@trucore/openclaw-atf 0.1.0 → 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TruCore AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -15,18 +15,78 @@ openclaw gateway restart
15
15
 
16
16
  ---
17
17
 
18
+ ## Quick Start — Install, Enable, Verify, Disable
19
+
20
+ ### 1. Install
21
+
22
+ ```sh
23
+ openclaw plugins install @trucore/openclaw-atf
24
+ ```
25
+
26
+ ### 2. Enable (minimal config — zero keys required)
27
+
28
+ Add to your OpenClaw config:
29
+
30
+ ```json
31
+ {
32
+ "plugins": {
33
+ "trucore-atf": {}
34
+ }
35
+ }
36
+ ```
37
+
38
+ That's it. All defaults are safe and correct for most environments.
39
+
40
+ ### 3. Restart and verify
41
+
42
+ ```sh
43
+ openclaw gateway restart
44
+ openclaw tool call atf_integration_doctor
45
+ ```
46
+
47
+ **Healthy state checklist:**
48
+ - `status` = `"ok"`
49
+ - `plugin_loaded` = `true`
50
+ - `native_tools_available` lists all 13 tools
51
+ - `native_tools_missing` is empty `[]`
52
+ - `config_validation.valid` = `true`
53
+ - `warnings` is empty or contains only informational items
54
+
55
+ ### 4. Disable (if needed)
56
+
57
+ Remove `trucore-atf` from your plugins config:
58
+
59
+ ```json
60
+ {
61
+ "plugins": {}
62
+ }
63
+ ```
64
+
65
+ Then: `openclaw gateway restart`. This has zero effect on ATF CLI/API.
66
+
67
+ **See also:** [examples/](examples/) for copy-paste-safe config files.
68
+
69
+ ---
70
+
18
71
  ## What this plugin does
19
72
 
20
- This plugin registers **6 optional agent tools** into OpenClaw:
73
+ This plugin registers **13 optional agent tools** into OpenClaw:
21
74
 
22
75
  | Tool | Purpose |
23
76
  |---|---|
77
+ | `atf_health` | Check ATF CLI/API availability and readiness |
24
78
  | `atf_discover` | Fetch and summarise the ATF manifest (capabilities, recipes, feature gates) |
25
79
  | `atf_bootstrap_plan` | Generate ATF self-install steps for a recipe (plan only, no side effects) |
26
80
  | `atf_bootstrap_execute_safe` | Run safe bootstrap steps locally (env setup + verify, no signing) |
27
81
  | `atf_protect_intent` | Submit a DeFi intent for policy evaluation — returns allow/deny + receipt |
28
82
  | `atf_verify_receipt` | Verify a receipt deterministically (proof for humans) |
29
83
  | `atf_report_savings` | Generate a receipt-backed "ATF saved you" report |
84
+ | `atf_integration_doctor` | Run integration readiness check — reports plugin/backend/tool status |
85
+ | `atf_bot_preflight` | Pre-session readiness check — returns go/no-go with backend + config diagnostics |
86
+ | `atf_tx_explain` | Explain ATF deny decisions — maps reason codes to human-readable explanations |
87
+ | `atf_billing_info` | Billing/pricing metadata for the advanced bot package |
88
+ | `atf_billing_claim` | Verify on-chain payment and process billing claim |
89
+ | `atf_adoption_advisor` | Deterministic adoption recommendation for bots |
30
90
 
31
91
  All tools are **optional** — agents and operators must opt in via OpenClaw's tool allowlist. Default-safe:
32
92
 
@@ -34,33 +94,47 @@ All tools are **optional** — agents and operators must opt in via OpenClaw's t
34
94
  - `safety.allowExecuteSafe = true` — bootstrap execute-safe runs (env/verify only; no signing).
35
95
  - ATF **never signs transactions**.
36
96
 
