🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@frontmcp/plugin-codecall

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontmcp/plugin-codecall - npm Package Compare versions

Comparing version
0.0.1
to
0.7.0
+42
codecall.plugin.d.ts
import { DynamicPlugin, FlowCtxOf, ProviderType } from '@frontmcp/sdk';
import { CodeCallPluginOptions, CodeCallPluginOptionsInput } from './codecall.types';
export default class CodeCallPlugin extends DynamicPlugin<CodeCallPluginOptions, CodeCallPluginOptionsInput> {
options: CodeCallPluginOptions;
constructor(options?: CodeCallPluginOptionsInput);
/**
* Dynamic providers allow you to configure the plugin with custom options
* without touching the plugin decorator.
*/
static dynamicProviders(options: CodeCallPluginOptionsInput): ProviderType[];
/**
* Hook into list_tools to enforce CodeCall modes:
*
* Modes:
* - codecall_only: Hide all tools from list_tools except CodeCall meta-tools.
* All other tools must be discovered via codecall:search.
* - codecall_opt_in: Show all tools in list_tools. Tools opt-in to CodeCall via metadata.
* - metadata_driven: Use per-tool metadata.codecall to control visibility in list_tools.
*
* CodeCall meta-tools (codecall:search, codecall:describe, codecall:execute, codecall:invoke)
* are ALWAYS visible regardless of mode.
*/
adjustListTools(flowCtx: FlowCtxOf<'tools:list-tools'>): Promise<void>;
/**
* Determine if a tool should be visible in list_tools based on mode.
*
* @param tool - The tool entry to check
* @param mode - The current CodeCall mode
* @returns true if tool should be visible
*/
private shouldShowInListTools;
/**
* Check if a tool is a CodeCall meta-tool.
* CodeCall meta-tools always remain visible.
*/
private isCodeCallTool;
/**
* Extract CodeCall-specific metadata from a tool.
*/
private getCodeCallMetadata;
}
//# sourceMappingURL=codecall.plugin.d.ts.map
{"version":3,"file":"codecall.plugin.d.ts","sourceRoot":"","sources":["../src/codecall.plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAyB,YAAY,EAAyB,MAAM,eAAe,CAAC;AAErH,OAAO,EAEL,qBAAqB,EACrB,0BAA0B,EAG3B,MAAM,kBAAkB,CAAC;AAgB1B,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,aAAa,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IAC1G,OAAO,EAAE,qBAAqB,CAAC;gBAEnB,OAAO,GAAE,0BAA+B;IAOpD;;;OAGG;WACa,gBAAgB,CAAC,OAAO,EAAE,0BAA0B,GAAG,YAAY,EAAE;IAuCrF;;;;;;;;;;;OAWG;IAEG,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,kBAAkB,CAAC;IAqB5D;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAkC7B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAKtB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAG5B"}
import { CodeCallVmPreset } from './codecall.types';
import type { ToolCallResult, CallToolOptions } from './errors';
export interface CodeCallAstValidationIssue {
kind: 'IllegalBuiltinAccess' | 'DisallowedGlobal' | 'DisallowedLoop' | 'ParseError';
message: string;
location?: {
line: number;
column: number;
};
identifier?: string;
}
export interface CodeCallAstValidationResult {
ok: boolean;
issues: CodeCallAstValidationIssue[];
transformedCode?: string;
}
/**
* Interface for the AST validator service
*/
export interface CodeCallAstValidator {
/**
* Validate a JavaScript script before execution
*/
validate(script: string): Promise<CodeCallAstValidationResult>;
}
/**
* Resolved VM options with all defaults applied.
* Plugins compute this once and pass into providers.
*/
export interface ResolvedCodeCallVmOptions {
preset: CodeCallVmPreset;
timeoutMs: number;
allowLoops: boolean;
maxSteps?: number;
disabledBuiltins: string[];
disabledGlobals: string[];
allowConsole: boolean;
}
/**
* Environment available to code running inside the VM.
* The plugin is responsible for wiring this to the underlying tool pipeline.
*/
export interface CodeCallVmEnvironment {
/**
* Call a tool from within AgentScript.
*
* @param name - Tool name (e.g., 'users:list')
* @param input - Tool input arguments
* @param options - Optional behavior configuration
* @param options.throwOnError - When true (default), throws on error.
* When false, returns { success, data, error }.
*
* SECURITY NOTES:
* - Cannot call 'codecall:*' tools (self-reference blocked)
* - Errors are sanitized - no stack traces or internal details exposed
* - Security guard errors (self-reference, access control) are NEVER catchable
*/
callTool: <TInput, TResult>(name: string, input: TInput, options?: CallToolOptions) => Promise<TResult | ToolCallResult<TResult>>;
getTool: (name: string) => {
name: string;
description?: string;
inputSchema: unknown;
outputSchema?: unknown | null;
} | undefined;
console?: Console;
mcpLog?: (level: 'debug' | 'info' | 'warn' | 'error', message: string, metadata?: Record<string, unknown>) => void;
mcpNotify?: (event: string, payload: Record<string, unknown>) => void;
}
/**
* Result from a tool search query
*/
export interface ToolSearchResult {
toolName: string;
appId?: string;
description: string;
relevanceScore: number;
}
/**
* Options for searching tools
*/
export interface ToolSearchOptions {
topK?: number;
appIds?: string[];
excludeToolNames?: string[];
}
/**
* Interface for the tool search service
*/
export interface ToolSearch {
/**
* Search for tools matching the query
*/
search(query: string, options?: ToolSearchOptions): Promise<ToolSearchResult[]>;
/**
* Check if a tool exists in the index
*/
hasTool(toolName: string): boolean;
/**
* Get the total number of indexed tools
*/
getTotalCount(): number;
/**
* Initialize the search index with tools
*/
initialize(): Promise<void>;
}
//# sourceMappingURL=codecall.symbol.d.ts.map
{"version":3,"file":"codecall.symbol.d.ts","sourceRoot":"","sources":["../src/codecall.symbol.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhE,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,YAAY,CAAC;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;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I,CAAC;IAEnH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACvE;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEhF;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAEnC;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC;IAExB;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B"}
import { z } from 'zod';
/**
* Tool info passed to the directCalls filter function
*/
export interface DirectCallsFilterToolInfo {
name: string;
appId?: string;
source?: string;
tags?: string[];
}
/**
* Tool info passed to the includeTools filter function
*/
export interface IncludeToolsFilterToolInfo {
name: string;
appId?: string;
source?: string;
description?: string;
tags?: string[];
}
/**
* Function type for directCalls filter
*/
export type DirectCallsFilterFn = (tool: DirectCallsFilterToolInfo) => boolean;
/**
* Function type for includeTools filter
*/
export type IncludeToolsFilterFn = (tool: IncludeToolsFilterToolInfo) => boolean;
export declare const codeCallModeSchema: z.ZodDefault<z.ZodEnum<{
codecall_only: "codecall_only";
codecall_opt_in: "codecall_opt_in";
metadata_driven: "metadata_driven";
}>>;
export declare const codeCallVmPresetSchema: z.ZodDefault<z.ZodEnum<{
locked_down: "locked_down";
secure: "secure";
balanced: "balanced";
experimental: "experimental";
}>>;
export declare const codeCallVmOptionsSchema: z.ZodDefault<z.ZodObject<{
preset: z.ZodDefault<z.ZodEnum<{
locked_down: "locked_down";
secure: "secure";
balanced: "balanced";
experimental: "experimental";
}>>;
timeoutMs: z.ZodOptional<z.ZodNumber>;
allowLoops: z.ZodOptional<z.ZodBoolean>;
maxSteps: z.ZodOptional<z.ZodNumber>;
disabledBuiltins: z.ZodOptional<z.ZodArray<z.ZodString>>;
disabledGlobals: z.ZodOptional<z.ZodArray<z.ZodString>>;
allowConsole: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
export declare const codeCallDirectCallsOptionsSchema: z.ZodObject<{
enabled: z.ZodBoolean;
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
filter: z.ZodOptional<z.ZodCustom<DirectCallsFilterFn, DirectCallsFilterFn>>;
}, z.core.$strip>;
export declare const embeddingStrategySchema: z.ZodDefault<z.ZodEnum<{
tfidf: "tfidf";
ml: "ml";
}>>;
export declare const synonymExpansionConfigSchema: z.ZodDefault<z.ZodObject<{
enabled: z.ZodDefault<z.ZodBoolean>;
additionalSynonyms: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
replaceDefaults: z.ZodDefault<z.ZodBoolean>;
maxExpansionsPerTerm: z.ZodDefault<z.ZodNumber>;
}, z.core.$strip>>;
export declare const codeCallEmbeddingOptionsSchema: z.ZodPipe<z.ZodOptional<z.ZodObject<{
strategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
tfidf: "tfidf";
ml: "ml";
}>>>;
modelName: z.ZodOptional<z.ZodString>;
cacheDir: z.ZodOptional<z.ZodString>;
useHNSW: z.ZodOptional<z.ZodBoolean>;
synonymExpansion: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodDefault<z.ZodObject<{
enabled: z.ZodDefault<z.ZodBoolean>;
additionalSynonyms: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
replaceDefaults: z.ZodDefault<z.ZodBoolean>;
maxExpansionsPerTerm: z.ZodDefault<z.ZodNumber>;
}, z.core.$strip>>]>>;
}, z.core.$strip>>, z.ZodTransform<{
strategy: "tfidf" | "ml";
modelName: string;
cacheDir: string;
useHNSW: boolean;
synonymExpansion: false | {
enabled: boolean;
replaceDefaults: boolean;
maxExpansionsPerTerm: number;
};
}, {
strategy?: "tfidf" | "ml" | undefined;
modelName?: string | undefined;
cacheDir?: string | undefined;
useHNSW?: boolean | undefined;
synonymExpansion?: false | {
enabled: boolean;
replaceDefaults: boolean;
maxExpansionsPerTerm: number;
additionalSynonyms?: string[][] | undefined;
} | undefined;
} | undefined>>;
export declare const codeCallSidecarOptionsSchema: z.ZodDefault<z.ZodObject<{
enabled: z.ZodDefault<z.ZodBoolean>;
maxTotalSize: z.ZodOptional<z.ZodNumber>;
maxReferenceSize: z.ZodOptional<z.ZodNumber>;
extractionThreshold: z.ZodOptional<z.ZodNumber>;
maxResolvedSize: z.ZodOptional<z.ZodNumber>;
allowComposites: z.ZodOptional<z.ZodBoolean>;
maxScriptLengthWhenDisabled: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
}, z.core.$strip>>;
declare const codeCallPluginOptionsObjectSchema: z.ZodObject<{
mode: z.ZodDefault<z.ZodEnum<{
codecall_only: "codecall_only";
codecall_opt_in: "codecall_opt_in";
metadata_driven: "metadata_driven";
}>>;
topK: z.ZodDefault<z.ZodNumber>;
maxDefinitions: z.ZodDefault<z.ZodNumber>;
includeTools: z.ZodOptional<z.ZodCustom<IncludeToolsFilterFn, IncludeToolsFilterFn>>;
directCalls: z.ZodOptional<z.ZodObject<{
enabled: z.ZodBoolean;
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
filter: z.ZodOptional<z.ZodCustom<DirectCallsFilterFn, DirectCallsFilterFn>>;
}, z.core.$strip>>;
vm: z.ZodDefault<z.ZodObject<{
preset: z.ZodDefault<z.ZodEnum<{
locked_down: "locked_down";
secure: "secure";
balanced: "balanced";
experimental: "experimental";
}>>;
timeoutMs: z.ZodOptional<z.ZodNumber>;
allowLoops: z.ZodOptional<z.ZodBoolean>;
maxSteps: z.ZodOptional<z.ZodNumber>;
disabledBuiltins: z.ZodOptional<z.ZodArray<z.ZodString>>;
disabledGlobals: z.ZodOptional<z.ZodArray<z.ZodString>>;
allowConsole: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
embedding: z.ZodPipe<z.ZodOptional<z.ZodObject<{
strategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
tfidf: "tfidf";
ml: "ml";
}>>>;
modelName: z.ZodOptional<z.ZodString>;
cacheDir: z.ZodOptional<z.ZodString>;
useHNSW: z.ZodOptional<z.ZodBoolean>;
synonymExpansion: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodDefault<z.ZodObject<{
enabled: z.ZodDefault<z.ZodBoolean>;
additionalSynonyms: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
replaceDefaults: z.ZodDefault<z.ZodBoolean>;
maxExpansionsPerTerm: z.ZodDefault<z.ZodNumber>;
}, z.core.$strip>>]>>;
}, z.core.$strip>>, z.ZodTransform<{
strategy: "tfidf" | "ml";
modelName: string;
cacheDir: string;
useHNSW: boolean;
synonymExpansion: false | {
enabled: boolean;
replaceDefaults: boolean;
maxExpansionsPerTerm: number;
};
}, {
strategy?: "tfidf" | "ml" | undefined;
modelName?: string | undefined;
cacheDir?: string | undefined;
useHNSW?: boolean | undefined;
synonymExpansion?: false | {
enabled: boolean;
replaceDefaults: boolean;
maxExpansionsPerTerm: number;
additionalSynonyms?: string[][] | undefined;
} | undefined;
} | undefined>>;
sidecar: z.ZodDefault<z.ZodObject<{
enabled: z.ZodDefault<z.ZodBoolean>;
maxTotalSize: z.ZodOptional<z.ZodNumber>;
maxReferenceSize: z.ZodOptional<z.ZodNumber>;
extractionThreshold: z.ZodOptional<z.ZodNumber>;
maxResolvedSize: z.ZodOptional<z.ZodNumber>;
allowComposites: z.ZodOptional<z.ZodBoolean>;
maxScriptLengthWhenDisabled: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
}, z.core.$strip>>;
}, z.core.$strip>;
export declare const codeCallPluginOptionsSchema: z.ZodPrefault<z.ZodObject<{
mode: z.ZodDefault<z.ZodEnum<{
codecall_only: "codecall_only";
codecall_opt_in: "codecall_opt_in";
metadata_driven: "metadata_driven";
}>>;
topK: z.ZodDefault<z.ZodNumber>;
maxDefinitions: z.ZodDefault<z.ZodNumber>;
includeTools: z.ZodOptional<z.ZodCustom<IncludeToolsFilterFn, IncludeToolsFilterFn>>;
directCalls: z.ZodOptional<z.ZodObject<{
enabled: z.ZodBoolean;
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
filter: z.ZodOptional<z.ZodCustom<DirectCallsFilterFn, DirectCallsFilterFn>>;
}, z.core.$strip>>;
vm: z.ZodDefault<z.ZodObject<{
preset: z.ZodDefault<z.ZodEnum<{
locked_down: "locked_down";
secure: "secure";
balanced: "balanced";
experimental: "experimental";
}>>;
timeoutMs: z.ZodOptional<z.ZodNumber>;
allowLoops: z.ZodOptional<z.ZodBoolean>;
maxSteps: z.ZodOptional<z.ZodNumber>;
disabledBuiltins: z.ZodOptional<z.ZodArray<z.ZodString>>;
disabledGlobals: z.ZodOptional<z.ZodArray<z.ZodString>>;
allowConsole: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
embedding: z.ZodPipe<z.ZodOptional<z.ZodObject<{
strategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
tfidf: "tfidf";
ml: "ml";
}>>>;
modelName: z.ZodOptional<z.ZodString>;
cacheDir: z.ZodOptional<z.ZodString>;
useHNSW: z.ZodOptional<z.ZodBoolean>;
synonymExpansion: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodDefault<z.ZodObject<{
enabled: z.ZodDefault<z.ZodBoolean>;
additionalSynonyms: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
replaceDefaults: z.ZodDefault<z.ZodBoolean>;
maxExpansionsPerTerm: z.ZodDefault<z.ZodNumber>;
}, z.core.$strip>>]>>;
}, z.core.$strip>>, z.ZodTransform<{
strategy: "tfidf" | "ml";
modelName: string;
cacheDir: string;
useHNSW: boolean;
synonymExpansion: false | {
enabled: boolean;
replaceDefaults: boolean;
maxExpansionsPerTerm: number;
};
}, {
strategy?: "tfidf" | "ml" | undefined;
modelName?: string | undefined;
cacheDir?: string | undefined;
useHNSW?: boolean | undefined;
synonymExpansion?: false | {
enabled: boolean;
replaceDefaults: boolean;
maxExpansionsPerTerm: number;
additionalSynonyms?: string[][] | undefined;
} | undefined;
} | undefined>>;
sidecar: z.ZodDefault<z.ZodObject<{
enabled: z.ZodDefault<z.ZodBoolean>;
maxTotalSize: z.ZodOptional<z.ZodNumber>;
maxReferenceSize: z.ZodOptional<z.ZodNumber>;
extractionThreshold: z.ZodOptional<z.ZodNumber>;
maxResolvedSize: z.ZodOptional<z.ZodNumber>;
allowComposites: z.ZodOptional<z.ZodBoolean>;
maxScriptLengthWhenDisabled: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
}, z.core.$strip>>;
}, z.core.$strip>>;
export type CodeCallMode = z.infer<typeof codeCallModeSchema>;
export type CodeCallVmPreset = z.infer<typeof codeCallVmPresetSchema>;
export type CodeCallVmOptions = z.infer<typeof codeCallVmOptionsSchema>;
export type CodeCallDirectCallsOptions = z.infer<typeof codeCallDirectCallsOptionsSchema>;
export type EmbeddingStrategy = z.infer<typeof embeddingStrategySchema>;
export type SynonymExpansionConfig = z.infer<typeof synonymExpansionConfigSchema>;
export type CodeCallSidecarOptions = z.infer<typeof codeCallSidecarOptionsSchema>;
export type CodeCallEmbeddingOptions = z.infer<typeof codeCallEmbeddingOptionsSchema>;
export type CodeCallEmbeddingOptionsInput = z.input<typeof codeCallEmbeddingOptionsSchema>;
/**
* Resolved options type (after parsing with defaults applied).
* Use this for internal plugin logic where all defaults are guaranteed.
*/
export type CodeCallPluginOptions = z.infer<typeof codeCallPluginOptionsSchema>;
/**
* Input options type (what users provide to init()).
* All fields with defaults are optional.
*/
export type CodeCallPluginOptionsInput = z.input<typeof codeCallPluginOptionsObjectSchema>;
/**
* Per-tool metadata used by CodeCall.
* This maps to `metadata.codecall` on tools.
*/
export interface CodeCallToolMetadata {
/**
* If true, this tool stays visible in `list_tools`
* even when CodeCall is hiding most tools.
*/
visibleInListTools?: boolean;
/**
* Whether this tool can be used via CodeCall.
* Semantics depend on CodeCallMode (see README).
*/
enabledInCodeCall?: boolean;
/** Optional extra indexing hints */
appId?: string;
source?: string;
tags?: string[];
}
export type CodeCallSearchInput = {
query: string;
topK?: number;
filter?: {
appIds?: string[];
tags?: string[];
includeOpenApi?: boolean;
includeInline?: boolean;
};
};
export type CodeCallSearchResult = {
tools: {
name: string;
description: string;
appId?: string;
source?: string;
score: number;
}[];
};
export type CodeCallDescribeInput = {
tools: string[];
max?: number;
};
export type CodeCallDescribeResult = {
tools: {
name: string;
description: string;
inputSchema: unknown;
outputSchema?: unknown | null;
examples?: {
input: unknown;
output?: unknown;
}[];
}[];
};
export type CodeCallExecuteInput = {
script: string;
/**
* Arbitrary, readonly context exposed as `codecallContext`.
*/
context?: Record<string, unknown>;
};
declare global {
interface ExtendFrontMcpToolMetadata {
/**
* CodeCall-specific metadata, attached via `@Tool({ metadata: { codecall: ... } })`
* or whatever your decorator mapping is.
*/
codecall?: CodeCallToolMetadata;
}
}
export {};
//# sourceMappingURL=codecall.types.d.ts.map
{"version":3,"file":"codecall.types.d.ts","sourceRoot":"","sources":["../src/codecall.types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,M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":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC"}
/**
* Error codes exposed to AgentScript via result-based error handling.
* These are the ONLY error codes scripts can see - no internal details.
*/
export declare const TOOL_CALL_ERROR_CODES: {
readonly NOT_FOUND: "NOT_FOUND";
readonly VALIDATION: "VALIDATION";
readonly EXECUTION: "EXECUTION";
readonly TIMEOUT: "TIMEOUT";
readonly ACCESS_DENIED: "ACCESS_DENIED";
readonly SELF_REFERENCE: "SELF_REFERENCE";
};
export type ToolCallErrorCode = (typeof TOOL_CALL_ERROR_CODES)[keyof typeof TOOL_CALL_ERROR_CODES];
/**
* Sanitized error structure exposed to AgentScript.
* Contains NO stack traces, NO internal details, NO sensitive information.
*/
export interface ToolCallError {
readonly code: ToolCallErrorCode;
readonly message: string;
readonly toolName: string;
}
/**
* Result type for callTool when throwOnError is false.
*/
export type ToolCallResult<T> = {
success: true;
data: T;
} | {
success: false;
error: ToolCallError;
};
/**
* Options for callTool behavior.
*/
export interface CallToolOptions {
/**
* When true (default), errors are thrown and can be caught.
* When false, errors are returned as { success: false, error: ToolCallError }.
*
* SECURITY: Even when throwOnError is true, only sanitized errors are thrown.
* Internal security guard errors are NEVER exposed to scripts.
*/
throwOnError?: boolean;
}
/**
* Creates a sanitized ToolCallError for script consumption.
* This function ensures no internal details leak to AgentScript.
*/
export declare function createToolCallError(code: ToolCallErrorCode, toolName: string, rawMessage?: string): ToolCallError;
/**
* FATAL: Self-reference attack detected.
* This error is thrown internally and causes immediate execution termination.
* The script NEVER sees this error - it only sees the sanitized version.
*/
export declare class SelfReferenceError extends Error {
readonly code: "SELF_REFERENCE";
readonly toolName: string;
constructor(toolName: string);
}
/**
* Internal error for tool access denial.
* Only the sanitized version is exposed to scripts.
*/
export declare class ToolAccessDeniedError extends Error {
readonly code: "ACCESS_DENIED";
readonly toolName: string;
readonly reason: string;
constructor(toolName: string, reason: string);
}
/**
* Internal error for tool not found.
* Only the sanitized version is exposed to scripts.
*/
export declare class ToolNotFoundError extends Error {
readonly code: "NOT_FOUND";
readonly toolName: string;
constructor(toolName: string);
}
//# sourceMappingURL=tool-call.errors.d.ts.map
{"version":3,"file":"tool-call.errors.d.ts","sourceRoot":"","sources":["../../src/errors/tool-call.errors.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;CAOxB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAEnG;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,CAAC;AAEtG;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,aAAa,CASjH;AAwDD;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,mBAAwC;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,QAAQ,EAAE,MAAM;CAM7B;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,kBAAuC;IACpD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAO7C;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,cAAmC;IAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,QAAQ,EAAE,MAAM;CAM7B"}

Sorry, the diff of this file is too big to display

{
"name": "@frontmcp/plugin-codecall",
"version": "0.7.0",
"description": "CodeCall plugin for FrontMCP - AgentScript-based meta-tools for orchestrating MCP tools",
"author": "AgentFront <info@agentfront.dev>",
"license": "Apache-2.0",
"keywords": [
"mcp",
"codecall",
"orchestration",
"meta-tools",
"plugin",
"frontmcp",
"agentfront"
],
"repository": {
"type": "git",
"url": "git+https://github.com/agentfront/frontmcp.git",
"directory": "plugins/plugin-codecall"
},
"bugs": {
"url": "https://github.com/agentfront/frontmcp/issues"
},
"homepage": "https://github.com/agentfront/frontmcp/blob/main/plugins/plugin-codecall/README.md",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"type": "module",
"main": "../index.js",
"module": "./index.mjs",
"types": "../index.d.ts",
"sideEffects": false,
"exports": {
"./package.json": "../package.json",
".": {
"require": {
"types": "../index.d.ts",
"default": "../index.js"
},
"import": {
"types": "../index.d.ts",
"default": "./index.mjs"
}
}
},
"dependencies": {
"enclave-vm": "^2.7.0",
"vectoriadb": "^2.0.2",
"@frontmcp/sdk": "0.7.0",
"zod": "^4.0.0"
},
"peerDependencies": {
"@frontmcp/plugin-cache": "0.7.0"
},
"devDependencies": {
"reflect-metadata": "^0.2.2"
}
}
export { default, default as CodeCallPlugin } from './codecall.plugin';
export * from './codecall.types';
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,cAAc,kBAAkB,CAAC"}

Sorry, the diff of this file is too big to display

import { BaseConfig } from '@frontmcp/sdk';
import { CodeCallPluginOptions } from '../codecall.types';
import { ResolvedCodeCallVmOptions } from '../codecall.symbol';
/**
* CodeCall configuration provider with convict-like API
* Extends BaseConfig to provide type-safe dotted path access
*
* @example
* // Get values with dotted path notation
* config.get('vm.preset') // returns 'secure'
* config.get('embedding.strategy') // returns 'tfidf'
* config.get('directCalls.enabled') // returns true
*
* // Get with default value
* config.get('vm.timeoutMs', 5000) // returns value or 5000
*
* // Get entire sections
* config.getSection('vm') // returns entire vm config
* config.getAll() // returns complete config
*
* // Require values (throws if undefined)
* config.getOrThrow('mode') // throws if undefined
* config.getRequired('topK') // same as getOrThrow
*/
export default class CodeCallConfig extends BaseConfig<CodeCallPluginOptions & {
resolvedVm: ResolvedCodeCallVmOptions;
}> {
constructor(options?: Partial<CodeCallPluginOptions>);
}
//# sourceMappingURL=code-call.config.d.ts.map
{"version":3,"file":"code-call.config.d.ts","sourceRoot":"","sources":["../../src/providers/code-call.config.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,UAAU,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EACL,qBAAqB,EAItB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CACpD,qBAAqB,GAAG;IAAE,UAAU,EAAE,yBAAyB,CAAA;CAAE,CAClE;gBACa,OAAO,GAAE,OAAO,CAAC,qBAAqB,CAAM;CASzD"}
export * from './self-reference-guard';
export * from './tool-access-control.service';
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC"}
/**
* Check if a tool name is a CodeCall plugin tool that should be blocked.
*
* SECURITY: This is the FIRST check in callTool before ANY other processing.
* It prevents:
* - Recursive execution attacks (codecall:execute calling itself)
* - Privilege escalation via nested tool calls
* - Resource exhaustion through self-invocation loops
*
* @param toolName - The name of the tool being called
* @returns true if the tool is a blocked CodeCall tool
*/
export declare function isBlockedSelfReference(toolName: string): boolean;
/**
* Assert that a tool call is not a self-reference.
* Throws SelfReferenceError if the tool is blocked.
*
* SECURITY: This function MUST be called at the very start of callTool,
* before any other validation or processing.
*
* @param toolName - The name of the tool being called
* @throws SelfReferenceError if the tool is a blocked CodeCall tool
*/
export declare function assertNotSelfReference(toolName: string): void;
/**
* Get the list of blocked tool patterns for documentation/testing.
* This is informational only - the actual blocking uses isBlockedSelfReference().
*/
export declare function getBlockedPatterns(): {
prefix: string;
explicit: readonly string[];
};
//# sourceMappingURL=self-reference-guard.d.ts.map
{"version":3,"file":"self-reference-guard.d.ts","sourceRoot":"","sources":["../../src/security/self-reference-guard.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAehE;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAI7D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAKpF"}
import type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
/**
* Tool access control modes:
* - whitelist: Only explicitly allowed tools can be called (most secure)
* - blacklist: All tools allowed except explicitly blocked (default, more flexible)
* - dynamic: Evaluate access per-call based on custom function
*/
export type ToolAccessMode = 'whitelist' | 'blacklist' | 'dynamic';
/**
* Tool access policy configuration.
*/
export interface ToolAccessPolicy {
/**
* Access control mode.
* @default 'blacklist'
*/
mode: ToolAccessMode;
/**
* Tools explicitly allowed (for whitelist mode).
* Supports exact names and glob patterns (e.g., 'users:*').
*/
whitelist?: string[];
/**
* Tools explicitly blocked (for blacklist mode).
* Supports exact names and glob patterns (e.g., 'admin:*').
*/
blacklist?: string[];
/**
* Pattern-based rules that apply in addition to whitelist/blacklist.
*/
patterns?: {
allow?: string[];
deny?: string[];
};
/**
* Custom evaluator function for dynamic mode.
* Called for each tool access request.
*/
evaluator?: (context: ToolAccessContext) => Promise<ToolAccessDecision>;
}
/**
* Context provided to the access evaluator.
*/
export interface ToolAccessContext {
toolName: string;
authInfo?: AuthInfo;
executionId?: string;
callDepth: number;
timestamp: number;
}
/**
* Decision from the access control check.
*/
export interface ToolAccessDecision {
allowed: boolean;
reason?: string;
}
/**
* Tool Access Control Service
*
* Provides centralized access control for tool calls within CodeCall.
* Implements a layered security model:
*
* 1. Self-reference blocking (handled separately in self-reference-guard.ts)
* 2. Default blacklist (always enforced)
* 3. User-configured whitelist/blacklist
* 4. Pattern matching (glob patterns)
* 5. Dynamic evaluation (if configured)
*/
export declare class ToolAccessControlService {
private readonly policy;
private readonly whitelistSet;
private readonly blacklistSet;
private readonly allowPatterns;
private readonly denyPatterns;
constructor(policy?: ToolAccessPolicy);
/**
* Check if a tool can be accessed.
*
* @param toolName - The tool being accessed
* @param context - Optional access context for dynamic evaluation
* @returns Decision indicating if access is allowed
*/
checkAccess(toolName: string, context?: Partial<ToolAccessContext>): Promise<ToolAccessDecision>;
private checkWhitelistMode;
private checkBlacklistMode;
private checkDynamicMode;
/**
* Check if a tool name matches any entry in a set (supports glob patterns).
*/
private isInSet;
/**
* Convert a glob pattern to a RegExp.
* Supports: * (any characters), ? (single character)
*
* Security: Prevents ReDoS by limiting pattern complexity and using non-greedy matching.
*/
private globToRegex;
/**
* Get the current policy configuration (for debugging/testing).
*/
getPolicy(): Readonly<ToolAccessPolicy>;
}
export default ToolAccessControlService;
//# sourceMappingURL=tool-access-control.service.d.ts.map
{"version":3,"file":"tool-access-control.service.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,CAAC,EAAE,gBAAgB;IAWrC;;;;;;OAMG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAsCxF,kBAAkB;YAqBlB,kBAAkB;YAelB,gBAAgB;IAS9B;;OAEG;IACH,OAAO,CAAC,OAAO;IAmBf;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAenB;;OAEG;IACH,SAAS,IAAI,QAAQ,CAAC,gBAAgB,CAAC;CAGxC;AAED,eAAe,wBAAwB,CAAC"}
/**
* Audit event types for CodeCall operations.
*/
export declare const AUDIT_EVENT_TYPES: {
/** Script execution started */
readonly EXECUTION_START: "codecall:execution:start";
/** Script execution completed successfully */
readonly EXECUTION_SUCCESS: "codecall:execution:success";
/** Script execution failed */
readonly EXECUTION_FAILURE: "codecall:execution:failure";
/** Script execution timed out */
readonly EXECUTION_TIMEOUT: "codecall:execution:timeout";
/** Tool call initiated from script */
readonly TOOL_CALL_START: "codecall:tool:call:start";
/** Tool call completed successfully */
readonly TOOL_CALL_SUCCESS: "codecall:tool:call:success";
/** Tool call failed */
readonly TOOL_CALL_FAILURE: "codecall:tool:call:failure";
/** Self-reference attack blocked */
readonly SECURITY_SELF_REFERENCE: "codecall:security:self-reference";
/** Tool access denied */
readonly SECURITY_ACCESS_DENIED: "codecall:security:access-denied";
/** AST validation failed (blocked code pattern) */
readonly SECURITY_AST_BLOCKED: "codecall:security:ast-blocked";
/** Search performed */
readonly SEARCH_PERFORMED: "codecall:search:performed";
/** Tool described */
readonly DESCRIBE_PERFORMED: "codecall:describe:performed";
/** Direct invoke performed */
readonly INVOKE_PERFORMED: "codecall:invoke:performed";
};
export type AuditEventType = (typeof AUDIT_EVENT_TYPES)[keyof typeof AUDIT_EVENT_TYPES];
/**
* Base audit event structure.
*/
export interface AuditEvent {
/** Event type */
type: AuditEventType;
/** ISO timestamp */
timestamp: string;
/** Unique execution ID for correlation */
executionId: string;
/** Duration in milliseconds (if applicable) */
durationMs?: number;
/** Additional event-specific data */
data?: Record<string, unknown>;
}
/**
* Execution audit event with script details.
*/
export interface ExecutionAuditEvent extends AuditEvent {
type: typeof AUDIT_EVENT_TYPES.EXECUTION_START | typeof AUDIT_EVENT_TYPES.EXECUTION_SUCCESS | typeof AUDIT_EVENT_TYPES.EXECUTION_FAILURE | typeof AUDIT_EVENT_TYPES.EXECUTION_TIMEOUT;
data: {
/** Script hash (NOT the full script - security!) */
scriptHash: string;
/** Script length in characters */
scriptLength: number;
/** Number of tool calls made */
toolCallCount?: number;
/** Error message (sanitized) if failed */
error?: string;
};
}
/**
* Tool call audit event.
*/
export interface ToolCallAuditEvent extends AuditEvent {
type: typeof AUDIT_EVENT_TYPES.TOOL_CALL_START | typeof AUDIT_EVENT_TYPES.TOOL_CALL_SUCCESS | typeof AUDIT_EVENT_TYPES.TOOL_CALL_FAILURE;
data: {
/** Tool name */
toolName: string;
/** Call depth (nested calls) */
callDepth: number;
/** Error code if failed */
errorCode?: string;
};
}
/**
* Security audit event.
*/
export interface SecurityAuditEvent extends AuditEvent {
type: typeof AUDIT_EVENT_TYPES.SECURITY_SELF_REFERENCE | typeof AUDIT_EVENT_TYPES.SECURITY_ACCESS_DENIED | typeof AUDIT_EVENT_TYPES.SECURITY_AST_BLOCKED;
data: {
/** What was blocked */
blocked: string;
/** Reason for blocking */
reason: string;
};
}
/**
* Audit event listener function type.
*/
export type AuditEventListener = (event: AuditEvent) => void;
/**
* Audit Logger Service
*
* Provides centralized audit logging for all CodeCall operations.
* Uses the SDK event emitter pattern for integration with external systems.
*
* Security considerations:
* - NEVER logs full scripts (only hashes)
* - NEVER logs tool inputs/outputs (only metadata)
* - NEVER logs sensitive error details (only sanitized messages)
* - All events include execution ID for correlation
*/
export declare class AuditLoggerService {
private listeners;
private executionCounter;
/**
* Subscribe to audit events.
*
* @param listener - Function to call when events occur
* @returns Unsubscribe function
*/
subscribe(listener: AuditEventListener): () => void;
/**
* Generate a unique execution ID.
*/
generateExecutionId(): string;
/**
* Log execution start.
*/
logExecutionStart(executionId: string, script: string): void;
/**
* Log execution success.
*/
logExecutionSuccess(executionId: string, script: string, durationMs: number, toolCallCount: number): void;
/**
* Log execution failure.
*/
logExecutionFailure(executionId: string, script: string, durationMs: number, error: string): void;
/**
* Log execution timeout.
*/
logExecutionTimeout(executionId: string, script: string, durationMs: number): void;
/**
* Log tool call start.
*/
logToolCallStart(executionId: string, toolName: string, callDepth: number): void;
/**
* Log tool call success.
*/
logToolCallSuccess(executionId: string, toolName: string, callDepth: number, durationMs: number): void;
/**
* Log tool call failure.
*/
logToolCallFailure(executionId: string, toolName: string, callDepth: number, durationMs: number, errorCode: string): void;
/**
* Log security event: self-reference blocked.
*/
logSecuritySelfReference(executionId: string, toolName: string): void;
/**
* Log security event: access denied.
*/
logSecurityAccessDenied(executionId: string, toolName: string, reason: string): void;
/**
* Log security event: AST validation blocked.
*/
logSecurityAstBlocked(executionId: string, pattern: string, reason: string): void;
/**
* Log search operation.
*/
logSearch(executionId: string, query: string, resultCount: number, durationMs: number): void;
/**
* Log describe operation.
*/
logDescribe(executionId: string, toolNames: string[], durationMs: number): void;
/**
* Log invoke operation.
*/
logInvoke(executionId: string, toolName: string, success: boolean, durationMs: number): void;
/**
* Emit an audit event to all listeners.
*/
private emit;
/**
* Create a simple hash of the script for identification.
* Uses a fast, non-cryptographic hash for performance.
*/
private hashScript;
/**
* Sanitize error messages to remove sensitive information.
*/
private sanitizeError;
}
export default AuditLoggerService;
//# sourceMappingURL=audit-logger.service.d.ts.map
{"version":3,"file":"audit-logger.service.d.ts","sourceRoot":"","sources":["../../src/services/audit-logger.service.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC5B,+BAA+B;;IAE/B,8CAA8C;;IAE9C,8BAA8B;;IAE9B,iCAAiC;;IAGjC,sCAAsC;;IAEtC,uCAAuC;;IAEvC,uBAAuB;;IAGvB,oCAAoC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,GAAG,IAAI;IAYhF;;OAEG;IACH,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAatG;;OAEG;IACH,kBAAkB,CAChB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,IAAI;IAcP;;OAEG;IACH,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAYrE;;OAEG;IACH,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAYpF;;OAEG;IACH,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAYjF;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAa5F;;OAEG;IACH,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAa/E;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAa5F;;OAEG;IACH,OAAO,CAAC,IAAI;IAaZ;;;OAGG;IACH,OAAO,CAAC,UAAU;IAUlB;;OAEG;IACH,OAAO,CAAC,aAAa;CAmBtB;AAED,eAAe,kBAAkB,CAAC"}
import type CodeCallConfig from '../providers/code-call.config';
import type { CodeCallVmEnvironment } from '../codecall.symbol';
/**
* Result from enclave execution - maps to existing VmExecutionResult interface
*/
export interface EnclaveExecutionResult {
success: boolean;
result?: unknown;
error?: {
message: string;
name: string;
stack?: string;
code?: string;
toolName?: string;
toolInput?: unknown;
details?: unknown;
[key: string]: unknown;
};
logs: string[];
timedOut: boolean;
stats?: {
duration: number;
toolCallCount: number;
iterationCount: number;
};
}
/**
* Service for executing AgentScript code using enclave-vm
*
* This service wraps the Enclave class and provides:
* - Safe AgentScript execution with AST validation
* - Automatic code transformation (callTool -> __safe_callTool)
* - Runtime limits (timeout, iterations, tool calls)
* - Tool call integration with FrontMCP pipeline
*/
/**
* Error thrown when script exceeds maximum length and sidecar is disabled
*/
export declare class ScriptTooLargeError extends Error {
readonly code = "SCRIPT_TOO_LARGE";
readonly scriptLength: number;
readonly maxLength: number;
constructor(scriptLength: number, maxLength: number);
}
export default class EnclaveService {
private readonly vmOptions;
private readonly sidecarOptions;
constructor(config: CodeCallConfig);
/**
* Execute AgentScript code in the enclave
*
* @param code - The AgentScript code to execute (raw, not transformed)
* @param environment - The VM environment with callTool, getTool, etc.
* @returns Execution result with success/error and logs
* @throws ScriptTooLargeError if script exceeds max length and sidecar is disabled
*/
execute(code: string, environment: CodeCallVmEnvironment): Promise<EnclaveExecutionResult>;
/**
* Map Enclave ExecutionResult to EnclaveExecutionResult
*/
private mapEnclaveResult;
}
//# sourceMappingURL=enclave.service.d.ts.map
{"version":3,"file":"enclave.service.d.ts","sourceRoot":"","sources":["../../src/services/enclave.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAA6B,MAAM,oBAAoB,CAAC;AAG3F;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED;;;;;;;;GAQG;AACH;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CASpD;AAOD,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyB;gBAE5C,MAAM,EAAE,cAAc;IAOlC;;;;;;;OAOG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA8EhG;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAuEzB"}
/**
* Error categories for classification.
*/
export declare const ERROR_CATEGORIES: {
/** Script syntax or parsing error */
readonly SYNTAX: "syntax";
/** AST validation blocked dangerous code */
readonly SECURITY: "security";
/** Script exceeded timeout */
readonly TIMEOUT: "timeout";
/** Tool not found */
readonly TOOL_NOT_FOUND: "tool_not_found";
/** Tool access denied */
readonly TOOL_ACCESS_DENIED: "tool_access_denied";
/** Tool validation error */
readonly TOOL_VALIDATION: "tool_validation";
/** Tool execution error */
readonly TOOL_EXECUTION: "tool_execution";
/** Runtime error in script */
readonly RUNTIME: "runtime";
/** Unknown error */
readonly UNKNOWN: "unknown";
};
export type ErrorCategory = (typeof ERROR_CATEGORIES)[keyof typeof ERROR_CATEGORIES];
/**
* Enriched error with actionable suggestions.
*/
export interface EnrichedError {
/** Error category */
category: ErrorCategory;
/** User-friendly error message */
message: string;
/** Actionable suggestions for fixing the error */
suggestions: string[];
/** Related documentation links */
docs?: string[];
/** Example of correct usage (if applicable) */
example?: string;
/** Original error code (if available) */
code?: string;
/** Whether the error is recoverable */
recoverable: boolean;
}
/**
* Error Enrichment Service
*
* Transforms raw errors into user-friendly, actionable error messages.
* Provides suggestions for fixing common errors and links to documentation.
*
* Security: Never exposes internal details, only provides helpful guidance.
*/
export declare class ErrorEnrichmentService {
/**
* Enrich an error with category, suggestions, and examples.
*
* @param error - The error to enrich (Error object, string, or unknown)
* @param context - Optional context for more specific suggestions
* @returns Enriched error with actionable information
*/
enrich(error: unknown, context?: {
toolName?: string;
scriptSnippet?: string;
}): EnrichedError;
/**
* Enrich a tool-specific error.
*/
enrichToolError(toolName: string, errorCode: string, rawMessage?: string): EnrichedError;
/**
* Create a brief error summary for logging.
*/
summarize(error: unknown): string;
/**
* Extract error message from various error types.
*/
private extractMessage;
/**
* Extract error code if available.
*/
private extractCode;
/**
* Format error message for user consumption.
* Removes technical details while keeping useful information.
*/
private formatMessage;
/**
* Get a human-readable prefix for error category.
*/
private getCategoryPrefix;
/**
* Contextualize suggestions based on context.
*/
private contextualizeSuggestions;
}
export default ErrorEnrichmentService;
//# sourceMappingURL=error-enrichment.service.d.ts.map
{"version":3,"file":"error-enrichment.service.d.ts","sourceRoot":"","sources":["../../src/services/error-enrichment.service.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B,qCAAqC;;IAErC,4CAA4C;;IAE5C,8BAA8B;;IAE9B,qBAAqB;;IA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enrichment.service';
export * from './tool-search.service';
export * from './synonym-expansion.service';
export { default as EnclaveService } from './enclave.service';
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
/**
* Output Sanitizer for CodeCall
*
* Sanitizes script outputs to prevent information leakage through:
* - Error messages with stack traces or file paths
* - Large outputs that could contain sensitive data
* - Recursive structures that could cause DoS
*
* Security considerations:
* - All sanitization is defensive (fail-safe)
* - Outputs are truncated, not rejected
* - Circular references are handled
* - Prototype pollution is prevented
*/
/**
* Configuration for output sanitization.
*/
export interface OutputSanitizerConfig {
/**
* Maximum depth for nested objects/arrays.
* @default 10
*/
maxDepth: number;
/**
* Maximum length for string values.
* @default 10000
*/
maxStringLength: number;
/**
* Maximum number of keys in an object.
* @default 100
*/
maxObjectKeys: number;
/**
* Maximum number of items in an array.
* @default 1000
*/
maxArrayLength: number;
/**
* Maximum total size of serialized output in bytes.
* @default 1MB
*/
maxTotalSize: number;
/**
* Remove error stack traces.
* @default true
*/
removeStackTraces: boolean;
/**
* Remove file paths from strings.
* @default true
*/
removeFilePaths: boolean;
}
/**
* Default sanitization configuration.
*/
export declare const DEFAULT_SANITIZER_CONFIG: OutputSanitizerConfig;
/**
* Result of sanitization.
*/
export interface SanitizationResult<T> {
/** Sanitized value */
value: T;
/** Whether any sanitization was applied */
wasModified: boolean;
/** Warnings about what was sanitized */
warnings: string[];
}
/**
* Sanitize output from CodeCall script execution.
*
* @param output - Raw output from script
* @param config - Sanitization configuration
* @returns Sanitized output with metadata
*/
export declare function sanitizeOutput<T = unknown>(output: unknown, config?: Partial<OutputSanitizerConfig>): SanitizationResult<T>;
/**
* Quick check if a value needs sanitization.
* Used for optimization - skip sanitization for simple values.
*/
export declare function needsSanitization(value: unknown): boolean;
/**
* Sanitize a log message (less aggressive than output sanitization).
*/
export declare function sanitizeLogMessage(message: string, maxLength?: number): string;
//# sourceMappingURL=output-sanitizer.d.ts.map
{"version":3,"file":"output-sanitizer.d.ts","sourceRoot":"","sources":["../../src/services/output-sanitizer.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,qBAQrC,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,sBAAsB;IACtB,KAAK,EAAE,CAAC,CAAC;IACT,2CAA2C;IAC3C,WAAW,EAAE,OAAO,CAAC;IACrB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,OAAO,EACxC,MAAM,EAAE,OAAO,EACf,MAAM,GAAE,OAAO,CAAC,qBAAqB,CAAM,GAC1C,kBAAkB,CAAC,CAAC,CAAC,CAiCvB;AAyND;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAgBzD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,SAAM,GAAG,MAAM,CAoB3E"}
/**
* Configuration for the SynonymExpansionService
*/
export interface SynonymExpansionConfig {
/**
* Additional synonym groups to include beyond defaults.
* Each group is an array of related terms.
*/
additionalSynonyms?: ReadonlyArray<ReadonlyArray<string>>;
/**
* If true, completely replace default synonyms with additionalSynonyms.
* @default false
*/
replaceDefaults?: boolean;
/**
* Maximum number of expanded terms per input term.
* Prevents query explosion.
* @default 5
*/
maxExpansionsPerTerm?: number;
}
/**
* Lightweight synonym expansion service for improving TF-IDF search relevance.
* Zero dependencies, synchronous, and easily extensible.
*
* This service provides query-time synonym expansion to help TF-IDF-based
* search understand that semantically similar terms (like "add" and "create")
* should match the same tools.
*/
export declare class SynonymExpansionService {
private synonymMap;
private maxExpansions;
constructor(config?: SynonymExpansionConfig);
/**
* Build a bidirectional synonym map from groups.
* Each term maps to all other terms in its group(s).
*/
private buildSynonymMap;
/**
* Get synonyms for a single term.
* Returns empty array if no synonyms found.
*
* @example
* getSynonyms('add') // ['create', 'new', 'insert', 'make']
*/
getSynonyms(term: string): string[];
/**
* Expand a query string by adding synonyms for each term.
* Returns the expanded query string with original terms and their synonyms.
*
* @example
* expandQuery('add user') // 'add create new insert make user account member profile'
*/
expandQuery(query: string): string;
/**
* Check if synonym expansion is available for any term in the query.
*/
hasExpansions(query: string): boolean;
/**
* Get statistics about the synonym dictionary.
*/
getStats(): {
termCount: number;
avgSynonymsPerTerm: number;
};
}
//# sourceMappingURL=synonym-expansion.service.d.ts.map
{"version":3,"file":"synonym-expansion.service.d.ts","sourceRoot":"","sources":["../../src/services/synonym-expansion.service.ts"],"names":[],"mappings":"AAoTA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1D;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,aAAa,CAAS;gBAElB,MAAM,GAAE,sBAA2B;IAW/C;;;OAGG;IACH,OAAO,CAAC,eAAe;IAwBvB;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;IAYnC;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAoBlC;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAKrC;;OAEG;IACH,QAAQ,IAAI;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE;CAa9D"}
import { ToolEntry, ScopeEntry } from '@frontmcp/sdk';
import type { EmbeddingStrategy, CodeCallEmbeddingOptions, CodeCallMode } from '../codecall.types';
import type { ToolSearch, ToolSearchResult as SymbolToolSearchResult, ToolSearchOptions as SymbolToolSearchOptions } from '../codecall.symbol';
import { SynonymExpansionConfig } from './synonym-expansion.service';
/**
* Search result for tool search
*/
export interface SearchResult {
tool: ToolEntry<any, any>;
score: number;
toolName: string;
qualifiedName: string;
appId?: string;
}
/**
* Search options for tool search
*/
export interface SearchOptions {
topK?: number;
appIds?: string[];
excludeToolNames?: string[];
minScore?: number;
}
/**
* Filter function type for including tools
*/
export type IncludeToolsFilter = (info: {
name: string;
appId?: string;
source?: string;
description?: string;
tags?: string[];
}) => boolean;
/**
* Configuration for tool search service
*/
export interface ToolSearchServiceConfig {
/**
* Embedding strategy to use
* @default 'tfidf'
*/
strategy?: EmbeddingStrategy;
/**
* Full embedding options (alternative to just strategy)
*/
embeddingOptions?: CodeCallEmbeddingOptions;
/**
* Default number of results to return
* @default 8
*/
defaultTopK?: number;
/**
* Default similarity threshold
* @default 0.0
*/
defaultSimilarityThreshold?: number;
/**
* CodeCall mode for filtering tools
* @default 'codecall_only'
*/
mode?: CodeCallMode;
/**
* Optional filter function for including tools in the search index
*/
includeTools?: IncludeToolsFilter;
/**
* Synonym expansion configuration.
* When enabled, queries are expanded with synonyms to improve search relevance.
* For example, "add user" will also match tools containing "create user".
* Only applies when strategy is 'tfidf' (ML already handles semantic similarity).
*
* Set to false to disable, or provide a config object to customize.
* @default { enabled: true } when strategy is 'tfidf'
*/
synonymExpansion?: false | (SynonymExpansionConfig & {
enabled?: boolean;
});
}
/**
* Service that maintains a searchable index of tools from the ToolRegistry
* Supports both TF-IDF (lightweight, synchronous) and ML-based (semantic) embeddings
* Implements the ToolSearch interface for dependency injection
*/
export declare class ToolSearchService implements ToolSearch {
private static readonly MAX_SUBSCRIPTION_RETRIES;
private static readonly INITIAL_RETRY_DELAY_MS;
private static readonly MAX_RETRY_DELAY_MS;
private vectorDB;
private strategy;
private initialized;
private mlInitialized;
private config;
private scope;
private unsubscribe?;
private synonymService;
private subscriptionPromise;
private subscriptionResolved;
private subscriptionResolve;
private subscriptionReject;
private retryTimeoutId;
private disposed;
constructor(config: ToolSearchServiceConfig | undefined, scope: ScopeEntry);
/**
* Ensures the service is subscribed to tool changes before proceeding.
* Public methods should call this before accessing tools.
*/
private ensureSubscribed;
/**
* Sets up subscription to tool changes with exponential backoff retry.
* Handles the case where scope.tools may not be available yet during plugin initialization.
*/
private setupSubscription;
/**
* Subscribes to tool changes once scope.tools is available.
*/
private subscribeToToolChanges;
/**
* Marks the subscription as resolved, allowing pending operations to proceed.
*/
private markSubscribed;
/**
* Handles tool change events by reindexing all tools from the snapshot
*/
private handleToolChange;
/**
* Determines if a tool should be indexed in the search database.
* Filters based on:
* - Excludes codecall:* meta-tools (they should not be searchable)
* - Mode-based filtering (codecall_only, codecall_opt_in, metadata_driven)
* - Per-tool metadata.codecall.enabledInCodeCall
* - Custom includeTools filter function
*/
private shouldIndexTool;
/**
* Extract CodeCall-specific metadata from a tool.
*/
private getCodeCallMetadata;
/**
* Initializes the search service by indexing all tools from the registry.
* NOTE: This method is now a no-op. Initialization is handled reactively
* via subscription to tool change events in the constructor.
* This method exists for interface compatibility.
*/
initialize(): Promise<void>;
/**
* Cleanup subscription and pending retries when service is destroyed
*/
dispose(): void;
/**
* Extracts searchable text from a tool instance.
* Uses term weighting to improve relevance:
* - Description terms are heavily weighted (most important for semantic matching)
* - Tool name parts are tokenized and weighted
* - Tags provide additional context
*/
private extractSearchableText;
/**
* Checks if a word is a common stop word that should not receive extra weighting.
* Uses module-level STOP_WORDS constant to avoid recreating the Set on each call.
*/
private isStopWord;
/**
* Extracts app ID from tool's owner lineage
*/
private extractAppId;
/**
* Searches for tools matching the query
* Implements the ToolSearch interface
*/
search(query: string, options?: SymbolToolSearchOptions): Promise<SymbolToolSearchResult[]>;
/**
* Gets all indexed tool names
*/
getAllToolNames(): string[];
/**
* Gets the total number of indexed tools
*/
getTotalCount(): number;
/**
* Checks if a tool exists in the index
*/
hasTool(toolName: string): boolean;
/**
* Clears the entire index
*/
clear(): void;
/**
* Get the current embedding strategy
*/
getStrategy(): EmbeddingStrategy;
/**
* Check if the service is initialized
*/
isInitialized(): boolean;
}
//# sourceMappingURL=tool-search.service.d.ts.map
{"version":3,"file":"tool-search.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-search.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,IAAI,sBAAsB,EAC1C,iBAAiB,IAAI,uBAAuB,EAC7C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA2B,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAoM9F;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,CAA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,MAAM;IAQvB;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQlC;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,WAAW,IAAI,iBAAiB;IAIhC;;OAEG;IACH,aAAa,IAAI,OAAO;CAGzB"}
import { z } from 'zod';
export declare const describeToolDescription = "Get input/output schemas for tools from search results.\n\nINPUT: toolNames: string[] - tool names from search\nOUTPUT per tool: inputSchema (JSON Schema), outputSchema (JSON Schema), usageExamples (up to 5 callTool examples)\n\nIMPORTANT: If notFound array is non-empty \u2192 re-search with corrected queries.\nFLOW: search \u2192 describe \u2192 execute/invoke";
export declare const describeToolInputSchema: z.ZodObject<{
toolNames: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
export type DescribeToolInput = z.infer<typeof describeToolInputSchema>;
export declare const describeToolOutputSchema: z.ZodObject<{
tools: z.ZodArray<z.ZodObject<{
name: z.ZodString;
appId: z.ZodString;
description: z.ZodString;
inputSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
outputSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
annotations: z.ZodOptional<z.ZodObject<{
title: z.ZodOptional<z.ZodString>;
readOnlyHint: z.ZodOptional<z.ZodBoolean>;
destructiveHint: z.ZodOptional<z.ZodBoolean>;
idempotentHint: z.ZodOptional<z.ZodBoolean>;
openWorldHint: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
usageExamples: z.ZodArray<z.ZodObject<{
description: z.ZodString;
code: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strip>>;
notFound: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
export type DescribeToolOutput = z.infer<typeof describeToolOutputSchema>;
//# sourceMappingURL=describe.schema.d.ts.map
{"version":3,"file":"describe.schema.d.ts","sourceRoot":"","sources":["../../src/tools/describe.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB,gXAMK,CAAC;AAE1C,eAAO,MAAM,uBAAuB;;iBAuBlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;iBAoCnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
import { ToolContext } from '@frontmcp/sdk';
import { DescribeToolInput, DescribeToolOutput } from './describe.schema';
export default class DescribeTool extends ToolContext {
execute(input: DescribeToolInput): Promise<DescribeToolOutput>;
/**
* Get the input schema for a tool, converting from Zod to JSON Schema.
* This ensures that property descriptions from .describe() are included.
*
* Priority:
* 1. Convert from tool.inputSchema (Zod) to get descriptions
* 2. Fall back to rawInputSchema if conversion fails
* 3. Return null if no schema available
*/
private getInputSchema;
/**
* Convert a schema to JSON Schema format.
* Handles Zod schemas, raw shapes, and already-JSON-Schema objects.
*
* Uses Zod v4's built-in z.toJSONSchema() for conversion.
*/
private toJsonSchema;
/**
* Extract app ID from tool metadata or owner.
*/
private extractAppId;
/**
* Generate up to 5 usage examples for a tool.
*
* Priority:
* 1. User-provided examples from @Tool decorator metadata (up to 5)
* 2. Smart intent-based generation to fill remaining slots
* 3. Returns at least 1 example
*/
private generateExamples;
}
//# sourceMappingURL=describe.tool.d.ts.map
{"version":3,"file":"describe.tool.d.ts","sourceRoot":"","sources":["../../src/tools/describe.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,WAAW,EAAa,MAAM,eAAe,CAAC;AAO7D,OAAO,EACL,iBAAiB,EAEjB,kBAAkB,EAGnB,MAAM,mBAAmB,CAAC;AAsB3B,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IAC7C,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAuDpE;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAuBtB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAkDpB;;OAEG;IACH,OAAO,CAAC,YAAY;IA6BpB;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;CAyBzB"}
import { z } from 'zod';
export declare const executeToolDescription = "Execute AgentScript (safe JS subset) for multi-tool orchestration.\n\nAPI: await callTool(name, args, opts?)\n- Default: throws on error\n- Safe mode: { throwOnError: false } \u2192 returns { success, data?, error? }\n\nEXAMPLE:\nconst users = await callTool('users:list', { active: true });\nconst results = [];\nfor (const u of users.items) {\n const orders = await callTool('orders:list', { userId: u.id });\n results.push({ id: u.id, total: orders.items.reduce((s,o) => s + o.amount, 0) });\n}\nreturn results;\n\nALLOWED: for, for-of, arrow fn, map/filter/reduce/find, Math.*, JSON.*, if/else, destructuring, spread, template literals\nBLOCKED: while, do-while, function decl, eval, require, fetch, setTimeout, process, globalThis\n\nERRORS: NOT_FOUND | VALIDATION | EXECUTION | TIMEOUT | ACCESS_DENIED\nSTATUS: ok | syntax_error | illegal_access | runtime_error | tool_error | timeout\nLIMITS: 10K iter/loop, 30s timeout, 100 calls max";
export declare const executeToolInputSchema: z.ZodObject<{
script: z.ZodString;
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
export type ExecuteToolInput = z.infer<typeof executeToolInputSchema>;
/**
* Result variants
*/
export declare const codeCallOkResultSchema: z.ZodObject<{
status: z.ZodLiteral<"ok">;
result: z.ZodUnknown;
logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
export declare const codeCallSyntaxErrorResultSchema: z.ZodObject<{
status: z.ZodLiteral<"syntax_error">;
error: z.ZodObject<{
message: z.ZodString;
location: z.ZodOptional<z.ZodObject<{
line: z.ZodNumber;
column: z.ZodNumber;
}, z.core.$strip>>;
}, z.core.$strip>;
}, z.core.$strip>;
export declare const codeCallIllegalAccessResultSchema: z.ZodObject<{
status: z.ZodLiteral<"illegal_access">;
error: z.ZodObject<{
message: z.ZodString;
kind: z.ZodUnion<readonly [z.ZodLiteral<"IllegalBuiltinAccess">, z.ZodLiteral<"DisallowedGlobal">, z.ZodString]>;
}, z.core.$strip>;
}, z.core.$strip>;
export declare const codeCallRuntimeErrorResultSchema: z.ZodObject<{
status: z.ZodLiteral<"runtime_error">;
error: z.ZodObject<{
source: z.ZodLiteral<"script">;
message: z.ZodString;
name: z.ZodOptional<z.ZodString>;
stack: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
}, z.core.$strip>;
export declare const codeCallToolErrorResultSchema: z.ZodObject<{
status: z.ZodLiteral<"tool_error">;
error: z.ZodObject<{
source: z.ZodLiteral<"tool">;
toolName: z.ZodString;
toolInput: z.ZodUnknown;
message: z.ZodString;
code: z.ZodOptional<z.ZodString>;
details: z.ZodOptional<z.ZodUnknown>;
}, z.core.$strip>;
}, z.core.$strip>;
export declare const codeCallTimeoutResultSchema: z.ZodObject<{
status: z.ZodLiteral<"timeout">;
error: z.ZodObject<{
message: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
/**
* Discriminated union for the whole result
*/
export declare const executeToolOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
status: z.ZodLiteral<"ok">;
result: z.ZodUnknown;
logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>, z.ZodObject<{
status: z.ZodLiteral<"syntax_error">;
error: z.ZodObject<{
message: z.ZodString;
location: z.ZodOptional<z.ZodObject<{
line: z.ZodNumber;
column: z.ZodNumber;
}, z.core.$strip>>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
status: z.ZodLiteral<"illegal_access">;
error: z.ZodObject<{
message: z.ZodString;
kind: z.ZodUnion<readonly [z.ZodLiteral<"IllegalBuiltinAccess">, z.ZodLiteral<"DisallowedGlobal">, z.ZodString]>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
status: z.ZodLiteral<"runtime_error">;
error: z.ZodObject<{
source: z.ZodLiteral<"script">;
message: z.ZodString;
name: z.ZodOptional<z.ZodString>;
stack: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
status: z.ZodLiteral<"tool_error">;
error: z.ZodObject<{
source: z.ZodLiteral<"tool">;
toolName: z.ZodString;
toolInput: z.ZodUnknown;
message: z.ZodString;
code: z.ZodOptional<z.ZodString>;
details: z.ZodOptional<z.ZodUnknown>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
status: z.ZodLiteral<"timeout">;
error: z.ZodObject<{
message: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>], "status">;
/**
* Inferred types
* (you can export whichever ones you actually need)
*/
export type CodeCallOkResult = z.infer<typeof codeCallOkResultSchema>;
export type CodeCallSyntaxErrorResult = z.infer<typeof codeCallSyntaxErrorResultSchema>;
export type CodeCallIllegalAccessResult = z.infer<typeof codeCallIllegalAccessResultSchema>;
export type CodeCallRuntimeErrorResult = z.infer<typeof codeCallRuntimeErrorResultSchema>;
export type CodeCallToolErrorResult = z.infer<typeof codeCallToolErrorResultSchema>;
export type CodeCallTimeoutResult = z.infer<typeof codeCallTimeoutResultSchema>;
export type CodeCallExecuteResult = CodeCallOkResult | CodeCallSyntaxErrorResult | CodeCallIllegalAccessResult | CodeCallRuntimeErrorResult | CodeCallToolErrorResult | CodeCallTimeoutResult;
//# sourceMappingURL=execute.schema.d.ts.map
{"version":3,"file":"execute.schema.d.ts","sourceRoot":"","sources":["../../src/tools/execute.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,sBAAsB,o7BAoBe,CAAC;AAEnD,eAAO,MAAM,sBAAsB;;;iBAcjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AA4CtE;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;iBAG1C,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;iBAG5C,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;iBAG3C,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;iBAGxC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;iBAGtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAOlC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAC5F,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAC1F,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,MAAM,MAAM,qBAAqB,GAC7B,gBAAgB,GAChB,yBAAyB,GACzB,2BAA2B,GAC3B,0BAA0B,GAC1B,uBAAuB,GACvB,qBAAqB,CAAC"}
import { ToolContext } from '@frontmcp/sdk';
import { CodeCallExecuteResult, ExecuteToolInput } from './execute.schema';
export default class ExecuteTool extends ToolContext {
execute(input: ExecuteToolInput): Promise<CodeCallExecuteResult>;
}
//# sourceMappingURL=execute.tool.d.ts.map
{"version":3,"file":"execute.tool.d.ts","sourceRoot":"","sources":["../../src/tools/execute.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,qBAAqB,EAIrB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAqD1B,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW;IAC5C,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAwNvE"}
export { default as SearchTool } from './search.tool';
export { default as DescribeTool } from './describe.tool';
export { default as ExecuteTool } from './execute.tool';
export { default as InvokeTool } from './invoke.tool';
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC"}
import { z } from 'zod';
export declare const invokeToolDescription = "Call ONE tool directly. Returns standard MCP CallToolResult.\n\nUSE invoke: single tool, no transformation\nUSE execute: multiple tools, loops, filtering, joining\n\nINPUT: tool (string), input (object matching tool schema)\nOUTPUT: MCP CallToolResult (same as standard tool call)\nERRORS: tool_not_found (\u2192 re-search) | validation_error | execution_error | permission_denied\n\nFLOW: search \u2192 describe \u2192 invoke";
export declare const invokeToolInputSchema: z.ZodObject<{
tool: z.ZodString;
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
}, z.core.$strip>;
export type InvokeToolInput = z.infer<typeof invokeToolInputSchema>;
export declare const invokeToolOutputSchema: z.ZodObject<{
_meta: z.ZodOptional<z.ZodObject<{
progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
"io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
taskId: z.ZodString;
}, z.core.$strip>>;
}, z.core.$loose>>;
content: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
annotations: z.ZodOptional<z.ZodObject<{
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
user: "user";
assistant: "assistant";
}>>>;
priority: z.ZodOptional<z.ZodNumber>;
lastModified: z.ZodOptional<z.ZodISODateTime>;
}, z.core.$strip>>;
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"image">;
data: z.ZodString;
mimeType: z.ZodString;
annotations: z.ZodOptional<z.ZodObject<{
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
user: "user";
assistant: "assistant";
}>>>;
priority: z.ZodOptional<z.ZodNumber>;
lastModified: z.ZodOptional<z.ZodISODateTime>;
}, z.core.$strip>>;
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"audio">;
data: z.ZodString;
mimeType: z.ZodString;
annotations: z.ZodOptional<z.ZodObject<{
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
user: "user";
assistant: "assistant";
}>>>;
priority: z.ZodOptional<z.ZodNumber>;
lastModified: z.ZodOptional<z.ZodISODateTime>;
}, z.core.$strip>>;
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>, z.ZodObject<{
uri: z.ZodString;
description: z.ZodOptional<z.ZodString>;
mimeType: z.ZodOptional<z.ZodString>;
annotations: z.ZodOptional<z.ZodObject<{
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
user: "user";
assistant: "assistant";
}>>>;
priority: z.ZodOptional<z.ZodNumber>;
lastModified: z.ZodOptional<z.ZodISODateTime>;
}, z.core.$strip>>;
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
icons: z.ZodOptional<z.ZodArray<z.ZodObject<{
src: z.ZodString;
mimeType: z.ZodOptional<z.ZodString>;
sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
theme: z.ZodOptional<z.ZodEnum<{
light: "light";
dark: "dark";
}>>;
}, z.core.$strip>>>;
name: z.ZodString;
title: z.ZodOptional<z.ZodString>;
type: z.ZodLiteral<"resource_link">;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"resource">;
resource: z.ZodUnion<readonly [z.ZodObject<{
uri: z.ZodString;
mimeType: z.ZodOptional<z.ZodString>;
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
text: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
uri: z.ZodString;
mimeType: z.ZodOptional<z.ZodString>;
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
blob: z.ZodString;
}, z.core.$strip>]>;
annotations: z.ZodOptional<z.ZodObject<{
audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
user: "user";
assistant: "assistant";
}>>>;
priority: z.ZodOptional<z.ZodNumber>;
lastModified: z.ZodOptional<z.ZodISODateTime>;
}, z.core.$strip>>;
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>]>>>;
structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
isError: z.ZodOptional<z.ZodBoolean>;
}, z.core.$loose>;
export type InvokeToolOutput = z.infer<typeof invokeToolOutputSchema>;
//# sourceMappingURL=invoke.schema.d.ts.map
{"version":3,"file":"invoke.schema.d.ts","sourceRoot":"","sources":["../../src/tools/invoke.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB,+aASD,CAAC;AAElC,eAAO,MAAM,qBAAqB;;;iBAWhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAuB,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
import { ToolContext } from '@frontmcp/sdk';
import { InvokeToolInput, InvokeToolOutput } from './invoke.schema';
/**
* InvokeTool allows direct tool invocation without running JavaScript code.
* Returns the same CallToolResult format as a standard MCP tool call.
*
* Security Considerations:
* - Self-reference blocking: Cannot invoke codecall:* tools
* - All middleware (auth, PII, rate limiting) applies via normal tool execution
*/
export default class InvokeTool extends ToolContext {
execute(input: InvokeToolInput): Promise<InvokeToolOutput>;
}
//# sourceMappingURL=invoke.tool.d.ts.map
{"version":3,"file":"invoke.tool.d.ts","sourceRoot":"","sources":["../../src/tools/invoke.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EACL,eAAe,EAEf,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AAazB;;;;;;;GAOG;AAeH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IAC3C,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAkCjE"}
import { z } from 'zod';
export declare const searchToolDescription = "Find tools by splitting user request into atomic actions.\n\nDECOMPOSE: \"delete users and send email\" \u2192 queries: [\"delete user\", \"send email\"]\nDECOMPOSE: \"get order and refund\" \u2192 queries: [\"get order\", \"calculate refund\"]\n\nAVOID RE-SEARCHING: Use excludeToolNames for already-discovered tools.\nRE-SEARCH WHEN: describe fails (typo?) OR execute returns tool_not_found.\n\nINPUT:\n- queries: string[] (required) - atomic action phrases, max 10\n- appIds?: string[] - filter by app\n- excludeToolNames?: string[] - skip known tools\n- topK?: number (default 5) - results per query\n- minRelevanceScore?: number (default 0.3) - minimum match threshold\n\nOUTPUT: Flat deduplicated tool list. relevanceScore: 0.5+=good, 0.7+=strong match.\n\nFLOW: search \u2192 describe \u2192 execute/invoke";
export declare const searchToolInputSchema: z.ZodObject<{
queries: z.ZodArray<z.ZodString>;
appIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
excludeToolNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
topK: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
minRelevanceScore: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
}, z.core.$strip>;
export type SearchToolInput = z.infer<typeof searchToolInputSchema>;
export declare const searchToolOutputSchema: z.ZodObject<{
tools: z.ZodArray<z.ZodObject<{
name: z.ZodString;
appId: z.ZodOptional<z.ZodString>;
description: z.ZodString;
relevanceScore: z.ZodNumber;
matchedQueries: z.ZodArray<z.ZodString>;
}, z.core.$strip>>;
warnings: z.ZodArray<z.ZodObject<{
type: z.ZodEnum<{
excluded_tool_not_found: "excluded_tool_not_found";
no_results: "no_results";
low_relevance: "low_relevance";
}>;
message: z.ZodString;
affectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>>;
totalAvailableTools: z.ZodNumber;
}, z.core.$strip>;
export type SearchToolOutput = z.infer<typeof searchToolOutputSchema>;
//# sourceMappingURL=search.schema.d.ts.map
{"version":3,"file":"search.schema.d.ts","sourceRoot":"","sources":["../../src/tools/search.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB,kzBAiBO,CAAC;AAE1C,eAAO,MAAM,qBAAqB;;;;;;iBAgBhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;iBAsBjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
import { ToolContext } from '@frontmcp/sdk';
import { SearchToolInput, SearchToolOutput } from './search.schema';
export default class SearchTool extends ToolContext {
execute(input: SearchToolInput): Promise<SearchToolOutput>;
}
//# sourceMappingURL=search.tool.d.ts.map
{"version":3,"file":"search.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,eAAe,EAEf,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AA8BzB,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IAC3C,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAyFjE"}
import type { JSONSchema } from 'zod/v4/core';
/** JSON Schema type from Zod v4 */
type JsonSchema = JSONSchema.JSONSchema;
/**
* Tool example for describe output
*/
export interface ToolUsageExample {
description: string;
code: string;
}
/**
* Detected intent of a tool based on its name and description.
*/
export type ToolIntent = 'create' | 'list' | 'get' | 'update' | 'delete' | 'search' | 'action' | 'unknown';
/**
* Detect the intent of a tool from its name.
* Extracts the action verb from tool names like "users:create" or "orders:list".
*/
export declare function detectToolIntent(toolName: string, description?: string): ToolIntent;
/**
* Generate a TypeScript-like function signature from a JSON Schema.
*
* @example
* Input: { type: 'object', properties: { id: { type: 'string' }, limit: { type: 'number' } }, required: ['id'] }
* Output: "(id: string, limit?: number) => unknown"
*/
export declare function jsonSchemaToSignature(toolName: string, inputSchema?: JsonSchema, outputSchema?: JsonSchema): string;
/**
* Generate a natural language summary of a schema.
*/
export declare function jsonSchemaToNaturalLanguage(schema: JsonSchema | undefined | null, direction: 'input' | 'output'): string;
/**
* Generate a basic usage example for a tool.
*/
export declare function generateBasicExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
/**
* Check if a schema has pagination parameters.
*/
export declare function hasPaginationParams(schema?: JsonSchema): boolean;
/**
* Check if a schema has filter-like parameters.
*/
export declare function hasFilterParams(schema?: JsonSchema): boolean;
/**
* Get filter-like property names from a schema.
*/
export declare function getFilterProperties(schema?: JsonSchema): string[];
/**
* Generate a pagination example for a tool.
*/
export declare function generatePaginationExample(toolName: string): ToolUsageExample;
/**
* Generate a filter example for a tool.
*/
export declare function generateFilterExample(toolName: string, filterProp: string): ToolUsageExample;
/**
* Generate a create example for a tool.
* Shows required parameters with contextual sample values.
*/
export declare function generateCreateExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
/**
* Generate a get (retrieve single item) example for a tool.
*/
export declare function generateGetExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
/**
* Generate a list example for a tool.
*/
export declare function generateListExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
/**
* Generate an update example for a tool.
*/
export declare function generateUpdateExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
/**
* Generate a delete example for a tool.
*/
export declare function generateDeleteExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
/**
* Generate a search example for a tool.
*/
export declare function generateSearchExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
/**
* Smart example generator that uses intent detection.
* This is the main entry point for generating examples.
*/
export declare function generateSmartExample(toolName: string, inputSchema?: JsonSchema, description?: string): ToolUsageExample;
export {};
//# sourceMappingURL=describe.utils.d.ts.map
{"version":3,"file":"describe.utils.d.ts","sourceRoot":"","sources":["../../src/utils/describe.utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,mCAAmC;AACnC,KAAK,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,U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M,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,gBAAgB,CAqB/F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,gBAAgB,CAQhG;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,gBAAgB,CA0BlG;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,gBAAgB,CAoBlG;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,gBAAgB,CAiBlG;AA2ED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,UAAU,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,gBAAgB,CAuBlB"}
export * from './describe.utils';
export * from './mcp-result';
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
/**
* Extract the actual result from a CallToolResult.
* MCP returns results wrapped in content array format.
*/
export declare function extractResultFromCallToolResult(mcpResult: CallToolResult): unknown;
//# sourceMappingURL=mcp-result.d.ts.map
{"version":3,"file":"mcp-result.d.ts","sourceRoot":"","sources":["../../src/utils/mcp-result.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,cAAc,GAAG,OAAO,CA4BlF"}
+1
-1
{
"name": "@frontmcp/plugin-codecall",
"version": "0.0.1",
"version": "0.7.0",
"description": "CodeCall plugin for FrontMCP - AgentScript-based meta-tools for orchestrating MCP tools",

@@ -5,0 +5,0 @@ "author": "AgentFront <info@agentfront.dev>",