dexbot 1.6.13 → 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.
Files changed (93) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +2 -2
  3. package/claw/docs/AI_BOT_LIBRARY_API.md +1 -1
  4. package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -4
  5. package/claw/modules/claw_catalog.ts +8 -4
  6. package/claw/modules/dexbot_profiles.ts +59 -15
  7. package/claw/modules/types.ts +2 -1
  8. package/claw/package.json +1 -1
  9. package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
  10. package/claw/runtimes/openclaw-plugin/package.json +1 -1
  11. package/claw/skills/margin-trading/SKILL.md +1 -1
  12. package/claw/skills/margin-trading/references/position-management.md +1 -1
  13. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +25 -25
  14. package/dist/modules/account_bots.d.ts +7 -6
  15. package/dist/modules/account_bots.js +10 -10
  16. package/dist/modules/account_orders.d.ts +36 -4
  17. package/dist/modules/account_orders.js +76 -5
  18. package/dist/modules/bitshares-native/crypto/ecc_core.d.ts +1 -2
  19. package/dist/modules/bitshares-native/crypto/ecc_core.js +1 -1
  20. package/dist/modules/bitshares-native/serial/chain_constants.d.ts +1 -2
  21. package/dist/modules/bitshares-native/serial/chain_constants.js +1 -2
  22. package/dist/modules/bot_defaults.d.ts +16 -2
  23. package/dist/modules/bot_defaults.js +34 -8
  24. package/dist/modules/bot_settings.d.ts +4 -0
  25. package/dist/modules/bot_settings.js +55 -21
  26. package/dist/modules/config.js +6 -1
  27. package/dist/modules/constants.d.ts +7 -5
  28. package/dist/modules/constants.js +12 -5
  29. package/dist/modules/dexbot_class.d.ts +5 -0
  30. package/dist/modules/dexbot_class.js +8 -3
  31. package/dist/modules/dexbot_cow_runtime.d.ts +62 -174
  32. package/dist/modules/dexbot_cow_runtime.js +331 -46
  33. package/dist/modules/dexbot_credential_client.d.ts +1 -16
  34. package/dist/modules/dexbot_credential_client.js +1 -1
  35. package/dist/modules/dexbot_fill_runtime.d.ts +1 -1
  36. package/dist/modules/dexbot_fill_runtime.js +12 -1
  37. package/dist/modules/dexbot_maintenance_runtime.d.ts +18 -80
  38. package/dist/modules/dexbot_maintenance_runtime.js +57 -68
  39. package/dist/modules/dexbot_startup_runtime.js +12 -0
  40. package/dist/modules/dexbot_state_recovery.js +16 -0
  41. package/dist/modules/key_store.d.ts +0 -5
  42. package/dist/modules/key_store.js +1 -1
  43. package/dist/modules/order/accounting.js +11 -11
  44. package/dist/modules/order/export.js +2 -2
  45. package/dist/modules/order/format.d.ts +15 -1
  46. package/dist/modules/order/format.js +19 -1
  47. package/dist/modules/order/genesis_policy.d.ts +1 -1
  48. package/dist/modules/order/genesis_policy.js +1 -1
  49. package/dist/modules/order/grid.d.ts +23 -11
  50. package/dist/modules/order/grid.js +383 -51
  51. package/dist/modules/order/grid_reconcile.d.ts +1 -1
  52. package/dist/modules/order/grid_reconcile.js +5 -5
  53. package/dist/modules/order/grid_reconcile_internal.js +48 -40
  54. package/dist/modules/order/index.d.ts +34 -8
  55. package/dist/modules/order/logger.js +2 -2
  56. package/dist/modules/order/manager.d.ts +9 -2
  57. package/dist/modules/order/manager.js +58 -24
  58. package/dist/modules/order/strategy.d.ts +2 -2
  59. package/dist/modules/order/strategy.js +51 -21
  60. package/dist/modules/order/sync_engine.js +4 -0
  61. package/dist/modules/order/utils/math.d.ts +3 -3
  62. package/dist/modules/order/utils/math.js +38 -27
  63. package/dist/modules/order/utils/order.d.ts +58 -58
  64. package/dist/modules/order/utils/order.js +119 -102
  65. package/dist/modules/order/utils/system.d.ts +193 -6
  66. package/dist/modules/order/utils/system.js +392 -29
  67. package/dist/modules/order/utils/validate.js +26 -4
  68. package/dist/modules/runtime_settings.d.ts +1 -1
  69. package/dist/modules/runtime_settings.js +3 -3
  70. package/dist/modules/types.d.ts +48 -4
  71. package/dist/scripts/analyze-orders.d.ts +1 -1
  72. package/dist/scripts/analyze-orders.js +4 -4
  73. package/dist/scripts/divergence-calc.js +6 -6
  74. package/dist/scripts/validate_bots.d.ts +1 -1
  75. package/dist/scripts/validate_bots.js +3 -3
  76. package/dist/unlock.js +7 -2
  77. package/docs/COPY_ON_WRITE_MASTER_PLAN.md +1 -2
  78. package/docs/COW_INVARIANTS.md +6 -6
  79. package/docs/DEXBOT_COMPARISON.md +5 -5
  80. package/docs/EVOLUTION.md +8 -7
  81. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +8 -6
  82. package/docs/GRID_PRICE_INVARIANT.md +3 -3
  83. package/docs/GRID_RECALCULATION.md +4 -1
  84. package/docs/GRID_RECONCILE.md +4 -4
  85. package/docs/LIFECYCLE.md +11 -11
  86. package/docs/LOGGING.md +14 -0
  87. package/docs/MPA_CREDIT_USAGE.md +1 -1
  88. package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +12 -4
  89. package/docs/README.md +3 -3
  90. package/docs/architecture.md +6 -6
  91. package/docs/developer_guide.md +7 -2
  92. package/package.json +1 -1
  93. package/tests/README.md +1 -1
@@ -49,7 +49,7 @@
49
49
  import { ORDER_TYPES, ORDER_STATES } from '../constants.js';
50
50
  import { calculateGapSlots } from './grid.js';
51
51
  import { isSlotInRail } from './utils/math.js';
52
- import { deriveTargetBoundary, getSideBudget, calculateBudgetedSizes, getActiveOrdersTotal, resolveReserveCount, resolveLiveReserveEdgeAnchorPrice, selectReserveEdgeSlots, isShiftEligibleFill } from './utils/order.js';
52
+ import { deriveTargetBoundary, getSideBudget, calculateBudgetedSizes, getCoreOrdersTotal, resolveEdgeCount, resolveLiveEdgeAnchorPrice, selectEdgeSlots, isShiftEligibleFill } from './utils/order.js';
53
53
  import { assignGridRoles } from './utils/order.js';
