@cogcoin/client 1.1.4 → 1.1.5

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 (83) hide show
  1. package/README.md +4 -5
  2. package/dist/bitcoind/progress/tty-renderer.js +3 -2
  3. package/dist/bitcoind/service.js +1 -1
  4. package/dist/cli/command-registry.d.ts +39 -0
  5. package/dist/cli/command-registry.js +1132 -0
  6. package/dist/cli/commands/client-admin.js +6 -56
  7. package/dist/cli/commands/mining-admin.js +9 -32
  8. package/dist/cli/commands/mining-read.js +15 -56
  9. package/dist/cli/commands/mining-runtime.js +258 -57
  10. package/dist/cli/commands/service-runtime.js +1 -64
  11. package/dist/cli/commands/status.js +2 -15
  12. package/dist/cli/commands/update.js +6 -21
  13. package/dist/cli/commands/wallet-admin.js +18 -120
  14. package/dist/cli/commands/wallet-mutation.js +4 -7
  15. package/dist/cli/commands/wallet-read.js +31 -138
  16. package/dist/cli/context.js +2 -4
  17. package/dist/cli/mining-format.js +8 -2
  18. package/dist/cli/mutation-command-groups.d.ts +11 -11
  19. package/dist/cli/mutation-command-groups.js +9 -18
  20. package/dist/cli/mutation-json.d.ts +1 -17
  21. package/dist/cli/mutation-json.js +1 -28
  22. package/dist/cli/mutation-success.d.ts +0 -1
  23. package/dist/cli/mutation-success.js +0 -19
  24. package/dist/cli/output.d.ts +1 -10
  25. package/dist/cli/output.js +52 -481
  26. package/dist/cli/parse.d.ts +1 -1
  27. package/dist/cli/parse.js +38 -695
  28. package/dist/cli/runner.js +28 -113
  29. package/dist/cli/types.d.ts +7 -8
  30. package/dist/cli/update-notifier.js +1 -1
  31. package/dist/cli/wallet-format.js +1 -1
  32. package/dist/wallet/lifecycle/managed-core.d.ts +23 -0
  33. package/dist/wallet/lifecycle/managed-core.js +257 -0
  34. package/dist/wallet/lifecycle/repair-mining.d.ts +49 -0
  35. package/dist/wallet/lifecycle/repair-mining.js +304 -0
  36. package/dist/wallet/lifecycle/repair-runtime.d.ts +36 -0
  37. package/dist/wallet/lifecycle/repair-runtime.js +206 -0
  38. package/dist/wallet/lifecycle/repair.d.ts +11 -0
  39. package/dist/wallet/lifecycle/repair.js +368 -0
  40. package/dist/wallet/lifecycle/setup.d.ts +16 -0
  41. package/dist/wallet/lifecycle/setup.js +430 -0
  42. package/dist/wallet/lifecycle/types.d.ts +125 -0
  43. package/dist/wallet/lifecycle/types.js +1 -0
  44. package/dist/wallet/lifecycle.d.ts +4 -165
  45. package/dist/wallet/lifecycle.js +3 -1656
  46. package/dist/wallet/mining/candidate.d.ts +60 -0
  47. package/dist/wallet/mining/candidate.js +290 -0
  48. package/dist/wallet/mining/competitiveness.d.ts +22 -0
  49. package/dist/wallet/mining/competitiveness.js +640 -0
  50. package/dist/wallet/mining/control.js +7 -251
  51. package/dist/wallet/mining/cycle.d.ts +39 -0
  52. package/dist/wallet/mining/cycle.js +542 -0
  53. package/dist/wallet/mining/engine-state.d.ts +66 -0
  54. package/dist/wallet/mining/engine-state.js +211 -0
  55. package/dist/wallet/mining/engine-types.d.ts +173 -0
  56. package/dist/wallet/mining/engine-types.js +1 -0
  57. package/dist/wallet/mining/engine-utils.d.ts +7 -0
  58. package/dist/wallet/mining/engine-utils.js +75 -0
  59. package/dist/wallet/mining/events.d.ts +2 -0
  60. package/dist/wallet/mining/events.js +19 -0
  61. package/dist/wallet/mining/lifecycle.d.ts +71 -0
  62. package/dist/wallet/mining/lifecycle.js +355 -0
  63. package/dist/wallet/mining/projection.d.ts +61 -0
  64. package/dist/wallet/mining/projection.js +319 -0
  65. package/dist/wallet/mining/publish.d.ts +79 -0
  66. package/dist/wallet/mining/publish.js +614 -0
  67. package/dist/wallet/mining/runner.d.ts +12 -418
  68. package/dist/wallet/mining/runner.js +274 -3433
  69. package/dist/wallet/mining/supervisor.d.ts +134 -0
  70. package/dist/wallet/mining/supervisor.js +558 -0
  71. package/dist/wallet/mining/visualizer-sync.d.ts +42 -0
  72. package/dist/wallet/mining/visualizer-sync.js +166 -0
  73. package/dist/wallet/mining/visualizer.d.ts +1 -0
  74. package/dist/wallet/mining/visualizer.js +33 -18
  75. package/dist/wallet/reset.d.ts +1 -1
  76. package/dist/wallet/reset.js +35 -11
  77. package/dist/wallet/runtime.d.ts +0 -6
  78. package/dist/wallet/runtime.js +2 -38
  79. package/dist/wallet/tx/common.d.ts +18 -0
  80. package/dist/wallet/tx/common.js +40 -26
  81. package/package.json +1 -1
  82. package/dist/wallet/state/seed-index.d.ts +0 -43
  83. package/dist/wallet/state/seed-index.js +0 -151
