@reefclaw/connect 0.1.6 → 0.1.8

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.
Files changed (50) hide show
  1. package/assets/bridge/bridge.js +46 -3
  2. package/assets/bridge/utils/skill-version.d.ts +9 -0
  3. package/assets/bridge/utils/skill-version.js +45 -1
  4. package/assets/plugin/ccxt/binance-ban-gate.js +3 -1
  5. package/assets/plugin/ccxt/binance-public.d.ts +17 -1
  6. package/assets/plugin/ccxt/binance-public.js +34 -1
  7. package/assets/plugin/ccxt/intel-public.d.ts +25 -0
  8. package/assets/plugin/ccxt/intel-public.js +80 -0
  9. package/assets/plugin/ccxt/public-market-data-api.d.ts +12 -0
  10. package/assets/plugin/ccxt/public-market-data-api.js +9 -0
  11. package/assets/plugin/config/plugin-config-io.d.ts +15 -0
  12. package/assets/plugin/index.js +117 -7
  13. package/assets/plugin/ingest/position-auto-capture.d.ts +5 -0
  14. package/assets/plugin/ingest/position-auto-capture.js +8 -2
  15. package/assets/plugin/ingest/position-decisions-client.d.ts +4 -0
  16. package/assets/plugin/ingest/readiness-reporter.d.ts +28 -5
  17. package/assets/plugin/ingest/readiness-reporter.js +40 -19
  18. package/assets/plugin/live/bracket-id.d.ts +9 -0
  19. package/assets/plugin/live/bracket-id.js +18 -0
  20. package/assets/plugin/tools/close-position.d.ts +2 -2
  21. package/assets/plugin/tools/create-order.d.ts +2 -2
  22. package/assets/plugin/tools/fetch-ohlcv.d.ts +2 -2
  23. package/assets/plugin/tools/fetch-ticker.d.ts +2 -2
  24. package/assets/plugin/tools/get-crypto-metrics.d.ts +2 -2
  25. package/assets/plugin/tools/get-market-structure.d.ts +2 -2
  26. package/assets/plugin/tools/get-orderbook.d.ts +2 -2
  27. package/assets/plugin/tools/get-volume-analysis.d.ts +2 -2
  28. package/assets/plugin/tools/helpers.d.ts +5 -4
  29. package/assets/plugin/tools/helpers.js +2 -1
  30. package/assets/plugin/types.d.ts +20 -1
  31. package/assets/plugin/venues/hyperliquid/hl-public.d.ts +52 -0
  32. package/assets/plugin/venues/hyperliquid/hl-public.js +285 -0
  33. package/assets/plugin/venues/registry.d.ts +19 -0
  34. package/assets/plugin/venues/registry.js +40 -0
  35. package/assets/shared/fills.d.ts +5 -1
  36. package/assets/shared/index.d.ts +4 -0
  37. package/assets/shared/index.js +2 -0
  38. package/assets/shared/readiness.d.ts +6 -1
  39. package/assets/shared/readiness.js +9 -0
  40. package/assets/shared/venues/symbols.d.ts +43 -0
  41. package/assets/shared/venues/symbols.js +123 -0
  42. package/assets/skill/SKILL.md +6 -0
  43. package/dist/cli.js +36 -1
  44. package/dist/validate.js +33 -1
  45. package/package.json +1 -1
  46. package/assets/shared/signals/indicators-extended.d.ts +0 -52
  47. package/assets/shared/signals/indicators-extended.js +0 -284
  48. package/assets/shared/signals/indicators.d.ts +0 -15
  49. package/assets/shared/signals/indicators.js +0 -107
  50. package/dist/daemon.js +0 -104
