@reefclaw/openclaw-plugin 0.1.51 → 0.1.53

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "reefclaw-paper-trading",
3
3
  "name": "ReefClaw Trading",
4
- "version": "0.1.51",
4
+ "version": "0.1.53",
5
5
  "description": "Supervised trading plugin for the ReefClaw dashboard. It runs on YOUR machine and starts in PAPER mode with no API keys. It cannot trade real funds until you supply exchange credentials and step PAPER→MICRO_LIVE→LIVE yourself from the dashboard — the agent cannot make that change (the tool is refused without operator provenance). Exchange keys stay local, are used only to sign requests to the exchange, and are never transmitted to ReefClaw (asserted by a test in this package). Trading telemetry — positions, fills, decision journal — is sent to ReefClaw to render the dashboard. Every live position carries exchange-native protective stops. Remote updates to the agent's trading instructions are applied only after an Ed25519 signature is verified against a public key pinned in this build. It runs on gateway startup and supervises a local connector process; the package README lists every path it writes and everything it sends. It never changes the gateway's auth settings.",
6
6
  "author": "ReefClaw",
7
7
  "activation": {
@@ -74,7 +74,8 @@
74
74
  "hl_agent_wallet_status",
75
75
  "hl_submit_agent_approval",
76
76
  "get_bracket_config",
77
- "set_bracket_requirement"
77
+ "set_bracket_requirement",
78
+ "set_operator_halt"
78
79
  ]
79
80
  },
80
81
  "toolMetadata": {
@@ -407,6 +408,11 @@
407
408
  "profiles": [
408
409
  "coding"
409
410
  ]
411
+ },
412
+ "set_operator_halt": {
413
+ "profiles": [
414
+ "coding"
415
+ ]
410
416
  }
411
417
  },
412
418
  "configSchema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reefclaw/openclaw-plugin",
3
- "version": "0.1.51",
3
+ "version": "0.1.53",
4
4
  "description": "ReefClaw supervised trading plugin for OpenClaw. Runs entirely on YOUR machine and starts in PAPER mode — it cannot trade real funds until you supply exchange credentials and walk the PAPER→MICRO_LIVE→LIVE ladder yourself from the ReefClaw dashboard (the agent cannot make that change; it is refused without operator provenance). Your exchange API keys stay on your machine to sign requests to the exchange and are NEVER sent to ReefClaw — a test in the package asserts this. What does reach ReefClaw is trading telemetry for the dashboard (positions, fills, decision journal). Live trading always carries exchange-native protective stops. Trading instructions can be updated remotely, and every update must carry a valid Ed25519 signature verified against a key pinned in this build before it is applied. Install from ClawHub on OpenClaw 2026.8.1+ (Control UI Plugins > Discover, or /plugins install clawhub:@reefclaw/openclaw-plugin then the same with --accept-capabilities after reviewing the listed capabilities), or with the ReefClaw connect installer (@reefclaw/connect on npm, pinned to the exact release named in the bundled skill). It runs on gateway startup, supervises a local connector process, and writes only under ~/.reefclaw and OpenClaw's own skill, config and cron locations; the README lists every path it writes and everything it sends. It never changes the gateway's auth settings.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -53,5 +53,15 @@
53
53
  "index.js": "04cfdd9de44d347b16689b7fc6ff05ef50823dd4cfa7b1106e6cda6fbce93710",
54
54
  "tools/create-order.js": "72aa6a78f246bdc1e0fe8321948c5ca06b101c6055b7336a5c61bbcee1fc4f2e",
55
55
  "risk/pre-trade-check.js": "5074ac12687d554f9c0a0aee611202aba9ecb4536e4632f8a5c76a5614ae0aad"
56
+ },
57
+ "0.1.51": {
58
+ "index.js": "04cfdd9de44d347b16689b7fc6ff05ef50823dd4cfa7b1106e6cda6fbce93710",
59
+ "tools/create-order.js": "72aa6a78f246bdc1e0fe8321948c5ca06b101c6055b7336a5c61bbcee1fc4f2e",
60
+ "risk/pre-trade-check.js": "5074ac12687d554f9c0a0aee611202aba9ecb4536e4632f8a5c76a5614ae0aad"
61
+ },
62
+ "0.1.52": {
63
+ "index.js": "b1b54e5c43742b92961d53b4027ec068e9226abb53ade188a945d365c448b287",
64
+ "tools/create-order.js": "72aa6a78f246bdc1e0fe8321948c5ca06b101c6055b7336a5c61bbcee1fc4f2e",
65
+ "risk/pre-trade-check.js": "5074ac12687d554f9c0a0aee611202aba9ecb4536e4632f8a5c76a5614ae0aad"
56
66
  }
