-
Notifications
You must be signed in to change notification settings - Fork 10
Replace Node UI token bootstrap with dashboard sessions #1428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
dd189e3
847b160
8d1013b
a8e7b1f
264a775
a550721
70a688f
d5efb31
1973575
8832b9a
03813b2
8f3e55c
022d17a
622e8c6
949a1af
e60ef12
69f0df8
087a7dc
ee51a4e
a83ef23
afb358d
6e1a664
90ec4f9
e797a82
1ffc988
d8834d9
dc6ccfc
7fd09f2
3c1d75c
f217dae
8dd4d81
0a644ed
955fbfe
5bbb47a
104be8f
f7ed67c
7a6700a
1aec8f5
7680931
a9a1cea
e8847c8
066cd95
c47979e
d01aecd
0da257a
a2f725b
8f878fc
b73da51
e652ed6
6793e7c
58ec3ce
a5b65e3
40e9c3b
965dba6
1a94b4d
5cad89f
160958d
acdebb1
2928480
b6f58d0
55d2a64
bc13750
a9da311
6daa067
1badd52
2b191a8
c3b387f
3cab575
064cabe
9d535ea
343929e
921d5aa
f7e8737
7b77e85
8aef2a5
86455bf
c923a03
c06881a
65bc558
1b25ac9
4def731
fe5eadb
77318af
4680aa1
e8bd4dc
0f74f77
bf03d77
4667af2
0e47c7e
3eeed32
c753511
96e4115
a171eb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -661,7 +661,23 @@ function rewriteActiveProviderLine(raw: string, newProvider: string): string | n | |
| * request so the adapter stays free of a `@origintrail-official/dkg-agent` | ||
| * dependency: the cli layer (which has dkg-agent) provides `loadOpWallets`. | ||
| */ | ||
| type PostConfigSetupHook = (dkgHome: string) => Promise<unknown>; | ||
|
|
||
| export interface RunHermesSetupDeps { | ||
| /** | ||
| * Optional setup lifecycle hook invoked after DKG node config bootstrap and | ||
| * before wallet creation / daemon start. CLI setup entry points use this for | ||
| * CLI-owned best-effort side effects while daemon/UI-driven adapter setup | ||
| * omits it. Required setup work should stay explicit instead of being hidden | ||
| * behind this optional hook. | ||
| */ | ||
| afterConfigBootstrap?: PostConfigSetupHook; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Issue: A generic post-config hook turns setup into a side-effect injection point What's wrong Example Suggested direction Confidence note For Agents There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Issue: Avoid spreading a generic post-config hook across setup flows What's wrong Example Suggested direction For Agents |
||
| /** | ||
| * @deprecated Use `afterConfigBootstrap`. Kept as a runtime fallback so | ||
| * JavaScript callers on the previous dependency shape do not silently lose | ||
| * dashboard credential provisioning. | ||
| */ | ||
| ensureDashboardCredentials?: PostConfigSetupHook; | ||
| /** | ||
| * Eagerly create the node's operational wallets (generate-if-absent) after | ||
| * the config bootstrap and before the daemon starts, so faucet funding and | ||
|
|
@@ -704,6 +720,7 @@ export async function runHermesSetup( | |
| // one they chose. Gating on `config.json` alone (the pre-#960 behavior) misses | ||
| // the YAML-only install. | ||
| const dkgConfigHome = resolveDkgConfigHome({ startDir: __dirname }); | ||
| const dashboardCredentialHome = shouldStart ? dkgConfigHome : dkgDir(setupOptions.daemonUrl); | ||
| const dkgConfigExists = | ||
| existsSync(join(dkgConfigHome, 'config.json')) || | ||
| existsSync(join(dkgConfigHome, 'config.yaml')); | ||
|
|
@@ -750,6 +767,18 @@ export async function runHermesSetup( | |
| console.log('[hermes-setup] [dry-run] Would bootstrap ~/.dkg/config.json if missing'); | ||
| } | ||
|
|
||
| // Run CLI-owned setup side effects after node config bootstrap and before | ||
| // wallets / daemon startup. Best-effort so adapter setup remains recoverable | ||
| // and daemon/UI-driven setup can omit terminal-only side effects entirely. | ||
| const afterConfigBootstrap = deps.afterConfigBootstrap ?? deps.ensureDashboardCredentials; | ||
| if (!dryRun && afterConfigBootstrap) { | ||
| try { | ||
| await afterConfigBootstrap(dashboardCredentialHome); | ||
| } catch (err: any) { | ||
| console.warn(`[hermes-setup] Post-config setup hook failed (${err?.message ?? String(err)}); continuing.`); | ||
| } | ||
| } | ||
|
|
||
| // Eagerly ensure the node's wallets exist BEFORE the daemon starts (issue | ||
| // #1306) — matching `dkg init` — so faucet funding (testnet) and manual | ||
| // mainnet funding have wallets even if the daemon never fully boots. Runs | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1645,7 +1645,23 @@ export function verifyMemorySlotInvariants(configPath?: string): void { | |
| * `SetupOptions` so the adapter stays free of a `@origintrail-official/dkg-agent` | ||
| * dependency: the cli layer (which has dkg-agent) provides `loadOpWallets`. | ||
| */ | ||
| type PostConfigSetupHook = (dkgHome: string) => Promise<unknown>; | ||
|
|
||
| export interface RunSetupDeps { | ||
| /** | ||
| * Optional setup lifecycle hook invoked after DKG node config bootstrap and | ||
| * before wallet creation / daemon start. CLI setup entry points use this for | ||
| * CLI-owned best-effort side effects while daemon/UI-driven adapter setup | ||
| * omits it. Required setup work should stay explicit instead of being hidden | ||
| * behind this optional hook. | ||
| */ | ||
| afterConfigBootstrap?: PostConfigSetupHook; | ||
| /** | ||
| * @deprecated Use `afterConfigBootstrap`. Kept as a runtime fallback so | ||
| * JavaScript callers on the previous dependency shape do not silently lose | ||
| * dashboard credential provisioning. | ||
| */ | ||
| ensureDashboardCredentials?: PostConfigSetupHook; | ||
| /** | ||
| * Eagerly create the node's operational wallets (generate-if-absent) after | ||
| * the config write and before the daemon starts, so faucet funding and | ||
|
|
@@ -1742,6 +1758,19 @@ export async function runSetup(options: SetupOptions, deps: RunSetupDeps = {}): | |
| log(`[dry-run] Would write ${join(dkgDir(), 'config.json')} (${network.networkName}, port ${apiPort})`); | ||
| } | ||
|
|
||
| // Run CLI-owned setup side effects after the node config home is known and | ||
| // before wallets / daemon startup. Best-effort so adapter setup remains | ||
| // recoverable and daemon/UI-driven setup can omit terminal-only side effects. | ||
| const afterConfigBootstrap = deps.afterConfigBootstrap ?? deps.ensureDashboardCredentials; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Issue: Post-config setup hook handling is duplicated across setup orchestrators What's wrong Example Suggested direction Confidence note For Agents |
||
| if (!dryRun && afterConfigBootstrap) { | ||
| const dashboardCredentialHome = dkgDir(); | ||
| try { | ||
| await afterConfigBootstrap(dashboardCredentialHome); | ||
| } catch (err: any) { | ||
| warn(`Post-config setup hook failed (${err?.message ?? String(err)}); continuing.`); | ||
| } | ||
| } | ||
|
|
||
| // Eagerly ensure the node's wallets exist BEFORE the daemon starts (issue | ||
| // #1306) — matching `dkg init` — so faucet funding (testnet) and manual | ||
| // mainnet funding have wallets to target even if the daemon never fully | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.