@cogcoin/client 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +136 -0
- package/dist/app-paths.d.ts +38 -0
- package/dist/app-paths.js +121 -0
- package/dist/art/banner.txt +13 -0
- package/dist/art/scroll.txt +13 -0
- package/dist/art/train-car.txt +6 -0
- package/dist/art/train-smoke.txt +6 -0
- package/dist/art/train.txt +6 -0
- package/dist/bitcoind/bootstrap/chainstate.d.ts +4 -0
- package/dist/bitcoind/bootstrap/chainstate.js +13 -0
- package/dist/bitcoind/bootstrap/constants.d.ts +7 -0
- package/dist/bitcoind/bootstrap/constants.js +12 -0
- package/dist/bitcoind/bootstrap/controller.d.ts +29 -0
- package/dist/bitcoind/bootstrap/controller.js +101 -0
- package/dist/bitcoind/bootstrap/download.d.ts +2 -0
- package/dist/bitcoind/bootstrap/download.js +196 -0
- package/dist/bitcoind/bootstrap/headers.d.ts +13 -0
- package/dist/bitcoind/bootstrap/headers.js +61 -0
- package/dist/bitcoind/bootstrap/paths.d.ts +4 -0
- package/dist/bitcoind/bootstrap/paths.js +15 -0
- package/dist/bitcoind/bootstrap/snapshot-file.d.ts +7 -0
- package/dist/bitcoind/bootstrap/snapshot-file.js +42 -0
- package/dist/bitcoind/bootstrap/state.d.ts +40 -0
- package/dist/bitcoind/bootstrap/state.js +70 -0
- package/dist/bitcoind/bootstrap/types.d.ts +28 -0
- package/dist/bitcoind/bootstrap/types.js +1 -0
- package/dist/bitcoind/bootstrap.d.ts +8 -0
- package/dist/bitcoind/bootstrap.js +7 -0
- package/dist/bitcoind/client/factory.d.ts +3 -0
- package/dist/bitcoind/client/factory.js +57 -0
- package/dist/bitcoind/client/follow-block-times.d.ts +8 -0
- package/dist/bitcoind/client/follow-block-times.js +25 -0
- package/dist/bitcoind/client/follow-loop.d.ts +10 -0
- package/dist/bitcoind/client/follow-loop.js +57 -0
- package/dist/bitcoind/client/internal-types.d.ts +63 -0
- package/dist/bitcoind/client/internal-types.js +18 -0
- package/dist/bitcoind/client/managed-client.d.ts +20 -0
- package/dist/bitcoind/client/managed-client.js +197 -0
- package/dist/bitcoind/client/rate-tracker.d.ts +2 -0
- package/dist/bitcoind/client/rate-tracker.js +24 -0
- package/dist/bitcoind/client/sync-engine.d.ts +3 -0
- package/dist/bitcoind/client/sync-engine.js +143 -0
- package/dist/bitcoind/client.d.ts +1 -0
- package/dist/bitcoind/client.js +1 -0
- package/dist/bitcoind/errors.d.ts +1 -0
- package/dist/bitcoind/errors.js +49 -0
- package/dist/bitcoind/index.d.ts +2 -0
- package/dist/bitcoind/index.js +1 -0
- package/dist/bitcoind/indexer-daemon-main.d.ts +1 -0
- package/dist/bitcoind/indexer-daemon-main.js +472 -0
- package/dist/bitcoind/indexer-daemon.d.ts +107 -0
- package/dist/bitcoind/indexer-daemon.js +391 -0
- package/dist/bitcoind/node.d.ts +8 -0
- package/dist/bitcoind/node.js +219 -0
- package/dist/bitcoind/normalize.d.ts +3 -0
- package/dist/bitcoind/normalize.js +47 -0
- package/dist/bitcoind/progress/assets.d.ts +10 -0
- package/dist/bitcoind/progress/assets.js +90 -0
- package/dist/bitcoind/progress/constants.d.ts +48 -0
- package/dist/bitcoind/progress/constants.js +53 -0
- package/dist/bitcoind/progress/controller.d.ts +28 -0
- package/dist/bitcoind/progress/controller.js +188 -0
- package/dist/bitcoind/progress/follow-scene.d.ts +40 -0
- package/dist/bitcoind/progress/follow-scene.js +367 -0
- package/dist/bitcoind/progress/formatting.d.ts +23 -0
- package/dist/bitcoind/progress/formatting.js +227 -0
- package/dist/bitcoind/progress/quote-scene.d.ts +4 -0
- package/dist/bitcoind/progress/quote-scene.js +137 -0
- package/dist/bitcoind/progress/train-scene.d.ts +9 -0
- package/dist/bitcoind/progress/train-scene.js +92 -0
- package/dist/bitcoind/progress/tty-renderer.d.ts +18 -0
- package/dist/bitcoind/progress/tty-renderer.js +150 -0
- package/dist/bitcoind/progress.d.ts +7 -0
- package/dist/bitcoind/progress.js +7 -0
- package/dist/bitcoind/quotes.d.ts +24 -0
- package/dist/bitcoind/quotes.js +195 -0
- package/dist/bitcoind/rpc.d.ts +71 -0
- package/dist/bitcoind/rpc.js +322 -0
- package/dist/bitcoind/service-paths.d.ts +19 -0
- package/dist/bitcoind/service-paths.js +49 -0
- package/dist/bitcoind/service.d.ts +40 -0
- package/dist/bitcoind/service.js +735 -0
- package/dist/bitcoind/testing.d.ts +9 -0
- package/dist/bitcoind/testing.js +9 -0
- package/dist/bitcoind/types.d.ts +396 -0
- package/dist/bitcoind/types.js +3 -0
- package/dist/bytes.d.ts +9 -0
- package/dist/bytes.js +36 -0
- package/dist/cli/commands/follow.d.ts +2 -0
- package/dist/cli/commands/follow.js +43 -0
- package/dist/cli/commands/mining-admin.d.ts +2 -0
- package/dist/cli/commands/mining-admin.js +92 -0
- package/dist/cli/commands/mining-read.d.ts +2 -0
- package/dist/cli/commands/mining-read.js +173 -0
- package/dist/cli/commands/mining-runtime.d.ts +2 -0
- package/dist/cli/commands/mining-runtime.js +108 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/status.js +31 -0
- package/dist/cli/commands/sync.d.ts +2 -0
- package/dist/cli/commands/sync.js +52 -0
- package/dist/cli/commands/wallet-admin.d.ts +2 -0
- package/dist/cli/commands/wallet-admin.js +175 -0
- package/dist/cli/commands/wallet-mutation.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation.js +681 -0
- package/dist/cli/commands/wallet-read.d.ts +2 -0
- package/dist/cli/commands/wallet-read.js +265 -0
- package/dist/cli/context.d.ts +3 -0
- package/dist/cli/context.js +75 -0
- package/dist/cli/io.d.ts +3 -0
- package/dist/cli/io.js +12 -0
- package/dist/cli/mining-format.d.ts +5 -0
- package/dist/cli/mining-format.js +156 -0
- package/dist/cli/mining-json.d.ts +49 -0
- package/dist/cli/mining-json.js +89 -0
- package/dist/cli/mutation-command-groups.d.ts +15 -0
- package/dist/cli/mutation-command-groups.js +71 -0
- package/dist/cli/mutation-json.d.ts +430 -0
- package/dist/cli/mutation-json.js +311 -0
- package/dist/cli/mutation-resolved-json.d.ts +124 -0
- package/dist/cli/mutation-resolved-json.js +129 -0
- package/dist/cli/mutation-success.d.ts +20 -0
- package/dist/cli/mutation-success.js +47 -0
- package/dist/cli/mutation-text-format.d.ts +22 -0
- package/dist/cli/mutation-text-format.js +171 -0
- package/dist/cli/mutation-text-write.d.ts +13 -0
- package/dist/cli/mutation-text-write.js +16 -0
- package/dist/cli/output.d.ts +185 -0
- package/dist/cli/output.js +1085 -0
- package/dist/cli/parse.d.ts +3 -0
- package/dist/cli/parse.js +971 -0
- package/dist/cli/preview-json.d.ts +416 -0
- package/dist/cli/preview-json.js +293 -0
- package/dist/cli/prompt.d.ts +3 -0
- package/dist/cli/prompt.js +33 -0
- package/dist/cli/read-json.d.ts +187 -0
- package/dist/cli/read-json.js +675 -0
- package/dist/cli/runner.d.ts +2 -0
- package/dist/cli/runner.js +129 -0
- package/dist/cli/signals.d.ts +3 -0
- package/dist/cli/signals.js +63 -0
- package/dist/cli/status-format.d.ts +2 -0
- package/dist/cli/status-format.js +48 -0
- package/dist/cli/types.d.ts +148 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/wallet-format.d.ts +29 -0
- package/dist/cli/wallet-format.js +637 -0
- package/dist/cli/workflow-hints.d.ts +13 -0
- package/dist/cli/workflow-hints.js +94 -0
- package/dist/cli-runner.d.ts +3 -0
- package/dist/cli-runner.js +3 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/client/default-client.d.ts +11 -0
- package/dist/client/default-client.js +118 -0
- package/dist/client/factory.d.ts +2 -0
- package/dist/client/factory.js +15 -0
- package/dist/client/initialization.d.ts +6 -0
- package/dist/client/initialization.js +30 -0
- package/dist/client/persistence.d.ts +5 -0
- package/dist/client/persistence.js +28 -0
- package/dist/client/store-adapter.d.ts +3 -0
- package/dist/client/store-adapter.js +20 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/passive-status.d.ts +36 -0
- package/dist/passive-status.js +100 -0
- package/dist/sqlite/better-sqlite3.d.ts +26 -0
- package/dist/sqlite/better-sqlite3.js +4 -0
- package/dist/sqlite/checkpoints.d.ts +11 -0
- package/dist/sqlite/checkpoints.js +27 -0
- package/dist/sqlite/driver.d.ts +17 -0
- package/dist/sqlite/driver.js +98 -0
- package/dist/sqlite/index.d.ts +4 -0
- package/dist/sqlite/index.js +9 -0
- package/dist/sqlite/migrate.d.ts +2 -0
- package/dist/sqlite/migrate.js +37 -0
- package/dist/sqlite/store.d.ts +3 -0
- package/dist/sqlite/store.js +122 -0
- package/dist/sqlite/tip-meta.d.ts +26 -0
- package/dist/sqlite/tip-meta.js +97 -0
- package/dist/sqlite/types.d.ts +10 -0
- package/dist/sqlite/types.js +1 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.js +1 -0
- package/dist/wallet/archive.d.ts +4 -0
- package/dist/wallet/archive.js +39 -0
- package/dist/wallet/cogop/constants.d.ts +32 -0
- package/dist/wallet/cogop/constants.js +32 -0
- package/dist/wallet/cogop/index.d.ts +32 -0
- package/dist/wallet/cogop/index.js +213 -0
- package/dist/wallet/cogop/numeric.d.ts +3 -0
- package/dist/wallet/cogop/numeric.js +24 -0
- package/dist/wallet/cogop/scriptpubkey.d.ts +2 -0
- package/dist/wallet/cogop/scriptpubkey.js +13 -0
- package/dist/wallet/cogop/validate-name.d.ts +2 -0
- package/dist/wallet/cogop/validate-name.js +18 -0
- package/dist/wallet/fs/atomic.d.ts +6 -0
- package/dist/wallet/fs/atomic.js +46 -0
- package/dist/wallet/fs/lock.d.ts +19 -0
- package/dist/wallet/fs/lock.js +61 -0
- package/dist/wallet/fs/status-file.d.ts +1 -0
- package/dist/wallet/fs/status-file.js +4 -0
- package/dist/wallet/lifecycle.d.ts +193 -0
- package/dist/wallet/lifecycle.js +1475 -0
- package/dist/wallet/material.d.ts +45 -0
- package/dist/wallet/material.js +118 -0
- package/dist/wallet/mining/config.d.ts +18 -0
- package/dist/wallet/mining/config.js +44 -0
- package/dist/wallet/mining/constants.d.ts +24 -0
- package/dist/wallet/mining/constants.js +24 -0
- package/dist/wallet/mining/control.d.ts +53 -0
- package/dist/wallet/mining/control.js +758 -0
- package/dist/wallet/mining/coordination.d.ts +40 -0
- package/dist/wallet/mining/coordination.js +121 -0
- package/dist/wallet/mining/hook-protocol.d.ts +47 -0
- package/dist/wallet/mining/hook-protocol.js +161 -0
- package/dist/wallet/mining/hook-runner.d.ts +1 -0
- package/dist/wallet/mining/hook-runner.js +52 -0
- package/dist/wallet/mining/hooks.d.ts +38 -0
- package/dist/wallet/mining/hooks.js +520 -0
- package/dist/wallet/mining/index.d.ts +8 -0
- package/dist/wallet/mining/index.js +6 -0
- package/dist/wallet/mining/runner.d.ts +155 -0
- package/dist/wallet/mining/runner.js +2574 -0
- package/dist/wallet/mining/runtime-artifacts.d.ts +17 -0
- package/dist/wallet/mining/runtime-artifacts.js +166 -0
- package/dist/wallet/mining/sentences.d.ts +23 -0
- package/dist/wallet/mining/sentences.js +281 -0
- package/dist/wallet/mining/state.d.ts +9 -0
- package/dist/wallet/mining/state.js +75 -0
- package/dist/wallet/mining/types.d.ts +141 -0
- package/dist/wallet/mining/types.js +1 -0
- package/dist/wallet/mining/visualizer.d.ts +19 -0
- package/dist/wallet/mining/visualizer.js +134 -0
- package/dist/wallet/mining/worker-main.d.ts +1 -0
- package/dist/wallet/mining/worker-main.js +17 -0
- package/dist/wallet/read/context.d.ts +20 -0
- package/dist/wallet/read/context.js +532 -0
- package/dist/wallet/read/filter.d.ts +9 -0
- package/dist/wallet/read/filter.js +42 -0
- package/dist/wallet/read/index.d.ts +4 -0
- package/dist/wallet/read/index.js +3 -0
- package/dist/wallet/read/project.d.ts +11 -0
- package/dist/wallet/read/project.js +300 -0
- package/dist/wallet/read/types.d.ts +144 -0
- package/dist/wallet/read/types.js +1 -0
- package/dist/wallet/runtime.d.ts +26 -0
- package/dist/wallet/runtime.js +28 -0
- package/dist/wallet/state/crypto.d.ts +31 -0
- package/dist/wallet/state/crypto.js +127 -0
- package/dist/wallet/state/provider.d.ts +37 -0
- package/dist/wallet/state/provider.js +312 -0
- package/dist/wallet/state/session.d.ts +12 -0
- package/dist/wallet/state/session.js +23 -0
- package/dist/wallet/state/storage.d.ts +19 -0
- package/dist/wallet/state/storage.js +55 -0
- package/dist/wallet/tx/anchor.d.ts +40 -0
- package/dist/wallet/tx/anchor.js +1210 -0
- package/dist/wallet/tx/cog.d.ts +92 -0
- package/dist/wallet/tx/cog.js +1055 -0
- package/dist/wallet/tx/common.d.ts +89 -0
- package/dist/wallet/tx/common.js +156 -0
- package/dist/wallet/tx/confirm.d.ts +15 -0
- package/dist/wallet/tx/confirm.js +24 -0
- package/dist/wallet/tx/domain-admin.d.ts +105 -0
- package/dist/wallet/tx/domain-admin.js +869 -0
- package/dist/wallet/tx/domain-market.d.ts +112 -0
- package/dist/wallet/tx/domain-market.js +1365 -0
- package/dist/wallet/tx/field.d.ts +101 -0
- package/dist/wallet/tx/field.js +1853 -0
- package/dist/wallet/tx/identity-selector.d.ts +12 -0
- package/dist/wallet/tx/identity-selector.js +52 -0
- package/dist/wallet/tx/index.d.ts +7 -0
- package/dist/wallet/tx/index.js +7 -0
- package/dist/wallet/tx/journal.d.ts +5 -0
- package/dist/wallet/tx/journal.js +31 -0
- package/dist/wallet/tx/register.d.ts +68 -0
- package/dist/wallet/tx/register.js +952 -0
- package/dist/wallet/tx/reputation.d.ts +72 -0
- package/dist/wallet/tx/reputation.js +693 -0
- package/dist/wallet/tx/targets.d.ts +7 -0
- package/dist/wallet/tx/targets.js +122 -0
- package/dist/wallet/types.d.ts +249 -0
- package/dist/wallet/types.js +1 -0
- package/dist/writing_quotes.json +1654 -0
- package/package.json +78 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { ManagedBitcoindHealth, ManagedIndexerTruthSource } from "../../bitcoind/types.js";
|
|
2
|
+
import type { MiningHookOperatorValidationState } from "./hook-protocol.js";
|
|
3
|
+
export type MiningServiceHealth = "synced" | "catching-up" | "reorging" | "starting" | "stale-heartbeat" | "failed" | "schema-mismatch" | "service-version-mismatch" | "wallet-root-mismatch" | "unavailable";
|
|
4
|
+
export type MiningProviderKind = "openai" | "anthropic";
|
|
5
|
+
export interface MiningProviderConfigRecord {
|
|
6
|
+
provider: MiningProviderKind;
|
|
7
|
+
apiKey: string;
|
|
8
|
+
extraPrompt: string | null;
|
|
9
|
+
modelOverride: string | null;
|
|
10
|
+
updatedAtUnixMs: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ClientConfigV1 {
|
|
13
|
+
schemaVersion: 1;
|
|
14
|
+
mining: {
|
|
15
|
+
builtIn: MiningProviderConfigRecord | null;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface MiningEventRecord {
|
|
19
|
+
schemaVersion: 1;
|
|
20
|
+
timestampUnixMs: number;
|
|
21
|
+
level: "info" | "warn" | "error";
|
|
22
|
+
kind: string;
|
|
23
|
+
message: string;
|
|
24
|
+
targetBlockHeight?: number | null;
|
|
25
|
+
referencedBlockHashDisplay?: string | null;
|
|
26
|
+
domainId?: number | null;
|
|
27
|
+
domainName?: string | null;
|
|
28
|
+
txid?: string | null;
|
|
29
|
+
feeRateSatVb?: number | null;
|
|
30
|
+
feeSats?: string | null;
|
|
31
|
+
score?: string | null;
|
|
32
|
+
reason?: string | null;
|
|
33
|
+
runId?: string | null;
|
|
34
|
+
}
|
|
35
|
+
export interface MiningRuntimeStatusV1 {
|
|
36
|
+
schemaVersion: 1;
|
|
37
|
+
walletRootId: string | null;
|
|
38
|
+
workerApiVersion: "cogcoin/mining-worker/v1" | null;
|
|
39
|
+
workerBinaryVersion: string | null;
|
|
40
|
+
workerBuildId: string | null;
|
|
41
|
+
updatedAtUnixMs: number;
|
|
42
|
+
runMode: "stopped" | "foreground" | "background";
|
|
43
|
+
backgroundWorkerPid: number | null;
|
|
44
|
+
backgroundWorkerRunId: string | null;
|
|
45
|
+
backgroundWorkerHeartbeatAtUnixMs: number | null;
|
|
46
|
+
backgroundWorkerHealth: "healthy" | "stale-pid" | "stale-heartbeat" | "version-mismatch" | null;
|
|
47
|
+
indexerDaemonState: "unavailable" | "starting" | "catching-up" | "reorging" | "synced" | "stale-heartbeat" | "failed" | "schema-mismatch" | "service-version-mismatch" | "wallet-root-mismatch" | null;
|
|
48
|
+
indexerDaemonInstanceId: string | null;
|
|
49
|
+
indexerSnapshotSeq?: string | null;
|
|
50
|
+
indexerSnapshotOpenedAtUnixMs?: number | null;
|
|
51
|
+
indexerTruthSource?: ManagedIndexerTruthSource;
|
|
52
|
+
indexerHeartbeatAtUnixMs: number | null;
|
|
53
|
+
coreBestHeight: number | null;
|
|
54
|
+
coreBestHash: string | null;
|
|
55
|
+
indexerTipHeight: number | null;
|
|
56
|
+
indexerTipHash: string | null;
|
|
57
|
+
indexerReorgDepth: number | null;
|
|
58
|
+
indexerTipAligned: boolean | null;
|
|
59
|
+
corePublishState: "unknown" | "network-inactive" | "no-outbound-peers" | "ibd" | "mempool-loading" | "healthy" | null;
|
|
60
|
+
providerState: "n/a" | "ready" | "backoff" | "unavailable" | "rate-limited" | "auth-error" | "hook-error" | null;
|
|
61
|
+
lastSuspendDetectedAtUnixMs: number | null;
|
|
62
|
+
reconnectSettledUntilUnixMs: number | null;
|
|
63
|
+
tipSettledUntilUnixMs: number | null;
|
|
64
|
+
miningState: "idle" | "live" | "paused" | "paused-stale" | "repair-required";
|
|
65
|
+
currentPhase: "idle" | "generating" | "scoring" | "publishing" | "replacing" | "waiting" | "waiting-provider" | "waiting-bitcoin-network" | "waiting-indexer" | "resuming";
|
|
66
|
+
currentPublishState: "none" | "broadcasting" | "broadcast-unknown" | "in-mempool";
|
|
67
|
+
targetBlockHeight: number | null;
|
|
68
|
+
referencedBlockHashDisplay: string | null;
|
|
69
|
+
currentDomainId: number | null;
|
|
70
|
+
currentDomainName: string | null;
|
|
71
|
+
currentSentenceDisplay: string | null;
|
|
72
|
+
currentCanonicalBlend: string | null;
|
|
73
|
+
currentTxid: string | null;
|
|
74
|
+
currentWtxid: string | null;
|
|
75
|
+
liveMiningFamilyInMempool: boolean | null;
|
|
76
|
+
currentFeeRateSatVb: number | null;
|
|
77
|
+
currentAbsoluteFeeSats: number | null;
|
|
78
|
+
currentBlockFeeSpentSats: string;
|
|
79
|
+
sessionFeeSpentSats: string;
|
|
80
|
+
lifetimeFeeSpentSats: string;
|
|
81
|
+
sameDomainCompetitorSuppressed: boolean | null;
|
|
82
|
+
higherRankedCompetitorDomainCount: number | null;
|
|
83
|
+
dedupedCompetitorDomainCount: number | null;
|
|
84
|
+
competitivenessGateIndeterminate: boolean | null;
|
|
85
|
+
mempoolSequenceCacheStatus: "reused" | "refreshed" | null;
|
|
86
|
+
currentPublishDecision: string | null;
|
|
87
|
+
lastMempoolSequence: string | null;
|
|
88
|
+
lastCompetitivenessGateAtUnixMs: number | null;
|
|
89
|
+
pauseReason: string | null;
|
|
90
|
+
hookMode: "builtin" | "custom";
|
|
91
|
+
providerConfigured: boolean;
|
|
92
|
+
providerKind: MiningProviderKind | null;
|
|
93
|
+
bitcoindHealth: ManagedBitcoindHealth;
|
|
94
|
+
bitcoindServiceState: "starting" | "ready" | "stopping" | "failed" | null;
|
|
95
|
+
bitcoindReplicaStatus: "not-proven" | "ready" | "missing" | "mismatch" | null;
|
|
96
|
+
nodeHealth: MiningServiceHealth;
|
|
97
|
+
indexerHealth: MiningServiceHealth;
|
|
98
|
+
tipsAligned: boolean | null;
|
|
99
|
+
lastValidationState: "unknown" | "validated" | "stale" | "failed" | null;
|
|
100
|
+
lastOperatorValidationState: MiningHookOperatorValidationState | null;
|
|
101
|
+
lastValidationAtUnixMs: number | null;
|
|
102
|
+
lastEventAtUnixMs: number | null;
|
|
103
|
+
lastError: string | null;
|
|
104
|
+
note: string | null;
|
|
105
|
+
}
|
|
106
|
+
export interface MiningHookInspection {
|
|
107
|
+
mode: "builtin" | "custom" | "disabled" | "unavailable";
|
|
108
|
+
entrypointPath: string;
|
|
109
|
+
packagePath: string;
|
|
110
|
+
entrypointExists: boolean;
|
|
111
|
+
packageStatus: "valid" | "missing" | "invalid";
|
|
112
|
+
packageMessage: string | null;
|
|
113
|
+
trustStatus: "trusted" | "untrusted" | "missing";
|
|
114
|
+
trustMessage: string | null;
|
|
115
|
+
validationState: "unknown" | "validated" | "stale" | "failed" | "unavailable";
|
|
116
|
+
operatorValidationState: MiningHookOperatorValidationState;
|
|
117
|
+
validationError: string | null;
|
|
118
|
+
validatedAtUnixMs: number | null;
|
|
119
|
+
validatedLaunchFingerprint: string | null;
|
|
120
|
+
validatedFullFingerprint: string | null;
|
|
121
|
+
currentLaunchFingerprint: string | null;
|
|
122
|
+
currentFullFingerprint: string | null;
|
|
123
|
+
verifyUsed: boolean;
|
|
124
|
+
cooldownUntilUnixMs: number | null;
|
|
125
|
+
cooldownActive: boolean;
|
|
126
|
+
consecutiveFailureCount: number;
|
|
127
|
+
}
|
|
128
|
+
export interface MiningProviderInspection {
|
|
129
|
+
configured: boolean;
|
|
130
|
+
provider: MiningProviderKind | null;
|
|
131
|
+
status: "ready" | "missing" | "error";
|
|
132
|
+
message: string | null;
|
|
133
|
+
modelOverride: string | null;
|
|
134
|
+
extraPromptConfigured: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface MiningControlPlaneView {
|
|
137
|
+
runtime: MiningRuntimeStatusV1;
|
|
138
|
+
hook: MiningHookInspection;
|
|
139
|
+
provider: MiningProviderInspection;
|
|
140
|
+
lastEventAtUnixMs: number | null;
|
|
141
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ProgressOutputMode } from "../../bitcoind/types.js";
|
|
2
|
+
import type { MiningRuntimeStatusV1 } from "./types.js";
|
|
3
|
+
interface RenderStream {
|
|
4
|
+
isTTY?: boolean;
|
|
5
|
+
columns?: number;
|
|
6
|
+
write(chunk: string): boolean | void;
|
|
7
|
+
}
|
|
8
|
+
export declare function describeMiningVisualizerStatus(snapshot: MiningRuntimeStatusV1): string;
|
|
9
|
+
export declare function describeMiningVisualizerProgress(snapshot: MiningRuntimeStatusV1): string;
|
|
10
|
+
export declare class MiningFollowVisualizer {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(options?: {
|
|
13
|
+
progressOutput?: ProgressOutputMode;
|
|
14
|
+
stream?: RenderStream;
|
|
15
|
+
});
|
|
16
|
+
update(snapshot: MiningRuntimeStatusV1): void;
|
|
17
|
+
close(): void;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { createBootstrapProgress } from "../../bitcoind/progress/formatting.js";
|
|
2
|
+
import { createFollowSceneState, syncFollowSceneState, } from "../../bitcoind/progress/follow-scene.js";
|
|
3
|
+
import { TtyProgressRenderer } from "../../bitcoind/progress/tty-renderer.js";
|
|
4
|
+
const VISUALIZER_PROGRESS_SNAPSHOT = {
|
|
5
|
+
url: "",
|
|
6
|
+
filename: "mining-follow-visualizer",
|
|
7
|
+
height: 0,
|
|
8
|
+
sha256: "",
|
|
9
|
+
sizeBytes: 1,
|
|
10
|
+
};
|
|
11
|
+
function shouldRenderToTty(progressOutput, stream) {
|
|
12
|
+
if (progressOutput === "none") {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (progressOutput === "tty") {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return stream.isTTY === true;
|
|
19
|
+
}
|
|
20
|
+
export function describeMiningVisualizerStatus(snapshot) {
|
|
21
|
+
switch (snapshot.currentPhase) {
|
|
22
|
+
case "resuming":
|
|
23
|
+
return "Resuming after suspend";
|
|
24
|
+
case "waiting-provider":
|
|
25
|
+
return snapshot.providerState === "hook-error"
|
|
26
|
+
? "Waiting for hook"
|
|
27
|
+
: "Waiting for provider";
|
|
28
|
+
case "waiting-indexer":
|
|
29
|
+
return snapshot.indexerDaemonState === "reorging"
|
|
30
|
+
? "Indexer replaying reorg"
|
|
31
|
+
: "Waiting for indexer";
|
|
32
|
+
case "waiting-bitcoin-network":
|
|
33
|
+
return "Waiting for Bitcoin node";
|
|
34
|
+
case "generating":
|
|
35
|
+
return "Generating candidates";
|
|
36
|
+
case "scoring":
|
|
37
|
+
return "Scoring candidates";
|
|
38
|
+
case "publishing":
|
|
39
|
+
return snapshot.currentPublishDecision === "fee-bump"
|
|
40
|
+
? "Fee-bumping mining tx"
|
|
41
|
+
: snapshot.currentPublishDecision === "replacing"
|
|
42
|
+
|| snapshot.currentPublishDecision === "replaced"
|
|
43
|
+
? "Replacing mining tx"
|
|
44
|
+
: "Broadcasting mining tx";
|
|
45
|
+
case "replacing":
|
|
46
|
+
return "Replacing mining tx";
|
|
47
|
+
default:
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
if (snapshot.miningState === "repair-required") {
|
|
51
|
+
return "Mining repair required";
|
|
52
|
+
}
|
|
53
|
+
if (snapshot.pauseReason === "zero-reward") {
|
|
54
|
+
return "Zero-reward height";
|
|
55
|
+
}
|
|
56
|
+
if (snapshot.currentPublishDecision === "suppressed-same-domain-mempool") {
|
|
57
|
+
return "Same-domain tx already live";
|
|
58
|
+
}
|
|
59
|
+
if (snapshot.currentPublishDecision === "suppressed-top5-mempool") {
|
|
60
|
+
return "Stronger mempool roots live";
|
|
61
|
+
}
|
|
62
|
+
if (snapshot.currentPublishDecision === "indeterminate-mempool-gate") {
|
|
63
|
+
return "Mempool gate indeterminate";
|
|
64
|
+
}
|
|
65
|
+
if (snapshot.liveMiningFamilyInMempool) {
|
|
66
|
+
return "Waiting for next block";
|
|
67
|
+
}
|
|
68
|
+
return "Waiting for next block";
|
|
69
|
+
}
|
|
70
|
+
export function describeMiningVisualizerProgress(snapshot) {
|
|
71
|
+
if (snapshot.note !== null && snapshot.note !== undefined && snapshot.note.length > 0) {
|
|
72
|
+
return snapshot.note;
|
|
73
|
+
}
|
|
74
|
+
switch (snapshot.currentPhase) {
|
|
75
|
+
case "resuming":
|
|
76
|
+
return "Mining discarded stale in-flight work after a large local runtime gap and is rechecking health.";
|
|
77
|
+
case "waiting-provider":
|
|
78
|
+
return "Mining is waiting for the sentence provider to recover.";
|
|
79
|
+
case "waiting-indexer":
|
|
80
|
+
return "Mining is waiting for Bitcoin Core and the indexer to align.";
|
|
81
|
+
case "waiting-bitcoin-network":
|
|
82
|
+
return "Mining is waiting for the local Bitcoin node to become publishable.";
|
|
83
|
+
case "generating":
|
|
84
|
+
return "Generating mining sentences for eligible root domains.";
|
|
85
|
+
case "scoring":
|
|
86
|
+
return "Scoring mining candidates for the current tip.";
|
|
87
|
+
case "publishing":
|
|
88
|
+
return snapshot.currentPublishDecision === "fee-bump"
|
|
89
|
+
? "Publishing a fee bump for the live mining family."
|
|
90
|
+
: snapshot.currentPublishDecision === "replacing"
|
|
91
|
+
|| snapshot.currentPublishDecision === "replaced"
|
|
92
|
+
? "Replacing the live mining transaction for the current tip."
|
|
93
|
+
: "Broadcasting the best mining candidate for the current tip.";
|
|
94
|
+
case "replacing":
|
|
95
|
+
return "Replacing the live mining transaction for the current tip.";
|
|
96
|
+
default:
|
|
97
|
+
return "Waiting for the next block while mining stays ready on the current tip.";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export class MiningFollowVisualizer {
|
|
101
|
+
#renderer;
|
|
102
|
+
#progress = createBootstrapProgress("follow_tip", VISUALIZER_PROGRESS_SNAPSHOT);
|
|
103
|
+
#scene = createFollowSceneState();
|
|
104
|
+
constructor(options = {}) {
|
|
105
|
+
const stream = options.stream ?? process.stderr;
|
|
106
|
+
const progressOutput = options.progressOutput ?? "auto";
|
|
107
|
+
this.#renderer = shouldRenderToTty(progressOutput, stream)
|
|
108
|
+
? new TtyProgressRenderer(stream)
|
|
109
|
+
: null;
|
|
110
|
+
}
|
|
111
|
+
update(snapshot) {
|
|
112
|
+
if (this.#renderer === null) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const indexedHeight = snapshot.indexerTipHeight ?? snapshot.coreBestHeight ?? null;
|
|
116
|
+
const nodeHeight = snapshot.coreBestHeight ?? indexedHeight;
|
|
117
|
+
this.#progress.phase = "follow_tip";
|
|
118
|
+
this.#progress.message = describeMiningVisualizerProgress(snapshot);
|
|
119
|
+
this.#progress.updatedAt = Date.now();
|
|
120
|
+
this.#progress.blocks = nodeHeight;
|
|
121
|
+
this.#progress.targetHeight = nodeHeight;
|
|
122
|
+
this.#progress.etaSeconds = null;
|
|
123
|
+
this.#progress.lastError = snapshot.lastError;
|
|
124
|
+
syncFollowSceneState(this.#scene, {
|
|
125
|
+
indexedHeight,
|
|
126
|
+
nodeHeight,
|
|
127
|
+
liveActivated: true,
|
|
128
|
+
});
|
|
129
|
+
this.#renderer.renderFollowScene(this.#progress, indexedHeight, nodeHeight, this.#scene, describeMiningVisualizerStatus(snapshot));
|
|
130
|
+
}
|
|
131
|
+
close() {
|
|
132
|
+
this.#renderer?.close();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { runBackgroundMiningWorker } from "./runner.js";
|
|
2
|
+
function readFlag(name) {
|
|
3
|
+
const prefix = `--${name}=`;
|
|
4
|
+
const match = process.argv.find((entry) => entry.startsWith(prefix));
|
|
5
|
+
return match === undefined ? null : match.slice(prefix.length);
|
|
6
|
+
}
|
|
7
|
+
const dataDir = readFlag("data-dir");
|
|
8
|
+
const databasePath = readFlag("database-path");
|
|
9
|
+
const runId = readFlag("run-id");
|
|
10
|
+
if (dataDir === null || databasePath === null || runId === null) {
|
|
11
|
+
throw new Error("mining_worker_missing_args");
|
|
12
|
+
}
|
|
13
|
+
await runBackgroundMiningWorker({
|
|
14
|
+
dataDir,
|
|
15
|
+
databasePath,
|
|
16
|
+
runId,
|
|
17
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readSnapshotWithRetry } from "../../bitcoind/indexer-daemon.js";
|
|
2
|
+
import { type WalletSecretProvider } from "../state/provider.js";
|
|
3
|
+
import type { WalletLocalStateStatus, WalletReadContext } from "./types.js";
|
|
4
|
+
import type { WalletRuntimePaths } from "../runtime.js";
|
|
5
|
+
declare function inspectWalletLocalState(options?: {
|
|
6
|
+
passphrase?: Uint8Array | string;
|
|
7
|
+
secretProvider?: WalletSecretProvider;
|
|
8
|
+
now?: number;
|
|
9
|
+
paths?: WalletRuntimePaths;
|
|
10
|
+
}): Promise<WalletLocalStateStatus>;
|
|
11
|
+
export declare function openWalletReadContext(options: {
|
|
12
|
+
dataDir: string;
|
|
13
|
+
databasePath: string;
|
|
14
|
+
walletStatePassphrase?: Uint8Array | string;
|
|
15
|
+
secretProvider?: WalletSecretProvider;
|
|
16
|
+
startupTimeoutMs?: number;
|
|
17
|
+
now?: number;
|
|
18
|
+
paths?: WalletRuntimePaths;
|
|
19
|
+
}): Promise<WalletReadContext>;
|
|
20
|
+
export { inspectWalletLocalState, readSnapshotWithRetry, };
|