57
67
  }
@@ -21,5 +21,7 @@
21
21
  "0.1.48": "Two changes. The heartbeat checklist (HEARTBEAT.md) now arrives with your trading instructions, signed, and is placed beside SKILL.md, so the agent reads it instead of failing every beat looking for a file that was never installed. And if ReefClaw's own edge protection ever blocks your host's address (an automatic DDoS mitigation, seen once on 2026-09-28), the plugin and connector now recognise it, back off instead of retrying into it, keep trading with the safety floor intact, and report it to the dashboard over the relay so you see a banner and support is paged; the log names the real cause instead of 'connect the account first' or 'Pro subscription required'. Periodic checks are spread out so several agents behind one address no longer call in lockstep. RC_WEBAPP_EDGE_GATE=off disables the back-off only.",
22
22
  "0.1.49": "Fixes for new and stuck agents. On a fresh install the first market check now starts as soon as the full trading instructions arrive, instead of 15 minutes after connecting. An agent whose ReefClaw heartbeat was never created, because an older version mistook one of your own scheduled jobs for it, now gets the heartbeat with this update and runs its first check straight away. The heartbeat job can no longer be created twice when the gateway answers slowly. New installs from the dashboard's paste message start on the exchange you picked there. New entries now need a stop at least 0.3 x ATR away, the rule the order checks always described (only the 30 bps minimum was enforced before); when ATR is unavailable the 30 bps minimum applies as before. The local signal evaluator (off by default) applies the same minimum stop distance as the server.",
23
23
  "0.1.50": "Install and update without a terminal. On OpenClaw 2026.9.5 or newer your agent can now install ReefClaw from chat with OpenClaw's own plugins tool, and the dashboard's Update button now also updates a ReefClaw that OpenClaw installed from ClawHub (it installs the new version through OpenClaw, then restarts the gateway). ReefClaw's tools are now visible to agents on OpenClaw's older 'coding' tool profile, where they used to be hidden. A new install starts on the exchange you picked on the onboarding page. On Hyperliquid, a call that fails with a USDT pair now tells the agent which USDC pair to use. The connect installer no longer puts a second copy next to one OpenClaw installed, keeps your own tool allow list valid, and writes its settings file safely.",
24
- "0.1.51": "Keeps your agent connected to the dashboard. The service that carried the live connection between your agent and the ReefClaw dashboard shuts down on 23 October, so this update moves your agent to ReefClaw's new connection server (relay.reefclaw.com) by itself; there is nothing to change. Without this update the dashboard, its chat and the Kill, Flatten and Pause buttons stop reaching your agent once the old service is gone. Also: a heartbeat whose chat channel has no recipient set no longer fails on every run, and a model that has stopped answering is still reported as down."
24
+ "0.1.51": "Keeps your agent connected to the dashboard. The service that carried the live connection between your agent and the ReefClaw dashboard shuts down on 23 October, so this update moves your agent to ReefClaw's new connection server (relay.reefclaw.com) by itself; there is nothing to change. Without this update the dashboard, its chat and the Kill, Flatten and Pause buttons stop reaching your agent once the old service is gone. Also: a heartbeat whose chat channel has no recipient set no longer fails on every run, and a model that has stopped answering is still reported as down.",
25
+ "0.1.52": "Your agent now looks for trades on every heartbeat. Until now the heartbeat’s required steps stopped at checking the market, so agents on smaller models never searched for an entry. Each check now runs the trade search and opens a setup only when your scorecard settings say GO, sized within your risk limits and with a stop and a target; otherwise it says in one line why not. Pause, Kill and Flatten on the dashboard now also block new orders on your machine, while closing positions and stops keep working. The Heartbeats history now shows the whole check on newer OpenClaw versions.",
26
+ "0.1.53": "Fixes a new install that stayed disconnected. If ReefClaw started before your agent saved its connection, the market tools kept answering 'No ReefClaw connection token configured' and the agent never traded until the gateway was fully restarted. ReefClaw now picks up the saved connection by itself within about 30 seconds, with no restart, and starts the journal, the dashboard settings and the readiness checks at the same time. That message now tells the agent where to save the connection. Also includes 0.1.52: every heartbeat looks for trades, and Pause, Kill and Flatten block new orders on your machine."
25
27
  }
@@ -114,7 +114,7 @@ If the ReefClaw trading tools are not present yet, there are two ways to install
114
114
  **2. A terminal, run by the user.** The user runs this once, in a terminal on the machine running OpenClaw (inside the container, if OpenClaw runs in Docker):
