@toon-protocol/townhouse 0.1.2 → 0.2.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.
@@ -22,10 +22,10 @@
22
22
  # Story 45.4 boots only connector + townhouse-api at apex install
23
23
  #
24
24
  # Digest placeholders (substituted at build time from dist/image-manifest.json):
25
- # @sha256:706591f02ab9fc5a3f6fdcd9feada9d149c2f76ba9951f00bd5d780cbcd62ec6 → @sha256:<hex>
26
- # @sha256:e791f677ec2cdb0bb5983f0b66c1de8fe4b7c050bc29e2483b9941949b82350b → @sha256:<hex>
27
- # @sha256:91f203ddcda5d77f394b19c943db1e121ade0e31855702ea4e5d6cc372e444c1 → @sha256:<hex>
28
- # @sha256:a8335306f4e787c87a9fd43147f71cce045d424d625491c229f226a38f909365 → @sha256:<hex>
25
+ # @sha256:f8f5d24ea14f288d2469459cf38ffcb93c5aa30c70c5387fe5451259cd78b8c4 → @sha256:<hex>
26
+ # @sha256:464e556d2388d3f804987340fd0a4369ca9de0b8e4f8e00072ef5a821e5107bc → @sha256:<hex>
27
+ # @sha256:d60e3678b376b5215ce10a8730632dcb7042265aaeefde254b1d1feed4e8088b → @sha256:<hex>
28
+ # @sha256:b7b5f3522a5885c0fdb4197181ee55dfae795782c3f4a81aae24e1422fccbd9e → @sha256:<hex>
29
29
  # @sha256:3343c19649290043e521c81b467b7c6410b8eaedd76d48804ea9b6fc810cddb0 → @sha256:<hex>
30
30
  #
31
31
  # Scope guard (Story 45.2 does NOT include):
@@ -152,7 +152,7 @@ services:
152
152
  # Port D21-008: Fastify host API on 127.0.0.1:28090.
153
153
  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
154
154
  townhouse-api:
155
- image: ghcr.io/toon-protocol/townhouse-api@sha256:706591f02ab9fc5a3f6fdcd9feada9d149c2f76ba9951f00bd5d780cbcd62ec6
155
+ image: ghcr.io/toon-protocol/townhouse-api@sha256:f8f5d24ea14f288d2469459cf38ffcb93c5aa30c70c5387fe5451259cd78b8c4
156
156
  container_name: townhouse-hs-api
157
157
  # Run as the operator's host UID so bind-mounted ~/.townhouse files
158
158
  # (rw------- 600) are readable. TOWNHOUSE_UID is injected by `townhouse hs up`.
@@ -252,7 +252,7 @@ services:
252
252
  # start at first run).
253
253
  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
254
254
  town:
255
- image: ghcr.io/toon-protocol/town@sha256:e791f677ec2cdb0bb5983f0b66c1de8fe4b7c050bc29e2483b9941949b82350b
255
+ image: ghcr.io/toon-protocol/town@sha256:464e556d2388d3f804987340fd0a4369ca9de0b8e4f8e00072ef5a821e5107bc
256
256
  container_name: townhouse-hs-town
257
257
  profiles: [town]
258
258
  networks:
@@ -303,7 +303,7 @@ services:
303
303
  # Lazy-provisioned via Epic 46: `townhouse node add mill`
304
304
  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
305
305
  mill:
306
- image: ghcr.io/toon-protocol/mill@sha256:91f203ddcda5d77f394b19c943db1e121ade0e31855702ea4e5d6cc372e444c1
306
+ image: ghcr.io/toon-protocol/mill@sha256:d60e3678b376b5215ce10a8730632dcb7042265aaeefde254b1d1feed4e8088b
307
307
  container_name: townhouse-hs-mill
308
308
  profiles: [mill]
309
309
  networks:
@@ -351,7 +351,7 @@ services:
351
351
  # Lazy-provisioned via Epic 46: `townhouse node add dvm`
352
352
  # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
353
353
  dvm:
354
- image: ghcr.io/toon-protocol/dvm@sha256:a8335306f4e787c87a9fd43147f71cce045d424d625491c229f226a38f909365
354
+ image: ghcr.io/toon-protocol/dvm@sha256:b7b5f3522a5885c0fdb4197181ee55dfae795782c3f4a81aae24e1422fccbd9e
355
355
  container_name: townhouse-hs-dvm
356
356
  profiles: [dvm]