package/dist/daemon.js DELETED
@@ -1,104 +0,0 @@
1
- // Keep the bridge running across reboots. Linux/systemd-user is implemented
2
- // fully; macOS and Windows fall back to printing the manual run command (a
3
- // launchd/Task-Scheduler unit is a follow-up). The bridge reads its config from
4
- // ~/.openclaw/openclaw.json, so until the user pastes their connect message the
5
- // service will start, find no token, and restart — harmless; it connects within
6
- // seconds of the agent writing the config.
7
- import { writeFileSync, mkdirSync } from 'node:fs';
8
- import { join } from 'node:path';
9
- import { homedir, userInfo } from 'node:os';
10
- import { BRIDGE_DIR } from './paths.js';
11
- import { run, which } from './exec.js';
12
- import { step, ok, info, warn } from './ui.js';
13
- const SERVICE_NAME = 'reefclaw-bridge';
14
- const NODE = process.execPath; // absolute path to the node running the installer
15
- /**
16
- * Build the systemd user-unit text. Pure + exported so the path-quoting is
17
- * unit-testable. Both `node` (process.execPath) and `bridgeDir` (under the
18
- * user's home) can contain spaces. Quoting rules differ per directive:
19
- * - ExecStart= is parsed with shell-like word splitting, so an unquoted
20
- * `ExecStart=/home/a b/node …` reads the binary as `/home/a` — QUOTE both
21
- * the binary and the script path.
22
- * - WorkingDirectory= takes the raw value after `=` as a single path (no word
23
- * splitting) — spaces are safe UNQUOTED, and quotes are treated as literal
24
- * characters, failing the unit with "path is not absolute" (verified live
25
- * on systemd 255 / Ubuntu 24.04). Do NOT quote it.
26
- */
27
- export function buildSystemdUnit(node, bridgeDir) {
28
- const indexJs = join(bridgeDir, 'index.js');
29
- return `[Unit]
30
- Description=ReefClaw connector - bridges OpenClaw to the ReefClaw dashboard
31
- After=network-online.target
32
- Wants=network-online.target
33
-
34
- [Service]
35
- Type=simple
36
- WorkingDirectory=${bridgeDir}
37
- ExecStart="${node}" "${indexJs}" --provider gateway --log-level info
38
- Restart=always
39
- RestartSec=5s
40
-
41
- [Install]
42
- WantedBy=default.target
43
- `;
44
- }
45
- function manualHint() {
46
- warn('Could not set up an auto-start service on this OS yet.');
47
- info('Keep the connector running with this command (leave it open / use your own service manager):');
48
- info(` "${NODE}" "${join(BRIDGE_DIR, 'index.js')}" --provider gateway`);
49
- }
50
- function installSystemd() {
51
- if (!which('systemctl'))
52
- return false;
53
- const unitDir = join(homedir(), '.config', 'systemd', 'user');
54
- mkdirSync(unitDir, { recursive: true });
55
- const unit = buildSystemdUnit(NODE, BRIDGE_DIR);
56
- writeFileSync(join(unitDir, `${SERVICE_NAME}.service`), unit, 'utf-8');
57
- run('systemctl', ['--user', 'daemon-reload']);
58
- const enabled = run('systemctl', ['--user', 'enable', '--now', `${SERVICE_NAME}.service`]);
59
- if (!enabled.ok) {
60
- warn('systemd --user enable/start did not succeed:');
61
- if (enabled.stderr.trim())
62
- info(enabled.stderr.trim().split('\n').slice(-2).join('\n'));
63
- info(`Try: systemctl --user enable --now ${SERVICE_NAME}.service`);
64
- return false;
65
- }
66
- // `enable --now` can exit 0 while the unit failed to load (e.g. a bad unit
67
- // file setting) — verify the unit actually came up before claiming ✓.
68
- // 'active' = running; 'activating' = the expected pre-token restart loop
69
- // (the bridge exits until the user pastes their connect message, and
70
- // Restart=always re-launches it). Anything else (inactive/failed) means the
71
- // unit never loaded.
72
- const active = run('systemctl', ['--user', 'is-active', `${SERVICE_NAME}.service`]);
73
- const state = active.stdout.trim();
74
- if (state !== 'active' && state !== 'activating') {
75
- warn(`the service did not come up (state: ${state || 'unknown'}).`);
76
- info(`Inspect: systemctl --user status ${SERVICE_NAME}.service`);
77
- return false;
78
- }
79
- // Linger lets the user service run without an active login session (servers).
80
- // Best-effort: needs privileges; non-fatal if it fails.
81
- const linger = run('loginctl', ['enable-linger', userInfo().username]);
82
- if (linger.ok) {
83
- info('enabled linger (service survives logout / reboot)');
84
- }
85
- else {
86
- info('note: run `sudo loginctl enable-linger $USER` so the connector survives logout.');
87
- }
88
- return true;
89
- }
90
- export function installDaemon() {
91
- step('Starting the connector as a background service');
92
- if (process.platform === 'linux') {
93
- if (installSystemd()) {
94
- ok(`connector running as a systemd user service (${SERVICE_NAME})`);
95
- info(`logs: journalctl --user -u ${SERVICE_NAME} -f`);
96
- return true;
97
- }
98
- manualHint();
99
- return false;
100
- }
101
- // macOS / Windows: manual for now (launchd / Task Scheduler unit is a follow-up).
102
- manualHint();
103
- return false;
104
- }