@vtechcom/hexcore 2.0.0-beta.1

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 (173) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/LICENSE +201 -0
  3. package/README.md +283 -0
  4. package/dist/app.module.js +55 -0
  5. package/dist/app.module.js.map +1 -0
  6. package/dist/auth.js +151 -0
  7. package/dist/auth.js.map +1 -0
  8. package/dist/chain/cost-models.js +81 -0
  9. package/dist/chain/cost-models.js.map +1 -0
  10. package/dist/chain/provider.js +269 -0
  11. package/dist/chain/provider.js.map +1 -0
  12. package/dist/chain/socket.js +48 -0
  13. package/dist/chain/socket.js.map +1 -0
  14. package/dist/cli/doctor.js +43 -0
  15. package/dist/cli/doctor.js.map +1 -0
  16. package/dist/cli/hexcore.js +435 -0
  17. package/dist/cli/hexcore.js.map +1 -0
  18. package/dist/common/auth.guard.js +66 -0
  19. package/dist/common/auth.guard.js.map +1 -0
  20. package/dist/common/http.js +171 -0
  21. package/dist/common/http.js.map +1 -0
  22. package/dist/common/zod-validation.pipe.js +47 -0
  23. package/dist/common/zod-validation.pipe.js.map +1 -0
  24. package/dist/config.js +354 -0
  25. package/dist/config.js.map +1 -0
  26. package/dist/config.module.js +35 -0
  27. package/dist/config.module.js.map +1 -0
  28. package/dist/controllers/cardano.controller.js +173 -0
  29. package/dist/controllers/cardano.controller.js.map +1 -0
  30. package/dist/controllers/heads.controller.js +225 -0
  31. package/dist/controllers/heads.controller.js.map +1 -0
  32. package/dist/controllers/setup.controller.js +127 -0
  33. package/dist/controllers/setup.controller.js.map +1 -0
  34. package/dist/controllers/system.controller.js +153 -0
  35. package/dist/controllers/system.controller.js.map +1 -0
  36. package/dist/db/database.module.js +73 -0
  37. package/dist/db/database.module.js.map +1 -0
  38. package/dist/db/index.js +135 -0
  39. package/dist/db/index.js.map +1 -0
  40. package/dist/db/repositories.js +220 -0
  41. package/dist/db/repositories.js.map +1 -0
  42. package/dist/docker/container-stats.js +134 -0
  43. package/dist/docker/container-stats.js.map +1 -0
  44. package/dist/docker/docker.service.js +335 -0
  45. package/dist/docker/docker.service.js.map +1 -0
  46. package/dist/hydra/argv.js +172 -0
  47. package/dist/hydra/argv.js.map +1 -0
  48. package/dist/hydra/blockfrost-keys.js +15 -0
  49. package/dist/hydra/blockfrost-keys.js.map +1 -0
  50. package/dist/hydra/boot-progress.js +165 -0
  51. package/dist/hydra/boot-progress.js.map +1 -0
  52. package/dist/hydra/capabilities.js +131 -0
  53. package/dist/hydra/capabilities.js.map +1 -0
  54. package/dist/hydra/head.service.js +1072 -0
  55. package/dist/hydra/head.service.js.map +1 -0
  56. package/dist/hydra/keys.js +301 -0
  57. package/dist/hydra/keys.js.map +1 -0
  58. package/dist/hydra/node-monitor.service.js +265 -0
  59. package/dist/hydra/node-monitor.service.js.map +1 -0
  60. package/dist/hydra/ws-client.js +177 -0
  61. package/dist/hydra/ws-client.js.map +1 -0
  62. package/dist/main.js +106 -0
  63. package/dist/main.js.map +1 -0
  64. package/dist/preflight.js +215 -0
  65. package/dist/preflight.js.map +1 -0
  66. package/dist/settings.js +243 -0
  67. package/dist/settings.js.map +1 -0
  68. package/dist/setup.service.js +257 -0
  69. package/dist/setup.service.js.map +1 -0
  70. package/dist/version.js +46 -0
  71. package/dist/version.js.map +1 -0
  72. package/node_modules/@hexcore/shared/dist/cjs/api.d.ts +730 -0
  73. package/node_modules/@hexcore/shared/dist/cjs/api.d.ts.map +1 -0
  74. package/node_modules/@hexcore/shared/dist/cjs/api.js +358 -0
  75. package/node_modules/@hexcore/shared/dist/cjs/api.js.map +1 -0
  76. package/node_modules/@hexcore/shared/dist/cjs/domain.d.ts +298 -0
  77. package/node_modules/@hexcore/shared/dist/cjs/domain.d.ts.map +1 -0
  78. package/node_modules/@hexcore/shared/dist/cjs/domain.js +49 -0
  79. package/node_modules/@hexcore/shared/dist/cjs/domain.js.map +1 -0
  80. package/node_modules/@hexcore/shared/dist/cjs/hydra-versions.d.ts +279 -0
  81. package/node_modules/@hexcore/shared/dist/cjs/hydra-versions.d.ts.map +1 -0
  82. package/node_modules/@hexcore/shared/dist/cjs/hydra-versions.js +453 -0
  83. package/node_modules/@hexcore/shared/dist/cjs/hydra-versions.js.map +1 -0
  84. package/node_modules/@hexcore/shared/dist/cjs/index.d.ts +7 -0
  85. package/node_modules/@hexcore/shared/dist/cjs/index.d.ts.map +1 -0
  86. package/node_modules/@hexcore/shared/dist/cjs/index.js +23 -0
  87. package/node_modules/@hexcore/shared/dist/cjs/index.js.map +1 -0
  88. package/node_modules/@hexcore/shared/dist/cjs/naming.d.ts +118 -0
  89. package/node_modules/@hexcore/shared/dist/cjs/naming.d.ts.map +1 -0
  90. package/node_modules/@hexcore/shared/dist/cjs/naming.js +103 -0
  91. package/node_modules/@hexcore/shared/dist/cjs/naming.js.map +1 -0
  92. package/node_modules/@hexcore/shared/dist/cjs/offline.d.ts +73 -0
  93. package/node_modules/@hexcore/shared/dist/cjs/offline.d.ts.map +1 -0
  94. package/node_modules/@hexcore/shared/dist/cjs/offline.js +80 -0
  95. package/node_modules/@hexcore/shared/dist/cjs/offline.js.map +1 -0
  96. package/node_modules/@hexcore/shared/dist/cjs/protocol-params.d.ts +79 -0
  97. package/node_modules/@hexcore/shared/dist/cjs/protocol-params.d.ts.map +1 -0
  98. package/node_modules/@hexcore/shared/dist/cjs/protocol-params.js +223 -0
  99. package/node_modules/@hexcore/shared/dist/cjs/protocol-params.js.map +1 -0
  100. package/node_modules/@hexcore/shared/dist/esm/api.js +355 -0
  101. package/node_modules/@hexcore/shared/dist/esm/api.js.map +1 -0
  102. package/node_modules/@hexcore/shared/dist/esm/domain.js +46 -0
  103. package/node_modules/@hexcore/shared/dist/esm/domain.js.map +1 -0
  104. package/node_modules/@hexcore/shared/dist/esm/hydra-versions.js +441 -0
  105. package/node_modules/@hexcore/shared/dist/esm/hydra-versions.js.map +1 -0
  106. package/node_modules/@hexcore/shared/dist/esm/index.js +7 -0
  107. package/node_modules/@hexcore/shared/dist/esm/index.js.map +1 -0
  108. package/node_modules/@hexcore/shared/dist/esm/naming.js +95 -0
  109. package/node_modules/@hexcore/shared/dist/esm/naming.js.map +1 -0
  110. package/node_modules/@hexcore/shared/dist/esm/offline.js +75 -0
  111. package/node_modules/@hexcore/shared/dist/esm/offline.js.map +1 -0
  112. package/node_modules/@hexcore/shared/dist/esm/package.json +3 -0
  113. package/node_modules/@hexcore/shared/dist/esm/protocol-params.js +217 -0
  114. package/node_modules/@hexcore/shared/dist/esm/protocol-params.js.map +1 -0
  115. package/node_modules/@hexcore/shared/package.json +15 -0
  116. package/package.json +67 -0
  117. package/web/200.html +23 -0
  118. package/web/404.html +23 -0
  119. package/web/_nuxt/2MxohCD-.js +1 -0
  120. package/web/_nuxt/4pFXjB_u.js +1 -0
  121. package/web/_nuxt/B-v0dEQX.js +1 -0
  122. package/web/_nuxt/B4yE3U25.js +1 -0
  123. package/web/_nuxt/BFh8Ai0L.js +1 -0
  124. package/web/_nuxt/BgPn4NJH.js +1 -0
  125. package/web/_nuxt/Bj1xviSh.js +1 -0
  126. package/web/_nuxt/BnotlrL7.js +1 -0
  127. package/web/_nuxt/C1YRg2ic.js +1 -0
  128. package/web/_nuxt/CGD7MYQH.js +1 -0
  129. package/web/_nuxt/CQcG7Bu4.js +1 -0
  130. package/web/_nuxt/CS3KqpH_.js +1 -0
  131. package/web/_nuxt/CT-yt694.js +1 -0
  132. package/web/_nuxt/CZK6xUH-.js +1 -0
  133. package/web/_nuxt/CcdyYRYz.js +1 -0
  134. package/web/_nuxt/CePNTU1S.js +1 -0
  135. package/web/_nuxt/CgPLsCeU.js +5 -0
  136. package/web/_nuxt/CkCrahXt.js +1 -0
  137. package/web/_nuxt/CnOqDT9k.js +3 -0
  138. package/web/_nuxt/CqsSss-D.js +1 -0
  139. package/web/_nuxt/Cr8dL64Q.js +1 -0
  140. package/web/_nuxt/D3CwzwU0.js +1 -0
  141. package/web/_nuxt/DDANn6-H.js +1 -0
  142. package/web/_nuxt/DDl9uKIA.js +1 -0
  143. package/web/_nuxt/DL9i0ayn.js +1 -0
  144. package/web/_nuxt/DLNoK9BC.js +1 -0
  145. package/web/_nuxt/DLztFeOQ.js +1 -0
  146. package/web/_nuxt/DPihKXdt.js +1 -0
  147. package/web/_nuxt/DXyr6Naa.js +1 -0
  148. package/web/_nuxt/DeDg5p0D.js +1 -0
  149. package/web/_nuxt/DgDlQiDU.js +1 -0
  150. package/web/_nuxt/DyPI7qJE.js +30 -0
  151. package/web/_nuxt/LGfPBi70.js +1 -0
  152. package/web/_nuxt/Onf26W-r.js +1 -0
  153. package/web/_nuxt/QZNQe_OX.js +1 -0
  154. package/web/_nuxt/Y8IJM-iz.js +1 -0
  155. package/web/_nuxt/YUGC0nt0.js +1 -0
  156. package/web/_nuxt/builds/latest.json +1 -0
  157. package/web/_nuxt/builds/meta/7e461629-93e2-4694-b237-6d5c6a85c97c.json +1 -0
  158. package/web/_nuxt/builds/meta/dev.json +1 -0
  159. package/web/_nuxt/entry.BxsAxZxf.css +1 -0
  160. package/web/_nuxt/error-404.XbtAw-qw.css +1 -0
  161. package/web/_nuxt/error-500.CNHVltWM.css +1 -0
  162. package/web/_nuxt/rS90pPZ_.js +1 -0
  163. package/web/_nuxt/rhEiP908.js +1 -0
  164. package/web/_nuxt/vSj9Ec0g.js +1 -0
  165. package/web/_nuxt/woNjBJMN.js +1 -0
  166. package/web/favicon.svg +28 -0
  167. package/web/heads/index.html +23 -0
  168. package/web/heads/new/index.html +23 -0
  169. package/web/index.html +23 -0
  170. package/web/login/index.html +23 -0
  171. package/web/logo.svg +56 -0
  172. package/web/settings/index.html +23 -0
  173. package/web/setup/index.html +23 -0