@@ -3,174 +3,18 @@ import { assaySentences } from "@cogcoin/scoring";
3
3
  import { attachOrStartManagedBitcoindService, probeManagedBitcoindService, stopManagedBitcoindService } from "../../bitcoind/service.js";
4
4
  import { createRpcClient } from "../../bitcoind/node.js";
5
5
  import type { ProgressOutputMode } from "../../bitcoind/types.js";
6
- import { type FixedWalletInput, type MutationSender, type WalletMutationRpcClient } from "../tx/common.js";
7
- import { readLockMetadata } from "../fs/lock.js";
8
6
  import type { WalletPrompter } from "../lifecycle.js";
9
- import { openWalletReadContext, type WalletReadContext } from "../read/index.js";
7
+ import { openWalletReadContext } from "../read/index.js";
10
8
  import { type WalletRuntimePaths } from "../runtime.js";
11
9
  import { type WalletSecretProvider } from "../state/provider.js";
12
- import type { MiningStateRecord, OutpointRecord, WalletStateV1 } from "../types.js";
10
+ import { generateCandidatesForDomains as generateCandidatesForDomainsModule } from "./candidate.js";
11
+ import { runCompetitivenessGate as runCompetitivenessGateModule } from "./competitiveness.js";
12
+ import { type MiningRuntimeLoopState } from "./engine-state.js";
13
+ import { saveStopSnapshot } from "./lifecycle.js";
14
+ import type { CompetitivenessDecision, MiningCandidate, MiningCooperativeYield, MiningRpcClient } from "./engine-types.js";
13
15
  import { requestMiningGenerationPreemption } from "./coordination.js";
