@frontmcp/plugin-codecall 0.0.1 → 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 (62) hide show
  1. package/codecall.plugin.d.ts +42 -0
  2. package/codecall.plugin.d.ts.map +1 -0
  3. package/codecall.symbol.d.ts +107 -0
  4. package/codecall.symbol.d.ts.map +1 -0
  5. package/codecall.types.d.ts +353 -0
  6. package/codecall.types.d.ts.map +1 -0
  7. package/errors/index.d.ts +2 -0
  8. package/errors/index.d.ts.map +1 -0
  9. package/errors/tool-call.errors.d.ts +80 -0
  10. package/errors/tool-call.errors.d.ts.map +1 -0
  11. package/esm/index.mjs +2625 -0
  12. package/esm/package.json +59 -0
  13. package/index.d.ts +3 -0
  14. package/index.d.ts.map +1 -0
  15. package/index.js +2668 -0
  16. package/package.json +3 -3
  17. package/providers/code-call.config.d.ts +30 -0
  18. package/providers/code-call.config.d.ts.map +1 -0
  19. package/security/index.d.ts +3 -0
  20. package/security/index.d.ts.map +1 -0
  21. package/security/self-reference-guard.d.ts +33 -0
  22. package/security/self-reference-guard.d.ts.map +1 -0
  23. package/security/tool-access-control.service.d.ts +105 -0
  24. package/security/tool-access-control.service.d.ts.map +1 -0
  25. package/services/audit-logger.service.d.ts +187 -0
  26. package/services/audit-logger.service.d.ts.map +1 -0
  27. package/services/enclave.service.d.ts +63 -0
  28. package/services/enclave.service.d.ts.map +1 -0
  29. package/services/error-enrichment.service.d.ts +95 -0
  30. package/services/error-enrichment.service.d.ts.map +1 -0
  31. package/services/index.d.ts +7 -0
  32. package/services/index.d.ts.map +1 -0
  33. package/services/output-sanitizer.d.ts +87 -0
  34. package/services/output-sanitizer.d.ts.map +1 -0
  35. package/services/synonym-expansion.service.d.ts +67 -0
  36. package/services/synonym-expansion.service.d.ts.map +1 -0
  37. package/services/tool-search.service.d.ts +196 -0
  38. package/services/tool-search.service.d.ts.map +1 -0
  39. package/tools/describe.schema.d.ts +29 -0
  40. package/tools/describe.schema.d.ts.map +1 -0
  41. package/tools/describe.tool.d.ts +36 -0
  42. package/tools/describe.tool.d.ts.map +1 -0
  43. package/tools/execute.schema.d.ts +116 -0
  44. package/tools/execute.schema.d.ts.map +1 -0
  45. package/tools/execute.tool.d.ts +6 -0
  46. package/tools/execute.tool.d.ts.map +1 -0
  47. package/tools/index.d.ts +5 -0
  48. package/tools/index.d.ts.map +1 -0
  49. package/tools/invoke.schema.d.ts +105 -0
  50. package/tools/invoke.schema.d.ts.map +1 -0
  51. package/tools/invoke.tool.d.ts +14 -0
  52. package/tools/invoke.tool.d.ts.map +1 -0
  53. package/tools/search.schema.d.ts +31 -0
  54. package/tools/search.schema.d.ts.map +1 -0
  55. package/tools/search.tool.d.ts +6 -0
  56. package/tools/search.tool.d.ts.map +1 -0
  57. package/utils/describe.utils.d.ts +87 -0
  58. package/utils/describe.utils.d.ts.map +1 -0
  59. package/utils/index.d.ts +3 -0
  60. package/utils/index.d.ts.map +1 -0
  61. package/utils/mcp-result.d.ts +7 -0
  62. package/utils/mcp-result.d.ts.map +1 -0
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Output Sanitizer for CodeCall
3
+ *
4
+ * Sanitizes script outputs to prevent information leakage through:
5
+ * - Error messages with stack traces or file paths
6
+ * - Large outputs that could contain sensitive data
7
+ * - Recursive structures that could cause DoS
8
+ *
9
+ * Security considerations:
10
+ * - All sanitization is defensive (fail-safe)
11
+ * - Outputs are truncated, not rejected
12
+ * - Circular references are handled
13
+ * - Prototype pollution is prevented
14
+ */
15
+ /**
16
+ * Configuration for output sanitization.
17
+ */
18
+ export interface OutputSanitizerConfig {
19
+ /**
20
+ * Maximum depth for nested objects/arrays.
21
+ * @default 10
22
+ */
23
+ maxDepth: number;
24
+ /**
25
+ * Maximum length for string values.
26
+ * @default 10000
27
+ */
28
+ maxStringLength: number;
29
+ /**
30
+ * Maximum number of keys in an object.
31
+ * @default 100
32
+ */
33
+ maxObjectKeys: number;
34
+ /**
35
+ * Maximum number of items in an array.
36
+ * @default 1000
37
+ */
38
+ maxArrayLength: number;
39
+ /**
40
+ * Maximum total size of serialized output in bytes.
41
+ * @default 1MB
42
+ */
43
+ maxTotalSize: number;
44
+ /**
45
+ * Remove error stack traces.
46
+ * @default true
47
+ */
48
+ removeStackTraces: boolean;
49
+ /**
50
+ * Remove file paths from strings.
51
+ * @default true
52
+ */
53
+ removeFilePaths: boolean;
54
+ }
55
+ /**
56
+ * Default sanitization configuration.
57
+ */
58
+ export declare const DEFAULT_SANITIZER_CONFIG: OutputSanitizerConfig;
59
+ /**
60
+ * Result of sanitization.
61
+ */
62
+ export interface SanitizationResult<T> {
63
+ /** Sanitized value */
64
+ value: T;
65
+ /** Whether any sanitization was applied */
66
+ wasModified: boolean;
67
+ /** Warnings about what was sanitized */
68
+ warnings: string[];
69
+ }
70
+ /**
71
+ * Sanitize output from CodeCall script execution.
72
+ *
73
+ * @param output - Raw output from script
74
+ * @param config - Sanitization configuration
75
+ * @returns Sanitized output with metadata
76
+ */
77
+ export declare function sanitizeOutput<T = unknown>(output: unknown, config?: Partial<OutputSanitizerConfig>): SanitizationResult<T>;
78
+ /**
79
+ * Quick check if a value needs sanitization.
80
+ * Used for optimization - skip sanitization for simple values.
81
+ */
82
+ export declare function needsSanitization(value: unknown): boolean;
83
+ /**
84
+ * Sanitize a log message (less aggressive than output sanitization).
85
+ */
86
+ export declare function sanitizeLogMessage(message: string, maxLength?: number): string;
87
+ //# sourceMappingURL=output-sanitizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"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"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Configuration for the SynonymExpansionService
3
+ */
4
+ export interface SynonymExpansionConfig {
5
+ /**
6
+ * Additional synonym groups to include beyond defaults.
7
+ * Each group is an array of related terms.
8
+ */
9
+ additionalSynonyms?: ReadonlyArray<ReadonlyArray<string>>;
10
+ /**
11
+ * If true, completely replace default synonyms with additionalSynonyms.
12
+ * @default false
13
+ */
14
+ replaceDefaults?: boolean;
15
+ /**
16
+ * Maximum number of expanded terms per input term.
17
+ * Prevents query explosion.
18
+ * @default 5
19
+ */
20
+ maxExpansionsPerTerm?: number;
21
+ }
22
+ /**
23
+ * Lightweight synonym expansion service for improving TF-IDF search relevance.
24
+ * Zero dependencies, synchronous, and easily extensible.
25
+ *
26
+ * This service provides query-time synonym expansion to help TF-IDF-based
27
+ * search understand that semantically similar terms (like "add" and "create")
28
+ * should match the same tools.
29
+ */
30
+ export declare class SynonymExpansionService {
31
+ private synonymMap;
32
+ private maxExpansions;
33
+ constructor(config?: SynonymExpansionConfig);
34
+ /**
35
+ * Build a bidirectional synonym map from groups.
36
+ * Each term maps to all other terms in its group(s).
37
+ */
38
+ private buildSynonymMap;
39
+ /**
40
+ * Get synonyms for a single term.
41
+ * Returns empty array if no synonyms found.
42
+ *
43
+ * @example
44
+ * getSynonyms('add') // ['create', 'new', 'insert', 'make']
45
+ */
46
+ getSynonyms(term: string): string[];
47
+ /**
48
+ * Expand a query string by adding synonyms for each term.
49
+ * Returns the expanded query string with original terms and their synonyms.
50
+ *
51
+ * @example
52
+ * expandQuery('add user') // 'add create new insert make user account member profile'
53
+ */
54
+ expandQuery(query: string): string;
55
+ /**
56
+ * Check if synonym expansion is available for any term in the query.
57
+ */
58
+ hasExpansions(query: string): boolean;
59
+ /**
60
+ * Get statistics about the synonym dictionary.
61
+ */
62
+ getStats(): {
63
+ termCount: number;
64
+ avgSynonymsPerTerm: number;
65
+ };
66
+ }
67
+ //# sourceMappingURL=synonym-expansion.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"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"}
@@ -0,0 +1,196 @@
1
+ import { ToolEntry, ScopeEntry } from '@frontmcp/sdk';
2
+ import type { EmbeddingStrategy, CodeCallEmbeddingOptions, CodeCallMode } from '../codecall.types';
3
+ import type { ToolSearch, ToolSearchResult as SymbolToolSearchResult, ToolSearchOptions as SymbolToolSearchOptions } from '../codecall.symbol';
4
+ import { SynonymExpansionConfig } from './synonym-expansion.service';
5
+ /**
6
+ * Search result for tool search
7
+ */
8
+ export interface SearchResult {
9
+ tool: ToolEntry<any, any>;
10
+ score: number;
11
+ toolName: string;
12
+ qualifiedName: string;
13
+ appId?: string;
14
+ }
15
+ /**
16
+ * Search options for tool search
17
+ */
18
+ export interface SearchOptions {
19
+ topK?: number;
20
+ appIds?: string[];
21
+ excludeToolNames?: string[];
22
+ minScore?: number;
23
+ }
24
+ /**
25
+ * Filter function type for including tools
26
+ */
27
+ export type IncludeToolsFilter = (info: {
28
+ name: string;
29
+ appId?: string;
30
+ source?: string;
31
+ description?: string;
32
+ tags?: string[];
33
+ }) => boolean;
34
+ /**
35
+ * Configuration for tool search service
36
+ */
37
+ export interface ToolSearchServiceConfig {
38
+ /**
39
+ * Embedding strategy to use
40
+ * @default 'tfidf'
41
+ */
42
+ strategy?: EmbeddingStrategy;
43
+ /**
44
+ * Full embedding options (alternative to just strategy)
45
+ */
46
+ embeddingOptions?: CodeCallEmbeddingOptions;
47
+ /**
48
+ * Default number of results to return
49
+ * @default 8
50
+ */
51
+ defaultTopK?: number;
52
+ /**
53
+ * Default similarity threshold
54
+ * @default 0.0
55
+ */
56
+ defaultSimilarityThreshold?: number;
57
+ /**
58
+ * CodeCall mode for filtering tools
59
+ * @default 'codecall_only'
60
+ */
61
+ mode?: CodeCallMode;
62
+ /**
63
+ * Optional filter function for including tools in the search index
64
+ */
65
+ includeTools?: IncludeToolsFilter;
66
+ /**
67
+ * Synonym expansion configuration.
68
+ * When enabled, queries are expanded with synonyms to improve search relevance.
69
+ * For example, "add user" will also match tools containing "create user".
70
+ * Only applies when strategy is 'tfidf' (ML already handles semantic similarity).
71
+ *
72
+ * Set to false to disable, or provide a config object to customize.
73
+ * @default { enabled: true } when strategy is 'tfidf'
74
+ */
75
+ synonymExpansion?: false | (SynonymExpansionConfig & {
76
+ enabled?: boolean;
77
+ });
78
+ }
79
+ /**
80
+ * Service that maintains a searchable index of tools from the ToolRegistry
81
+ * Supports both TF-IDF (lightweight, synchronous) and ML-based (semantic) embeddings
82
+ * Implements the ToolSearch interface for dependency injection
83
+ */
84
+ export declare class ToolSearchService implements ToolSearch {
85
+ private static readonly MAX_SUBSCRIPTION_RETRIES;
86
+ private static readonly INITIAL_RETRY_DELAY_MS;
87
+ private static readonly MAX_RETRY_DELAY_MS;
88
+ private vectorDB;
89
+ private strategy;
90
+ private initialized;
91
+ private mlInitialized;
92
+ private config;
93
+ private scope;
94
+ private unsubscribe?;
95
+ private synonymService;
96
+ private subscriptionPromise;
97
+ private subscriptionResolved;
98
+ private subscriptionResolve;
99
+ private subscriptionReject;
100
+ private retryTimeoutId;
101
+ private disposed;
102
+ constructor(config: ToolSearchServiceConfig | undefined, scope: ScopeEntry);
103
+ /**
104
+ * Ensures the service is subscribed to tool changes before proceeding.
105
+ * Public methods should call this before accessing tools.
106
+ */
107
+ private ensureSubscribed;
108
+ /**
109
+ * Sets up subscription to tool changes with exponential backoff retry.
110
+ * Handles the case where scope.tools may not be available yet during plugin initialization.
111
+ */
112
+ private setupSubscription;
113
+ /**
114
+ * Subscribes to tool changes once scope.tools is available.
115
+ */
116
+ private subscribeToToolChanges;
117
+ /**
118
+ * Marks the subscription as resolved, allowing pending operations to proceed.
119
+ */
120
+ private markSubscribed;
121
+ /**
122
+ * Handles tool change events by reindexing all tools from the snapshot
123
+ */
124
+ private handleToolChange;
125
+ /**
126
+ * Determines if a tool should be indexed in the search database.
127
+ * Filters based on:
128
+ * - Excludes codecall:* meta-tools (they should not be searchable)
129
+ * - Mode-based filtering (codecall_only, codecall_opt_in, metadata_driven)
130
+ * - Per-tool metadata.codecall.enabledInCodeCall
131
+ * - Custom includeTools filter function
132
+ */
133
+ private shouldIndexTool;
134
+ /**
135
+ * Extract CodeCall-specific metadata from a tool.
136
+ */
137
+ private getCodeCallMetadata;
138
+ /**
139
+ * Initializes the search service by indexing all tools from the registry.
140
+ * NOTE: This method is now a no-op. Initialization is handled reactively
141
+ * via subscription to tool change events in the constructor.
142
+ * This method exists for interface compatibility.
143
+ */
144
+ initialize(): Promise<void>;
145
+ /**
146
+ * Cleanup subscription and pending retries when service is destroyed
147
+ */
148
+ dispose(): void;
149
+ /**
150
+ * Extracts searchable text from a tool instance.
151
+ * Uses term weighting to improve relevance:
152
+ * - Description terms are heavily weighted (most important for semantic matching)
153
+ * - Tool name parts are tokenized and weighted
154
+ * - Tags provide additional context
155
+ */
156
+ private extractSearchableText;
157
+ /**
158
+ * Checks if a word is a common stop word that should not receive extra weighting.
159
+ * Uses module-level STOP_WORDS constant to avoid recreating the Set on each call.
160
+ */
161
+ private isStopWord;
162
+ /**
163
+ * Extracts app ID from tool's owner lineage
164
+ */
165
+ private extractAppId;
166
+ /**
167
+ * Searches for tools matching the query
168
+ * Implements the ToolSearch interface
169
+ */
170
+ search(query: string, options?: SymbolToolSearchOptions): Promise<SymbolToolSearchResult[]>;
171
+ /**
172
+ * Gets all indexed tool names
173
+ */
174
+ getAllToolNames(): string[];
175
+ /**
176
+ * Gets the total number of indexed tools
177
+ */
178
+ getTotalCount(): number;
179
+ /**
180
+ * Checks if a tool exists in the index
181
+ */
182
+ hasTool(toolName: string): boolean;
183
+ /**
184
+ * Clears the entire index
185
+ */
186
+ clear(): void;
187
+ /**
188
+ * Get the current embedding strategy
189
+ */
190
+ getStrategy(): EmbeddingStrategy;
191
+ /**
192
+ * Check if the service is initialized
193
+ */
194
+ isInitialized(): boolean;
195
+ }
196
+ //# sourceMappingURL=tool-search.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-search.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-search.service.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ 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";
3
+ export declare const describeToolInputSchema: z.ZodObject<{
4
+ toolNames: z.ZodArray<z.ZodString>;
5
+ }, z.core.$strip>;
6
+ export type DescribeToolInput = z.infer<typeof describeToolInputSchema>;
7
+ export declare const describeToolOutputSchema: z.ZodObject<{
8
+ tools: z.ZodArray<z.ZodObject<{
9
+ name: z.ZodString;
10
+ appId: z.ZodString;
11
+ description: z.ZodString;
12
+ inputSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
+ outputSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
14
+ annotations: z.ZodOptional<z.ZodObject<{
15
+ title: z.ZodOptional<z.ZodString>;
16
+ readOnlyHint: z.ZodOptional<z.ZodBoolean>;
17
+ destructiveHint: z.ZodOptional<z.ZodBoolean>;
18
+ idempotentHint: z.ZodOptional<z.ZodBoolean>;
19
+ openWorldHint: z.ZodOptional<z.ZodBoolean>;
20
+ }, z.core.$strip>>;
21
+ usageExamples: z.ZodArray<z.ZodObject<{
22
+ description: z.ZodString;
23
+ code: z.ZodString;
24
+ }, z.core.$strip>>;
25
+ }, z.core.$strip>>;
26
+ notFound: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
+ }, z.core.$strip>;
28
+ export type DescribeToolOutput = z.infer<typeof describeToolOutputSchema>;
29
+ //# sourceMappingURL=describe.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"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"}
@@ -0,0 +1,36 @@
1
+ import { ToolContext } from '@frontmcp/sdk';
2
+ import { DescribeToolInput, DescribeToolOutput } from './describe.schema';
3
+ export default class DescribeTool extends ToolContext {
4
+ execute(input: DescribeToolInput): Promise<DescribeToolOutput>;
5
+ /**
6
+ * Get the input schema for a tool, converting from Zod to JSON Schema.
7
+ * This ensures that property descriptions from .describe() are included.
8
+ *
9
+ * Priority:
10
+ * 1. Convert from tool.inputSchema (Zod) to get descriptions
11
+ * 2. Fall back to rawInputSchema if conversion fails
12
+ * 3. Return null if no schema available
13
+ */
14
+ private getInputSchema;
15
+ /**
16
+ * Convert a schema to JSON Schema format.
17
+ * Handles Zod schemas, raw shapes, and already-JSON-Schema objects.
18
+ *
19
+ * Uses Zod v4's built-in z.toJSONSchema() for conversion.
20
+ */
21
+ private toJsonSchema;
22
+ /**
23
+ * Extract app ID from tool metadata or owner.
24
+ */
25
+ private extractAppId;
26
+ /**
27
+ * Generate up to 5 usage examples for a tool.
28
+ *
29
+ * Priority:
30
+ * 1. User-provided examples from @Tool decorator metadata (up to 5)
31
+ * 2. Smart intent-based generation to fill remaining slots
32
+ * 3. Returns at least 1 example
33
+ */
34
+ private generateExamples;
35
+ }
36
+ //# sourceMappingURL=describe.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"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"}
@@ -0,0 +1,116 @@
1
+ import { z } from 'zod';
2
+ 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";
3
+ export declare const executeToolInputSchema: z.ZodObject<{
4
+ script: z.ZodString;
5
+ allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
6
+ }, z.core.$strip>;
7
+ export type ExecuteToolInput = z.infer<typeof executeToolInputSchema>;
8
+ /**
9
+ * Result variants
10
+ */
11
+ export declare const codeCallOkResultSchema: z.ZodObject<{
12
+ status: z.ZodLiteral<"ok">;
13
+ result: z.ZodUnknown;
14
+ logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
+ }, z.core.$strip>;
16
+ export declare const codeCallSyntaxErrorResultSchema: z.ZodObject<{
17
+ status: z.ZodLiteral<"syntax_error">;
18
+ error: z.ZodObject<{
19
+ message: z.ZodString;
20
+ location: z.ZodOptional<z.ZodObject<{
21
+ line: z.ZodNumber;
22
+ column: z.ZodNumber;
23
+ }, z.core.$strip>>;
24
+ }, z.core.$strip>;
25
+ }, z.core.$strip>;
26
+ export declare const codeCallIllegalAccessResultSchema: z.ZodObject<{
27
+ status: z.ZodLiteral<"illegal_access">;
28
+ error: z.ZodObject<{
29
+ message: z.ZodString;
30
+ kind: z.ZodUnion<readonly [z.ZodLiteral<"IllegalBuiltinAccess">, z.ZodLiteral<"DisallowedGlobal">, z.ZodString]>;
31
+ }, z.core.$strip>;
32
+ }, z.core.$strip>;
33
+ export declare const codeCallRuntimeErrorResultSchema: z.ZodObject<{
34
+ status: z.ZodLiteral<"runtime_error">;
35
+ error: z.ZodObject<{
36
+ source: z.ZodLiteral<"script">;
37
+ message: z.ZodString;
38
+ name: z.ZodOptional<z.ZodString>;
39
+ stack: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strip>;
41
+ }, z.core.$strip>;
42
+ export declare const codeCallToolErrorResultSchema: z.ZodObject<{
43
+ status: z.ZodLiteral<"tool_error">;
44
+ error: z.ZodObject<{
45
+ source: z.ZodLiteral<"tool">;
46
+ toolName: z.ZodString;
47
+ toolInput: z.ZodUnknown;
48
+ message: z.ZodString;
49
+ code: z.ZodOptional<z.ZodString>;
50
+ details: z.ZodOptional<z.ZodUnknown>;
51
+ }, z.core.$strip>;
52
+ }, z.core.$strip>;
53
+ export declare const codeCallTimeoutResultSchema: z.ZodObject<{
54
+ status: z.ZodLiteral<"timeout">;
55
+ error: z.ZodObject<{
56
+ message: z.ZodString;
57
+ }, z.core.$strip>;
58
+ }, z.core.$strip>;
59
+ /**
60
+ * Discriminated union for the whole result
61
+ */
62
+ export declare const executeToolOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
+ status: z.ZodLiteral<"ok">;
64
+ result: z.ZodUnknown;
65
+ logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
66
+ }, z.core.$strip>, z.ZodObject<{
67
+ status: z.ZodLiteral<"syntax_error">;
68
+ error: z.ZodObject<{
69
+ message: z.ZodString;
70
+ location: z.ZodOptional<z.ZodObject<{
71
+ line: z.ZodNumber;
72
+ column: z.ZodNumber;
73
+ }, z.core.$strip>>;
74
+ }, z.core.$strip>;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ status: z.ZodLiteral<"illegal_access">;
77
+ error: z.ZodObject<{
78
+ message: z.ZodString;
79
+ kind: z.ZodUnion<readonly [z.ZodLiteral<"IllegalBuiltinAccess">, z.ZodLiteral<"DisallowedGlobal">, z.ZodString]>;
80
+ }, z.core.$strip>;
81
+ }, z.core.$strip>, z.ZodObject<{
82
+ status: z.ZodLiteral<"runtime_error">;
83
+ error: z.ZodObject<{
84
+ source: z.ZodLiteral<"script">;
85
+ message: z.ZodString;
86
+ name: z.ZodOptional<z.ZodString>;
87
+ stack: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strip>;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ status: z.ZodLiteral<"tool_error">;
91
+ error: z.ZodObject<{
92
+ source: z.ZodLiteral<"tool">;
93
+ toolName: z.ZodString;
94
+ toolInput: z.ZodUnknown;
95
+ message: z.ZodString;
96
+ code: z.ZodOptional<z.ZodString>;
97
+ details: z.ZodOptional<z.ZodUnknown>;
98
+ }, z.core.$strip>;
99
+ }, z.core.$strip>, z.ZodObject<{
100
+ status: z.ZodLiteral<"timeout">;
101
+ error: z.ZodObject<{
102
+ message: z.ZodString;
103
+ }, z.core.$strip>;
104
+ }, z.core.$strip>], "status">;
105
+ /**
106
+ * Inferred types
107
+ * (you can export whichever ones you actually need)
108
+ */
109
+ export type CodeCallOkResult = z.infer<typeof codeCallOkResultSchema>;
110
+ export type CodeCallSyntaxErrorResult = z.infer<typeof codeCallSyntaxErrorResultSchema>;
111
+ export type CodeCallIllegalAccessResult = z.infer<typeof codeCallIllegalAccessResultSchema>;
112
+ export type CodeCallRuntimeErrorResult = z.infer<typeof codeCallRuntimeErrorResultSchema>;
113
+ export type CodeCallToolErrorResult = z.infer<typeof codeCallToolErrorResultSchema>;
114
+ export type CodeCallTimeoutResult = z.infer<typeof codeCallTimeoutResultSchema>;
115
+ export type CodeCallExecuteResult = CodeCallOkResult | CodeCallSyntaxErrorResult | CodeCallIllegalAccessResult | CodeCallRuntimeErrorResult | CodeCallToolErrorResult | CodeCallTimeoutResult;
116
+ //# sourceMappingURL=execute.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"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"}
@@ -0,0 +1,6 @@
1
+ import { ToolContext } from '@frontmcp/sdk';
2
+ import { CodeCallExecuteResult, ExecuteToolInput } from './execute.schema';
3
+ export default class ExecuteTool extends ToolContext {
4
+ execute(input: ExecuteToolInput): Promise<CodeCallExecuteResult>;
5
+ }
6
+ //# sourceMappingURL=execute.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"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"}
@@ -0,0 +1,5 @@
1
+ export { default as SearchTool } from './search.tool';
2
+ export { default as DescribeTool } from './describe.tool';
3
+ export { default as ExecuteTool } from './execute.tool';
4
+ export { default as InvokeTool } from './invoke.tool';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"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"}