@reefclaw/openclaw-plugin 0.1.37 → 0.1.38

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.
@@ -228,9 +228,25 @@ export declare function requestGatewayRestart(rpc: TerminalRpc, opts: {
228
228
  reason: string;
229
229
  skipDeferral?: boolean;
230
230
  }): Promise<ConnectorUpdateOutcome>;
231
- /** The reason string the gateway logs for a restart we asked for. */
232
- export declare const RESTART_REASON_AFTER_UPDATE = "reefclaw.connector.update";
233
- export declare const RESTART_REASON_OPERATOR = "reefclaw.connector.restart";
231
+ /** ★ The reason is NOT a label — the gateway's restart handler BRANCHES on it.
232
+ * `update.run` selects OpenClaw's update-restart path
233
+ * (`respawnGatewayProcessForUpdate`): "update restarts must replace the OS
234
+ * process so the new code runs from a fresh module graph after package files
235
+ * have changed on disk" — a detached respawn on unmanaged gateways and in
236
+ * containers (where the old process then exits and the container supervisor
237
+ * brings the new one up). ANY OTHER reason takes the generic path, which on a
238
+ * container ("keep PID 1 alive") and on any unmanaged gateway ("keep custom
239
+ * supervisor PID tracking stable") is an IN-PROCESS restart: the http server
240
+ * comes back in 0.2 s with the SAME plugin instances and none of the new
241
+ * files loaded. Measured on the rig (OpenClaw 2026.6.9 in Docker, 2026-09-20):
242
+ * reason `gateway.restart.safe` → "restart mode: in-process restart
243
+ * (container: use in-process restart to keep PID 1 alive)", no re-registration,
244
+ * old plugin still reporting its old version. Verified in the 2026.6.9 dist
245
+ * (`cli/gateway-lifecycle.runtime.js`, `run-*.js handleRestartAfterServerClose`)
246
+ * and upstream (`src/infra/update-run-*.ts`). So both of our restarts are
247
+ * update restarts, whatever triggered them. */
248
+ export declare const RESTART_REASON_AFTER_UPDATE = "update.run";
249
+ export declare const RESTART_REASON_OPERATOR = "update.run";
234
250
  export interface RunOptions {
235
251
  pollMs?: number;
236
252
  maxPolls?: number;
@@ -573,9 +573,25 @@ export async function requestGatewayRestart(rpc, opts) {
573
573
  return outcome;
574
574
  }
575
575
  }
576
- /** The reason string the gateway logs for a restart we asked for. */
577
- export const RESTART_REASON_AFTER_UPDATE = 'reefclaw.connector.update';
578
- export const RESTART_REASON_OPERATOR = 'reefclaw.connector.restart';
576
+ /** ★ The reason is NOT a label — the gateway's restart handler BRANCHES on it.
577
+ * `update.run` selects OpenClaw's update-restart path
578
+ * (`respawnGatewayProcessForUpdate`): "update restarts must replace the OS
579
+ * process so the new code runs from a fresh module graph after package files
580
+ * have changed on disk" — a detached respawn on unmanaged gateways and in
581
+ * containers (where the old process then exits and the container supervisor
582
+ * brings the new one up). ANY OTHER reason takes the generic path, which on a
583
+ * container ("keep PID 1 alive") and on any unmanaged gateway ("keep custom
584
+ * supervisor PID tracking stable") is an IN-PROCESS restart: the http server
585
+ * comes back in 0.2 s with the SAME plugin instances and none of the new
586
+ * files loaded. Measured on the rig (OpenClaw 2026.6.9 in Docker, 2026-09-20):
587
+ * reason `gateway.restart.safe` → "restart mode: in-process restart
588
+ * (container: use in-process restart to keep PID 1 alive)", no re-registration,
589
+ * old plugin still reporting its old version. Verified in the 2026.6.9 dist
590
+ * (`cli/gateway-lifecycle.runtime.js`, `run-*.js handleRestartAfterServerClose`)
591
+ * and upstream (`src/infra/update-run-*.ts`). So both of our restarts are
592
+ * update restarts, whatever triggered them. */
593
+ export const RESTART_REASON_AFTER_UPDATE = 'update.run';
594
+ export const RESTART_REASON_OPERATOR = 'update.run';
579
595
  /**
580
596
  * Poll the PTY and emit progress until the command finishes or the gateway
581
597
  * restart takes the session down. Returns the final outcome. A single failed
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "reefclaw-paper-trading",
3
3
  "name": "ReefClaw Trading",
4
- "version": "0.1.37",
4
+ "version": "0.1.38",
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": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reefclaw/openclaw-plugin",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
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",
@@ -8,5 +8,6 @@
8
8
  "0.1.34": "The heartbeat flight recorder now reads OpenClaw 2026.9's SQLite transcript store (it recorded nothing on those gateways) and warns when it cannot see beats; a RED-zone drawdown is re-checked on a fresh position snapshot before it is judged, and a loss larger than the open book plus today's realized losses is refused as a calculation error instead of trusting a -50% constant; RC_SHOCK_WAKE=off switches shock wakes off per box; the README lists what the connector sends and how to read the risk log.",
9
9
  "0.1.35": "The connector never changes your gateway's auth settings any more (it reports the manual remedy instead); the install line in the bundled skill and the one-click update are pinned to an exact connector release instead of 'latest'; the bundled skill spells out what the remotely delivered trading instructions can and cannot do; the package README lists every file the plugin writes and everything it sends.",
10
10
  "0.1.36": "Day P&L no longer shows two days as 'today' after midnight UTC: the connector now takes the exchange-anchored figure on every balance read, not only when the dashboard reconnects. The one-click update tells the truth on Docker and other unmanaged gateways (a restart the installer could not perform is reported, never assumed), shows live progress again on OpenClaw 2026.8+, and never resets the live skill with a forced reinstall; a box whose OpenClaw has no terminal API gets a clear 'update from a shell' notice instead of a retry loop.",
11
- "0.1.37": "Updates now finish on Docker and other unmanaged gateways: the connector asks the gateway to restart itself through OpenClaw's own restart request, so a one-click update no longer ends with 'files installed, restart it from the host', and the dashboard offers 'Restart now' if that ever does happen. The installer no longer re-registers an already-registered plugin on an update, which is what used to start a second plugin process inside a container."
11
+ "0.1.37": "Updates now finish on Docker and other unmanaged gateways: the connector asks the gateway to restart itself through OpenClaw's own restart request, so a one-click update no longer ends with 'files installed, restart it from the host', and the dashboard offers 'Restart now' if that ever does happen. The installer no longer re-registers an already-registered plugin on an update, which is what used to start a second plugin process inside a container.",
12
+ "0.1.38": "Fixes the restart that 0.1.37 introduced for Docker and other unmanaged gateways: the connector now asks for OpenClaw's update restart, the one kind that replaces the running process so the new files actually load (the previous kind restarted in place and kept the old code while reporting success). The installer no longer claims a self-restart it cannot verify; the connector or the dashboard's Restart now button performs it, waiting for an in-progress agent run to finish first."
12
13
  }
@@ -101,7 +101,7 @@ When a user gives you this message (or just a bare `Here's my ReefClaw token: rc
101
101
  If the ReefClaw trading tools are not present yet, the **user** installs them by running this once, in a terminal on the machine running OpenClaw (inside the container, if OpenClaw runs in Docker):
102
102
 
103
103
  ```
104
- npx --yes @reefclaw/connect@0.1.50
104
+ npx --yes @reefclaw/connect@0.1.51
105
105
  ```
106
106
 
107
107
  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 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.