dexbot 1.7.0 → 1.7.1
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 +42 -0
- package/README.md +3 -3
- package/analysis/README.md +33 -13
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/dist/analysis/account_resolver.js +5 -6
- package/dist/analysis/analyze_liquidity.js +15 -4
- package/dist/analysis/bot_key_utils.d.ts +44 -1
- package/dist/analysis/bot_key_utils.js +76 -7
- package/dist/analysis/fills_cache.js +2 -1
- package/dist/analysis/grid_correction_check.d.ts +1 -19
- package/dist/analysis/grid_correction_check.js +12 -30
- package/dist/analysis/liquidity/liquidity_chart_generator.js +190 -20
- package/dist/analysis/liquidity/liquidity_depth_model.d.ts +41 -16
- package/dist/analysis/liquidity/liquidity_depth_model.js +49 -21
- package/dist/analysis/liquidity/liquidity_view.d.ts +15 -0
- package/dist/analysis/liquidity/liquidity_view.js +11 -0
- package/dist/analysis/resolve_bot_accounts.js +7 -6
- package/dist/analysis/trade_profitability.js +2 -1
- package/dist/credential-daemon.js +13 -2
- package/dist/dexbot.js +4 -4
- package/dist/modules/account_bots.d.ts +11 -1
- package/dist/modules/account_orders.d.ts +12 -0
- package/dist/modules/account_orders.js +30 -0
- package/dist/modules/bitshares-native/transport.js +24 -6
- package/dist/modules/bitshares_client.d.ts +24 -6
- package/dist/modules/bitshares_client.js +44 -7
- package/dist/modules/bot_settings.d.ts +2 -0
- package/dist/modules/constants.d.ts +26 -3
- package/dist/modules/constants.js +63 -8
- package/dist/modules/dexbot_class.d.ts +1 -6
- package/dist/modules/dexbot_class.js +14 -0
- package/dist/modules/dexbot_cow_runtime.d.ts +97 -7
- package/dist/modules/dexbot_cow_runtime.js +620 -132
- package/dist/modules/dexbot_fill_runtime.js +124 -35
- package/dist/modules/dexbot_maintenance_runtime.js +226 -73
- package/dist/modules/dexbot_startup_runtime.js +32 -20
- package/dist/modules/dexbot_state_recovery.d.ts +33 -1
- package/dist/modules/dexbot_state_recovery.js +167 -5
- package/dist/modules/node_connect_policy.d.ts +8 -1
- package/dist/modules/node_connect_policy.js +18 -2
- package/dist/modules/node_flap_score.d.ts +87 -0
- package/dist/modules/node_flap_score.js +124 -0
- package/dist/modules/node_health_cache.d.ts +40 -3
- package/dist/modules/node_health_cache.js +66 -20
- package/dist/modules/node_manager.d.ts +101 -19
- package/dist/modules/node_manager.js +255 -65
- package/dist/modules/order/accounting.js +56 -7
- package/dist/modules/order/format.d.ts +24 -10
- package/dist/modules/order/format.js +30 -10
- package/dist/modules/order/grid.js +82 -11
- package/dist/modules/order/grid_reconcile.d.ts +5 -1
- package/dist/modules/order/grid_reconcile.js +333 -210
- package/dist/modules/order/grid_reconcile_internal.d.ts +38 -2
- package/dist/modules/order/grid_reconcile_internal.js +207 -87
- package/dist/modules/order/index.d.ts +4 -0
- package/dist/modules/order/lifecycle.d.ts +353 -0
- package/dist/modules/order/lifecycle.js +1109 -0
- package/dist/modules/order/manager.d.ts +271 -5
- package/dist/modules/order/manager.js +651 -48
- package/dist/modules/order/placement_lock.d.ts +102 -0
- package/dist/modules/order/placement_lock.js +222 -0
- package/dist/modules/order/strategy.js +13 -1
- package/dist/modules/order/sync_engine.d.ts +13 -1
- package/dist/modules/order/sync_engine.js +153 -53
- package/dist/modules/order/utils/math.d.ts +22 -1
- package/dist/modules/order/utils/math.js +54 -1
- package/dist/modules/order/utils/order.d.ts +75 -5
- package/dist/modules/order/utils/order.js +158 -9
- package/dist/modules/order/utils/system.d.ts +18 -0
- package/dist/modules/order/utils/system.js +84 -8
- package/dist/modules/order/utils/validate.d.ts +7 -1
- package/dist/modules/order/utils/validate.js +48 -2
- package/dist/modules/outcome.d.ts +54 -0
- package/dist/modules/outcome.js +51 -0
- package/dist/modules/settings_merge.d.ts +4 -0
- package/dist/modules/settings_merge.js +9 -0
- package/dist/modules/timing_policy.d.ts +82 -0
- package/dist/modules/timing_policy.js +244 -0
- package/dist/modules/types.d.ts +132 -0
- package/dist/scripts/analyze-credit.js +54 -17
- package/dist/scripts/analyze-orders.d.ts +4 -2
- package/dist/scripts/analyze-orders.js +113 -34
- package/dist/scripts/chart_targets.js +11 -15
- package/dist/scripts/test-credit-renewal.js +12 -5
- package/docs/COW_INVARIANTS.md +67 -8
- package/docs/DEXBOT_COMPARISON.md +6 -6
- package/docs/EVOLUTION.md +9 -8
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/GRID_PRICE_INVARIANT.md +1 -1
- package/docs/GRID_RECONCILE.md +17 -12
- package/docs/LOGGING.md +25 -1
- package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +175 -26
- package/docs/README.md +23 -2
- package/docs/WORKFLOW.md +9 -3
- package/docs/architecture.md +42 -5
- package/docs/developer_guide.md +25 -8
- package/modules/README.md +3 -0
- package/package.json +1 -1
- package/scripts/README.md +16 -0
- package/scripts/pdev.sh +14 -1
- package/scripts/pmain.sh +23 -8
- package/scripts/ptest.sh +7 -0
- package/tests/README.md +30 -1
|
@@ -86,8 +86,11 @@
|
|
|
86
86
|
* DEFAULT_NODES: List of BitShares nodes for redundancy
|
|
87
87
|
* HEALTH_CHECK_INTERVAL_MS, HEALTH_CHECK_TIMEOUT_MS, MAX_PING_MS
|
|
88
88
|
* BLACKLIST_THRESHOLD: Failures before node is blacklisted
|
|
89
|
+
* FAILURE_STRIKE_DECAY_MS: How long a live-transport strike lasts
|
|
90
|
+
* FLAP_WINDOW_MS / FLAP_HALF_LIFE_MS / FLAP_PENALTY_MS_PER_DROP /
|
|
91
|
+
* FLAP_PENALTY_MAX_MS: time-decayed connection-churn penalty
|
|
89
92
|
* EXPECTED_CHAIN_ID: BitShares mainnet chain ID validation
|
|
90
|
-
* SELECTION_STRATEGY: Node selection algorithm (latency
|
|
93
|
+
* SELECTION_STRATEGY: Node selection algorithm (latency + churn penalty)
|
|
91
94
|
*
|
|
92
95
|
* 13. UPDATER - Version checking and update notification
|
|
93
96
|
* ACTIVE, REPOSITORY_URL, BRANCH, SCHEDULE
|
|
@@ -139,6 +142,7 @@ import { BUILD_DIR } from './utils/build_dir.js';
|
|
|
139
142
|
import { readGeneralSettings } from './general_settings.js';
|
|
140
143
|
import { mergeSettings, buildNodesView } from './settings_merge.js';
|
|
141
144
|
import { getErrorMessage } from './utils/errors.js';
|
|
145
|
+
import { DEFAULT_FLAP_HALF_LIFE_MS, DEFAULT_FLAP_PENALTY_MAX_MS, DEFAULT_FLAP_PENALTY_MS_PER_DROP, DEFAULT_FLAP_WINDOW_MS, } from './node_flap_score.js';
|
|
142
146
|
const ORDER_TYPES = Object.freeze({
|
|
143
147
|
SELL: 'sell',
|
|
144
148
|
BUY: 'buy',
|
|
@@ -300,6 +304,42 @@ let TIMING = {
|
|
|
300
304
|
// bound (FILL_BROADCAST_DEFER_MAX_MS, derived below) are expressed in
|
|
301
305
|
// terms of it, so they cannot be tuned out of agreement.
|
|
302
306
|
BROADCAST_STALE_CLEAR_MS: 120000, // 120 seconds
|
|
307
|
+
// PENDING_BROADCAST_TTL_MS: a CREATE recorded as pending (uncertain
|
|
308
|
+
// broadcast) protects its slot/price from a duplicate CREATE. The entry is
|
|
309
|
+
// normally cleared when the batch resolves; if that resolution is lost
|
|
310
|
+
// (crash, hung poll) a stale entry must not block creates forever. After
|
|
311
|
+
// this TTL it is dropped and the next caught-up read re-verifies the level
|
|
312
|
+
// against the chain instead.
|
|
313
|
+
PENDING_BROADCAST_TTL_MS: 30 * 60 * 1000, // 30 minutes
|
|
314
|
+
// BATCH_INFLIGHT_STALE_MS / RECOVERY_INFLIGHT_STALE_MS: leak watchdogs for
|
|
315
|
+
// the bot-level pipeline counters. A parked fill queue for minutes with no
|
|
316
|
+
// progress (2026-11-03: _batchInFlight stuck ~2.5 min, queue depth 10) must
|
|
317
|
+
// be surfaced and, when nothing actually holds placement, cleared so the
|
|
318
|
+
// pipeline can recover. Generous: a legitimate create-group reconcile can
|
|
319
|
+
// take minutes. Never force-clear while placement is still held (a live
|
|
320
|
+
// batch owns it).
|
|
321
|
+
BATCH_INFLIGHT_STALE_MS: 10 * 60 * 1000,
|
|
322
|
+
RECOVERY_INFLIGHT_STALE_MS: 10 * 60 * 1000,
|
|
323
|
+
// PLACEMENT_STALE_CLEAR_MS: a placement lease (COW / reconcile / drain)
|
|
324
|
+
// has no natural deadline — a hung chain call or a missed release can hold
|
|
325
|
+
// the exclusive region forever. Fills and rebalances defer while it is
|
|
326
|
+
// held, so the watchdog force-releases a region held far longer than any
|
|
327
|
+
// legitimate path. Sized above the longest observed reconcile (~8 min) and
|
|
328
|
+
// the COW batch ceiling; unlike the broadcast refcount there is no
|
|
329
|
+
// "re-arm on progress" signal, so err generous.
|
|
330
|
+
PLACEMENT_STALE_CLEAR_MS: 15 * 60 * 1000,
|
|
331
|
+
// CHAIN_SIZE_APPLIED_MARKER_TTL_MS: a sync-pass-1 "size already applied"
|
|
332
|
+
// marker is only meaningful until the matching fill history arrives. Stale
|
|
333
|
+
// markers are ignored/dropped so they cannot suppress an unrelated later
|
|
334
|
+
// fill of the same order.
|
|
335
|
+
CHAIN_SIZE_APPLIED_MARKER_TTL_MS: 5 * 60 * 1000,
|
|
336
|
+
// STRUCTURAL_REBUILD_DEFER_MAX_MS: fill-driven rebalances defer while a
|
|
337
|
+
// structural rebuild runs. A hung rebuild (e.g. a 10-minute reconcile) must
|
|
338
|
+
// not defer them silently for its whole duration: after this bound, log at
|
|
339
|
+
// warn every tick so the stall is visible to operators. The deferral
|
|
340
|
+
// itself is kept (correctness beats availability: planning mid-rebuild is
|
|
341
|
+
// exactly the duplicate class), but it is no longer silent.
|
|
342
|
+
STRUCTURAL_REBUILD_DEFER_MAX_MS: 3 * 60 * 1000,
|
|
303
343
|
// BROADCAST_DEFER_SAFETY_MARGIN_MS: headroom added to
|
|
304
344
|
// BROADCAST_STALE_CLEAR_MS when deriving FILL_BROADCAST_DEFER_MAX_MS, so a
|
|
305
345
|
// region that is still considered live by the stale-clear watchdog cannot
|
|
@@ -1010,15 +1050,30 @@ let NODE_MANAGEMENT = {
|
|
|
1010
1050
|
BLACKLIST_THRESHOLD: 3, // Failures before blacklist
|
|
1011
1051
|
BLACKLIST_COOLDOWN_MS: 24 * 60 * 60 * 1000, // 24 hours before retrying blacklisted nodes
|
|
1012
1052
|
FAILURE_REPORT_COOLDOWN_MS: 1000, // Min ms between failure count increments (prevents rapid-fire blacklisting)
|
|
1013
|
-
//
|
|
1014
|
-
//
|
|
1015
|
-
//
|
|
1016
|
-
//
|
|
1017
|
-
|
|
1053
|
+
// Strike decay: a live-transport failure counts as a strike, and strikes
|
|
1054
|
+
// fade out over this window instead of being erased by a successful health
|
|
1055
|
+
// probe. With a 4h probe interval and a once-a-day flapper, the old
|
|
1056
|
+
// success-streak reset wiped every strike before it could reach
|
|
1057
|
+
// BLACKLIST_THRESHOLD (every failure logged "attempt 1/3"), so a node that
|
|
1058
|
+
// drops its socket daily was selected forever. A strike is fully forgiven
|
|
1059
|
+
// only after this long without a new failure.
|
|
1060
|
+
FAILURE_STRIKE_DECAY_MS: 24 * 60 * 60 * 1000, // 24 hours
|
|
1061
|
+
// Flapping (connection-churn) scoring used by node selection: a node ranks
|
|
1062
|
+
// on `latency + penalty`, where the penalty is the time-decayed weight of
|
|
1063
|
+
// its recent transport drops. Zero recent drops means ping alone decides.
|
|
1064
|
+
// Values come from modules/node_flap_score.ts so the ranking maths and the
|
|
1065
|
+
// defaults here can never drift apart.
|
|
1066
|
+
FLAP_WINDOW_MS: DEFAULT_FLAP_WINDOW_MS, // only the trailing day counts
|
|
1067
|
+
FLAP_HALF_LIFE_MS: DEFAULT_FLAP_HALF_LIFE_MS, // a drop's weight halves every 12h
|
|
1068
|
+
FLAP_PENALTY_MS_PER_DROP: DEFAULT_FLAP_PENALTY_MS_PER_DROP, // +5s effective latency per fresh drop
|
|
1069
|
+
FLAP_PENALTY_MAX_MS: DEFAULT_FLAP_PENALTY_MAX_MS, // cap so a degraded node stays a last resort
|
|
1018
1070
|
// Expected chain ID (BitShares mainnet)
|
|
1019
1071
|
EXPECTED_CHAIN_ID: '4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8',
|
|
1020
|
-
// Selection strategy
|
|
1021
|
-
|
|
1072
|
+
// Selection strategy. 'latency' means latency + the time-decayed flap
|
|
1073
|
+
// penalty (see FLAP_* above): the fastest node wins only while it is also
|
|
1074
|
+
// stable, which is what stops a cheap Cloudflare endpoint that drops every
|
|
1075
|
+
// few hours from outranking a slightly slower endpoint that never drops.
|
|
1076
|
+
SELECTION_STRATEGY: 'latency'
|
|
1022
1077
|
};
|
|
1023
1078
|
// Pipeline timeout configuration
|
|
1024
1079
|
let PIPELINE_TIMING = {
|
|
@@ -728,12 +728,7 @@ declare class DEXBot implements BotLike {
|
|
|
728
728
|
* @param {Array<Object>} opContexts - Original opContexts from the failed batch
|
|
729
729
|
* @returns {Promise<Object>} Result object compatible with batch return shape
|
|
730
730
|
*/
|
|
731
|
-
_reconcileAfterUncertainBroadcast(err: unknown, opContexts: OpPhase[], options?: UnknownRecord): Promise<UnknownRecord
|
|
732
|
-
executed: boolean;
|
|
733
|
-
hadRotation: boolean;
|
|
734
|
-
uncertain: boolean;
|
|
735
|
-
ambiguousRead: boolean;
|
|
736
|
-
}>;
|
|
731
|
+
_reconcileAfterUncertainBroadcast(err: unknown, opContexts: OpPhase[], options?: UnknownRecord): Promise<UnknownRecord>;
|
|
737
732
|
/**
|
|
738
733
|
* Execute operations with retry on BroadcastUncertainError.
|
|
739
734
|
* The daemon already retries internally against a 25s deadline. If it
|
|
@@ -1115,6 +1115,14 @@ class DEXBot {
|
|
|
1115
1115
|
if (typeof this.manager?.pauseFundRecalc === 'function') {
|
|
1116
1116
|
this.manager.pauseFundRecalc();
|
|
1117
1117
|
}
|
|
1118
|
+
// One absolute boundary re-anchor per drained fill batch: each fill
|
|
1119
|
+
// event re-anchoring + a fresh COW plan amplified churn (6 re-anchors
|
|
1120
|
+
// in ~1 min). The crawl still runs per chunk; the absolute anchor is
|
|
1121
|
+
// the expensive geometry jump. A BUDGET (not a boolean) is nest-safe:
|
|
1122
|
+
// a nested/overlapping fill cycle restores the outer budget instead of
|
|
1123
|
+
// silently re-enabling multiple anchors.
|
|
1124
|
+
const prevReanchorBudget = this.manager._boundaryReanchorBudget;
|
|
1125
|
+
this.manager._boundaryReanchorBudget = 1;
|
|
1118
1126
|
let anyDeferred = false;
|
|
1119
1127
|
try {
|
|
1120
1128
|
const activeSell = this.manager?.config?.coreOrders?.sell ?? 1;
|
|
@@ -1183,6 +1191,12 @@ class DEXBot {
|
|
|
1183
1191
|
if (this.manager) {
|
|
1184
1192
|
delete this.manager._boundaryShiftBudget;
|
|
1185
1193
|
delete this.manager._boundaryShiftBudgetBase;
|
|
1194
|
+
if (prevReanchorBudget === undefined) {
|
|
1195
|
+
delete this.manager._boundaryReanchorBudget;
|
|
1196
|
+
}
|
|
1197
|
+
else {
|
|
1198
|
+
this.manager._boundaryReanchorBudget = prevReanchorBudget;
|
|
1199
|
+
}
|
|
1186
1200
|
}
|
|
1187
1201
|
if (typeof this.manager?.resumeFundRecalc === 'function') {
|
|
1188
1202
|
await this.manager.resumeFundRecalc();
|
|
@@ -20,6 +20,97 @@ import { isLastFillGuardBlocked } from './order/utils/system.js';
|
|
|
20
20
|
* keeps the plan-build authority (fail-open to the stamp, never to the guard).
|
|
21
21
|
*/
|
|
22
22
|
export declare function isEvacuationStampStillValid(liveBoundary: unknown, liveGapSlots: unknown, sourceId: unknown, destId: unknown, orderType: unknown): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Detect a live-rail conflict: the resting BUY/SELL rails cannot coexist with
|
|
25
|
+
* a `gapSlots`-wide spread band, i.e. no boundary value satisfies
|
|
26
|
+
* `maxBuy <= boundary` and `minSell >= boundary + gapSlots + 1` at once.
|
|
27
|
+
*
|
|
28
|
+
* Why this matters for gap evacuation: the stale-stamp check below refuses an
|
|
29
|
+
* evacuation whose source is no longer in-band under the LIVE (pre-commit)
|
|
30
|
+
* boundary. That is correct when the live geometry is itself consistent (the
|
|
31
|
+
* 2026-10-30 incident: plan boundary 124 wanted buys 125-128 evacuated, live
|
|
32
|
+
* 128 kept them on the rail, the bid edge survived). It is WRONG when the live
|
|
33
|
+
* rails already overlap: then the batch's boundary retreat is FORCED — some
|
|
34
|
+
* order has to move — and refusing the evacuation leaves the stranded order
|
|
35
|
+
* inside the band permanently (observed class: a buy fill inside the band
|
|
36
|
+
* crawls the boundary down, the retreat strands the two buys above it, the
|
|
37
|
+
* guard skips their rotation as stale, the rail clamp cannot move the boundary
|
|
38
|
+
* back because the sell rail caps it, and the 4-slot spread band keeps two
|
|
39
|
+
* live buys forever → real spread 1.2% against a 2.0% target).
|
|
40
|
+
*
|
|
41
|
+
* The test is boundary-independent (a crossing is a crossing at any boundary),
|
|
42
|
+
* so it cannot be satisfied by simply moving the boundary: only an evacuation
|
|
43
|
+
* resolves it. Ladder positions use the same live-price resolution as
|
|
44
|
+
* deriveRailBoundary, so a stale slot id cannot fake a rail member.
|
|
45
|
+
*
|
|
46
|
+
* @param manager - Manager exposing orders/assets/_genesis
|
|
47
|
+
* @param gapSlots - Gap-band width (slots)
|
|
48
|
+
* @returns `{ crossed, maxBuyIdx, minSellIdx, upper }`; `crossed` is false when
|
|
49
|
+
* either rail is empty (one-sided book proves nothing) or geometry is
|
|
50
|
+
* unknown (fail closed: keep the stale-stamp refusal).
|
|
51
|
+
*/
|
|
52
|
+
export declare function liveRailsConflictWithGap(manager: unknown, gapSlots: unknown): {
|
|
53
|
+
crossed: boolean;
|
|
54
|
+
maxBuyIdx: number | null;
|
|
55
|
+
minSellIdx: number | null;
|
|
56
|
+
upper: number | null;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Decide whether a stale-stamp refusal of a gap-evacuation rotation must yield
|
|
60
|
+
* to the forced-retreat allowance. Single authority for the three call sites
|
|
61
|
+
* (stamped build branch, unstamped build branch, final pivot gate) so the
|
|
62
|
+
* conditions can never drift apart.
|
|
63
|
+
*
|
|
64
|
+
* Two conditions, both required:
|
|
65
|
+
* 1. The stamp could actually be EVALUATED: an unparseable source/dest id is
|
|
66
|
+
* not a geometry disagreement — `isEvacuationStampStillValid` refuses those
|
|
67
|
+
* too, and overriding that would ship a rotation whose geometry nobody
|
|
68
|
+
* proved. Never override an unprovable stamp.
|
|
69
|
+
* 2. The live rails already conflict (see liveRailsConflictWithGap): some
|
|
70
|
+
* order must move at ANY boundary, so the plan's retreat is the only
|
|
71
|
+
* consistent geometry and the pre-commit "still on the rail" reading is not
|
|
72
|
+
* authoritative.
|
|
73
|
+
*
|
|
74
|
+
* @param manager - Manager exposing orders/assets/_genesis
|
|
75
|
+
* @param gapSlots - LIVE gap-band width (slots)
|
|
76
|
+
* @param sourceId - Evacuation source slot id
|
|
77
|
+
* @param destId - Evacuation destination slot id
|
|
78
|
+
* @returns The conflict record when the allowance applies, otherwise null.
|
|
79
|
+
*/
|
|
80
|
+
export declare function forcedRetreatJustifiesEvacuation(manager: unknown, gapSlots: unknown, sourceId: unknown, destId: unknown): {
|
|
81
|
+
crossed: boolean;
|
|
82
|
+
maxBuyIdx: number | null;
|
|
83
|
+
minSellIdx: number | null;
|
|
84
|
+
upper: number | null;
|
|
85
|
+
} | null;
|
|
86
|
+
/**
|
|
87
|
+
* Split pending price corrections into "drain now" and "held back because this
|
|
88
|
+
* batch supersedes them".
|
|
89
|
+
*
|
|
90
|
+
* A cancel-only gap-evacuation whose chain order the batch ROTATES is
|
|
91
|
+
* superseded by the plan: the rotation moves that order onto its rail in place,
|
|
92
|
+
* and cancelling it first destroys the batch's own source. Observed live on a
|
|
93
|
+
* stranded 4-slot band: the teeth queued cancels for the two rotation sources,
|
|
94
|
+
* the pre-batch drain executed them, and the UPDATE batch was rejected
|
|
95
|
+
* pre-broadcast ("2 target(s) missing on chain") → structural resync + full grid
|
|
96
|
+
* reload + two CREATEs, instead of two in-place price updates.
|
|
97
|
+
*
|
|
98
|
+
* Held entries are put back after the drain: if the rotation is dropped or the
|
|
99
|
+
* batch aborts they stay queued (their own staleness check drops them once the
|
|
100
|
+
* slot no longer owns the order).
|
|
101
|
+
*
|
|
102
|
+
* @param entries - `manager.ordersNeedingPriceCorrection`
|
|
103
|
+
* @param actions - The batch's planned actions
|
|
104
|
+
* @returns `{ kept, held }` (both empty-safe)
|
|
105
|
+
*/
|
|
106
|
+
export declare function splitEvacuationCancelsSupersededByRotations(entries: unknown, actions: unknown): {
|
|
107
|
+
kept: Array<{
|
|
108
|
+
[key: string]: unknown;
|
|
109
|
+
}>;
|
|
110
|
+
held: Array<{
|
|
111
|
+
[key: string]: unknown;
|
|
112
|
+
}>;
|
|
113
|
+
};
|
|
23
114
|
import * as workingGridModule from './order/working_grid.js';
|
|
24
115
|
declare const WorkingGrid: typeof workingGridModule.WorkingGrid;
|
|
25
116
|
import type { BotLike, OrderManagerLike, ManagedOrder, ChainOrder, UnknownRecord, CowAction } from './types.js';
|
|
@@ -176,12 +267,7 @@ declare function findChainOrderForSlot(bot: BotLike, chainOrders: ChainOrderLike
|
|
|
176
267
|
* @param {Object} [options]
|
|
177
268
|
* @returns {Promise<Object>}
|
|
178
269
|
*/
|
|
179
|
-
declare function reconcileAfterUncertainBroadcast(bot: BotLike, err: unknown, opContexts: OpPhase[], options?: JsonObj): Promise<UnknownRecord
|
|
180
|
-
executed: boolean;
|
|
181
|
-
hadRotation: boolean;
|
|
182
|
-
uncertain: boolean;
|
|
183
|
-
ambiguousRead: boolean;
|
|
184
|
-
}>;
|
|
270
|
+
declare function reconcileAfterUncertainBroadcast(bot: BotLike, err: unknown, opContexts: OpPhase[], options?: JsonObj): Promise<UnknownRecord>;
|
|
185
271
|
/**
|
|
186
272
|
* Restore discarded CREATE slots to creation-uncertain state and clear
|
|
187
273
|
* their pending entries; residual pending entries that survive the
|
|
@@ -398,8 +484,12 @@ declare function toRefillSlotIdSet(refillSlotIds: unknown): Set<string>;
|
|
|
398
484
|
* Unrelated vetoes (skip ids outside the refill set) never pin geometry.
|
|
399
485
|
* The grid still commits; only the boundary value is held (same discipline
|
|
400
486
|
* as the overrun-hold in validateBoundaryCommit).
|
|
487
|
+
*
|
|
488
|
+
* `refillSide` (BUY/SELL) scopes the hold to the boundary's PROMOTION
|
|
489
|
+
* direction; a fill-driven retreat, or a wire whose side cannot be resolved
|
|
490
|
+
* (null), keeps the legacy hold.
|
|
401
491
|
*/
|
|
402
|
-
declare function resolveRefillBoundaryHold(workingBoundary: unknown, committedBoundary: unknown, skippedUpdateSlotIds: Iterable<string> | null | undefined, clampedUpdateSlotIds: Iterable<string> | null | undefined, refillSlotIds: unknown, skippedCreateSlotIds?: Iterable<string> | null | undefined): {
|
|
492
|
+
declare function resolveRefillBoundaryHold(workingBoundary: unknown, committedBoundary: unknown, skippedUpdateSlotIds: Iterable<string> | null | undefined, clampedUpdateSlotIds: Iterable<string> | null | undefined, refillSlotIds: unknown, skippedCreateSlotIds?: Iterable<string> | null | undefined, refillSide?: unknown): {
|
|
403
493
|
effectiveBoundary: unknown;
|
|
404
494
|
heldRefillSlotIds: string[];
|
|
405
495
|
};
|