97
+ ### Diagnostic tools
98
+
99
+ `atf_bot_preflight` is a lightweight readiness check designed for bot startup:
100
+ it probes CLI/API availability, validates plugin config, and returns a single
101
+ `ready: true/false` signal with remediation steps if needed.
102
+
103
+ `atf_tx_explain` maps ATF deny reason codes to structured human-readable
104
+ explanations with category, description, and remediation guidance. It works
105
+ offline and requires no backend — it reads from the built-in reason code
106
+ catalog. Pass either a `reasonCodes` array or a full `receipt` object.
107
+
37
108
  ---
38
109
 
39
110
  ## Enable tools
40
111
 
41
- Add the plugin tools to your OpenClaw agent's allowlist. Example OpenClaw config:
112
+ The simplest config enables all plugin tools with safe defaults:
113
+
114
+ ```json
115
+ {
116
+ "plugins": {
117
+ "trucore-atf": {}
118
+ }
119
+ }
120
+ ```
121
+
122
+ To explicitly allowlist individual tools and customize settings:
42
123
 
43
124
  ```json
44
125
  {
45
126
  "plugins": {
46
127
  "trucore-atf": {
47
- "atfCli": "atf",
48
128
  "prefer": "cli",
49
- "receiptsDir": "./atf_receipts",
50
- "safety": {
51
- "allowExecuteSafe": true,
52
- "allowNetwork": false
53
- }
129
+ "receiptsDir": "./atf_receipts"
54
130
  }
55
131
  },
56
132
  "tools": {
57
133
  "allowlist": [
58
- "atf_discover",
59
- "atf_bootstrap_plan",
60
- "atf_bootstrap_execute_safe",
134
+ "atf_health",
61
135
  "atf_protect_intent",
62
136
  "atf_verify_receipt",
63
- "atf_report_savings"
137
+ "atf_integration_doctor"
64
138
  ]
65
139
  }
66
140
  }
@@ -83,6 +157,40 @@ To allow live manifest fetching, set `safety.allowNetwork = true` (agent environ
83
157
 
84
158
  ---
85
159
 
160
+ ## Integration Doctor
161
+
162
+ Validate the full integration in one step:
163
+
164
+ ```sh
165
+ openclaw tool call atf_integration_doctor
166
+ ```
167
+
168
+ Returns a structured readiness report including:
169
+ - Plugin loading status
170
+ - CLI / API availability
171
+ - Backend preference vs effective backend (with fallback details)
172
+ - Registered tool inventory
173
+ - Configuration warnings and remediation steps
174
+
175
+ Status values: `ok`, `degraded`, `misconfigured`, `unavailable`.
176
+
177
+ See the [operator runbook](../../docs/runbooks/openclaw-plugin-operations.md) for expected outputs and troubleshooting.
178
+
179
+ ---
180
+
181
+ ## Backend preference
182
+
183
+ The plugin supports two backends:
184
+
185
+ | Backend | When to use |
186
+ |---|---|
187
+ | `cli` (default) | Local dev, offline, ATF CLI installed |
188
+ | `api` | Hosted environments, shared infra, centrally deployed ATF API |
189
+
190
+ Set `prefer` in your plugin config. If the preferred backend is unavailable, the plugin falls back to the other automatically. Both `atf_health` and `atf_integration_doctor` report what was preferred, what was chosen, and why fallback occurred.
191
+
192
+ ---
193
+
86
194
  ## Example: "ATF saved you" message
87
195
 
88
196
  When your agent runs `atf_report_savings`, it produces a receipt-backed human summary like:
@@ -190,17 +298,123 @@ Full docs: [docs/runbooks/agent-adoption-atf.md](../../docs/runbooks/agent-adopt
190
298
 
191
299
  ---
192
300
 
301
+ ## Jupiter Endpoint Configuration
302
+
303
+ ATF swap commands use the canonical Jupiter v6 production endpoint by default:
304
+
305
+ ```text
306
+ https://quote-api.jup.ag/v6
307
+ ```
308
+
309
+ Override via environment:
310
+
311
+ | Variable | Purpose |
312
+ | --- | --- |
313
+ | `ATF_JUPITER_BASE` | Full override (takes priority over all other settings) |
314
+ | `ATF_JUPITER_API_KEY` | API key for x-api-key header (never logged) |
315
+ | `ATF_JUPITER_PREPROD` | Set to `1` for preprod endpoint (explicit opt-in only) |
316
+
317
+ Or via ATF profile config: `jupiter_quote_url` / `jupiter_swap_url`.
318
+
319
+ ---
320
+
321
+ ## Fallback: Direct CLI (if plugin install fails)
322
+
323
+ If `openclaw plugins install @trucore/openclaw-atf` is unavailable:
324
+
325
+ ```sh
326
+ # Install ATF CLI directly
327
+ npm install -g @trucore/atf
328
+
329
+ # Bootstrap
330
+ atf bootstrap --recipe bootstrap_local --execute-safe
331
+
332
+ # Protect an intent
333
+ echo '{"chain_id":"solana","intent_type":"swap","intent":{...}}' | atf bot protect --stdin
334
+
335
+ # Verify receipt
336
+ atf receipts verify --receipt sha256:aabbcc...
337
+
338
+ # Report savings
339
+ atf report savings --receipts-dir ./atf_receipts --format json
340
+ ```
341
+
342
+ The plugin is an optional convenience layer. All ATF security guarantees
343
+ work identically via direct CLI.
344
+
345
+ ---
346
+
193
347
  ## Tests
194
348
 
195
349
  ```sh
