@reefclaw/connect 0.1.20 → 0.1.22
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/assets/bridge/bridge.d.ts +20 -5
- package/assets/bridge/bridge.js +29 -14
- package/assets/bridge/config.js +6 -0
- package/assets/bridge/gateway/gateway-config.d.ts +16 -5
- package/assets/bridge/gateway/gateway-config.js +68 -12
- package/assets/bridge/gateway/gateway-ws-client.d.ts +4 -1
- package/assets/bridge/gateway/gateway-ws-client.js +41 -11
- package/assets/bridge/gateway/poller.js +18 -8
- package/assets/bridge/providers/emergency-commands.d.ts +9 -1
- package/assets/bridge/providers/emergency-commands.js +38 -1
- package/assets/bridge/providers/gateway.d.ts +51 -1
- package/assets/bridge/providers/gateway.js +209 -22
- package/assets/bridge/providers/onboarding-commands.d.ts +11 -0
- package/assets/bridge/providers/onboarding-commands.js +5 -5
- package/assets/bridge/providers/risk-calculator.d.ts +61 -2
- package/assets/bridge/providers/risk-calculator.js +92 -20
- package/assets/bridge/utils/skill-signing.js +8 -3
- package/assets/plugin/ccxt/binance-public.d.ts +17 -5
- package/assets/plugin/ccxt/binance-public.js +31 -3
- package/assets/plugin/config/operator-provenance.d.ts +6 -0
- package/assets/plugin/config/operator-provenance.js +50 -0
- package/assets/plugin/config/plugin-config-io.d.ts +15 -1
- package/assets/plugin/config/plugin-config-io.js +29 -0
- package/assets/plugin/exchange-adapter.d.ts +13 -0
- package/assets/plugin/index.js +230 -176
- package/assets/plugin/ingest/event-loop-monitor.d.ts +22 -0
- package/assets/plugin/ingest/event-loop-monitor.js +190 -0
- package/assets/plugin/ingest/position-auto-capture.d.ts +5 -0
- package/assets/plugin/ingest/position-auto-capture.js +14 -5
- package/assets/plugin/ingest/readiness-reporter.d.ts +26 -6
- package/assets/plugin/ingest/readiness-reporter.js +137 -9
- package/assets/plugin/ingest/skill-version-reader.d.ts +16 -0
- package/assets/plugin/ingest/skill-version-reader.js +64 -0
- package/assets/plugin/live/approval-lifecycle.d.ts +30 -0
- package/assets/plugin/live/approval-lifecycle.js +80 -0
- package/assets/plugin/live/bracket-types.d.ts +9 -0
- package/assets/plugin/live/live-adapter.d.ts +0 -1
- package/assets/plugin/live/user-data-stream.js +10 -2
- package/assets/plugin/onboarding/runtime.d.ts +34 -1
- package/assets/plugin/onboarding/runtime.js +56 -5
- package/assets/plugin/openclaw.plugin.json +1 -1
- package/assets/plugin/risk/pre-trade-check.js +18 -5
- package/assets/plugin/simulator/exchange-simulator.d.ts +45 -2
- package/assets/plugin/simulator/exchange-simulator.js +96 -4
- package/assets/plugin/simulator/types.d.ts +17 -0
- package/assets/plugin/strategy/condition-registry.js +9 -2
- package/assets/plugin/strategy/evaluator.d.ts +5 -0
- package/assets/plugin/tools/attach-brackets.js +50 -1
- package/assets/plugin/tools/cancel-all-orders.js +9 -1
- package/assets/plugin/tools/create-order.js +18 -1
- package/assets/plugin/tools/get-bracket-config.d.ts +21 -2
- package/assets/plugin/tools/get-bracket-config.js +18 -2
- package/assets/plugin/tools/set-trading-mode.js +6 -3
- package/assets/plugin/venues/hyperliquid/hl-bracket-coordinator.d.ts +25 -1
- package/assets/plugin/venues/hyperliquid/hl-bracket-coordinator.js +57 -0
- package/assets/plugin/venues/hyperliquid/hl-brackets.d.ts +10 -0
- package/assets/plugin/venues/hyperliquid/hl-brackets.js +45 -13
- package/assets/plugin/venues/hyperliquid/hl-fill-ingest.d.ts +18 -0
- package/assets/plugin/venues/hyperliquid/hl-fill-ingest.js +88 -0
- package/assets/plugin/venues/hyperliquid/hl-live-adapter.d.ts +36 -0
- package/assets/plugin/venues/hyperliquid/hl-live-adapter.js +116 -7
- package/assets/plugin/venues/hyperliquid/hl-public.d.ts +12 -5
- package/assets/plugin/venues/hyperliquid/hl-public.js +24 -3
- package/assets/plugin/venues/hyperliquid/hl-user-stream.d.ts +13 -1
- package/assets/plugin/venues/hyperliquid/hl-user-stream.js +4 -1
- package/assets/plugin/venues/registry.js +8 -7
- package/assets/plugin/wave9/paper-admission-guard.d.ts +12 -1
- package/assets/plugin/wave9/paper-admission-guard.js +12 -1
- package/assets/shared/index.d.ts +3 -3
- package/assets/shared/index.js +6 -2
- package/assets/shared/readiness.d.ts +45 -2
- package/assets/shared/readiness.js +60 -8
- package/assets/skill/SKILL.md +6 -11
- package/dist/cli.js +3 -0
- package/package.json +1 -1
|
@@ -5,22 +5,30 @@
|
|
|
5
5
|
// renders generically without duplicating the copy. Advisory only: readiness
|
|
6
6
|
// explains failures, it never blocks trading or the safety floor.
|
|
7
7
|
// See docs/AGENT_READINESS_GATE_PLAN.md.
|
|
8
|
+
/** A failed probe is read as a venue failure only while it finished within
|
|
9
|
+
* this multiple of its own timeout budget; past it, the clock says the
|
|
10
|
+
* process — not the network — is what broke. 2× leaves generous room for
|
|
11
|
+
* ordinary scheduling jitter and TLS/DNS slack while sitting far below the
|
|
12
|
+
* 8×-and-worse overshoots a real freeze produces. */
|
|
13
|
+
export const REACHABILITY_STALL_FACTOR = 2;
|
|
8
14
|
/** The canonical connect-phase checks + their plain-English fixes. Single source
|
|
9
15
|
* of copy; the plugin inlines these into each report so the webapp stays dumb. */
|
|
10
16
|
export const READINESS_CHECK_COPY = {
|
|
17
|
+
// ★ The DEFAULT reachability copy must describe possible causes, never assert
|
|
18
|
+
// one: this hint is attached to the debounced 'unreachable' warn, where all we
|
|
19
|
+
// know is that two probes did not complete. Asserting DNS/firewall/region sent
|
|
20
|
+
// an operator hunting a firewall that did not exist (issue #265) — the actual
|
|
21
|
+
// cause was the agent's own host being starved. A CONFIRMED geo-block (the
|
|
22
|
+
// server answered 451/403) gets the assertive copy below, passed explicitly.
|
|
11
23
|
binance_reachable: {
|
|
12
24
|
label: 'Binance reachable',
|
|
13
25
|
phase: 'connect',
|
|
14
|
-
fixHint: 'Your agent host
|
|
26
|
+
fixHint: 'Your agent host did not reach the Binance API on two consecutive checks. Possible causes: outbound HTTPS/DNS blocked, a transient Binance outage, or the host itself being starved of CPU/memory (check "Agent host responsive"). If it persists, verify connectivity and that the host region is Binance-permitted.',
|
|
15
27
|
},
|
|
16
|
-
// Dormant until the Hyperliquid venue ships (docs/HYPERLIQUID_INTEGRATION_PLAN.md
|
|
17
|
-
// Phase 1): the reporter probes only the CONFIGURED venue, so this id is never
|
|
18
|
-
// emitted while venue='binance'. Landed early so older webapps render it via the
|
|
19
|
-
// string-widened ReadinessCheck.id the moment a newer plugin starts sending it.
|
|
20
28
|
hyperliquid_reachable: {
|
|
21
29
|
label: 'Hyperliquid reachable',
|
|
22
30
|
phase: 'connect',
|
|
23
|
-
fixHint: 'Your agent host
|
|
31
|
+
fixHint: 'Your agent host did not reach the Hyperliquid API (api.hyperliquid.xyz) on two consecutive checks. Possible causes: outbound HTTPS/DNS blocked, a transient Hyperliquid outage, or the host itself being starved of CPU/memory (check "Agent host responsive"). If it persists, verify connectivity and that the host region is permitted.',
|
|
24
32
|
},
|
|
25
33
|
clock_in_sync: {
|
|
26
34
|
label: 'Host clock in sync',
|
|
@@ -37,9 +45,53 @@ export const READINESS_CHECK_COPY = {
|
|
|
37
45
|
phase: 'connect',
|
|
38
46
|
fixHint: 'No trading tools are registered. Ensure tools.alsoAllow includes "group:plugins", then restart the gateway.',
|
|
39
47
|
},
|
|
48
|
+
// The signal that actually matters on a trading rig, and the one that was
|
|
49
|
+
// invisible while a starved host masqueraded as an unreachable venue
|
|
50
|
+
// (issue #265): the agent process stopped running for seconds at a time. Fed
|
|
51
|
+
// by the event-loop delay the plugin samples locally.
|
|
52
|
+
//
|
|
53
|
+
// ★ This DEFAULT must not name a cause. Event-loop delay is a symptom of two
|
|
54
|
+
// opposite problems — the host starving the process, or the process blocking
|
|
55
|
+
// its own loop — and it alone cannot distinguish them. Asserting "your host is
|
|
56
|
+
// starved, give it more CPU/RAM" sent an operator toward a resize on a box
|
|
57
|
+
// measured at 0.05 load with 1.95s of lifetime runqueue wait (2026-07-29);
|
|
58
|
+
// the freeze was an in-process LLM turn. When the plugin CAN discriminate (it
|
|
59
|
+
// reads /proc/self/schedstat) it passes one of HOST_STALL_FIX_HINT below;
|
|
60
|
+
// this cautious copy is what an unattributable freeze gets. Same rule the
|
|
61
|
+
// reachability hints already follow.
|
|
62
|
+
host_responsive: {
|
|
63
|
+
label: 'Agent host responsive',
|
|
64
|
+
phase: 'connect',
|
|
65
|
+
fixHint: 'The agent process froze for seconds at a time, so order handling, stop attachment and bracket resync can be delayed by that much. Two things cause this and we could not tell them apart on this host: the host being short of CPU/memory (other containers, agents or a leaking process competing for the box), or something inside the agent process blocking it — note the AI agent itself runs in this same process. Check host load first; if it is idle, the freeze came from inside.',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
/** Assertive copy for a stall we COULD attribute, passed explicitly as the
|
|
69
|
+
* `fixHint` override — the same "only name a cause you measured" rule that
|
|
70
|
+
* governs GEO_BLOCK_FIX_HINT. The discriminator is the kernel's own runqueue
|
|
71
|
+
* wait for this process (/proc/self/schedstat): time spent runnable but denied
|
|
72
|
+
* a CPU. Large ⇒ the host really is the problem; ~0 across a multi-second
|
|
73
|
+
* freeze ⇒ the process blocked itself and no amount of extra hardware helps. */
|
|
74
|
+
export const HOST_STALL_FIX_HINT = {
|
|
75
|
+
host_starved: 'Your agent host is starved of CPU/memory — the agent process was ready to run but the host kept it waiting, so order handling, stop attachment and bracket resync can be delayed by that much. Give the host more CPU/RAM, or reduce what else runs on it (other containers, agents or a leaking process competing for the same box).',
|
|
76
|
+
self_inflicted: 'The agent process froze for seconds at a time, but the host was NOT short of CPU — it barely waited for one. Something inside the agent process blocked it, and the usual cause is an AI turn: the agent runs in the same process as order handling, so assembling a large turn (long session transcript, big memory database, large injected files) stops trading work while it runs. More CPU/RAM will not fix this. Trim what each turn loads, or reduce turn frequency.',
|
|
77
|
+
};
|
|
78
|
+
/** Assertive copy for a CONFIRMED geo-block, passed explicitly as the `fixHint`
|
|
79
|
+
* override. This is the one case where naming the cause is honest: the server
|
|
80
|
+
* answered 451/403, so we are reporting what it told us — not an inference from
|
|
81
|
+
* a request that never completed. */
|
|
82
|
+
export const GEO_BLOCK_FIX_HINT = {
|
|
83
|
+
binance: 'Your agent host is geo-blocked by Binance (HTTP 451) — Binance itself refused the request. Run OpenClaw from a Binance-permitted region; most EU / several Asia VPS regions work.',
|
|
84
|
+
hyperliquid: 'Your agent host is blocked by Hyperliquid (api.hyperliquid.xyz answered HTTP 451/403) — the API itself refused the request, so this is a region/policy block rather than a network fault. Run OpenClaw from a permitted region.',
|
|
40
85
|
};
|
|
41
86
|
/** Build a self-describing check, pulling label/phase/fixHint from the copy map.
|
|
42
|
-
* fixHint is attached only when there is something to fix (warn/fail).
|
|
87
|
+
* fixHint is attached only when there is something to fix (warn/fail).
|
|
88
|
+
*
|
|
89
|
+
* `fixHint` in opts OVERRIDES the copy-map default. The static copy asserts one
|
|
90
|
+
* cause per check id, which is right for a definitive signal (a 451 IS a geo
|
|
91
|
+
* block) but wrong when the same id fires on an inference: a reachability warn
|
|
92
|
+
* sent the operator hunting a firewall that was never the problem (issue #265).
|
|
93
|
+
* Callers that know the status was inferred pass a hint that describes the
|
|
94
|
+
* possibilities instead of asserting one. */
|
|
43
95
|
export function makeReadinessCheck(id, status, opts = {}) {
|
|
44
96
|
const copy = READINESS_CHECK_COPY[id];
|
|
45
97
|
const needsFix = status === 'warn' || status === 'fail';
|
|
@@ -49,7 +101,7 @@ export function makeReadinessCheck(id, status, opts = {}) {
|
|
|
49
101
|
phase: copy.phase,
|
|
50
102
|
status,
|
|
51
103
|
...(opts.detail !== undefined ? { detail: opts.detail } : {}),
|
|
52
|
-
...(needsFix ? { fixHint: copy.fixHint } : {}),
|
|
104
|
+
...(needsFix ? { fixHint: opts.fixHint ?? copy.fixHint } : {}),
|
|
53
105
|
checkedAt: opts.checkedAt ?? Date.now(),
|
|
54
106
|
};
|
|
55
107
|
}
|
package/assets/skill/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: reefclaw
|
|
3
|
-
version: 0.0.
|
|
3
|
+
version: 0.0.7
|
|
4
4
|
description: ReefClaw trading control room — bootstrap (connects your agent; full trading instructions arrive automatically after first connect)
|
|
5
5
|
author: ReefClaw
|
|
6
6
|
homepage: https://reefclaw.com
|
|
@@ -24,18 +24,13 @@ config:
|
|
|
24
24
|
description: ReefClaw relay WebSocket URL. Defaults to the production relay when omitted.
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
<!-- BOOTSTRAP SKILL.md — this is the thin installer copy shipped in the
|
|
28
|
-
@reefclaw/connect npm package. It carries ONLY the config schema and the
|
|
29
|
-
connect instructions. The FULL trading instructions (versioned 2.x.y) are
|
|
30
|
-
delivered automatically by the ReefClaw connector minutes after the first
|
|
31
|
-
successful connect, over the authenticated update channel — they replace
|
|
32
|
-
this file in place (a 0.0.x version always loses the semver comparison).
|
|
33
|
-
The "Connecting (first run)" section below MUST stay in sync with the
|
|
34
|
-
same section in skill/SKILL.md. -->
|
|
35
|
-
|
|
36
27
|
# ReefClaw — Connect Your Agent (Bootstrap)
|
|
37
28
|
|
|
38
|
-
|
|
29
|
+
## About this file
|
|
30
|
+
|
|
31
|
+
This is the thin BOOTSTRAP copy shipped in the `@reefclaw/connect` npm package. It covers **installing the ReefClaw plugin and connecting to the user's ReefClaw account** — nothing else. The FULL trading instructions (versioned 2.x.y) are delivered automatically by the ReefClaw connector minutes after the first successful connect, over the authenticated update channel — they replace this file in place (a 0.0.x version always loses the semver comparison). Maintainers: the "Connecting (first run)" section below MUST stay in sync with the same section in `skill/SKILL.md`.
|
|
32
|
+
|
|
33
|
+
You are being connected to **ReefClaw**, a supervised trading control room. Your operator watches everything you do on the ReefClaw dashboard. Some steps below change host configuration or install software; they exist solely to complete the setup **the user initiated by pasting their connect message**. Tell the user what each step changes before you do it, do it only for that user, and revert any temporary permission (like elevated exec) as soon as the install completes.
|
|
39
34
|
|
|
40
35
|
**Do not attempt to trade before the full instructions arrive.** If trading tools are visible but this file is still a bootstrap version (0.0.x), the connection has not completed — finish connecting first.
|
|
41
36
|
|
package/dist/cli.js
CHANGED
|
@@ -89,6 +89,9 @@ function wireConfig(pre) {
|
|
|
89
89
|
info('This is required for OpenClaw v2026.4.2+ to keep operator scopes on the WS connection; keep the gateway bound to localhost.');
|
|
90
90
|
}
|
|
91
91
|
const merged = mergeReefClawConfig(base);
|
|
92
|
+
// Explicit disclosure: the connect message's rc_ token is persisted locally
|
|
93
|
+
// so the connector can authenticate to the user's relay room across restarts.
|
|
94
|
+
info('Saving your ReefClaw connection settings (including the rc_ token) to ~/.openclaw/openclaw.json — owner-only file permissions (0600).');
|
|
92
95
|
writeConfig(merged);
|
|
93
96
|
ok('sandbox allowlist (group:plugins) + gateway scope + reefclaw entry ensured');
|
|
94
97
|
return merged;
|