357
357
  networks:
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "townhouseVersion": "0.1.2",
4
- "builtAt": "2026-06-02T11:30:55.118Z",
3
+ "townhouseVersion": "0.2.0",
4
+ "builtAt": "2026-06-02T15:50:15.649Z",
5
5
  "images": {
6
6
  "townhouse-api": {
7
7
  "name": "ghcr.io/toon-protocol/townhouse-api",
8
- "tag": "0.1.2",
9
- "digest": "sha256:706591f02ab9fc5a3f6fdcd9feada9d149c2f76ba9951f00bd5d780cbcd62ec6"
8
+ "tag": "0.2.0",
9
+ "digest": "sha256:f8f5d24ea14f288d2469459cf38ffcb93c5aa30c70c5387fe5451259cd78b8c4"
10
10
  },
11
11
  "town": {
12
12
  "name": "ghcr.io/toon-protocol/town",
13
- "tag": "0.1.2",
14
- "digest": "sha256:e791f677ec2cdb0bb5983f0b66c1de8fe4b7c050bc29e2483b9941949b82350b"
13
+ "tag": "0.2.0",
14
+ "digest": "sha256:464e556d2388d3f804987340fd0a4369ca9de0b8e4f8e00072ef5a821e5107bc"
15
15
  },
16
16
  "mill": {
17
17
  "name": "ghcr.io/toon-protocol/mill",
18
- "tag": "0.1.2",
19
- "digest": "sha256:91f203ddcda5d77f394b19c943db1e121ade0e31855702ea4e5d6cc372e444c1"
18
+ "tag": "0.2.0",
19
+ "digest": "sha256:d60e3678b376b5215ce10a8730632dcb7042265aaeefde254b1d1feed4e8088b"
20
20
  },
21
21
  "dvm": {
22
22
  "name": "ghcr.io/toon-protocol/dvm",
23
- "tag": "0.1.2",
24
- "digest": "sha256:a8335306f4e787c87a9fd43147f71cce045d424d625491c229f226a38f909365"
23
+ "tag": "0.2.0",
24
+ "digest": "sha256:b7b5f3522a5885c0fdb4197181ee55dfae795782c3f4a81aae24e1422fccbd9e"
25
25
  },
26
26
  "connector": {
27
27
  "name": "ghcr.io/toon-protocol/connector",
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as EncryptedWallet, T as TownhouseConfig, W as WalletManager, a as ComposeProfile, N as NodeType$1, B as BandwidthStats, H as HealthCheckOptions } from './manager-SsneW_Mj.js';
2
- export { A as ApiConfig, b as ComposeLoaderError, C as ComposeLoaderOptions, c as ConnectorConfig, d as ContainerSpec, D as DerivedNodeKeys, e as DvmNodeConfig, L as LoggingConfig, M as MillNodeConfig, f as NodeKeyInfo, g as NodeKeys, h as NodesConfig, O as OrchestratorEvents, i as TownNodeConfig, j as TransportConfig, k as WalletConfig, l as WalletManagerConfig, m as WalletState, n as loadComposeTemplate, o as materializeComposeTemplate } from './manager-SsneW_Mj.js';
1
+ import { E as EncryptedWallet, T as TownhouseConfig, W as WalletManager, a as ComposeProfile, N as NodeType$1, B as BandwidthStats, H as HealthCheckOptions, b as ChainProviderEntry } from './manager-BtpOFwd6.js';
2
+ export { A as ApiConfig, c as ChainType, d as ComposeLoaderError, C as ComposeLoaderOptions, e as ConnectorConfig, f as ContainerSpec, D as DerivedNodeKeys, g as DvmNodeConfig, h as EvmChainProvider, L as LoggingConfig, M as MillNodeConfig, i as MinaChainProvider, j as NodeKeyInfo, k as NodeKeys, l as NodesConfig, O as OrchestratorEvents, S as SolanaChainProvider, m as TownNodeConfig, n as TransportConfig, o as WalletConfig, p as WalletManagerConfig, q as WalletState, r as loadComposeTemplate, s as materializeComposeTemplate } from './manager-BtpOFwd6.js';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import Docker from 'dockerode';
5
5
  import { FastifyBaseLogger, FastifyInstance } from 'fastify';
@@ -1269,6 +1269,12 @@ interface WizardInitRequest {
1269
1269
  transport: {
1270
1270
  mode: 'direct' | 'ator';
1271
1271
  };
1272
+ /**
1273
+ * Optional settlement chains (connector chainProviders) to configure during
1274
+ * first-run setup. Omitted/empty → the connector uses the dev-Anvil default.
1275
+ * Validated deeply when the resulting config is saved.
1276
+ */
1277
+ chainProviders?: ChainProviderEntry[];
1272
1278
  }
1273
1279
  /** Progress messages streamed over WS /api/wizard/progress */
1274
1280
  type WizardProgressMessage = {
@@ -2038,4 +2044,4 @@ declare class BootReconciler {
2038
2044
  private appendLog;
2039
2045
  }
2040
2046
 
2041
- export { type AggregateEarningsInput, type AggregatedEarnings, type AggregatedEarningsStatus, type AggregatorLogger, type ApiDeps, type ApiServer, type BandwidthPayload, BandwidthStats, BootReconciler, ComposeProfile, ConfigValidationError, ConnectorAdminClient, ConnectorConfigGenerator, type ConnectorRuntimeConfig, DEFAULT_ATOR_PROXY, type DeltaComputer, type DepositAddressEntry, type DepositAddressesPayload, type DivergenceAction, type DivergenceLog, DockerOrchestrator, type DvmHealthResponse, EncryptedWallet, HealthCheckOptions, type HealthResponse, type HsHostnameResponse, type ImageManifest, ImageManifestSchema, type JobsByKindEntry, type JobsRecentPayload, type MetricsPayload, type MetricsPeerEntry, type MetricsResponse, type MillHealthResponse, type MillSwapsRecentPayload, type NodeDetail, type NodeEarnings, type NodeHealthPayload, type NodeInfo, type NodeState, NodeType$1 as NodeType, type NodesYaml, type NodesYamlEntry, NodesYamlEntrySchema, NodesYamlSchema, type NostrEventPayload, OrchestratorError, type PacketLogEntry, type PacketLogFilter, type PacketTimeseriesPayload, type PeerEntry, type PeerStatus, PeerTypeResolver, type PeersResponse, type PerAsset, type ReconcileSummary, type RevealRequest, type RevealResponse, type SnapshotEntry, SnapshotWriter, type SnapshotWriterOptions, type SwapByPairEntry, type TimeseriesBucket, type TownHealthPayload, TownhouseConfig, type TransactionReceiptPayload, type TransportPatchRequest, type TransportPatchResponse, TransportProbe, type TransportStatusPayload, type WalletBalanceEntry, type WalletBalancesPayload, WalletManager, type WithdrawDryRunResponse, type WithdrawRequest, type WithdrawResponse, type WithdrawSuccessResponse, type WizardInitRequest, type WizardProgressMessage, type WizardStatePayload, type WsBatchMessage, type WsConnectorRestartedMessage, type WsConnectorRestartingMessage, type WsHeartbeatMessage, type WsMessage, type WsMetricsMessage, type WsNodeStateMessage, type WsRelayEventsMessage, createApiServer, createDeltaComputer, createWizardApiServer, decryptWallet, encryptWallet, getDefaultConfig, loadConfig, loadWallet, readImageManifest, readNodesYaml, saveConfig, saveWallet, utcDayBoundary, utcMonthBoundary, utcYearBoundary, validateConfig, writeNodesYaml };
2047
+ export { type AggregateEarningsInput, type AggregatedEarnings, type AggregatedEarningsStatus, type AggregatorLogger, type ApiDeps, type ApiServer, type BandwidthPayload, BandwidthStats, BootReconciler, ChainProviderEntry, ComposeProfile, ConfigValidationError, ConnectorAdminClient, ConnectorConfigGenerator, type ConnectorRuntimeConfig, DEFAULT_ATOR_PROXY, type DeltaComputer, type DepositAddressEntry, type DepositAddressesPayload, type DivergenceAction, type DivergenceLog, DockerOrchestrator, type DvmHealthResponse, EncryptedWallet, HealthCheckOptions, type HealthResponse, type HsHostnameResponse, type ImageManifest, ImageManifestSchema, type JobsByKindEntry, type JobsRecentPayload, type MetricsPayload, type MetricsPeerEntry, type MetricsResponse, type MillHealthResponse, type MillSwapsRecentPayload, type NodeDetail, type NodeEarnings, type NodeHealthPayload, type NodeInfo, type NodeState, NodeType$1 as NodeType, type NodesYaml, type NodesYamlEntry, NodesYamlEntrySchema, NodesYamlSchema, type NostrEventPayload, OrchestratorError, type PacketLogEntry, type PacketLogFilter, type PacketTimeseriesPayload, type PeerEntry, type PeerStatus, PeerTypeResolver, type PeersResponse, type PerAsset, type ReconcileSummary, type RevealRequest, type RevealResponse, type SnapshotEntry, SnapshotWriter, type SnapshotWriterOptions, type SwapByPairEntry, type TimeseriesBucket, type TownHealthPayload, TownhouseConfig, type TransactionReceiptPayload, type TransportPatchRequest, type TransportPatchResponse, TransportProbe, type TransportStatusPayload, type WalletBalanceEntry, type WalletBalancesPayload, WalletManager, type WithdrawDryRunResponse, type WithdrawRequest, type WithdrawResponse, type WithdrawSuccessResponse, type WizardInitRequest, type WizardProgressMessage, type WizardStatePayload, type WsBatchMessage, type WsConnectorRestartedMessage, type WsConnectorRestartingMessage, type WsHeartbeatMessage, type WsMessage, type WsMetricsMessage, type WsNodeStateMessage, type WsRelayEventsMessage, createApiServer, createDeltaComputer, createWizardApiServer, decryptWallet, encryptWallet, getDefaultConfig, loadConfig, loadWallet, readImageManifest, readNodesYaml, saveConfig, saveWallet, utcDayBoundary, utcMonthBoundary, utcYearBoundary, validateConfig, writeNodesYaml };
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ import {
34
34
  utcYearBoundary,
35
35
  validateConfig,
36
36
  writeNodesYaml
37
- } from "./chunk-W33MEOPM.js";
37
+ } from "./chunk-B4KWPVEK.js";
38
38
  import "./chunk-5O4SBV5O.js";
39
39
  import "./chunk-GQNBZJ6F.js";
40
40
  import "./chunk-I2R4CRUX.js";
@@ -58,29 +58,65 @@ interface ConnectorConfig {
58
58
  adminPort: number;
59
59
  }
60
60
  /**
61
- * Connector chain-provider entry — surfaces what the connector needs to spin
62
- * up its settlement subsystem (AccountManager + ClaimReceiver). Without at
63
- * least one entry, `/admin/earnings.json` returns 503 and Townhouse's
61
+ * Connector chain-provider entry — what the connector needs to spin up its
62
+ * settlement subsystem (AccountManager + ClaimReceiver) for one chain. Without
63
+ * at least one entry, `/admin/earnings.json` returns 503 and Townhouse's
64
64
  * earnings data plane breaks (Epic 47 BUG-1).
65
65
  *
66
+ * This is a discriminated union on `chainType` that mirrors the connector's
67
+ * `ProviderConfig` contract (EVM | Solana | Mina), so entries pass straight
68
+ * through `ConnectorConfigGenerator` to the connector. The connector already
69
+ * implements payment-channel providers for all three chains.
70
+ *
66
71
  * Dev-Anvil deterministic placeholders are exposed via
67
72
  * `DEFAULT_HS_CHAIN_PROVIDERS` in `defaults.ts`; operators running on real
68
73
  * chains override this in their `config.yaml`.
69
74
  */
70
- interface ChainProviderEntry {
71
- /** Currently only 'evm' supported. */
75
+ /** Supported settlement chain families. */
76
+ type ChainType = 'evm' | 'solana' | 'mina';
77
+ /** EVM settlement chain (Base, Arbitrum, Anvil dev, …). */
78
+ interface EvmChainProvider {
72
79
  chainType: 'evm';
73
80
  /** Canonical chain id, e.g. 'evm:base:31337' (dev-Anvil) or 'evm:base:8453' (mainnet). */
74
81
  chainId: string;
75
- /** Chain RPC endpoint. May be a dead address in offline/demo mode. */
82
+ /** JSON-RPC endpoint. May be a dead address in offline/demo mode. */
76
83
  rpcUrl: string;
77
84
  /** PaymentChannel registry contract. */
78
85
  registryAddress: string;
79
86
  /** Settlement token (USDC, etc.) contract. */
80
87
  tokenAddress: string;
81
- /** Hex private key the connector signs settlement claims with. */
88
+ /** Hex private key / key id the connector signs settlement claims with. */
89
+ keyId: string;
90
+ }
91
+ /** Solana settlement chain. */
92
+ interface SolanaChainProvider {
93
+ chainType: 'solana';
94
+ /** Canonical chain id, e.g. 'solana:devnet' or 'solana:mainnet'. */
95
+ chainId: string;
96
+ /** Cluster RPC endpoint (HTTP). */
97
+ rpcUrl: string;
98
+ /** WebSocket endpoint for account subscriptions (derived from rpcUrl if absent). */
99
+ wsUrl?: string;
100
+ /** On-chain payment-channel program id (base58). */
101
+ programId: string;
102
+ /** Settlement token mint (base58). */
103
+ tokenMint?: string;
104
+ /** Key id the connector signs settlement claims with. */
82
105
  keyId: string;
83
106
  }
107
+ /** Mina settlement chain. */
108
+ interface MinaChainProvider {
109
+ chainType: 'mina';
110
+ /** Canonical chain id, e.g. 'mina:devnet' or 'mina:mainnet'. */
111
+ chainId: string;
112
+ /** Mina GraphQL endpoint. */
113
+ graphqlUrl: string;
114
+ /** zkApp address for the payment-channel contract (base58). */
115
+ zkAppAddress: string;
116
+ /** Key id the connector signs settlement claims with. */
117
+ keyId?: string;
118
+ }
119
+ type ChainProviderEntry = EvmChainProvider | SolanaChainProvider | MinaChainProvider;
84
120
  /**
85
121
  * Hidden-service publication config (Story 35.5 of the connector repo).
86
122
  *
@@ -516,4 +552,4 @@ declare class WalletManager {
516
552
  private deriveNodeKeys;
517
553
  }
518
554
 
519
- export { type ApiConfig as A, type BandwidthStats as B, type ComposeLoaderOptions as C, type DerivedNodeKeys as D, type EncryptedWallet as E, type HealthCheckOptions as H, type LoggingConfig as L, type MillNodeConfig as M, type NodeType as N, type OrchestratorEvents as O, type TownhouseConfig as T, WalletManager as W, type ComposeProfile as a, ComposeLoaderError as b, type ConnectorConfig as c, type ContainerSpec as d, type DvmNodeConfig as e, type NodeKeyInfo as f, type NodeKeys as g, type NodesConfig as h, type TownNodeConfig as i, type TransportConfig as j, type WalletConfig as k, type WalletManagerConfig as l, type WalletState as m, loadComposeTemplate as n, materializeComposeTemplate as o };
555
+ export { type ApiConfig as A, type BandwidthStats as B, type ComposeLoaderOptions as C, type DerivedNodeKeys as D, type EncryptedWallet as E, type HealthCheckOptions as H, type LoggingConfig as L, type MillNodeConfig as M, type NodeType as N, type OrchestratorEvents as O, type SolanaChainProvider as S, type TownhouseConfig as T, WalletManager as W, type ComposeProfile as a, type ChainProviderEntry as b, type ChainType as c, ComposeLoaderError as d, type ConnectorConfig as e, type ContainerSpec as f, type DvmNodeConfig as g, type EvmChainProvider as h, type MinaChainProvider as i, type NodeKeyInfo as j, type NodeKeys as k, type NodesConfig as l, type TownNodeConfig as m, type TransportConfig as n, type WalletConfig as o, type WalletManagerConfig as p, type WalletState as q, loadComposeTemplate as r, materializeComposeTemplate as s };
@@ -20,6 +20,7 @@ import { useEffect, useRef, useState } from "react";
20
20
  // src/tui/constants.ts
21
21
  var DEFAULT_REFRESH_INTERVAL_MS = 2e3;
22
22
  var DEFAULT_API_URL = "http://127.0.0.1:28090";
23
+ var STARTING_UP_GRACE_FETCHES = 3;
23
24
 
24
25
  // src/tui/use-earnings.ts
25
26
  var EMPTY_EARNINGS = {
@@ -42,9 +43,15 @@ function useEarnings(opts = {}) {
42
43
  bannerKey: null
43
44
  });
44
45
  const prevDataRef = useRef(null);
46
+ const warmupFailuresRef = useRef(0);
45
47
  useEffect(() => {
46
48
  let cancelled = false;
47
49
  let abortController = null;
50
+ function failureBanner(specific) {
51
+ if (prevDataRef.current !== null) return specific;
52
+ warmupFailuresRef.current += 1;
53
+ return warmupFailuresRef.current <= STARTING_UP_GRACE_FETCHES ? "starting_up" : specific;
54
+ }
48
55
  async function doFetch() {
49
56
  if (cancelled) return;
50
57
  const ac = new AbortController();
@@ -59,7 +66,7 @@ function useEarnings(opts = {}) {
59
66
  setState({
60
67
  phase: "stale",
61
68
  data: prev ?? EMPTY_EARNINGS,
62
- bannerKey: "fetch_failed"
69
+ bannerKey: failureBanner("fetch_failed")
63
70
  });
64
71
  return;
65
72
  }
@@ -70,20 +77,20 @@ function useEarnings(opts = {}) {
70
77
  setState({
71
78
  phase: "stale",
72
79
  data: prev ?? EMPTY_EARNINGS,
73
- bannerKey: "connector_unavailable"
80
+ bannerKey: failureBanner("connector_unavailable")
74
81
  });
75
82
  return;
76
83
  }
77
84
  prevDataRef.current = body;
85
+ warmupFailuresRef.current = 0;
78
86
  setState({ phase: "ok", data: body, bannerKey: null });
79
87
  } catch (err) {
80
88
  if (cancelled) return;
81
89
  if (err instanceof Error && err.name === "AbortError") return;
82
- const prev = prevDataRef.current;
83
90
  setState({
84
91
  phase: "stale",
85
- data: prev ?? EMPTY_EARNINGS,
86
- bannerKey: "fetch_failed"
92
+ data: prevDataRef.current ?? EMPTY_EARNINGS,
93
+ bannerKey: failureBanner("fetch_failed")
87
94
  });
88
95
  } finally {
89
96
  abortController = null;
@@ -187,14 +194,17 @@ var COPY = {
187
194
  qualifierEvents: (n) => `${n} events relayed`,
188
195
  banners: {
189
196
  connectorUnavailable: `Connector not reachable \u2014 showing last known values. Retrying in 2s.`,
190
- fetchFailed: `Last refresh failed \u2014 retrying.`
197
+ fetchFailed: `Last refresh failed \u2014 retrying.`,
198
+ // Shown only before the first successful fetch — a fresh node whose API is
199
+ // still warming up should read as "starting", not "failed".
200
+ startingUp: `Starting up \u2014 connecting to your node\u2026`
191
201
  },
192
202
  apex: {
193
203
  routingPrefix: `\u21B3 apex routing: `,
194
204
  routingEmpty: `(enable mill to route)`
195
205
  },
196
206
  peerTable: {
197
- empty: `no peers yet \u2014 run 'townhouse node add town'`
207
+ empty: `no peers yet \u2014 in a new terminal: townhouse node add town`
198
208
  },
199
209
  activityTicker: {
200
210
  prefix: `recent: `,
@@ -305,6 +315,9 @@ import { Text as Text4 } from "ink";
305
315
  import { jsx as jsx2 } from "react/jsx-runtime";
306
316
  function Banner({ bannerKey }) {
307
317
  if (bannerKey === null) return null;
318
+ if (bannerKey === "starting_up") {
319
+ return /* @__PURE__ */ jsx2(Text4, { color: "cyan", children: COPY.banners.startingUp });
320
+ }
308
321
  const isError = bannerKey === "fetch_failed";
309
322
  const text = isError ? COPY.banners.fetchFailed : COPY.banners.connectorUnavailable;
310
323
  return /* @__PURE__ */ jsx2(Text4, { color: isError ? "red" : "yellow", children: text });
@@ -622,4 +635,4 @@ function mountTui(opts = {}) {
622
635
  export {
623
636
  mountTui
624
637
  };
625
- //# sourceMappingURL=tui-OIFXGBTL.js.map
638
+ //# sourceMappingURL=tui-QE3ZRZO3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tui/index.ts","../src/tui/App.tsx","../src/tui/use-earnings.ts","../src/tui/constants.ts","../src/tui/use-activity-buffer.ts","../src/tui/components/HeroBand.tsx","../src/tui/components/Sparkline.tsx","../src/tui/components/Qualifier.tsx","../src/tui/copy.ts","../src/tui/components/Banner.tsx","../src/tui/components/ApexStrip.tsx","../src/tui/components/PeerTable.tsx","../src/tui/components/ActivityTicker.tsx","../src/tui/components/Badge.tsx","../src/tui/components/ActivityOverlay.tsx"],"sourcesContent":["import { createElement } from 'react';\nimport { render, type Instance } from 'ink';\nimport App from './App.js';\n\nexport interface MountTuiOptions {\n apiUrl?: string;\n refreshIntervalMs?: number;\n fetchImpl?: typeof fetch;\n}\n\nexport function mountTui(opts: MountTuiOptions = {}): Instance {\n return render(createElement(App, opts), {\n exitOnCtrlC: true,\n patchConsole: false,\n });\n}\n","import React, { useState } from 'react';\nimport { Box, Text, useInput } from 'ink';\nimport { useEarnings } from './use-earnings.js';\nimport { useActivityBuffer, MAX_BUFFER_SIZE } from './use-activity-buffer.js';\nimport { HeroBand } from './components/HeroBand.js';\nimport { Banner } from './components/Banner.js';\nimport { ApexStripSlot } from './components/ApexStripSlot.js';\nimport { PeerTableSlot } from './components/PeerTableSlot.js';\nimport { FooterSlot } from './components/FooterSlot.js';\nimport { Badge } from './components/Badge.js';\nimport { ActivityOverlay } from './components/ActivityOverlay.js';\nimport { COPY } from './copy.js';\n\nexport interface AppProps {\n apiUrl?: string;\n refreshIntervalMs?: number;\n fetchImpl?: typeof fetch;\n}\n\nexport default function App(props: AppProps): React.ReactElement {\n const state = useEarnings(props);\n const recentClaims = state.phase !== 'loading' ? state.data.recentClaims : undefined;\n const buffer = useActivityBuffer(recentClaims);\n const [overlayOpen, setOverlayOpen] = useState(false);\n\n useInput(\n (input, key) => {\n if (key.ctrl || key.meta) return;\n if (input === 'a' || input === 'A') setOverlayOpen(true);\n },\n { isActive: !overlayOpen && state.phase !== 'loading' },\n );\n\n if (state.phase === 'loading') {\n return <Text>{COPY.loading}</Text>;\n }\n\n if (overlayOpen) {\n return <ActivityOverlay claims={buffer} onClose={() => setOverlayOpen(false)} maxBufferSize={MAX_BUFFER_SIZE} />;\n }\n\n const { data } = state;\n const bannerKey = state.phase === 'stale' ? state.bannerKey : null;\n\n return (\n <Box flexDirection=\"column\">\n <HeroBand apex={data.apex} peers={data.peers} eventsRelayed={data.eventsRelayed} />\n <Badge apex={data.apex} peers={data.peers} uptimeSeconds={data.uptimeSeconds} />\n <Banner bannerKey={bannerKey} />\n <ApexStripSlot apex={data.apex} peers={data.peers} />\n <PeerTableSlot peers={data.peers} />\n <FooterSlot recentClaims={data.recentClaims} />\n </Box>\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { AggregatedEarnings } from './types.js';\nimport {\n DEFAULT_API_URL,\n DEFAULT_REFRESH_INTERVAL_MS,\n STARTING_UP_GRACE_FETCHES,\n} from './constants.js';\n\nexport type EarningsState =\n | { phase: 'loading'; data: null; bannerKey: null }\n | { phase: 'ok'; data: AggregatedEarnings; bannerKey: null }\n | {\n phase: 'stale';\n data: AggregatedEarnings;\n bannerKey: 'connector_unavailable' | 'fetch_failed' | 'starting_up';\n };\n\nexport interface UseEarningsOptions {\n apiUrl?: string;\n refreshIntervalMs?: number;\n fetchImpl?: typeof fetch;\n}\n\nconst EMPTY_EARNINGS: AggregatedEarnings = {\n status: 'connector_unavailable',\n apex: { routingFees: {} },\n peers: [],\n recentClaims: [],\n eventsRelayed: 0,\n uptimeSeconds: 0,\n};\n\nexport function useEarnings(opts: UseEarningsOptions = {}): EarningsState {\n const {\n apiUrl = DEFAULT_API_URL,\n refreshIntervalMs = DEFAULT_REFRESH_INTERVAL_MS,\n fetchImpl = globalThis.fetch,\n } = opts;\n\n const [state, setState] = useState<EarningsState>({\n phase: 'loading',\n data: null,\n bannerKey: null,\n });\n\n const prevDataRef = useRef<AggregatedEarnings | null>(null);\n // Consecutive failures before the first-ever success. Resets on any success.\n const warmupFailuresRef = useRef(0);\n\n useEffect(() => {\n let cancelled = false;\n let abortController: AbortController | null = null;\n\n // Choose the banner for a failed fetch: a calm 'starting_up' while a node\n // that has never responded is within its warm-up grace, escalating to the\n // specific failure banner once we've had data OR the grace is exhausted.\n function failureBanner(\n specific: 'fetch_failed' | 'connector_unavailable'\n ): 'starting_up' | 'fetch_failed' | 'connector_unavailable' {\n if (prevDataRef.current !== null) return specific;\n warmupFailuresRef.current += 1;\n return warmupFailuresRef.current <= STARTING_UP_GRACE_FETCHES\n ? 'starting_up'\n : specific;\n }\n\n async function doFetch(): Promise<void> {\n if (cancelled) return;\n\n const ac = new AbortController();\n abortController = ac;\n\n try {\n const res = await fetchImpl(`${apiUrl}/api/earnings`, {\n signal: ac.signal,\n });\n\n if (cancelled) return;\n\n if (!res.ok) {\n const prev = prevDataRef.current;\n setState({\n phase: 'stale',\n data: prev ?? EMPTY_EARNINGS,\n bannerKey: failureBanner('fetch_failed'),\n });\n return;\n }\n\n const body = (await res.json()) as AggregatedEarnings;\n\n if (cancelled) return;\n\n if (body.status === 'connector_unavailable') {\n const prev = prevDataRef.current;\n setState({\n phase: 'stale',\n data: prev ?? EMPTY_EARNINGS,\n bannerKey: failureBanner('connector_unavailable'),\n });\n return;\n }\n\n prevDataRef.current = body;\n warmupFailuresRef.current = 0;\n setState({ phase: 'ok', data: body, bannerKey: null });\n } catch (err) {\n if (cancelled) return;\n if (err instanceof Error && err.name === 'AbortError') return;\n\n setState({\n phase: 'stale',\n data: prevDataRef.current ?? EMPTY_EARNINGS,\n bannerKey: failureBanner('fetch_failed'),\n });\n } finally {\n abortController = null;\n }\n }\n\n void doFetch();\n\n const intervalId = setInterval(() => {\n void doFetch();\n }, refreshIntervalMs);\n\n return () => {\n cancelled = true;\n clearInterval(intervalId);\n if (abortController !== null) {\n abortController.abort();\n }\n };\n }, [apiUrl, refreshIntervalMs, fetchImpl]);\n\n return state;\n}\n","export const DEFAULT_REFRESH_INTERVAL_MS = 2_000;\nexport const DEFAULT_API_URL = 'http://127.0.0.1:28090';\n\n/**\n * How many consecutive failed fetches to treat as \"still starting up\" before a\n * node has ever responded. During this grace window the dashboard shows a calm\n * \"Starting up…\" banner (a fresh node's API takes a few seconds to come up);\n * after it, persistent failure escalates to the louder \"Last refresh failed\"\n * so a genuinely-broken/crash-looping API doesn't masquerade as \"starting\" forever.\n * At the 2s refresh interval, 3 ≈ a ~6s grace.\n */\nexport const STARTING_UP_GRACE_FETCHES = 3;\n","import { useState, useEffect } from 'react';\nimport type { RecentClaim } from './types.js';\n\nexport const MAX_BUFFER_SIZE = 200;\n\nfunction claimKey(c: RecentClaim): string {\n return `${c.peerId}|${c.at}|${c.amount}|${c.assetCode}|${c.direction}`;\n}\n\nfunction sortKey(c: RecentClaim): number {\n const ms = Date.parse(c.at);\n return Number.isFinite(ms) ? ms : -Infinity;\n}\n\nexport function useActivityBuffer(\n incoming: RecentClaim[] | undefined\n): RecentClaim[] {\n const [buffer, setBuffer] = useState<RecentClaim[]>([]);\n\n useEffect(() => {\n if (!Array.isArray(incoming)) return;\n if (incoming.length === 0 && buffer.length === 0) return;\n\n const seen = new Map<string, RecentClaim>();\n for (const c of buffer) seen.set(claimKey(c), c);\n for (const c of incoming) seen.set(claimKey(c), c);\n\n const merged = Array.from(seen.values());\n merged.sort((a, b) => sortKey(b) - sortKey(a));\n const trimmed = merged.slice(0, MAX_BUFFER_SIZE);\n\n const same =\n trimmed.length === buffer.length &&\n trimmed.every(\n (c, i) =>\n buffer[i] !== undefined &&\n claimKey(c) === claimKey(buffer[i] as RecentClaim)\n );\n if (!same) setBuffer(trimmed);\n }, [incoming]);\n\n return buffer;\n}\n","import { Box, Text, useStdout } from 'ink';\nimport type { ReactElement } from 'react';\nimport type { AggregatedEarnings } from '../types.js';\nimport { formatUsdc } from '../format.js';\nimport { Sparkline } from './Sparkline.js';\nimport { Qualifier } from './Qualifier.js';\n\nconst USDC_SCALE = 6;\nconst ASSET = 'USDC';\nconst DECIMAL_RE = /^-?\\d+$/;\nconst MIN_COL_WIDTH = 8;\n\nfunction addDecimalStrings(a: string, b: string): string {\n // Defensive: malformed peer/apex amounts must not crash the render tree.\n // `formatUsdc` will degrade to '$?.??' on a non-decimal accumulator.\n if (!DECIMAL_RE.test(b)) return a;\n try {\n return (BigInt(a) + BigInt(b)).toString();\n } catch {\n return a;\n }\n}\n\ninterface HeroBandProps {\n apex: AggregatedEarnings['apex'];\n peers: AggregatedEarnings['peers'];\n eventsRelayed: number;\n}\n\ninterface Scalars {\n today: string;\n month: string;\n year: string;\n lifetime: string;\n}\n\nfunction computeScalars(\n apex: AggregatedEarnings['apex'],\n peers: AggregatedEarnings['peers']\n): Scalars {\n let today = '0';\n let month = '0';\n let year = '0';\n let lifetime = '0';\n\n const apexUsdc = apex.routingFees[ASSET];\n if (apexUsdc !== undefined) {\n today = addDecimalStrings(today, apexUsdc.today);\n month = addDecimalStrings(month, apexUsdc.month);\n year = addDecimalStrings(year, apexUsdc.year);\n lifetime = addDecimalStrings(lifetime, apexUsdc.lifetime);\n }\n\n for (const peer of peers) {\n const peerUsdc = peer.byAsset[ASSET];\n if (peerUsdc !== undefined) {\n today = addDecimalStrings(today, peerUsdc.today);\n month = addDecimalStrings(month, peerUsdc.month);\n year = addDecimalStrings(year, peerUsdc.year);\n lifetime = addDecimalStrings(lifetime, peerUsdc.lifetime);\n }\n }\n\n return { today, month, year, lifetime };\n}\n\nfunction isEmptyState(\n apex: AggregatedEarnings['apex'],\n peers: AggregatedEarnings['peers']\n): boolean {\n const apexMonth = apex.routingFees[ASSET]?.month ?? '0';\n if (apexMonth !== '0') return false;\n for (const peer of peers) {\n const peerMonth = peer.byAsset[ASSET]?.month ?? '0';\n if (peerMonth !== '0') return false;\n }\n return true;\n}\n\nexport function HeroBand({ apex, peers, eventsRelayed }: HeroBandProps): ReactElement {\n const { stdout } = useStdout();\n const columns = stdout?.columns ?? 80;\n\n const scalars = computeScalars(apex, peers);\n const showQualifier = isEmptyState(apex, peers);\n\n const todayFmt = formatUsdc(scalars.today, USDC_SCALE);\n const monthFmt = formatUsdc(scalars.month, USDC_SCALE);\n const yearFmt = formatUsdc(scalars.year, USDC_SCALE);\n const lifetimeFmt = formatUsdc(scalars.lifetime, USDC_SCALE);\n\n const shortLabels = columns < 70;\n const labelLifetime = shortLabels ? 'LIFE' : 'LIFETIME';\n\n // Clamp: at very narrow widths (<32ch) Ink would collapse <Box width={0}>\n // and truncate scalar values into garbage. Floor to a usable per-column width.\n const colWidth = Math.max(Math.floor(columns / 4), MIN_COL_WIDTH);\n\n return (\n <Box flexDirection=\"column\">\n <Box>\n <Box width={colWidth}><Text dimColor>TODAY</Text></Box>\n <Box width={colWidth}><Text dimColor>MONTH</Text></Box>\n <Box width={colWidth}><Text dimColor>YEAR</Text></Box>\n <Box width={colWidth}><Text dimColor>{labelLifetime}</Text></Box>\n </Box>\n <Box>\n <Box width={colWidth}>\n <Text color={scalars.today !== '0' ? 'green' : undefined}>{todayFmt}</Text>\n </Box>\n <Box width={colWidth}>\n <Text color={scalars.month !== '0' ? 'green' : undefined}>{monthFmt}</Text>\n </Box>\n <Box width={colWidth}>\n <Text color={scalars.year !== '0' ? 'green' : undefined}>{yearFmt}</Text>\n </Box>\n <Box width={colWidth}>\n <Text color={scalars.lifetime !== '0' ? 'green' : undefined}>{lifetimeFmt}</Text>\n </Box>\n </Box>\n <Sparkline values={[]} width={columns} />\n {showQualifier ? <Qualifier eventsRelayed={eventsRelayed} /> : null}\n </Box>\n );\n}\n","import { Text } from 'ink';\nimport type { ReactElement } from 'react';\n\nconst BLOCKS = '▁▂▃▄▅▆▇█';\nconst PLACEHOLDER = '·······';\n\ninterface SparklineProps {\n values: number[];\n width: number;\n}\n\nexport function Sparkline({ values, width }: SparklineProps): ReactElement | null {\n // Collapse the row entirely at <60ch — return null so the layout doesn't\n // reserve a blank row (wireframe degrade ladder: sparkline drops first).\n if (width < 60) {\n return null;\n }\n\n if (values.length === 0) {\n return <Text>{PLACEHOLDER} 7d</Text>;\n }\n\n // Filter NaN / Infinity / negative values; treat negatives as 0 floor.\n const safe = values\n .filter((v) => Number.isFinite(v))\n .map((v) => (v < 0 ? 0 : v));\n\n if (safe.length === 0) {\n return <Text>{PLACEHOLDER} 7d</Text>;\n }\n\n // Use reduce to avoid Math.max(...arr) stack overflow on large arrays.\n const max = safe.reduce((m, v) => (v > m ? v : m), 0);\n const chars = safe\n .map((v) => {\n if (max === 0) return BLOCKS[0] ?? '▁';\n const idx = Math.floor((v / max) * (BLOCKS.length - 1));\n return BLOCKS[idx] ?? '▁';\n })\n .join('');\n\n return <Text>{chars} 7d</Text>;\n}\n","import { Text } from 'ink';\nimport type { ReactElement } from 'react';\nimport { COPY } from '../copy.js';\n\ninterface QualifierProps {\n eventsRelayed: number;\n}\n\nexport function Qualifier({ eventsRelayed }: QualifierProps): ReactElement {\n return (\n <Text color=\"yellow\">\n {COPY.qualifierPrefix} · {COPY.qualifierEvents(eventsRelayed)} · {COPY.heroEarly}\n </Text>\n );\n}\n","export const COPY = {\n heroEarly: `you're early`,\n heroEarlyRotation: [\n `you're early`,\n `warming up`,\n `first packet en route`,\n ] as const,\n loading: `Fetching earnings…`,\n qualifierPrefix: `MONTH $0.00`,\n qualifierEventsWords: `events relayed`,\n qualifierEvents: (n: number) => `${n} events relayed`,\n banners: {\n connectorUnavailable: `Connector not reachable — showing last known values. Retrying in 2s.`,\n fetchFailed: `Last refresh failed — retrying.`,\n // Shown only before the first successful fetch — a fresh node whose API is\n // still warming up should read as \"starting\", not \"failed\".\n startingUp: `Starting up — connecting to your node…`,\n },\n apex: {\n routingPrefix: `↳ apex routing: `,\n routingEmpty: `(enable mill to route)`,\n },\n peerTable: {\n empty: `no peers yet — in a new terminal: townhouse node add town`,\n },\n activityTicker: {\n prefix: `recent: `,\n empty: `no settlements yet — press [a] when activity arrives`,\n keybind: ` [a] activity`,\n },\n activityOverlay: {\n titlePrefix: `Activity — last `,\n emptyHint: `(no activity yet)`,\n scrollHint: `j/k to scroll · q to close`,\n scrollHintEmpty: `q to close`,\n directionInbound: `in`,\n directionOutbound: `out`,\n directionUnknown: `?`,\n },\n} as const;\n","import { Text } from 'ink';\nimport type { ReactElement } from 'react';\nimport { COPY } from '../copy.js';\n\ninterface BannerProps {\n bannerKey: 'connector_unavailable' | 'fetch_failed' | 'starting_up' | null;\n}\n\nexport function Banner({ bannerKey }: BannerProps): ReactElement | null {\n if (bannerKey === null) return null;\n\n // 'starting_up' is the calm warm-up state (no successful fetch yet); the\n // others mean we had data and then lost it, which warrants a louder colour.\n if (bannerKey === 'starting_up') {\n return <Text color=\"cyan\">{COPY.banners.startingUp}</Text>;\n }\n\n const isError = bannerKey === 'fetch_failed';\n const text = isError\n ? COPY.banners.fetchFailed\n : COPY.banners.connectorUnavailable;\n\n return <Text color={isError ? 'red' : 'yellow'}>{text}</Text>;\n}\n","import { Text } from 'ink';\nimport type { ReactElement } from 'react';\nimport type { AggregatedEarnings } from '../types.js';\nimport { formatUsdc } from '../format.js';\nimport { COPY } from '../copy.js';\n\nconst USDC_SCALE = 6;\nconst ASSET = 'USDC';\nconst DECIMAL_RE = /^-?\\d+$/;\n\nfunction addDecimalStrings(a: string, b: string): string {\n // Defensive: malformed peer amounts must not crash the render tree.\n if (!DECIMAL_RE.test(b)) return a;\n try {\n return (BigInt(a) + BigInt(b)).toString();\n } catch {\n return a;\n }\n}\n\nexport interface ApexStripProps {\n apex: AggregatedEarnings['apex'];\n peers: AggregatedEarnings['peers'];\n}\n\nexport function ApexStrip({ apex, peers }: ApexStripProps): ReactElement {\n const apexMonth = apex.routingFees[ASSET]?.month ?? '0';\n const apexValid = DECIMAL_RE.test(apexMonth);\n const apexMonthBig = apexValid ? BigInt(apexMonth) : 0n;\n\n let totalMonth = apexMonthBig;\n for (const peer of peers) {\n const peerMonth = peer.byAsset[ASSET]?.month ?? '0';\n totalMonth = BigInt(addDecimalStrings(totalMonth.toString(), peerMonth));\n }\n\n const apexFmt = formatUsdc(apexMonth, USDC_SCALE);\n const hasMillPeer = peers.some((p) => p.type === 'mill');\n\n // Malformed apex.month: render the formatUsdc fallback alone — adding the Mill upsell\n // would mix a wire-anomaly signal with a \"you have no Mill\" signal.\n if (!apexValid) {\n return (\n <Text dimColor italic>\n {COPY.apex.routingPrefix}{apexFmt}\n </Text>\n );\n }\n\n if (apexMonthBig === 0n) {\n const upsell = hasMillPeer ? '' : ` ${COPY.apex.routingEmpty}`;\n return (\n <Text dimColor italic>\n {COPY.apex.routingPrefix}{apexFmt}{upsell}\n </Text>\n );\n }\n\n // Defensive: negative apex (refund/chargeback, wire-legal per `^-?\\d+$`) can let peers\n // exactly cancel apex; totalMonth === 0n would throw on BigInt division. Omit instead.\n const pct = totalMonth === 0n ? null : Number((apexMonthBig * 100n) / totalMonth);\n return (\n <Text>\n {COPY.apex.routingPrefix}{apexFmt}{pct !== null ? ` (${pct}%)` : ''}\n </Text>\n );\n}\n","import { Box, Text, useStdout } from 'ink';\nimport type { ReactElement } from 'react';\nimport type { AggregatedEarnings, NodeEarnings, PerAsset } from '../types.js';\nimport { formatUsdc, formatRelativeTime } from '../format.js';\nimport { COPY } from '../copy.js';\n\nconst USDC_SCALE = 6;\nconst MAX_DATA_ROWS = 4;\nconst MIN_COL_WIDTH = 6;\n\ninterface AssetRow {\n peerId: string;\n type: string;\n assetCode: string;\n perAsset: PerAsset;\n lastClaimAt: string | null;\n isFirstRowOfPeer: boolean;\n}\n\nfunction flattenPeers(peers: NodeEarnings[]): AssetRow[] {\n const out: AssetRow[] = [];\n for (const peer of peers) {\n const assetCodes = Object.keys(peer.byAsset).sort();\n if (assetCodes.length === 0) continue;\n let isFirst = true;\n for (const assetCode of assetCodes) {\n const perAsset = peer.byAsset[assetCode];\n if (perAsset === undefined) continue;\n out.push({\n peerId: peer.id,\n type: peer.type,\n assetCode,\n perAsset,\n lastClaimAt: peer.lastClaimAt,\n isFirstRowOfPeer: isFirst,\n });\n isFirst = false;\n }\n }\n return out;\n}\n\nexport interface PeerTableProps {\n peers: AggregatedEarnings['peers'];\n now?: Date;\n /** Override terminal column width. Defaults to useStdout(). Inject in tests to pin width. */\n columns?: number;\n}\n\nexport function PeerTable({ peers, now = new Date(), columns: columnsProp }: PeerTableProps): ReactElement {\n const { stdout } = useStdout();\n // `??` only coalesces null/undefined — a detached/piped tty can ship `columns === 0`,\n // which would clamp every column to MIN_COL_WIDTH and garble the header. Fall back to 80.\n const columns = columnsProp ?? (stdout?.columns || 80);\n\n const rows = flattenPeers(peers).slice(0, MAX_DATA_ROWS);\n\n if (rows.length === 0) {\n return <Text dimColor>{COPY.peerTable.empty}</Text>;\n }\n\n const showLastClaim = columns >= 60;\n const shortType = columns < 70;\n const dropAgoSuffix = columns < 70;\n\n const totalCols = showLastClaim ? 5 : 4;\n const colWidth = Math.max(Math.floor(columns / totalCols), MIN_COL_WIDTH);\n\n const header = (\n <Box>\n <Box width={colWidth}><Text dimColor>PEER</Text></Box>\n <Box width={colWidth}><Text dimColor>TYPE</Text></Box>\n <Box width={colWidth}><Text dimColor>ASSET</Text></Box>\n <Box width={colWidth}><Text dimColor>NET (MONTH)</Text></Box>\n {showLastClaim ? <Box width={colWidth}><Text dimColor>LAST CLAIM</Text></Box> : null}\n </Box>\n );\n\n return (\n <Box flexDirection=\"column\">\n {header}\n {rows.map((row, i) => {\n const peerCell = row.isFirstRowOfPeer ? row.peerId : '';\n const typeRaw = row.isFirstRowOfPeer ? row.type : '';\n const typeCell = shortType && typeRaw.length > 0 ? typeRaw.slice(0, 3) : typeRaw;\n const netFmt = formatUsdc(row.perAsset.month, USDC_SCALE);\n let lastClaim = formatRelativeTime(row.lastClaimAt, now);\n if (dropAgoSuffix && lastClaim.endsWith(' ago')) {\n lastClaim = lastClaim.slice(0, -' ago'.length);\n }\n return (\n <Box key={`${row.peerId}-${row.assetCode}-${i}`}>\n <Box width={colWidth}><Text>{peerCell}</Text></Box>\n <Box width={colWidth}><Text>{typeCell}</Text></Box>\n <Box width={colWidth}><Text>{row.assetCode}</Text></Box>\n <Box width={colWidth}><Text>{netFmt}</Text></Box>\n {showLastClaim ? <Box width={colWidth}><Text>{lastClaim}</Text></Box> : null}\n </Box>\n );\n })}\n </Box>\n );\n}\n","import { Text } from 'ink';\nimport type { ReactElement } from 'react';\nimport type { RecentClaim } from '../types.js';\nimport { formatUsdcMicro, formatRelativeTime } from '../format.js';\nimport { COPY } from '../copy.js';\n\nexport interface ActivityTickerProps {\n recentClaims: RecentClaim[];\n now?: Date;\n}\n\nfunction sortKey(c: RecentClaim): number {\n const ms = Date.parse(c.at);\n return Number.isFinite(ms) ? ms : -Infinity;\n}\n\nfunction arrowFor(direction: RecentClaim['direction']): string {\n return direction === 'inbound' ? '←' : direction === 'outbound' ? '→' : COPY.activityOverlay.directionUnknown;\n}\n\nexport function ActivityTicker({ recentClaims, now = new Date() }: ActivityTickerProps): ReactElement {\n if (recentClaims.length === 0) {\n return <Text dimColor>{COPY.activityTicker.empty}</Text>;\n }\n // Defensive sort DESC by `at` — wire ordering is not contractually guaranteed.\n const sorted = [...recentClaims].sort((a, b) => sortKey(b) - sortKey(a));\n const claim = sorted[0];\n if (!claim) {\n return <Text dimColor>{COPY.activityTicker.empty}</Text>;\n }\n const arrow = arrowFor(claim.direction);\n const amount = formatUsdcMicro(claim.amount, claim.assetScale);\n const rel = formatRelativeTime(claim.at, now);\n return (\n <Text dimColor>\n {COPY.activityTicker.prefix}{claim.peerId} {arrow} {amount} {claim.assetCode} · {rel}{COPY.activityTicker.keybind}\n </Text>\n );\n}\n","import { Text } from 'ink';\nimport type { ReactElement } from 'react';\nimport type { AggregatedEarnings } from '../types.js';\nimport { COPY } from '../copy.js';\n\nconst USDC_ASSET = 'USDC';\nconst DECIMAL_RE = /^-?\\d+$/;\n\nconst LIFETIME_USDC_THRESHOLD = 1_000_000n;\nconst UPTIME_SECONDS_THRESHOLD = 7 * 24 * 60 * 60;\nexport const ROTATION_INTERVAL_MS = 30_000;\n\nfunction parseDecimalOrZero(value: string | undefined): bigint {\n if (value === undefined || !DECIMAL_RE.test(value)) return 0n;\n try {\n return BigInt(value);\n } catch {\n return 0n;\n }\n}\n\nfunction computeLifetimeUsdc(\n apex: AggregatedEarnings['apex'],\n peers: AggregatedEarnings['peers']\n): bigint {\n let total = parseDecimalOrZero(apex.routingFees[USDC_ASSET]?.lifetime);\n for (const peer of peers) {\n total += parseDecimalOrZero(peer.byAsset[USDC_ASSET]?.lifetime);\n }\n return total;\n}\n\nexport interface BadgeProps {\n apex: AggregatedEarnings['apex'];\n peers: AggregatedEarnings['peers'];\n uptimeSeconds: number;\n /** Override the wall clock. Default `new Date()`. Inject in tests to pin rotation. */\n now?: Date;\n}\n\nexport function Badge({\n apex,\n peers,\n uptimeSeconds,\n now = new Date(),\n}: BadgeProps): ReactElement | null {\n const lifetime = computeLifetimeUsdc(apex, peers);\n const lifetimeTriggers = lifetime < LIFETIME_USDC_THRESHOLD;\n const uptimeTriggers = uptimeSeconds < UPTIME_SECONDS_THRESHOLD;\n\n if (!lifetimeTriggers && !uptimeTriggers) return null;\n\n const index =\n Math.floor(now.getTime() / ROTATION_INTERVAL_MS) %\n COPY.heroEarlyRotation.length;\n const text = COPY.heroEarlyRotation[index] ?? COPY.heroEarlyRotation[0];\n\n return (\n <Text color=\"yellow\" bold>\n {text}\n </Text>\n );\n}\n","import { Box, Text, useStdout, useInput } from 'ink';\nimport { useEffect, useState, type ReactElement } from 'react';\nimport type { RecentClaim } from '../types.js';\nimport { formatUsdcMicro } from '../format.js';\nimport { COPY } from '../copy.js';\n\nconst MIN_OVERLAY_WIDTH = 40;\nconst MAX_PEER_ID_WIDTH = 24;\n// Default fallback only. App.tsx provides the authoritative cap (MAX_BUFFER_SIZE in\n// the ring-buffer hook) via the `maxBufferSize` prop so there is one source of truth.\n// Tests that mount the overlay directly fall back to this default.\nconst DEFAULT_MAX_BUFFER_SIZE = 200;\n\nfunction formatTime(iso: string): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return '--:--:--';\n return d.toLocaleTimeString('en-GB', { hour12: false });\n}\n\nfunction truncatePeerId(id: string): string {\n if (id.length <= MAX_PEER_ID_WIDTH) return id;\n return id.slice(0, MAX_PEER_ID_WIDTH - 1) + '…';\n}\n\nfunction arrowFor(direction: RecentClaim['direction']): string {\n return direction === 'inbound' ? '←' : direction === 'outbound' ? '→' : COPY.activityOverlay.directionUnknown;\n}\n\nfunction directionLabel(direction: RecentClaim['direction']): string {\n return direction === 'inbound'\n ? COPY.activityOverlay.directionInbound\n : direction === 'outbound'\n ? COPY.activityOverlay.directionOutbound\n : COPY.activityOverlay.directionUnknown;\n}\n\nfunction formatRow(claim: RecentClaim): string {\n const time = formatTime(claim.at);\n const peer = truncatePeerId(claim.peerId);\n const arrow = arrowFor(claim.direction);\n const amount = formatUsdcMicro(claim.amount, claim.assetScale);\n const dir = directionLabel(claim.direction);\n return `${time} · ${peer} · ${arrow} ${amount} ${claim.assetCode} · ${dir}`;\n}\n\nfunction claimKeyForReact(c: RecentClaim): string {\n return `${c.peerId}|${c.at}|${c.amount}|${c.assetCode}|${c.direction}`;\n}\n\nexport interface ActivityOverlayProps {\n claims: RecentClaim[];\n onClose: () => void;\n columns?: number;\n rows?: number;\n maxBufferSize?: number;\n}\n\nexport function ActivityOverlay({\n claims,\n onClose,\n columns: columnsProp,\n rows: rowsProp,\n maxBufferSize = DEFAULT_MAX_BUFFER_SIZE,\n}: ActivityOverlayProps): ReactElement {\n const { stdout } = useStdout();\n const columns = columnsProp ?? (stdout?.columns || 80);\n const rows = rowsProp ?? (stdout?.rows || 24);\n\n const modalWidth = Math.max(MIN_OVERLAY_WIDTH, Math.floor(columns * 0.7));\n const visibleRows = Math.max(5, rows - 5);\n\n const [scroll, setScroll] = useState(0);\n const maxScroll = Math.max(0, claims.length - visibleRows);\n\n // Reconcile scroll when maxScroll shrinks under it — terminal resize that grows\n // `visibleRows` (or any future shrink of `claims`) would otherwise leave the slice\n // pointing past the data, hiding the newest entries until the operator presses k.\n useEffect(() => {\n if (scroll > maxScroll) setScroll(maxScroll);\n }, [maxScroll, scroll]);\n\n useInput((input, key) => {\n // ESC must be checked BEFORE the ctrl/meta guard — Ink's input parser sets\n // `key.meta` on a bare `\\x1b` byte (Alt-prefix detection), which would\n // otherwise eat the close action.\n if (key.escape) {\n onClose();\n return;\n }\n // Guard against Ctrl-* and Alt-* — they MUST NOT trigger close/scroll.\n if (key.ctrl || key.meta) return;\n if (input === 'q' || input === 'Q') {\n onClose();\n return;\n }\n if (input === 'j' || key.downArrow) {\n setScroll((s) => Math.min(maxScroll, s + 1));\n return;\n }\n if (input === 'k' || key.upArrow) {\n setScroll((s) => Math.max(0, s - 1));\n }\n });\n\n const displayedCount = Math.min(claims.length, maxBufferSize);\n const title = `${COPY.activityOverlay.titlePrefix}${displayedCount} of ${maxBufferSize}`;\n const window = claims.slice(scroll, scroll + visibleRows);\n const hint = claims.length === 0 ? COPY.activityOverlay.scrollHintEmpty : COPY.activityOverlay.scrollHint;\n\n return (\n <Box flexDirection=\"column\" alignItems=\"center\" width={columns}>\n <Box flexDirection=\"column\" borderStyle=\"round\" width={modalWidth} paddingX={1}>\n <Text bold>{title}</Text>\n {claims.length === 0 ? (\n <Text dimColor>{COPY.activityOverlay.emptyHint}</Text>\n ) : (\n window.map((c, i) => (\n <Text key={`${claimKeyForReact(c)}-${scroll + i}`}>{formatRow(c)}</Text>\n ))\n )}\n <Text dimColor>{hint}</Text>\n </Box>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,cAA6B;;;ACDtC,SAAgB,YAAAA,iBAAgB;AAChC,SAAS,OAAAC,MAAK,QAAAC,QAAM,YAAAC,iBAAgB;;;ACDpC,SAAS,WAAW,QAAQ,gBAAgB;;;ACArC,IAAM,8BAA8B;AACpC,IAAM,kBAAkB;AAUxB,IAAM,4BAA4B;;;ADYzC,IAAM,iBAAqC;AAAA,EACzC,QAAQ;AAAA,EACR,MAAM,EAAE,aAAa,CAAC,EAAE;AAAA,EACxB,OAAO,CAAC;AAAA,EACR,cAAc,CAAC;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AACjB;AAEO,SAAS,YAAY,OAA2B,CAAC,GAAkB;AACxE,QAAM;AAAA,IACJ,SAAS;AAAA,IACT,oBAAoB;AAAA,IACpB,YAAY,WAAW;AAAA,EACzB,IAAI;AAEJ,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB;AAAA,IAChD,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAW;AAAA,EACb,CAAC;AAED,QAAM,cAAc,OAAkC,IAAI;AAE1D,QAAM,oBAAoB,OAAO,CAAC;AAElC,YAAU,MAAM;AACd,QAAI,YAAY;AAChB,QAAI,kBAA0C;AAK9C,aAAS,cACP,UAC0D;AAC1D,UAAI,YAAY,YAAY,KAAM,QAAO;AACzC,wBAAkB,WAAW;AAC7B,aAAO,kBAAkB,WAAW,4BAChC,gBACA;AAAA,IACN;AAEA,mBAAe,UAAyB;AACtC,UAAI,UAAW;AAEf,YAAM,KAAK,IAAI,gBAAgB;AAC/B,wBAAkB;AAElB,UAAI;AACF,cAAM,MAAM,MAAM,UAAU,GAAG,MAAM,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cAAc,KAAK,cAAc;AAAA,KAC/C;AAEJ;;;AD5CO,SAAS,SAAS,OAAwB,CAAC,GAAa;AAC7D,SAAO,OAAO,cAAc,KAAK,IAAI,GAAG;AAAA,IACtC,aAAa;AAAA,IACb,cAAc;AAAA,EAChB,CAAC;AACH;","names":["useState","Box","Text","useInput","useState","useEffect","Text","Text","jsxs","Text","jsxs","Text","Text","jsx","Text","Text","jsxs","USDC_SCALE","ASSET","DECIMAL_RE","addDecimalStrings","Text","Box","Text","useStdout","jsx","jsxs","USDC_SCALE","MIN_COL_WIDTH","useStdout","Text","Box","Text","jsx","jsxs","sortKey","Text","Text","jsx","DECIMAL_RE","Text","Box","Text","useStdout","useEffect","useState","jsx","jsxs","arrowFor","useStdout","useState","useEffect","Box","Text","jsx","jsxs","useState","useInput","Text","Box"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toon-protocol/townhouse",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "TOON Townhouse — host-native orchestrator + dashboard for Docker-containerized TOON nodes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -71,10 +71,10 @@
71
71
  "tsup": "^8.0.0",
72
72
  "typescript": "^5.3.0",
73
73
  "vitest": "^1.0.0",
74
- "@toon-protocol/mill": "^0.1.0",
75
74
  "@toon-protocol/core": "^1.4.1",
76
- "@toon-protocol/relay": "^1.3.1",
75
+ "@toon-protocol/mill": "^0.1.0",
77
76
  "@toon-protocol/client": "^0.9.1",
77
+ "@toon-protocol/relay": "^1.3.1",
78
78
  "@toon-protocol/sdk": "^0.5.0"
79
79
  },
80
80
  "scripts": {