196
350
  cd packages/openclaw-atf
197
351
  node --test tests/test_tools.mjs
352
+ node --test tests/test_plugin_package.mjs
353
+ node --test tests/test_integration_hardening.mjs
354
+ node --test tests/test_doctor.mjs
355
+ node --test tests/test_config_ux.mjs
356
+ node --test tests/test_activate_validation.mjs
357
+ node --test tests/test_native_tools.mjs
198
358
  ```
199
359
 
200
360
  All tests are offline. No network calls. No ATF CLI required.
201
361
 
202
362
  ---
203
363
 
364
+ ## Plugin exports
365
+
366
+ The plugin provides the following entry-points:
367
+
368
+ | Export | Type | Purpose |
369
+ |---|---|---|
370
+ | `default` | `function(api)` | Legacy single-function entry (calls `register(api)`) |
371
+ | `register(api)` | `function` | OpenClaw lifecycle: register tools |
372
+ | `activate(ctx)` | `function` | OpenClaw lifecycle: activate (runs non-blocking config validation) |
373
+ | `deactivate()` | `function` | OpenClaw lifecycle: deactivate (no-op for stateless ATF) |
374
+ | `PLUGIN_ID` | `string` | Canonical plugin identity: `trucore-atf` |
375
+ | `PLUGIN_VERSION` | `string` | Current plugin version |
376
+ | `buildHumanSummary(report)` | `function` | Human messaging helper for savings reports |
377
+ | `REASON_CODE_CATALOG` | `object` | Frozen map of deny reason codes → `{category, explanation, remediation}` |
378
+ | `ATF_BILLING_MANIFEST` | `object` | Machine-readable billing/pricing metadata |
379
+ | `evaluateAdoption` | `function` | Adoption advisor evaluation function |
380
+ | `verifyBillingClaim` | `function` | Billing claim verification function |
381
+ | `CLAIM_STATUS` | `object` | Claim status enum |
382
+ | `CLAIM_DENY_CODES` | `object` | Claim deny code catalog |
383
+ | `TREASURY_ADDRESS` | `string` | Canonical treasury address |
384
+ | `USDC_MINT` | `string` | Canonical Solana mainnet USDC mint address |
385
+ | `CONTRACT_FAMILIES` | `object` | Universal contract family definitions |
386
+ | `TOOL_FAMILY_MAP` | `object` | Tool → contract family mapping |
387
+ | `CANONICAL_TOOLS` | `array` | Frozen list of all 13 tool names |
388
+ | `CANONICAL_TOOL_COUNT` | `number` | Number of canonical tools (13) |
389
+
390
+ The canonical plugin ID is `trucore-atf` everywhere: manifest, package.json, config, docs.
391
+
392
+ ---
393
+
394
+ ## Activation-time config validation
395
+
396
+ When the plugin activates, it validates the config and surfaces any issues as `console.warn` messages. **Invalid config never blocks activation.** The plugin always loads and remains operational.
397
+
398
+ - **Valid config** — activates silently, no warnings.
399
+ - **Config with warnings** — activates normally; warnings logged with `[trucore-atf]` prefix.
400
+ - **Config with errors / unsupported keys** — activates normally; errors and unsupported keys logged clearly.
401
+ - Warnings include remediation guidance and recommend running `atf_integration_doctor` for full details.
402
+
403
+ This gives operators immediate feedback at startup without breaking the integration.
404
+
405
+ ---
406
+
407
+ ## Graceful degradation
408
+
409
+ - If ATF CLI is not installed, tools return clear error messages — never crash.
410
+ - If ATF API is unreachable, tools degrade to CLI fallback or return errors.
411
+ - If the plugin receives an invalid `api` object, it logs a warning and skips registration.
412
+ - If activate() receives invalid or missing context, it degrades silently.
413
+ - All tool handlers are wrapped in a safe-handler that catches runtime errors.
414
+ - Plugin failure never breaks the OpenClaw gateway or other plugins.
415
+
416
+ ---
417
+
204
418
  ## License
205
419
 
206
420
  MIT — TruCore AI
@@ -0,0 +1,134 @@
1
+ # OpenClaw ATF Plugin — Config Examples
2
+
3
+ Canonical config examples for the TruCore ATF OpenClaw plugin.
4
+
5
+ All examples use the canonical plugin ID: `trucore-atf`.
6
+
7
+ ---
8
+
9
+ ## Minimal Enable (recommended starting point)
10
+
11
+ **File:** [minimal-enable.json](minimal-enable.json)
12
+
13
+ ```json
14
+ {
15
+ "plugins": {
16
+ "trucore-atf": {}
17
+ }
18
+ }
19
+ ```
20
+
21
+ Zero config keys needed. The plugin uses safe defaults:
22
+ - `prefer: "cli"` — uses ATF CLI subprocess
23
+ - `safety.allowExecuteSafe: true`
24
+ - `safety.allowNetwork: false`
25
+
26
+ This is the **fastest path** to enable ATF in OpenClaw.
27
+
28
+ ---
29
+
30
+ ## Prefer CLI (explicit)
31
+
32
+ **File:** [prefer-cli.json](prefer-cli.json)
33
+
34
+ ```json
35
+ {
36
+ "plugins": {
37
+ "trucore-atf": {
38
+ "prefer": "cli"
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ Same as minimal enable, but explicitly declares CLI preference.
45
+ Best for: local dev, offline environments, ATF CLI installed locally.
46
+
47
+ ---
48
+
49
+ ## Prefer API
50
+
51
+ **File:** [prefer-api.json](prefer-api.json)
52
+
53
+ ```json
54
+ {
55
+ "plugins": {
56
+ "trucore-atf": {
57
+ "prefer": "api",
58
+ "atfBaseUrl": "https://api.trucore.xyz"
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ Routes tool calls through the ATF HTTP API.
65
+ Best for: hosted environments, shared infra, centrally deployed ATF API.
66
+
67
+ **Note:** `atfBaseUrl` is required when `prefer` is `"api"`.
68
+
69
+ ---
70
+
71
+ ## Full Config
72
+
73
+ **File:** [full-config.json](full-config.json)
74
+
75
+ ```json
76
+ {
77
+ "plugins": {
78
+ "trucore-atf": {
79
+ "prefer": "cli",
80
+ "receiptsDir": "./atf_receipts",
81
+ "safety": {
82
+ "allowExecuteSafe": true,
83
+ "allowNetwork": false
84
+ }
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ Shows all commonly used keys. Only set keys you want to change from defaults.
91
+
92
+ ---
93
+
94
+ ## Disable Plugin
95
+
96
+ **File:** [disable-plugin.json](disable-plugin.json)
97
+
98
+ ```json
99
+ {
100
+ "plugins": {}
101
+ }
102
+ ```
103
+
104
+ Remove the `"trucore-atf"` key from `plugins` and restart the gateway.
105
+ This has zero effect on ATF CLI or API operations.
106
+
107
+ ---
108
+
109
+ ## Config Reference
110
+
111
+ | Key | Type | Default | Description |
112
+ |---|---|---|---|
113
+ | `atfCli` | string | `"atf"` | CLI command name or absolute path |
114
+ | `atfBaseUrl` | string | — | ATF HTTP API URL (required for `prefer: "api"`) |
115
+ | `prefer` | `"cli"` \| `"api"` | `"cli"` | Backend preference |
116
+ | `receiptsDir` | string | — | Receipt storage directory |
117
+ | `safety.allowExecuteSafe` | boolean | `true` | Allow bootstrap execute-safe |
118
+ | `safety.allowNetwork` | boolean | `false` | Allow live manifest fetch |
119
+
120
+ No other keys are accepted (`additionalProperties: false`).
121
+
122
+ ---
123
+
124
+ ## Verify After Enabling
125
+
126
+ ```bash
127
+ # Restart the gateway
128
+ openclaw gateway restart
129
+
130
+ # Run integration doctor
131
+ openclaw tool call atf_integration_doctor
132
+
133
+ # Expected: status = "ok", all 8 tools available
134
+ ```
@@ -0,0 +1,3 @@
1
+ {
2
+ "plugins": {}
3
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "plugins": {
3
+ "trucore-atf": {
4
+ "prefer": "cli",
5
+ "receiptsDir": "./atf_receipts",
6
+ "safety": {
7
+ "allowExecuteSafe": true,
8
+ "allowNetwork": false
9
+ }
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "plugins": {
3
+ "trucore-atf": {}
4
+ }
5
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "plugins": {
3
+ "trucore-atf": {
4
+ "prefer": "api",
5
+ "atfBaseUrl": "https://api.trucore.xyz"
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "plugins": {
3
+ "trucore-atf": {
4
+ "prefer": "cli"
5
+ }
6
+ }
7
+ }
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "id": "trucore-atf",
3
3
  "name": "TruCore ATF",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "description": "Transaction firewall tools for autonomous finance agents: protect + verify + report savings. ATF evaluates swap, lend, and perps intents against policy before they reach the chain. Never signs. Deny-by-default.",
6
6
  "homepage": "https://github.com/trucore-ai/agent-transaction-firewall",
7
7
  "main": "src/index.mjs",
8
+ "extensions": ["src/index.mjs"],
8
9
  "tools": "optional",
9
10
  "configSchema": {
10
11
  "$schema": "http://json-schema.org/draft-07/schema#",
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@trucore/openclaw-atf",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "OpenClaw plugin — ATF transaction firewall tools for autonomous agents: discover, protect, verify, report savings.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "src/index.mjs",
8
8
  "files": [
9
9
  "src",
10
+ "examples",
10
11
  "openclaw.plugin.json",
11
12
  "README.md",
12
13
  "LICENSE"
@@ -40,6 +41,11 @@
40
41
  "engines": {
41
42
  "node": ">=18"
42
43
  },
44
+ "openclaw": {
45
+ "extensions": [
46
+ "openclaw.plugin.json"
47
+ ]
48
+ },
43
49
  "peerDependencies": {
44
50
  "openclaw": "*"
45
51
  },
@@ -49,7 +55,10 @@
49
55
  }
50
56
  },
51
57
  "scripts": {
52
- "test": "node --test tests/test_tools.mjs"
58
+ "test": "node --test tests/test_tools.mjs",
59
+ "validate": "node tests/test_plugin_package.mjs",
60
+ "check-versions": "python3 ../../scripts/check_openclaw_versions.py",
61
+ "prepublishOnly": "npm run check-versions && npm run validate && npm run test"
53
62
  },
54
63
  "dependencies": {}
55
64
  }