@frontmcp/plugin-codecall 1.8.0 → 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/codecall.plugin.d.ts.map +1 -1
- package/esm/index.mjs +535 -199
- package/esm/package.json +5 -5
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +559 -221
- package/package.json +5 -5
- package/security/codecall-tool-policy.d.ts +67 -15
- package/security/codecall-tool-policy.d.ts.map +1 -1
- package/security/index.d.ts +0 -1
- package/security/index.d.ts.map +1 -1
- package/services/enclave.service.d.ts +7 -0
- package/services/enclave.service.d.ts.map +1 -1
- package/services/index.d.ts +0 -1
- package/services/index.d.ts.map +1 -1
- package/services/tool-search.service.d.ts +7 -15
- package/services/tool-search.service.d.ts.map +1 -1
- package/tools/describe.tool.d.ts.map +1 -1
- package/tools/execute.tool.d.ts.map +1 -1
- package/tools/invoke.tool.d.ts.map +1 -1
- package/tools/search-knowledge.tool.d.ts.map +1 -1
- package/tools/search-skills.tool.d.ts.map +1 -1
- package/tools/search.tool.d.ts.map +1 -1
- package/security/tool-access-control.service.d.ts +0 -115
- package/security/tool-access-control.service.d.ts.map +0 -1
- package/services/error-enrichment.service.d.ts +0 -95
- package/services/error-enrichment.service.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-codecall",
|
|
3
|
-
"version": "1.8.
|
|
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.8.
|
|
53
|
-
"@frontmcp/sdk": "1.8.
|
|
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.8.
|
|
58
|
-
"@frontmcp/plugin-cache": "1.8.
|
|
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"
|
|
@@ -1,20 +1,39 @@
|
|
|
1
|
-
import type { CodeCallMode, CodeCallToolMetadata, DirectCallsFilterFn, IncludeToolsFilterFn } from '../codecall.types';
|
|
2
|
-
/**
|
|
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`. */
|
|
3
21
|
export interface CodeCallPolicyTool {
|
|
4
|
-
/**
|
|
22
|
+
/** The tool's own name: the `name` search indexes and `includeTools` receives. */
|
|
5
23
|
name: string;
|
|
24
|
+
/** The qualified `<owner>:<name>` spelling, which the flow dispatches as well. */
|
|
25
|
+
fullName?: string;
|
|
6
26
|
/**
|
|
7
|
-
*
|
|
27
|
+
* Further spellings, such as the name the caller asked for.
|
|
8
28
|
*
|
|
9
|
-
* The namespace rules
|
|
10
|
-
*
|
|
11
|
-
* one — so judging a single spelling lets the other one through.
|
|
29
|
+
* The namespace rules deny under every spelling, because judging one lets another through.
|
|
30
|
+
* No allow decision ever reads an alias.
|
|
12
31
|
*/
|
|
13
32
|
aliases?: string[];
|
|
14
33
|
appId?: string;
|
|
15
34
|
description?: string;
|
|
16
35
|
tags?: string[];
|
|
17
|
-
|
|
36
|
+
hidden?: boolean;
|
|
18
37
|
codecall?: CodeCallToolMetadata;
|
|
19
38
|
}
|
|
20
39
|
export interface CodeCallPolicyConfig {
|
|
@@ -33,6 +52,31 @@ export type CodeCallPolicyDecision = {
|
|
|
33
52
|
allowed: false;
|
|
34
53
|
reason: string;
|
|
35
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;
|
|
36
80
|
/**
|
|
37
81
|
* Decide whether CodeCall may reach `tool`.
|
|
38
82
|
*
|
|
@@ -46,7 +90,10 @@ export declare function checkCodeCallToolPolicy(tool: CodeCallPolicyTool, config
|
|
|
46
90
|
* `callTool` receives a bare string, so a name matching no resolvable tool would otherwise
|
|
47
91
|
* skip every metadata-driven check above and fall straight through to `tools:call-tool`.
|
|
48
92
|
*/
|
|
49
|
-
export declare function denyUnknownTool(name: string):
|
|
93
|
+
export declare function denyUnknownTool(name: string): {
|
|
94
|
+
allowed: false;
|
|
95
|
+
reason: string;
|
|
96
|
+
};
|
|
50
97
|
interface ResolvableEntry {
|
|
51
98
|
name: string;
|
|
52
99
|
fullName: string;
|
|
@@ -74,16 +121,21 @@ export declare function checkDirectCallPolicy(tool: CodeCallPolicyTool, directCa
|
|
|
74
121
|
interface PolicyConfigReader {
|
|
75
122
|
get(key: string): unknown;
|
|
76
123
|
}
|
|
124
|
+
/** Read the base policy options from the plugin config. */
|
|
125
|
+
export declare function readCodeCallPolicyConfig(config: PolicyConfigReader): CodeCallPolicyConfig;
|
|
77
126
|
/**
|
|
78
127
|
* Resolve a tool name and decide whether CodeCall may reach it.
|
|
79
128
|
*
|
|
80
|
-
* The one entry point for
|
|
81
|
-
* and `getTool`, `codecall:
|
|
82
|
-
*
|
|
83
|
-
* answer.
|
|
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.
|
|
84
136
|
*/
|
|
85
|
-
export declare function checkCodeCallToolAccess(scope: unknown, config: PolicyConfigReader, name: string, options?: {
|
|
137
|
+
export declare function checkCodeCallToolAccess<T extends CodeCallPolicyEntry = CodeCallPolicyEntry>(scope: unknown, config: PolicyConfigReader, name: string, options?: {
|
|
86
138
|
directCall?: boolean;
|
|
87
|
-
}):
|
|
139
|
+
}): CodeCallToolAccess<T>;
|
|
88
140
|
export {};
|
|
89
141
|
//# sourceMappingURL=codecall-tool-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecall-tool-policy.d.ts","sourceRoot":"","sources":["../../src/security/codecall-tool-policy.ts"],"names":[],"mappings":"
|
|
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,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package/security/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,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,C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,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;;;;;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"}
|
package/services/index.d.ts
CHANGED
|
@@ -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';
|
package/services/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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 {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
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
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
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":"
|
|
1
|
+
{"version":3,"file":"tool-search.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-search.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,KAAK,EACV,iBAAiB,IAAI,uBAAuB,EAC5C,gBAAgB,IAAI,sBAAsB,EAC1C,UAAU,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEnG,OAAO,EAA2B,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAoMnG;;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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":3,"file":"describe.tool.d.ts","sourceRoot":"","sources":["../../src/tools/describe.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAkB,MAAM,eAAe,CAAC;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.tool.d.ts","sourceRoot":"","sources":["../../src/tools/execute.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,
|
|
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,
|
|
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;
|
|
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,115 +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
|
-
* NOT ON THE ENFORCEMENT PATH. Nothing constructs this service: the plugin declares
|
|
62
|
-
* `providers: []`, no `ToolAccessPolicy` can be supplied through the plugin options, and
|
|
63
|
-
* neither `codecall:execute` nor `codecall:invoke` consults it. Its unit tests pass by
|
|
64
|
-
* constructing it directly, which is exactly how GHSA-6w3j-82v5-6qrr stayed invisible — a
|
|
65
|
-
* green suite for a control that never ran.
|
|
66
|
-
*
|
|
67
|
-
* The policy CodeCall actually enforces lives in `codecall-tool-policy.ts`
|
|
68
|
-
* (`checkCodeCallToolAccess`), called by both meta-tools. This class is kept only so the
|
|
69
|
-
* exported types do not disappear from the package's public surface in a security patch;
|
|
70
|
-
* wiring it in, or removing it, is a follow-up with its own BC note.
|
|
71
|
-
*
|
|
72
|
-
* The richer model it offers, unused today:
|
|
73
|
-
*
|
|
74
|
-
* 1. Self-reference blocking (handled separately in self-reference-guard.ts)
|
|
75
|
-
* 2. Default blacklist (always enforced)
|
|
76
|
-
* 3. User-configured whitelist/blacklist
|
|
77
|
-
* 4. Pattern matching (glob patterns)
|
|
78
|
-
* 5. Dynamic evaluation (if configured)
|
|
79
|
-
*/
|
|
80
|
-
export declare class ToolAccessControlService {
|
|
81
|
-
private readonly policy;
|
|
82
|
-
private readonly whitelistSet;
|
|
83
|
-
private readonly blacklistSet;
|
|
84
|
-
private readonly allowPatterns;
|
|
85
|
-
private readonly denyPatterns;
|
|
86
|
-
constructor(policy?: ToolAccessPolicy);
|
|
87
|
-
/**
|
|
88
|
-
* Check if a tool can be accessed.
|
|
89
|
-
*
|
|
90
|
-
* @param toolName - The tool being accessed
|
|
91
|
-
* @param context - Optional access context for dynamic evaluation
|
|
92
|
-
* @returns Decision indicating if access is allowed
|
|
93
|
-
*/
|
|
94
|
-
checkAccess(toolName: string, context?: Partial<ToolAccessContext>): Promise<ToolAccessDecision>;
|
|
95
|
-
private checkWhitelistMode;
|
|
96
|
-
private checkBlacklistMode;
|
|
97
|
-
private checkDynamicMode;
|
|
98
|
-
/**
|
|
99
|
-
* Check if a tool name matches any entry in a set (supports glob patterns).
|
|
100
|
-
*/
|
|
101
|
-
private isInSet;
|
|
102
|
-
/**
|
|
103
|
-
* Convert a glob pattern to a RegExp.
|
|
104
|
-
* Supports: * (any characters), ? (single character)
|
|
105
|
-
*
|
|
106
|
-
* Security: Prevents ReDoS by limiting pattern complexity and using non-greedy matching.
|
|
107
|
-
*/
|
|
108
|
-
private globToRegex;
|
|
109
|
-
/**
|
|
110
|
-
* Get the current policy configuration (for debugging/testing).
|
|
111
|
-
*/
|
|
112
|
-
getPolicy(): Readonly<ToolAccessPolicy>;
|
|
113
|
-
}
|
|
114
|
-
export default ToolAccessControlService;
|
|
115
|
-
//# 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":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;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;;;;;;;;;;;;;;;;;;;;;GAqBG;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":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B,qCAAqC;;IAErC,4CAA4C;;IAE5C,8BAA8B;;IAE9B,qBAAqB;;IAErB,yBAAyB;;IAEzB,4BAA4B;;IAE5B,2BAA2B;;IAE3B,8BAA8B;;IAE9B,oBAAoB;;CAEZ,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,QAAQ,EAAE,aAAa,CAAC;IACxB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,WAAW,EA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