fastgrc-openclaw 1.0.13 → 1.0.14
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/plugin.d.mts +2 -28
- package/dist/plugin.d.ts +2 -28
- package/dist/plugin.js +36 -42
- package/dist/plugin.mjs +37 -37
- package/package.json +1 -1
package/dist/plugin.d.mts
CHANGED
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
id?: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
type?: string;
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
}
|
|
7
|
-
type BeforeToolCallResult = {
|
|
8
|
-
block: true;
|
|
9
|
-
blockReason: string;
|
|
10
|
-
} | {
|
|
11
|
-
requireApproval: {
|
|
12
|
-
timeoutBehavior: 'allow' | 'deny';
|
|
13
|
-
};
|
|
14
|
-
} | undefined;
|
|
15
|
-
declare const plugin: {
|
|
16
|
-
name: string;
|
|
17
|
-
hooks: {
|
|
18
|
-
before_tool_call(toolName: string, args: unknown, context: AgentContext): Promise<BeforeToolCallResult>;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
declare function register(api?: unknown): {
|
|
22
|
-
name: string;
|
|
23
|
-
hooks: {
|
|
24
|
-
before_tool_call(toolName: string, args: unknown, context: AgentContext): Promise<BeforeToolCallResult>;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
declare const activate: typeof register;
|
|
1
|
+
declare const _default: unknown;
|
|
28
2
|
|
|
29
|
-
export {
|
|
3
|
+
export { _default as default };
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
id?: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
type?: string;
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
}
|
|
7
|
-
type BeforeToolCallResult = {
|
|
8
|
-
block: true;
|
|
9
|
-
blockReason: string;
|
|
10
|
-
} | {
|
|
11
|
-
requireApproval: {
|
|
12
|
-
timeoutBehavior: 'allow' | 'deny';
|
|
13
|
-
};
|
|
14
|
-
} | undefined;
|
|
15
|
-
declare const plugin: {
|
|
16
|
-
name: string;
|
|
17
|
-
hooks: {
|
|
18
|
-
before_tool_call(toolName: string, args: unknown, context: AgentContext): Promise<BeforeToolCallResult>;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
declare function register(api?: unknown): {
|
|
22
|
-
name: string;
|
|
23
|
-
hooks: {
|
|
24
|
-
before_tool_call(toolName: string, args: unknown, context: AgentContext): Promise<BeforeToolCallResult>;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
declare const activate: typeof register;
|
|
1
|
+
declare const _default: unknown;
|
|
28
2
|
|
|
29
|
-
export {
|
|
3
|
+
export { _default as default };
|
package/dist/plugin.js
CHANGED
|
@@ -30,11 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/plugin.ts
|
|
31
31
|
var plugin_exports = {};
|
|
32
32
|
__export(plugin_exports, {
|
|
33
|
-
|
|
34
|
-
default: () => plugin_default,
|
|
35
|
-
register: () => register
|
|
33
|
+
default: () => plugin_default
|
|
36
34
|
});
|
|
37
35
|
module.exports = __toCommonJS(plugin_exports);
|
|
36
|
+
var import_node_module = require("module");
|
|
38
37
|
|
|
39
38
|
// src/index.ts
|
|
40
39
|
var fs = __toESM(require("fs"));
|
|
@@ -59,7 +58,7 @@ async function evaluate(payload) {
|
|
|
59
58
|
agentId,
|
|
60
59
|
agentType,
|
|
61
60
|
agentName,
|
|
62
|
-
apiKey
|
|
61
|
+
apiKey,
|
|
63
62
|
policyId,
|
|
64
63
|
baseUrl = DEFAULT_BASE_URL,
|
|
65
64
|
timeoutMs = DEFAULT_TIMEOUT_MS
|
|
@@ -73,7 +72,7 @@ args: ${JSON.stringify(args)}`;
|
|
|
73
72
|
const res = await fetch(evalUrl, {
|
|
74
73
|
method: "POST",
|
|
75
74
|
headers: {
|
|
76
|
-
"Authorization": `Bearer ${
|
|
75
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
77
76
|
"Content-Type": "application/json"
|
|
78
77
|
},
|
|
79
78
|
body: JSON.stringify({
|
|
@@ -101,25 +100,29 @@ args: ${JSON.stringify(args)}`;
|
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
// src/plugin.ts
|
|
103
|
+
var import_meta = {};
|
|
104
104
|
var DEFAULT_BASE_URL2 = "https://app.fastgrc.ai";
|
|
105
105
|
var DEFAULT_TIMEOUT_MS2 = 3e3;
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
var pluginEntry = {
|
|
107
|
+
id: "fastgrc",
|
|
108
|
+
name: "FastGRC Policy Router",
|
|
109
|
+
description: "Evaluate every tool call against your FastGRC compliance policy before it executes. Blocks violations, flags drift, builds an audit trail.",
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
|
+
register(api) {
|
|
112
|
+
const apiKey = resolveApiKey();
|
|
113
|
+
if (!apiKey) {
|
|
114
|
+
console.warn(
|
|
115
|
+
"[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"
|
|
116
|
+
);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
api.on("before_tool_call", async (event, ctx) => {
|
|
117
120
|
const result = await evaluate({
|
|
118
|
-
toolName,
|
|
119
|
-
args,
|
|
120
|
-
agentId:
|
|
121
|
-
agentType:
|
|
122
|
-
agentName:
|
|
121
|
+
toolName: event.toolName,
|
|
122
|
+
args: event.params,
|
|
123
|
+
agentId: ctx?.agentId,
|
|
124
|
+
agentType: void 0,
|
|
125
|
+
agentName: void 0,
|
|
123
126
|
apiKey,
|
|
124
127
|
baseUrl: DEFAULT_BASE_URL2,
|
|
125
128
|
timeoutMs: DEFAULT_TIMEOUT_MS2
|
|
@@ -134,35 +137,26 @@ var plugin = {
|
|
|
134
137
|
};
|
|
135
138
|
}
|
|
136
139
|
if (decision === "require_approval") {
|
|
137
|
-
return {
|
|
138
|
-
requireApproval: { timeoutBehavior: "deny" }
|
|
139
|
-
};
|
|
140
|
+
return { requireApproval: { timeoutBehavior: "deny" } };
|
|
140
141
|
}
|
|
141
142
|
if (Array.isArray(reasonTags) && reasonTags.includes("override_block_active")) {
|
|
142
143
|
const msg = policyContext?.matchedRule ? `[FastGRC] Observability mode \u2014 would have blocked: [${policyContext.matchedRule}] ${reasoning}` : `[FastGRC] Observability mode \u2014 would have blocked: ${reasoning}`;
|
|
143
144
|
console.warn(msg);
|
|
144
145
|
}
|
|
145
146
|
return void 0;
|
|
146
|
-
}
|
|
147
|
+
});
|
|
147
148
|
}
|
|
148
149
|
};
|
|
149
|
-
function
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
console.log("[fastgrc] register called \u2014 api:", typeof api);
|
|
150
|
+
function tryLoadDefinePluginEntry(specifier) {
|
|
151
|
+
try {
|
|
152
|
+
const req = (0, import_node_module.createRequire)(import_meta.url);
|
|
153
|
+
const mod = req(specifier);
|
|
154
|
+
if (typeof mod.definePluginEntry === "function") {
|
|
155
|
+
return mod.definePluginEntry;
|
|
156
156
|
}
|
|
157
|
-
}
|
|
158
|
-
console.log("[fastgrc] register called \u2014 no api arg");
|
|
157
|
+
} catch {
|
|
159
158
|
}
|
|
160
|
-
return
|
|
159
|
+
return null;
|
|
161
160
|
}
|
|
162
|
-
var
|
|
163
|
-
var plugin_default =
|
|
164
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
165
|
-
0 && (module.exports = {
|
|
166
|
-
activate,
|
|
167
|
-
register
|
|
168
|
-
});
|
|
161
|
+
var definePluginEntry = tryLoadDefinePluginEntry("openclaw/plugin-sdk/plugin-entry") ?? tryLoadDefinePluginEntry("openclaw/plugin-sdk/core");
|
|
162
|
+
var plugin_default = definePluginEntry ? definePluginEntry(pluginEntry) : pluginEntry;
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/plugin.ts
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
|
|
1
4
|
// src/index.ts
|
|
2
5
|
import * as fs from "fs";
|
|
3
6
|
import * as os from "os";
|
|
@@ -21,7 +24,7 @@ async function evaluate(payload) {
|
|
|
21
24
|
agentId,
|
|
22
25
|
agentType,
|
|
23
26
|
agentName,
|
|
24
|
-
apiKey
|
|
27
|
+
apiKey,
|
|
25
28
|
policyId,
|
|
26
29
|
baseUrl = DEFAULT_BASE_URL,
|
|
27
30
|
timeoutMs = DEFAULT_TIMEOUT_MS
|
|
@@ -35,7 +38,7 @@ args: ${JSON.stringify(args)}`;
|
|
|
35
38
|
const res = await fetch(evalUrl, {
|
|
36
39
|
method: "POST",
|
|
37
40
|
headers: {
|
|
38
|
-
"Authorization": `Bearer ${
|
|
41
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
39
42
|
"Content-Type": "application/json"
|
|
40
43
|
},
|
|
41
44
|
body: JSON.stringify({
|
|
@@ -65,23 +68,26 @@ args: ${JSON.stringify(args)}`;
|
|
|
65
68
|
// src/plugin.ts
|
|
66
69
|
var DEFAULT_BASE_URL2 = "https://app.fastgrc.ai";
|
|
67
70
|
var DEFAULT_TIMEOUT_MS2 = 3e3;
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
var pluginEntry = {
|
|
72
|
+
id: "fastgrc",
|
|
73
|
+
name: "FastGRC Policy Router",
|
|
74
|
+
description: "Evaluate every tool call against your FastGRC compliance policy before it executes. Blocks violations, flags drift, builds an audit trail.",
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
register(api) {
|
|
77
|
+
const apiKey = resolveApiKey();
|
|
78
|
+
if (!apiKey) {
|
|
79
|
+
console.warn(
|
|
80
|
+
"[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"
|
|
81
|
+
);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
api.on("before_tool_call", async (event, ctx) => {
|
|
79
85
|
const result = await evaluate({
|
|
80
|
-
toolName,
|
|
81
|
-
args,
|
|
82
|
-
agentId:
|
|
83
|
-
agentType:
|
|
84
|
-
agentName:
|
|
86
|
+
toolName: event.toolName,
|
|
87
|
+
args: event.params,
|
|
88
|
+
agentId: ctx?.agentId,
|
|
89
|
+
agentType: void 0,
|
|
90
|
+
agentName: void 0,
|
|
85
91
|
apiKey,
|
|
86
92
|
baseUrl: DEFAULT_BASE_URL2,
|
|
87
93
|
timeoutMs: DEFAULT_TIMEOUT_MS2
|
|
@@ -96,35 +102,29 @@ var plugin = {
|
|
|
96
102
|
};
|
|
97
103
|
}
|
|
98
104
|
if (decision === "require_approval") {
|
|
99
|
-
return {
|
|
100
|
-
requireApproval: { timeoutBehavior: "deny" }
|
|
101
|
-
};
|
|
105
|
+
return { requireApproval: { timeoutBehavior: "deny" } };
|
|
102
106
|
}
|
|
103
107
|
if (Array.isArray(reasonTags) && reasonTags.includes("override_block_active")) {
|
|
104
108
|
const msg = policyContext?.matchedRule ? `[FastGRC] Observability mode \u2014 would have blocked: [${policyContext.matchedRule}] ${reasoning}` : `[FastGRC] Observability mode \u2014 would have blocked: ${reasoning}`;
|
|
105
109
|
console.warn(msg);
|
|
106
110
|
}
|
|
107
111
|
return void 0;
|
|
108
|
-
}
|
|
112
|
+
});
|
|
109
113
|
}
|
|
110
114
|
};
|
|
111
|
-
function
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
console.log("[fastgrc] register called \u2014 api:", typeof api);
|
|
115
|
+
function tryLoadDefinePluginEntry(specifier) {
|
|
116
|
+
try {
|
|
117
|
+
const req = createRequire(import.meta.url);
|
|
118
|
+
const mod = req(specifier);
|
|
119
|
+
if (typeof mod.definePluginEntry === "function") {
|
|
120
|
+
return mod.definePluginEntry;
|
|
118
121
|
}
|
|
119
|
-
}
|
|
120
|
-
console.log("[fastgrc] register called \u2014 no api arg");
|
|
122
|
+
} catch {
|
|
121
123
|
}
|
|
122
|
-
return
|
|
124
|
+
return null;
|
|
123
125
|
}
|
|
124
|
-
var
|
|
125
|
-
var plugin_default =
|
|
126
|
+
var definePluginEntry = tryLoadDefinePluginEntry("openclaw/plugin-sdk/plugin-entry") ?? tryLoadDefinePluginEntry("openclaw/plugin-sdk/core");
|
|
127
|
+
var plugin_default = definePluginEntry ? definePluginEntry(pluginEntry) : pluginEntry;
|
|
126
128
|
export {
|
|
127
|
-
|
|
128
|
-
plugin_default as default,
|
|
129
|
-
register
|
|
129
|
+
plugin_default as default
|
|
130
130
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastgrc-openclaw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
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",
|