115
115
 
116
116
  ```
117
- npx --yes @reefclaw/connect@0.1.64
117
+ npx --yes @reefclaw/connect@0.1.66
118
118
  ```
119
119
 
120
120
  That is the whole install. It places the plugin, sets up the connector, restarts the gateway where it can, and prints what it changed. If OpenClaw already installed ReefClaw itself (ClawHub) and this installer's own copy is not registered, it says so and installs nothing. If its closing lines say **GATEWAY NOT RESTARTED**, the plugin is on disk but not running yet: restarting is the user's step (in Docker, `docker restart <container>` from the host; otherwise restarting OpenClaw). Tell the user exactly that and stop — do not restart, signal or kill any process, do not run docker or service commands, and do not edit the gateway config, even if you could. The plugin reports its own version to ReefClaw after the restart; never post readiness, version or health reports yourself. The version is pinned on purpose: the line names the exact connector release this plugin was published with, so what runs on the machine is reviewable and never "whatever the registry serves today". It needs no ReefClaw token — the connection is the separate paste step above, and the connector picks it up on its own.
@@ -13,6 +13,7 @@
13
13
  // order (the create_order gate still applies) — and makes injected directives
14
14
  // far less likely to be followed.
15
15
  import { keepAliveFetch } from '../http/keepalive-fetch.js';
16
+ import { NO_CONNECTION_TOKEN_ERROR } from './intel-api.js';
16
17
  import { noteWebappResponse, webappEdgeGate, webappUserAgent } from '../http/webapp-edge.js';
17
18
  /** What the agent is told when the EDGE (not the app) denies the host. Names
18
19
  * the real cause; the old branch called every 403 a subscription problem. */
