@reefclaw/openclaw-plugin 0.1.36 → 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.
package/bridge/bridge.js CHANGED
@@ -638,6 +638,26 @@ export class Bridge {
638
638
  this.connector.sendResponse(id, true, outcome);
639
639
  return;
640
640
  }
641
+ if (method === 'connector.restart') {
642
+ const provider = this.provider;
643
+ if (!provider.restartGateway) {
644
+ this.connector.sendResponse(id, true, {
645
+ ok: false,
646
+ status: 'failed',
647
+ message: 'Provider does not support connector.restart (likely mock provider)',
648
+ });
649
+ return;
650
+ }
651
+ // Same single-field contract as connector.update: no target, no
652
+ // reason, no args cross this boundary — the RPC the provider issues is
653
+ // a constant (providers/connector-update.ts requestGatewayRestart).
654
+ const acknowledgeOpenPositions = params?.acknowledgeOpenPositions === true;
655
+ audit('connector_restart.start', { id, acknowledgeOpenPositions });
656
+ const outcome = await provider.restartGateway({ acknowledgeOpenPositions });
657
+ audit('connector_restart.dispatched', { id, ok: outcome.ok, status: outcome.status });
658
+ this.connector.sendResponse(id, true, outcome);
659
+ return;
660
+ }
641
661
  if (method === 'get_bracket_config') {
642
662
  if (!this.provider.getBracketConfig) {
643
663
  this.connector.sendResponse(id, false, undefined, {
@@ -236,6 +236,14 @@ export interface OpenClawProvider {
236
236
  updateConnector?(args: {
237
237
  acknowledgeOpenPositions?: boolean;
238
238
  }): Promise<ConnectorUpdateOutcome>;
239
+ /** Operator-only: ask the OpenClaw gateway to restart ITSELF through its own
240
+ * `gateway.restart.request` RPC (operator.admin). This is how a box whose
241
+ * installer could not restart the gateway (Docker, any unmanaged gateway)
242
+ * loads already-installed connector files — no terminal, no host access.
243
+ * Same single input as updateConnector: the open-positions acknowledgement. */
244
+ restartGateway?(args: {
245
+ acknowledgeOpenPositions?: boolean;
246
+ }): Promise<ConnectorUpdateOutcome>;
239
247
  /** Operator-only: remove stored credentials from the plugin config and
240
248
  * de-escalate to PAPER mode if currently running in a live mode. */
241
249
  clearExchangeCredentials?(): Promise<{
@@ -202,6 +202,51 @@ export type AdminSessionResult = {
202
202
  /** Connect a fresh admin-scoped client and wait for hello-ok. Resolves with the
203
203
  * granted scopes, or a blocked/failed outcome (client already destroyed). */
204
204
  export declare function openAdminGatewaySession(client: AdminSessionClient, timeoutMs?: number): Promise<AdminSessionResult>;
205
+ /** The gateway's answer to `gateway.restart.request`, as far as we read it. */
206
+ export interface GatewayRestartReply {
207
+ status?: string;
208
+ ok?: boolean;
209
+ preflight?: {
210
+ safe?: boolean;
211
+ blockers?: Array<{
212
+ kind?: string;
213
+ count?: number;
214
+ message?: string;
215
+ }>;
216
+ summary?: string;
217
+ };
218
+ }
219
+ /** Pure: map the RPC reply / error onto an operator outcome.
220
+ * `scheduled` + `coalesced` = the restart is happening now; `deferred` = the
221
+ * gateway restarts as soon as its active agent run drains (still a promise
222
+ * the gateway itself made, so it is `restarting`, with the reason shown). */
223
+ export declare function classifyGatewayRestartReply(reply: unknown): ConnectorUpdateOutcome;
224
+ /** Map an RPC error from `gateway.restart.request` onto an outcome. */
225
+ export declare function describeRestartRpcFailure(err: unknown): ConnectorUpdateOutcome;
226
+ /** Ask the gateway to restart itself. Never throws. */
227
+ export declare function requestGatewayRestart(rpc: TerminalRpc, opts: {
228
+ reason: string;
229
+ skipDeferral?: boolean;
230
+ }): Promise<ConnectorUpdateOutcome>;
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";
205
250
  export interface RunOptions {
206
251
  pollMs?: number;
207
252
  maxPolls?: number;
@@ -502,6 +502,96 @@ export async function openAdminGatewaySession(client, timeoutMs = 20_000) {
502
502
  logger.info(TAG, `admin session open (scopes: ${result.join(', ')})`);
503
503
  return { ok: true, scopes: result };
504
504
  }
505
+ /** Pure: map the RPC reply / error onto an operator outcome.
506
+ * `scheduled` + `coalesced` = the restart is happening now; `deferred` = the
507
+ * gateway restarts as soon as its active agent run drains (still a promise
508
+ * the gateway itself made, so it is `restarting`, with the reason shown). */
509
+ export function classifyGatewayRestartReply(reply) {
510
+ const r = (reply && typeof reply === 'object' ? reply : {});
511
+ const status = typeof r.status === 'string' ? r.status : '';
512
+ if (status === 'scheduled' || status === 'coalesced') {
513
+ return {
514
+ ok: true,
515
+ status: 'restarting',
516
+ message: 'The gateway is restarting itself to load the new version. The dashboard reconnects on its own.',
517
+ };
518
+ }
519
+ if (status === 'deferred') {
520
+ const blockers = (r.preflight?.blockers ?? [])
521
+ .map((b) => (typeof b?.message === 'string' ? b.message : ''))
522
+ .filter(Boolean);
523
+ const why = blockers.length > 0 ? ` (waiting on: ${blockers.join('; ')})` : '';
524
+ return {
525
+ ok: true,
526
+ status: 'restarting',
527
+ message: `The gateway accepted the restart and will apply it as soon as its current agent run finishes${why}. `
528
+ + 'The dashboard reconnects on its own.',
529
+ };
530
+ }
531
+ return {
532
+ ok: false,
533
+ status: 'failed',
534
+ message: `The gateway did not accept the restart request (reply: ${status || 'unrecognised'}).`,
535
+ };
536
+ }
537
+ /** Map an RPC error from `gateway.restart.request` onto an outcome. */
538
+ export function describeRestartRpcFailure(err) {
539
+ const raw = err instanceof Error ? err.message : String(err);
540
+ const lower = raw.toLowerCase();
541
+ if (/unknown method/.test(lower)) {
542
+ return {
543
+ ok: false,
544
+ status: 'blocked',
545
+ message: 'This OpenClaw has no gateway.restart.request RPC (older than 2026.5.12), so the connector cannot restart it. '
546
+ + 'Restart OpenClaw yourself — in Docker, from the host machine (docker restart <container>).',
547
+ };
548
+ }
549
+ if (/operator\.admin|scope|forbidden|unauthori[sz]ed|not allowed|\b403\b/.test(lower)) {
550
+ return {
551
+ ok: false,
552
+ status: 'blocked',
553
+ message: 'The gateway refused the restart request (it needs the operator.admin scope). '
554
+ + 'Restart OpenClaw yourself — in Docker, from the host machine (docker restart <container>).',
555
+ };
556
+ }
557
+ return { ok: false, status: 'failed', message: `Could not ask the gateway to restart: ${raw}` };
558
+ }
559
+ /** Ask the gateway to restart itself. Never throws. */
560
+ export async function requestGatewayRestart(rpc, opts) {
561
+ try {
562
+ const reply = await rpc('gateway.restart.request', {
563
+ reason: opts.reason,
564
+ ...(opts.skipDeferral === true ? { skipDeferral: true } : {}),
565
+ });
566
+ const outcome = classifyGatewayRestartReply(reply);
567
+ logger.info(TAG, `gateway.restart.request → ${outcome.status}: ${outcome.message}`);
568
+ return outcome;
569
+ }
570
+ catch (err) {
571
+ const outcome = describeRestartRpcFailure(err);
572
+ logger.warn(TAG, `gateway.restart.request failed: ${outcome.message}`);
573
+ return outcome;
574
+ }
575
+ }
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';
505
595
  /**
506
596
  * Poll the PTY and emit progress until the command finishes or the gateway
507
597
  * restart takes the session down. Returns the final outcome. A single failed
@@ -562,20 +652,48 @@ export async function runConnectorUpdate(rpc, sessionId, emit, opts = {}) {
562
652
  // unmanaged gateway the CLI cannot signal). Say so — "the agent restarts
563
653
  // to load it" would be false, and no restart is coming from this side.
564
654
  const restartRequired = ok && installerReportedNoRestart(screen);
655
+ if (restartRequired) {
656
+ // ★ Finish the job from here: the admin session that ran the PTY holds
657
+ // the operator.admin scope `gateway.restart.request` needs, so ask the
658
+ // gateway to restart ITSELF (in-process / respawn — works in Docker).
659
+ // Only when it refuses does the operator get the host-side advice.
660
+ await closeTerminal(rpc, sessionId);
661
+ const kicked = await requestGatewayRestart(rpc, { reason: RESTART_REASON_AFTER_UPDATE });
662
+ if (kicked.status === 'restarting') {
663
+ const outcome = {
664
+ ok: true,
665
+ status: 'restarting',
666
+ sessionId,
667
+ exitCode,
668
+ output: screen,
669
+ message: `Connector files updated. ${kicked.message}`,
670
+ };
671
+ emit(outcome);
672
+ return outcome;
673
+ }
674
+ const outcome = {
675
+ ok: true,
676
+ status: 'completed',
677
+ sessionId,
678
+ exitCode,
679
+ output: screen,
680
+ restartRequired: true,
681
+ message: 'Connector files updated, but the gateway was NOT restarted, so the previous version is still running. '
682
+ + 'If OpenClaw runs in Docker, restart the container from the host machine (docker restart <container>); '
683
+ + `otherwise restart OpenClaw. The new version loads then. (Self-restart refused: ${kicked.message})`,
684
+ };
685
+ emit(outcome);
686
+ return outcome;
687
+ }
565
688
  const outcome = {
566
689
  ok,
567
690
  status: 'completed',
568
691
  sessionId,
569
692
  exitCode,
570
693
  output: screen,
571
- ...(restartRequired ? { restartRequired: true } : {}),
572
694
  message: !ok
573
695
  ? `The updater exited with code ${exitCode}. The connector was left as it was.`
574
- : restartRequired
575
- ? 'Connector files updated, but the gateway was NOT restarted, so the previous version is still running. '
576
- + 'If OpenClaw runs in Docker, restart the container from the host machine (docker restart <container>); '
577
- + 'otherwise restart OpenClaw. The new version loads then.'
578
- : 'Connector updated. The agent restarts to load it.',
696
+ : 'Connector updated. The agent restarts to load it.',
579
697
  };
580
698
  emit(outcome);
581
699
  await closeTerminal(rpc, sessionId);
@@ -274,6 +274,20 @@ export declare class GatewayProvider implements OpenClawProvider {
274
274
  updateConnector(args: {
275
275
  acknowledgeOpenPositions?: boolean;
276
276
  }): Promise<ConnectorUpdateOutcome>;
277
+ /**
278
+ * Operator-triggered gateway self-restart through OpenClaw's own
279
+ * `gateway.restart.request` RPC. The one door on a Docker / unmanaged box:
280
+ * the installer cannot restart such a gateway, a raw signal is ignored as
281
+ * unauthorized, and running the CLI inside the container boots a second
282
+ * plugin stack (2026-09-19/20). Same gates as updateConnector — per-host
283
+ * opt-out, connected gateway, open-positions acknowledgement — then a
284
+ * short-lived operator.admin session for the single RPC. A `restarting`
285
+ * outcome is also emitted as a connector_update frame so the dashboard
286
+ * latches "restart expected" before the connection drops.
287
+ */
288
+ restartGateway(args: {
289
+ acknowledgeOpenPositions?: boolean;
290
+ }): Promise<ConnectorUpdateOutcome>;
277
291
  private emitConnectorUpdate;
278
292
  /** Operator-only. Approval/balance status of the provisioned HL wallet. */
279
293
  getHlAgentWalletStatus(): Promise<HlAgentWalletStatusOutcome>;
@@ -19,7 +19,7 @@ import { parseIdentityName } from '../utils/identity-name.js';
19
19
  import { assessDrawdownPlausibility, computeEquity as _computeEquity, computePositionNotional as _computePositionNotional, computeRiskMetrics as _computeRiskMetrics, DEFAULT_RISK_LIMITS, DRAWDOWN_ZONE_THRESHOLDS, TENANT_LIMIT_BOUNDS, boundedNum, validateDrawdownLadder, } from './risk-calculator.js';
20
20
  import { executeKill as _executeKill, executeFlatten as _executeFlatten, executePause as _executePause, executeResume as _executeResume, cancelPendingProposals, withProposalDetail, } from './emergency-commands.js';
21
21
  import { executeSetTradingMode, executeGetBracketConfig, executeSetBracketRequirement, executeSetExchangeCredentials, executeTestExchangeCredentials, executeClearExchangeCredentials, executeProvisionHlAgentWallet, executeHlAgentWalletStatus, executeSubmitHlAgentApproval, } from './onboarding-commands.js';
22
- import { startConnectorUpdate, runConnectorUpdate, fetchPinnedConnectVersion, openAdminGatewaySession, checkPositionGuard, describeUpdateDisabled, } from './connector-update.js';
22
+ import { startConnectorUpdate, runConnectorUpdate, fetchPinnedConnectVersion, openAdminGatewaySession, checkPositionGuard, describeUpdateDisabled, requestGatewayRestart, RESTART_REASON_OPERATOR, } from './connector-update.js';
23
23
  import { DEFAULT_AGENT_ID, isForeignAgentEvent, resolveAgentEventOwner } from '../gateway/agent-scope.js';
24
24
  const TAG = 'gateway';
25
25
  // ---- Day-start NAV persistence ----
@@ -828,6 +828,50 @@ export class GatewayProvider {
828
828
  });
829
829
  return started;
830
830
  }
831
+ /**
832
+ * Operator-triggered gateway self-restart through OpenClaw's own
833
+ * `gateway.restart.request` RPC. The one door on a Docker / unmanaged box:
834
+ * the installer cannot restart such a gateway, a raw signal is ignored as
835
+ * unauthorized, and running the CLI inside the container boots a second
836
+ * plugin stack (2026-09-19/20). Same gates as updateConnector — per-host
837
+ * opt-out, connected gateway, open-positions acknowledgement — then a
838
+ * short-lived operator.admin session for the single RPC. A `restarting`
839
+ * outcome is also emitted as a connector_update frame so the dashboard
840
+ * latches "restart expected" before the connection drops.
841
+ */
842
+ async restartGateway(args) {
843
+ if (this.config.allowConnectorUpdate === false) {
844
+ logger.info(TAG, 'connector.restart refused: one-click updates are switched off on this box');
845
+ return describeUpdateDisabled();
846
+ }
847
+ if (!this.wsClient) {
848
+ return { ok: false, status: 'failed', message: 'Not connected to the OpenClaw gateway.' };
849
+ }
850
+ const openPositionCount = this.positions.filter((p) => Math.abs(Number(p.contracts) || 0) > 0).length;
851
+ const blocked = checkPositionGuard({ acknowledgeOpenPositions: args.acknowledgeOpenPositions, openPositionCount });
852
+ if (blocked)
853
+ return blocked;
854
+ const admin = new GatewayWsClient({
855
+ gatewayUrl: this.config.gatewayUrl,
856
+ gatewayToken: this.config.gatewayToken,
857
+ requestAdminScope: true,
858
+ identities: [this.wsClient.getClientId()],
859
+ requireScope: 'operator.admin',
860
+ }, { baseDelayMs: 60_000, maxDelayMs: 60_000, maxFastAttempts: 0, jitterFactor: 0, slowRetryMs: 3_600_000 });
861
+ const session = await openAdminGatewaySession(admin);
862
+ if (!session.ok)
863
+ return session.outcome;
864
+ try {
865
+ const rpc = (method, params) => admin.sendRpc(method, params);
866
+ const outcome = await requestGatewayRestart(rpc, { reason: RESTART_REASON_OPERATOR });
867
+ if (outcome.status === 'restarting')
868
+ this.emitConnectorUpdate(outcome);
869
+ return outcome;
870
+ }
871
+ finally {
872
+ admin.destroy();
873
+ }
874
+ }
831
875
  emitConnectorUpdate(payload) {
832
876
  this.fire('connectorUpdate', payload);
833
877
  }
package/bridge/types.d.ts CHANGED
@@ -3,7 +3,7 @@ export type { Channel, RequestFrame, ResponseFrame, EventFrame, Frame, Emergency
3
3
  export { VALID_CHANNELS, VALID_EMERGENCY_ACTIONS } from '@reefclaw/shared';
4
4
  type EventFrame = _EventFrame;
5
5
  /** Methods the skill accepts from the relay (browser → skill) */
6
- export declare const ALLOWED_METHODS: readonly ["emergency.kill", "emergency.flatten", "emergency.pause", "emergency.resume", "reconcile", "chat.send", "skill.update", "close_position", "set_trading_mode", "set_exchange_credentials", "test_exchange_credentials", "clear_exchange_credentials", "hl_provision_agent_wallet", "hl_agent_wallet_status", "hl_submit_agent_approval", "get_bracket_config", "set_bracket_requirement", "connector.update"];
6
+ export declare const ALLOWED_METHODS: readonly ["emergency.kill", "emergency.flatten", "emergency.pause", "emergency.resume", "reconcile", "chat.send", "skill.update", "close_position", "set_trading_mode", "set_exchange_credentials", "test_exchange_credentials", "clear_exchange_credentials", "hl_provision_agent_wallet", "hl_agent_wallet_status", "hl_submit_agent_approval", "get_bracket_config", "set_bracket_requirement", "connector.update", "connector.restart"];
7
7
  /** Subset of ALLOWED_METHODS that require operator.write scope. The bridge
8
8
  * enforces this before dispatching — a session without the scope gets a
9
9
  * 403 error. PR2 ships the scope as session-wide (inherited from the Clerk
package/bridge/types.js CHANGED
@@ -29,6 +29,11 @@ export const ALLOWED_METHODS = [
29
29
  // the gateway PTY — carries no command/version/args field by design (see the
30
30
  // security note in providers/connector-update.ts). operator.write-gated.
31
31
  'connector.update',
32
+ // Operator-triggered gateway restart via OpenClaw's OWN `gateway.restart.request`
33
+ // RPC (the gateway restarts itself in-process — works in Docker, needs no
34
+ // terminal and no host access). Carries only the open-positions
35
+ // acknowledgement. operator.write-gated.
36
+ 'connector.restart',
32
37
  ];
33
38
  /** Subset of ALLOWED_METHODS that require operator.write scope. The bridge
34
39
  * enforces this before dispatching — a session without the scope gets a
@@ -47,6 +52,7 @@ export const OPERATOR_WRITE_METHODS = new Set([
47
52
  'get_bracket_config',
48
53
  'set_bracket_requirement',
49
54
  'connector.update',
55
+ 'connector.restart',
50
56
  'emergency.kill',
51
57
  'emergency.flatten',
52
58
  'emergency.pause',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "reefclaw-paper-trading",
3
3
  "name": "ReefClaw Trading",
4
- "version": "0.1.36",
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.36",
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",
@@ -7,5 +7,7 @@
7
7
  "0.1.33": "Adds the connect installer's --agent <id> option for gateways that host several agents: the trading skill, heartbeat and dashboard attach to that agent and the trading tools are denied to the others.",
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
- "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."
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.",
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."
11
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.49
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.