fastgrc-openclaw 1.0.13 → 1.0.15

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