@axonflow/openclaw 1.1.0 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.0] - 2026-04-09
4
+
5
+ ### Changed
6
+
7
+ - **Smart error classification in governance hooks (issue #1545 Direction 3).** `before_tool_call` now distinguishes network/transport errors (timeouts, DNS failures, connection refused, HTTP 5xx) from auth/config errors (HTTP 401/403, invalid credentials, invalid tokens). **Network errors always fail-open** regardless of `config.onError` — transient infrastructure issues should never block legitimate dev workflows. **Auth errors respect `config.onError`** which defaults to `block` so misconfigured credentials are caught at the first tool call. This replaces the previous all-or-nothing `onError` behavior.
8
+
9
+ ### Added
10
+
11
+ - **`isAxonFlowAuthError(err)` exported helper** classifies thrown errors from the AxonFlow client. Applications can use it to implement their own fail-open / fail-closed logic outside the built-in hook.
12
+ - 11 new unit tests cover the auth-vs-network classification on the governance hook path and the standalone classifier.
13
+
14
+ ### Security
15
+
16
+ - Pinned all GitHub Actions in test and publish workflows to immutable commit SHAs to prevent supply chain attacks.
17
+ - Added Dependabot configuration for weekly GitHub Actions updates.
18
+
3
19
  ## [1.1.0] - 2026-04-06
4
20
 
5
21
  ### Added
package/README.md CHANGED
@@ -58,10 +58,22 @@ See [Getting Started](https://docs.getaxonflow.com/docs/getting-started/) for fu
58
58
 
59
59
  ## Install
60
60
 
61
+ Available on [ClawHub](https://clawhub.ai/plugins/%40axonflow%2Fopenclaw) and [npm](https://www.npmjs.com/package/@axonflow/openclaw).
62
+
61
63
  ```bash
62
64
  openclaw plugins install @axonflow/openclaw
63
65
  ```
64
66
 
67
+ Or via the ClawHub install path:
68
+
69
+ ```bash
70
+ openclaw plugins install clawhub:@axonflow/openclaw
71
+ ```
72
+
73
+ Either install path works; the ClawHub form is included for users browsing plugins there.
74
+
75
+ For the full integration walkthrough (architecture, hook coverage, policy examples, troubleshooting), see the [OpenClaw Integration Guide](https://docs.getaxonflow.com/docs/integration/openclaw/).
76
+
65
77
  ## Configure
66
78
 
67
79
  In your OpenClaw config:
@@ -21,6 +21,20 @@ export interface BeforeToolCallResult {
21
21
  }
22
22
  /** Derive connector_type from tool name for AxonFlow policy evaluation. */
23
23
  export declare function deriveConnectorType(toolName: string): string;
24
+ /**
25
+ * Classify an error thrown by the AxonFlow client as an auth/config error
26
+ * vs a transient network / server-side error.
27
+ *
28
+ * Auth/config errors: HTTP 401, 403, or error messages containing "auth",
29
+ * "unauthorized", "forbidden", "credentials", or "token invalid".
30
+ *
31
+ * Network/server errors: everything else (timeouts, DNS failures, 5xx,
32
+ * connection refused, aborts).
33
+ *
34
+ * Used by the fail-open / fail-closed decision in the before_tool_call
35
+ * hook handler (issue #1545 Direction 3).
36
+ */
37
+ export declare function isAxonFlowAuthError(err: unknown): boolean;
24
38
  /**
25
39
  * Create the before_tool_call hook handler.
26
40
  *
@@ -1 +1 @@
1
- {"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../src/governance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAUxD,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;QAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;KACpC,CAAC;CACH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wBAAgB,2BAA2B,CACzC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,oBAAoB,IAEd,OAAO;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,KAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAwE9C"}
@@ -10,6 +10,39 @@ import { recordToolCallEvaluated, recordToolCallBlocked, recordToolCallApprovalR
10
10
  export function deriveConnectorType(toolName) {
11
11
  return `openclaw.${toolName}`;
12
12
  }
13
+ /**
14
+ * Classify an error thrown by the AxonFlow client as an auth/config error
15
+ * vs a transient network / server-side error.
16
+ *
17
+ * Auth/config errors: HTTP 401, 403, or error messages containing "auth",
18
+ * "unauthorized", "forbidden", "credentials", or "token invalid".
19
+ *
20
+ * Network/server errors: everything else (timeouts, DNS failures, 5xx,
21
+ * connection refused, aborts).
22
+ *
23
+ * Used by the fail-open / fail-closed decision in the before_tool_call
24
+ * hook handler (issue #1545 Direction 3).
25
+ */
26
+ export function isAxonFlowAuthError(err) {
27
+ if (!err || typeof err !== "object")
28
+ return false;
29
+ // Error objects with HTTP status (if the SDK exposes one)
30
+ const maybeStatus = err.status ??
31
+ err.statusCode;
32
+ if (maybeStatus === 401 || maybeStatus === 403)
33
+ return true;
34
+ const message = err instanceof Error
35
+ ? err.message.toLowerCase()
36
+ : String(err).toLowerCase();
37
+ return (message.includes("401") ||
38
+ message.includes("403") ||
39
+ message.includes("unauthorized") ||
40
+ message.includes("forbidden") ||
41
+ message.includes("credentials") ||
42
+ (message.includes("auth") && !message.includes("auth server")) ||
43
+ message.includes("token invalid") ||
44
+ message.includes("invalid token"));
45
+ }
13
46
  /**
14
47
  * Create the before_tool_call hook handler.
15
48
  *
@@ -34,14 +67,27 @@ export function createBeforeToolCallHandler(client, config) {
34
67
  }
35
68
  catch (err) {
36
69
  recordGovernanceError();
70
+ // Issue #1545 Direction 3: classify the error to decide fail-open vs
71
+ // fail-closed. Network errors (timeout, DNS failure, connection
72
+ // refused, 5xx) always fail OPEN regardless of config.onError —
73
+ // transient infrastructure issues should never block legitimate dev
74
+ // workflows. Auth errors (401/403) respect config.onError, defaulting
75
+ // to fail-closed because they indicate a misconfiguration the
76
+ // operator can and should fix.
77
+ const isAuthError = isAxonFlowAuthError(err);
78
+ if (!isAuthError) {
79
+ recordToolCallAllowed();
80
+ return undefined; // Fail-open: transient network issue
81
+ }
82
+ // Auth error — respect config.onError (which defaults to "block").
37
83
  if (config.onError === "allow") {
38
84
  recordToolCallAllowed();
39
- return undefined; // Fail-open: allow tool execution
85
+ return undefined;
40
86
  }
41
87
  recordToolCallBlocked();
42
88
  return {
43
89
  block: true,
44
- blockReason: `AxonFlow unreachable: ${err instanceof Error ? err.message : "unknown error"}`,
90
+ blockReason: `AxonFlow auth error: ${err instanceof Error ? err.message : "unknown error"}. Fix configuration to restore tool access.`,
45
91
  };
46
92
  }
47
93
  if (!check.allowed) {
@@ -1 +1 @@
1
- {"version":3,"file":"governance.js","sourceRoot":"","sources":["../src/governance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,EAC9B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAgBtB,2EAA2E;AAC3E,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,OAAO,YAAY,QAAQ,EAAE,CAAC;AAChC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAAsB,EACtB,MAA4B;IAE5B,OAAO,KAAK,EAAE,KAKb,EAA6C,EAAE;QAC9C,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAA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AAE,CAAC;gBACxB,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,qBAAqB,EAAE,CAAC;YACxB,OAAO;gBACL,KAAK,EAAE,IAAI;gBACX,WAAW,EAAE,wBAAwB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,6CAA6C;aACvI,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,qBAAqB,EAAE,CAAC;YACxB,OAAO;gBACL,KAAK,EAAE,IAAI;gBACX,WAAW,EAAE,KAAK,CAAC,YAAY,IAAI,4BAA4B;aAChE,CAAC;QACJ,CAAC;QAED,uDAAuD;QACvD,IACE,MAAM,CAAC,aAAa;YACpB,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAC7C,CAAC;YACD,8BAA8B,EAAE,CAAC;YACjC,OAAO;gBACL,eAAe,EAAE;oBACf,KAAK,EAAE,aAAa,KAAK,CAAC,QAAQ,oBAAoB;oBACtD,WAAW,EAAE,mCAAmC,KAAK,CAAC,kBAAkB,sBAAsB;oBAC9F,QAAQ,EAAE,SAAS;oBACnB,SAAS,EAAE,MAAM;oBACjB,eAAe,EAAE,MAAM;iBACxB;aACF,CAAC;QACJ,CAAC;QAED,qBAAqB,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@
31
31
  * for async hook support.
32
32
  */
33
33
  /** Plugin version — update before each release. */
34
- export declare const VERSION = "1.1.0";
34
+ export declare const VERSION = "1.2.0";
35
35
  export { AxonFlowClient } from "./axonflow-client.js";
36
36
  export type { AxonFlowPluginConfig } from "./config.js";
37
37
  export { resolveConfig, shouldGovernTool } from "./config.js";
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ import { createLlmInputHandler, createLlmOutputHandler } from "./llm-audit.js";
39
39
  import { sendTelemetryPing } from "./telemetry.js";
40
40
  import { resetMetrics } from "./metrics.js";
41
41
  /** Plugin version — update before each release. */
42
- export const VERSION = "1.1.0";
42
+ export const VERSION = "1.2.0";
43
43
  // Re-export for external consumers
44
44
  export { AxonFlowClient } from "./axonflow-client.js";
45
45
  export { resolveConfig, shouldGovernTool } from "./config.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axonflow/openclaw",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Policy enforcement, approval gates, and audit trails for OpenClaw — govern tool inputs before execution, scan outbound messages for PII/secrets, and record agent activity for review and compliance",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "compliance",
51
51
  "ssrf-protection"
52
52
  ],
53
- "author": "AxonFlow Team <team@getaxonflow.com>",
53
+ "author": "AxonFlow Team <hello@getaxonflow.com>",
54
54
  "license": "MIT",
55
55
  "repository": {
56
56
  "type": "git",