14
- import { type MiningSentenceGenerationRequest } from "./sentences.js";
15
- import type { MiningControlPlaneView, MiningEventRecord, MiningRuntimeStatusV1 } from "./types.js";
16
- import { type MiningFollowVisualizerState, type MiningSentenceBoardEntry, MiningFollowVisualizer } from "./visualizer.js";
17
- type MiningRpcClient = WalletMutationRpcClient & {
18
- getBlockchainInfo(): Promise<{
19
- blocks: number;
20
- bestblockhash: string;
21
- initialblockdownload?: boolean;
22
- }>;
23
- getNetworkInfo(): Promise<{
24
- networkactive: boolean;
25
- connections_out?: number;
26
- }>;
27
- getBlockHash(height: number): Promise<string>;
28
- getBlock(hashHex: string): Promise<{
29
- hash: string;
30
- previousblockhash?: string;
31
- height: number;
32
- time?: number;
33
- }>;
34
- getMempoolInfo(): Promise<{
35
- loaded: boolean;
36
- }>;
37
- getRawMempool(): Promise<string[]>;
38
- getRawMempoolVerbose(): Promise<{
39
- txids: string[];
40
- mempool_sequence: string | number;
41
- }>;
42
- getMempoolEntry(txid: string): Promise<{
43
- vsize: number;
44
- fees: {
45
- base: number;
46
- ancestor: number;
47
- descendant: number;
48
- };
49
- ancestorsize?: number;
50
- descendantsize?: number;
51
- }>;
52
- getRawTransaction(txid: string, verbose?: boolean): Promise<{
53
- txid: string;
54
- hash?: string;
55
- vin: Array<{
56
- txid?: string;
57
- prevout?: {
58
- scriptPubKey?: {
59
- hex?: string;
60
- };
61
- };
62
- }>;
63
- vout: Array<{
64
- n: number;
65
- value: number | string;
66
- scriptPubKey?: {
67
- hex?: string;
68
- };
69
- }>;
70
- }>;
71
- getTransaction(walletName: string, txid: string): Promise<{
72
- txid: string;
73
- confirmations: number;
74
- blockhash?: string;
75
- walletconflicts?: string[];
76
- }>;
77
- sendRawTransaction(hex: string): Promise<string>;
78
- saveMempool?(): Promise<null>;
79
- };
80
- interface MiningRunnerStatusOverrides {
81
- runMode?: MiningRuntimeStatusV1["runMode"];
82
- backgroundWorkerPid?: number | null;
83
- backgroundWorkerRunId?: string | null;
84
- backgroundWorkerHeartbeatAtUnixMs?: number | null;
85
- currentPhase?: MiningRuntimeStatusV1["currentPhase"];
86
- currentPublishState?: MiningRuntimeStatusV1["currentPublishState"];
87
- targetBlockHeight?: number | null;
88
- referencedBlockHashDisplay?: string | null;
89
- currentDomainId?: number | null;
90
- currentDomainName?: string | null;
91
- currentSentenceDisplay?: string | null;
92
- currentCanonicalBlend?: string | null;
93
- currentTxid?: string | null;
94
- currentWtxid?: string | null;
95
- currentFeeRateSatVb?: number | null;
96
- currentAbsoluteFeeSats?: number | null;
97
- currentBlockFeeSpentSats?: string;
98
- lastSuspendDetectedAtUnixMs?: number | null;
99
- reconnectSettledUntilUnixMs?: number | null;
100
- tipSettledUntilUnixMs?: number | null;
101
- providerState?: MiningRuntimeStatusV1["providerState"];
102
- corePublishState?: MiningRuntimeStatusV1["corePublishState"];
103
- currentPublishDecision?: string | null;
104
- sameDomainCompetitorSuppressed?: boolean | null;
105
- higherRankedCompetitorDomainCount?: number | null;
106
- dedupedCompetitorDomainCount?: number | null;
107
- competitivenessGateIndeterminate?: boolean | null;
108
- mempoolSequenceCacheStatus?: MiningRuntimeStatusV1["mempoolSequenceCacheStatus"];
109
- lastMempoolSequence?: string | null;
110
- lastCompetitivenessGateAtUnixMs?: number | null;
111
- lastError?: string | null;
112
- note?: string | null;
113
- livePublishInMempool?: boolean | null;
114
- }
115
- interface MiningCandidate {
116
- domainId: number;
117
- domainName: string;
118
- localIndex: number;
119
- sender: MutationSender;
120
- sentence: string;
121
- encodedSentenceBytes: Uint8Array;
122
- bip39WordIndices: number[];
123
- bip39Words: readonly string[];
124
- canonicalBlend: bigint;
125
- referencedBlockHashDisplay: string;
126
- referencedBlockHashInternal: Uint8Array;
127
- targetBlockHeight: number;
128
- }
129
- type ReadyMiningReadContext = WalletReadContext & {
130
- localState: {
131
- availability: "ready";
132
- state: WalletStateV1;
133
- };
134
- snapshot: NonNullable<WalletReadContext["snapshot"]>;
135
- model: NonNullable<WalletReadContext["model"]>;
136
- };
137
- interface MiningPublishSkipResult {
138
- state: WalletStateV1;
139
- txid: null;
140
- decision: "publish-skipped-stale-candidate" | "publish-paused-insufficient-funds";
141
- note: string;
142
- lastError?: string | null;
143
- skipped: true;
144
- retryable?: false;
145
- candidate: null;
146
- }
147
- interface MiningPublishRetryResult {
148
- state: WalletStateV1;
149
- txid: null;
150
- decision: "publish-retry-pending";
151
- note: string;
152
- skipped?: false;
153
- retryable: true;
154
- candidate: MiningCandidate;
155
- }
156
- type MiningPublishOutcome = ({
157
- skipped?: false;
158
- retryable?: false;
159
- note?: null;
160
- candidate: MiningCandidate;
161
- } & Awaited<ReturnType<typeof publishCandidateOnce>>) | MiningPublishSkipResult | MiningPublishRetryResult;
162
- interface CompetitivenessDecision {
163
- allowed: boolean;
164
- decision: string;
165
- sameDomainCompetitorSuppressed: boolean;
166
- higherRankedCompetitorDomainCount: number;
167
- dedupedCompetitorDomainCount: number;
168
- competitivenessGateIndeterminate: boolean;
169
- mempoolSequenceCacheStatus: MiningRuntimeStatusV1["mempoolSequenceCacheStatus"];
170
- lastMempoolSequence: string | null;
171
- visibleBoardEntries: MiningSentenceBoardEntry[];
172
- candidateRank: number | null;
173
- }
16
+ import type { MiningRuntimeStatusV1 } from "./types.js";
17
+ import { MiningFollowVisualizer } from "./visualizer.js";
174
18
  interface RunnerDependencies {
175
19
  openReadContext?: typeof openWalletReadContext;
176
20
  attachService?: typeof attachOrStartManagedBitcoindService;
@@ -184,30 +28,7 @@ interface RunnerDependencies {
184
28
  shutdownGraceMs?: number;
185
29
  sleepImpl?: typeof sleep;
186
30
  }
187
- interface IndexerTruthKey {
188
- walletRootId: string;
189
- daemonInstanceId: string;
190
- snapshotSeq: string;
191
- }
192
- interface MiningLoopState {
193
- attemptedTipKey: string | null;
194
- currentTipKey: string | null;
195
- selectedCandidateTipKey: string | null;
196
- selectedCandidate: MiningCandidate | null;
197
- ui: MiningFollowVisualizerState;
198
- waitingNote: string | null;
199
- providerWaitState: "backoff" | "rate-limited" | "auth-error" | "not-found" | null;
200
- providerWaitLastError: string | null;
201
- providerWaitNextRetryAtUnixMs: number | null;
202
- providerTransientFailureCount: number;
203
- bitcoinRecoveryFirstFailureAtUnixMs: number | null;
204
- bitcoinRecoveryFirstUnreachableAtUnixMs: number | null;
205
- bitcoinRecoveryLastRestartAttemptAtUnixMs: number | null;
206
- bitcoinRecoveryServiceInstanceId: string | null;
207
- bitcoinRecoveryProcessId: number | null;
208
- reconnectSettledUntilUnixMs: number | null;
209
- tipSettledUntilUnixMs: number | null;
210
- }
31
+ type MiningLoopState = MiningRuntimeLoopState;
211
32
  interface MiningSuspendDetector {
212
33
  lastHeartbeatMonotonicMs: number;
213
34
  detectedAtUnixMs: number | null;
@@ -221,7 +42,6 @@ interface MiningSuspendHeartbeatHandle {
221
42
  interface MiningSuspendScheduler {
222
43
  every(intervalMs: number, callback: () => void): MiningSuspendHeartbeatHandle;
223
44
  }
224
- type MiningCooperativeYield = () => Promise<void>;
225
45
  export interface RunForegroundMiningOptions extends RunnerDependencies {
226
46
  dataDir: string;
227
47
  databasePath: string;
@@ -241,6 +61,7 @@ export interface RunForegroundMiningOptions extends RunnerDependencies {
241
61
  signal?: AbortSignal;
242
62
  progressOutput?: ProgressOutputMode;
243
63
  paths?: WalletRuntimePaths;
64
+ visualizer?: MiningFollowVisualizer;
244
65
  }
245
66
  export interface StartBackgroundMiningOptions extends RunnerDependencies {
246
67
  dataDir: string;
@@ -260,186 +81,14 @@ export interface MiningStartResult {
260
81
  started: boolean;
261
82
  snapshot: MiningRuntimeStatusV1 | null;
262
83
  }
263
- interface MiningRuntimeTakeoverResult {
264
- controlLockCleared: boolean;
265
- replaced: boolean;
266
- snapshot: MiningRuntimeStatusV1 | null;
267
- terminatedPids: number[];
268
- }
269
84
  declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
270
- export declare function createMiningLoopStateForTesting(): MiningLoopState;
271
- export declare function resetMiningUiForTipForTesting(loopState: MiningLoopState, targetBlockHeight: number | null): void;
272
- export declare function resolveSettledBoardForTesting(options: {
273
- snapshotState: NonNullable<WalletReadContext["snapshot"]>["state"] | null | undefined;
274
- snapshotTipHeight: number | null;
275
- snapshotTipPreviousHashHex?: string | null;
276
- nodeBestHeight: number | null;
277
- }): {
278
- settledBlockHeight: number | null;
279
- settledBoardEntries: MiningSentenceBoardEntry[];
280
- };
281
- export declare function getSelectedCandidateForTipForTesting(loopState: MiningLoopState, tipKey: string | null): MiningCandidate | null;
282
- export declare function cacheSelectedCandidateForTipForTesting(loopState: MiningLoopState, tipKey: string | null, candidate: MiningCandidate, liveState?: MiningStateRecord | null): void;
283
- export declare function resolveFundingDisplaySatsForTesting(state: WalletStateV1, rpc: MiningRpcClient): Promise<bigint>;
284
- export declare function loadMiningVisibleFollowBlockTimesForTesting(options: {
285
- rpc: MiningRpcClient;
286
- indexedTipHeight: number | null;
287
- indexedTipHashHex: string | null;
288
- }): Promise<Record<number, number>>;
289
- export declare function syncMiningVisualizerBlockTimesForTesting(loopState: MiningLoopState, blockTimesByHeight: Record<number, number>): void;
290
- declare function appendEvent(paths: WalletRuntimePaths, event: MiningEventRecord): Promise<void>;
291
- declare function createMiningPlan(options: {
292
- state: WalletStateV1;
293
- candidate: MiningCandidate;
294
- conflictOutpoint: OutpointRecord | null;
295
- allUtxos: Awaited<ReturnType<MiningRpcClient["listUnspent"]>>;
296
- feeRateSatVb: number;
297
- }): {
298
- sender: MutationSender;
299
- fixedInputs: FixedWalletInput[];
300
- outputs: unknown[];
301
- changeAddress: string;
302
- changePosition: number;
303
- expectedOpReturnScriptHex: string;
304
- allowedFundingScriptPubKeyHex: string;
305
- eligibleFundingOutpointKeys: Set<string>;
306
- expectedConflictOutpoint: OutpointRecord | null;
307
- feeRateSatVb: number;
308
- };
309
- export declare function createMiningPlanForTesting(options: {
310
- state: WalletStateV1;
311
- candidate: {
312
- domainId: number;
313
- domainName: string;
314
- localIndex: number;
315
- sender: MutationSender;
316
- sentence: string;
317
- encodedSentenceBytes: Uint8Array;
318
- bip39WordIndices: number[];
319
- bip39Words: readonly string[];
320
- canonicalBlend: bigint;
321
- referencedBlockHashDisplay: string;
322
- referencedBlockHashInternal: Uint8Array;
323
- targetBlockHeight: number;
324
- };
325
- conflictOutpoint: OutpointRecord | null;
326
- allUtxos: Awaited<ReturnType<MiningRpcClient["listUnspent"]>>;
327
- feeRateSatVb: number;
328
- }): {
329
- sender: MutationSender;
330
- fixedInputs: FixedWalletInput[];
331
- outputs: unknown[];
332
- changeAddress: string;
333
- changePosition: number;
334
- expectedOpReturnScriptHex: string;
335
- allowedFundingScriptPubKeyHex: string;
336
- eligibleFundingOutpointKeys: Set<string>;
337
- expectedConflictOutpoint: OutpointRecord | null;
338
- feeRateSatVb: number;
339
- };
340
- export declare function validateMiningDraftForTesting(decoded: Awaited<ReturnType<MiningRpcClient["decodePsbt"]>>, funded: Awaited<ReturnType<MiningRpcClient["walletCreateFundedPsbt"]>>, plan: ReturnType<typeof createMiningPlan>): void;
341
- declare function resolveEligibleAnchoredRoots(context: WalletReadContext): Array<{
342
- domainId: number;
343
- domainName: string;
344
- localIndex: number;
345
- sender: MutationSender;
346
- }>;
347
- export declare function refreshMiningCandidateFromCurrentStateForTesting(context: ReadyMiningReadContext, candidate: MiningCandidate): MiningCandidate | null;
348
- export declare function resolveMiningConflictOutpointForTesting(options: {
349
- state: WalletStateV1;
350
- allUtxos: Awaited<ReturnType<MiningRpcClient["listUnspent"]>>;
351
- }): OutpointRecord | null;
352
- export declare function buildMiningGenerationRequestForTesting(options: {
353
- targetBlockHeight: number;
354
- referencedBlockHashDisplay: string;
355
- generatedAtUnixMs?: number;
356
- requestId?: string;
357
- domains: Array<{
358
- domainId: number;
359
- domainName: string;
360
- requiredWords: [string, string, string, string, string];
361
- }>;
362
- domainExtraPrompts?: Record<string, string>;
363
- extraPrompt?: string | null;
364
- }): MiningSentenceGenerationRequest;
365
- declare function generateCandidatesForDomains(options: {
366
- rpc: MiningRpcClient;
367
- readContext: WalletReadContext & {
368
- localState: {
369
- availability: "ready";
370
- state: WalletStateV1;
371
- };
372
- snapshot: NonNullable<WalletReadContext["snapshot"]>;
373
- model: NonNullable<WalletReadContext["model"]>;
374
- };
375
- domains: ReturnType<typeof resolveEligibleAnchoredRoots>;
376
- provider: WalletSecretProvider;
377
- paths: WalletRuntimePaths;
378
- indexerTruthKey: IndexerTruthKey | null;
379
- runId?: string | null;
380
- fetchImpl?: typeof fetch;
381
- }): Promise<MiningCandidate[]>;
382
- declare function runCompetitivenessGate(options: {
383
- rpc: MiningRpcClient;
384
- readContext: WalletReadContext & {
385
- snapshot: NonNullable<WalletReadContext["snapshot"]>;
386
- };
387
- candidate: MiningCandidate;
388
- currentTxid: string | null;
389
- assaySentencesImpl?: typeof assaySentences;
390
- cooperativeYield?: MiningCooperativeYield;
391
- cooperativeYieldEvery?: number;
392
- }): Promise<CompetitivenessDecision>;
393
- declare function publishCandidateOnce(options: {
394
- readContext: WalletReadContext & {
395
- localState: {
396
- availability: "ready";
397
- state: WalletStateV1;
398
- };
399
- snapshot: NonNullable<WalletReadContext["snapshot"]>;
400
- model: NonNullable<WalletReadContext["model"]>;
401
- };
402
- candidate: MiningCandidate;
403
- dataDir: string;
404
- provider: WalletSecretProvider;
405
- paths: WalletRuntimePaths;
406
- attachService: typeof attachOrStartManagedBitcoindService;
407
- rpcFactory: (config: Parameters<typeof createRpcClient>[0]) => MiningRpcClient;
408
- runId: string | null;
409
- }): Promise<{
410
- state: WalletStateV1;
411
- txid: string | null;
412
- decision: string;
413
- }>;
414
- export declare function publishCandidateForTesting(options: {
415
- candidate: MiningCandidate;
416
- dataDir: string;
417
- databasePath: string;
418
- provider: WalletSecretProvider;
419
- paths: WalletRuntimePaths;
420
- fallbackState: WalletStateV1;
421
- openReadContext: typeof openWalletReadContext;
422
- attachService: typeof attachOrStartManagedBitcoindService;
423
- rpcFactory: (config: Parameters<typeof createRpcClient>[0]) => MiningRpcClient;
424
- runId: string | null;
425
- publishAttempt?: typeof publishCandidateOnce;
426
- appendEventFn?: typeof appendEvent;
427
- }): Promise<MiningPublishOutcome>;
85
+ declare function generateCandidatesForDomains(options: Parameters<typeof generateCandidatesForDomainsModule>[0]): Promise<MiningCandidate[]>;
86
+ declare function runCompetitivenessGate(options: Parameters<typeof runCompetitivenessGateModule>[0]): Promise<CompetitivenessDecision>;
428
87
  export declare function ensureBuiltInMiningSetupIfNeeded(options: {
429
88
  provider: WalletSecretProvider;
430
89
  prompter: WalletPrompter;
431
90
  paths: WalletRuntimePaths;
432
91
  }): Promise<boolean>;
433
- declare function saveStopSnapshot(options: {
434
- dataDir: string;
435
- databasePath: string;
436
- provider: WalletSecretProvider;
437
- paths: WalletRuntimePaths;
438
- runMode: "foreground" | "background";
439
- backgroundWorkerPid: number | null;
440
- backgroundWorkerRunId: string | null;
441
- note: string | null;
442
- }): Promise<void>;
443
92
  declare function runMiningLoop(options: {
444
93
  dataDir: string;
445
94
  databasePath: string;
@@ -481,28 +130,6 @@ export declare function runBackgroundMiningWorker(options: RunnerDependencies &
481
130
  provider?: WalletSecretProvider;
482
131
  paths?: WalletRuntimePaths;
483
132
  }): Promise<void>;
484
- export declare function handleDetectedMiningRuntimeResumeForTesting(options: {
485
- dataDir: string;
486
- databasePath: string;
487
- provider: WalletSecretProvider;
488
- paths: WalletRuntimePaths;
489
- runMode: "foreground" | "background";
490
- backgroundWorkerPid: number | null;
491
- backgroundWorkerRunId: string | null;
492
- detectedAtUnixMs: number;
493
- openReadContext: typeof openWalletReadContext;
494
- visualizer?: MiningFollowVisualizer;
495
- loopState?: MiningLoopState;
496
- }): Promise<void>;
497
- export declare function takeOverMiningRuntimeForTesting(options: {
498
- paths: WalletRuntimePaths;
499
- reason: string;
500
- clearControlLockFile?: boolean;
501
- controlLockMetadata?: Awaited<ReturnType<typeof readLockMetadata>>;
502
- requestMiningPreemption?: typeof requestMiningGenerationPreemption;
503
- shutdownGraceMs?: number;
504
- sleepImpl?: typeof sleep;
505
- }): Promise<MiningRuntimeTakeoverResult>;
506
133
  export declare function performMiningCycleForTesting(options: {
507
134
  dataDir: string;
508
135
  databasePath: string;
@@ -559,43 +186,10 @@ export declare function runMiningLoopForTesting(options: {
559
186
  cooperativeYieldImpl?: MiningCooperativeYield;
560
187
  cooperativeYieldEvery?: number;
561
188
  }): Promise<void>;
562
- export declare function runCompetitivenessGateForTesting(options: {
563
- rpc: MiningRpcClient;
564
- readContext: WalletReadContext & {
565
- snapshot: NonNullable<WalletReadContext["snapshot"]>;
566
- };
567
- candidate: MiningCandidate;
568
- currentTxid: string | null;
569
- assaySentencesImpl?: typeof assaySentences;
570
- cooperativeYieldImpl?: MiningCooperativeYield;
571
- cooperativeYieldEvery?: number;
572
- }): Promise<CompetitivenessDecision>;
573
189
  export declare function createMiningSuspendDetectorForTesting(options?: {
574
190
  monotonicNow?: () => number;
575
191
  nowUnixMs?: () => number;
576
192
  scheduler?: MiningSuspendScheduler;
577
193
  }): MiningSuspendDetector;
578
194
  export declare function throwIfMiningSuspendDetectedForTesting(detector: MiningSuspendDetector): void;
579
- export declare function topologicallyOrderAncestorTxidsForTesting(options: {
580
- txid: string;
581
- txContexts: Map<string, {
582
- txid: string;
583
- rawTransaction: Awaited<ReturnType<MiningRpcClient["getRawTransaction"]>>;
584
- }>;
585
- }): string[] | null;
586
- export declare function buildPrePublishStatusOverridesForTesting(options: {
587
- state: WalletStateV1;
588
- candidate: MiningCandidate;
589
- }): MiningRunnerStatusOverrides;
590
- export declare function buildStatusSnapshotForTesting(view: MiningControlPlaneView, overrides?: MiningRunnerStatusOverrides): MiningRuntimeStatusV1;
591
- export declare function shouldKeepCurrentTipLivePublishForTesting(options: {
592
- liveState: MiningStateRecord;
593
- candidate: {
594
- domainId: number;
595
- sender: MutationSender;
596
- encodedSentenceBytes: Uint8Array;
597
- referencedBlockHashDisplay: string;
598
- targetBlockHeight: number;
599
- };
600
- }): boolean;
601
195
  export {};