@@ -0,0 +1,355 @@
1
+ /**
2
+ * Request/response contracts. Imported by the control-plane (validation) AND the
3
+ * web UI (typed fetch) so the two can never drift.
4
+ */
5
+ import { z } from 'zod';
6
+ import { chainBackendSchema, networkSchema } from './domain.js';
7
+ import { DEFAULT_OFFLINE_SEED_LOVELACE, MAX_OFFLINE_NODES, offlineHeadSeedPattern } from './offline.js';
8
+ /**
9
+ * Creating a head in v2 only needs a name and a node count — the control-plane
10
+ * generates every Hydra/Cardano key itself. In v1 the caller had to supply
11
+ * pre-generated key material for every node, which was the single biggest
12
+ * source of setup friction.
13
+ */
14
+ /**
15
+ * A Blockfrost project id carries the network in its prefix. Checking the shape
16
+ * here turns a typo into a field error on the create form instead of a head
17
+ * that boots and then never observes its own init transaction.
18
+ */
19
+ export const blockfrostProjectIdSchema = z
20
+ .string()
21
+ .trim()
22
+ .regex(/^(preprod|preview|mainnet)[A-Za-z0-9]+$/, 'A Blockfrost project id starts with the network name, e.g. preprodXXXXXXXX');
23
+ /**
24
+ * Offline-mode settings. Only read when `chainBackend` is `offline`; the flags
25
+ * they produce are mutually exclusive with every online one (see offline.ts).
26
+ */
27
+ export const offlineConfigSchema = z.object({
28
+ /**
29
+ * `--offline-head-seed`. Left out, it is derived from the head id, which is
30
+ * both unique per head and stable across restarts — two heads sharing a
31
+ * seed would derive the same head id.
32
+ */
33
+ headSeed: z
34
+ .string()
35
+ .trim()
36
+ .regex(offlineHeadSeedPattern, 'The head seed is 64 hex characters (32 bytes)')
37
+ .optional(),
38
+ /**
39
+ * The L2 ledger's entire starting state, verbatim, as hydra-node's
40
+ * `--initial-utxo` file. Left out, each node's own address is seeded with
41
+ * `seedLovelace` — so the operator holds the keys to everything in the head
42
+ * without having to write this by hand.
43
+ */
44
+ initialUtxo: z.record(z.string(), z.unknown()).optional(),
45
+ /**
46
+ * Bounded well below Number.MAX_SAFE_INTEGER: the value ends up in a JSON
47
+ * file read as JSON, and a seed large enough to round is a typo, not a
48
+ * requirement.
49
+ */
50
+ seedLovelace: z.number().int().min(0).max(1_000_000_000_000_000).default(DEFAULT_OFFLINE_SEED_LOVELACE),
51
+ /**
52
+ * Shelley genesis for `--ledger-genesis`, which gives the simulated L1 its
53
+ * slot/time arithmetic. Genuinely optional — hydra-node's own default is
54
+ * "no genesis file" — so it is omitted rather than invented when absent: a
55
+ * hand-built partial genesis fails to decode and kills the node at startup.
56
+ */
57
+ ledgerGenesis: z.record(z.string(), z.unknown()).optional(),
58
+ });
59
+ /** Per-head logging. See HeadLoggingView for why hydra-node and Docker knobs sit together. */
60
+ export const headLoggingSchema = z.object({
61
+ /** hydra-node `--quiet`. */
62
+ quiet: z.boolean().default(false),
63
+ /** Docker json-file max-size per file, in MB. */
64
+ maxSizeMb: z.number().int().min(1).max(1024).default(10),
65
+ /** Docker json-file max-file. */
66
+ maxFiles: z.number().int().min(1).max(50).default(3),
67
+ });
68
+ /**
69
+ * Kept as a plain object so `updateHeadSchema` can still `.partial()` it —
70
+ * the cross-field rules live in `createHeadSchema` below, and a ZodEffects
71
+ * cannot be partialled.
72
+ */
73
+ const createHeadObject = z.object({
74
+ name: z
75
+ .string()
76
+ .min(1, 'name is required')
77
+ .max(48)
78
+ .regex(/^[a-zA-Z0-9][a-zA-Z0-9 _-]*$/, 'name may only contain letters, digits, space, dash and underscore'),
79
+ description: z.string().max(280).optional(),
80
+ /** 1 = solo head (useful for smoke tests), up to 10 peers. */
81
+ nodeCount: z.number().int().min(1).max(10).default(1),
82
+ network: networkSchema.optional(),
83
+ chainBackend: chainBackendSchema.optional(),
84
+ contestationPeriod: z.number().int().min(1).max(86400).default(120),
85
+ depositPeriod: z.number().int().min(1).max(86400).default(720),
86
+ persistenceRotateAfter: z.number().int().min(100).default(15000),
87
+ /**
88
+ * Overrides merged on top of whatever protocol parameters are fetched at
89
+ * start. TOP-LEVEL keys only: the merge is a shallow spread, so a partial
90
+ * nested object replaces its whole key and drops the siblings. The create
91
+ * form builds these with `diffProtocolParameters`, which is what keeps them
92
+ * whole — see protocol-params.ts.
93
+ */
94
+ protocolParameters: z.record(z.string(), z.unknown()).optional(),
95
+ /** Only read when chainBackend is `offline`. */
96
+ offline: offlineConfigSchema.optional(),
97
+ logging: headLoggingSchema.optional(),
98
+ /**
99
+ * Blockfrost key for every node of this head, unless a node overrides it
100
+ * below. Optional: left out, nodes fall back to the server-wide key, and
101
+ * the control-plane refuses the head if there isn't one.
102
+ */
103
+ blockfrostProjectId: blockfrostProjectIdSchema.optional(),
104
+ /**
105
+ * Per-node keys, one per node in index order.
106
+ *
107
+ * Blockfrost meters per project id, so a head whose nodes all share one key
108
+ * spends a single rate limit budget N ways — fine for a smoke test, not for
109
+ * N independent participants. Sharing stays the default (this is left out,
110
+ * or filled with the same value); giving each node its own is a matter of
111
+ * filling the array.
112
+ */
113
+ nodeBlockfrostProjectIds: z.array(blockfrostProjectIdSchema).min(1).max(10).optional(),
114
+ /**
115
+ * Cardano payment keys to reuse instead of generating, one entry per node
116
+ * in index order; null for a node that should get a fresh pair.
117
+ *
118
+ * The point is funds: a generated node starts at a brand-new address that
119
+ * has to be filled from the faucet before the head can commit anything.
120
+ * Supplying a key that already holds test ADA skips that entirely.
121
+ *
122
+ * Hydra keys are never imported — they only sign Head protocol messages,
123
+ * so there is no state attached to carrying one over.
124
+ */
125
+ nodeCardanoKeys: z
126
+ .array(z
127
+ .object({
128
+ /** A .skey file, its cborHex, 64 hex chars, or ed25519_sk1… */
129
+ signingKey: z.string().trim().min(1),
130
+ /** Optional .vkey, checked against the signing key. */
131
+ verificationKey: z.string().trim().min(1).optional(),
132
+ })
133
+ .nullable())
134
+ .min(1)
135
+ .max(10)
136
+ .optional(),
137
+ /**
138
+ * Optional per-head hydra-node image; falls back to HYDRA_NODE_IMAGE.
139
+ *
140
+ * Any reference is accepted, not just the ones in HYDRA_VERSION_PROFILES —
141
+ * a tag with no profile is probed instead of refused, so a fork or a release
142
+ * newer than this build still boots. What the tag cannot be is empty or
143
+ * whitespace-bearing, which would reach Docker as an unparseable ref.
144
+ */
145
+ hydraNodeImage: z
146
+ .string()
147
+ .trim()
148
+ .min(1)
149
+ .max(200)
150
+ .regex(/^\S+$/, 'hydraNodeImage must be a Docker image reference')
151
+ .optional(),
152
+ });
153
+ export const createHeadSchema = createHeadObject.superRefine((v, ctx) => {
154
+ /**
155
+ * Offline heads are multi-party, but capped lower than online ones: every
156
+ * node runs on this one machine, each with an embedded etcd, and there is
157
+ * no L1 to spread the load over. See MAX_OFFLINE_NODES.
158
+ */
159
+ if (v.chainBackend === 'offline' && v.nodeCount > MAX_OFFLINE_NODES) {
160
+ ctx.addIssue({
161
+ code: z.ZodIssueCode.custom,
162
+ path: ['nodeCount'],
163
+ message: `An offline head runs at most ${MAX_OFFLINE_NODES} nodes — they all share this machine, with no layer 1 to spread the load over.`,
164
+ });
165
+ }
166
+ /**
167
+ * Keys the head would store and never read. An offline node makes no HTTP
168
+ * calls at all, so accepting a project id here would leave a credential on
169
+ * disk for nothing.
170
+ */
171
+ if (v.chainBackend === 'offline' && (v.blockfrostProjectId || v.nodeBlockfrostProjectIds)) {
172
+ ctx.addIssue({
173
+ code: z.ZodIssueCode.custom,
174
+ path: ['blockfrostProjectId'],
175
+ message: 'An offline head never contacts Blockfrost — remove the project id.',
176
+ });
177
+ }
178
+ // Settings that would be stored and silently ignored. Saying so is better
179
+ // than letting someone tune a seed UTxO that no node will ever read.
180
+ if (v.offline && v.chainBackend && v.chainBackend !== 'offline') {
181
+ ctx.addIssue({
182
+ code: z.ZodIssueCode.custom,
183
+ path: ['offline'],
184
+ message: `Offline settings only apply to an offline head, not a ${v.chainBackend} one.`,
185
+ });
186
+ }
187
+ // One key per node, in index order — a short array would silently leave the
188
+ // tail of the head on a different key than the operator intended.
189
+ if (v.nodeBlockfrostProjectIds && v.nodeBlockfrostProjectIds.length !== v.nodeCount) {
190
+ ctx.addIssue({
191
+ code: z.ZodIssueCode.custom,
192
+ path: ['nodeBlockfrostProjectIds'],
193
+ message: `Expected one Blockfrost key per node (${v.nodeCount}), got ${v.nodeBlockfrostProjectIds.length}`,
194
+ });
195
+ }
196
+ if (v.nodeCardanoKeys && v.nodeCardanoKeys.length !== v.nodeCount) {
197
+ ctx.addIssue({
198
+ code: z.ZodIssueCode.custom,
199
+ path: ['nodeCardanoKeys'],
200
+ message: `Expected one entry per node (${v.nodeCount}), got ${v.nodeCardanoKeys.length}. Use null for nodes that should get a generated key.`,
201
+ });
202
+ }
203
+ /**
204
+ * A key's prefix is its network. Mismatches are worth catching here because
205
+ * hydra-node does not fail on them — it starts, watches the wrong chain,
206
+ * and simply never sees the head's own init transaction.
207
+ */
208
+ if (!v.network)
209
+ return;
210
+ const wrong = (id) => !id.startsWith(v.network);
211
+ if (v.blockfrostProjectId && wrong(v.blockfrostProjectId)) {
212
+ ctx.addIssue({
213
+ code: z.ZodIssueCode.custom,
214
+ path: ['blockfrostProjectId'],
215
+ message: `This key is not for ${v.network} — a ${v.network} project id starts with "${v.network}"`,
216
+ });
217
+ }
218
+ v.nodeBlockfrostProjectIds?.forEach((id, i) => {
219
+ if (wrong(id)) {
220
+ ctx.addIssue({
221
+ code: z.ZodIssueCode.custom,
222
+ path: ['nodeBlockfrostProjectIds', i],
223
+ message: `This key is not for ${v.network} — a ${v.network} project id starts with "${v.network}"`,
224
+ });
225
+ }
226
+ });
227
+ });
228
+ export const updateHeadSchema = createHeadObject
229
+ .partial()
230
+ .omit({ nodeCount: true })
231
+ .extend({ name: createHeadObject.shape.name.optional() });
232
+ /**
233
+ * Check a Cardano key before it is committed to a head.
234
+ *
235
+ * Pasting a key is the one step of head creation with no feedback: the address
236
+ * it produces is not visible until the head exists, and by then a wrong key
237
+ * means deleting and starting over. This answers "what address is this, and
238
+ * does it hold anything" while the form is still open.
239
+ */
240
+ export const verifyCardanoKeySchema = z.object({
241
+ signingKey: z.string().trim().min(1),
242
+ /** Optional, and only ever cross-checked against the signing key. */
243
+ verificationKey: z.string().trim().min(1).optional(),
244
+ /** Defaults to the server's network — the address differs per network. */
245
+ network: networkSchema.optional(),
246
+ /**
247
+ * Key to look the balance up with, for a head that will carry its own.
248
+ * Falls back to the server-wide one; without either, the address still
249
+ * comes back and the balance does not.
250
+ */
251
+ blockfrostProjectId: blockfrostProjectIdSchema.optional(),
252
+ });
253
+ /**
254
+ * The protocol parameters a head created right now would boot with.
255
+ *
256
+ * The create form needs the effective baseline before it can offer to edit it:
257
+ * overrides merge at the top level, so a field can only be changed safely by
258
+ * starting from the whole current value and diffing. Asking the server also
259
+ * keeps the browser out of the business of holding a Blockfrost key.
260
+ */
261
+ export const protocolParametersQuerySchema = z.object({
262
+ network: networkSchema.optional(),
263
+ /** For a head that will carry its own key, before it exists. */
264
+ blockfrostProjectId: blockfrostProjectIdSchema.optional(),
265
+ /** Set false to see real L1 fees instead of the zeroed L2 ones. */
266
+ zeroFees: z.boolean().optional(),
267
+ });
268
+ export const listHeadsQuerySchema = z.object({
269
+ status: z.string().optional(),
270
+ });
271
+ /** Wipe persistence dirs so the head can restart from a clean slate. */
272
+ export const resetHeadSchema = z.object({
273
+ /** Also delete generated key material (forces brand-new addresses). */
274
+ includeKeys: z.boolean().default(false),
275
+ });
276
+ export const loginSchema = z.object({
277
+ username: z.string().min(1),
278
+ password: z.string().min(1),
279
+ });
280
+ // ---------------------------------------------------------------------- setup
281
+ /**
282
+ * First-run setup.
283
+ *
284
+ * Until this exists, standing up Hexcore meant editing a 123-line `.env` by
285
+ * hand — which assumes the reader already knows what a Blockfrost project id is
286
+ * and which of thirty keys matter. docs/PRODUCT.md names non-technical
287
+ * operators as a first-class audience, and that file is where they stopped.
288
+ *
289
+ * The settings a wizard may write are deliberately a SMALL subset of the env
290
+ * schema. Two rules decide what is in:
291
+ *
292
+ * 1. It must be answerable by someone who has not read the code. `PORT_BASE`
293
+ * and `HYDRA_UNSYNCED_PERIOD` are not; they stay env-only, where whoever
294
+ * needs them will find them.
295
+ * 2. It must be applicable without a restart. `PORT` and `STATE_DIR` are read
296
+ * once while the process boots — offering them in a web form would produce
297
+ * a saved setting that silently does not take effect.
298
+ */
299
+ export const settingsSchema = z.object({
300
+ network: networkSchema,
301
+ chainBackend: chainBackendSchema,
302
+ /**
303
+ * Blank clears it. The wizard sends what the operator typed, and an empty
304
+ * box has to mean "no key" rather than "keep the old one" — the opposite
305
+ * rule is what makes a settings form unable to remove a value.
306
+ */
307
+ blockfrostProjectId: z.string().trim().optional(),
308
+ cardanoNodeSocket: z.string().trim().optional(),
309
+ /** Default image for heads that name none; a head can still pin its own. */
310
+ hydraNodeImage: z.string().trim().min(1).optional(),
311
+ adminUsername: z.string().trim().min(1).optional(),
312
+ });
313
+ /**
314
+ * The setup request.
315
+ *
316
+ * Carries the admin password, which is the one value that must never reach the
317
+ * settings file: it is handed to the auth service, hashed into `secrets.json`,
318
+ * and dropped. Left blank, one is generated and printed once — the same
319
+ * behaviour a fresh boot has always had.
320
+ */
321
+ export const completeSetupSchema = settingsSchema.extend({
322
+ /**
323
+ * Proves the caller can read the terminal Hexcore was started from.
324
+ *
325
+ * Setup is necessarily reachable without a token — it is where the password
326
+ * is set — so on any interface but loopback the first request wins, and on
327
+ * a shared network that is a takeover. The CLI prints the URL with this in
328
+ * it, so for the person who just ran `hexcore` it costs a click.
329
+ */
330
+ setupToken: z.string().min(1),
331
+ adminPassword: z.string().min(8, 'Use at least 8 characters').optional(),
332
+ });
333
+ /**
334
+ * How far a wipe goes.
335
+ *
336
+ * Split into three because the middle one is the one people actually want and
337
+ * the last one destroys money. A head's Cardano keys control addresses that may
338
+ * hold test ADA — or, on mainnet, ADA — and Hexcore is the only place they
339
+ * exist. `everything` is therefore CLI-only; see the note on cleanSchema.
340
+ */
341
+ export const cleanScopeSchema = z.enum(['config', 'heads', 'everything']);
342
+ /**
343
+ * `everything` is deliberately absent from the API surface.
344
+ *
345
+ * Two reasons, and the second is not negotiable: it deletes the key material
346
+ * behind funded addresses, and it deletes the SQLite database the request is
347
+ * being served from. A server cannot honestly delete its own state mid-request
348
+ * and then answer. `hexcore clean --all` does it with the process stopped.
349
+ */
350
+ export const cleanSchema = z.object({
351
+ scope: z.enum(['config', 'heads']),
352
+ /** Must equal the machine's own name; the UI shows which to type. */
353
+ confirm: z.string().min(1),
354
+ });
355
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources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C,GAAG,CAAC,CAAC,CAAC;IAC7B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAAC,QAAQ,EAAE;CAC3E,CAAC,CAAC;AA+BH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AAG1E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClC,qEAAqE;IACrE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC7B,CAAC,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Hydra Head / Node domain model shared between control-plane and web UI.
3
+ */
4
+ import { z } from 'zod';
5
+ /** Lifecycle of a Head as tracked by the control-plane (not the on-chain Hydra state). */
6
+ export const headStatusSchema = z.enum([
7
+ 'CONFIGURED', // rows + keys exist on disk, no containers
8
+ 'STARTING', // containers created, waiting for all nodes to greet
9
+ 'RUNNING', // all nodes answered Greetings
10
+ 'STOPPED', // containers removed on purpose
11
+ 'FAILED', // boot failed, containers cleaned up
12
+ ]);
13
+ /**
14
+ * On-chain Hydra protocol state, mirrored from the node's Greetings frame.
15
+ *
16
+ * Sourced from `Hydra.API.ServerOutput.HeadStatus`. FANNING_OUT landed after
17
+ * the 2.3.0 tag (selective partial fanout) and is accepted ahead of time so a
18
+ * newer image degrades to a correct label rather than UNKNOWN.
19
+ */
20
+ export const hydraStateSchema = z.enum([
21
+ 'IDLE',
22
+ 'INITIALIZING',
23
+ 'OPEN',
24
+ 'CLOSED',
25
+ 'FANOUT_POSSIBLE',
26
+ 'FANNING_OUT',
27
+ 'FINAL',
28
+ 'UNKNOWN',
29
+ ]);
30
+ export const nodeStatusSchema = z.enum(['CREATED', 'STARTING', 'RUNNING', 'STOPPED', 'FAILED']);
31
+ export const networkSchema = z.enum(['preprod', 'preview', 'mainnet']);
32
+ /**
33
+ * How a head talks to layer 1 — or whether it does at all.
34
+ *
35
+ * `offline` is not a variant of the other two: hydra-node's option parser puts
36
+ * `--offline-head-seed` on a different branch than `--blockfrost` /
37
+ * `--node-socket`, and mixing them aborts startup. See offline.ts.
38
+ */
39
+ export const chainBackendSchema = z.enum(['blockfrost', 'cardano-node', 'offline']);
40
+ /** Network magic per network — used for --testnet-magic / --mainnet. */
41
+ export const NETWORK_MAGIC = {
42
+ preprod: 1,
43
+ preview: 2,
44
+ mainnet: null, // mainnet uses --mainnet, no magic
45
+ };
46
+ //# sourceMappingURL=domain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.js","sourceRoot":"","sources":["../../src/domain.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0FAA0F;AAC1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IACnC,YAAY,EAAE,2CAA2C;IACzD,UAAU,EAAE,qDAAqD;IACjE,SAAS,EAAE,+BAA+B;IAC1C,SAAS,EAAE,gCAAgC;IAC3C,QAAQ,EAAE,qCAAqC;CAClD,CAAC,CAAC;AAGH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IACnC,MAAM;IACN,cAAc;IACd,MAAM;IACN,QAAQ;IACR,iBAAiB;IACjB,aAAa;IACb,OAAO;IACP,SAAS;CACZ,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGhG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAGvE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC;AAGpF,wEAAwE;AACxE,MAAM,CAAC,MAAM,aAAa,GAA0C;IAChE,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,IAAI,EAAE,mCAAmC;CACrD,CAAC"}