@frontmcp/plugin-codecall 1.7.2 → 1.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontmcp/plugin-codecall",
3
- "version": "1.7.2",
3
+ "version": "1.8.1",
4
4
  "description": "CodeCall plugin for FrontMCP - AgentScript-based meta-tools for orchestrating MCP tools",
5
5
  "author": "AgentFront <info@agentfront.dev>",
6
6
  "license": "Apache-2.0",
@@ -49,13 +49,13 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@enclave-vm/core": "^2.15.2",
52
- "@frontmcp/protocol": "1.7.2",
53
- "@frontmcp/sdk": "1.7.2",
52
+ "@frontmcp/protocol": "1.8.1",
53
+ "@frontmcp/sdk": "1.8.1",
54
54
  "vectoriadb": "^2.3.2"
55
55
  },
56
56
  "peerDependencies": {
57
- "@frontmcp/lazy-zod": "1.7.2",
58
- "@frontmcp/plugin-cache": "1.7.2"
57
+ "@frontmcp/lazy-zod": "1.8.1",
58
+ "@frontmcp/plugin-cache": "1.8.1"
59
59
  },
60
60
  "devDependencies": {
61
61
  "reflect-metadata": "^0.2.2"
@@ -0,0 +1,141 @@
1
+ import type { CodeCallMode, CodeCallToolMetadata, DirectCallsFilterFn, IncludeToolsFilterFn, IncludeToolsFilterToolInfo } from '../codecall.types';
2
+ /** An owner in a registry entry's lineage: an app, adapter, plugin or the scope. */
3
+ interface CodeCallPolicyOwner {
4
+ kind?: string;
5
+ id?: string;
6
+ }
7
+ /** A registry entry as the policy reads it: a `ToolEntry`, or anything shaped like one. */
8
+ export interface CodeCallPolicyEntry {
9
+ name: string;
10
+ fullName: string;
11
+ owner?: CodeCallPolicyOwner;
12
+ metadata?: {
13
+ description?: string;
14
+ tags?: string[];
15
+ hideFromDiscovery?: boolean;
16
+ visibility?: string;
17
+ codecall?: CodeCallToolMetadata;
18
+ };
19
+ }
20
+ /** The policy's view of one tool. Build it with `toCodeCallPolicyTool`. */
21
+ export interface CodeCallPolicyTool {
22
+ /** The tool's own name: the `name` search indexes and `includeTools` receives. */
23
+ name: string;
24
+ /** The qualified `<owner>:<name>` spelling, which the flow dispatches as well. */
25
+ fullName?: string;
26
+ /**
27
+ * Further spellings, such as the name the caller asked for.
28
+ *
29
+ * The namespace rules deny under every spelling, because judging one lets another through.
30
+ * No allow decision ever reads an alias.
31
+ */
32
+ aliases?: string[];
33
+ appId?: string;
34
+ description?: string;
35
+ tags?: string[];
36
+ hidden?: boolean;
37
+ codecall?: CodeCallToolMetadata;
38
+ }
39
+ export interface CodeCallPolicyConfig {
40
+ mode: CodeCallMode;
41
+ includeTools?: IncludeToolsFilterFn;
42
+ }
43
+ /** The `directCalls` options, which narrow `codecall:invoke` beyond the base policy. */
44
+ export interface CodeCallDirectCallsConfig {
45
+ enabled: boolean;
46
+ allowedTools?: string[];
47
+ filter?: DirectCallsFilterFn;
48
+ }
49
+ export type CodeCallPolicyDecision = {
50
+ allowed: true;
51
+ } | {
52
+ allowed: false;
53
+ reason: string;
54
+ };
55
+ /** A decision that also carries the entry it was made for, so callers use that exact entry. */
56
+ export type CodeCallToolAccess<T> = {
57
+ allowed: true;
58
+ entry: T;
59
+ } | {
60
+ allowed: false;
61
+ reason: string;
62
+ };
63
+ /**
64
+ * The app a tool belongs to, found anywhere in its lineage in the scope's tool registry.
65
+ *
66
+ * A tool an app's adapter or plugin provides is owned by that adapter or plugin, so reading only
67
+ * `owner` gave it no app, and an `includeTools: (t) => t.appId !== 'admin'` filter let it through.
68
+ */
69
+ export declare function codeCallAppIdOf(scope: unknown, entry: CodeCallPolicyEntry): string | undefined;
70
+ /**
71
+ * Build the policy subject for a registry entry.
72
+ *
73
+ * Search indexing, `describe` and execution all build their subject here, so none of them can
74
+ * judge a different name than the others. Pass the scope so `appId` names the app of a tool its
75
+ * adapters or plugins provide.
76
+ */
77
+ export declare function toCodeCallPolicyTool(entry: CodeCallPolicyEntry, requestedName?: string, scope?: unknown): CodeCallPolicyTool;
78
+ /** The object `includeTools` and `directCalls.filter` receive, wherever the policy runs. */
79
+ export declare function toToolFilterInfo(tool: CodeCallPolicyTool): IncludeToolsFilterToolInfo;
80
+ /**
81
+ * Decide whether CodeCall may reach `tool`.
82
+ *
83
+ * Discovery and execution both call this. A tool the policy denies must be absent from
84
+ * search results AND rejected at `callTool` — hiding it from search is not authorization.
85
+ */
86
+ export declare function checkCodeCallToolPolicy(tool: CodeCallPolicyTool, config: CodeCallPolicyConfig): CodeCallPolicyDecision;
87
+ /**
88
+ * A tool the policy cannot evaluate is denied.
89
+ *
90
+ * `callTool` receives a bare string, so a name matching no resolvable tool would otherwise
91
+ * skip every metadata-driven check above and fall straight through to `tools:call-tool`.
92
+ */
93
+ export declare function denyUnknownTool(name: string): {
94
+ allowed: false;
95
+ reason: string;
96
+ };
97
+ interface ResolvableEntry {
98
+ name: string;
99
+ fullName: string;
100
+ }
101
+ /**
102
+ * Resolve a tool name exactly as `call-tool.flow.ts` `findTool` does.
103
+ *
104
+ * MUST mirror that stage. The policy has to evaluate the same entry the flow will execute:
105
+ * resolve more narrowly and legitimate remote-app tools get denied; resolve more loosely and
106
+ * a tool reachable only through the flow's fallback escapes the policy entirely. The flow
107
+ * applies three steps, and so does this —
108
+ * 1. the scope registry,
109
+ * 2. a hyphen <-> underscore alias (issue #408),
110
+ * 3. remote app registries, for tools whose subscription has not yet propagated.
111
+ */
112
+ export declare function resolveCodeCallTool<T extends ResolvableEntry>(scope: unknown, name: string): T | undefined;
113
+ /**
114
+ * Apply the `directCalls` options to a `codecall:invoke` request.
115
+ *
116
+ * These options were declared in the plugin schema and read by nothing, so `codecall:invoke`
117
+ * proxied the entire registry regardless of how an operator configured it. They narrow the
118
+ * base policy; they never widen it.
119
+ */
120
+ export declare function checkDirectCallPolicy(tool: CodeCallPolicyTool, directCalls: CodeCallDirectCallsConfig | undefined): CodeCallPolicyDecision;
121
+ interface PolicyConfigReader {
122
+ get(key: string): unknown;
123
+ }
124
+ /** Read the base policy options from the plugin config. */
125
+ export declare function readCodeCallPolicyConfig(config: PolicyConfigReader): CodeCallPolicyConfig;
126
+ /**
127
+ * Resolve a tool name and decide whether CodeCall may reach it.
128
+ *
129
+ * The one entry point for the meta-tools: `codecall:execute` calls it for every `callTool`
130
+ * and `getTool`, `codecall:describe` for every name it is asked about, and `codecall:invoke`
131
+ * for its single target with `directCall: true`. Sharing it is the point — the advisory
132
+ * existed because execution and discovery each had their own answer.
133
+ *
134
+ * An allow decision carries the resolved entry. Callers describe or run that entry rather than
135
+ * looking the name up again, which could land on a different tool than the one judged.
136
+ */
137
+ export declare function checkCodeCallToolAccess<T extends CodeCallPolicyEntry = CodeCallPolicyEntry>(scope: unknown, config: PolicyConfigReader, name: string, options?: {
138
+ directCall?: boolean;
139
+ }): CodeCallToolAccess<T>;
140
+ export {};
141
+ //# sourceMappingURL=codecall-tool-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codecall-tool-policy.d.ts","sourceRoot":"","sources":["../../src/security/codecall-tool-policy.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAK3B,oFAAoF;AACpF,UAAU,mBAAmB;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,2FAA2F;AAC3F,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,CAAC,EAAE;QACT,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,Q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export * from './codecall-tool-policy';
1
2
  export * from './self-reference-guard';
2
- export * from './tool-access-control.service';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
@@ -14,6 +14,13 @@ export interface EnclaveExecutionResult {
14
14
  toolName?: string;
15
15
  toolInput?: unknown;
16
16
  details?: unknown;
17
+ /**
18
+ * Distinct AST-validation issue codes, for the `codecall:security:ast-blocked` audit event.
19
+ *
20
+ * The enclave reports structured `issues` alongside the human-readable message; this branch
21
+ * used to discard them, which left the audit event with prose where a pattern belongs.
22
+ */
23
+ blockedPatterns?: string[];
17
24
  [key: string]: unknown;
18
25
  };
19
26
  logs: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"enclave.service.d.ts","sourceRoot":"","sources":["../../src/services/enclave.service.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAA6B,MAAM,oBAAoB,CAAC;AAE3F,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAC;AAEhE;;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,EA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,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB;;;;;WAKG;QACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3B,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;IAgGhG;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAgFzB"}
@@ -1,6 +1,5 @@
1
1
  export * from './audit-logger.service';
2
2
  export * from './output-sanitizer';
3
- export * from './error-enrichment.service';
4
3
  export * from './tool-search.service';
5
4
  export * from './synonym-expansion.service';
6
5
  export { default as EnclaveService } from './enclave.service';
@@ -1 +1 @@
1
- {"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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,7 +1,7 @@
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';
1
+ import { type ScopeEntry, type ToolEntry } from '@frontmcp/sdk';
2
+ import type { ToolSearchOptions as SymbolToolSearchOptions, ToolSearchResult as SymbolToolSearchResult, ToolSearch } from '../codecall.symbol';
3
+ import type { CodeCallEmbeddingOptions, CodeCallMode, EmbeddingStrategy } from '../codecall.types';
4
+ import { type SynonymExpansionConfig } from './synonym-expansion.service';
5
5
  /**
6
6
  * Search result for tool search
7
7
  */
@@ -123,19 +123,11 @@ export declare class ToolSearchService implements ToolSearch {
123
123
  */
124
124
  private handleToolChange;
125
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
- * - Excludes tools with hideFromDiscovery: true (system tools like sendElicitationResult)
130
- * - Mode-based filtering (codecall_only, codecall_opt_in, metadata_driven)
131
- * - Per-tool metadata.codecall.enabledInCodeCall
132
- * - Custom includeTools filter function
126
+ * Whether a tool belongs in the search index: exactly when CodeCall may execute it.
127
+ * The decision is `codecall:execute`'s own, so search cannot show a tool execution refuses
128
+ * or hide one it runs (GHSA-6w3j-82v5-6qrr).
133
129
  */
134
130
  private shouldIndexTool;
135
- /**
136
- * Extract CodeCall-specific metadata from a tool.
137
- */
138
- private getCodeCallMetadata;
139
131
  /**
140
132
  * Initializes the search service by indexing all tools from the registry.
141
133
  * NOTE: This method is now a no-op. Initialization is handled reactively
@@ -1 +1 @@
1
- {"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,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE;IACtC,IAAI,EAAE,MAAM,C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;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAkE7B;;;OAGG;IACH,OAAO,CAAC,UAAU;IAIlB;;OAEG;IACH,OAAO,CAAC,YAAY;IAKpB;;;OAGG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;IA4CrG;;OAEG;IACH,eAAe,IAAI,MAAM,EAAE;IAQ3B;;OAEG;IACH,aAAa,IAAI,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"describe.tool.d.ts","sourceRoot":"","sources":["../../src/tools/describe.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAkB,MAAM,eAAe,CAAC;AAIlE,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAuB3B,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IAC7C,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA2DpE;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAuBtB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAkDpB;;OAEG;IACH,OAAO,CAAC,YAAY;IA6BpB;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;CAyBzB"}
1
+ {"version":3,"file":"describe.tool.d.ts","sourceRoot":"","sources":["../../src/tools/describe.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAkB,MAAM,eAAe,CAAC;AAMlE,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAuB3B,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IAC7C,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgEpE;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAuBtB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAkDpB;;OAEG;IACH,OAAO,CAAC,YAAY;IA6BpB;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;CAyBzB"}
@@ -1,6 +1,15 @@
1
1
  import { ToolContext } from '@frontmcp/sdk';
2
2
  import { type CodeCallExecuteResult, type ExecuteToolInput } from './execute.schema';
3
3
  export default class ExecuteTool extends ToolContext {
4
+ /**
5
+ * Resolve the server-side CodeCall policy for a tool name (GHSA-6w3j-82v5-6qrr).
6
+ *
7
+ * Shares its decision with discovery and with `codecall:invoke`, so the three cannot
8
+ * diverge. A name matching no registered tool is denied rather than passed through —
9
+ * otherwise it would skip every metadata-driven check and reach `tools:call-tool`
10
+ * unexamined.
11
+ */
12
+ private checkToolPolicy;
4
13
  execute(input: ExecuteToolInput): Promise<CodeCallExecuteResult>;
5
14
  }
6
15
  //# sourceMappingURL=execute.tool.d.ts.map
@@ -1 +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,EAIL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAyC1B,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW;IAC5C,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAqPvE"}
1
+ {"version":3,"file":"execute.tool.d.ts","sourceRoot":"","sources":["../../src/tools/execute.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAkB,MAAM,eAAe,CAAC;AAuBlE,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAyC1B,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW;IAClD;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAIjB,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CA4UvE"}
@@ -6,6 +6,8 @@ import { InvokeToolInput, InvokeToolOutput } from './invoke.schema';
6
6
  *
7
7
  * Security Considerations:
8
8
  * - Self-reference blocking: Cannot invoke codecall:* tools
9
+ * - Shares the CodeCall access policy with `codecall:execute`, so a tool withheld from
10
+ * scripts is not reachable by naming it here instead (GHSA-6w3j-82v5-6qrr)
9
11
  * - All middleware (auth, PII, rate limiting) applies via normal tool execution
10
12
  */
11
13
  export default class InvokeTool extends ToolContext {
@@ -1 +1 @@
1
- {"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"}
1
+ {"version":3,"file":"invoke.tool.d.ts","sourceRoot":"","sources":["../../src/tools/invoke.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AAKlD,OAAO,EAEL,eAAe,EAEf,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AAYzB;;;;;;;;;GASG;AAeH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IAC3C,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAwDjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"search-knowledge.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search-knowledge.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAIL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,2BAA2B,CAAC;AA6BnC,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAAW;IACpD,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAgFnF"}
1
+ {"version":3,"file":"search-knowledge.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search-knowledge.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8B,WAAW,EAAE,MAAM,eAAe,CAAC;AAExE,OAAO,EAIL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,2BAA2B,CAAC;AA6BnC,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAAW;IACpD,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAiFnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"search-skills.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search-skills.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAmChC,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACjD,OAAO,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAiH7E"}
1
+ {"version":3,"file":"search-skills.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search-skills.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8B,WAAW,EAAE,MAAM,eAAe,CAAC;AAExE,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAmChC,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACjD,OAAO,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAkH7E"}
@@ -1 +1 @@
1
- {"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"}
1
+ {"version":3,"file":"search.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AAIlD,OAAO,EAEL,eAAe,EAEf,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AA6BzB,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IAC3C,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAgGjE"}
@@ -1,105 +0,0 @@
1
- import type { AuthInfo } from '@frontmcp/protocol';
2
- /**
3
- * Tool access control modes:
4
- * - whitelist: Only explicitly allowed tools can be called (most secure)
5
- * - blacklist: All tools allowed except explicitly blocked (default, more flexible)
6
- * - dynamic: Evaluate access per-call based on custom function
7
- */
8
- export type ToolAccessMode = 'whitelist' | 'blacklist' | 'dynamic';
9
- /**
10
- * Tool access policy configuration.
11
- */
12
- export interface ToolAccessPolicy {
13
- /**
14
- * Access control mode.
15
- * @default 'blacklist'
16
- */
17
- mode: ToolAccessMode;
18
- /**
19
- * Tools explicitly allowed (for whitelist mode).
20
- * Supports exact names and glob patterns (e.g., 'users:*').
21
- */
22
- whitelist?: string[];
23
- /**
24
- * Tools explicitly blocked (for blacklist mode).
25
- * Supports exact names and glob patterns (e.g., 'admin:*').
26
- */
27
- blacklist?: string[];
28
- /**
29
- * Pattern-based rules that apply in addition to whitelist/blacklist.
30
- */
31
- patterns?: {
32
- allow?: string[];
33
- deny?: string[];
34
- };
35
- /**
36
- * Custom evaluator function for dynamic mode.
37
- * Called for each tool access request.
38
- */
39
- evaluator?: (context: ToolAccessContext) => Promise<ToolAccessDecision>;
40
- }
41
- /**
42
- * Context provided to the access evaluator.
43
- */
44
- export interface ToolAccessContext {
45
- toolName: string;
46
- authInfo?: AuthInfo;
47
- executionId?: string;
48
- callDepth: number;
49
- timestamp: number;
50
- }
51
- /**
52
- * Decision from the access control check.
53
- */
54
- export interface ToolAccessDecision {
55
- allowed: boolean;
56
- reason?: string;
57
- }
58
- /**
59
- * Tool Access Control Service
60
- *
61
- * Provides centralized access control for tool calls within CodeCall.
62
- * Implements a layered security model:
63
- *
64
- * 1. Self-reference blocking (handled separately in self-reference-guard.ts)
65
- * 2. Default blacklist (always enforced)
66
- * 3. User-configured whitelist/blacklist
67
- * 4. Pattern matching (glob patterns)
68
- * 5. Dynamic evaluation (if configured)
69
- */
70
- export declare class ToolAccessControlService {
71
- private readonly policy;
72
- private readonly whitelistSet;
73
- private readonly blacklistSet;
74
- private readonly allowPatterns;
75
- private readonly denyPatterns;
76
- constructor(policy?: ToolAccessPolicy);
77
- /**
78
- * Check if a tool can be accessed.
79
- *
80
- * @param toolName - The tool being accessed
81
- * @param context - Optional access context for dynamic evaluation
82
- * @returns Decision indicating if access is allowed
83
- */
84
- checkAccess(toolName: string, context?: Partial<ToolAccessContext>): Promise<ToolAccessDecision>;
85
- private checkWhitelistMode;
86
- private checkBlacklistMode;
87
- private checkDynamicMode;
88
- /**
89
- * Check if a tool name matches any entry in a set (supports glob patterns).
90
- */
91
- private isInSet;
92
- /**
93
- * Convert a glob pattern to a RegExp.
94
- * Supports: * (any characters), ? (single character)
95
- *
96
- * Security: Prevents ReDoS by limiting pattern complexity and using non-greedy matching.
97
- */
98
- private globToRegex;
99
- /**
100
- * Get the current policy configuration (for debugging/testing).
101
- */
102
- getPolicy(): Readonly<ToolAccessPolicy>;
103
- }
104
- export default ToolAccessControlService;
105
- //# sourceMappingURL=tool-access-control.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool-access-control.service.d.ts","sourceRoot":"","sources":["../../src/security/tool-access-control.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,IAAI,EAAE,cAAc,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IAEF;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACzE;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAeD;;;;;;;;;;;GAWG;AACH,qBAIa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAW;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAW;gBAE5B,MAAM,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"}
@@ -1,95 +0,0 @@
1
- /**
2
- * Error categories for classification.
3
- */
4
- export declare const ERROR_CATEGORIES: {
5
- /** Script syntax or parsing error */
6
- readonly SYNTAX: "syntax";
7
- /** AST validation blocked dangerous code */
8
- readonly SECURITY: "security";
9
- /** Script exceeded timeout */
10
- readonly TIMEOUT: "timeout";
11
- /** Tool not found */
12
- readonly TOOL_NOT_FOUND: "tool_not_found";
13
- /** Tool access denied */
14
- readonly TOOL_ACCESS_DENIED: "tool_access_denied";
15
- /** Tool validation error */
16
- readonly TOOL_VALIDATION: "tool_validation";
17
- /** Tool execution error */
18
- readonly TOOL_EXECUTION: "tool_execution";
19
- /** Runtime error in script */
20
- readonly RUNTIME: "runtime";
21
- /** Unknown error */
22
- readonly UNKNOWN: "unknown";
23
- };
24
- export type ErrorCategory = (typeof ERROR_CATEGORIES)[keyof typeof ERROR_CATEGORIES];
25
- /**
26
- * Enriched error with actionable suggestions.
27
- */
28
- export interface EnrichedError {
29
- /** Error category */
30
- category: ErrorCategory;
31
- /** User-friendly error message */
32
- message: string;
33
- /** Actionable suggestions for fixing the error */
34
- suggestions: string[];
35
- /** Related documentation links */
36
- docs?: string[];
37
- /** Example of correct usage (if applicable) */
38
- example?: string;
39
- /** Original error code (if available) */
40
- code?: string;
41
- /** Whether the error is recoverable */
42
- recoverable: boolean;
43
- }
44
- /**
45
- * Error Enrichment Service
46
- *
47
- * Transforms raw errors into user-friendly, actionable error messages.
48
- * Provides suggestions for fixing common errors and links to documentation.
49
- *
50
- * Security: Never exposes internal details, only provides helpful guidance.
51
- */
52
- export declare class ErrorEnrichmentService {
53
- /**
54
- * Enrich an error with category, suggestions, and examples.
55
- *
56
- * @param error - The error to enrich (Error object, string, or unknown)
57
- * @param context - Optional context for more specific suggestions
58
- * @returns Enriched error with actionable information
59
- */
60
- enrich(error: unknown, context?: {
61
- toolName?: string;
62
- scriptSnippet?: string;
63
- }): EnrichedError;
64
- /**
65
- * Enrich a tool-specific error.
66
- */
67
- enrichToolError(toolName: string, errorCode: string, rawMessage?: string): EnrichedError;
68
- /**
69
- * Create a brief error summary for logging.
70
- */
71
- summarize(error: unknown): string;
72
- /**
73
- * Extract error message from various error types.
74
- */
75
- private extractMessage;
76
- /**
77
- * Extract error code if available.
78
- */
79
- private extractCode;
80
- /**
81
- * Format error message for user consumption.
82
- * Removes technical details while keeping useful information.
83
- */
84
- private formatMessage;
85
- /**
86
- * Get a human-readable prefix for error category.
87
- */
88
- private getCategoryPrefix;
89
- /**
90
- * Contextualize suggestions based on context.
91
- */
92
- private contextualizeSuggestions;
93
- }
94
- export default ErrorEnrichmentService;
95
- //# sourceMappingURL=error-enrichment.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-enrichment.service.d.ts","sourceRoot":"","sources":["../../src/services/error-enrichment.service.ts"],"names":[],"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