@goplus/agentguard 1.0.2 → 1.0.4
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/README.md +126 -12
- package/dist/adapters/claude-code.d.ts +16 -0
- package/dist/adapters/claude-code.d.ts.map +1 -0
- package/dist/adapters/claude-code.js +128 -0
- package/dist/adapters/claude-code.js.map +1 -0
- package/dist/adapters/common.d.ts +40 -0
- package/dist/adapters/common.d.ts.map +1 -0
- package/dist/adapters/common.js +166 -0
- package/dist/adapters/common.js.map +1 -0
- package/dist/adapters/engine.d.ts +9 -0
- package/dist/adapters/engine.d.ts.map +1 -0
- package/dist/adapters/engine.js +93 -0
- package/dist/adapters/engine.js.map +1 -0
- package/dist/adapters/index.d.ts +7 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +22 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/openclaw-plugin.d.ts +72 -0
- package/dist/adapters/openclaw-plugin.d.ts.map +1 -0
- package/dist/adapters/openclaw-plugin.js +369 -0
- package/dist/adapters/openclaw-plugin.js.map +1 -0
- package/dist/adapters/openclaw.d.ts +22 -0
- package/dist/adapters/openclaw.d.ts.map +1 -0
- package/dist/adapters/openclaw.js +118 -0
- package/dist/adapters/openclaw.js.map +1 -0
- package/dist/adapters/types.d.ts +81 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +3 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/tests/adapter.test.d.ts +2 -0
- package/dist/tests/adapter.test.d.ts.map +1 -0
- package/dist/tests/adapter.test.js +396 -0
- package/dist/tests/adapter.test.js.map +1 -0
- package/dist/tests/helpers/test-utils.d.ts +23 -0
- package/dist/tests/helpers/test-utils.d.ts.map +1 -0
- package/dist/tests/helpers/test-utils.js +37 -0
- package/dist/tests/helpers/test-utils.js.map +1 -0
- package/dist/tests/integration.test.d.ts +2 -0
- package/dist/tests/integration.test.d.ts.map +1 -0
- package/dist/tests/integration.test.js +229 -0
- package/dist/tests/integration.test.js.map +1 -0
- package/dist/tests/smoke.test.d.ts +2 -0
- package/dist/tests/smoke.test.d.ts.map +1 -0
- package/dist/tests/smoke.test.js +94 -0
- package/dist/tests/smoke.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenClawAdapter = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Tool name → action type mapping for OpenClaw
|
|
6
|
+
*/
|
|
7
|
+
const TOOL_ACTION_MAP = {
|
|
8
|
+
exec: 'exec_command',
|
|
9
|
+
write: 'write_file',
|
|
10
|
+
read: 'read_file',
|
|
11
|
+
web_fetch: 'network_request',
|
|
12
|
+
browser: 'network_request',
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* OpenClaw hook adapter
|
|
16
|
+
*
|
|
17
|
+
* Bridges OpenClaw's before_tool_call / after_tool_call plugin hooks
|
|
18
|
+
* to the common AgentGuard decision engine.
|
|
19
|
+
*
|
|
20
|
+
* OpenClaw plugin hooks receive an event object:
|
|
21
|
+
* { toolName: string, params: Record<string, any>, toolCallId?: string }
|
|
22
|
+
*
|
|
23
|
+
* Blocking is done by returning { block: true, blockReason: "..." }
|
|
24
|
+
* from the before_tool_call handler.
|
|
25
|
+
*/
|
|
26
|
+
class OpenClawAdapter {
|
|
27
|
+
name = 'openclaw';
|
|
28
|
+
parseInput(raw) {
|
|
29
|
+
const event = raw;
|
|
30
|
+
return {
|
|
31
|
+
toolName: event.toolName || '',
|
|
32
|
+
toolInput: event.params || {},
|
|
33
|
+
eventType: 'pre', // before_tool_call = pre
|
|
34
|
+
raw: event,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
mapToolToActionType(toolName) {
|
|
38
|
+
// Direct match
|
|
39
|
+
if (TOOL_ACTION_MAP[toolName]) {
|
|
40
|
+
return TOOL_ACTION_MAP[toolName];
|
|
41
|
+
}
|
|
42
|
+
// Prefix match for tool families (e.g. "exec_python" → "exec_command")
|
|
43
|
+
for (const [prefix, actionType] of Object.entries(TOOL_ACTION_MAP)) {
|
|
44
|
+
if (toolName.startsWith(prefix)) {
|
|
45
|
+
return actionType;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
buildEnvelope(input, initiatingSkill) {
|
|
51
|
+
const actionType = this.mapToolToActionType(input.toolName);
|
|
52
|
+
if (!actionType)
|
|
53
|
+
return null;
|
|
54
|
+
const actor = {
|
|
55
|
+
skill: {
|
|
56
|
+
id: initiatingSkill || 'openclaw-session',
|
|
57
|
+
source: initiatingSkill || 'openclaw',
|
|
58
|
+
version_ref: '0.0.0',
|
|
59
|
+
artifact_hash: '',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const context = {
|
|
63
|
+
session_id: `openclaw-${Date.now()}`,
|
|
64
|
+
user_present: true,
|
|
65
|
+
env: 'prod',
|
|
66
|
+
time: new Date().toISOString(),
|
|
67
|
+
initiating_skill: initiatingSkill || undefined,
|
|
68
|
+
};
|
|
69
|
+
let actionData;
|
|
70
|
+
switch (actionType) {
|
|
71
|
+
case 'exec_command':
|
|
72
|
+
actionData = {
|
|
73
|
+
command: input.toolInput.command || '',
|
|
74
|
+
args: [],
|
|
75
|
+
};
|
|
76
|
+
break;
|
|
77
|
+
case 'write_file':
|
|
78
|
+
actionData = {
|
|
79
|
+
path: input.toolInput.path ||
|
|
80
|
+
input.toolInput.file_path || '',
|
|
81
|
+
};
|
|
82
|
+
break;
|
|
83
|
+
case 'read_file':
|
|
84
|
+
actionData = {
|
|
85
|
+
path: input.toolInput.path ||
|
|
86
|
+
input.toolInput.file_path || '',
|
|
87
|
+
};
|
|
88
|
+
break;
|
|
89
|
+
case 'network_request':
|
|
90
|
+
actionData = {
|
|
91
|
+
method: input.toolInput.method || 'GET',
|
|
92
|
+
url: input.toolInput.url || '',
|
|
93
|
+
body_preview: input.toolInput.body,
|
|
94
|
+
};
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
actor,
|
|
101
|
+
action: { type: actionType, data: actionData },
|
|
102
|
+
context,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
async inferInitiatingSkill(input) {
|
|
106
|
+
// Try to get plugin ID from tool → plugin mapping
|
|
107
|
+
try {
|
|
108
|
+
const { getPluginIdFromTool } = await import('./openclaw-plugin.js');
|
|
109
|
+
return getPluginIdFromTool(input.toolName);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Mapping not available (plugin not loaded)
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.OpenClawAdapter = OpenClawAdapter;
|
|
118
|
+
//# sourceMappingURL=openclaw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openclaw.js","sourceRoot":"","sources":["../../src/adapters/openclaw.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAM,eAAe,GAA2B;IAC9C,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,WAAW;IACjB,SAAS,EAAE,iBAAiB;IAC5B,OAAO,EAAE,iBAAiB;CAC3B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAa,eAAe;IACjB,IAAI,GAAG,UAAU,CAAC;IAE3B,UAAU,CAAC,GAAY;QACrB,MAAM,KAAK,GAAG,GAA8B,CAAC;QAC7C,OAAO;YACL,QAAQ,EAAG,KAAK,CAAC,QAAmB,IAAI,EAAE;YAC1C,SAAS,EAAG,KAAK,CAAC,MAAkC,IAAI,EAAE;YAC1D,SAAS,EAAE,KAAK,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;iBACT,CAAC;gBACF,MAAM;YAER,KAAK,YAAY;gBACf,UAAU,GAAG;oBACX,IAAI,EAAG,KAAK,CAAC,SAAS,CAAC,IAAe;wBAC/B,KAAK,CAAC,SAAS,CAAC,SAAoB,IAAI,EAAE;iBAClD,CAAC;gBACF,MAAM;YAER,KAAK,WAAW;gBACd,UAAU,GAAG;oBACX,IAAI,EAAG,KAAK,CAAC,SAAS,CAAC,IAAe;wBAC/B,KAAK,CAAC,SAAS,CAAC,SAAoB,IAAI,EAAE;iBAClD,CAAC;gBACF,MAAM;YAER,KAAK,iBAAiB;gBACpB,UAAU,GAAG;oBACX,MAAM,EAAG,KAAK,CAAC,SAAS,CAAC,MAAiB,IAAI,KAAK;oBACnD,GAAG,EAAG,KAAK,CAAC,SAAS,CAAC,GAAc,IAAI,EAAE;oBAC1C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,IAA0B;iBACzD,CAAC;gBACF,MAAM;YAER;gBACE,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO;YACL,KAAK;YACL,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE;YAC9C,OAAO;SACqB,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,KAAgB;QACzC,kDAAkD;QAClD,IAAI,CAAC;YACH,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;YACrE,OAAO,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7C,CAAC;QAAC,MAAM,CAAC;YACP,4CAA4C;YAC5C,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AArGD,0CAqGC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ActionEnvelope, PolicyDecision } from '../types/action.js';
|
|
2
|
+
/**
|
|
3
|
+
* Standardized hook input — platform-agnostic representation
|
|
4
|
+
*/
|
|
5
|
+
export interface HookInput {
|
|
6
|
+
/** Tool name (platform-specific, e.g. "Bash" or "exec") */
|
|
7
|
+
toolName: string;
|
|
8
|
+
/** Tool parameters */
|
|
9
|
+
toolInput: Record<string, unknown>;
|
|
10
|
+
/** Hook event type */
|
|
11
|
+
eventType: 'pre' | 'post';
|
|
12
|
+
/** Session identifier */
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
/** Working directory */
|
|
15
|
+
cwd?: string;
|
|
16
|
+
/** Raw platform-specific input */
|
|
17
|
+
raw: unknown;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Hook evaluation result
|
|
21
|
+
*/
|
|
22
|
+
export interface HookOutput {
|
|
23
|
+
/** Decision */
|
|
24
|
+
decision: 'allow' | 'deny' | 'ask';
|
|
25
|
+
/** Human-readable reason */
|
|
26
|
+
reason?: string;
|
|
27
|
+
/** Risk level */
|
|
28
|
+
riskLevel?: string;
|
|
29
|
+
/** Risk tags */
|
|
30
|
+
riskTags?: string[];
|
|
31
|
+
/** Initiating skill (if detected) */
|
|
32
|
+
initiatingSkill?: string | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Platform adapter interface
|
|
36
|
+
*
|
|
37
|
+
* Each platform (Claude Code, OpenClaw, etc.) implements this interface
|
|
38
|
+
* to bridge its hook protocol to the common AgentGuard decision engine.
|
|
39
|
+
*/
|
|
40
|
+
export interface HookAdapter {
|
|
41
|
+
/** Platform identifier */
|
|
42
|
+
readonly name: string;
|
|
43
|
+
/** Parse raw platform input into standardized HookInput */
|
|
44
|
+
parseInput(raw: unknown): HookInput;
|
|
45
|
+
/** Map platform tool name to ActionEnvelope action type */
|
|
46
|
+
mapToolToActionType(toolName: string): string | null;
|
|
47
|
+
/** Build an ActionEnvelope from standardized input */
|
|
48
|
+
buildEnvelope(input: HookInput, initiatingSkill?: string | null): ActionEnvelope | null;
|
|
49
|
+
/** Infer which skill initiated the current tool call */
|
|
50
|
+
inferInitiatingSkill(input: HookInput): Promise<string | null>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Agentguard instance interface (subset used by engine)
|
|
54
|
+
*/
|
|
55
|
+
export interface AgentGuardInstance {
|
|
56
|
+
actionScanner: {
|
|
57
|
+
decide(envelope: ActionEnvelope): Promise<PolicyDecision>;
|
|
58
|
+
};
|
|
59
|
+
registry: {
|
|
60
|
+
lookup(skill: {
|
|
61
|
+
id: string;
|
|
62
|
+
source: string;
|
|
63
|
+
version_ref: string;
|
|
64
|
+
artifact_hash: string;
|
|
65
|
+
}): Promise<{
|
|
66
|
+
effective_trust_level: string;
|
|
67
|
+
effective_capabilities: Record<string, unknown>;
|
|
68
|
+
record: unknown | null;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Engine options
|
|
74
|
+
*/
|
|
75
|
+
export interface EngineOptions {
|
|
76
|
+
config: {
|
|
77
|
+
level?: string;
|
|
78
|
+
};
|
|
79
|
+
agentguard: AgentGuardInstance;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,sBAAsB;IACtB,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;GAEG;AACH,MAA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AM,EAAE,OAAO,GAAG,IAAI,CAAC;SACxB,CAAC,CAAC;KACJ,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3B,UAAU,EAAE,kBAAkB,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { SkillRegistry, RegistryStorage, type RegistryOptions, type StorageOptio
|
|
|
12
12
|
export { ActionScanner, GoPlusClient, type ActionScannerOptions, } from './action/index.js';
|
|
13
13
|
export { DEFAULT_POLICIES, RESTRICTIVE_CAPABILITY, PERMISSIVE_CAPABILITY, CAPABILITY_PRESETS, type PolicyConfig, } from './policy/default.js';
|
|
14
14
|
export { containsSensitiveData, maskSensitiveData, extractDomain, isDomainAllowed, SENSITIVE_PATTERNS, } from './utils/patterns.js';
|
|
15
|
+
export { ClaudeCodeAdapter, OpenClawAdapter, evaluateHook, registerOpenClawPlugin, loadConfig, type HookAdapter, type HookInput, type HookOutput, type EngineOptions, } from './adapters/index.js';
|
|
15
16
|
import { SkillScanner } from './scanner/index.js';
|
|
16
17
|
import { SkillRegistry } from './registry/index.js';
|
|
17
18
|
import { ActionScanner } from './action/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACL,aAAa,EACb,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,GACl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AAe,EACf,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,sBAAsB,EACtB,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;;;;EAgBA;AAGD,eAAe,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
22
22
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.SENSITIVE_PATTERNS = exports.isDomainAllowed = exports.extractDomain = exports.maskSensitiveData = exports.containsSensitiveData = exports.CAPABILITY_PRESETS = exports.PERMISSIVE_CAPABILITY = exports.RESTRICTIVE_CAPABILITY = exports.DEFAULT_POLICIES = exports.GoPlusClient = exports.ActionScanner = exports.RegistryStorage = exports.SkillRegistry = exports.SkillScanner = void 0;
|
|
25
|
+
exports.loadConfig = exports.registerOpenClawPlugin = exports.evaluateHook = exports.OpenClawAdapter = exports.ClaudeCodeAdapter = exports.SENSITIVE_PATTERNS = exports.isDomainAllowed = exports.extractDomain = exports.maskSensitiveData = exports.containsSensitiveData = exports.CAPABILITY_PRESETS = exports.PERMISSIVE_CAPABILITY = exports.RESTRICTIVE_CAPABILITY = exports.DEFAULT_POLICIES = exports.GoPlusClient = exports.ActionScanner = exports.RegistryStorage = exports.SkillRegistry = exports.SkillScanner = void 0;
|
|
26
26
|
exports.createAgentGuard = createAgentGuard;
|
|
27
27
|
// Export types
|
|
28
28
|
__exportStar(require("./types/index.js"), exports);
|
|
@@ -48,21 +48,28 @@ Object.defineProperty(exports, "maskSensitiveData", { enumerable: true, get: fun
|
|
|
48
48
|
Object.defineProperty(exports, "extractDomain", { enumerable: true, get: function () { return patterns_js_1.extractDomain; } });
|
|
49
49
|
Object.defineProperty(exports, "isDomainAllowed", { enumerable: true, get: function () { return patterns_js_1.isDomainAllowed; } });
|
|
50
50
|
Object.defineProperty(exports, "SENSITIVE_PATTERNS", { enumerable: true, get: function () { return patterns_js_1.SENSITIVE_PATTERNS; } });
|
|
51
|
+
// Export adapters (multi-platform hook support)
|
|
52
|
+
var index_js_4 = require("./adapters/index.js");
|
|
53
|
+
Object.defineProperty(exports, "ClaudeCodeAdapter", { enumerable: true, get: function () { return index_js_4.ClaudeCodeAdapter; } });
|
|
54
|
+
Object.defineProperty(exports, "OpenClawAdapter", { enumerable: true, get: function () { return index_js_4.OpenClawAdapter; } });
|
|
55
|
+
Object.defineProperty(exports, "evaluateHook", { enumerable: true, get: function () { return index_js_4.evaluateHook; } });
|
|
56
|
+
Object.defineProperty(exports, "registerOpenClawPlugin", { enumerable: true, get: function () { return index_js_4.registerOpenClawPlugin; } });
|
|
57
|
+
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return index_js_4.loadConfig; } });
|
|
51
58
|
// Convenience factory functions
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
59
|
+
const index_js_5 = require("./scanner/index.js");
|
|
60
|
+
const index_js_6 = require("./registry/index.js");
|
|
61
|
+
const index_js_7 = require("./action/index.js");
|
|
55
62
|
/**
|
|
56
63
|
* Create a complete AgentGuard instance with all modules
|
|
57
64
|
*/
|
|
58
65
|
function createAgentGuard(options) {
|
|
59
|
-
const registry = new
|
|
66
|
+
const registry = new index_js_6.SkillRegistry({
|
|
60
67
|
filePath: options?.registryPath,
|
|
61
68
|
});
|
|
62
|
-
const scanner = new
|
|
69
|
+
const scanner = new index_js_5.SkillScanner({
|
|
63
70
|
useExternalScanner: options?.useExternalScanner ?? true,
|
|
64
71
|
});
|
|
65
|
-
const actionScanner = new
|
|
72
|
+
const actionScanner = new index_js_7.ActionScanner({ registry });
|
|
66
73
|
return {
|
|
67
74
|
scanner,
|
|
68
75
|
registry,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;AA4DH,4CAmBC;AA7ED,eAAe;AACf,mDAAiC;AAEjC,iBAAiB;AACjB,+CAAuE;AAA9D,wGAAA,YAAY,OAAA;AACrB,gDAO6B;AAN3B,yGAAA,aAAa,OAAA;AACb,2GAAA,eAAe,OAAA;AAMjB,8CAI2B;AAHzB,yGAAA,aAAa,OAAA;AACb,wGAAA,YAAY,OAAA;AAId,wBAAwB;AACxB,kDAM6B;AAL3B,8GAAA,gBAAgB,OAAA;AAChB,oHAAA,sBAAsB,OAAA;AACtB,mHAAA,qBAAqB,OAAA;AACrB,gHAAA,kBAAkB,OAAA;AAIpB,2BAA2B;AAC3B,mDAM6B;AAL3B,oHAAA,qBAAqB,OAAA;AACrB,gHAAA,iBAAiB,OAAA;AACjB,4GAAA,aAAa,OAAA;AACb,8GAAA,eAAe,OAAA;AACf,iHAAA,kBAAkB,OAAA;AAGpB,gDAAgD;AAChD,gDAU6B;AAT3B,6GAAA,iBAAiB,OAAA;AACjB,2GAAA,eAAe,OAAA;AACf,wGAAA,YAAY,OAAA;AACZ,kHAA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