54
54
  import { convertToSpreadPlaceholder, toRailHolePlaceholder, geometryTypeForSlotIndex, parseSlotIndex, hasOnChainId, isOrderPlaced } from "./utils/order.js";
55
55
  class StrategyEngine {
@@ -188,7 +188,7 @@ class StrategyEngine {
188
188
  * 1. Derive new boundary index based on fills (boundary crawl)
189
189
  * 2. Assign grid roles (BUY/SELL/SPREAD) based on boundary position
190
190
  * 3. Calculate budget allocation for each side
191
- * 4. Apply window discipline (activeOrders count limits)
191
+ * 4. Apply window discipline (coreOrders count limits)
192
192
  * 5. Calculate ideal order sizes based on budgets and weights
193
193
  * 6. Build target grid map representing desired state
194
194
  *
@@ -207,7 +207,7 @@ class StrategyEngine {
207
207
  * @param {Object} params.config - Bot configuration
208
208
  * - targetSpreadPercent {number}: Width of spread zone
209
209
  * - incrementPercent {number}: Price step between orders
210
- * - activeOrders {Object}: Target active order counts
210
+ * - coreOrders {Object}: Target active order counts
211
211
  * - weightDistribution {Object}: Size weighting for each side
212
212
  * @param {Object} params.accountAssets - Asset metadata (precision, IDs)
213
213
  * @param {Object} params.funds - Current fund state
@@ -250,16 +250,16 @@ class StrategyEngine {
250
250
  const boundaryConfig = (!Number.isFinite(Number(config?.startPrice)) && Number.isFinite(genesisStart))
251
251
  ? { ...config, genesisStartPrice: genesisStart }
252
252
  : config;
253
- // Live reserve edge anchors (single source): the ladder extremes of the
254
- // grid actually being traded. Resolved once and shared by the reserve
253
+ // Live edge order anchors (single source): the ladder extremes of the
254
+ // grid actually being traded. Resolved once and shared by the edge
255
255
  // selection below and the no-crawl classification inside
256
256
  // deriveTargetBoundary, so placement and fill classification can never
257
- // disagree about which slots are reserves.
258
- const reserveEdgeAnchors = {
259
- buy: resolveLiveReserveEdgeAnchorPrice(this.manager, 'buy'),
260
- sell: resolveLiveReserveEdgeAnchorPrice(this.manager, 'sell'),
257
+ // disagree about which slots are edge orders.
258
+ const edgeAnchors = {
259
+ buy: resolveLiveEdgeAnchorPrice(this.manager, 'buy'),
260
+ sell: resolveLiveEdgeAnchorPrice(this.manager, 'sell'),
261
261
  };
262
- const { boundaryIdx: newBoundaryIdx, remainingBudget } = deriveTargetBoundary(fills, currentBoundaryIdx, allSlots, boundaryConfig, gapSlots, crossChunkBudget, this.manager._pendingFillCrawls, reserveEdgeAnchors);
262
+ const { boundaryIdx: newBoundaryIdx, remainingBudget } = deriveTargetBoundary(fills, currentBoundaryIdx, allSlots, boundaryConfig, gapSlots, crossChunkBudget, this.manager._pendingFillCrawls, edgeAnchors);
263
263
  if (crossChunkBudget != null) {
264
264
  this.manager._boundaryShiftBudget = remainingBudget;
265
265
  }
@@ -270,20 +270,50 @@ class StrategyEngine {
270
270
  this.manager.logger.log('[COW] calculateTargetGrid: boundary unrecoverable (no numeric center); skipping rotation plan', 'warn');
271
271
  return { targetGrid: new Map(), boundaryIdx: null };
272
272
  }
273
+ // P2 observability: a market/fill-derived boundary that jumps more than
274
+ // the active window in ONE plan is the "boundary detached from the
275
+ // market anchor" signal (the ANCHOR-DIVERGENCE condition, which lost its
276
+ // telemetry when the price projection was removed). A normal crawl is
277
+ // budget-bounded to at most half the active window, so this can only fire
278
+ // on an absolute recovery anchor or a geometry fault. Counted and
279
+ // rate-limited; never gates the plan.
280
+ try {
281
+ const activeWindow = Math.max(1, Number(config?.coreOrders?.buy) || 1, Number(config?.coreOrders?.sell) || 1);
282
+ // Null boundary is DELIBERATELY compared against numeric 0 here:
283
+ // the derived boundary is an absolute recovery anchor, and its
284
+ // distance from 0 is exactly the ANCHOR-DIVERGENCE signal this
285
+ // observability counter exists to surface (see P2 test).
286
+ const driftSlots = Math.abs(Number(newBoundaryIdx) - Number(currentBoundaryIdx));
287
+ if (Number.isFinite(driftSlots) && driftSlots > activeWindow) {
288
+ const metrics = this.manager._metrics;
289
+ if (metrics) {
290
+ metrics.boundaryDriftExceedsWindowCount = (metrics.boundaryDriftExceedsWindowCount || 0) + 1;
291
+ }
292
+ const now = Date.now();
293
+ const lastWarn = Number(this.manager._lastBoundaryDriftWarnAt) || 0;
294
+ if (now - lastWarn >= 5 * 60 * 1000) {
295
+ this.manager._lastBoundaryDriftWarnAt = now;
296
+ this.manager.logger.log(`[BOUNDARY-DRIFT] committed boundary ${currentBoundaryIdx} -> planned ${newBoundaryIdx} ` +
297
+ `(drift ${driftSlots} slots) exceeds active window ${activeWindow}; ` +
298
+ `boundary is detached from the market anchor (observability only)`, 'warn');
299
+ }
300
+ }
301
+ }
302
+ catch { /* observability only */ }
273
303
  // 2. Assign Roles (Buy/Sell/Spread)
274
304
  const updatedSlots = assignGridRoles(allSlots, newBoundaryIdx, gapSlots, ORDER_TYPES, ORDER_STATES, { assignOnChain: true });
275
305
  this.manager.logger.log(`[DEBUG] calculateTargetGrid: boundary=${newBoundaryIdx}, gap=${gapSlots}, allSlots=${updatedSlots.length}`, 'debug');
276
306
  updatedSlots.forEach((s) => this.manager.logger.log(` Slot ${s.id}: price=${s.price}, size=${s.size ?? 'n/a'}, type=${s.type}`, 'debug'));
277
307
  // 3. Calculate Ideal Sizes (Budgeting)
278
- const totalTarget = getActiveOrdersTotal(config);
308
+ const totalTarget = getCoreOrdersTotal(config);
279
309
  const budgetBuy = getSideBudget('buy', funds, config, totalTarget);
280
310
  const budgetSell = getSideBudget('sell', funds, config, totalTarget);
281
311
  // Filter slots into BUY/SELL
282
312
  const allBuySlots = updatedSlots.filter((o) => o.type === ORDER_TYPES.BUY);
283
313
  const allSellSlots = updatedSlots.filter((o) => o.type === ORDER_TYPES.SELL);
284
- // Apply Window Discipline (activeOrders count)
285
- const targetCountBuy = Math.max(1, (config.activeOrders?.buy ?? 1));
286
- const targetCountSell = Math.max(1, (config.activeOrders?.sell ?? 1));
314
+ // Apply Window Discipline (coreOrders count)
315
+ const targetCountBuy = Math.max(1, (config.coreOrders?.buy ?? 1));
316
+ const targetCountSell = Math.max(1, (config.coreOrders?.sell ?? 1));
287
317
  // The SPREAD GUARD (assignGridRoles) keeps a live on-chain order typed
288
318
  // BUY/SELL even when a boundary crawl moves its slot into the spread
289
319
  // band (to avoid the illegal SPREAD+ACTIVE state). Such a stray slot
@@ -330,17 +360,17 @@ class StrategyEngine {
330
360
  const fullSellSizes = calculateBudgetedSizes(allSellSortedForSizing, 'sell', budgetSell, config.weightDistribution?.sell, config.incrementPercent, accountAssets);
331
361
  const buySizeById = new Map(allBuySortedForSizing.map((slot, i) => [slot.id, fullBuySizes[i] || 0]));
332
362
  const sellSizeById = new Map(allSellSortedForSizing.map((slot, i) => [slot.id, fullSellSizes[i] || 0]));
333
- // Reserve ladder: edge-pinned insurance orders stay live alongside the
363
+ // Edge ladder: edge-pinned insurance orders stay live alongside the
334
364
  // window. Buys pin at the floor (lowest prices), sells at the ceiling
335
365
  // (highest prices). Discontiguous by design — the middle stays VIRTUAL.
336
- // Sizes come from the same full-rail curves; reserve fills never crawl
366
+ // Sizes come from the same full-rail curves; edge fills never crawl
337
367
  // (filtered in deriveTargetBoundary).
338
- // Both edges anchor at the live grid's own edge (reserveEdgeAnchors),
368
+ // Both edges anchor at the live grid's own edge (edgeAnchors),
339
369
  // which is the same pair deriveTargetBoundary classified against.
340
- const reserveBuySlots = selectReserveEdgeSlots(allBuySortedForSizing.filter((s) => inBuyRail(s)), resolveReserveCount(config, 'buy'), new Set(buySlots.map((s) => s.id)), 'floor', reserveEdgeAnchors.buy);
341
- const reserveSellSlots = selectReserveEdgeSlots(allSellSortedForSizing.filter((s) => inSellRail(s)), resolveReserveCount(config, 'sell'), new Set(sellSlots.map((s) => s.id)), 'ceiling', reserveEdgeAnchors.sell);
342
- const buySlotsAll = [...buySlots, ...reserveBuySlots];
343
- const sellSlotsAll = [...sellSlots, ...reserveSellSlots];
370
+ const edgeBuySlots = selectEdgeSlots(allBuySortedForSizing.filter((s) => inBuyRail(s)), resolveEdgeCount(config, 'buy'), new Set(buySlots.map((s) => s.id)), 'floor', edgeAnchors.buy);
371
+ const edgeSellSlots = selectEdgeSlots(allSellSortedForSizing.filter((s) => inSellRail(s)), resolveEdgeCount(config, 'sell'), new Set(sellSlots.map((s) => s.id)), 'ceiling', edgeAnchors.sell);
372
+ const buySlotsAll = [...buySlots, ...edgeBuySlots];
373
+ const sellSlotsAll = [...sellSlots, ...edgeSellSlots];
344
374
  const buySizes = buySlotsAll.map((slot) => buySizeById.get(slot.id) || 0);
345
375
  const sellSizes = sellSlotsAll.map((slot) => sellSizeById.get(slot.id) || 0);
346
376
  // Apply sizes to target grid map
@@ -651,6 +651,10 @@ class SyncEngine {
651
651
  ? (innerResult.unmatchedChainOrders ?? []).map((order) => ({ ...order }))
652
652
  : [];
653
653
  mgr._lastUnmatchedChainOrdersAt = unmatchedCount > 0 ? Date.now() : 0;
654
+ // Freshness stamp for the spread-correction bypass gate:
655
+ // only a completed open-orders sync makes the local anchor
656
+ // trustworthy enough to bypass the LAST-FILL-GUARD.
657
+ mgr._lastSyncAt = Date.now();
654
658
  mgr.logger?.log?.(`[SYNC] Synchronization complete: ${innerResult.filledOrders.length} filled, ` +
655
659
  `${innerResult.updatedOrders.length} updated, ` +
656
660
  `${innerResult.ordersNeedingCorrection.length} needing correction.`, 'info');
@@ -71,7 +71,7 @@
71
71
  *
72
72
  * ===============================================================================
73
73
  */
74
- import type { OrderManagerLike, AccountTotals, ManagerFunds, ActiveOrdersConfig, GridFeeParams, ManagedOrder, AssetPair, GridConfig, GridLimitsLike, WeightDistributionConfig } from '../../types.js';
74
+ import type { OrderManagerLike, AccountTotals, ManagerFunds, CoreOrdersConfig, GridFeeParams, ManagedOrder, AssetPair, GridConfig, GridLimitsLike, WeightDistributionConfig } from '../../types.js';
75
75
  interface FeeCacheEntry {
76
76
  limitOrderCreate: {
77
77
  bts: number;
@@ -413,10 +413,10 @@ declare function getAssetFeesSafe(assetSymbol: string, assetAmount?: number | nu
413
413
  * @param {Object} funds - Fund allocation object with virtual, btsFeesOwed properties
414
414
  * @param {string} assetA - First asset symbol
415
415
  * @param {string} assetB - Second asset symbol
416
- * @param {Object} [activeOrders=null] - Active order counts {buy, sell} for BTS reservation calculation
416
+ * @param {Object} [coreOrders=null] - Active order counts {buy, sell} for BTS reservation calculation
417
417
  * @returns {number} Available funds for the side (0 if side invalid or insufficient funds)
418
418
  */
419
- declare function calculateAvailableFundsValue(side: string, accountTotals: AccountTotals | null | undefined, funds: ManagerFunds, assetA: string | undefined, assetB: string | undefined, activeOrders?: ActiveOrdersConfig | null, configMinBtsValue?: number | null, feeParams?: GridFeeParams | null): number;
419
+ declare function calculateAvailableFundsValue(side: string, accountTotals: AccountTotals | null | undefined, funds: ManagerFunds, assetA: string | undefined, assetB: string | undefined, coreOrders?: CoreOrdersConfig | null, configMinBtsValue?: number | null, feeParams?: GridFeeParams | null): number;
420
420
  /**
421
421
  * Adjust an allocated budget for BTS fee reservation.
422
422
  * Uses computeBtsFeeImpact for proportional deduction; falls back to 0.5
@@ -429,10 +429,10 @@ function getAssetFeesSafe(assetSymbol, assetAmount = null, isMaker = true) {
429
429
  * @param {Object} funds - Fund allocation object with virtual, btsFeesOwed properties
430
430
  * @param {string} assetA - First asset symbol
431
431
  * @param {string} assetB - Second asset symbol
432
- * @param {Object} [activeOrders=null] - Active order counts {buy, sell} for BTS reservation calculation
432
+ * @param {Object} [coreOrders=null] - Active order counts {buy, sell} for BTS reservation calculation
433
433
  * @returns {number} Available funds for the side (0 if side invalid or insufficient funds)
434
434
  */
435
- function calculateAvailableFundsValue(side, accountTotals, funds, assetA, assetB, activeOrders = null, configMinBtsValue = null, feeParams = null) {
435
+ function calculateAvailableFundsValue(side, accountTotals, funds, assetA, assetB, coreOrders = null, configMinBtsValue = null, feeParams = null) {
436
436
  if (side !== 'buy' && side !== 'sell')
437
437
  return 0;
438
438
  const chainFree = toFiniteNumber(side === 'buy' ? accountTotals?.buyFree : accountTotals?.sellFree);
@@ -441,17 +441,17 @@ function calculateAvailableFundsValue(side, accountTotals, funds, assetA, assetB
441
441
  const btsSide = getBtsSide(assetA, assetB);
442
442
  const btsReservationMultiplier = feeParams?.BTS_RESERVATION_MULTIPLIER ?? FEE_PARAMETERS.BTS_RESERVATION_MULTIPLIER;
443
443
  let btsFeesReservation = 0;
444
- if (btsSide === side && activeOrders) {
445
- const targetBuy = Math.max(0, toFiniteNumber(activeOrders?.buy, 1));
446
- const targetSell = Math.max(0, toFiniteNumber(activeOrders?.sell, 1));
444
+ if (btsSide === side && coreOrders) {
445
+ const targetBuy = Math.max(0, toFiniteNumber(coreOrders?.buy, 1));
446
+ const targetSell = Math.max(0, toFiniteNumber(coreOrders?.sell, 1));
447
447
  const totalTargetOrders = targetBuy + targetSell;
448
448
  btsFeesReservation = calculateOrderCreationFees(assetA, assetB, totalTargetOrders, btsReservationMultiplier);
449
449
  }
450
450
  const currentFeesOwed = (btsSide === side) ? btsFeesOwed : 0;
451
451
  // Non-BTS pair: reserve proportional share for BTS fee budget
452
- if (!btsSide && activeOrders && funds?.btsBalance != null) {
453
- const targetBuy = Math.max(0, toFiniteNumber(activeOrders?.buy, 1));
454
- const targetSell = Math.max(0, toFiniteNumber(activeOrders?.sell, 1));
452
+ if (!btsSide && coreOrders && funds?.btsBalance != null) {
453
+ const targetBuy = Math.max(0, toFiniteNumber(coreOrders?.buy, 1));
454
+ const targetSell = Math.max(0, toFiniteNumber(coreOrders?.sell, 1));
455
455
  const totalTargetOrders = targetBuy + targetSell;
456
456
  const formulaBudget = calculateOrderCreationFees(assetA, assetB, totalTargetOrders, btsReservationMultiplier);
457
457
  const btsFree = toFiniteNumber(funds?.btsBalance?.free, 0);
@@ -1336,13 +1336,11 @@ function resolveGapSlots(manager) {
1336
1336
  */
1337
1337
  function resolveGapBand(manager) {
1338
1338
  const gapSlots = resolveGapSlots(manager);
1339
- // Explicit null/undefined guard: Number(null) === 0, which would silently
1340
- // treat "no boundary" as boundary 0 — a valid index that biases all slots
1341
- // to the SELL rail. Return null so callers can detect the unknown state.
1342
- if (manager.boundaryIdx == null) {
1343
- return { gapSlots, boundaryIdx: null, sellStartIdx: null };
1344
- }
1345
- const raw = Number(manager.boundaryIdx);
1339
+ // Absent-aware coercion: Number(null)/Number('') === 0 would silently treat
1340
+ // "no boundary" as boundary 0 — a valid index that biases all slots to the
1341
+ // SELL rail. toKnownNumber keeps null/undefined/'' as NaN so the unknown
1342
+ // state is detectable, while a genuine boundary 0 still returns 0.
1343
+ const raw = Format.toKnownNumber(manager.boundaryIdx);
1346
1344
  if (!Number.isFinite(raw)) {
1347
1345
  return { gapSlots, boundaryIdx: null, sellStartIdx: null };
1348
1346
  }
@@ -1401,7 +1399,15 @@ const BOUNDARY_REJECT_PLACED_IN_BAND = 'placed_order_in_band';
1401
1399
  * is a stable short code and `detail` carries indices/prices for logs.
1402
1400
  */
1403
1401
  function validateBoundaryCommit(proposedBoundary, orders, gapSlots, options = {}) {
1404
- if (proposedBoundary == null)
1402
+ // Absent-aware: null/undefined/'' means "no proposal" (ok), NOT boundary 0,
1403
+ // otherwise Number('') === 0 would self-legalize a fake boundary 0 commit.
1404
+ // Everything else non-numeric stays FAIL-CLOSED (corrupt/garbage, never
1405
+ // ok): this gate also backs validatePersistedBoundary — the disk-trust
1406
+ // boundary where a poison value must surface as a rejection (rebuild),
1407
+ // not silently pass as "no proposal". Callers pass number | null; the
1408
+ // '' branch only exists because '' would otherwise coerce to 0 via
1409
+ // Number() and read as a valid boundary index.
1410
+ if (proposedBoundary === '' || proposedBoundary == null)
1405
1411
  return { ok: true };
1406
1412
  const raw = Number(proposedBoundary);
1407
1413
  if (!Number.isFinite(raw) || !Number.isInteger(raw)) {
@@ -1605,17 +1611,25 @@ function countGapBandSpread(manager, orders, resolveIndex) {
1605
1611
  * sits provably outside the rail.
1606
1612
  */
1607
1613
  function isSlotInRail(boundaryIdx, gapSlots, orderType, slot) {
1608
- if (boundaryIdx == null || !Number.isFinite(Number(boundaryIdx)))
1614
+ // Absent-aware: ''/null/undefined is unknown geometry → fail open, never a
1615
+ // boundary of 0 (Number('') === 0 would otherwise exclude valid slots).
1616
+ const boundary = Format.toKnownNumber(boundaryIdx);
1617
+ if (!Number.isFinite(boundary))
1609
1618
  return true;
1610
1619
  const parsed = parseSlotIndex(slot?.id);
1611
1620
  if (parsed === null)
1612
1621
  return true;
1613
1622
  const idx = parsed;
1614
1623
  if (orderType === ORDER_TYPES.BUY)
1615
- return idx <= Number(boundaryIdx);
1624
+ return idx <= boundary;
1616
1625
  if (orderType !== ORDER_TYPES.SELL)
1617
1626
  return true;
1618
- const sellStartIdx = getSellStartIdx(boundaryIdx, gapSlots);
1627
+ // The SELL rail needs the gap width; unknown gap → cannot derive sellStart
1628
+ // → fail open (same contract as the unknown-boundary branch above).
1629
+ const gap = Format.toKnownNumber(gapSlots);
1630
+ if (!Number.isFinite(gap))
1631
+ return true;
1632
+ const sellStartIdx = getSellStartIdx(boundary, gap);
1619
1633
  if (!Number.isFinite(sellStartIdx))
1620
1634
  return true;
1621
1635
  return idx >= sellStartIdx;
@@ -1632,14 +1646,11 @@ function isSlotInRail(boundaryIdx, gapSlots, orderType, slot) {
1632
1646
  * @returns {boolean} True when the index is inside the gap band
1633
1647
  */
1634
1648
  function isSlotIndexInGapBand(idx, boundaryIdx, gapSlots) {
1635
- // Explicit null guard: Number(null) === 0 must never read as slot 0.
1636
- if (idx === null || idx === undefined || idx === '')
1637
- return false;
1638
- if (boundaryIdx === null || boundaryIdx === undefined || boundaryIdx === '')
1639
- return false;
1640
- const n = Number(idx);
1641
- const b = Number(boundaryIdx);
1642
- const g = Number(gapSlots);
1649
+ // Absent-aware: Number(null)/Number('') === 0 must never read as slot 0,
1650
+ // and an unknown gap width must not collapse the band (null → 0).
1651
+ const n = Format.toKnownNumber(idx);
1652
+ const b = Format.toKnownNumber(boundaryIdx);
1653
+ const g = Format.toKnownNumber(gapSlots);
1643
1654
  if (!Number.isFinite(n) || !Number.isFinite(b) || !Number.isFinite(g))
1644
1655
  return false;
1645
1656
  const sellStartIdx = getSellStartIdx(b, g);
@@ -60,13 +60,13 @@
60
60
  * - getOrderSize(order) - Extract order size with fallback
61
61
  *
62
62
  * SECTION 10: STRATEGY CALCULATIONS (7 functions)
63
- * - resolveReserveCount(config, side) - Clamped per-side reserve count (>=0 int, 0 disables)
64
- * - resolveReserveOrders(config) - Total reserves buy+sell (fee/count totals)
65
- * - resolveLiveReserveEdgeAnchorPrice(manager, side) - Live-grid edge anchor (genesis ladder extreme; null when no usable ladder)
66
- * - resolveReserveEdgeAnchorPrice(config, side) - Config-bound anchor fallback (buy→minPrice, sell→maxPrice; null when unresolvable)
67
- * - compareReserveEdge(a, b, edge, anchorPrice) - Shared anchored edge comparator (single ordering source)
68
- * - reserveEdgeIdSet(allSlots, config, orderType, anchorPrice?, excludeIds?) - Edge reserve id set (config count; shares the picker ordering; excludeIds carries the window exclusion)
69
- * - selectReserveEdgeSlots(sortedAsc, count, excludeIds, edge, anchorPrice?) - Shared position picker (both edges anchor toward their bound)
63
+ * - resolveEdgeCount(config, side) - Clamped per-side edge count (>=0 int, 0 disables)
64
+ * - resolveEdgeOrders(config) - Total edge orders buy+sell (fee/count totals)
65
+ * - resolveLiveEdgeAnchorPrice(manager, side) - Live-grid edge anchor (genesis ladder extreme; null when no usable ladder)
66
+ * - resolveEdgeAnchorPrice(config, side) - Config-bound anchor fallback (buy→minPrice, sell→maxPrice; null when unresolvable)
67
+ * - compareEdge(a, b, edge, anchorPrice) - Shared anchored edge comparator (single ordering source)
68
+ * - edgeOrderIdSet(allSlots, config, orderType, anchorPrice?, excludeIds?) - Edge order id set (config count; shares the picker ordering; excludeIds carries the window exclusion)
69
+ * - selectEdgeSlots(sortedAsc, count, excludeIds, edge, anchorPrice?) - Shared position picker (both edges anchor toward their bound)
70
70
  *
71
71
  * ===============================================================================
72
72
  */
@@ -875,13 +875,13 @@ interface DeltaAction {
875
875
  orderId?: string | null;
876
876
  [key: string]: unknown;
877
877
  }
878
- interface ReserveConfig {
879
- reserveOrders?: number | {
878
+ interface OrderConfigView {
879
+ edgeOrders?: number | {
880
880
  buy?: number;
881
881
  sell?: number;
882
882
  [key: string]: unknown;
883
883
  };
884
- activeOrders?: {
884
+ coreOrders?: {
885
885
  buy?: number;
886
886
  sell?: number;
887
887
  [key: string]: unknown;
@@ -1015,7 +1015,7 @@ declare function deriveTargetBoundary(fills: Array<{
1015
1015
  }> | null | undefined, currentBoundaryIdx: number | null | undefined, allSlots: ManagedOrder[], config: {
1016
1016
  startPrice?: number | string;
1017
1017
  genesisStartPrice?: number | string;
1018
- activeOrders?: {
1018
+ coreOrders?: {
1019
1019
  buy?: number;
1020
1020
  sell?: number;
1021
1021
  [key: string]: unknown;
@@ -1058,56 +1058,56 @@ export declare function consumePendingFillCrawls(manager: OrderManagerLike): {
1058
1058
  reason?: string;
1059
1059
  };
1060
1060
  /**
1061
- * Per-side reserve count (edge-pinned fat-finger insurance orders).
1062
- * Buy reserves pin at the grid floor, sell reserves at the grid ceiling.
1061
+ * Per-side edge count (edge-pinned fat-finger insurance orders).
1062
+ * Buy edges pin at the grid floor, sell edges at the grid ceiling.
1063
1063
  * Non-finite/non-integer/negative values disable (0).
1064
1064
  *
1065
- * The legacy numeric form (`reserveOrders: n`) is migrated here at read time
1065
+ * The legacy numeric form (`edgeOrders: n`) is migrated here at read time
1066
1066
  * to `{ buy: n, sell: 0 }`: the editor seeder rewrites the persisted JSON, but
1067
- * a hand-edited bots.json that bypassed the editor must not have its reserve
1067
+ * a hand-edited bots.json that bypassed the editor must not have its edge
1068
1068
  * count silently read as 0.
1069
1069
  *
1070
1070
  * @param {Object} config - Bot configuration
1071
1071
  * @param {string} side - 'buy' or 'sell'
1072
- * @returns {number} Reserve count for the side (>= 0 integer)
1072
+ * @returns {number} Edge count for the side (>= 0 integer)
1073
1073
  */
1074
- declare function resolveReserveCount(config: ReserveConfig | null | undefined, side: string): number;
1074
+ declare function resolveEdgeCount(config: OrderConfigView | null | undefined, side: string): number;
1075
1075
  /**
1076
- * Total reserve count across both sides (fee/count totals).
1076
+ * Total edge count across both sides (fee/count totals).
1077
1077
  *
1078
1078
  * @param {Object} config - Bot configuration
1079
- * @returns {number} Total reserves (buy + sell)
1079
+ * @returns {number} Total edges (buy + sell)
1080
1080
  */
1081
- declare function resolveReserveOrders(config: ReserveConfig | null | undefined): number;
1081
+ declare function resolveEdgeOrders(config: OrderConfigView | null | undefined): number;
1082
1082
  /**
1083
- * Edge-pinned reserve id set for one side, or null when disabled.
1083
+ * Edge-pinned order id set for one side, or null when disabled.
1084
1084
  * Type/price-filtered, then ordered by the SAME edge order the placement
1085
- * pickers use (compareReserveEdge via selectReserveEdgeSlots) — single source
1085
+ * pickers use (compareEdge via selectEdgeSlots) — single source
1086
1086
  * of truth, so the no-crawl classification can never drift from placement.
1087
1087
  * Anchor: explicit live-grid edge when supplied, otherwise the config-bound
1088
1088
  * fallback (unresolved -> plain rank). Shelf/manual ids (non-slot-N, e.g.
1089
- * fork-kept deep-* orders below the rail) are never reserves: they would
1089
+ * fork-kept deep-* orders below the rail) are never edge orders: they would
1090
1090
  * otherwise win the cheapest-first rank and poison the deficit check while
1091
1091
  * the shelf is live (issue #27 follow-up). No-op upstream (grids only mint
1092
1092
  * slot-N).
1093
1093
  *
1094
1094
  * @param {Array<Object>} allSlots - All grid slots (need id/price/type)
1095
- * @param {Object} config - Bot configuration (reserve count source)
1095
+ * @param {Object} config - Bot configuration (edge count source)
1096
1096
  * @param {string} orderType - ORDER_TYPES.BUY (floor) or SELL (ceiling)
1097
1097
  * @param {number|null} [anchorPrice] - Explicit edge anchor (live grid edge);
1098
1098
  * callers that picked slots must pass the SAME anchor so no-crawl
1099
1099
  * classification matches placement. NB: null/undefined falls back to the
1100
1100
  * config-bound anchor (unresolved -> plain rank) — unlike
1101
- * selectReserveEdgeSlots, where null alone means plain rank.
1101
+ * selectEdgeSlots, where null alone means plain rank.
1102
1102
  * @param {Set<string>|null} [excludeIds] - Windowed ids to skip (same set the
1103
1103
  * placement pickers exclude). Window + edge are additive in every target
1104
1104
  * (order counts, fees, hold-back), so a window that reaches the grid edge
1105
1105
  * (e.g. a keep-low window sitting on the floor) must not let the edge pick
1106
1106
  * land on window members — otherwise counting reads N/N with zero
1107
- * dedicated reserves and the deficit never fires (issue #27 follow-up).
1107
+ * dedicated edge orders and the deficit never fires (issue #27 follow-up).
1108
1108
  * @returns {Set<string>|null} Edge slot ids, or null when side disabled
1109
1109
  */
1110
- declare function reserveEdgeIdSet(allSlots: SlotLike[], config: ReserveConfig | null | undefined, orderType: OrderType, anchorPrice?: unknown, excludeIds?: Set<string> | null): Set<string> | null;
1110
+ declare function edgeOrderIdSet(allSlots: SlotLike[], config: OrderConfigView | null | undefined, orderType: OrderType, anchorPrice?: unknown, excludeIds?: Set<string> | null): Set<string> | null;
1111
1111
  /**
1112
1112
  * Window member ids for one side from the live manager (see
1113
1113
  * windowIdSetFromSlots). Delegates so the manager and explicit-geometry
@@ -1130,29 +1130,29 @@ declare function liveWindowIdSet(manager: OrderManagerLike, orderType: OrderType
1130
1130
  *
1131
1131
  * - CREATE ids of the plan (the slots a fold did not convert into an
1132
1132
  * UPDATE), minus
1133
- * - reserve-ladder ids. Reserves are static edge insurance; their fills
1133
+ * - edge-ladder ids. Edge orders are static edge insurance; their fills
1134
1134
  * never crawl (deriveTargetBoundary filters them), so a guard-skipped
1135
- * reserve must not pin geometry either. Without this exclusion a reserve
1135
+ * edge order must not pin geometry either. Without this exclusion an edge order
1136
1136
  * CREATE skipped at the wrong moment (e.g. a floor BUY above the last-fill
1137
1137
  * pivot while the market dumps below the grid) would hold the boundary for
1138
1138
  * a cycle although nothing was stranded.
1139
1139
  *
1140
- * Absent/disabled reserves or an empty action list yield the plain CREATE ids,
1141
- * so callers that never configured reserves keep the previous behavior.
1140
+ * Absent/disabled edge orders or an empty action list yield the plain CREATE ids,
1141
+ * so callers that never configured edge orders keep the previous behavior.
1142
1142
  *
1143
1143
  * @param {Array<Object>} actions - Optimized COW actions
1144
1144
  * @param {Object} [options]
1145
- * @param {Object} [options.config] - Bot configuration (reserve count source)
1146
- * @param {Iterable<Object>} [options.slots] - Master slots (reserve classification)
1145
+ * @param {Object} [options.config] - Bot configuration (edge count source)
1146
+ * @param {Iterable<Object>} [options.slots] - Master slots (edge classification)
1147
1147
  * @param {{buy?: number|null, sell?: number|null}} [options.edgeAnchors] - Live
1148
- * edge anchors (same pair the strategy classifies reserve fills against)
1148
+ * edge anchors (same pair the strategy classifies edge fills against)
1149
1149
  * @param {unknown} [options.manager] - OrderManager for the window exclusion (same
1150
1150
  * set the placement pickers exclude); omit to fall back to the previous
1151
1151
  * exclusion-free classification (fail-open)
1152
- * @returns {string[]} Refill slot ids (CREATE ids minus reserve edge ids)
1152
+ * @returns {string[]} Refill slot ids (CREATE ids minus edge ids)
1153
1153
  */
1154
1154
  declare function collectRefillSlotIds(actions: CowAction[], options?: {
1155
- config?: ReserveConfig | null;
1155
+ config?: OrderConfigView | null;
1156
1156
  slots?: unknown;
1157
1157
  edgeAnchors?: {
1158
1158
  buy?: number | null;
@@ -1161,7 +1161,7 @@ declare function collectRefillSlotIds(actions: CowAction[], options?: {
1161
1161
  manager?: OrderManagerLike | null;
1162
1162
  }): string[];
1163
1163
  /**
1164
- * Resolved bound anchor for reserve edges from CONFIG alone.
1164
+ * Resolved bound anchor for edges from CONFIG alone.
1165
1165
  * BUY floor anchors toward minPrice (dip-insurance end), SELL ceiling toward
1166
1166
  * maxPrice (spike-insurance end). Resolves numeric and "Nx" relative forms
1167
1167
  * via resolveConfiguredPriceBound (startPrice-referenced); falls back to the
@@ -1169,18 +1169,18 @@ declare function collectRefillSlotIds(actions: CowAction[], options?: {
1169
1169
  *
1170
1170
  * Known limit: this is the statically resolved config bound, not the
1171
1171
  * gridPrice/AMA-referenced live rail bound. Placement call sites should use
1172
- * resolveLiveReserveEdgeAnchorPrice(manager, side), which prefers the genesis
1172
+ * resolveLiveEdgeAnchorPrice(manager, side), which prefers the genesis
1173
1173
  * ladder extreme and returns null when there is no usable ladder. Callers that
1174
- * need a fallback (e.g. reserveEdgeIdSet) still resolve this config bound when
1174
+ * need a fallback (e.g. edgeOrderIdSet) still resolve this config bound when
1175
1175
  * the live anchor is null; the live resolver itself no longer computes it.
1176
1176
  *
1177
1177
  * @param {Object} config - Bot configuration
1178
1178
  * @param {string} side - 'buy' or 'sell'
1179
1179
  * @returns {number|null} Finite anchor price, or null
1180
1180
  */
1181
- declare function resolveReserveEdgeAnchorPrice(config: ReserveConfig | null | undefined, side: string): number | null;
1182
- /** Manager surface the live reserve-edge anchor reads (structural view). */
1183
- type ReserveEdgeAnchorManager = {
1181
+ declare function resolveEdgeAnchorPrice(config: OrderConfigView | null | undefined, side: string): number | null;
1182
+ /** Manager surface the live edge anchor reads (structural view). */
1183
+ type EdgeAnchorManager = {
1184
1184
  _genesis?: {
1185
1185
  priceLevels?: readonly unknown[];
1186
1186
  } | null;
@@ -1192,7 +1192,7 @@ type ReserveEdgeAnchorManager = {
1192
1192
  config?: unknown;
1193
1193
  };
1194
1194
  /**
1195
- * Live-grid reserve edge anchor (single source for edge placement).
1195
+ * Live-grid edge anchor (single source for edge placement).
1196
1196
  *
1197
1197
  * The anchor must come from the geometry the bot is actually trading, never
1198
1198
  * from a config value that can be a mode string ("pool"/"book"), a relative
@@ -1210,7 +1210,7 @@ type ReserveEdgeAnchorManager = {
1210
1210
  * paper over. The former tiers — the live in-rail slot extreme and the resolved
1211
1211
  * config bound — are gone with the legacy matcher they only existed to cover;
1212
1212
  * any config-bound fallback is now resolved by the individual consumer that
1213
- * wants one (see reserveEdgeIdSet), not by this live-edge resolver. The fault
1213
+ * wants one (see edgeOrderIdSet), not by this live-edge resolver. The fault
1214
1214
  * itself is reported
1215
1215
  * once per grid generation by the sync-entry gate; this resolver stays silent
1216
1216
  * because it is called from per-fill and per-placement paths.
@@ -1219,9 +1219,9 @@ type ReserveEdgeAnchorManager = {
1219
1219
  * @param {string} side - 'buy' or 'sell'
1220
1220
  * @returns {number|null} Finite anchor price, or null
1221
1221
  */
1222
- declare function resolveLiveReserveEdgeAnchorPrice(manager: ReserveEdgeAnchorManager | null | undefined, side: unknown): number | null;
1222
+ declare function resolveLiveEdgeAnchorPrice(manager: EdgeAnchorManager | null | undefined, side: unknown): number | null;
1223
1223
  /**
1224
- * Shared anchored edge comparator for reserve selection (single source).
1224
+ * Shared anchored edge comparator for edge selection (single source).
1225
1225
  * With a finite anchor: in-bound slots first, nearest the anchor first
1226
1226
  * (floor ascending, ceiling descending); stale out-of-bound slots last,
1227
1227
  * still nearest the anchor first. Without one: plain rank fallback
@@ -1233,36 +1233,36 @@ declare function resolveLiveReserveEdgeAnchorPrice(manager: ReserveEdgeAnchorMan
1233
1233
  * @param {number|null} anchorPrice - Resolved bound anchor (null = rank fallback)
1234
1234
  * @returns {number} Comparator result for Array.prototype.sort
1235
1235
  */
1236
- declare function compareReserveEdge(a: SlotLike, b: SlotLike, edge: string, anchorPrice: number | null): number;
1236
+ declare function compareEdge(a: SlotLike, b: SlotLike, edge: string, anchorPrice: number | null): number;
1237
1237
  /**
1238
- * Central edge selector: take reserve slots from a price-ascending list,
1238
+ * Central edge selector: take edge slots from a price-ascending list,
1239
1239
  * skipping already-windowed ids. Both edges anchor at the live grid's own
1240
- * edge (resolveLiveReserveEdgeAnchorPrice) when finite — floor: nearest
1240
+ * edge (resolveLiveEdgeAnchorPrice) when finite — floor: nearest
1241
1241
  * at/above the live floor first, slots below it rank last; ceiling: nearest
1242
1242
  * at/below the live ceiling first, slots above it rank last. Anchoring to the
1243
- * live edge keeps the reserve on genuine live-rail slots when the grid still
1243
+ * live edge keeps the edge order on genuine live-rail slots when the grid still
1244
1244
  * carries leftovers from an older bound or the configured bound disagrees
1245
1245
  * with the geometry being traded. Callers pre-filter rail/type and apply
1246
1246
  * their own size gates; this only picks positions. A null anchor degrades to
1247
1247
  * plain rank (floor: lowest first; ceiling: highest first).
1248
1248
  *
1249
1249
  * @param {Array<Object>} sortedAsc - Slots sorted by price ascending
1250
- * @param {number} count - Reserve count
1250
+ * @param {number} count - Edge count
1251
1251
  * @param {Set<string>|null} excludeIds - Windowed ids to skip
1252
1252
  * @param {string} edge - 'floor' or 'ceiling'
1253
1253
  * @param {number|null} [anchorPrice] - Live edge anchor for the side (null = rank-based)
1254
- * @returns {Array<Object>} Reserve slots (ascending for floor, descending for ceiling)
1254
+ * @returns {Array<Object>} Edge slots (ascending for floor, descending for ceiling)
1255
1255
  */
1256
- declare function selectReserveEdgeSlots<T extends SlotLike>(sortedAsc: T[], count: number, excludeIds: Set<string> | null, edge: string, anchorPrice?: number | null): T[];
1256
+ declare function selectEdgeSlots<T extends SlotLike>(sortedAsc: T[], count: number, excludeIds: Set<string> | null, edge: string, anchorPrice?: number | null): T[];
1257
1257
  /**
1258
1258
  * Total target order count across both sides (used for BTS fee calculation).
1259
1259
  * Single source of truth so every budget derivation sizes identically.
1260
- * Includes per-side reserves: they rest live on-chain and pay creation fees.
1260
+ * Includes per-side edge orders: they rest live on-chain and pay creation fees.
1261
1261
  *
1262
1262
  * @param {Object} config - Bot configuration
1263
1263
  * @returns {number} Total target order count
1264
1264
  */
1265
- declare function getActiveOrdersTotal(config: ReserveConfig | null | undefined): number;
1265
+ declare function getCoreOrdersTotal(config: OrderConfigView | null | undefined): number;
1266
1266
  /**
1267
1267
  * Calculate side budget after BTS fee deduction.
1268
1268
  *
@@ -1272,7 +1272,7 @@ declare function getActiveOrdersTotal(config: ReserveConfig | null | undefined):
1272
1272
  * @param {number} totalTarget - Total target order count (used for BTS fee calculation on both sides)
1273
1273
  * @returns {number} Available budget for the side
1274
1274
  */
1275
- declare function getSideBudget(side: string, funds: ManagerFundsLike | ProjectedFunds | null, config: ReserveConfig, totalTarget: number): number;
1275
+ declare function getSideBudget(side: string, funds: ManagerFundsLike | ProjectedFunds | null, config: OrderConfigView, totalTarget: number): number;
1276
1276
  /**
1277
1277
  * Calculate sizes for all slots on a side using weighted distribution.
1278
1278
  *
@@ -1358,6 +1358,6 @@ declare function collectKnownOnChainOrderIds(mgr: OrderManagerLike, placedResult
1358
1358
  createIds: string[];
1359
1359
  all: string[];
1360
1360
  };
1361
- export { parseChainOrder, applyChainSizeToGridOrder, buildFillKey, correctOrderPriceOnChain, correctAllPriceMismatches, _validatePriceCorrectionEntry, _stampCorrectionProvenance, findLiveOrderOwnerByChainId, buildCreateOrderArgs, getOrderTypeFromUpdatedFlags, resolveConfiguredPriceBound, virtualizeOrder, convertToSpreadPlaceholder, toRailHolePlaceholder, geometryTypeForSlotIndex, detectGapEvacuationCandidates, updateGapEvacuationStreaks, resolveSpreadOrderSide, chainOrderMatchesSlot, chainOrderMatchesSlotWithTolerance, crossingCandidateChainId, isCrossingCheckCandidate, buildCrossingCheckCandidates, parseSlotIndex, filterOrdersByType, buildOutsideInPairGroups, extractBatchOperationResults, formatUnmatchedChainOrder, isNonBlockingUnmatchedOrder, isStrandedHoldOrder, isOrderOnChain, isOrderVirtual, hasOnChainId, isOrderPlaced, isPhantomOrder, isSlotAvailable, isEmptyGridSlot, isOrderHealthy, checkSizeThreshold, checkSizesBeforeMinimum, calculateIdealBoundary, assignGridRoles, resolveOnChainRetypeType, shouldFlagOutOfSpread, buildIndexes, validateIndexes, ordersEqual, buildDelta, deriveTargetBoundary, isShiftEligibleFill, resolveReserveCount, resolveReserveOrders, selectReserveEdgeSlots, getActiveOrdersTotal, getSideBudget, calculateBudgetedSizes, buildCreateOpFingerprint, isOrderGoneErrorMessage, recordDuplicateOrphanDetection, clearDuplicateOrphanDetection, duplicateOrphanLogInfo, chainOrderUnchangedFromCache, detectCrossedBookPlan, collectKnownOnChainOrderIds, reserveEdgeIdSet, liveWindowIdSet, checkGridPriceInvariant, reportGridPriceInvariant };
1362
- export { resolveReserveEdgeAnchorPrice, resolveLiveReserveEdgeAnchorPrice, compareReserveEdge, collectRefillSlotIds, recordOrderPlacement, isFreshlyPlacedOrder, _filterUnmatchedChainOrders };
1361
+ export { parseChainOrder, applyChainSizeToGridOrder, buildFillKey, correctOrderPriceOnChain, correctAllPriceMismatches, _validatePriceCorrectionEntry, _stampCorrectionProvenance, findLiveOrderOwnerByChainId, buildCreateOrderArgs, getOrderTypeFromUpdatedFlags, resolveConfiguredPriceBound, virtualizeOrder, convertToSpreadPlaceholder, toRailHolePlaceholder, geometryTypeForSlotIndex, detectGapEvacuationCandidates, updateGapEvacuationStreaks, resolveSpreadOrderSide, chainOrderMatchesSlot, chainOrderMatchesSlotWithTolerance, crossingCandidateChainId, isCrossingCheckCandidate, buildCrossingCheckCandidates, parseSlotIndex, filterOrdersByType, buildOutsideInPairGroups, extractBatchOperationResults, formatUnmatchedChainOrder, isNonBlockingUnmatchedOrder, isStrandedHoldOrder, isOrderOnChain, isOrderVirtual, hasOnChainId, isOrderPlaced, isPhantomOrder, isSlotAvailable, isEmptyGridSlot, isOrderHealthy, checkSizeThreshold, checkSizesBeforeMinimum, calculateIdealBoundary, assignGridRoles, resolveOnChainRetypeType, shouldFlagOutOfSpread, buildIndexes, validateIndexes, ordersEqual, buildDelta, deriveTargetBoundary, isShiftEligibleFill, resolveEdgeCount, resolveEdgeOrders, selectEdgeSlots, getCoreOrdersTotal, getSideBudget, calculateBudgetedSizes, buildCreateOpFingerprint, isOrderGoneErrorMessage, recordDuplicateOrphanDetection, clearDuplicateOrphanDetection, duplicateOrphanLogInfo, chainOrderUnchangedFromCache, detectCrossedBookPlan, collectKnownOnChainOrderIds, edgeOrderIdSet, liveWindowIdSet, checkGridPriceInvariant, reportGridPriceInvariant };
1362
+ export { resolveEdgeAnchorPrice, resolveLiveEdgeAnchorPrice, compareEdge, collectRefillSlotIds, recordOrderPlacement, isFreshlyPlacedOrder, _filterUnmatchedChainOrders };
1363
1363
  //# sourceMappingURL=order.d.ts.map