From 42a090c8764a49939c83548694b2c2944441bb98 Mon Sep 17 00:00:00 2001 From: phroi <90913182+phroi@users.noreply.github.com> Date: Sun, 9 Aug 2026 17:24:15 +0200 Subject: [PATCH 001/232] chore: snapshot pre-rewrite baseline Full working-tree state of the wip restructure before the planned library rewrite. Review findings and the design blueprint that motivate the rewrite are under docs/reviews/ (2026-08-09 snapshots). --- .dependency-cruiser.jsonc | 77 + .github/workflows/check.yaml | 19 +- .gitignore | 9 +- .prettierignore | 13 + PRODUCT.md | 33 + README.md | 54 +- apps/bot/README.md | 276 +- apps/bot/docs/current_rebalancing_policy.md | 133 +- apps/bot/package.json | 36 +- apps/bot/src/index.test.ts | 868 --- apps/bot/src/index.ts | 455 +- apps/bot/src/observability.test.ts | 693 --- apps/bot/src/observability.ts | 355 -- apps/bot/src/policy.test.ts | 1216 ----- apps/bot/src/policy.ts | 479 -- apps/bot/src/runtime.ts | 573 -- apps/bot/src/withdrawal_selection.ts | 808 --- apps/bot/test/index.ts | 405 ++ apps/bot/tsconfig.build.json | 9 - apps/bot/tsconfig.json | 8 +- apps/bot/vitest.config.mts | 4 +- apps/interface/.github/workflows/deploy.yml | 62 - apps/interface/.gitignore | 2 +- apps/interface/README.md | 16 +- apps/interface/eslint.config.mjs | 31 - apps/interface/eslint.config.mts | 18 + apps/interface/index.css | 107 +- apps/interface/index.html | 348 +- apps/interface/package.json | 45 +- apps/interface/src/Action.tsx | 229 - apps/interface/src/App.tsx | 106 - apps/interface/src/Connector.test.ts | 32 - apps/interface/src/Connector.tsx | 81 - apps/interface/src/Dashboard.tsx | 37 - apps/interface/src/Form.tsx | 137 - apps/interface/src/Progress.tsx | 42 - apps/interface/src/action/Action.tsx | 393 ++ apps/interface/src/action/ActionLayout.tsx | 80 + apps/interface/src/action/actionStatus.ts | 262 + apps/interface/src/action/actionTime.ts | 24 + .../interface/src/action/actionTransaction.ts | 280 + apps/interface/src/action/transaction.ts | 122 + apps/interface/src/app/App.tsx | 103 + apps/interface/src/app/ErrorBoundary.tsx | 47 + apps/interface/src/app/Interface.tsx | 41 + apps/interface/src/app/interfaceConfig.ts | 56 + apps/interface/src/app/lazyInterface.ts | 15 + apps/interface/src/app/loadInterface.tsx | 34 + apps/interface/src/{ => app}/vite-env.d.ts | 0 apps/interface/src/chart/rateChart.tsx | 92 + apps/interface/src/chart/rateChartData.ts | 125 + apps/interface/src/chart/rateChartLayout.tsx | 95 + apps/interface/src/chart/rateChartScale.ts | 25 + apps/interface/src/chart/rateChartText.ts | 78 + apps/interface/src/chart/rateChartView.ts | 112 + apps/interface/src/connectorQueryKey.ts | 34 - apps/interface/src/main.tsx | 60 +- apps/interface/src/queries.test.ts | 227 - apps/interface/src/queries.ts | 236 - apps/interface/src/query/l1StateQueryKey.ts | 14 + .../src/query/pendingTransactionQuery.ts | 238 + apps/interface/src/query/queries.ts | 140 + apps/interface/src/query/queryStateId.ts | 180 + apps/interface/src/query/quoteState.ts | 35 + .../interface/src/query/rootConfigQueryKey.ts | 41 + .../src/query/walletConfigQueryKey.ts | 40 + apps/interface/src/shared/buttonStyles.ts | 2 + apps/interface/src/shared/quote.ts | 60 + apps/interface/src/shared/utils.ts | 184 + apps/interface/src/transaction.test.ts | 277 - apps/interface/src/transaction.ts | 112 - apps/interface/src/utils.test.ts | 27 - apps/interface/src/utils.ts | 146 - apps/interface/src/view/Dashboard.tsx | 155 + apps/interface/src/view/Form.tsx | 186 + apps/interface/src/view/WalletAppView.tsx | 86 + .../interface/src/view/WalletHeaderPortal.tsx | 11 + apps/interface/src/view/WalletSections.tsx | 21 + apps/interface/src/view/formState.ts | 95 + apps/interface/src/view/staticWalletApp.tsx | 70 + .../interface/src/wallet/WalletConfigGate.tsx | 107 + .../src/wallet/WalletConfigPendingView.tsx | 69 + apps/interface/src/wallet/WalletGate.tsx | 106 + apps/interface/src/wallet/cccConnection.ts | 73 + apps/interface/src/wallet/chain.ts | 16 + .../interface/src/wallet/interfaceLanding.tsx | 104 + apps/interface/src/wallet/walletGateState.ts | 53 + .../src/wallet/walletGateSupport.tsx | 60 + apps/interface/tailwind.config.ts | 9 - apps/interface/test/action/actionStatus.ts | 244 + .../test/action/actionTransaction.ts | 686 +++ .../test/action/fixtures/transaction.ts | 192 + apps/interface/test/action/transaction.ts | 214 + apps/interface/test/app/actionStrictMode.tsx | 372 ++ apps/interface/test/app/fixtures/mount.ts | 24 + .../interface/test/app/interfaceLazyRetry.tsx | 66 + apps/interface/test/app/main.ts | 82 + .../test/app/pendingTransactionRemount.tsx | 306 ++ apps/interface/test/app/transactionIntent.tsx | 146 + apps/interface/test/app/viteConfig.ts | 57 + apps/interface/test/app/walletAppMount.ts | 14 + .../test/browser/LiveTestnetWalletHarness.tsx | 85 + apps/interface/test/hook/appAction.tsx | 532 ++ apps/interface/test/hook/fixtures/data.ts | 188 + .../test/hook/fixtures/environment.ts | 275 + apps/interface/test/hook/fixtures/modules.ts | 55 + apps/interface/test/hook/interfaceRuntime.tsx | 116 + apps/interface/test/hook/walletConfigGate.tsx | 75 + apps/interface/test/hook/walletGate.tsx | 207 + apps/interface/test/query/fixtures/query.ts | 96 + .../test/query/pendingTransaction.ts | 297 ++ apps/interface/test/query/queries.ts | 273 + apps/interface/test/query/queryStateId.ts | 135 + .../test/query/rootConfigQueryKey.ts | 40 + .../test/query/walletConfigQueryKey.ts | 33 + .../interface/test/shared/fixtures/storage.ts | 15 + .../test/shared/fixtures/transaction.ts | 16 + apps/interface/test/shared/quote.ts | 74 + apps/interface/test/shared/utils.ts | 90 + apps/interface/test/support/react.ts | 68 + apps/interface/test/support/reactNode.ts | 20 + apps/interface/test/view/Dashboard.ts | 32 + apps/interface/test/view/Form.ts | 101 + apps/interface/test/view/components.tsx | 421 ++ apps/interface/test/view/fixtures/modules.ts | 24 + apps/interface/test/view/rateChart.ts | 158 + apps/interface/test/wallet/cccConnection.ts | 83 + apps/interface/test/wallet/chain.ts | 14 + apps/interface/test/wallet/fixtures/signer.ts | 15 + apps/interface/test/wallet/signer.ts | 12 + apps/interface/tsconfig.json | 11 +- apps/interface/tsconfig.node.json | 8 +- apps/interface/vite.config.ts | 110 +- apps/interface/vitest.config.mts | 4 +- apps/sampler/README.md | 8 +- apps/sampler/package.json | 26 +- apps/sampler/rate.csv | 27 - apps/sampler/src/index.test.ts | 116 - apps/sampler/src/index.ts | 155 +- apps/sampler/test/index.ts | 341 ++ apps/sampler/tsconfig.build.json | 9 - apps/sampler/tsconfig.json | 7 +- apps/sampler/vitest.config.mts | 4 +- apps/supervisor/README.md | 111 - apps/supervisor/package.json | 51 - apps/supervisor/src/index.test.ts | 3434 ------------ apps/supervisor/src/index.ts | 2504 --------- apps/supervisor/tsconfig.build.json | 9 - apps/supervisor/tsconfig.json | 11 - apps/tester/.gitignore | 1 - apps/tester/.npmignore | 1 - apps/tester/README.md | 83 - apps/tester/package.json | 59 - apps/tester/src/freshMatchableOrderSkip.ts | 69 - apps/tester/src/index.test.ts | 973 ---- apps/tester/src/index.ts | 976 ---- apps/tester/src/runtime.test.ts | 337 -- apps/tester/src/runtime.ts | 106 - apps/tester/tsconfig.build.json | 9 - apps/tester/tsconfig.json | 10 - apps/validation/package.json | 24 + apps/validation/src/liveBotStimulusTest.ts | 42 + apps/validation/src/supervisor.ts | 31 + apps/validation/src/tester.ts | 132 + apps/validation/test/entrypoints.ts | 378 ++ .../fixtures/testerStdoutPressureProcess.ts | 18 + .../test/fixtures/twoPassTesterProcess.ts | 84 + apps/validation/test/processBoundary.ts | 207 + apps/validation/tsconfig.json | 8 + .../vitest.config.mts | 4 +- docs/lint-policy-map.md | 105 + docs/reviews/2026-07-16T22-11-21Z-cycle-01.md | 172 + docs/reviews/2026-07-17T01-55-21Z-cycle-02.md | 101 + ...07-17T03-44-39Z-snapshot-current-review.md | 66 + ...07-17T03-47-16Z-snapshot-ponytail-audit.md | 53 + ...52-33Z-snapshot-baseline-implementation.md | 41 + ...-58-01Z-snapshot-scalpel-implementation.md | 43 + ...5Z-snapshot-fable-method-implementation.md | 59 + ...Z-snapshot-fable-scalpel-implementation.md | 54 + ...26-07-17T04-37-54Z-snapshot-fable-judge.md | 60 + docs/reviews/2026-07-17T06-08-14Z-cycle-03.md | 99 + docs/reviews/2026-07-17T09-22-26Z-cycle-04.md | 73 + ...-17T17-46-56Z-snapshot-full-fable-judge.md | 68 + ...T18-32-02Z-snapshot-thin-claim-verifier.md | 74 + docs/reviews/2026-07-17T18-48-46Z-cycle-05.md | 87 + ...49Z-snapshot-ponytail-operational-audit.md | 110 + ...snapshot-integrated-fablify-interrupted.md | 117 + docs/reviews/2026-07-18T00-29-02Z-cycle-06.md | 51 + docs/reviews/2026-07-18T01-16-46Z-cycle-07.md | 108 + docs/reviews/2026-07-18T13-40-18Z-cycle-08.md | 83 + docs/reviews/2026-07-18T17-07-55Z-cycle-09.md | 47 + docs/reviews/2026-07-18T20-38-02Z-cycle-10.md | 75 + docs/reviews/2026-07-19T00-17-49Z-cycle-11.md | 83 + docs/reviews/2026-07-19T23-34-06Z-cycle-12.md | 83 + docs/reviews/2026-07-21T16-01-14Z-cycle-13.md | 93 + docs/reviews/2026-07-21T16-55-44Z-cycle-14.md | 76 + docs/reviews/2026-07-21T20-20-03Z-cycle-15.md | 64 + docs/reviews/2026-07-21T23-48-31Z-cycle-16.md | 71 + docs/reviews/2026-07-22T03-15-35Z-cycle-17.md | 102 + docs/reviews/2026-07-22T06-34-14Z-cycle-18.md | 90 + docs/reviews/2026-07-22T14-07-28Z-cycle-19.md | 139 + docs/reviews/2026-07-22T17-30-47Z-cycle-20.md | 74 + docs/reviews/2026-07-22T20-37-23Z-cycle-21.md | 34 + docs/reviews/2026-07-22T23-40-00Z-cycle-22.md | 28 + docs/reviews/2026-07-23T02-42-10Z-cycle-23.md | 28 + ...53Z-snapshot-whole-repo-parallel-review.md | 140 + ...-09T01-08-17Z-snapshot-design-blueprint.md | 285 + eslint.config.mjs | 38 - eslint.config.mts | 519 ++ knip.jsonc | 18 + package.json | 80 +- packages/bot/package.json | 51 + packages/bot/src/bot/failure.ts | 242 + packages/bot/src/bot/loop.ts | 415 ++ packages/bot/src/bot/state.ts | 48 + packages/bot/src/index.ts | 21 + packages/bot/src/observability/artifacts.ts | 232 + packages/bot/src/observability/error.ts | 134 + packages/bot/src/observability/events.ts | 319 ++ packages/bot/src/observability/logValue.ts | 62 + packages/bot/src/observability/rbf.ts | 15 + packages/bot/src/policy.ts | 80 + packages/bot/src/policy/constants.ts | 6 + packages/bot/src/policy/ring.ts | 220 + packages/bot/src/policy/types.ts | 102 + packages/bot/src/policy/withdrawal.ts | 229 + packages/bot/src/runtime/audit.ts | 130 + packages/bot/src/runtime/decision.ts | 159 + packages/bot/src/runtime/support.ts | 173 + packages/bot/src/runtime/transaction.ts | 360 ++ packages/bot/src/runtime/types.ts | 279 + packages/bot/test/bot/config.ts | 72 + packages/bot/test/bot/failure.ts | 192 + packages/bot/test/bot/fixtures/bot.ts | 322 ++ packages/bot/test/bot/loop.ts | 591 +++ packages/bot/test/bot/outputBoundary.ts | 62 + packages/bot/test/bot/state.ts | 133 + packages/bot/test/observability/artifacts.ts | 271 + packages/bot/test/observability/decision.ts | 238 + packages/bot/test/observability/error.ts | 281 + packages/bot/test/observability/events.ts | 346 ++ .../observability/fixtures/observability.ts | 193 + packages/bot/test/policy/balance.ts | 450 ++ packages/bot/test/policy/fixtures/policy.ts | 145 + packages/bot/test/policy/ringBootstrap.ts | 246 + packages/bot/test/policy/ringReserve.ts | 171 + packages/bot/test/policy/ringWithdrawal.ts | 157 + packages/bot/test/policy/withdrawalLimits.ts | 196 + .../bot/test/policy/withdrawalRecovery.ts | 106 + .../bot/test/policy/withdrawalSelection.ts | 217 + packages/bot/test/runtime/support.ts | 36 + packages/bot/test/transactions/deposit.ts | 216 + packages/bot/test/transactions/match.ts | 569 ++ packages/bot/test/transactions/reserve.ts | 246 + packages/bot/test/transactions/withdrawal.ts | 211 + packages/bot/tsconfig.json | 8 + packages/bot/vitest.config.mts | 11 + packages/core/package.json | 3 +- packages/core/src/entities.ts | 96 +- packages/core/src/index.ts | 10 +- packages/core/src/logic.ts | 24 +- packages/core/src/owned_owner.ts | 45 +- packages/core/src/udt.ts | 59 +- packages/core/test/index.ts | 25 + packages/core/test/logic/logic.ts | 17 +- packages/core/test/logic/logic_receipts.ts | 17 + packages/core/test/logic/logic_validation.ts | 50 +- .../core/test/logic/support/logic_support.ts | 4 - packages/core/test/owned_owner/owned_owner.ts | 8 + .../owned_owner_find_concurrency.ts | 69 + .../test/owned_owner/owned_owner_request.ts | 153 +- .../owned_owner_request_anchors.ts | 38 +- packages/core/test/udt/udt_complete.ts | 33 +- packages/core/vitest.config.mts | 2 +- packages/dao/package.json | 3 +- packages/dao/src/cells.ts | 37 +- packages/dao/src/dao.ts | 88 +- packages/dao/src/dao_output_limit.ts | 40 +- packages/dao/src/index.ts | 4 +- packages/dao/test/dao.ts | 251 +- packages/dao/test/index.ts | 4 + packages/dao/test/withdraw.ts | 83 +- packages/dao/vitest.config.mts | 2 +- packages/node-utils/README.md | 4 +- packages/node-utils/package.json | 8 +- packages/node-utils/src/account.ts | 24 +- packages/node-utils/src/chain.ts | 50 +- packages/node-utils/src/index.ts | 31 +- packages/node-utils/src/path.ts | 44 + packages/node-utils/src/process.ts | 507 ++ packages/node-utils/src/retryable.ts | 19 +- packages/node-utils/src/runtime_config.ts | 24 +- packages/node-utils/test/account.ts | 21 + packages/node-utils/test/chain.ts | 115 +- .../test/fixtures/httpPublicClientProcess.ts | 32 + packages/node-utils/test/process.ts | 368 ++ packages/node-utils/test/retryable.ts | 7 + packages/node-utils/test/runtime_config.ts | 37 +- packages/node-utils/tsconfig.build.json | 13 - packages/node-utils/vitest.config.mts | 2 +- packages/order/README.md | 12 +- packages/order/package.json | 3 +- packages/order/src/index.ts | 19 +- packages/order/src/io/order_io.ts | 7 +- packages/order/src/io/order_scan.ts | 33 +- packages/order/src/io/order_transaction.ts | 67 +- packages/order/src/matching/match_types.ts | 65 +- .../order/src/matching/order_match_context.ts | 70 +- .../order/src/matching/order_match_search.ts | 601 ++- .../src/matching/order_match_sequence.ts | 264 +- .../src/matching/order_match_uniqueness.ts | 4 +- packages/order/src/matching/order_matcher.ts | 26 +- packages/order/src/matching/order_matching.ts | 33 +- packages/order/src/model/cells.ts | 145 +- packages/order/src/model/info.ts | 70 +- packages/order/src/model/order_data.ts | 60 +- packages/order/src/model/ratio.ts | 72 +- packages/order/src/model/relative.ts | 52 +- packages/order/src/order.ts | 56 +- packages/order/test/index.ts | 37 +- .../order/test/matching/order_cell_resolve.ts | 100 +- .../matching/order_manager_transaction.ts | 431 +- .../test/matching/order_matcher_best_match.ts | 230 +- .../test/matching/order_matcher_budget.ts | 552 ++ .../order/test/matching/order_matcher_caps.ts | 171 +- .../test/matching/order_matcher_conversion.ts | 58 +- .../matching/order_matcher_diagnostics.ts | 316 +- .../matching/support/order_match_helpers.ts | 192 +- .../order/test/order_boundary_validation.ts | 62 + packages/order/test/order_entities.ts | 259 +- .../order/test/scan/order_find_orders_scan.ts | 20 +- .../order/test/scan/order_resolve_group.ts | 42 +- packages/order/vitest.config.mts | 2 +- packages/sdk/README.md | 12 +- packages/sdk/docs/pool_maturity_estimates.md | 2 + packages/sdk/package.json | 3 +- packages/sdk/src/client/sdk_base.ts | 137 +- .../sdk/src/client/sdk_conversion_class.ts | 116 +- packages/sdk/src/client/sdk_error.ts | 16 +- packages/sdk/src/client/sdk_l1_class.ts | 180 +- packages/sdk/src/client/sdk_state_store.ts | 15 - packages/sdk/src/client/sdk_types.ts | 29 +- .../src/conversion/sdk_conversion_plans.ts | 80 +- .../sdk/src/conversion/sdk_value_helpers.ts | 20 +- packages/sdk/src/estimate/sdk_maturity.ts | 16 +- packages/sdk/src/index.ts | 12 +- packages/sdk/src/sdk.ts | 130 +- packages/sdk/src/send/send_and_wait.ts | 343 -- packages/sdk/src/send/send_and_wait_error.ts | 31 - .../sdk/src/send/sign_and_send_transaction.ts | 67 + packages/sdk/src/send/wait_transaction.ts | 365 ++ .../sdk/src/withdrawal/withdrawal_best_fit.ts | 113 +- .../withdrawal/withdrawal_best_fit_support.ts | 7 +- .../src/withdrawal/withdrawal_ring_core.ts | 7 +- .../src/withdrawal/withdrawal_selection.ts | 207 +- .../withdrawal/withdrawal_selection_types.ts | 12 - packages/sdk/test/constants.ts | 43 +- ...onversion_bounded_fee_precision_failure.ts | 8 +- ...version_ckb_to_ickb_construction_errors.ts | 17 +- ...uild_conversion_ckb_to_ickb_deposit_cap.ts | 10 +- ...conversion_ckb_to_ickb_deposit_priority.ts | 32 +- ...nversion_ckb_to_ickb_output_limit_retry.ts | 199 +- ...onversion_fee_precision_uint64_failures.ts | 10 +- ...ion_ickb_to_ckb_output_limit_exhaustion.ts | 32 +- .../support/sdk_fixture_support.ts | 25 +- ...ersion_activity_and_tiny_order_failures.ts | 143 +- ...onversion_construction_failure_messages.ts | 89 - .../build_conversion_dao_output_accounting.ts | 15 +- ...rsion_ready_withdrawal_nonready_anchors.ts | 42 +- ...rsion_ready_withdrawal_required_anchors.ts | 42 +- .../sdk_conversion_planning_helpers.ts | 43 +- .../test/conversion/planning/sdk_helpers.ts | 13 + .../planning/support/sdk_order_support.ts | 67 +- ...rsion_ickb_to_ckb_deposit_amount_filter.ts | 11 +- ...ion_ickb_to_ckb_direct_surplus_priority.ts | 11 +- ...rsion_ickb_to_ckb_dust_remainder_orders.ts | 48 +- ...version_ickb_to_ckb_nonretryable_errors.ts | 10 +- ...nversion_ickb_to_ckb_output_limit_retry.ts | 11 +- ...rsion_ickb_to_ckb_quote_preserving_dust.ts | 49 +- .../estimate/estimate_dust_order_previews.ts | 68 +- .../estimate/ickb_sdk_maturity_calculation.ts | 14 +- .../estimate/sdk_maturity_guard_helpers.ts | 3 +- packages/sdk/test/index.ts | 32 +- packages/sdk/test/sdk_error.ts | 25 - ..._commit_success_and_prebroadcast_events.ts | 193 - ...send_and_wait_confirmation_timeout_hash.ts | 67 - ...nd_and_wait_lifecycle_callback_failures.ts | 73 - ...nd_and_wait_polling_failure_unconfirmed.ts | 57 - ...nd_and_wait_post_broadcast_poll_timeout.ts | 66 - ...and_wait_terminal_status_cache_clearing.ts | 90 - ..._wait_timeout_proven_after_pending_poll.ts | 64 - .../test/send/sign_and_send_transaction.ts | 132 + .../send/support/sdk_send_wait_support.ts | 108 - packages/sdk/test/send/wait_transaction.ts | 811 +++ .../project_conversion_transaction_context.ts | 1 + .../account/sdk_projection_value_helpers.ts | 5 - .../l1_account/account_state_exact_scans.ts | 117 + ..._size.ts => l1_account_state_page_size.ts} | 33 +- ...state_bot_capacity_withdrawal_page_size.ts | 2 +- .../l1_state_bot_withdrawal_scan_failure.ts | 28 +- .../l1_pool/l1_state_fee_rate_statistics.ts | 94 + .../l1_state_pool_deposit_scan_options.ts | 16 + ...ate_user_order_liquidity_classification.ts | 4 +- .../state/l1_pool/support/l1_pool_support.ts | 2 +- ...transaction_balanced_withdrawal_request.ts | 51 +- ...se_transaction_deposit_after_withdrawal.ts | 48 +- .../build_base_transaction_manager_effects.ts | 60 +- ...action_withdrawal_before_input_activity.ts | 15 +- .../base/support/sdk_core_support.ts | 1 + ...transaction_fee_change_fallback_rebuild.ts | 165 +- ...transaction_fee_change_target_selection.ts | 4 - ...transaction_fee_rate_and_change_routing.ts | 34 +- ...mplete_transaction_fee_retry_boundaries.ts | 3 - .../complete/support/sdk_suite_titles.ts | 2 +- .../withdrawal/withdrawal_best_fit_support.ts | 9 +- .../withdrawal/withdrawal_selection_direct.ts | 196 +- packages/sdk/tsconfig.json | 1 + packages/sdk/vitest.config.mts | 2 +- packages/testkit/src/index.ts | 45 +- packages/testkit/vitest.config.mts | 2 +- packages/utils/README.md | 8 + packages/utils/package.json | 3 +- packages/utils/src/codec.ts | 52 +- packages/utils/src/index.ts | 13 +- packages/utils/src/utils.ts | 187 +- packages/utils/test/codec.ts | 46 +- packages/utils/test/index.ts | 1 + packages/utils/test/utils.ts | 186 +- packages/utils/vitest.config.mts | 2 +- packages/validation/package.json | 35 + packages/validation/src/index.ts | 10 + packages/validation/src/supervisor/README.md | 129 + .../src/supervisor/args/supervisorArgs.ts | 271 + .../src/supervisor/args/supervisorCli.ts | 68 + .../src/supervisor/args/supervisorPaths.ts | 181 + .../supervisorArtifactCommandShape.ts | 21 + .../artifacts/supervisorArtifacts.ts | 336 ++ .../artifacts/supervisorOutputDirectory.ts | 86 + .../supervisorBotClassificationA.ts | 328 ++ .../supervisorBotClassificationB.ts | 535 ++ .../supervisorBotFailureClassification.ts | 139 + .../supervisorClassification.ts | 119 + .../classification/supervisorClassifyUtils.ts | 238 + packages/validation/src/supervisor/index.ts | 33 + .../preflight/supervisorPreflightBudget.ts | 102 + .../supervisorPreflightClassification.ts | 50 + .../preflight/supervisorPreflightFinish.ts | 97 + .../preflight/supervisorPreflightRetry.ts | 104 + .../preflight/supervisorPreflightRun.ts | 138 + .../preflight/supervisorPreflightState.ts | 125 + .../preflight/supervisorPreflightStep.ts | 96 + .../runtime/actor/supervisorActorCommand.ts | 70 + .../runtime/actor/supervisorActorRun.ts | 421 ++ .../runtime/actor/supervisorActorState.ts | 96 + .../runtime/actor/supervisorCycleRun.ts | 106 + .../runtime/command/supervisorCommandRun.ts | 100 + .../runtime/dry-run/supervisorDryRun.ts | 146 + .../dry-run/supervisorDryRunSamples.ts | 42 + .../runtime/shared/supervisorConstants.ts | 248 + .../runtime/shared/supervisorCoverage.ts | 282 + .../runtime/shared/supervisorEvidence.ts | 182 + .../runtime/shared/supervisorMainRun.ts | 122 + .../runtime/shared/supervisorPublicState.ts | 147 + .../runtime/shared/supervisorStops.ts | 234 + .../runtime/shared/supervisorSummary.ts | 119 + .../runtime/shared/supervisorTypes.ts | 325 ++ .../artifacts/liveBotStimulusArtifacts.ts | 165 + .../artifacts/liveBotStimulusPaths.ts | 120 + .../preflight/liveBotStimulusPreflight.ts | 273 + .../preflight/liveBotStimulusPrepare.ts | 310 ++ .../runtime/liveBotStimulusSession.ts | 163 + .../runtime/liveBotStimulusTesterRun.ts | 167 + .../stimulus/runtime/liveBotStimulusWait.ts | 367 ++ .../runtime/liveBotStimulusWaitAfter.ts | 173 + .../selection/liveBotStimulusEventScan.ts | 593 +++ .../selection/liveBotStimulusSelection.ts | 208 + .../stimulus/shared/liveBotStimulusArgs.ts | 258 + .../shared/liveBotStimulusConstants.ts | 85 + .../stimulus/shared/liveBotStimulusMain.ts | 116 + .../stimulus/shared/liveBotStimulusTest.ts | 13 + .../stimulus/shared/liveBotStimulusTypes.ts | 222 + .../stimulus/shared/liveBotStimulusUtils.ts | 139 + .../stimulus/shared/stimulusArithmetic.ts | 61 + .../tester/supervisorTesterClassification.ts | 314 ++ .../tester/supervisorTesterEvidence.ts | 277 + .../tester/evidence/testerAttemptEvidence.ts | 71 + .../src/tester/evidence/testerEvidence.ts | 261 + .../src/tester/evidence/testerReserve.ts | 88 + packages/validation/src/tester/index.ts | 34 + .../tester/planning/testerAttemptEstimate.ts | 40 + .../tester/planning/testerAttemptPlanning.ts | 263 + .../src/tester/planning/testerConfig.ts | 85 + .../tester/planning/testerOrderPlanning.ts | 196 + .../src/tester/planning/testerPlanning.ts | 134 + .../tester/planning/testerRandomPlanning.ts | 134 + .../tester/planning/testerScenarioPlans.ts | 204 + .../src/tester/planning/testerSdkPlanning.ts | 110 + .../tester/runtime/freshMatchableOrderSkip.ts | 107 + .../validation/src/tester/runtime/runtime.ts | 174 + .../src/tester/runtime/testerAttempt.ts | 232 + .../src/tester/runtime/testerErrors.ts | 134 + .../src/tester/runtime/testerLoop.ts | 152 + .../src/tester/runtime/testerStop.ts | 16 + .../src/tester/runtime/testerTypes.ts | 108 + packages/validation/src/testerContract.ts | 128 + packages/validation/test/index.ts | 57 + ...rIndexActorExitPrecedenceClassification.ts | 252 + .../actor/supervisorIndexActorTimerLimits.ts | 119 + .../supervisorIndexActorWallClockTimeouts.ts | 239 + ...visorIndexBotCommitActionClassification.ts | 374 ++ ...IndexBotIterationEvidenceClassification.ts | 217 + ...orIndexBotSkipAndNoActionClassification.ts | 290 + ...tTimeoutAndMatchEconomicsClassification.ts | 266 + ...sorIndexCliActorSignalAndTargetSteering.ts | 155 + .../supervisorIndexCliArgumentValidation.ts | 278 + .../supervisorIndexCliArtifactPathSafety.ts | 257 + ...ervisorIndexCliLivePreflightRequirement.ts | 58 + .../supervisorIndexCliOrderTargetSteering.ts | 168 + ...sorIndexCliTesterScenarioAndFeeControls.ts | 155 + ...IndexCliFreshSkipHighCkbAndConfigSafety.ts | 302 ++ ...pervisorIndexCliFreshSkipLowCkbStimulus.ts | 154 + ...sorIndexPreflightEvidenceClassification.ts | 167 + ...supervisorIndexPreflightEvidenceParsing.ts | 55 + ...pervisorIndexPreflightRetryAndArtifacts.ts | 189 + ...supervisorIndexPreflightWallClockBudget.ts | 257 + ...isorIndexTesterConversionClassification.ts | 273 + ...ndexTesterFailureEvidenceClassification.ts | 220 + ...rIndexTesterOrderScenarioClassification.ts | 220 + ...supervisorIndexTxHashEvidencePrecedence.ts | 233 + .../cli/liveBotStimulusCliArguments.ts | 91 + .../liveBotStimulusCommitFailureBoundaries.ts | 253 + .../liveBotStimulusLauncherEventTail.ts | 142 + .../runtime/liveBotStimulusLiveBotWait.ts | 477 ++ .../liveBotStimulusMatchedOrderCommit.ts | 84 + .../liveBotStimulusCkbToIckbSelection.ts | 77 + .../liveBotStimulusCorrelatedMatchScan.ts | 166 + .../liveBotStimulusIckbToCkbSelection.ts | 50 + .../liveBotStimulusPreflightBalances.ts | 35 + .../liveBotStimulusTesterOrderMatch.ts | 124 + .../support/stimulus/liveBotStimulus.ts | 137 + .../stimulus/liveBotStimulusFixture.ts | 371 ++ .../stimulus/liveBotStimulusRuntimeImports.ts | 42 + .../stimulus/liveBotStimulusSessionImports.ts | 36 + .../supervisor/support/supervisor/index.ts | 5 + .../supervisor/supervisorIndexAssertions.ts | 133 + .../supervisorIndexCommandFixtures.ts | 284 + .../supervisor/supervisorIndexConstants.ts | 161 + .../supervisorIndexProcessFixtures.ts | 258 + .../supervisor/supervisorIndexRunFixtures.ts | 139 + .../test/support/runtime/runtime.ts | 199 + .../runtime/runtimeDefaultSdkFixture.ts | 80 + .../validation/test/support/tester/index.ts | 4 + .../support/tester/testerFreshFixtures.ts | 63 + .../support/tester/testerIndexConstants.ts | 27 + .../support/tester/testerOrderFixtures.ts | 259 + .../support/tester/testerStateFixtures.ts | 78 + .../tester/testerTransactionFixtures.ts | 12 + .../test/tester/evidence/testerEvidence.ts | 388 ++ .../test/tester/evidence/testerFailure.ts | 333 ++ .../test/tester/evidence/testerReserve.ts | 223 + .../tester/planning/testerPlanningAuto.ts | 209 + .../tester/planning/testerPlanningCore.ts | 269 + .../tester/planning/testerPlanningFunded.ts | 110 + .../tester/planning/testerPlanningMixed.ts | 113 + .../tester/planning/testerPlanningRandom.ts | 366 ++ .../runtime/attempt/attemptSendReserve.ts | 338 ++ .../tester/runtime/attempt/attemptSkips.ts | 178 + .../test/tester/runtime/attempt/loopErrors.ts | 146 + .../runtime/attempt/planningLowCapital.ts | 94 + .../tester/runtime/attempt/planningSkips.ts | 78 + .../runtime/attempt/planningTransactions.ts | 102 + .../test/tester/runtime/attempt/sdkFixture.ts | 98 + .../test/tester/runtime/attempt/support.ts | 49 + .../tester/runtime/core/runtimeConversion.ts | 78 + .../test/tester/runtime/core/runtimeState.ts | 103 + .../tester/runtime/core/runtimeTransaction.ts | 115 + .../test/tester/runtime/core/testerConfig.ts | 217 + .../tester/runtime/core/testerFreshOrder.ts | 339 ++ packages/validation/tsconfig.json | 8 + .../validation}/vitest.config.mts | 7 +- patches/@joyid__ckb@1.1.4.patch | 116 + pnpm-lock.yaml | 4656 ++++++++--------- pnpm-workspace.yaml | 63 +- prettier.config.mts | 6 + scripts/bot/collect-incident.ts | 9 + scripts/bot/incident/args.ts | 150 + scripts/bot/incident/bundle.ts | 85 + scripts/bot/incident/index.ts | 65 + scripts/bot/incident/io/filesystem.ts | 298 ++ scripts/bot/incident/io/version.ts | 70 + scripts/bot/incident/model/constants.ts | 12 + scripts/bot/incident/model/paths.ts | 77 + scripts/bot/incident/model/text.ts | 48 + scripts/bot/incident/model/types.ts | 244 + scripts/bot/incident/source/artifacts.ts | 261 + scripts/bot/incident/source/collection.ts | 59 + scripts/bot/incident/source/discovery.ts | 93 + scripts/bot/incident/source/filter.ts | 228 + scripts/bot/incident/source/summary.ts | 397 ++ scripts/bot/launcher.ts | 14 + scripts/bot/launcher/args.ts | 71 + scripts/bot/launcher/index.ts | 66 + scripts/bot/launcher/io.ts | 178 + scripts/bot/launcher/logs.ts | 256 + scripts/bot/launcher/paths.ts | 48 + scripts/bot/launcher/runtime/constants.ts | 13 + scripts/bot/launcher/runtime/execute.ts | 136 + scripts/bot/launcher/runtime/process.ts | 219 + scripts/bot/launcher/runtime/records.ts | 112 + scripts/bot/launcher/runtime/spawn.ts | 71 + scripts/bot/launcher/runtime/support.ts | 23 + scripts/bot/launcher/runtime/types.ts | 247 + scripts/bot/launcher/storage/filesystem.ts | 126 + scripts/bot/launcher/storage/metadata.ts | 24 + scripts/bot/launcher/storage/prepare.ts | 55 + scripts/ickb-bot-collect-incident.mjs | 822 --- scripts/ickb-bot-collect-incident.test.mjs | 574 -- scripts/ickb-bot-launcher.mjs | 455 -- scripts/ickb-bot-launcher.test.mjs | 393 -- scripts/ickb-bot-systemd-credential.sh | 50 +- scripts/ickb-bot-systemd-credential.test.mjs | 68 - scripts/ickb-bot-systemd-install.sh | 573 +- scripts/ickb-bot-systemd-install.test.mjs | 96 - scripts/ickb-bot-systemd-update.sh | 645 ++- scripts/ickb-bot-systemd-update.test.mjs | 270 - scripts/ickb-generate-config.mjs | 384 -- scripts/ickb-generate-config.test.mjs | 381 -- scripts/ickb-live-config-from-env.mjs | 418 -- scripts/ickb-live-config-from-env.test.mjs | 647 --- scripts/ickb-live-config-git.mjs | 18 - scripts/ickb-live-config-git.test.mjs | 48 - scripts/ickb-live-preflight.mjs | 355 -- scripts/ickb-live-preflight.test.mjs | 533 -- scripts/ickb-script-helpers.mjs | 31 - scripts/ickb-supervisor-dynamic-loop.mjs | 637 --- scripts/ickb-supervisor-dynamic-loop.test.mjs | 705 --- scripts/ickb-supervisor-loop.mjs | 569 -- scripts/ickb-supervisor-loop.test.mjs | 656 --- scripts/lint-source-structure.ts | 3 + scripts/live/config-from-env.ts | 9 + scripts/live/config/config-from-env.ts | 507 ++ scripts/live/config/generate-config-args.ts | 249 + scripts/live/config/generate-config-files.ts | 244 + scripts/live/config/generate-config.ts | 118 + scripts/live/config/git.ts | 46 + scripts/live/generate-config.ts | 9 + scripts/live/preflight.ts | 9 + scripts/live/preflight/args.ts | 49 + scripts/live/preflight/errors.ts | 43 + scripts/live/preflight/main.ts | 45 + scripts/live/preflight/paths.ts | 79 + scripts/live/preflight/report.ts | 340 ++ scripts/live/preflight/run.ts | 120 + scripts/run-node-tests.ts | 54 + scripts/supervisor/dynamic-loop-cli.ts | 9 + scripts/supervisor/dynamic-loop.ts | 12 + scripts/supervisor/dynamic-loop/args.ts | 288 + scripts/supervisor/dynamic-loop/command.ts | 98 + scripts/supervisor/dynamic-loop/model.ts | 252 + scripts/supervisor/dynamic-loop/preflight.ts | 198 + scripts/supervisor/dynamic-loop/runtime.ts | 498 ++ scripts/supervisor/dynamic-loop/scenario.ts | 34 + scripts/supervisor/dynamic-loop/session.ts | 313 ++ scripts/supervisor/helpers.ts | 54 + scripts/supervisor/loop-cli.ts | 9 + scripts/supervisor/loop.ts | 15 + scripts/supervisor/loop/args.ts | 149 + scripts/supervisor/loop/command.ts | 119 + scripts/supervisor/loop/model.ts | 227 + scripts/supervisor/loop/output.ts | 134 + scripts/supervisor/loop/paths.ts | 120 + scripts/supervisor/loop/runtime.ts | 341 ++ scripts/supervisor/loop/summary.ts | 217 + scripts/test/bot/incident/artifacts.ts | 244 + scripts/test/bot/incident/core.ts | 376 ++ scripts/test/bot/incident/paths.ts | 133 + scripts/test/bot/incident/support.ts | 478 ++ scripts/test/bot/launcher/failures.ts | 524 ++ scripts/test/bot/launcher/logs.ts | 280 + scripts/test/bot/launcher/support.ts | 242 + scripts/test/bot/systemd-credential.ts | 276 + scripts/test/bot/systemd-install.ts | 279 + scripts/test/bot/systemd-update.ts | 621 +++ scripts/test/build/native-source-smoke.ts | 122 + scripts/test/build/rewrite-dts-imports.ts | 76 + .../test/live/config/config-from-env-files.ts | 151 + .../live/config/config-from-env-support.ts | 238 + scripts/test/live/config/config-from-env.ts | 270 + .../test/live/config/generate-config-files.ts | 188 + scripts/test/live/config/generate-config.ts | 211 + scripts/test/live/config/git.ts | 75 + scripts/test/live/preflight/cli.ts | 52 + scripts/test/live/preflight/failures.ts | 161 + scripts/test/live/preflight/paths.ts | 156 + scripts/test/live/preflight/report.ts | 190 + scripts/test/live/preflight/support.ts | 284 + scripts/test/supervisor/dynamic-loop/args.ts | 283 + .../test/supervisor/dynamic-loop/chunks.ts | 349 ++ .../test/supervisor/dynamic-loop/guards.ts | 278 + .../supervisor/dynamic-loop/inspection.ts | 329 ++ .../test/supervisor/dynamic-loop/session.ts | 256 + .../test/supervisor/dynamic-loop/support.ts | 330 ++ scripts/test/supervisor/loop/args-summary.ts | 408 ++ scripts/test/supervisor/loop/command.ts | 137 + scripts/test/supervisor/loop/evidence.ts | 367 ++ scripts/test/supervisor/loop/runtime.ts | 274 + scripts/test/supervisor/loop/support.ts | 190 + .../tooling/eslint/finite-transaction-wait.ts | 35 + .../lint/source-structure/package-policy.ts | 42 + .../source-structure/repository-policy.ts | 131 + .../lint/source-structure/source-policy.ts | 51 + .../lint/source-structure/test-policy.ts | 110 + scripts/tooling/eslint-plugin-types.d.ts | 22 + scripts/tooling/eslint/plugins.ts | 23 + .../tooling/lint/source-structure/format.ts | 175 + .../tooling/lint/source-structure/model.ts | 95 + .../tooling/lint/source-structure/packages.ts | 318 ++ .../lint/source-structure/policy/common.ts | 31 + .../lint/source-structure/policy/source.ts | 186 + .../lint/source-structure/policy/test.ts | 448 ++ .../lint/source-structure/public-api.ts | 386 ++ .../lint/source-structure/repository.ts | 545 ++ scripts/tooling/lint/source-structure/run.ts | 74 + .../tooling/lint/source-structure/source.ts | 82 + tsconfig.json | 30 +- vitest.config.mts | 22 +- 726 files changed, 83536 insertions(+), 31324 deletions(-) create mode 100644 .dependency-cruiser.jsonc create mode 100644 .prettierignore create mode 100644 PRODUCT.md delete mode 100644 apps/bot/src/index.test.ts delete mode 100644 apps/bot/src/observability.test.ts delete mode 100644 apps/bot/src/observability.ts delete mode 100644 apps/bot/src/policy.test.ts delete mode 100644 apps/bot/src/policy.ts delete mode 100644 apps/bot/src/runtime.ts delete mode 100644 apps/bot/src/withdrawal_selection.ts create mode 100644 apps/bot/test/index.ts delete mode 100644 apps/bot/tsconfig.build.json delete mode 100644 apps/interface/.github/workflows/deploy.yml delete mode 100644 apps/interface/eslint.config.mjs create mode 100644 apps/interface/eslint.config.mts delete mode 100644 apps/interface/src/Action.tsx delete mode 100644 apps/interface/src/App.tsx delete mode 100644 apps/interface/src/Connector.test.ts delete mode 100644 apps/interface/src/Connector.tsx delete mode 100644 apps/interface/src/Dashboard.tsx delete mode 100644 apps/interface/src/Form.tsx delete mode 100644 apps/interface/src/Progress.tsx create mode 100644 apps/interface/src/action/Action.tsx create mode 100644 apps/interface/src/action/ActionLayout.tsx create mode 100644 apps/interface/src/action/actionStatus.ts create mode 100644 apps/interface/src/action/actionTime.ts create mode 100644 apps/interface/src/action/actionTransaction.ts create mode 100644 apps/interface/src/action/transaction.ts create mode 100644 apps/interface/src/app/App.tsx create mode 100644 apps/interface/src/app/ErrorBoundary.tsx create mode 100644 apps/interface/src/app/Interface.tsx create mode 100644 apps/interface/src/app/interfaceConfig.ts create mode 100644 apps/interface/src/app/lazyInterface.ts create mode 100644 apps/interface/src/app/loadInterface.tsx rename apps/interface/src/{ => app}/vite-env.d.ts (100%) create mode 100644 apps/interface/src/chart/rateChart.tsx create mode 100644 apps/interface/src/chart/rateChartData.ts create mode 100644 apps/interface/src/chart/rateChartLayout.tsx create mode 100644 apps/interface/src/chart/rateChartScale.ts create mode 100644 apps/interface/src/chart/rateChartText.ts create mode 100644 apps/interface/src/chart/rateChartView.ts delete mode 100644 apps/interface/src/connectorQueryKey.ts delete mode 100644 apps/interface/src/queries.test.ts delete mode 100644 apps/interface/src/queries.ts create mode 100644 apps/interface/src/query/l1StateQueryKey.ts create mode 100644 apps/interface/src/query/pendingTransactionQuery.ts create mode 100644 apps/interface/src/query/queries.ts create mode 100644 apps/interface/src/query/queryStateId.ts create mode 100644 apps/interface/src/query/quoteState.ts create mode 100644 apps/interface/src/query/rootConfigQueryKey.ts create mode 100644 apps/interface/src/query/walletConfigQueryKey.ts create mode 100644 apps/interface/src/shared/buttonStyles.ts create mode 100644 apps/interface/src/shared/quote.ts create mode 100644 apps/interface/src/shared/utils.ts delete mode 100644 apps/interface/src/transaction.test.ts delete mode 100644 apps/interface/src/transaction.ts delete mode 100644 apps/interface/src/utils.test.ts delete mode 100644 apps/interface/src/utils.ts create mode 100644 apps/interface/src/view/Dashboard.tsx create mode 100644 apps/interface/src/view/Form.tsx create mode 100644 apps/interface/src/view/WalletAppView.tsx create mode 100644 apps/interface/src/view/WalletHeaderPortal.tsx create mode 100644 apps/interface/src/view/WalletSections.tsx create mode 100644 apps/interface/src/view/formState.ts create mode 100644 apps/interface/src/view/staticWalletApp.tsx create mode 100644 apps/interface/src/wallet/WalletConfigGate.tsx create mode 100644 apps/interface/src/wallet/WalletConfigPendingView.tsx create mode 100644 apps/interface/src/wallet/WalletGate.tsx create mode 100644 apps/interface/src/wallet/cccConnection.ts create mode 100644 apps/interface/src/wallet/chain.ts create mode 100644 apps/interface/src/wallet/interfaceLanding.tsx create mode 100644 apps/interface/src/wallet/walletGateState.ts create mode 100644 apps/interface/src/wallet/walletGateSupport.tsx delete mode 100644 apps/interface/tailwind.config.ts create mode 100644 apps/interface/test/action/actionStatus.ts create mode 100644 apps/interface/test/action/actionTransaction.ts create mode 100644 apps/interface/test/action/fixtures/transaction.ts create mode 100644 apps/interface/test/action/transaction.ts create mode 100644 apps/interface/test/app/actionStrictMode.tsx create mode 100644 apps/interface/test/app/fixtures/mount.ts create mode 100644 apps/interface/test/app/interfaceLazyRetry.tsx create mode 100644 apps/interface/test/app/main.ts create mode 100644 apps/interface/test/app/pendingTransactionRemount.tsx create mode 100644 apps/interface/test/app/transactionIntent.tsx create mode 100644 apps/interface/test/app/viteConfig.ts create mode 100644 apps/interface/test/app/walletAppMount.ts create mode 100644 apps/interface/test/browser/LiveTestnetWalletHarness.tsx create mode 100644 apps/interface/test/hook/appAction.tsx create mode 100644 apps/interface/test/hook/fixtures/data.ts create mode 100644 apps/interface/test/hook/fixtures/environment.ts create mode 100644 apps/interface/test/hook/fixtures/modules.ts create mode 100644 apps/interface/test/hook/interfaceRuntime.tsx create mode 100644 apps/interface/test/hook/walletConfigGate.tsx create mode 100644 apps/interface/test/hook/walletGate.tsx create mode 100644 apps/interface/test/query/fixtures/query.ts create mode 100644 apps/interface/test/query/pendingTransaction.ts create mode 100644 apps/interface/test/query/queries.ts create mode 100644 apps/interface/test/query/queryStateId.ts create mode 100644 apps/interface/test/query/rootConfigQueryKey.ts create mode 100644 apps/interface/test/query/walletConfigQueryKey.ts create mode 100644 apps/interface/test/shared/fixtures/storage.ts create mode 100644 apps/interface/test/shared/fixtures/transaction.ts create mode 100644 apps/interface/test/shared/quote.ts create mode 100644 apps/interface/test/shared/utils.ts create mode 100644 apps/interface/test/support/react.ts create mode 100644 apps/interface/test/support/reactNode.ts create mode 100644 apps/interface/test/view/Dashboard.ts create mode 100644 apps/interface/test/view/Form.ts create mode 100644 apps/interface/test/view/components.tsx create mode 100644 apps/interface/test/view/fixtures/modules.ts create mode 100644 apps/interface/test/view/rateChart.ts create mode 100644 apps/interface/test/wallet/cccConnection.ts create mode 100644 apps/interface/test/wallet/chain.ts create mode 100644 apps/interface/test/wallet/fixtures/signer.ts create mode 100644 apps/interface/test/wallet/signer.ts delete mode 100644 apps/sampler/rate.csv delete mode 100644 apps/sampler/src/index.test.ts create mode 100644 apps/sampler/test/index.ts delete mode 100644 apps/sampler/tsconfig.build.json delete mode 100644 apps/supervisor/README.md delete mode 100644 apps/supervisor/package.json delete mode 100644 apps/supervisor/src/index.test.ts delete mode 100644 apps/supervisor/src/index.ts delete mode 100644 apps/supervisor/tsconfig.build.json delete mode 100644 apps/supervisor/tsconfig.json delete mode 100644 apps/tester/.gitignore delete mode 100644 apps/tester/.npmignore delete mode 100644 apps/tester/README.md delete mode 100644 apps/tester/package.json delete mode 100644 apps/tester/src/freshMatchableOrderSkip.ts delete mode 100644 apps/tester/src/index.test.ts delete mode 100644 apps/tester/src/index.ts delete mode 100644 apps/tester/src/runtime.test.ts delete mode 100644 apps/tester/src/runtime.ts delete mode 100644 apps/tester/tsconfig.build.json delete mode 100644 apps/tester/tsconfig.json create mode 100644 apps/validation/package.json create mode 100644 apps/validation/src/liveBotStimulusTest.ts create mode 100644 apps/validation/src/supervisor.ts create mode 100644 apps/validation/src/tester.ts create mode 100644 apps/validation/test/entrypoints.ts create mode 100644 apps/validation/test/fixtures/testerStdoutPressureProcess.ts create mode 100644 apps/validation/test/fixtures/twoPassTesterProcess.ts create mode 100644 apps/validation/test/processBoundary.ts create mode 100644 apps/validation/tsconfig.json rename apps/{supervisor => validation}/vitest.config.mts (62%) create mode 100644 docs/lint-policy-map.md create mode 100644 docs/reviews/2026-07-16T22-11-21Z-cycle-01.md create mode 100644 docs/reviews/2026-07-17T01-55-21Z-cycle-02.md create mode 100644 docs/reviews/2026-07-17T03-44-39Z-snapshot-current-review.md create mode 100644 docs/reviews/2026-07-17T03-47-16Z-snapshot-ponytail-audit.md create mode 100644 docs/reviews/2026-07-17T03-52-33Z-snapshot-baseline-implementation.md create mode 100644 docs/reviews/2026-07-17T03-58-01Z-snapshot-scalpel-implementation.md create mode 100644 docs/reviews/2026-07-17T04-15-35Z-snapshot-fable-method-implementation.md create mode 100644 docs/reviews/2026-07-17T04-26-09Z-snapshot-fable-scalpel-implementation.md create mode 100644 docs/reviews/2026-07-17T04-37-54Z-snapshot-fable-judge.md create mode 100644 docs/reviews/2026-07-17T06-08-14Z-cycle-03.md create mode 100644 docs/reviews/2026-07-17T09-22-26Z-cycle-04.md create mode 100644 docs/reviews/2026-07-17T17-46-56Z-snapshot-full-fable-judge.md create mode 100644 docs/reviews/2026-07-17T18-32-02Z-snapshot-thin-claim-verifier.md create mode 100644 docs/reviews/2026-07-17T18-48-46Z-cycle-05.md create mode 100644 docs/reviews/2026-07-17T19-01-49Z-snapshot-ponytail-operational-audit.md create mode 100644 docs/reviews/2026-07-17T23-04-27Z-snapshot-integrated-fablify-interrupted.md create mode 100644 docs/reviews/2026-07-18T00-29-02Z-cycle-06.md create mode 100644 docs/reviews/2026-07-18T01-16-46Z-cycle-07.md create mode 100644 docs/reviews/2026-07-18T13-40-18Z-cycle-08.md create mode 100644 docs/reviews/2026-07-18T17-07-55Z-cycle-09.md create mode 100644 docs/reviews/2026-07-18T20-38-02Z-cycle-10.md create mode 100644 docs/reviews/2026-07-19T00-17-49Z-cycle-11.md create mode 100644 docs/reviews/2026-07-19T23-34-06Z-cycle-12.md create mode 100644 docs/reviews/2026-07-21T16-01-14Z-cycle-13.md create mode 100644 docs/reviews/2026-07-21T16-55-44Z-cycle-14.md create mode 100644 docs/reviews/2026-07-21T20-20-03Z-cycle-15.md create mode 100644 docs/reviews/2026-07-21T23-48-31Z-cycle-16.md create mode 100644 docs/reviews/2026-07-22T03-15-35Z-cycle-17.md create mode 100644 docs/reviews/2026-07-22T06-34-14Z-cycle-18.md create mode 100644 docs/reviews/2026-07-22T14-07-28Z-cycle-19.md create mode 100644 docs/reviews/2026-07-22T17-30-47Z-cycle-20.md create mode 100644 docs/reviews/2026-07-22T20-37-23Z-cycle-21.md create mode 100644 docs/reviews/2026-07-22T23-40-00Z-cycle-22.md create mode 100644 docs/reviews/2026-07-23T02-42-10Z-cycle-23.md create mode 100644 docs/reviews/2026-08-09T00-33-53Z-snapshot-whole-repo-parallel-review.md create mode 100644 docs/reviews/2026-08-09T01-08-17Z-snapshot-design-blueprint.md delete mode 100644 eslint.config.mjs create mode 100644 eslint.config.mts create mode 100644 knip.jsonc create mode 100644 packages/bot/package.json create mode 100644 packages/bot/src/bot/failure.ts create mode 100644 packages/bot/src/bot/loop.ts create mode 100644 packages/bot/src/bot/state.ts create mode 100644 packages/bot/src/index.ts create mode 100644 packages/bot/src/observability/artifacts.ts create mode 100644 packages/bot/src/observability/error.ts create mode 100644 packages/bot/src/observability/events.ts create mode 100644 packages/bot/src/observability/logValue.ts create mode 100644 packages/bot/src/observability/rbf.ts create mode 100644 packages/bot/src/policy.ts create mode 100644 packages/bot/src/policy/constants.ts create mode 100644 packages/bot/src/policy/ring.ts create mode 100644 packages/bot/src/policy/types.ts create mode 100644 packages/bot/src/policy/withdrawal.ts create mode 100644 packages/bot/src/runtime/audit.ts create mode 100644 packages/bot/src/runtime/decision.ts create mode 100644 packages/bot/src/runtime/support.ts create mode 100644 packages/bot/src/runtime/transaction.ts create mode 100644 packages/bot/src/runtime/types.ts create mode 100644 packages/bot/test/bot/config.ts create mode 100644 packages/bot/test/bot/failure.ts create mode 100644 packages/bot/test/bot/fixtures/bot.ts create mode 100644 packages/bot/test/bot/loop.ts create mode 100644 packages/bot/test/bot/outputBoundary.ts create mode 100644 packages/bot/test/bot/state.ts create mode 100644 packages/bot/test/observability/artifacts.ts create mode 100644 packages/bot/test/observability/decision.ts create mode 100644 packages/bot/test/observability/error.ts create mode 100644 packages/bot/test/observability/events.ts create mode 100644 packages/bot/test/observability/fixtures/observability.ts create mode 100644 packages/bot/test/policy/balance.ts create mode 100644 packages/bot/test/policy/fixtures/policy.ts create mode 100644 packages/bot/test/policy/ringBootstrap.ts create mode 100644 packages/bot/test/policy/ringReserve.ts create mode 100644 packages/bot/test/policy/ringWithdrawal.ts create mode 100644 packages/bot/test/policy/withdrawalLimits.ts create mode 100644 packages/bot/test/policy/withdrawalRecovery.ts create mode 100644 packages/bot/test/policy/withdrawalSelection.ts create mode 100644 packages/bot/test/runtime/support.ts create mode 100644 packages/bot/test/transactions/deposit.ts create mode 100644 packages/bot/test/transactions/match.ts create mode 100644 packages/bot/test/transactions/reserve.ts create mode 100644 packages/bot/test/transactions/withdrawal.ts create mode 100644 packages/bot/tsconfig.json create mode 100644 packages/bot/vitest.config.mts create mode 100644 packages/node-utils/src/path.ts create mode 100644 packages/node-utils/src/process.ts create mode 100644 packages/node-utils/test/fixtures/httpPublicClientProcess.ts create mode 100644 packages/node-utils/test/process.ts delete mode 100644 packages/node-utils/tsconfig.build.json create mode 100644 packages/order/test/matching/order_matcher_budget.ts create mode 100644 packages/order/test/order_boundary_validation.ts delete mode 100644 packages/sdk/src/client/sdk_state_store.ts delete mode 100644 packages/sdk/src/send/send_and_wait.ts delete mode 100644 packages/sdk/src/send/send_and_wait_error.ts create mode 100644 packages/sdk/src/send/sign_and_send_transaction.ts create mode 100644 packages/sdk/src/send/wait_transaction.ts delete mode 100644 packages/sdk/test/conversion/planning/build_conversion_construction_failure_messages.ts delete mode 100644 packages/sdk/test/sdk_error.ts delete mode 100644 packages/sdk/test/send/send_and_wait_commit_success_and_prebroadcast_events.ts delete mode 100644 packages/sdk/test/send/send_and_wait_confirmation_timeout_hash.ts delete mode 100644 packages/sdk/test/send/send_and_wait_lifecycle_callback_failures.ts delete mode 100644 packages/sdk/test/send/send_and_wait_polling_failure_unconfirmed.ts delete mode 100644 packages/sdk/test/send/send_and_wait_post_broadcast_poll_timeout.ts delete mode 100644 packages/sdk/test/send/send_and_wait_terminal_status_cache_clearing.ts delete mode 100644 packages/sdk/test/send/send_and_wait_timeout_proven_after_pending_poll.ts create mode 100644 packages/sdk/test/send/sign_and_send_transaction.ts delete mode 100644 packages/sdk/test/send/support/sdk_send_wait_support.ts create mode 100644 packages/sdk/test/send/wait_transaction.ts create mode 100644 packages/sdk/test/state/l1_account/account_state_exact_scans.ts rename packages/sdk/test/state/l1_account/{l1_account_state_tip_assertion_and_page_size.ts => l1_account_state_page_size.ts} (74%) create mode 100644 packages/sdk/test/state/l1_pool/l1_state_fee_rate_statistics.ts create mode 100644 packages/validation/package.json create mode 100644 packages/validation/src/index.ts create mode 100644 packages/validation/src/supervisor/README.md create mode 100644 packages/validation/src/supervisor/args/supervisorArgs.ts create mode 100644 packages/validation/src/supervisor/args/supervisorCli.ts create mode 100644 packages/validation/src/supervisor/args/supervisorPaths.ts create mode 100644 packages/validation/src/supervisor/artifacts/supervisorArtifactCommandShape.ts create mode 100644 packages/validation/src/supervisor/artifacts/supervisorArtifacts.ts create mode 100644 packages/validation/src/supervisor/artifacts/supervisorOutputDirectory.ts create mode 100644 packages/validation/src/supervisor/classification/supervisorBotClassificationA.ts create mode 100644 packages/validation/src/supervisor/classification/supervisorBotClassificationB.ts create mode 100644 packages/validation/src/supervisor/classification/supervisorBotFailureClassification.ts create mode 100644 packages/validation/src/supervisor/classification/supervisorClassification.ts create mode 100644 packages/validation/src/supervisor/classification/supervisorClassifyUtils.ts create mode 100644 packages/validation/src/supervisor/index.ts create mode 100644 packages/validation/src/supervisor/preflight/supervisorPreflightBudget.ts create mode 100644 packages/validation/src/supervisor/preflight/supervisorPreflightClassification.ts create mode 100644 packages/validation/src/supervisor/preflight/supervisorPreflightFinish.ts create mode 100644 packages/validation/src/supervisor/preflight/supervisorPreflightRetry.ts create mode 100644 packages/validation/src/supervisor/preflight/supervisorPreflightRun.ts create mode 100644 packages/validation/src/supervisor/preflight/supervisorPreflightState.ts create mode 100644 packages/validation/src/supervisor/preflight/supervisorPreflightStep.ts create mode 100644 packages/validation/src/supervisor/runtime/actor/supervisorActorCommand.ts create mode 100644 packages/validation/src/supervisor/runtime/actor/supervisorActorRun.ts create mode 100644 packages/validation/src/supervisor/runtime/actor/supervisorActorState.ts create mode 100644 packages/validation/src/supervisor/runtime/actor/supervisorCycleRun.ts create mode 100644 packages/validation/src/supervisor/runtime/command/supervisorCommandRun.ts create mode 100644 packages/validation/src/supervisor/runtime/dry-run/supervisorDryRun.ts create mode 100644 packages/validation/src/supervisor/runtime/dry-run/supervisorDryRunSamples.ts create mode 100644 packages/validation/src/supervisor/runtime/shared/supervisorConstants.ts create mode 100644 packages/validation/src/supervisor/runtime/shared/supervisorCoverage.ts create mode 100644 packages/validation/src/supervisor/runtime/shared/supervisorEvidence.ts create mode 100644 packages/validation/src/supervisor/runtime/shared/supervisorMainRun.ts create mode 100644 packages/validation/src/supervisor/runtime/shared/supervisorPublicState.ts create mode 100644 packages/validation/src/supervisor/runtime/shared/supervisorStops.ts create mode 100644 packages/validation/src/supervisor/runtime/shared/supervisorSummary.ts create mode 100644 packages/validation/src/supervisor/runtime/shared/supervisorTypes.ts create mode 100644 packages/validation/src/supervisor/stimulus/artifacts/liveBotStimulusArtifacts.ts create mode 100644 packages/validation/src/supervisor/stimulus/artifacts/liveBotStimulusPaths.ts create mode 100644 packages/validation/src/supervisor/stimulus/preflight/liveBotStimulusPreflight.ts create mode 100644 packages/validation/src/supervisor/stimulus/preflight/liveBotStimulusPrepare.ts create mode 100644 packages/validation/src/supervisor/stimulus/runtime/liveBotStimulusSession.ts create mode 100644 packages/validation/src/supervisor/stimulus/runtime/liveBotStimulusTesterRun.ts create mode 100644 packages/validation/src/supervisor/stimulus/runtime/liveBotStimulusWait.ts create mode 100644 packages/validation/src/supervisor/stimulus/runtime/liveBotStimulusWaitAfter.ts create mode 100644 packages/validation/src/supervisor/stimulus/selection/liveBotStimulusEventScan.ts create mode 100644 packages/validation/src/supervisor/stimulus/selection/liveBotStimulusSelection.ts create mode 100644 packages/validation/src/supervisor/stimulus/shared/liveBotStimulusArgs.ts create mode 100644 packages/validation/src/supervisor/stimulus/shared/liveBotStimulusConstants.ts create mode 100644 packages/validation/src/supervisor/stimulus/shared/liveBotStimulusMain.ts create mode 100644 packages/validation/src/supervisor/stimulus/shared/liveBotStimulusTest.ts create mode 100644 packages/validation/src/supervisor/stimulus/shared/liveBotStimulusTypes.ts create mode 100644 packages/validation/src/supervisor/stimulus/shared/liveBotStimulusUtils.ts create mode 100644 packages/validation/src/supervisor/stimulus/shared/stimulusArithmetic.ts create mode 100644 packages/validation/src/supervisor/tester/supervisorTesterClassification.ts create mode 100644 packages/validation/src/supervisor/tester/supervisorTesterEvidence.ts create mode 100644 packages/validation/src/tester/evidence/testerAttemptEvidence.ts create mode 100644 packages/validation/src/tester/evidence/testerEvidence.ts create mode 100644 packages/validation/src/tester/evidence/testerReserve.ts create mode 100644 packages/validation/src/tester/index.ts create mode 100644 packages/validation/src/tester/planning/testerAttemptEstimate.ts create mode 100644 packages/validation/src/tester/planning/testerAttemptPlanning.ts create mode 100644 packages/validation/src/tester/planning/testerConfig.ts create mode 100644 packages/validation/src/tester/planning/testerOrderPlanning.ts create mode 100644 packages/validation/src/tester/planning/testerPlanning.ts create mode 100644 packages/validation/src/tester/planning/testerRandomPlanning.ts create mode 100644 packages/validation/src/tester/planning/testerScenarioPlans.ts create mode 100644 packages/validation/src/tester/planning/testerSdkPlanning.ts create mode 100644 packages/validation/src/tester/runtime/freshMatchableOrderSkip.ts create mode 100644 packages/validation/src/tester/runtime/runtime.ts create mode 100644 packages/validation/src/tester/runtime/testerAttempt.ts create mode 100644 packages/validation/src/tester/runtime/testerErrors.ts create mode 100644 packages/validation/src/tester/runtime/testerLoop.ts create mode 100644 packages/validation/src/tester/runtime/testerStop.ts create mode 100644 packages/validation/src/tester/runtime/testerTypes.ts create mode 100644 packages/validation/src/testerContract.ts create mode 100644 packages/validation/test/index.ts create mode 100644 packages/validation/test/supervisor/index/actor/supervisorIndexActorExitPrecedenceClassification.ts create mode 100644 packages/validation/test/supervisor/index/actor/supervisorIndexActorTimerLimits.ts create mode 100644 packages/validation/test/supervisor/index/actor/supervisorIndexActorWallClockTimeouts.ts create mode 100644 packages/validation/test/supervisor/index/bot/supervisorIndexBotCommitActionClassification.ts create mode 100644 packages/validation/test/supervisor/index/bot/supervisorIndexBotIterationEvidenceClassification.ts create mode 100644 packages/validation/test/supervisor/index/bot/supervisorIndexBotSkipAndNoActionClassification.ts create mode 100644 packages/validation/test/supervisor/index/bot/supervisorIndexBotTimeoutAndMatchEconomicsClassification.ts create mode 100644 packages/validation/test/supervisor/index/cli/supervisorIndexCliActorSignalAndTargetSteering.ts create mode 100644 packages/validation/test/supervisor/index/cli/supervisorIndexCliArgumentValidation.ts create mode 100644 packages/validation/test/supervisor/index/cli/supervisorIndexCliArtifactPathSafety.ts create mode 100644 packages/validation/test/supervisor/index/cli/supervisorIndexCliLivePreflightRequirement.ts create mode 100644 packages/validation/test/supervisor/index/cli/supervisorIndexCliOrderTargetSteering.ts create mode 100644 packages/validation/test/supervisor/index/cli/supervisorIndexCliTesterScenarioAndFeeControls.ts create mode 100644 packages/validation/test/supervisor/index/fresh/supervisorIndexCliFreshSkipHighCkbAndConfigSafety.ts create mode 100644 packages/validation/test/supervisor/index/fresh/supervisorIndexCliFreshSkipLowCkbStimulus.ts create mode 100644 packages/validation/test/supervisor/index/preflight/supervisorIndexPreflightEvidenceClassification.ts create mode 100644 packages/validation/test/supervisor/index/preflight/supervisorIndexPreflightEvidenceParsing.ts create mode 100644 packages/validation/test/supervisor/index/preflight/supervisorIndexPreflightRetryAndArtifacts.ts create mode 100644 packages/validation/test/supervisor/index/preflight/supervisorIndexPreflightWallClockBudget.ts create mode 100644 packages/validation/test/supervisor/index/tester/supervisorIndexTesterConversionClassification.ts create mode 100644 packages/validation/test/supervisor/index/tester/supervisorIndexTesterFailureEvidenceClassification.ts create mode 100644 packages/validation/test/supervisor/index/tester/supervisorIndexTesterOrderScenarioClassification.ts create mode 100644 packages/validation/test/supervisor/index/tester/supervisorIndexTxHashEvidencePrecedence.ts create mode 100644 packages/validation/test/supervisor/stimulus/cli/liveBotStimulusCliArguments.ts create mode 100644 packages/validation/test/supervisor/stimulus/runtime/liveBotStimulusCommitFailureBoundaries.ts create mode 100644 packages/validation/test/supervisor/stimulus/runtime/liveBotStimulusLauncherEventTail.ts create mode 100644 packages/validation/test/supervisor/stimulus/runtime/liveBotStimulusLiveBotWait.ts create mode 100644 packages/validation/test/supervisor/stimulus/runtime/liveBotStimulusMatchedOrderCommit.ts create mode 100644 packages/validation/test/supervisor/stimulus/selection/liveBotStimulusCkbToIckbSelection.ts create mode 100644 packages/validation/test/supervisor/stimulus/selection/liveBotStimulusCorrelatedMatchScan.ts create mode 100644 packages/validation/test/supervisor/stimulus/selection/liveBotStimulusIckbToCkbSelection.ts create mode 100644 packages/validation/test/supervisor/stimulus/selection/liveBotStimulusPreflightBalances.ts create mode 100644 packages/validation/test/supervisor/stimulus/selection/liveBotStimulusTesterOrderMatch.ts create mode 100644 packages/validation/test/supervisor/support/stimulus/liveBotStimulus.ts create mode 100644 packages/validation/test/supervisor/support/stimulus/liveBotStimulusFixture.ts create mode 100644 packages/validation/test/supervisor/support/stimulus/liveBotStimulusRuntimeImports.ts create mode 100644 packages/validation/test/supervisor/support/stimulus/liveBotStimulusSessionImports.ts create mode 100644 packages/validation/test/supervisor/support/supervisor/index.ts create mode 100644 packages/validation/test/supervisor/support/supervisor/supervisorIndexAssertions.ts create mode 100644 packages/validation/test/supervisor/support/supervisor/supervisorIndexCommandFixtures.ts create mode 100644 packages/validation/test/supervisor/support/supervisor/supervisorIndexConstants.ts create mode 100644 packages/validation/test/supervisor/support/supervisor/supervisorIndexProcessFixtures.ts create mode 100644 packages/validation/test/supervisor/support/supervisor/supervisorIndexRunFixtures.ts create mode 100644 packages/validation/test/support/runtime/runtime.ts create mode 100644 packages/validation/test/support/runtime/runtimeDefaultSdkFixture.ts create mode 100644 packages/validation/test/support/tester/index.ts create mode 100644 packages/validation/test/support/tester/testerFreshFixtures.ts create mode 100644 packages/validation/test/support/tester/testerIndexConstants.ts create mode 100644 packages/validation/test/support/tester/testerOrderFixtures.ts create mode 100644 packages/validation/test/support/tester/testerStateFixtures.ts create mode 100644 packages/validation/test/support/tester/testerTransactionFixtures.ts create mode 100644 packages/validation/test/tester/evidence/testerEvidence.ts create mode 100644 packages/validation/test/tester/evidence/testerFailure.ts create mode 100644 packages/validation/test/tester/evidence/testerReserve.ts create mode 100644 packages/validation/test/tester/planning/testerPlanningAuto.ts create mode 100644 packages/validation/test/tester/planning/testerPlanningCore.ts create mode 100644 packages/validation/test/tester/planning/testerPlanningFunded.ts create mode 100644 packages/validation/test/tester/planning/testerPlanningMixed.ts create mode 100644 packages/validation/test/tester/planning/testerPlanningRandom.ts create mode 100644 packages/validation/test/tester/runtime/attempt/attemptSendReserve.ts create mode 100644 packages/validation/test/tester/runtime/attempt/attemptSkips.ts create mode 100644 packages/validation/test/tester/runtime/attempt/loopErrors.ts create mode 100644 packages/validation/test/tester/runtime/attempt/planningLowCapital.ts create mode 100644 packages/validation/test/tester/runtime/attempt/planningSkips.ts create mode 100644 packages/validation/test/tester/runtime/attempt/planningTransactions.ts create mode 100644 packages/validation/test/tester/runtime/attempt/sdkFixture.ts create mode 100644 packages/validation/test/tester/runtime/attempt/support.ts create mode 100644 packages/validation/test/tester/runtime/core/runtimeConversion.ts create mode 100644 packages/validation/test/tester/runtime/core/runtimeState.ts create mode 100644 packages/validation/test/tester/runtime/core/runtimeTransaction.ts create mode 100644 packages/validation/test/tester/runtime/core/testerConfig.ts create mode 100644 packages/validation/test/tester/runtime/core/testerFreshOrder.ts create mode 100644 packages/validation/tsconfig.json rename {apps/tester => packages/validation}/vitest.config.mts (55%) create mode 100644 patches/@joyid__ckb@1.1.4.patch create mode 100644 prettier.config.mts create mode 100644 scripts/bot/collect-incident.ts create mode 100644 scripts/bot/incident/args.ts create mode 100644 scripts/bot/incident/bundle.ts create mode 100644 scripts/bot/incident/index.ts create mode 100644 scripts/bot/incident/io/filesystem.ts create mode 100644 scripts/bot/incident/io/version.ts create mode 100644 scripts/bot/incident/model/constants.ts create mode 100644 scripts/bot/incident/model/paths.ts create mode 100644 scripts/bot/incident/model/text.ts create mode 100644 scripts/bot/incident/model/types.ts create mode 100644 scripts/bot/incident/source/artifacts.ts create mode 100644 scripts/bot/incident/source/collection.ts create mode 100644 scripts/bot/incident/source/discovery.ts create mode 100644 scripts/bot/incident/source/filter.ts create mode 100644 scripts/bot/incident/source/summary.ts create mode 100644 scripts/bot/launcher.ts create mode 100644 scripts/bot/launcher/args.ts create mode 100644 scripts/bot/launcher/index.ts create mode 100644 scripts/bot/launcher/io.ts create mode 100644 scripts/bot/launcher/logs.ts create mode 100644 scripts/bot/launcher/paths.ts create mode 100644 scripts/bot/launcher/runtime/constants.ts create mode 100644 scripts/bot/launcher/runtime/execute.ts create mode 100644 scripts/bot/launcher/runtime/process.ts create mode 100644 scripts/bot/launcher/runtime/records.ts create mode 100644 scripts/bot/launcher/runtime/spawn.ts create mode 100644 scripts/bot/launcher/runtime/support.ts create mode 100644 scripts/bot/launcher/runtime/types.ts create mode 100644 scripts/bot/launcher/storage/filesystem.ts create mode 100644 scripts/bot/launcher/storage/metadata.ts create mode 100644 scripts/bot/launcher/storage/prepare.ts delete mode 100644 scripts/ickb-bot-collect-incident.mjs delete mode 100644 scripts/ickb-bot-collect-incident.test.mjs delete mode 100644 scripts/ickb-bot-launcher.mjs delete mode 100644 scripts/ickb-bot-launcher.test.mjs delete mode 100644 scripts/ickb-bot-systemd-credential.test.mjs delete mode 100644 scripts/ickb-bot-systemd-install.test.mjs delete mode 100644 scripts/ickb-bot-systemd-update.test.mjs delete mode 100644 scripts/ickb-generate-config.mjs delete mode 100644 scripts/ickb-generate-config.test.mjs delete mode 100644 scripts/ickb-live-config-from-env.mjs delete mode 100644 scripts/ickb-live-config-from-env.test.mjs delete mode 100644 scripts/ickb-live-config-git.mjs delete mode 100644 scripts/ickb-live-config-git.test.mjs delete mode 100644 scripts/ickb-live-preflight.mjs delete mode 100644 scripts/ickb-live-preflight.test.mjs delete mode 100644 scripts/ickb-script-helpers.mjs delete mode 100644 scripts/ickb-supervisor-dynamic-loop.mjs delete mode 100644 scripts/ickb-supervisor-dynamic-loop.test.mjs delete mode 100644 scripts/ickb-supervisor-loop.mjs delete mode 100644 scripts/ickb-supervisor-loop.test.mjs create mode 100644 scripts/lint-source-structure.ts create mode 100644 scripts/live/config-from-env.ts create mode 100644 scripts/live/config/config-from-env.ts create mode 100644 scripts/live/config/generate-config-args.ts create mode 100644 scripts/live/config/generate-config-files.ts create mode 100644 scripts/live/config/generate-config.ts create mode 100644 scripts/live/config/git.ts create mode 100644 scripts/live/generate-config.ts create mode 100644 scripts/live/preflight.ts create mode 100644 scripts/live/preflight/args.ts create mode 100644 scripts/live/preflight/errors.ts create mode 100644 scripts/live/preflight/main.ts create mode 100644 scripts/live/preflight/paths.ts create mode 100644 scripts/live/preflight/report.ts create mode 100644 scripts/live/preflight/run.ts create mode 100644 scripts/run-node-tests.ts create mode 100644 scripts/supervisor/dynamic-loop-cli.ts create mode 100644 scripts/supervisor/dynamic-loop.ts create mode 100644 scripts/supervisor/dynamic-loop/args.ts create mode 100644 scripts/supervisor/dynamic-loop/command.ts create mode 100644 scripts/supervisor/dynamic-loop/model.ts create mode 100644 scripts/supervisor/dynamic-loop/preflight.ts create mode 100644 scripts/supervisor/dynamic-loop/runtime.ts create mode 100644 scripts/supervisor/dynamic-loop/scenario.ts create mode 100644 scripts/supervisor/dynamic-loop/session.ts create mode 100644 scripts/supervisor/helpers.ts create mode 100644 scripts/supervisor/loop-cli.ts create mode 100644 scripts/supervisor/loop.ts create mode 100644 scripts/supervisor/loop/args.ts create mode 100644 scripts/supervisor/loop/command.ts create mode 100644 scripts/supervisor/loop/model.ts create mode 100644 scripts/supervisor/loop/output.ts create mode 100644 scripts/supervisor/loop/paths.ts create mode 100644 scripts/supervisor/loop/runtime.ts create mode 100644 scripts/supervisor/loop/summary.ts create mode 100644 scripts/test/bot/incident/artifacts.ts create mode 100644 scripts/test/bot/incident/core.ts create mode 100644 scripts/test/bot/incident/paths.ts create mode 100644 scripts/test/bot/incident/support.ts create mode 100644 scripts/test/bot/launcher/failures.ts create mode 100644 scripts/test/bot/launcher/logs.ts create mode 100644 scripts/test/bot/launcher/support.ts create mode 100644 scripts/test/bot/systemd-credential.ts create mode 100644 scripts/test/bot/systemd-install.ts create mode 100644 scripts/test/bot/systemd-update.ts create mode 100644 scripts/test/build/native-source-smoke.ts create mode 100644 scripts/test/build/rewrite-dts-imports.ts create mode 100644 scripts/test/live/config/config-from-env-files.ts create mode 100644 scripts/test/live/config/config-from-env-support.ts create mode 100644 scripts/test/live/config/config-from-env.ts create mode 100644 scripts/test/live/config/generate-config-files.ts create mode 100644 scripts/test/live/config/generate-config.ts create mode 100644 scripts/test/live/config/git.ts create mode 100644 scripts/test/live/preflight/cli.ts create mode 100644 scripts/test/live/preflight/failures.ts create mode 100644 scripts/test/live/preflight/paths.ts create mode 100644 scripts/test/live/preflight/report.ts create mode 100644 scripts/test/live/preflight/support.ts create mode 100644 scripts/test/supervisor/dynamic-loop/args.ts create mode 100644 scripts/test/supervisor/dynamic-loop/chunks.ts create mode 100644 scripts/test/supervisor/dynamic-loop/guards.ts create mode 100644 scripts/test/supervisor/dynamic-loop/inspection.ts create mode 100644 scripts/test/supervisor/dynamic-loop/session.ts create mode 100644 scripts/test/supervisor/dynamic-loop/support.ts create mode 100644 scripts/test/supervisor/loop/args-summary.ts create mode 100644 scripts/test/supervisor/loop/command.ts create mode 100644 scripts/test/supervisor/loop/evidence.ts create mode 100644 scripts/test/supervisor/loop/runtime.ts create mode 100644 scripts/test/supervisor/loop/support.ts create mode 100644 scripts/test/tooling/eslint/finite-transaction-wait.ts create mode 100644 scripts/test/tooling/lint/source-structure/package-policy.ts create mode 100644 scripts/test/tooling/lint/source-structure/repository-policy.ts create mode 100644 scripts/test/tooling/lint/source-structure/source-policy.ts create mode 100644 scripts/test/tooling/lint/source-structure/test-policy.ts create mode 100644 scripts/tooling/eslint-plugin-types.d.ts create mode 100644 scripts/tooling/eslint/plugins.ts create mode 100644 scripts/tooling/lint/source-structure/format.ts create mode 100644 scripts/tooling/lint/source-structure/model.ts create mode 100644 scripts/tooling/lint/source-structure/packages.ts create mode 100644 scripts/tooling/lint/source-structure/policy/common.ts create mode 100644 scripts/tooling/lint/source-structure/policy/source.ts create mode 100644 scripts/tooling/lint/source-structure/policy/test.ts create mode 100644 scripts/tooling/lint/source-structure/public-api.ts create mode 100644 scripts/tooling/lint/source-structure/repository.ts create mode 100644 scripts/tooling/lint/source-structure/run.ts create mode 100644 scripts/tooling/lint/source-structure/source.ts diff --git a/.dependency-cruiser.jsonc b/.dependency-cruiser.jsonc new file mode 100644 index 00000000..2f47ae14 --- /dev/null +++ b/.dependency-cruiser.jsonc @@ -0,0 +1,77 @@ +{ + "extends": "dependency-cruiser/configs/recommended-strict", + "forbidden": [ + { + "name": "no-orphans", + "from": { + "orphan": true, + "pathNot": [ + "(^|/)\\.[^/]+\\.(js|cjs|mjs|ts|json)$", + "\\.d\\.(c|m)?ts$", + "(^|/)tsconfig\\.json$", + "(^|/)(?:babel|webpack)\\.config\\.(?:js|cjs|mjs|ts|json)$", + "^scripts/(?:run-node-tests|lint-source-structure)[.](?:mts|ts)$", + "^scripts/tooling/build/rewrite-dts-imports[.](?:mts|ts)$", + "^scripts/tooling/eslint/plugins[.]ts$", + "^scripts/test/.+[.](?:mts|ts)$", + "^(?:apps|packages)/[^/]+/vitest[.]config[.]mts$", + "^apps/interface/vite[.]config[.]ts$", + "^apps/interface/eslint[.]config[.]mts$", + ], + }, + }, + { + "name": "not-prod-to-test-source", + "comment": "Production source must not import test-only files. Keep test fixtures behind test/ boundaries.", + "severity": "error", + "from": { + "path": "^(?:(?:apps|packages)/[^/]+/src/|scripts/)", + "pathNot": [ + "(?:^|/)test/", + "[.]test[.](?:mts|ts|tsx)$", + "(?:^|/)[^/]*(?:Suite[0-9]*[.]test|Suite|Test(?:Assertions|CommandFixtures|Constants|Fixtures|ProcessFixtures|RunFixtures|Support)|TestFixtures|TestSupport)[.](?:mts|ts|tsx)$", + "(?:^|/)[^/]*(?:Suite[0-9]*[.]test|Suite|Test(?:Assertions|CommandFixtures|Constants|Fixtures|ProcessFixtures|RunFixtures|Support)|TestFixtures|TestSupport)[.][^/]+[.](?:mts|ts|tsx)$", + "(?:^|/)[^/]*(?:_test_|_test_constants[.]|_test_fixtures[.]|_test_support[.])[^/]*$", + ], + }, + "to": { + "path": [ + "(?:^|/)test/", + "[.]test[.](?:mts|ts|tsx)$", + "(?:^|/)[^/]*(?:Suite[0-9]*[.]test|Suite|Test(?:Assertions|CommandFixtures|Constants|Fixtures|ProcessFixtures|RunFixtures|Support)|TestFixtures|TestSupport)[.](?:mts|ts|tsx)$", + "(?:^|/)[^/]*(?:Suite[0-9]*[.]test|Suite|Test(?:Assertions|CommandFixtures|Constants|Fixtures|ProcessFixtures|RunFixtures|Support)|TestFixtures|TestSupport)[.][^/]+[.](?:mts|ts|tsx)$", + "(?:^|/)[^/]*(?:_test_|_test_constants[.]|_test_fixtures[.]|_test_support[.])[^/]*$", + ], + }, + }, + { + "name": "not-prod-to-testkit", + "comment": "Production source must not import @ickb/testkit. Keep test harness dependencies under test/.", + "severity": "error", + "from": { + "path": "^(apps|packages)/[^/]+/src/", + "pathNot": [ + "^packages/testkit/src/", + "(?:^|/)test/", + "[.]test[.](?:mts|ts|tsx)$", + "(?:^|/)[^/]*(?:Suite[0-9]*[.]test|Suite|Test(?:Assertions|CommandFixtures|Constants|Fixtures|ProcessFixtures|RunFixtures|Support)|TestFixtures|TestSupport)[.](?:mts|ts|tsx)$", + "(?:^|/)[^/]*(?:Suite[0-9]*[.]test|Suite|Test(?:Assertions|CommandFixtures|Constants|Fixtures|ProcessFixtures|RunFixtures|Support)|TestFixtures|TestSupport)[.][^/]+[.](?:mts|ts|tsx)$", + "(?:^|/)[^/]*(?:_test_|_test_constants[.]|_test_fixtures[.]|_test_support[.])[^/]*$", + ], + }, + "to": { + "path": "^packages/testkit/src/", + }, + }, + ], + "options": { + "exclude": { + "path": "(?:^|/)(?:coverage|dist)/", + }, + "includeOnly": "^(apps|packages|scripts)/", + "tsConfig": { + "fileName": "tsconfig.json", + }, + "tsPreCompilationDeps": "specify", + }, +} diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 7b518c0d..3d23088d 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -5,19 +5,24 @@ on: push: branches: [master] +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + node-version: [22.19.0, 24] steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 with: - node-version: 24 - - uses: pnpm/action-setup@v4 - - - name: Install jq for fork bootstrap - run: sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends jq + persist-credentials: false + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + with: + node-version: ${{ matrix.node-version }} + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 - name: Run pnpm check run: pnpm check diff --git a/.gitignore b/.gitignore index 74e2f24e..767fce20 100644 --- a/.gitignore +++ b/.gitignore @@ -2,15 +2,16 @@ **/node_modules/ # Artifacts +**/coverage/ **/dist/ +**/temp/*.api.md +**/*.tsbuildinfo log/ apps/*/log_*.json +apps/sampler/rate.csv # Local runtime config files -config/ - -# Local logs -logs/ +/config/ # Local scratch files .scratch/ diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..9884a9f1 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +**/node_modules/ +**/dist/ +**/etc/*.api.md +**/*.tsbuildinfo +coverage/ +.git/ +.scratch/ +config/ +log/ +apps/*/log_*.json +apps/sampler/rate.csv +forks/ +pnpm-lock.yaml diff --git a/PRODUCT.md b/PRODUCT.md new file mode 100644 index 00000000..728af2ef --- /dev/null +++ b/PRODUCT.md @@ -0,0 +1,33 @@ +# Product + +## Register + +product + +## Users + +iCKB users are CKB holders who want NervosDAO exposure while keeping a liquid token they can move, redeem, or use in compatible CKB apps. They may be testing on testnet first or connecting a real mainnet wallet, so the interface must make network choice, wallet state, and transaction intent clear before signing. + +## Product Purpose + +The interface helps users understand iCKB at a glance, connect a CCC-compatible CKB wallet, preview CKB/iCKB conversions, complete transactions, sign, send, and confirm results. Success means users can distinguish the static explanation from the wallet app, understand the iCKB exchange-rate basis, and avoid signing a transaction they do not understand. + +## Brand Personality + +Plain, credible, and protocol-native. The voice should use simple words for public-facing explanations, but only make claims backed by the whitepaper, contracts repo, audit reports, tests, or live protocol behavior. + +## Anti-references + +Do not look like a generic DeFi yield farm, meme-token landing page, or overpromising finance app. Avoid hype language, vague security claims, chart clutter, decorative glassmorphism, nested card grids, and wallet actions that hide network or signing consequences. + +## Design Principles + +- Explain the basis before asking for trust. +- Keep the chart as evidence, not decoration. +- Make signing and network state explicit. +- Separate audited contracts from unaudited web-app code. +- Prefer fast static content, then progressive wallet interactivity. + +## Accessibility & Inclusion + +Target WCAG AA. Keep contrast strong on the dark theme, avoid motion-gated content, preserve readable line lengths, use standalone link labels, and make wallet/network actions understandable without relying on color alone. diff --git a/README.md b/README.md index 9bee59af..1a549783 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ iCKB Stack is the monorepo for the current TypeScript iCKB libraries and apps bu Callers own the final completion pipeline: 1. Build the partial transaction through `IckbSdk` and the package managers. -2. Before send, call `sdk.completeTransaction(...)` or `completeIckbTransaction(...)` from `@ickb/sdk`. +2. Before send, call `sdk.completeTransaction(...)` from `@ickb/sdk`. 3. Only then send the transaction. Withdrawal requests built from public pool ready deposits may include `requiredLiveDeposits`. `@ickb/sdk` adds those cells as live `cell_dep` checks so a transaction fails if a protected pool anchor disappears before inclusion. @@ -26,23 +26,24 @@ Current stack flows assume user-owned cells are protected by locks whose signatu Apps: -- `apps/bot`: Node order-fulfillment and rebalance bot for matching profitable orders, collecting owned orders, completing receipts and withdrawals, and rebalancing pool exposure. +- `apps/bot`: Node CLI adapter for the private bot runtime. - `apps/interface`: Browser interface for CCC wallet connection, conversion previews, transaction completion, signing, sending, and confirmation. -- `apps/sampler`: Mainnet sampling utility that writes historical iCKB exchange-rate CSV output. -- `apps/supervisor`: Deterministic live testnet supervisor for bounded bot/tester stress cycles, ignored artifacts, and incident bundles. -- `apps/tester`: Node simulator that creates random conversion orders to exercise the order and conversion flows. +- `apps/sampler`: Mainnet sampling utility that writes historical CKB-per-iCKB CSV output. +- `apps/validation`: Node CLI adapters for deterministic live testnet validation flows, including bounded supervisor cycles and tester order stimulus. -The Node app packages (`@ickb/bot`, `@ickb/sampler`, and `@ickb/tester`) publish their built entrypoints for distribution, but the supported reusable API surface lives in the packages below. `@ickb/interface` is a deployable browser app package and does not expose a library entrypoint. +Apps are private workspace runtimes and run from source under Node 22.19+ or Vite. The supported reusable API surface lives in the packages below. Stack package `build` scripts emit `dist/` for publishing reusable packages only; local development, tests, live supervisor runs, and bot deployments use TypeScript source directly. Packages: - `packages/core`: iCKB protocol primitives, cells, UDT conversion helpers, and low-level transaction builders. +- `packages/bot`: Private order-fulfillment and rebalance bot core for matching profitable orders, collecting owned orders, completing receipts and withdrawals, and rebalancing pool exposure. - `packages/dao`: Nervos DAO cell classification, readiness, deposit, request, and withdrawal helpers. - `packages/node-utils`: Private Node app utilities for env parsing, RPC client setup, signer locks, sleeps, and JSON logs. - `packages/order`: UDT limit-order entities, grouping, matching, minting, melting, and deployed-script confusion mitigation. - `packages/sdk`: Stack-level SDK that composes core, DAO, and order packages into account state, conversion planning, completion, sending, and confirmation helpers. - `packages/testkit`: Private test helpers and fixtures for workspace tests. - `packages/utils`: Shared low-level utilities such as complete-scan enforcement, binary search, collection helpers, and bounded subset selection. +- `packages/validation`: Private live validation core for tester and supervisor flows. ## Dependencies @@ -50,6 +51,27 @@ CCC packages are normal package dependencies resolved through `pnpm-workspace.ya `pnpm check` is the validation gate. It always runs with `CI=true`. +## Live Testnet Bot Watch + +Run continuous matching with the production-style bot launcher and an unbounded bot config: + +```bash +pnpm live:config-from-env -- --force +BOT_CONFIG_FILE=config/bot-live-testnet.json node scripts/bot/launcher.ts --no-child-tee +``` + +Every 30-minute watch audit must first prove the bot launcher and child are still running. Only then inspect `log/bot/launches.ndjson`, the current `logFiles.events` and `logFiles.stderr` from the latest `launcher.started` record, and any referenced files under `log/bot/artifacts//` for recent `bot.iteration.started`, `bot.state.read`, chain preflight matches, terminal failures, retry-budget exhaustion, transaction failures, or exit records. If the bot is not running, the audit fails before interpreting stale logs. + +Generated live configs default to `sleepIntervalSeconds: 60`; override with `ICKB_TESTNET_SLEEP_INTERVAL_SECONDS` only when the operator deliberately wants a different cadence. Bounded supervisor/tester configs default to `maxRetryableAttempts: 10`; the unbounded live launcher config omits `maxRetryableAttempts` unless `ICKB_TESTNET_MAX_RETRYABLE_ATTEMPTS` is set intentionally. + +Use the supervisor-owned live stimulus cadence when the long-running bot is healthy and continuous production-bot validation is required: + +```bash +pnpm -s live:supervisor:bot-stimulus-test --keep-going --log-root log +``` + +The cadence keeps the single production-like bot under its existing launcher and runs non-overlapping cycles until `SIGINT` or `SIGTERM`. Every cycle gets fresh bot and tester preflights and an ignored `log/validation/live-bot-stimulus-