@reefclaw/openclaw-plugin 0.1.49 → 0.1.50
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/README.md +10 -6
- package/bridge/gateway/gateway-ws-client.d.ts +79 -1
- package/bridge/gateway/gateway-ws-client.js +99 -5
- package/bridge/providers/connector-update-direct.d.ts +3 -0
- package/bridge/providers/connector-update-direct.js +11 -1
- package/bridge/providers/connector-update-openclaw.d.ts +268 -0
- package/bridge/providers/connector-update-openclaw.js +772 -0
- package/bridge/providers/connector-update.d.ts +115 -1
- package/bridge/providers/connector-update.js +228 -13
- package/bridge/providers/gateway.d.ts +31 -10
- package/bridge/providers/gateway.js +139 -27
- package/config/first-start-venue.d.ts +147 -0
- package/config/first-start-venue.js +400 -0
- package/config/plugin-config-io.d.ts +9 -2
- package/config/plugin-config-io.js +29 -5
- package/connector-supervisor.d.ts +20 -0
- package/connector-supervisor.js +27 -1
- package/index.js +32 -1
- package/openclaw.plugin.json +333 -1
- package/package.json +1 -1
- package/release-integrity.json +5 -0
- package/release-notes.json +2 -1
- package/skills/reefclaw/SKILL.md +21 -8
- package/tools/venue-quote-hint.d.ts +49 -0
- package/tools/venue-quote-hint.js +200 -0
|
@@ -23,8 +23,9 @@ import { parseIdentityName } from '../utils/identity-name.js';
|
|
|
23
23
|
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';
|
|
24
24
|
import { executeKill as _executeKill, executeFlatten as _executeFlatten, executePause as _executePause, executeResume as _executeResume, cancelPendingProposals, withProposalDetail, } from './emergency-commands.js';
|
|
25
25
|
import { executeSetTradingMode, executeGetBracketConfig, executeSetBracketRequirement, executeSetExchangeCredentials, executeTestExchangeCredentials, executeClearExchangeCredentials, executeProvisionHlAgentWallet, executeHlAgentWalletStatus, executeSubmitHlAgentApproval, } from './onboarding-commands.js';
|
|
26
|
-
import { startConnectorUpdate, runConnectorUpdate,
|
|
26
|
+
import { startConnectorUpdate, runConnectorUpdate, fetchPinnedRelease, openAdminGatewaySession, checkPositionGuard, describeUnconfirmedConnectVersion, describeUpdateAlreadyRunning, describeUpdateDisabled, tryBeginConnectorUpdate, requestGatewayRestart, RESTART_REASON_OPERATOR, } from './connector-update.js';
|
|
27
27
|
import { isInsideContainer, readContainerProbe, runDirectConnectorUpdate } from './connector-update-direct.js';
|
|
28
|
+
import { getRunningPluginRelease, inspectInstalledPlugin, planConnectorUpdate, runOpenClawPluginUpdate, } from './connector-update-openclaw.js';
|
|
28
29
|
import { DEFAULT_AGENT_ID, isForeignAgentEvent, resolveAgentEventOwner } from '../gateway/agent-scope.js';
|
|
29
30
|
import { noteWebappResponse, webappEdgeTracker, webappHeaders } from '../utils/webapp-edge.js';
|
|
30
31
|
const TAG = 'gateway';
|
|
@@ -817,15 +818,21 @@ export class GatewayProvider {
|
|
|
817
818
|
* Operator-only. Update the ReefClaw connector on this box to the latest
|
|
818
819
|
* published version.
|
|
819
820
|
*
|
|
820
|
-
*
|
|
821
|
-
*
|
|
822
|
-
*
|
|
823
|
-
*
|
|
824
|
-
*
|
|
821
|
+
* Two update paths, chosen by how the plugin was installed (plugins.inspect
|
|
822
|
+
* over the admin session, after every guard):
|
|
823
|
+
* - a copy OpenClaw installed from ClawHub → OpenClaw's own plugins.install
|
|
824
|
+
* (update mode), pinned to the exact PLUGIN release ReefClaw's public
|
|
825
|
+
* release endpoint reports, then a gateway self-restart
|
|
826
|
+
* (providers/connector-update-openclaw.ts);
|
|
827
|
+
* - everything else → the connect installer over the gateway's PTY, or run
|
|
828
|
+
* directly (files-only) where there is no usable terminal, pinned to the
|
|
829
|
+
* exact CONNECTOR release (providers/connector-update.ts).
|
|
830
|
+
* The RPC carries no command/version/args parameter and never should — the
|
|
831
|
+
* versions are looked up by this process, never taken from the caller.
|
|
825
832
|
*
|
|
826
|
-
* The
|
|
827
|
-
*
|
|
828
|
-
* `restarting` and the dashboard waits for the reconnect.
|
|
833
|
+
* The update restarts the gateway when it finishes, which kills both the
|
|
834
|
+
* session and this process's own transport. That is the SUCCESS path: we
|
|
835
|
+
* report `restarting` and the dashboard waits for the reconnect.
|
|
829
836
|
*/
|
|
830
837
|
async updateConnector(args) {
|
|
831
838
|
// Per-host opt-out FIRST: a box whose operator switched this off must
|
|
@@ -852,16 +859,51 @@ export class GatewayProvider {
|
|
|
852
859
|
const blocked = checkPositionGuard(guardArgs);
|
|
853
860
|
if (blocked)
|
|
854
861
|
return blocked;
|
|
855
|
-
//
|
|
862
|
+
// ONE update at a time, process-wide (connector-update.ts
|
|
863
|
+
// tryBeginConnectorUpdate): the dashboard's busy flag is per browser, so a
|
|
864
|
+
// second tab or device can ask again mid-install — and a second run's
|
|
865
|
+
// gateway restart would kill the first run's install mid-stage. Taken
|
|
866
|
+
// synchronously, before the first await, so two requests cannot interleave;
|
|
867
|
+
// released when the run ends, whichever way (a background run releases it
|
|
868
|
+
// itself — `handedOff`).
|
|
869
|
+
const endUpdate = tryBeginConnectorUpdate();
|
|
870
|
+
if (!endUpdate) {
|
|
871
|
+
logger.info(TAG, 'connector.update refused: an update is already running on this box');
|
|
872
|
+
return describeUpdateAlreadyRunning();
|
|
873
|
+
}
|
|
874
|
+
let handedOff = false;
|
|
875
|
+
try {
|
|
876
|
+
return await this.updateConnectorLocked(guardArgs, () => {
|
|
877
|
+
handedOff = true;
|
|
878
|
+
return endUpdate;
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
finally {
|
|
882
|
+
if (!handedOff)
|
|
883
|
+
endUpdate();
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
/** updateConnector past its guards and holding the one-update lock.
|
|
887
|
+
* `handOff()` is called by a path that returns while its run continues in
|
|
888
|
+
* the background; that run releases the lock (the returned function) when
|
|
889
|
+
* it ends. */
|
|
890
|
+
async updateConnectorLocked(guardArgs, handOff) {
|
|
891
|
+
if (!this.wsClient) {
|
|
892
|
+
return { ok: false, status: 'failed', message: 'Not connected to the OpenClaw gateway.' };
|
|
893
|
+
}
|
|
894
|
+
// Which version? Only the ones ReefClaw vouches for, fetched by THIS
|
|
856
895
|
// process from the public release endpoint — never `@latest`, never a
|
|
857
|
-
// caller-supplied string.
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
//
|
|
864
|
-
//
|
|
896
|
+
// caller-supplied string. One request, both releases (connector + plugin);
|
|
897
|
+
// each path below refuses when ITS release is missing. Neither confirmed ⇒
|
|
898
|
+
// no update, before any gateway call.
|
|
899
|
+
const release = await fetchPinnedRelease({});
|
|
900
|
+
if (!release.ok)
|
|
901
|
+
return release.outcome;
|
|
902
|
+
// terminal.* and plugins.install are operator.admin-only (OpenClaw
|
|
903
|
+
// method-scopes). The long-lived session runs on operator.read/write by
|
|
904
|
+
// design, so open a SEPARATE short-lived admin session for this update.
|
|
905
|
+
// Reconnects are effectively disabled: the gateway restart is supposed to
|
|
906
|
+
// kill it.
|
|
865
907
|
const admin = new GatewayWsClient({
|
|
866
908
|
gatewayUrl: this.config.gatewayUrl,
|
|
867
909
|
gatewayToken: this.config.gatewayToken,
|
|
@@ -874,6 +916,38 @@ export class GatewayProvider {
|
|
|
874
916
|
if (!session.ok)
|
|
875
917
|
return session.outcome;
|
|
876
918
|
const rpc = (method, params) => admin.sendRpc(method, params);
|
|
919
|
+
// ★ Who installed this copy? Decided BEFORE picking PTY / direct: a copy
|
|
920
|
+
// OpenClaw installed from ClawHub (the no-terminal onboarding route) is
|
|
921
|
+
// not the connect installer's to update — the installer refuses it
|
|
922
|
+
// (ALREADY_INSTALLED_MARKER) — so it goes through OpenClaw's own
|
|
923
|
+
// plugins.install instead. No usable answer (older OpenClaw, an error) or
|
|
924
|
+
// a path install keeps today's installer path, unchanged.
|
|
925
|
+
const inspected = await inspectInstalledPlugin(rpc);
|
|
926
|
+
const plan = planConnectorUpdate(inspected, { pluginVersion: release.pluginVersion });
|
|
927
|
+
logger.info(TAG, `connector.update: route=${plan.path} (${plan.reason})`);
|
|
928
|
+
if (plan.path === 'blocked') {
|
|
929
|
+
admin.destroy();
|
|
930
|
+
return plan.outcome;
|
|
931
|
+
}
|
|
932
|
+
if (plan.path === 'openclaw') {
|
|
933
|
+
// opts only when given, so every other call is the byte-identical
|
|
934
|
+
// two-argument sendRpc it always was.
|
|
935
|
+
const gatewayRpc = (method, params, opts) => opts ? admin.sendRpc(method, params, opts) : admin.sendRpc(method, params);
|
|
936
|
+
const running = getRunningPluginRelease();
|
|
937
|
+
return this.runOpenClawUpdate(gatewayRpc, admin, {
|
|
938
|
+
inspect: inspected,
|
|
939
|
+
pinnedPluginVersion: release.pluginVersion,
|
|
940
|
+
hello: admin.getHelloInfo(),
|
|
941
|
+
runningRelease: running.version,
|
|
942
|
+
runningReleaseLoadedByGateway: running.loadedByGateway,
|
|
943
|
+
}, handOff());
|
|
944
|
+
}
|
|
945
|
+
// The installer path needs the exact CONNECTOR release.
|
|
946
|
+
if (release.connectVersion === null) {
|
|
947
|
+
admin.destroy();
|
|
948
|
+
return describeUnconfirmedConnectVersion();
|
|
949
|
+
}
|
|
950
|
+
const connectVersion = release.connectVersion;
|
|
877
951
|
// Inside a container the PTY path is the wrong tool even where the
|
|
878
952
|
// terminal RPC exists: the full installer runs the `openclaw` CLI inside
|
|
879
953
|
// the live gateway (a second plugin stack) and cannot restart the
|
|
@@ -881,14 +955,14 @@ export class GatewayProvider {
|
|
|
881
955
|
// the gateway restart itself (connector-update-direct.ts).
|
|
882
956
|
if (isInsideContainer(readContainerProbe())) {
|
|
883
957
|
logger.info(TAG, 'connector.update: container detected — running the installer directly (files-only)');
|
|
884
|
-
return this.runDirectUpdate(rpc,
|
|
958
|
+
return this.runDirectUpdate(rpc, connectVersion, admin, release.pluginVersion, handOff());
|
|
885
959
|
}
|
|
886
|
-
const started = await startConnectorUpdate(rpc, guardArgs,
|
|
960
|
+
const started = await startConnectorUpdate(rpc, guardArgs, connectVersion);
|
|
887
961
|
if (started.status === 'blocked' && started.directFallback) {
|
|
888
962
|
// The gateway has no usable terminal (OpenClaw < 2026.7, terminal
|
|
889
963
|
// disabled, sandboxed agent). The connector does not need one.
|
|
890
964
|
logger.info(TAG, `connector.update: no gateway terminal (${started.message}) — running the installer directly`);
|
|
891
|
-
return this.runDirectUpdate(rpc,
|
|
965
|
+
return this.runDirectUpdate(rpc, connectVersion, admin, release.pluginVersion, handOff());
|
|
892
966
|
}
|
|
893
967
|
if (started.status !== 'started' || !started.sessionId) {
|
|
894
968
|
admin.destroy();
|
|
@@ -896,17 +970,23 @@ export class GatewayProvider {
|
|
|
896
970
|
}
|
|
897
971
|
// Stream progress in the background; the RPC returns as soon as the command
|
|
898
972
|
// is running so the browser is never left waiting on a minutes-long call.
|
|
899
|
-
// The admin session is torn down
|
|
900
|
-
|
|
973
|
+
// The admin session is torn down, and the one-update lock released, when
|
|
974
|
+
// the loop ends, whichever way.
|
|
975
|
+
const endUpdate = handOff();
|
|
976
|
+
void runConnectorUpdate(rpc, started.sessionId, (outcome) => this.emitConnectorUpdate(outcome), {
|
|
977
|
+
pluginVersion: release.pluginVersion,
|
|
978
|
+
}).finally(() => {
|
|
901
979
|
admin.destroy();
|
|
980
|
+
endUpdate();
|
|
902
981
|
});
|
|
903
982
|
return started;
|
|
904
983
|
}
|
|
905
984
|
/** The direct (no-PTY) update. Resolves the RPC with the `started` frame as
|
|
906
985
|
* soon as the installer is running (or the refusal), streams the rest as
|
|
907
|
-
* connector_update events, and tears the admin session down
|
|
908
|
-
* the same contract as the PTY
|
|
909
|
-
|
|
986
|
+
* connector_update events, and tears the admin session down (and releases
|
|
987
|
+
* the one-update lock, `onEnd`) at the end — the same contract as the PTY
|
|
988
|
+
* path. */
|
|
989
|
+
runDirectUpdate(rpc, version, admin, pluginVersion, onEnd) {
|
|
910
990
|
return new Promise((resolve) => {
|
|
911
991
|
let answered = false;
|
|
912
992
|
const answer = (outcome) => {
|
|
@@ -921,9 +1001,41 @@ export class GatewayProvider {
|
|
|
921
1001
|
this.emitConnectorUpdate(outcome);
|
|
922
1002
|
if (outcome.status === 'started')
|
|
923
1003
|
answer(outcome);
|
|
1004
|
+
}, { pluginVersion })
|
|
1005
|
+
.then((final) => answer(final))
|
|
1006
|
+
.finally(() => {
|
|
1007
|
+
admin.destroy();
|
|
1008
|
+
onEnd();
|
|
1009
|
+
});
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
/** The OpenClaw (plugins.install) update. Same contract as the direct path:
|
|
1013
|
+
* the RPC resolves with the first `started` frame (a restart-only run sends
|
|
1014
|
+
* one too, before it asks the gateway to restart) else with the final
|
|
1015
|
+
* outcome (a refusal decided before anything ran, or "already up to
|
|
1016
|
+
* date"); every emitted frame also goes out as a connector_update event.
|
|
1017
|
+
* The admin session stays open for the whole install (OpenClaw 2026.9.7
|
|
1018
|
+
* re-checks the caller's admin authority before persisting) and is torn
|
|
1019
|
+
* down — and the one-update lock released (`onEnd`) — at the end. */
|
|
1020
|
+
runOpenClawUpdate(rpc, admin, ctx, onEnd) {
|
|
1021
|
+
return new Promise((resolve) => {
|
|
1022
|
+
let answered = false;
|
|
1023
|
+
const answer = (outcome) => {
|
|
1024
|
+
if (answered)
|
|
1025
|
+
return;
|
|
1026
|
+
answered = true;
|
|
1027
|
+
resolve(outcome);
|
|
1028
|
+
};
|
|
1029
|
+
void runOpenClawPluginUpdate(rpc, ctx, (outcome) => {
|
|
1030
|
+
this.emitConnectorUpdate(outcome);
|
|
1031
|
+
if (outcome.status === 'started')
|
|
1032
|
+
answer(outcome);
|
|
924
1033
|
})
|
|
925
1034
|
.then((final) => answer(final))
|
|
926
|
-
.finally(() =>
|
|
1035
|
+
.finally(() => {
|
|
1036
|
+
admin.destroy();
|
|
1037
|
+
onEnd();
|
|
1038
|
+
});
|
|
927
1039
|
});
|
|
928
1040
|
}
|
|
929
1041
|
/**
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { type VenueId } from '../venues/symbols.js';
|
|
2
|
+
import { updatePluginConfig } from './plugin-config-io.js';
|
|
3
|
+
/** = index.ts PLUGIN_ID, the StateManager directory name (pinned by test). */
|
|
4
|
+
export declare const FIRST_START_PLUGIN_ID = "reefclaw-paper-trading";
|
|
5
|
+
/** The marker left in <OpenClaw state dir>/plugins/<pluginId>/ when that dir
|
|
6
|
+
* is not the plugin's own $HOME state dir. */
|
|
7
|
+
export declare const FIRST_START_MARKER_FILE = "first-start.json";
|
|
8
|
+
/** Keys the connect installer writes into plugin-config.json before the
|
|
9
|
+
* plugin's first start. Same table as installer/src/venue-config.ts
|
|
10
|
+
* isInstallerOwned — change both together. `connectorSupervisor` counts only
|
|
11
|
+
* as the installer's 'on'; an 'off' is a deliberate human setting. */
|
|
12
|
+
export declare function isInstallerOwnedKey(key: string, value: unknown): boolean;
|
|
13
|
+
export type SavedVenue = {
|
|
14
|
+
kind: 'none';
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'venue';
|
|
17
|
+
venue: VenueId;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'unrecognized';
|
|
20
|
+
shown: string;
|
|
21
|
+
};
|
|
22
|
+
/** Tolerant parse (an agent wrote it): strings only, trimmed + lowercased,
|
|
23
|
+
* and only the exact ids 'hyperliquid' / 'binance' after that. */
|
|
24
|
+
export declare function parseSavedVenue(raw: unknown): SavedVenue;
|
|
25
|
+
export type PluginConfigView = {
|
|
26
|
+
kind: 'absent';
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'unreadable';
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'object';
|
|
31
|
+
value: Record<string, unknown>;
|
|
32
|
+
};
|
|
33
|
+
export type FirstStartVenueSkipReason = 'disabled' | 'not-requested' | 'ran-before' | 'unrecognized' | 'binance-default' | 'unreadable' | 'already-set' | 'configured-before';
|
|
34
|
+
export type FirstStartVenueDecision = {
|
|
35
|
+
action: 'write';
|
|
36
|
+
venue: 'hyperliquid';
|
|
37
|
+
} | {
|
|
38
|
+
action: 'skip';
|
|
39
|
+
reason: Exclude<FirstStartVenueSkipReason, 'disabled'>;
|
|
40
|
+
};
|
|
41
|
+
/** Pure. Order matters: `ran-before` is checked before garbage, so a box that
|
|
42
|
+
* ran before never warns about its saved value on every restart. */
|
|
43
|
+
export declare function decideFirstStartVenue(input: {
|
|
44
|
+
saved: SavedVenue;
|
|
45
|
+
ranBefore: boolean;
|
|
46
|
+
pluginConfig: PluginConfigView;
|
|
47
|
+
}): FirstStartVenueDecision;
|
|
48
|
+
/** The state dir and the transport key are written only by this plugin's
|
|
49
|
+
* first full register() (StateManager, ensureCredentialTransportKey); the
|
|
50
|
+
* OpenClaw-side dir only by markFirstStart below. Any one present = ran
|
|
51
|
+
* before. */
|
|
52
|
+
export declare function pluginRanBefore(paths: {
|
|
53
|
+
stateDir: string;
|
|
54
|
+
transportKeyFile: string;
|
|
55
|
+
openclawPluginDir?: string;
|
|
56
|
+
}): boolean;
|
|
57
|
+
export type FirstStartMarkOutcome = 'not-needed' | 'present' | 'written' | 'failed';
|
|
58
|
+
/** Record that ReefClaw has started on this OpenClaw state, in OpenClaw's
|
|
59
|
+
* state dir, when that is not where StateManager already records it (the
|
|
60
|
+
* $HOME state dir). Exclusive create: never overwrites. Never throws. */
|
|
61
|
+
export declare function markFirstStart(paths: {
|
|
62
|
+
stateDir: string;
|
|
63
|
+
openclawPluginDir: string;
|
|
64
|
+
}, now?: Date): FirstStartMarkOutcome;
|
|
65
|
+
/** plugin-config.json as this rule sees it. Never throws. A symlink or a
|
|
66
|
+
* directory is `unreadable` (never written through), as is bad JSON, a BOM,
|
|
67
|
+
* or a non-object root. */
|
|
68
|
+
export declare function viewPluginConfig(path: string): PluginConfigView;
|
|
69
|
+
/** The saved onboarding venue, raw. OpenClaw's own resolved config handed to
|
|
70
|
+
* register() (api.config) first: it is the running gateway's config, and a
|
|
71
|
+
* config file at a default location may belong to another layout. The file
|
|
72
|
+
* only when api.config holds no venue (the agent wrote the file a moment
|
|
73
|
+
* before the hot-load). Nested `.config.venue` only. */
|
|
74
|
+
export declare function readSavedVenue(openclawConfig?: unknown, openclawConfigPath?: string): unknown;
|
|
75
|
+
/** Mirror of OpenClaw's resolveStateDir (src/config/state-dir.ts, v2026.9.7)
|
|
76
|
+
* without its legacy-dir fallback: OPENCLAW_STATE_DIR (a `~` expands against
|
|
77
|
+
* the effective home), else <effective home>/.openclaw, where the effective
|
|
78
|
+
* home is OPENCLAW_HOME, else the OS home. */
|
|
79
|
+
export declare function openClawStateDirFromEnv(env: NodeJS.ProcessEnv, home: string): string;
|
|
80
|
+
/** OpenClaw's state dir: the host's own answer when it hands one over
|
|
81
|
+
* (api.runtime.state.resolveStateDir on 2026.9.x, through `hostStateDir`),
|
|
82
|
+
* else the env mirror. Never throws. */
|
|
83
|
+
export declare function resolveOpenClawStateDir(input: {
|
|
84
|
+
hostStateDir?: () => unknown;
|
|
85
|
+
env: NodeJS.ProcessEnv;
|
|
86
|
+
home: string;
|
|
87
|
+
}): string;
|
|
88
|
+
export interface FirstStartPaths {
|
|
89
|
+
/** = plugin-config-io defaultConfigPath(). */
|
|
90
|
+
pluginConfigPath: string;
|
|
91
|
+
/** = dirname(new StateManager(pluginId).getStatePath()). */
|
|
92
|
+
stateDir: string;
|
|
93
|
+
/** = the file ensureCredentialTransportKey() writes with no dir. */
|
|
94
|
+
transportKeyFile: string;
|
|
95
|
+
/** <OpenClaw state dir>/plugins/<pluginId>: the marker's home. */
|
|
96
|
+
openclawPluginDir: string;
|
|
97
|
+
/** OPENCLAW_CONFIG_PATH, else <OpenClaw state dir>/openclaw.json. */
|
|
98
|
+
openclawConfigPath: string;
|
|
99
|
+
}
|
|
100
|
+
/** The default paths. Exported so tests pin them against the code that
|
|
101
|
+
* creates each one (StateManager, ensureCredentialTransportKey,
|
|
102
|
+
* defaultConfigPath) rather than against a literal. */
|
|
103
|
+
export declare function defaultFirstStartPaths(input: {
|
|
104
|
+
home: string;
|
|
105
|
+
pluginId: string;
|
|
106
|
+
openclawStateDir: string;
|
|
107
|
+
env: NodeJS.ProcessEnv;
|
|
108
|
+
}): FirstStartPaths;
|
|
109
|
+
export interface ApplyFirstStartVenueOptions {
|
|
110
|
+
/** register()'s api.config (OpenClaw's resolved config) — read first. */
|
|
111
|
+
openclawConfig?: unknown;
|
|
112
|
+
/** Lazily yields OpenClaw's own state dir (api.runtime.state.resolveStateDir);
|
|
113
|
+
* called inside the never-throw boundary. */
|
|
114
|
+
hostStateDir?: () => unknown;
|
|
115
|
+
/** Defaults to FIRST_START_PLUGIN_ID; decides the default state dirs. */
|
|
116
|
+
pluginId?: string;
|
|
117
|
+
/** Test seams. Defaults: defaultFirstStartPaths(). */
|
|
118
|
+
pluginConfigPath?: string;
|
|
119
|
+
stateDir?: string;
|
|
120
|
+
transportKeyFile?: string;
|
|
121
|
+
openclawPluginDir?: string;
|
|
122
|
+
openclawConfigPath?: string;
|
|
123
|
+
/** Test seam: OpenClaw's state dir (default resolveOpenClawStateDir()). */
|
|
124
|
+
openclawStateDir?: string;
|
|
125
|
+
env?: NodeJS.ProcessEnv;
|
|
126
|
+
/** Test seam for the atomic writer (default updatePluginConfig). */
|
|
127
|
+
writePluginConfig?: typeof updatePluginConfig;
|
|
128
|
+
}
|
|
129
|
+
export type FirstStartVenueResult = {
|
|
130
|
+
outcome: 'applied';
|
|
131
|
+
venue: 'hyperliquid';
|
|
132
|
+
} | {
|
|
133
|
+
outcome: 'skipped';
|
|
134
|
+
reason: FirstStartVenueSkipReason;
|
|
135
|
+
} | {
|
|
136
|
+
outcome: 'failed';
|
|
137
|
+
error: string;
|
|
138
|
+
};
|
|
139
|
+
/** See the file header. Synchronous (register() must be), never throws. */
|
|
140
|
+
export declare function applyFirstStartVenue(options?: ApplyFirstStartVenueOptions): FirstStartVenueResult;
|
|
141
|
+
/** The venue this box will actually start on, for log lines: what
|
|
142
|
+
* plugin-config.json selects, read the way index.ts reads it (following a
|
|
143
|
+
* symlink; unreadable = the Binance default). Never throws. */
|
|
144
|
+
export declare function describeSelectedVenue(path: string): {
|
|
145
|
+
venue: VenueId;
|
|
146
|
+
text: string;
|
|
147
|
+
};
|