@@ -93,7 +94,7 @@ export async function getMarketIntelTool(args, deps) {
93
94
  const { category, symbols } = args;
94
95
  const { connectionToken, apiBaseUrl } = deps;
95
96
  if (!connectionToken) {
96
- return { error: 'No ReefClaw connection token configured. Market intelligence requires a reefclaw.com account.' };
97
+ return { error: NO_CONNECTION_TOKEN_ERROR };
97
98
  }
98
99
  // The category is a path segment AND selects the fence: an unknown value
99
100
  // must never reach the URL (../ into another route) or skip the fence.
@@ -4,6 +4,11 @@ import type { IExchangeAdapter } from '../exchange-adapter.js';
4
4
  import type { TradingMode } from '../types.js';
5
5
  export interface RiskSummaryResult {
6
6
  tradingMode: TradingMode;
7
+ /** Present only while the operator has paused or stopped trading (operator-halt.ts). */
8
+ operator_halt?: {
9
+ mode: 'PAUSED' | 'STOPPED';
10
+ since: string | null;
11
+ };
7
12
  totalEquity: number;
8
13
  availableBalance: number;
9
14
  lockedBalance: number;
@@ -1,6 +1,7 @@
1
1
  // Tool: get_risk_summary — current portfolio risk metrics
2
2
  // Returns exposure, drawdown, heat score, position count — everything
3
3
  // the agent needs for risk-aware decision making.
4
+ import { readOperatorHalt } from '../config/operator-halt.js';
4
5
  import { getQuoteBalance, getQuoteWalletBalance } from '../balance-utils.js';
5
6
  /** Finite number or undefined — never NaN, never a silent 0. */
6
7
  function fin(v) {
@@ -23,6 +24,7 @@ function round(v, dp) {
23
24
  return n === undefined ? 0 : +n.toFixed(dp);
24
25
  }
25
26
  export async function getRiskSummaryTool(_args, deps) {
27
+ const halt = readOperatorHalt();
26
28
  // In live modes, use real exchange data instead of simulator
27
29
  let balance;
28
30
  let positions;
@@ -152,6 +154,9 @@ export async function getRiskSummaryTool(_args, deps) {
152
154
  executionStats,
153
155
  shadowMetrics,
154
156
  ...(dataWarnings.length > 0 ? { dataWarnings } : {}),
157
+ // The operator's Pause / Kill as create_order enforces it: shown so an
158
+ // agent skips its entry work instead of being refused at the order.
159
+ ...(halt.mode !== 'ACTIVE' ? { operator_halt: { mode: halt.mode, since: halt.since } } : {}),
155
160
  timestamp: new Date().toISOString(),
156
161
  };
157
162
  }
@@ -1,5 +1,15 @@
1
1
  import { type VenueId } from '../venues/symbols.js';
2
+ /** Returned by every token-gated tool while this plugin has no connection.
3
+ * Written for the AGENT: it says what to do, and that no restart is needed
4
+ * (config/late-wiring.ts picks the connection up live). The first sentence is
5
+ * a stable prefix — fleet monitoring matches on it; do not reword it. The
6
+ * old text ("requires a reefclaw.com account") was false for an onboarded
7
+ * user whose plugin simply started before the connection was saved, and gave
8
+ * the agent nothing to act on. */
9
+ export declare const NO_CONNECTION_TOKEN_ERROR: string;
2
10
  export interface IntelApiDeps {
11
+ /** May be a GETTER (index.ts) — read it per call, never copy the deps
12
+ * object, so a connection saved after boot is seen (config/late-wiring.ts). */
3
13
  connectionToken: string;
4
14
  intelligenceUrl: string;
5
15
  /** Trading venue of this box (HYPERLIQUID_INTEGRATION_PLAN §5.3). Absent =
@@ -2,6 +2,18 @@
2
2
  // All intelligence tools use Bearer token auth against intel.reefclaw.com.
3
3
  import { keepAliveFetch } from '../http/keepalive-fetch.js';
4
4
  import { HL_INTEL_PREFIX, fromIntelSymbol, toIntelSymbol } from '../venues/symbols.js';
5
+ /** Returned by every token-gated tool while this plugin has no connection.
6
+ * Written for the AGENT: it says what to do, and that no restart is needed
7
+ * (config/late-wiring.ts picks the connection up live). The first sentence is
8
+ * a stable prefix — fleet monitoring matches on it; do not reword it. The
9
+ * old text ("requires a reefclaw.com account") was false for an onboarded
10
+ * user whose plugin simply started before the connection was saved, and gave
11
+ * the agent nothing to act on. */
12
+ export const NO_CONNECTION_TOKEN_ERROR = 'No ReefClaw connection token configured. This plugin has not found a saved connection yet. ' +
13
+ 'Save the connection from reefclaw.com/onboarding (token, userId, relayUrl) under ' +
14
+ 'skills.entries.reefclaw.config in ~/.openclaw/openclaw.json — these tools normally pick it up ' +
15
+ 'within a minute, no restart needed. If it is already saved there and this error is still ' +
16
+ 'returned after two minutes, tell your operator: the OpenClaw gateway process needs a full restart.';
5
17
  // ─── Venue-aware intel-symbol mapping (plan §5.3: the agent keeps using
6
18
  // canonical symbols like BTC/USDC; these helpers translate at the intel
7
19
  // boundary). All three FAIL OPEN — unmappable input passes through
@@ -80,7 +92,7 @@ export const enc = encodeURIComponent;
80
92
  export async function fetchIntelApi(path, deps, options) {
81
93
  const { connectionToken, intelligenceUrl } = deps;
82
94
  if (!connectionToken) {
83
- return { error: 'No ReefClaw connection token configured. Intelligence features require a reefclaw.com account.' };
95
+ return { error: NO_CONNECTION_TOKEN_ERROR };
84
96
  }
85
97
  if (!intelligenceUrl) {
86
98
  return { error: 'No intelligence URL configured. Set intelligenceUrl in openclaw.json plugin config.' };
@@ -1,7 +1,7 @@
1
1
  // Tool: score_setup — Pre-trade setup scorecard.
2
2
  // Consolidates regime, feedback, and flow data into a single scored verdict.
3
3
  // Forces the agent to only trade high-quality setups.
4
- import { fetchIntelApi, enc } from './intel-api.js';
4
+ import { fetchIntelApi, enc, resolveIntelSymbol } from './intel-api.js';
5
5
  import { getTradingParams } from '../trading-params-cache.js';
6
6
  export async function scoreSetupTool(args, deps) {
7
7
  const { symbol, direction, setup_type, entry_price, stop_price, target_price } = args;
@@ -13,7 +13,9 @@ export async function scoreSetupTool(args, deps) {
13
13
  return { error: 'For SHORT: stop_price must be above entry_price' };
14
14
  }
15
15
  // Fetch all intelligence data + trading params in parallel
16
- const s = enc(symbol);
16
+ // The venue pair an agent passes (BTC/USDC on Hyperliquid) must reach intel
17
+ // in its own spelling (HL_BTC), or every intel dimension falls back to 5.
18
+ const s = enc(resolveIntelSymbol(deps, symbol));
17
19
  const [regimeData, feedbackData, flowData, tp] = await Promise.all([
18
20
  fetchIntelApi(`/api/regime/${s}`, deps),
19
21
  fetchIntelApi(`/api/analytics/${s}/feedback`, deps),