dexbot 1.6.12 → 1.6.14
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/CHANGELOG.md +65 -1
- package/README.md +2 -2
- package/analysis/README.md +9 -11
- package/analysis/ama_fitting/README.md +5 -3
- package/claw/README.md +1 -0
- package/claw/docs/AI_BOT_LIBRARY_API.md +3 -1
- package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -4
- package/claw/modules/claw_bridge.ts +0 -3
- package/claw/modules/claw_catalog.ts +8 -4
- package/claw/modules/claw_skill_md.ts +1 -0
- package/claw/modules/dexbot_profiles.ts +59 -15
- package/claw/modules/types.ts +2 -1
- package/claw/package.json +3 -3
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/skills/margin-trading/SKILL.md +1 -1
- package/claw/skills/margin-trading/references/position-management.md +1 -1
- package/claw/tsconfig.json +2 -2
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +1 -14
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +51 -41
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +1 -24
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +36 -18
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +18 -66
- package/dist/analysis/analyze_args.d.ts +12 -0
- package/dist/analysis/analyze_args.js +20 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +1 -16
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +20 -101
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +26 -92
- package/dist/analysis/bot_fitting/backtest_lookback_drawdown.js +19 -34
- package/dist/analysis/bot_fitting/shared_utils.d.ts +71 -3
- package/dist/analysis/bot_fitting/shared_utils.js +124 -8
- package/dist/analysis/chart_ui.d.ts +30 -1
- package/dist/analysis/chart_ui.js +37 -1
- package/dist/analysis/fills_cache.d.ts +3 -23
- package/dist/analysis/fills_cache.js +3 -84
- package/dist/analysis/fills_source.d.ts +31 -1
- package/dist/analysis/fills_source.js +69 -1
- package/dist/analysis/grid_correction_check.d.ts +1 -23
- package/dist/analysis/grid_correction_check.js +15 -58
- package/dist/analysis/math_utils.d.ts +85 -1
- package/dist/analysis/math_utils.js +116 -1
- package/dist/analysis/price_sources.d.ts +22 -1
- package/dist/analysis/price_sources.js +23 -0
- package/dist/analysis/resolve_source.js +31 -10
- package/dist/analysis/trade_profitability.d.ts +6 -0
- package/dist/analysis/trade_profitability.js +23 -97
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +1 -17
- package/dist/analysis/tradingview/analyze_tradingview.js +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +27 -40
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.d.ts +1 -101
- package/dist/analysis/trend_detection/backtest_ama_slope_huber.js +22 -80
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +11 -37
- package/dist/analysis/trend_detection/volatility_chart_generator.js +9 -10
- package/dist/analysis/worker_pool.d.ts +38 -0
- package/dist/analysis/worker_pool.js +67 -0
- package/dist/dexbot.js +67 -48
- package/dist/market_adapter/ama_signal_runner.js +21 -54
- package/dist/market_adapter/candle_utils.d.ts +7 -1
- package/dist/market_adapter/candle_utils.js +11 -1
- package/dist/market_adapter/cli_args.d.ts +22 -0
- package/dist/market_adapter/cli_args.js +30 -0
- package/dist/market_adapter/core/config_normalizers.js +11 -6
- package/dist/market_adapter/core/kibana_candles.d.ts +3 -1
- package/dist/market_adapter/core/kibana_candles.js +3 -2
- package/dist/market_adapter/core/market_adapter_service.d.ts +85 -85
- package/dist/market_adapter/core/market_adapter_service.js +93 -158
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +1 -6
- package/dist/market_adapter/core/signals/hurst_analyzer.js +1 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts +1 -11
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +1 -1
- package/dist/market_adapter/inputs/fetch_book_data.js +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +63 -107
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +8 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +25 -7
- package/dist/market_adapter/inputs/kibana_feed_source.js +4 -26
- package/dist/market_adapter/inputs/window_cache.d.ts +4 -72
- package/dist/market_adapter/inputs/window_cache.js +52 -177
- package/dist/market_adapter/interval_utils.d.ts +11 -1
- package/dist/market_adapter/interval_utils.js +16 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +3 -0
- package/dist/market_adapter/lp_chart_runner.js +37 -19
- package/dist/market_adapter/market_adapter.js +27 -72
- package/dist/market_adapter/utils/data_discovery.d.ts +45 -1
- package/dist/market_adapter/utils/data_discovery.js +220 -27
- package/dist/market_adapter/utils/month_shards.d.ts +84 -0
- package/dist/market_adapter/utils/month_shards.js +237 -0
- package/dist/modules/account_bots.d.ts +8 -6
- package/dist/modules/account_bots.js +112 -131
- package/dist/modules/account_orders.d.ts +49 -4
- package/dist/modules/account_orders.js +114 -49
- package/dist/modules/bitshares-native/chain_client.d.ts +1 -1
- package/dist/modules/bitshares-native/chain_client.js +14 -13
- package/dist/modules/bitshares-native/crypto/ecc_core.d.ts +1 -2
- package/dist/modules/bitshares-native/crypto/ecc_core.js +1 -1
- package/dist/modules/bitshares-native/resolvers.js +22 -25
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts +1 -2
- package/dist/modules/bitshares-native/serial/chain_constants.js +1 -2
- package/dist/modules/bitshares-native/serial/types.js +22 -50
- package/dist/modules/bitshares-native/signing_client.d.ts +1 -1
- package/dist/modules/bot_defaults.d.ts +18 -3
- package/dist/modules/bot_defaults.js +34 -8
- package/dist/modules/bot_settings.d.ts +5 -1
- package/dist/modules/bot_settings.js +55 -21
- package/dist/modules/broadcast_failure.d.ts +2 -1
- package/dist/modules/chain_orders.d.ts +1 -1
- package/dist/modules/chain_orders.js +51 -96
- package/dist/modules/cli_start_onboarding.d.ts +2 -1
- package/dist/modules/config.js +6 -1
- package/dist/modules/constants.d.ts +14 -6
- package/dist/modules/constants.js +32 -6
- package/dist/modules/cr_planner.d.ts +1 -1
- package/dist/modules/cr_planner.js +1 -5
- package/dist/modules/credit_pricing.d.ts +2 -1
- package/dist/modules/credit_pricing.js +36 -40
- package/dist/modules/credit_runtime.d.ts +7 -0
- package/dist/modules/credit_runtime.js +45 -73
- package/dist/modules/daemon_node_health.d.ts +4 -3
- package/dist/modules/dexbot_class.d.ts +33 -17
- package/dist/modules/dexbot_class.js +113 -61
- package/dist/modules/dexbot_cow_runtime.d.ts +62 -181
- package/dist/modules/dexbot_cow_runtime.js +380 -69
- package/dist/modules/dexbot_credential_client.d.ts +1 -23
- package/dist/modules/dexbot_credential_client.js +2 -3
- package/dist/modules/dexbot_fill_runtime.d.ts +2 -3
- package/dist/modules/dexbot_fill_runtime.js +17 -7
- package/dist/modules/dexbot_maintenance_runtime.d.ts +36 -81
- package/dist/modules/dexbot_maintenance_runtime.js +137 -133
- package/dist/modules/dexbot_startup_runtime.d.ts +0 -1
- package/dist/modules/dexbot_startup_runtime.js +25 -14
- package/dist/modules/dexbot_state_recovery.js +16 -0
- package/dist/modules/general_settings.d.ts +1 -1
- package/dist/modules/graceful_shutdown.js +17 -11
- package/dist/modules/key_store.d.ts +0 -5
- package/dist/modules/key_store.js +1 -2
- package/dist/modules/lazy_shim.d.ts +11 -0
- package/dist/modules/lazy_shim.js +16 -0
- package/dist/modules/node_connect_policy.d.ts +3 -2
- package/dist/modules/node_failure_ledger.d.ts +6 -5
- package/dist/modules/order/accounting.js +11 -11
- package/dist/modules/order/export.js +2 -2
- package/dist/modules/order/format.d.ts +26 -3
- package/dist/modules/order/format.js +33 -3
- package/dist/modules/order/genesis_policy.d.ts +4 -4
- package/dist/modules/order/genesis_policy.js +6 -3
- package/dist/modules/order/grid.d.ts +26 -12
- package/dist/modules/order/grid.js +468 -80
- package/dist/modules/order/grid_reconcile.d.ts +1 -1
- package/dist/modules/order/grid_reconcile.js +5 -5
- package/dist/modules/order/grid_reconcile_internal.js +48 -40
- package/dist/modules/order/index.d.ts +35 -8
- package/dist/modules/order/logger.d.ts +1 -8
- package/dist/modules/order/logger.js +2 -11
- package/dist/modules/order/manager.d.ts +18 -15
- package/dist/modules/order/manager.js +91 -74
- package/dist/modules/order/strategy.d.ts +2 -2
- package/dist/modules/order/strategy.js +51 -21
- package/dist/modules/order/sync_engine.js +4 -0
- package/dist/modules/order/utils/math.d.ts +3 -3
- package/dist/modules/order/utils/math.js +38 -27
- package/dist/modules/order/utils/order.d.ts +58 -58
- package/dist/modules/order/utils/order.js +158 -137
- package/dist/modules/order/utils/system.d.ts +202 -35
- package/dist/modules/order/utils/system.js +409 -31
- package/dist/modules/order/utils/validate.js +28 -6
- package/dist/modules/order/utils/withPoolRef.d.ts +2 -1
- package/dist/modules/paths.js +32 -34
- package/dist/modules/runtime_settings.d.ts +3 -5
- package/dist/modules/runtime_settings.js +3 -3
- package/dist/modules/settings_merge.d.ts +2 -2
- package/dist/modules/socket_json_client.d.ts +2 -1
- package/dist/modules/types.d.ts +89 -30
- package/dist/modules/utils/errors.js +1 -3
- package/dist/modules/version_notice.d.ts +11 -10
- package/dist/pm2.d.ts +0 -1
- package/dist/pm2.js +56 -35
- package/dist/scripts/analyze-git.js +2 -15
- package/dist/scripts/analyze-orders.d.ts +1 -1
- package/dist/scripts/analyze-orders.js +4 -4
- package/dist/scripts/chart_command.js +2 -2
- package/dist/scripts/check_any.d.ts +4 -0
- package/dist/scripts/check_any.js +53 -21
- package/dist/scripts/diagnose-pool-history.js +1 -6
- package/dist/scripts/divergence-calc.js +6 -6
- package/dist/scripts/run-tests.js +0 -1
- package/dist/scripts/sync-version.js +0 -10
- package/dist/scripts/validate_bots.d.ts +1 -1
- package/dist/scripts/validate_bots.js +3 -3
- package/dist/unlock.js +7 -2
- package/docs/BITSHARES_ONBOARDING.md +8 -12
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +2 -3
- package/docs/COW_INVARIANTS.md +6 -6
- package/docs/DEXBOT_COMPARISON.md +7 -7
- package/docs/EVOLUTION.md +10 -8
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +8 -6
- package/docs/GRID_PRICE_INVARIANT.md +3 -3
- package/docs/GRID_RECALCULATION.md +4 -1
- package/docs/GRID_RECONCILE.md +4 -4
- package/docs/LIFECYCLE.md +11 -11
- package/docs/LOGGING.md +14 -0
- package/docs/MPA_CREDIT_USAGE.md +1 -1
- package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +12 -4
- package/docs/README.md +3 -3
- package/docs/WORKFLOW.md +1 -0
- package/docs/architecture.md +25 -16
- package/docs/developer_guide.md +7 -2
- package/market_adapter/README.md +6 -4
- package/package.json +6 -9
- package/scripts/README.md +43 -38
- package/tests/README.md +26 -11
- package/dist/scripts/diagnose-kibana-candles.d.ts +0 -3
- package/dist/scripts/diagnose-kibana-candles.js +0 -82
- package/scripts/git-viewer.sh +0 -489
- package/scripts/postinstall.js +0 -16
package/dist/modules/paths.js
CHANGED
|
@@ -143,6 +143,27 @@ function resolveProfilesDir(projectRoot = PROJECT_ROOT) {
|
|
|
143
143
|
return homeDir || repoDir;
|
|
144
144
|
}
|
|
145
145
|
const PROFILES_DIR = resolveProfilesDir();
|
|
146
|
+
/**
|
|
147
|
+
* Shared layout rule for bundled data dirs (market_adapter, claw, analysis):
|
|
148
|
+
* the source layout is used only when the profiles dir also resolves to the
|
|
149
|
+
* repo checkout (and, where required, the bundled dir exists); otherwise the
|
|
150
|
+
* root follows the relocated profiles dir. Env vars override both. `root()`
|
|
151
|
+
* resolves an env-overridable sub-root (e.g. `data`, `state`) under the chosen
|
|
152
|
+
* layout; `DIR` companions use `sourceDir`/`relocatedDir` directly.
|
|
153
|
+
*/
|
|
154
|
+
function resolveBundledLayout(name, profilesDir, projectRoot, requireExisting = false) {
|
|
155
|
+
const sourceDir = path.join(projectRoot, name);
|
|
156
|
+
const relocatedDir = path.join(profilesDir, name);
|
|
157
|
+
const useSourceLayout = profilesDir === path.join(projectRoot, 'profiles')
|
|
158
|
+
&& (!requireExisting || fs.existsSync(sourceDir));
|
|
159
|
+
const root = (envVar, sourceSub = '', relocatedSub = sourceSub) => {
|
|
160
|
+
const env = getEnvLive(envVar);
|
|
161
|
+
if (env)
|
|
162
|
+
return path.resolve(env);
|
|
163
|
+
return useSourceLayout ? path.join(sourceDir, sourceSub) : path.join(relocatedDir, relocatedSub);
|
|
164
|
+
};
|
|
165
|
+
return { sourceDir, relocatedDir, useSourceLayout, root };
|
|
166
|
+
}
|
|
146
167
|
/**
|
|
147
168
|
* Market adapter data/state dirs. State stays next to the code (source
|
|
148
169
|
* layout) only when the profiles dir also resolves to the repo layout —
|
|
@@ -152,22 +173,11 @@ const PROFILES_DIR = resolveProfilesDir();
|
|
|
152
173
|
* state across the repo and home. Env vars override both.
|
|
153
174
|
*/
|
|
154
175
|
function resolveMarketAdapterDirs(profilesDir = PROFILES_DIR, projectRoot = PROJECT_ROOT) {
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
const stateEnv = getEnvLive('DEXBOT_MARKET_ADAPTER_STATE_DIR');
|
|
159
|
-
const dataRoot = dataEnv
|
|
160
|
-
? path.resolve(dataEnv)
|
|
161
|
-
: useSourceLayout
|
|
162
|
-
? path.join(sourceDir, 'data')
|
|
163
|
-
: path.join(profilesDir, 'market_adapter', 'data');
|
|
164
|
-
const stateRoot = stateEnv
|
|
165
|
-
? path.resolve(stateEnv)
|
|
166
|
-
: useSourceLayout
|
|
167
|
-
? path.join(sourceDir, 'state')
|
|
168
|
-
: path.join(profilesDir, 'market_adapter', 'state');
|
|
176
|
+
const layout = resolveBundledLayout('market_adapter', profilesDir, projectRoot, true);
|
|
177
|
+
const dataRoot = layout.root('DEXBOT_MARKET_ADAPTER_DATA_DIR', 'data');
|
|
178
|
+
const stateRoot = layout.root('DEXBOT_MARKET_ADAPTER_STATE_DIR', 'state');
|
|
169
179
|
return {
|
|
170
|
-
DIR: useSourceLayout ? sourceDir :
|
|
180
|
+
DIR: layout.useSourceLayout ? layout.sourceDir : layout.relocatedDir,
|
|
171
181
|
DATA_DIR: dataRoot,
|
|
172
182
|
LP_DATA_DIR: path.join(dataRoot, 'lp'),
|
|
173
183
|
FEED_DATA_DIR: path.join(dataRoot, 'feed'),
|
|
@@ -188,22 +198,16 @@ const MARKET_ADAPTER = resolveMarketAdapterDirs(PROFILES_DIR, PROJECT_ROOT);
|
|
|
188
198
|
* overrides the data root.
|
|
189
199
|
*/
|
|
190
200
|
function resolveClawDirs(profilesDir = PROFILES_DIR, projectRoot = PROJECT_ROOT) {
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
const clawEnv = getEnvLive('DEXBOT_CLAW_DATA_DIR');
|
|
194
|
-
const dataRoot = clawEnv
|
|
195
|
-
? path.resolve(clawEnv)
|
|
196
|
-
: useSourceLayout
|
|
197
|
-
? path.join(sourceDir, 'data')
|
|
198
|
-
: path.join(profilesDir, 'claw', 'data');
|
|
201
|
+
const layout = resolveBundledLayout('claw', profilesDir, projectRoot);
|
|
202
|
+
const dataRoot = layout.root('DEXBOT_CLAW_DATA_DIR', 'data');
|
|
199
203
|
return {
|
|
200
|
-
DIR: sourceDir,
|
|
204
|
+
DIR: layout.sourceDir,
|
|
201
205
|
DATA_DIR: dataRoot,
|
|
202
206
|
STATE_DIR: path.join(dataRoot, 'state'),
|
|
203
207
|
POSITIONS_FILE: path.join(dataRoot, 'positions.json'),
|
|
204
208
|
WATCHER_HEALTH_FILE: path.join(dataRoot, 'watcher-health.json'),
|
|
205
209
|
MEMU_DIR: path.join(dataRoot, 'memu'),
|
|
206
|
-
MEMU_RUNNER_SCRIPT: path.join(sourceDir, 'scripts', 'memu_runner.py'),
|
|
210
|
+
MEMU_RUNNER_SCRIPT: path.join(layout.sourceDir, 'scripts', 'memu_runner.py'),
|
|
207
211
|
};
|
|
208
212
|
}
|
|
209
213
|
const CLAW = resolveClawDirs(PROFILES_DIR, PROJECT_ROOT);
|
|
@@ -216,14 +220,8 @@ const CLAW = resolveClawDirs(PROFILES_DIR, PROJECT_ROOT);
|
|
|
216
220
|
* DEXBOT_ANALYSIS_DIR overrides the root.
|
|
217
221
|
*/
|
|
218
222
|
function resolveAnalysisDirs(profilesDir = PROFILES_DIR, projectRoot = PROJECT_ROOT) {
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
const analysisEnv = getEnvLive('DEXBOT_ANALYSIS_DIR');
|
|
222
|
-
const outRoot = analysisEnv
|
|
223
|
-
? path.resolve(analysisEnv)
|
|
224
|
-
: useSourceLayout
|
|
225
|
-
? sourceDir
|
|
226
|
-
: path.join(profilesDir, 'analysis');
|
|
223
|
+
const layout = resolveBundledLayout('analysis', profilesDir, projectRoot, true);
|
|
224
|
+
const outRoot = layout.root('DEXBOT_ANALYSIS_DIR');
|
|
227
225
|
return {
|
|
228
226
|
DIR: outRoot,
|
|
229
227
|
CHARTS_DIR: path.join(outRoot, 'charts'),
|
|
@@ -232,7 +230,7 @@ function resolveAnalysisDirs(profilesDir = PROFILES_DIR, projectRoot = PROJECT_R
|
|
|
232
230
|
CACHE_DIR: path.join(outRoot, 'cache'),
|
|
233
231
|
// Vendored read-only assets always live with the code (repo checkout
|
|
234
232
|
// or npm package), never under the relocated output root.
|
|
235
|
-
ASSETS_DIR: path.join(sourceDir, 'uplot'),
|
|
233
|
+
ASSETS_DIR: path.join(layout.sourceDir, 'uplot'),
|
|
236
234
|
};
|
|
237
235
|
}
|
|
238
236
|
const ANALYSIS = resolveAnalysisDirs(PROFILES_DIR, PROJECT_ROOT);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UnknownRecord } from './types.js';
|
|
2
2
|
import { GRID_LIMITS, FEE_PARAMETERS, INCREMENT_BOUNDS, TIMING, LOGGING_CONFIG, FILL_PROCESSING, PIPELINE_TIMING, API_LIMITS, COW_PERFORMANCE } from './constants.js';
|
|
3
|
-
|
|
3
|
+
interface BotRuntimeSettings {
|
|
4
4
|
gridLimits: typeof GRID_LIMITS;
|
|
5
5
|
feeParams: typeof FEE_PARAMETERS;
|
|
6
6
|
incrementBounds: typeof INCREMENT_BOUNDS;
|
|
@@ -14,16 +14,13 @@ export interface BotRuntimeSettings {
|
|
|
14
14
|
config: typeof LOGGING_CONFIG;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
export type BotRuntimeSettingsOverrides = Partial<BotRuntimeSettings> & {
|
|
18
|
-
poolSlippageTolerance?: number;
|
|
19
|
-
};
|
|
20
17
|
export declare const RUNTIME_SETTINGS_KEYS: readonly string[];
|
|
21
18
|
/**
|
|
22
19
|
* Bot-config keys safe to apply to a live bot without a grid rebuild or a
|
|
23
20
|
* process restart (Issue #27 follow-up). Single source of truth — consumed
|
|
24
21
|
* by the live bot-config check (dexbot_maintenance_runtime.ts) and the
|
|
25
22
|
* `dexbot bot` editor hint (account_bots.ts) so the two can never drift.
|
|
26
|
-
*
|
|
23
|
+
* coreOrders/edgeOrders are re-read via the targeted-reconcile path,
|
|
27
24
|
* botFunds via recalculateFunds, weightDistribution base via
|
|
28
25
|
* refreshDynamicWeightDistribution, min_BTS_value via the fee/acquisition
|
|
29
26
|
* reads, and debtPolicy via the credit runtime's live getter (next credit
|
|
@@ -32,4 +29,5 @@ export declare const RUNTIME_SETTINGS_KEYS: readonly string[];
|
|
|
32
29
|
*/
|
|
33
30
|
export declare const BOT_LIVE_CONFIG_KEYS: readonly string[];
|
|
34
31
|
export declare function resolveBotRuntimeSettings(botConfig: UnknownRecord): BotRuntimeSettings;
|
|
32
|
+
export {};
|
|
35
33
|
//# sourceMappingURL=runtime_settings.d.ts.map
|
|
@@ -28,7 +28,7 @@ export const RUNTIME_SETTINGS_KEYS = [
|
|
|
28
28
|
* process restart (Issue #27 follow-up). Single source of truth — consumed
|
|
29
29
|
* by the live bot-config check (dexbot_maintenance_runtime.ts) and the
|
|
30
30
|
* `dexbot bot` editor hint (account_bots.ts) so the two can never drift.
|
|
31
|
-
*
|
|
31
|
+
* coreOrders/edgeOrders are re-read via the targeted-reconcile path,
|
|
32
32
|
* botFunds via recalculateFunds, weightDistribution base via
|
|
33
33
|
* refreshDynamicWeightDistribution, min_BTS_value via the fee/acquisition
|
|
34
34
|
* reads, and debtPolicy via the credit runtime's live getter (next credit
|
|
@@ -36,8 +36,8 @@ export const RUNTIME_SETTINGS_KEYS = [
|
|
|
36
36
|
* (re)starts the credit watchdog, removal stops it).
|
|
37
37
|
*/
|
|
38
38
|
export const BOT_LIVE_CONFIG_KEYS = [
|
|
39
|
-
'
|
|
40
|
-
'
|
|
39
|
+
'coreOrders',
|
|
40
|
+
'edgeOrders',
|
|
41
41
|
'botFunds',
|
|
42
42
|
'weightDistribution',
|
|
43
43
|
'min_BTS_value',
|
|
@@ -38,7 +38,7 @@ declare function deepMerge(target: UnknownRecord, source: UnknownRecord): Unknow
|
|
|
38
38
|
* `selection` are typed because callers read/write those sub-fields directly;
|
|
39
39
|
* the index signature keeps unmapped passthrough keys reachable.
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
interface NodesHealthCheckView {
|
|
42
42
|
enabled?: boolean;
|
|
43
43
|
intervalMs?: number;
|
|
44
44
|
timeoutMs?: number;
|
|
@@ -46,7 +46,7 @@ export interface NodesHealthCheckView {
|
|
|
46
46
|
blacklistThreshold?: number;
|
|
47
47
|
[key: string]: unknown;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
interface NodesSelectionView {
|
|
50
50
|
strategy?: string;
|
|
51
51
|
preferredNode?: string | null;
|
|
52
52
|
[key: string]: unknown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type SocketJsonFailureKind = 'timeout' | 'connection' | 'closed' | 'invalid';
|
|
2
|
-
|
|
2
|
+
interface SocketJsonRequestOptions {
|
|
3
3
|
socketPath: string;
|
|
4
4
|
timeoutMs: number;
|
|
5
5
|
/** Write the request to the connected socket (one JSON line). */
|
|
@@ -13,4 +13,5 @@ export interface SocketJsonRequestOptions {
|
|
|
13
13
|
handleResponse: (parsed: unknown, resolve: (value: unknown) => void, reject: (err: unknown) => void) => void;
|
|
14
14
|
}
|
|
15
15
|
export declare function sendSocketJsonRequest(options: SocketJsonRequestOptions): Promise<unknown>;
|
|
16
|
+
export {};
|
|
16
17
|
//# sourceMappingURL=socket_json_client.d.ts.map
|
package/dist/modules/types.d.ts
CHANGED
|
@@ -8,15 +8,45 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type OrderType = 'sell' | 'buy' | 'spread';
|
|
10
10
|
export type OrderState = 'virtual' | 'active' | 'partial';
|
|
11
|
+
/**
|
|
12
|
+
* Why a spread correction placed no effective order. Carried from
|
|
13
|
+
* checkSpreadCondition to the maintenance loop so the funds/open-orders refresh
|
|
14
|
+
* is requested only when it can repair the cause, and so the log states the
|
|
15
|
+
* truth instead of always blaming free funds.
|
|
16
|
+
*
|
|
17
|
+
* no-free-funds — determineOrderSideByFunds found no fundable side.
|
|
18
|
+
* unfunded — candidates existed but free funds funded none.
|
|
19
|
+
* no-candidates — no spread-tightening slot exists in the LOCAL snapshot.
|
|
20
|
+
* This can be genuine structural geometry, or a stale
|
|
21
|
+
* local order state (a missed fill leaves an ACTIVE slot
|
|
22
|
+
* occupying the window edge, hiding the tightening slot
|
|
23
|
+
* behind it). Only a chain sync can tell the two apart,
|
|
24
|
+
* so it arms the refresh too; the out-of-spread staleness
|
|
25
|
+
* watchdog remains the backstop if the sync heals nothing.
|
|
26
|
+
* cold-book — no live order on either side (readiness P-A): there is
|
|
27
|
+
* no realized spread to repair. The reconcile path owns
|
|
28
|
+
* the first window; a targeted sync is armed.
|
|
29
|
+
* unmatched-orders — readiness P-C: the only tightening candidates collided
|
|
30
|
+
* with known-unmatched chain orders, so planning skipped
|
|
31
|
+
* them and let the sync adopt them first.
|
|
32
|
+
* readiness-gate — the readiness gate itself failed (threw), so the cycle
|
|
33
|
+
* was refused correct-by-refusal. A fault to triage, not
|
|
34
|
+
* a structural candidate condition.
|
|
35
|
+
* batch-not-executed— a plan was prepared but the COW batch did not run.
|
|
36
|
+
* apply-error — the broadcast threw.
|
|
37
|
+
*
|
|
38
|
+
* ('stale-snapshot' is degraded-ok, not a stall: the planner still acts, it
|
|
39
|
+
* only withholds the LAST-FILL-GUARD bypass.)
|
|
40
|
+
*/
|
|
41
|
+
export type SpreadCorrectionStall = 'no-free-funds' | 'unfunded' | 'no-candidates' | 'cold-book' | 'unmatched-orders' | 'readiness-gate' | 'batch-not-executed' | 'apply-error';
|
|
11
42
|
/**
|
|
12
43
|
* Dict with unknown values. The canonical replacement for
|
|
13
44
|
* `Record<string, any>`; callers must narrow a value before using it.
|
|
14
45
|
*/
|
|
15
46
|
export type UnknownRecord = Record<string, unknown>;
|
|
16
47
|
/** A value that survives JSON round-tripping. */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type JsonArray = JsonValue[];
|
|
48
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
49
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
20
50
|
export interface JsonObject {
|
|
21
51
|
[key: string]: JsonValue;
|
|
22
52
|
}
|
|
@@ -48,12 +78,12 @@ export interface Deferred<T> {
|
|
|
48
78
|
/** Runtime narrowing guard for `UnknownRecord` at I/O boundaries. */
|
|
49
79
|
export declare function isUnknownRecord(value: unknown): value is UnknownRecord;
|
|
50
80
|
/** Graphene `asset_amount` (e.g. `{ amount: 12345, asset_id: '1.3.0' }`). */
|
|
51
|
-
|
|
81
|
+
interface ChainAssetAmount {
|
|
52
82
|
amount: number | string;
|
|
53
83
|
asset_id: string;
|
|
54
84
|
}
|
|
55
85
|
/** Graphene `price` (sell_price.base / sell_price.quote). */
|
|
56
|
-
|
|
86
|
+
interface ChainPrice {
|
|
57
87
|
base: ChainAssetAmount;
|
|
58
88
|
quote: ChainAssetAmount;
|
|
59
89
|
}
|
|
@@ -205,6 +235,7 @@ export interface BotLike {
|
|
|
205
235
|
_blockchainFetchInFlight: number;
|
|
206
236
|
_blockchainFetchIntervalMin: number;
|
|
207
237
|
_spreadFundsExhausted: boolean;
|
|
238
|
+
_spreadCorrectionStall: SpreadCorrectionStall | null;
|
|
208
239
|
_skipEmptyReadConfirmDelay: boolean;
|
|
209
240
|
_testPollIntervalMs?: number;
|
|
210
241
|
_appliedBotConfigEntry: unknown;
|
|
@@ -301,7 +332,7 @@ export interface BotLike {
|
|
|
301
332
|
updateOrdersOnChainBatch(rebalanceResult: unknown): unknown;
|
|
302
333
|
updateOrdersOnChainPlan(...args: unknown[]): unknown;
|
|
303
334
|
}
|
|
304
|
-
|
|
335
|
+
interface OrderBase {
|
|
305
336
|
id: string;
|
|
306
337
|
price: number;
|
|
307
338
|
type: OrderType;
|
|
@@ -322,16 +353,16 @@ export interface OrderBase {
|
|
|
322
353
|
idealSize?: number;
|
|
323
354
|
sideHint?: string;
|
|
324
355
|
}
|
|
325
|
-
|
|
356
|
+
interface VirtualOrder extends OrderBase {
|
|
326
357
|
state: 'virtual';
|
|
327
358
|
orderId: null | '';
|
|
328
359
|
}
|
|
329
|
-
|
|
360
|
+
interface ActiveOrder extends OrderBase {
|
|
330
361
|
state: 'active';
|
|
331
362
|
orderId: string;
|
|
332
363
|
size: number;
|
|
333
364
|
}
|
|
334
|
-
|
|
365
|
+
interface PartialOrder extends OrderBase {
|
|
335
366
|
state: 'partial';
|
|
336
367
|
orderId: string;
|
|
337
368
|
size: number;
|
|
@@ -363,12 +394,12 @@ export interface AccountTotals {
|
|
|
363
394
|
[key: string]: unknown;
|
|
364
395
|
}
|
|
365
396
|
/** Per-side fund amounts. */
|
|
366
|
-
|
|
397
|
+
interface SideFunds {
|
|
367
398
|
buy: number;
|
|
368
399
|
sell: number;
|
|
369
400
|
}
|
|
370
401
|
/** Chain/grid split of a fund category. */
|
|
371
|
-
|
|
402
|
+
interface ChainGridFunds {
|
|
372
403
|
chain: SideFunds;
|
|
373
404
|
grid: SideFunds;
|
|
374
405
|
}
|
|
@@ -392,7 +423,7 @@ export interface ManagerFunds {
|
|
|
392
423
|
[key: string]: unknown;
|
|
393
424
|
}
|
|
394
425
|
/** `manager.persistGrid()` result — validation outcome plus skip flags. */
|
|
395
|
-
|
|
426
|
+
interface PersistGridResult extends UnknownRecord {
|
|
396
427
|
isValid: boolean;
|
|
397
428
|
skipped?: boolean;
|
|
398
429
|
suspended?: boolean;
|
|
@@ -451,15 +482,8 @@ export interface FillBatchResult extends UnknownRecord {
|
|
|
451
482
|
aborted?: boolean;
|
|
452
483
|
deferred?: boolean;
|
|
453
484
|
}
|
|
454
|
-
/** Result of `_cancelDustOrders`. */
|
|
455
|
-
export interface DustCancelResult extends UnknownRecord {
|
|
456
|
-
batchResult?: {
|
|
457
|
-
aborted?: boolean;
|
|
458
|
-
[key: string]: unknown;
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
485
|
/** Result of `manager.checkGridHealth()`. */
|
|
462
|
-
|
|
486
|
+
interface GridHealthResult extends UnknownRecord {
|
|
463
487
|
buyDustOrders?: unknown[];
|
|
464
488
|
sellDustOrders?: unknown[];
|
|
465
489
|
}
|
|
@@ -472,6 +496,16 @@ export interface BotMetrics extends UnknownRecord {
|
|
|
472
496
|
maxQueueDepth: number;
|
|
473
497
|
gridLockContention: number;
|
|
474
498
|
fundRecalcCount: number;
|
|
499
|
+
/** Genuine post-broadcast commit refusals (working grid rejected). Excludes a poll-confirmed success that merely reuses the recovery funnel for adoption. */
|
|
500
|
+
refusedCommitCount: number;
|
|
501
|
+
/** Orphan fills whose proceeds were credited outside slot accounting. */
|
|
502
|
+
orphanFillCreditedCount: number;
|
|
503
|
+
/** BUY emissions at/above the last filled BUY pivot (guard bypass / leak). */
|
|
504
|
+
restampBuyAboveAnchorCount: number;
|
|
505
|
+
/** Derived boundary moved more than the active window in one plan. */
|
|
506
|
+
boundaryDriftExceedsWindowCount: number;
|
|
507
|
+
/** Non-spread-correction CREATE/UPDATE destinations inside the gap band (shadow). */
|
|
508
|
+
gapBandPlacementShadowCount: number;
|
|
475
509
|
}
|
|
476
510
|
/** An unmatched chain order surfaced by a sync pass. */
|
|
477
511
|
export interface UnmatchedChainOrder extends UnknownRecord {
|
|
@@ -499,7 +533,7 @@ export interface IncomingFill extends UnknownRecord {
|
|
|
499
533
|
id?: string;
|
|
500
534
|
}
|
|
501
535
|
/** Aggregate chain-funds summary produced by `computeChainFundTotals`. */
|
|
502
|
-
|
|
536
|
+
interface ChainFundsTotals {
|
|
503
537
|
chainFreeBuy: number;
|
|
504
538
|
chainFreeSell: number;
|
|
505
539
|
committedChainBuy: number;
|
|
@@ -550,8 +584,8 @@ export interface ManagedOrder {
|
|
|
550
584
|
sideHint?: string;
|
|
551
585
|
[key: string]: unknown;
|
|
552
586
|
}
|
|
553
|
-
/**
|
|
554
|
-
export interface
|
|
587
|
+
/** Market-order target counts (core-order window). */
|
|
588
|
+
export interface CoreOrdersConfig extends UnknownRecord {
|
|
555
589
|
buy?: number;
|
|
556
590
|
sell?: number;
|
|
557
591
|
}
|
|
@@ -586,7 +620,7 @@ export interface GridConfig extends UnknownRecord {
|
|
|
586
620
|
[key: string]: unknown;
|
|
587
621
|
};
|
|
588
622
|
targetSpreadPercent?: number;
|
|
589
|
-
|
|
623
|
+
coreOrders?: CoreOrdersConfig;
|
|
590
624
|
assetA?: string;
|
|
591
625
|
assetB?: string;
|
|
592
626
|
botKey?: string;
|
|
@@ -630,16 +664,26 @@ export interface GridFeeParams extends UnknownRecord {
|
|
|
630
664
|
POOL_SLIPPAGE_TOLERANCE?: number;
|
|
631
665
|
}
|
|
632
666
|
/** `config.timing` knobs. */
|
|
633
|
-
|
|
667
|
+
interface TimingConfig extends UnknownRecord {
|
|
634
668
|
SAFETY_NET_SYNC_TIMEOUT_MS?: number;
|
|
635
669
|
CREDIT_DEAL_EXPIRY_THRESHOLD_HOURS?: number;
|
|
636
670
|
CREDIT_REBORROW_MAX_ATTEMPTS?: number;
|
|
637
671
|
BLOCKCHAIN_FETCH_INTERVAL_MIN?: number;
|
|
638
672
|
BOTS_CONFIG_POLL_INTERVAL_MS?: number;
|
|
639
673
|
BTS_ACQUIRE_COOLDOWN_MIN?: number;
|
|
674
|
+
/**
|
|
675
|
+
* Spread-correction trust window (ms). How old the last completed
|
|
676
|
+
* open-orders sync may be before the local snapshot is treated as stale
|
|
677
|
+
* (the planner still acts but loses the LAST-FILL-GUARD bypass), and how
|
|
678
|
+
* often the live market price is re-read for the crossing floor. Defaults to
|
|
679
|
+
* `TIMING.SPREAD_CORRECTION_SYNC_FRESH_MS` (10 min); a non-positive value
|
|
680
|
+
* disables the time bound entirely (snapshot is never stale and the live
|
|
681
|
+
* price is never force-refreshed, so the floor stays on the fill anchor).
|
|
682
|
+
*/
|
|
683
|
+
SPREAD_CORRECTION_SYNC_FRESH_MS?: number;
|
|
640
684
|
}
|
|
641
685
|
/** `config.fillProcessing` knobs read by the fill consumer. */
|
|
642
|
-
|
|
686
|
+
interface FillProcessingConfig extends UnknownRecord {
|
|
643
687
|
CONSUMER_BACKOFF_INITIAL_MS?: number;
|
|
644
688
|
CONSUMER_BACKOFF_MAX_MS?: number;
|
|
645
689
|
MAX_CONSECUTIVE_CONSUMER_FAILURES?: number;
|
|
@@ -657,16 +701,16 @@ export interface ManagerLock {
|
|
|
657
701
|
heldForMs(): number;
|
|
658
702
|
}
|
|
659
703
|
/** `refreshAccountTotalsIfStale()` freshness gate. */
|
|
660
|
-
|
|
704
|
+
interface AccountTotalsGate {
|
|
661
705
|
ok: boolean;
|
|
662
706
|
[key: string]: unknown;
|
|
663
707
|
}
|
|
664
708
|
/** Accountant surface the sync engine calls directly. */
|
|
665
709
|
/** Result of `accountant.processFillAccounting()`. */
|
|
666
|
-
|
|
710
|
+
interface FillAccountingResult extends UnknownRecord {
|
|
667
711
|
status: string;
|
|
668
712
|
}
|
|
669
|
-
|
|
713
|
+
interface AccountantLike {
|
|
670
714
|
processFillAccounting(fillOp: unknown, fillKey: string, options?: UnknownRecord): Promise<boolean>;
|
|
671
715
|
adjustTotalBalance(orderType: string, delta: number, operation: string): Promise<unknown>;
|
|
672
716
|
addToChainFree(orderType: string, size: number, operation: string): Promise<unknown>;
|
|
@@ -809,6 +853,7 @@ export interface AccountOrdersLike {
|
|
|
809
853
|
loadGenesis(forceReload?: boolean): unknown;
|
|
810
854
|
loadGapEvacStreaks(forceReload?: boolean): unknown;
|
|
811
855
|
loadLastFillPivot?(forceReload?: boolean): unknown;
|
|
856
|
+
loadLastMarketFill?(forceReload?: boolean): unknown;
|
|
812
857
|
loadPendingFillCrawls(forceReload?: boolean): unknown[];
|
|
813
858
|
loadRecentFillKeys(forceReload?: boolean): unknown;
|
|
814
859
|
loadPersistedAssets(forceReload?: boolean): {
|
|
@@ -820,6 +865,8 @@ export interface AccountOrdersLike {
|
|
|
820
865
|
clearGrid(): Promise<unknown>;
|
|
821
866
|
clearPersistedBoundary(...args: unknown[]): Promise<unknown>;
|
|
822
867
|
clearPersistedLastFillPivot(...args: unknown[]): Promise<unknown>;
|
|
868
|
+
clearPersistedLastMarketFill?(...args: unknown[]): Promise<unknown>;
|
|
869
|
+
backupSnapshot?(reason?: string): Promise<string | null>;
|
|
823
870
|
loadProcessedFills(options?: boolean | {
|
|
824
871
|
forceReload?: boolean;
|
|
825
872
|
minTimestamp?: number | null;
|
|
@@ -865,7 +912,7 @@ export interface ManagerLogger {
|
|
|
865
912
|
flush?(): Promise<void>;
|
|
866
913
|
}
|
|
867
914
|
/** Mutable recovery-state record (all fields optional to allow partial writes). */
|
|
868
|
-
|
|
915
|
+
interface ManagerRecoveryState {
|
|
869
916
|
phase?: string;
|
|
870
917
|
attemptCount?: number;
|
|
871
918
|
lastAttemptAt?: number;
|
|
@@ -987,6 +1034,8 @@ export interface OrderManagerLike {
|
|
|
987
1034
|
createdAt?: number;
|
|
988
1035
|
} | null;
|
|
989
1036
|
_missingGenesis?: unknown;
|
|
1037
|
+
_metrics?: BotMetrics;
|
|
1038
|
+
_lastBoundaryDriftWarnAt?: number;
|
|
990
1039
|
_genesisInvariantViolations?: number;
|
|
991
1040
|
_genesisInvariantLoggedAt?: number;
|
|
992
1041
|
_fundDriftLedger?: {
|
|
@@ -1002,6 +1051,13 @@ export interface OrderManagerLike {
|
|
|
1002
1051
|
_lastFilledType: string | null;
|
|
1003
1052
|
_lastFilledAt: number | null;
|
|
1004
1053
|
lastFillPivotSource: 'fill' | 'book' | null;
|
|
1054
|
+
_lastMarketFillPrice?: number | null;
|
|
1055
|
+
_lastMarketFillType?: string | null;
|
|
1056
|
+
_lastMarketFillAt?: number | null;
|
|
1057
|
+
_liveMarketPrice?: number | null;
|
|
1058
|
+
_liveMarketPriceAt?: number | null;
|
|
1059
|
+
_liveMarketPriceAttemptedAt?: number | null;
|
|
1060
|
+
_lastSyncAt?: number;
|
|
1005
1061
|
_lastUnmatchedChainOrders?: UnmatchedChainOrder[];
|
|
1006
1062
|
_lastUnmatchedChainOrdersAt?: number;
|
|
1007
1063
|
_lastAccountingFailure?: unknown;
|
|
@@ -1085,6 +1141,8 @@ export interface OrderManagerLike {
|
|
|
1085
1141
|
syncFromFillHistoryBatch(fills: unknown, options?: UnknownRecord): Promise<FillHistorySyncResult>;
|
|
1086
1142
|
checkSpreadCondition(...args: unknown[]): Promise<{
|
|
1087
1143
|
ordersPlaced?: number;
|
|
1144
|
+
partialsMoved?: number;
|
|
1145
|
+
stall?: SpreadCorrectionStall;
|
|
1088
1146
|
[key: string]: unknown;
|
|
1089
1147
|
}>;
|
|
1090
1148
|
_fetchAccountBalancesAndSetTotals(...args: unknown[]): Promise<unknown>;
|
|
@@ -1108,4 +1166,5 @@ export interface OrderManagerLike {
|
|
|
1108
1166
|
}): Promise<PersistGridResult>;
|
|
1109
1167
|
calculateCurrentSpread(): number;
|
|
1110
1168
|
}
|
|
1169
|
+
export {};
|
|
1111
1170
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -42,9 +42,7 @@ export function getErrorName(err) {
|
|
|
42
42
|
* interval, credit-deal settle delay, deferred-fill retry backoff).
|
|
43
43
|
*/
|
|
44
44
|
export function resolveSeamMs(value, fallback) {
|
|
45
|
-
return
|
|
46
|
-
? Number(value)
|
|
47
|
-
: fallback;
|
|
45
|
+
return resolveSeamMsOrNull(value) ?? fallback;
|
|
48
46
|
}
|
|
49
47
|
/**
|
|
50
48
|
* Like {@link resolveSeamMs}, but returns `null` instead of a fallback so the
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
* dir (never in the package dir — npm reinstalls wipe that).
|
|
64
64
|
*/
|
|
65
65
|
/** How the running copy was installed — selects the hint text. */
|
|
66
|
-
|
|
66
|
+
type InstallKind = 'npm-global' | 'git' | 'other';
|
|
67
67
|
/**
|
|
68
68
|
* The pending one-time announcement: what the operator is told when a newer
|
|
69
69
|
* release exists and has not been displayed yet. It carries DATA only — the
|
|
70
70
|
* wording and colour are rendered by `printVersionStatus`, so there is exactly
|
|
71
71
|
* one place that decides how a version verdict looks.
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
interface VersionNotice {
|
|
74
74
|
currentVersion: string;
|
|
75
75
|
latestVersion: string;
|
|
76
76
|
installKind: InstallKind;
|
|
@@ -79,8 +79,8 @@ export interface VersionNotice {
|
|
|
79
79
|
cacheFile: string;
|
|
80
80
|
}
|
|
81
81
|
/** Green when current, orange when a newer release exists, gray when unknown. */
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
type VersionState = 'up-to-date' | 'update-available' | 'unknown';
|
|
83
|
+
interface VersionStatus {
|
|
84
84
|
/** Installed version — `Config.VERSION` unless overridden. */
|
|
85
85
|
currentVersion: string;
|
|
86
86
|
/** Latest version observed this run, or from the throttle cache. Null when
|
|
@@ -106,7 +106,7 @@ export interface VersionStatus {
|
|
|
106
106
|
* that latches it. */
|
|
107
107
|
notice: VersionNotice | null;
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
interface VersionNoticeOptions {
|
|
110
110
|
/** Override the installed version (defaults to `Config.VERSION`). */
|
|
111
111
|
currentVersion?: string;
|
|
112
112
|
/** Override the cache location (tests). */
|
|
@@ -149,18 +149,18 @@ export declare function compareVersions(a: string, b: string): number;
|
|
|
149
149
|
/** Classify the running install without spawning anything. */
|
|
150
150
|
export declare function detectInstallKind(projectRoot?: string): InstallKind;
|
|
151
151
|
/** Minimal structural view of a fetch response used by the probe. */
|
|
152
|
-
|
|
152
|
+
interface FetchResponseLike {
|
|
153
153
|
ok?: boolean;
|
|
154
154
|
status?: number;
|
|
155
155
|
json(): Promise<unknown>;
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
type FetchImpl = (url: string, init: {
|
|
158
158
|
method?: string;
|
|
159
159
|
headers?: Record<string, string>;
|
|
160
160
|
signal?: AbortSignal;
|
|
161
161
|
}) => Promise<FetchResponseLike | null | undefined>;
|
|
162
162
|
/** One place the published version can be read from. */
|
|
163
|
-
|
|
163
|
+
interface VersionSource {
|
|
164
164
|
id: string;
|
|
165
165
|
url: string;
|
|
166
166
|
/** Pull the version out of the source's JSON shape. Returns null when the
|
|
@@ -296,7 +296,7 @@ export declare function flushVersionStatusOrHeader(pending: Promise<VersionStatu
|
|
|
296
296
|
* same contract as `flushVersionStatusOrHeader`.
|
|
297
297
|
*/
|
|
298
298
|
export declare function printVersionStatusWhenReady(pending: Promise<VersionStatus | null>): void;
|
|
299
|
-
|
|
299
|
+
interface StagedVersionNoticeOptions extends VersionNoticeOptions {
|
|
300
300
|
/** Wait at the top of the command before the caller prints anything else.
|
|
301
301
|
* Default `UPDATER.NOTICE_STAGE_GRACE_MS` (1s). */
|
|
302
302
|
graceMs?: number;
|
|
@@ -304,7 +304,7 @@ export interface StagedVersionNoticeOptions extends VersionNoticeOptions {
|
|
|
304
304
|
* `UPDATER.NOTICE_STATUS_TIMEOUT_MS`. */
|
|
305
305
|
finalMs?: number;
|
|
306
306
|
}
|
|
307
|
-
|
|
307
|
+
interface StagedVersionWait {
|
|
308
308
|
/** The status if it lands within `graceMs`, else null. Await this at the
|
|
309
309
|
* top of a report; the value is only interesting for its TIMING. */
|
|
310
310
|
quick: Promise<VersionStatus | null>;
|
|
@@ -319,4 +319,5 @@ export interface StagedVersionWait {
|
|
|
319
319
|
* carries the whole escalation.
|
|
320
320
|
*/
|
|
321
321
|
export declare function startStagedVersionStatus(options?: StagedVersionNoticeOptions): StagedVersionWait;
|
|
322
|
+
export {};
|
|
322
323
|
//# sourceMappingURL=version_notice.d.ts.map
|
package/dist/pm2.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ declare function generateEcosystemConfig({ botNameFilter, clawOnly, exitOnError
|
|
|
46
46
|
}): Pm2App[];
|
|
47
47
|
declare function ensureCredentialDaemonPM2({ forceRefresh, headless, passwordFile }?: {
|
|
48
48
|
forceRefresh?: boolean;
|
|
49
|
-
logReuse?: boolean;
|
|
50
49
|
headless?: boolean;
|
|
51
50
|
passwordFile?: string | null;
|
|
52
51
|
}): Promise<boolean>;
|