fastgrc-openclaw 1.0.17 → 1.0.19
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/dist/bin.js +5 -4
- package/dist/bin.mjs +5 -4
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +16 -2
- package/dist/index.mjs +14 -1
- package/dist/plugin.js +15 -4
- package/dist/plugin.mjs +15 -4
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -152,8 +152,9 @@ if (cmd === "unset-policy") {
|
|
|
152
152
|
if (cmd === "install-hook") {
|
|
153
153
|
const targetDir = arg || process.cwd();
|
|
154
154
|
const hookMdPath = path.join(targetDir, "HOOK.md");
|
|
155
|
+
const binPath = process.argv[1];
|
|
155
156
|
const homeDir = os.homedir();
|
|
156
|
-
const handlerStr = `HOME=${homeDir}
|
|
157
|
+
const handlerStr = `HOME=${homeDir} node ${binPath}`;
|
|
157
158
|
const HOOK_ENTRY = ` - matcher: PreToolUse
|
|
158
159
|
handler: "${handlerStr}"
|
|
159
160
|
`;
|
|
@@ -176,13 +177,13 @@ Restart OpenClaw \u2014 FastGRC will evaluate every tool call.
|
|
|
176
177
|
`);
|
|
177
178
|
process.exit(0);
|
|
178
179
|
}
|
|
179
|
-
if (existing.includes("fastgrc-hook")) {
|
|
180
|
+
if (existing.includes("fastgrc-hook") || existing.includes("fastgrc-openclaw")) {
|
|
180
181
|
const patched = existing.replace(
|
|
181
|
-
/handler:\s*"[^"]*fastgrc-hook[^"]*"/,
|
|
182
|
+
/handler:\s*"[^"]*(?:fastgrc-hook|fastgrc-openclaw)[^"]*"/,
|
|
182
183
|
`handler: "${handlerStr}"`
|
|
183
184
|
);
|
|
184
185
|
fs.writeFileSync(hookMdPath, patched, "utf8");
|
|
185
|
-
process.stdout.write(`\u2713 Updated handler in ${hookMdPath} \u2014
|
|
186
|
+
process.stdout.write(`\u2713 Updated handler in ${hookMdPath} \u2014 now uses absolute path.
|
|
186
187
|
|
|
187
188
|
Restart OpenClaw to activate.
|
|
188
189
|
`);
|
package/dist/bin.mjs
CHANGED
|
@@ -129,8 +129,9 @@ if (cmd === "unset-policy") {
|
|
|
129
129
|
if (cmd === "install-hook") {
|
|
130
130
|
const targetDir = arg || process.cwd();
|
|
131
131
|
const hookMdPath = path.join(targetDir, "HOOK.md");
|
|
132
|
+
const binPath = process.argv[1];
|
|
132
133
|
const homeDir = os.homedir();
|
|
133
|
-
const handlerStr = `HOME=${homeDir}
|
|
134
|
+
const handlerStr = `HOME=${homeDir} node ${binPath}`;
|
|
134
135
|
const HOOK_ENTRY = ` - matcher: PreToolUse
|
|
135
136
|
handler: "${handlerStr}"
|
|
136
137
|
`;
|
|
@@ -153,13 +154,13 @@ Restart OpenClaw \u2014 FastGRC will evaluate every tool call.
|
|
|
153
154
|
`);
|
|
154
155
|
process.exit(0);
|
|
155
156
|
}
|
|
156
|
-
if (existing.includes("fastgrc-hook")) {
|
|
157
|
+
if (existing.includes("fastgrc-hook") || existing.includes("fastgrc-openclaw")) {
|
|
157
158
|
const patched = existing.replace(
|
|
158
|
-
/handler:\s*"[^"]*fastgrc-hook[^"]*"/,
|
|
159
|
+
/handler:\s*"[^"]*(?:fastgrc-hook|fastgrc-openclaw)[^"]*"/,
|
|
159
160
|
`handler: "${handlerStr}"`
|
|
160
161
|
);
|
|
161
162
|
fs.writeFileSync(hookMdPath, patched, "utf8");
|
|
162
|
-
process.stdout.write(`\u2713 Updated handler in ${hookMdPath} \u2014
|
|
163
|
+
process.stdout.write(`\u2713 Updated handler in ${hookMdPath} \u2014 now uses absolute path.
|
|
163
164
|
|
|
164
165
|
Restart OpenClaw to activate.
|
|
165
166
|
`);
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
declare function resolveApiKey(explicit?: string): string | undefined;
|
|
2
|
+
declare function resolveConfig(explicit?: {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
policyId?: string;
|
|
5
|
+
}): {
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
policyId?: string;
|
|
8
|
+
};
|
|
2
9
|
interface FastGRCPluginOptions {
|
|
3
10
|
/**
|
|
4
11
|
* Your FastGRC API key (fgrc_k1_...).
|
|
@@ -76,4 +83,4 @@ declare function evaluate(payload: {
|
|
|
76
83
|
}): Promise<EvaluateResponse | null>;
|
|
77
84
|
declare function FastGRCPlugin(options: FastGRCPluginOptions): OpenClawPlugin;
|
|
78
85
|
|
|
79
|
-
export { FastGRCApprovalRequiredError, FastGRCBlockedError, FastGRCPlugin, type FastGRCPluginOptions, evaluate, resolveApiKey };
|
|
86
|
+
export { FastGRCApprovalRequiredError, FastGRCBlockedError, FastGRCPlugin, type FastGRCPluginOptions, evaluate, resolveApiKey, resolveConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
declare function resolveApiKey(explicit?: string): string | undefined;
|
|
2
|
+
declare function resolveConfig(explicit?: {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
policyId?: string;
|
|
5
|
+
}): {
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
policyId?: string;
|
|
8
|
+
};
|
|
2
9
|
interface FastGRCPluginOptions {
|
|
3
10
|
/**
|
|
4
11
|
* Your FastGRC API key (fgrc_k1_...).
|
|
@@ -76,4 +83,4 @@ declare function evaluate(payload: {
|
|
|
76
83
|
}): Promise<EvaluateResponse | null>;
|
|
77
84
|
declare function FastGRCPlugin(options: FastGRCPluginOptions): OpenClawPlugin;
|
|
78
85
|
|
|
79
|
-
export { FastGRCApprovalRequiredError, FastGRCBlockedError, FastGRCPlugin, type FastGRCPluginOptions, evaluate, resolveApiKey };
|
|
86
|
+
export { FastGRCApprovalRequiredError, FastGRCBlockedError, FastGRCPlugin, type FastGRCPluginOptions, evaluate, resolveApiKey, resolveConfig };
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,8 @@ __export(index_exports, {
|
|
|
34
34
|
FastGRCBlockedError: () => FastGRCBlockedError,
|
|
35
35
|
FastGRCPlugin: () => FastGRCPlugin,
|
|
36
36
|
evaluate: () => evaluate,
|
|
37
|
-
resolveApiKey: () => resolveApiKey
|
|
37
|
+
resolveApiKey: () => resolveApiKey,
|
|
38
|
+
resolveConfig: () => resolveConfig
|
|
38
39
|
});
|
|
39
40
|
module.exports = __toCommonJS(index_exports);
|
|
40
41
|
var fs = __toESM(require("fs"));
|
|
@@ -52,6 +53,18 @@ function resolveApiKey(explicit) {
|
|
|
52
53
|
}
|
|
53
54
|
return void 0;
|
|
54
55
|
}
|
|
56
|
+
function resolveConfig(explicit) {
|
|
57
|
+
const apiKey = resolveApiKey(explicit?.apiKey);
|
|
58
|
+
let policyId = explicit?.policyId;
|
|
59
|
+
if (!policyId) {
|
|
60
|
+
try {
|
|
61
|
+
const cfg = JSON.parse(fs.readFileSync(path.join(os.homedir(), ".fastgrc.json"), "utf8"));
|
|
62
|
+
if (cfg.policyId) policyId = cfg.policyId;
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return { apiKey, policyId };
|
|
67
|
+
}
|
|
55
68
|
var FastGRCBlockedError = class extends Error {
|
|
56
69
|
constructor(matchedRule, reasoning, policyId) {
|
|
57
70
|
super(
|
|
@@ -179,6 +192,7 @@ function FastGRCPlugin(options) {
|
|
|
179
192
|
FastGRCBlockedError,
|
|
180
193
|
FastGRCPlugin,
|
|
181
194
|
evaluate,
|
|
182
|
-
resolveApiKey
|
|
195
|
+
resolveApiKey,
|
|
196
|
+
resolveConfig
|
|
183
197
|
});
|
|
184
198
|
module.exports = module.exports.default ?? module.exports;
|
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,18 @@ function resolveApiKey(explicit) {
|
|
|
14
14
|
}
|
|
15
15
|
return void 0;
|
|
16
16
|
}
|
|
17
|
+
function resolveConfig(explicit) {
|
|
18
|
+
const apiKey = resolveApiKey(explicit?.apiKey);
|
|
19
|
+
let policyId = explicit?.policyId;
|
|
20
|
+
if (!policyId) {
|
|
21
|
+
try {
|
|
22
|
+
const cfg = JSON.parse(fs.readFileSync(path.join(os.homedir(), ".fastgrc.json"), "utf8"));
|
|
23
|
+
if (cfg.policyId) policyId = cfg.policyId;
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return { apiKey, policyId };
|
|
28
|
+
}
|
|
17
29
|
var FastGRCBlockedError = class extends Error {
|
|
18
30
|
constructor(matchedRule, reasoning, policyId) {
|
|
19
31
|
super(
|
|
@@ -140,5 +152,6 @@ export {
|
|
|
140
152
|
FastGRCBlockedError,
|
|
141
153
|
FastGRCPlugin,
|
|
142
154
|
evaluate,
|
|
143
|
-
resolveApiKey
|
|
155
|
+
resolveApiKey,
|
|
156
|
+
resolveConfig
|
|
144
157
|
};
|
package/dist/plugin.js
CHANGED
|
@@ -50,6 +50,18 @@ function resolveApiKey(explicit) {
|
|
|
50
50
|
}
|
|
51
51
|
return void 0;
|
|
52
52
|
}
|
|
53
|
+
function resolveConfig(explicit) {
|
|
54
|
+
const apiKey = resolveApiKey(explicit?.apiKey);
|
|
55
|
+
let policyId = explicit?.policyId;
|
|
56
|
+
if (!policyId) {
|
|
57
|
+
try {
|
|
58
|
+
const cfg = JSON.parse(fs.readFileSync(path.join(os.homedir(), ".fastgrc.json"), "utf8"));
|
|
59
|
+
if (cfg.policyId) policyId = cfg.policyId;
|
|
60
|
+
} catch {
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { apiKey, policyId };
|
|
64
|
+
}
|
|
53
65
|
async function evaluate(payload) {
|
|
54
66
|
const {
|
|
55
67
|
toolName,
|
|
@@ -99,16 +111,15 @@ args: ${JSON.stringify(args)}`;
|
|
|
99
111
|
}
|
|
100
112
|
|
|
101
113
|
// src/plugin.ts
|
|
102
|
-
process.stderr.write("[fastgrc] plugin.js module loaded\n");
|
|
103
114
|
var DEFAULT_BASE_URL2 = "https://app.fastgrc.ai";
|
|
104
115
|
var DEFAULT_TIMEOUT_MS2 = 3e3;
|
|
105
116
|
var pluginEntry = {
|
|
106
|
-
id: "fastgrc",
|
|
117
|
+
id: "fastgrc-openclaw",
|
|
107
118
|
name: "FastGRC Policy Router",
|
|
108
119
|
description: "Evaluate every tool call against your FastGRC compliance policy before it executes. Blocks violations, flags drift, builds an audit trail.",
|
|
109
120
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
121
|
register(api) {
|
|
111
|
-
const apiKey =
|
|
122
|
+
const { apiKey, policyId } = resolveConfig();
|
|
112
123
|
if (!apiKey) {
|
|
113
124
|
console.warn(
|
|
114
125
|
"[fastgrc] No API key found \u2014 all tool calls will proceed unchecked.\n\n Run once to connect:\n fastgrc-hook set-key fgrc_k1_your_key_here\n\n Get a key at: https://app.fastgrc.ai/connect\n Manage keys at: https://app.fastgrc.ai/dashboard/settings"
|
|
@@ -123,6 +134,7 @@ var pluginEntry = {
|
|
|
123
134
|
agentType: void 0,
|
|
124
135
|
agentName: void 0,
|
|
125
136
|
apiKey,
|
|
137
|
+
policyId,
|
|
126
138
|
baseUrl: DEFAULT_BASE_URL2,
|
|
127
139
|
timeoutMs: DEFAULT_TIMEOUT_MS2
|
|
128
140
|
});
|
|
@@ -146,6 +158,5 @@ var pluginEntry = {
|
|
|
146
158
|
});
|
|
147
159
|
}
|
|
148
160
|
};
|
|
149
|
-
process.stderr.write("[fastgrc] plugin export shape: " + JSON.stringify({ type: typeof pluginEntry, registerType: typeof pluginEntry.register }) + "\n");
|
|
150
161
|
var plugin_default = pluginEntry;
|
|
151
162
|
module.exports = module.exports.default ?? module.exports;
|
package/dist/plugin.mjs
CHANGED
|
@@ -14,6 +14,18 @@ function resolveApiKey(explicit) {
|
|
|
14
14
|
}
|
|
15
15
|
return void 0;
|
|
16
16
|
}
|
|
17
|
+
function resolveConfig(explicit) {
|
|
18
|
+
const apiKey = resolveApiKey(explicit?.apiKey);
|
|
19
|
+
let policyId = explicit?.policyId;
|
|
20
|
+
if (!policyId) {
|
|
21
|
+
try {
|
|
22
|
+
const cfg = JSON.parse(fs.readFileSync(path.join(os.homedir(), ".fastgrc.json"), "utf8"));
|
|
23
|
+
if (cfg.policyId) policyId = cfg.policyId;
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return { apiKey, policyId };
|
|
28
|
+
}
|
|
17
29
|
async function evaluate(payload) {
|
|
18
30
|
const {
|
|
19
31
|
toolName,
|
|
@@ -63,16 +75,15 @@ args: ${JSON.stringify(args)}`;
|
|
|
63
75
|
}
|
|
64
76
|
|
|
65
77
|
// src/plugin.ts
|
|
66
|
-
process.stderr.write("[fastgrc] plugin.js module loaded\n");
|
|
67
78
|
var DEFAULT_BASE_URL2 = "https://app.fastgrc.ai";
|
|
68
79
|
var DEFAULT_TIMEOUT_MS2 = 3e3;
|
|
69
80
|
var pluginEntry = {
|
|
70
|
-
id: "fastgrc",
|
|
81
|
+
id: "fastgrc-openclaw",
|
|
71
82
|
name: "FastGRC Policy Router",
|
|
72
83
|
description: "Evaluate every tool call against your FastGRC compliance policy before it executes. Blocks violations, flags drift, builds an audit trail.",
|
|
73
84
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
85
|
register(api) {
|
|
75
|
-
const apiKey =
|
|
86
|
+
const { apiKey, policyId } = resolveConfig();
|
|
76
87
|
if (!apiKey) {
|
|
77
88
|
console.warn(
|
|
78
89
|
"[fastgrc] No API key found \u2014 all tool calls will proceed unchecked.\n\n Run once to connect:\n fastgrc-hook set-key fgrc_k1_your_key_here\n\n Get a key at: https://app.fastgrc.ai/connect\n Manage keys at: https://app.fastgrc.ai/dashboard/settings"
|
|
@@ -87,6 +98,7 @@ var pluginEntry = {
|
|
|
87
98
|
agentType: void 0,
|
|
88
99
|
agentName: void 0,
|
|
89
100
|
apiKey,
|
|
101
|
+
policyId,
|
|
90
102
|
baseUrl: DEFAULT_BASE_URL2,
|
|
91
103
|
timeoutMs: DEFAULT_TIMEOUT_MS2
|
|
92
104
|
});
|
|
@@ -110,7 +122,6 @@ var pluginEntry = {
|
|
|
110
122
|
});
|
|
111
123
|
}
|
|
112
124
|
};
|
|
113
|
-
process.stderr.write("[fastgrc] plugin export shape: " + JSON.stringify({ type: typeof pluginEntry, registerType: typeof pluginEntry.register }) + "\n");
|
|
114
125
|
var plugin_default = pluginEntry;
|
|
115
126
|
export {
|
|
116
127
|
plugin_default as default
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "fastgrc",
|
|
2
|
+
"id": "fastgrc-openclaw",
|
|
3
3
|
"name": "FastGRC Policy Router",
|
|
4
4
|
"description": "Evaluate every tool call against your FastGRC compliance policy before it executes. Blocks violations, flags drift, builds an audit trail.",
|
|
5
5
|
"extensions": ["./dist/plugin.js"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastgrc-openclaw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "FastGRC agent compliance plugin for OpenClaw — evaluates every tool call against your policy before it executes",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|