ainize 0.1.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 +225 -0
- package/dist/bin.d.ts +10 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +711 -0
- package/dist/bin.js.map +1 -0
- package/dist/client.d.ts +38 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +164 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/auth.d.ts +30 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +216 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/branch.d.ts +326 -0
- package/dist/commands/branch.d.ts.map +1 -0
- package/dist/commands/branch.js +467 -0
- package/dist/commands/branch.js.map +1 -0
- package/dist/commands/chain.d.ts +43 -0
- package/dist/commands/chain.d.ts.map +1 -0
- package/dist/commands/chain.js +224 -0
- package/dist/commands/chain.js.map +1 -0
- package/dist/commands/chat.d.ts +157 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +395 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/dataset.d.ts +51 -0
- package/dist/commands/dataset.d.ts.map +1 -0
- package/dist/commands/dataset.js +157 -0
- package/dist/commands/dataset.js.map +1 -0
- package/dist/commands/drive.d.ts +32 -0
- package/dist/commands/drive.d.ts.map +1 -0
- package/dist/commands/drive.js +68 -0
- package/dist/commands/drive.js.map +1 -0
- package/dist/commands/huggingface-dataset.d.ts +63 -0
- package/dist/commands/huggingface-dataset.d.ts.map +1 -0
- package/dist/commands/huggingface-dataset.js +254 -0
- package/dist/commands/huggingface-dataset.js.map +1 -0
- package/dist/commands/init.d.ts +107 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +538 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/ledger.d.ts +43 -0
- package/dist/commands/ledger.d.ts.map +1 -0
- package/dist/commands/ledger.js +125 -0
- package/dist/commands/ledger.js.map +1 -0
- package/dist/commands/node.d.ts +250 -0
- package/dist/commands/node.d.ts.map +1 -0
- package/dist/commands/node.js +651 -0
- package/dist/commands/node.js.map +1 -0
- package/dist/commands/patch.d.ts +852 -0
- package/dist/commands/patch.d.ts.map +1 -0
- package/dist/commands/patch.js +1527 -0
- package/dist/commands/patch.js.map +1 -0
- package/dist/commands/peers.d.ts +86 -0
- package/dist/commands/peers.d.ts.map +1 -0
- package/dist/commands/peers.js +143 -0
- package/dist/commands/peers.js.map +1 -0
- package/dist/commands/teach-dataset.d.ts +381 -0
- package/dist/commands/teach-dataset.d.ts.map +1 -0
- package/dist/commands/teach-dataset.js +780 -0
- package/dist/commands/teach-dataset.js.map +1 -0
- package/dist/commands/teach.d.ts +351 -0
- package/dist/commands/teach.d.ts.map +1 -0
- package/dist/commands/teach.js +435 -0
- package/dist/commands/teach.js.map +1 -0
- package/dist/context.d.ts +55 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +102 -0
- package/dist/context.js.map +1 -0
- package/dist/ens.d.ts +50 -0
- package/dist/ens.d.ts.map +1 -0
- package/dist/ens.js +155 -0
- package/dist/ens.js.map +1 -0
- package/dist/help.d.ts +57 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +227 -0
- package/dist/help.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +104 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +383 -0
- package/dist/output.js.map +1 -0
- package/dist/pid.d.ts +5 -0
- package/dist/pid.d.ts.map +1 -0
- package/dist/pid.js +25 -0
- package/dist/pid.js.map +1 -0
- package/dist/quiet.d.ts +2 -0
- package/dist/quiet.d.ts.map +1 -0
- package/dist/quiet.js +12 -0
- package/dist/quiet.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ainize init` / `ainize config` / `ainize keys` — local node configuration (AINIZE_HOME/config.json).
|
|
3
|
+
*/
|
|
4
|
+
import { createCipheriv, createDecipheriv, randomBytes, scryptSync } from 'node:crypto';
|
|
5
|
+
import { chmodSync, copyFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import { PROTECTED_CONFIG_KEYS, coerceConfigValue, configField, configFieldType, configKeys, configPath, defaultConfig, hashPassword, loadConfig, createIdentity, identityFromPrivateKey, nearestConfigKey, saveConfig, validateConfig, } from '@ainize/core';
|
|
7
|
+
import { NodeClient } from '../client.js';
|
|
8
|
+
import { promptLine, promptPassword } from './auth.js';
|
|
9
|
+
import { warnLedgerMismatch } from './peers.js';
|
|
10
|
+
import { CliError, PROG } from '../context.js';
|
|
11
|
+
import { runningPid } from '../pid.js';
|
|
12
|
+
import { emit, info, kv, ok, warn, c } from '../output.js';
|
|
13
|
+
/** Copy config.json aside before overwriting it — it is the only copy of the node's private key. */
|
|
14
|
+
function backupConfig(home) {
|
|
15
|
+
const from = configPath(home);
|
|
16
|
+
const to = `${from}.bak-${new Date().toISOString().replace(/[:.]/g, '-')}`;
|
|
17
|
+
copyFileSync(from, to);
|
|
18
|
+
chmodSync(to, 0o600);
|
|
19
|
+
return to;
|
|
20
|
+
}
|
|
21
|
+
export async function init(ctx, a = {}) {
|
|
22
|
+
const p = configPath(ctx.home);
|
|
23
|
+
const existing = existsSync(p) ? loadConfig(ctx.home) : null;
|
|
24
|
+
if (existing && !a.force) {
|
|
25
|
+
throw new CliError(`config already exists at ${p} — change one setting with \`${PROG} config set <key> <value>\`; \`--force\` rewrites the file (keeping this node's identity)`);
|
|
26
|
+
}
|
|
27
|
+
const roles = a.roles ? a.roles.split(',').map((s) => s.trim()).filter(Boolean) : undefined;
|
|
28
|
+
for (const r of roles ?? [])
|
|
29
|
+
if (!['seller', 'verifier', 'serving', 'gateway'].includes(r))
|
|
30
|
+
throw new CliError(`unknown role: ${r}`);
|
|
31
|
+
/**
|
|
32
|
+
* `gateway` is a name the config accepts and nothing reads (item 384).
|
|
33
|
+
*
|
|
34
|
+
* It is in `NodeRole` and in `ROLES`, so `--roles gateway` validates, is written to config.json and is
|
|
35
|
+
* advertised to peers — and no line of code anywhere branches on it. An operator choosing it gets a node that
|
|
36
|
+
* behaves exactly as if they had not. The role is what `p2p-compute-market-design.md` reserves for a node with
|
|
37
|
+
* no runtime that hosts the UI and buys inference from peers; that design is accepted and not implemented, so
|
|
38
|
+
* the honest thing is to keep the name (existing configs and peer records carry it) and say what it does today.
|
|
39
|
+
*/
|
|
40
|
+
if ((roles ?? []).includes('gateway')) {
|
|
41
|
+
warn(ctx, 'the `gateway` role does nothing on this build: it is reserved for a node that owns no GPU and buys inference from peers, which is designed (docs/p2p-compute-market-design.md) and not built. The node will run exactly as it would without it.');
|
|
42
|
+
}
|
|
43
|
+
if (a.newIdentity && !existing)
|
|
44
|
+
throw new CliError('--new-identity only means something when a config already exists; plain `init` mints a key');
|
|
45
|
+
// The key in config.json owns every anchor this node published, its balance and its payout address, and it is
|
|
46
|
+
// the only copy. `--force` used to replace it silently — the remedy the duplicate-init error itself named (item 120).
|
|
47
|
+
let backup;
|
|
48
|
+
if (existing) {
|
|
49
|
+
if (a.newIdentity) {
|
|
50
|
+
if (!ctx.quiet) {
|
|
51
|
+
process.stdout.write([
|
|
52
|
+
c.warn('! this replaces the node identity ') + c.bold(existing.identity.address),
|
|
53
|
+
c.dim(' Every knowledge it published stays on the permanent record under an address nobody can sign for:'),
|
|
54
|
+
c.dim(' it can never be superseded, retired or challenged by you again, and any balance or pending payout is'),
|
|
55
|
+
c.dim(` orphaned. Back it up first: \`${PROG} keys backup <file>\`.`),
|
|
56
|
+
'',
|
|
57
|
+
].join('\n'));
|
|
58
|
+
}
|
|
59
|
+
const typed = await promptLine(`Type the current address to replace it (${existing.identity.address}): `);
|
|
60
|
+
if (typed.toLowerCase() !== existing.identity.address.toLowerCase()) {
|
|
61
|
+
throw new CliError(typed ? `that is not this node's address — nothing was changed` : 'no address typed — nothing was changed');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
backup = backupConfig(ctx.home);
|
|
65
|
+
}
|
|
66
|
+
const cfg = defaultConfig({
|
|
67
|
+
home: ctx.home, name: a.name, port: a.port, ledger: a.ledger, ainProviderUrl: a.ainProvider, ainChainId: a.ainChainId,
|
|
68
|
+
peers: a.peer, roles, runtimeRepo: a.runtimeRepo, runtimeApi: a.runtimeApi, privateKey: a.privateKey, publicUrl: a.publicUrl,
|
|
69
|
+
host: a.public ? '0.0.0.0' : a.host,
|
|
70
|
+
});
|
|
71
|
+
const kept = !!existing && !a.newIdentity && !a.privateKey;
|
|
72
|
+
if (kept) {
|
|
73
|
+
cfg.identity = existing.identity;
|
|
74
|
+
if (existing.operatorPasswordHash)
|
|
75
|
+
cfg.operatorPasswordHash = existing.operatorPasswordHash; // not part of defaultConfig
|
|
76
|
+
}
|
|
77
|
+
// Claim the node NOW rather than at its first HTTP call. Until a password exists, `POST /api/auth/setup` gives a
|
|
78
|
+
// full operator session to whoever asks; the node only accepts that from its own machine, but a node that is
|
|
79
|
+
// already claimed cannot be taken at all. Interactive terminals are asked; scripts pass --password / AINIZE_PASSWORD
|
|
80
|
+
// (or --no-password to start unclaimed on purpose, which is what `ainize login` then fixes). Item 121.
|
|
81
|
+
const wantPassword = a.password ?? process.env.AINIZE_PASSWORD;
|
|
82
|
+
let claimed = null;
|
|
83
|
+
if (!cfg.operatorPasswordHash && !a.noPassword) {
|
|
84
|
+
if (wantPassword) {
|
|
85
|
+
if (wantPassword.length < 4)
|
|
86
|
+
throw new CliError('the operator password must be at least 4 characters');
|
|
87
|
+
cfg.operatorPasswordHash = hashPassword(wantPassword);
|
|
88
|
+
claimed = 'given';
|
|
89
|
+
}
|
|
90
|
+
else if (process.stdin.isTTY && !ctx.json && !ctx.quiet) {
|
|
91
|
+
const pw = await promptPassword('Operator password for this node (empty = claim it later with `ainize login`): ');
|
|
92
|
+
if (pw) {
|
|
93
|
+
if (pw.length < 4)
|
|
94
|
+
throw new CliError('the operator password must be at least 4 characters');
|
|
95
|
+
const again = await promptPassword('Confirm password: ');
|
|
96
|
+
if (again !== pw)
|
|
97
|
+
throw new CliError('passwords do not match — nothing was written');
|
|
98
|
+
cfg.operatorPasswordHash = hashPassword(pw);
|
|
99
|
+
claimed = 'typed';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
saveConfig(cfg, ctx.home);
|
|
104
|
+
const publicBind = cfg.host === '0.0.0.0' || cfg.host === '::';
|
|
105
|
+
emit(ctx, { config: p, name: cfg.name, address: cfg.identity.address, port: cfg.port, host: cfg.host, ledger: cfg.ledger.kind, roles: cfg.roles, kept_identity: kept, backup: backup ?? null, claimed: !!cfg.operatorPasswordHash }, (d) => [
|
|
106
|
+
c.ok('✓ ') + `node initialised at ${d.config}`,
|
|
107
|
+
kv([['name', d.name], ['address', d.address], ['listens on', `${d.host}:${d.port}${publicBind ? c.warn(' (every interface)') : c.dim(' (this machine only)')}`], ['ledger', d.ledger], ['roles', d.roles.join(', ')],
|
|
108
|
+
['operator', d.claimed ? c.ok(claimed ? 'password set — this node is claimed' : 'password kept from the previous config') : c.warn(`not set — claim it with \`${PROG} login\` before anyone else can`)]]),
|
|
109
|
+
...(d.kept_identity ? [c.dim(`keeping this node's identity ${d.address} (pass --new-identity to replace it)`)] : []),
|
|
110
|
+
...(d.backup ? [c.dim(`previous config saved as ${d.backup}`)] : []),
|
|
111
|
+
...(existing ? [] : [
|
|
112
|
+
c.dim(`the private key lives in ${d.config} and this is the only copy — back it up now: \`${PROG} keys backup <file>\``),
|
|
113
|
+
]),
|
|
114
|
+
...(publicBind && !d.claimed ? [c.warn(`! this node will accept connections from every interface with no operator password: run \`${PROG} login\` before \`${PROG} start\`, or re-run init with --password`)] : []),
|
|
115
|
+
...(publicBind ? [c.dim(`bound to ${cfg.host}: anyone who can reach port ${cfg.port} reaches this node's API — put it behind a proxy or a firewall (\`${PROG} config set host 127.0.0.1\` keeps it local)`)] : []),
|
|
116
|
+
// Item 143: seeding writes the data directory, so it goes BEFORE the node that opens it — `seed` refuses once a
|
|
117
|
+
// node is running, and the old hint told operators to do it the other way round.
|
|
118
|
+
// Item 142: a node on the AIN ledger cannot announce, attest or settle until a chain is reachable, its app is
|
|
119
|
+
// registered and its identity holds AIN. `next: ainize start` was the only thing ever said about any of that.
|
|
120
|
+
'', ...(d.ledger === 'ain' ? [
|
|
121
|
+
c.dim('next, on the AIN ledger:'),
|
|
122
|
+
c.dim(` ${PROG} chain up the local 1-node chain in docker (skip it if ${cfg.ledger.ain?.providerUrl ?? 'the provider'} is a chain you already run)`),
|
|
123
|
+
c.dim(` ${PROG} chain setup registers /apps/knowledge + the market rules, and funds this identity on a local chain`),
|
|
124
|
+
c.dim(` ${PROG} start${d.claimed ? '' : ` && ${PROG} login`}`),
|
|
125
|
+
c.dim(` ${PROG} wallet this node pays for every announce, attest and settle from its own AIN balance — check it`),
|
|
126
|
+
] : [
|
|
127
|
+
c.dim(`next: \`${PROG} start\`${d.claimed ? '' : ` (then \`${PROG} login\`)`}`),
|
|
128
|
+
c.dim(` (demo knowledge: \`${PROG} seed\` first — it writes the data directory the node then opens)`),
|
|
129
|
+
]),
|
|
130
|
+
].join('\n'));
|
|
131
|
+
// A peer on the other ledger answers everything and serves an empty record set forever — say so now, not never (item 170).
|
|
132
|
+
for (const ep of cfg.peers)
|
|
133
|
+
await warnLedgerMismatch(ctx, ep, cfg.ledger.kind);
|
|
134
|
+
return cfg;
|
|
135
|
+
}
|
|
136
|
+
export function requireConfig(ctx) {
|
|
137
|
+
const cfg = ctx.cfg ?? loadConfig(ctx.home);
|
|
138
|
+
if (!cfg)
|
|
139
|
+
throw new CliError(`no node config at ${configPath(ctx.home)} — run \`${PROG} init\` first`);
|
|
140
|
+
return cfg;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Refuse a config the node could not boot on, naming every offending key — the same check `startNode` makes, made
|
|
144
|
+
* here first so `start -d` does not spawn a child only to read its refusal back out of node.log (item 123).
|
|
145
|
+
*/
|
|
146
|
+
export function assertUsableConfig(cfg, home) {
|
|
147
|
+
const invalid = validateConfig(cfg).filter((p) => p.kind === 'invalid');
|
|
148
|
+
if (invalid.length) {
|
|
149
|
+
throw new CliError(`this node's config is not usable:\n${invalid.map((p) => ` ${p.key} ${p.message}`).join('\n')}\n` +
|
|
150
|
+
`fix it with \`${PROG} config set <key> <value>\` (or \`${PROG} config unset <key>\` for the default) in ${configPath(home)}`);
|
|
151
|
+
}
|
|
152
|
+
return cfg;
|
|
153
|
+
}
|
|
154
|
+
function redact(cfg) {
|
|
155
|
+
const clone = JSON.parse(JSON.stringify(cfg));
|
|
156
|
+
const id = clone.identity;
|
|
157
|
+
if (id)
|
|
158
|
+
id.privateKey = `<hidden — \`${PROG} keys show --reveal\`>`;
|
|
159
|
+
if (clone.operatorPasswordHash)
|
|
160
|
+
clone.operatorPasswordHash = '<set>';
|
|
161
|
+
return clone;
|
|
162
|
+
}
|
|
163
|
+
// ------------------------------------------------------------------ teach-mode overrides (item 125)
|
|
164
|
+
/**
|
|
165
|
+
* Teach policy has TWO stores and config.json is the one that loses. The console's Teaching tab writes a
|
|
166
|
+
* `settings.teach` row into node.sqlite, and `market.teach()` lets every field of that row override the file —
|
|
167
|
+
* so `config set teach.enabled false`, a full restart and `config show` printed `"enabled": false` while the same
|
|
168
|
+
* running node went on accepting and publishing lessons. This table is the missing link between the two names:
|
|
169
|
+
* the dotted config key, the override field the store keeps, and the field `PATCH /api/me/teach/policy` takes.
|
|
170
|
+
*
|
|
171
|
+
* `teach.rowsPerJob` is deliberately absent: in config.json it is the {floor,ceiling,safetyFactor} block that shapes
|
|
172
|
+
* the measured derivation, while the store's `rowsPerJob` is a scalar that DISABLES it. Different settings, same word.
|
|
173
|
+
*/
|
|
174
|
+
export const TEACH_OVERRIDES = [
|
|
175
|
+
{ key: 'teach.enabled', setting: 'enabled', api: 'enabled' },
|
|
176
|
+
{ key: 'teach.publish', setting: 'publish', api: 'publish' },
|
|
177
|
+
{ key: 'teach.factsPerJob', setting: 'factsPerJob', api: 'facts_per_job' },
|
|
178
|
+
{ key: 'teach.jobsPerKeyPerDay', setting: 'jobsPerKeyPerDay', api: 'jobs_per_key_per_day' },
|
|
179
|
+
{ key: 'teach.jobsPerIpPerDay', setting: 'jobsPerIpPerDay', api: 'jobs_per_ip_per_day' },
|
|
180
|
+
{ key: 'teach.queueMax', setting: 'queueMax', api: 'queue_max' },
|
|
181
|
+
{ key: 'teach.contributorShare', setting: 'contributorShare', api: 'contributor_share' },
|
|
182
|
+
{ key: 'teach.draftTtlDays', setting: 'draftTtlDays', api: 'draft_ttl_days' },
|
|
183
|
+
{ key: 'teach.queuedRowsMax', setting: 'queuedRowsMax', api: 'queued_rows_max' },
|
|
184
|
+
{ key: 'teach.dataset.maxBytes', setting: 'datasetMaxBytes', api: 'dataset_max_bytes' },
|
|
185
|
+
{ key: 'teach.dataset.maxRows', setting: 'datasetMaxRows', api: 'dataset_max_rows' },
|
|
186
|
+
{ key: 'teach.dataset.rowsPerKeyPerDay', setting: 'rowsPerKeyPerDay', api: 'rows_per_key_per_day' },
|
|
187
|
+
{ key: 'teach.dataset.rowsPerIpPerDay', setting: 'rowsPerIpPerDay', api: 'rows_per_ip_per_day' },
|
|
188
|
+
{ key: 'teach.dataset.perKeyPerDay', setting: 'datasetsPerKeyPerDay', api: 'datasets_per_key_per_day' },
|
|
189
|
+
{ key: 'teach.dataset.ttlDays', setting: 'datasetTtlDays', api: 'dataset_ttl_days' },
|
|
190
|
+
{ key: 'teach.dataset.declarationRows', setting: 'declarationRows', api: 'declaration_rows' },
|
|
191
|
+
{ key: 'teach.check.callBudget', setting: 'checkCallBudget', api: 'check_call_budget' },
|
|
192
|
+
];
|
|
193
|
+
/** Overrides the console can set that config.json has no key for at all — still worth naming when they are on. */
|
|
194
|
+
const OVERRIDE_ONLY = [
|
|
195
|
+
{ setting: 'rowsPerJob', label: 'teach.rowsPerJob (a fixed rows-per-job override; disables the measured derivation)' },
|
|
196
|
+
{ setting: 'pausedReason', label: 'teach paused (reason shown to visitors)' },
|
|
197
|
+
{ setting: 'blockedTopics', label: 'teach blocked topics (regular expression)' },
|
|
198
|
+
];
|
|
199
|
+
/**
|
|
200
|
+
* What the RUNNING node is actually using, where it differs from config.json. Silent when no node answers or the
|
|
201
|
+
* terminal is not logged in — an override can only be read by the operator, and `config show` must still work offline.
|
|
202
|
+
*/
|
|
203
|
+
async function teachOverrides(ctx, cfg) {
|
|
204
|
+
if (!(await runningHere(ctx, cfg)))
|
|
205
|
+
return { overrides: [], checked: false };
|
|
206
|
+
const policy = await new NodeClient(ctx)
|
|
207
|
+
.get('/api/me/teach/policy', { timeoutMs: 4000 })
|
|
208
|
+
.catch(() => null);
|
|
209
|
+
if (!policy?.policy)
|
|
210
|
+
return { overrides: [], checked: false };
|
|
211
|
+
const at = (key) => key.split('.').reduce((o, k) => (o && typeof o === 'object' ? o[k] : undefined), cfg);
|
|
212
|
+
const out = [];
|
|
213
|
+
for (const m of TEACH_OVERRIDES) {
|
|
214
|
+
const v = policy.policy[m.setting];
|
|
215
|
+
if (v === undefined || v === null)
|
|
216
|
+
continue;
|
|
217
|
+
if (JSON.stringify(v) === JSON.stringify(at(m.key)))
|
|
218
|
+
continue;
|
|
219
|
+
out.push({ key: m.key, file: at(m.key), effective: v, source: 'console' });
|
|
220
|
+
}
|
|
221
|
+
for (const o of OVERRIDE_ONLY) {
|
|
222
|
+
const v = policy.policy[o.setting];
|
|
223
|
+
if (v === undefined || v === null)
|
|
224
|
+
continue;
|
|
225
|
+
out.push({ key: o.label, file: undefined, effective: v, source: 'console' });
|
|
226
|
+
}
|
|
227
|
+
return { overrides: out, checked: true };
|
|
228
|
+
}
|
|
229
|
+
/** Append `// overridden …` to the line of every overridden key in a `JSON.stringify(x, null, 2)` rendering. */
|
|
230
|
+
function annotate(json, notes) {
|
|
231
|
+
const stack = [];
|
|
232
|
+
return json.split('\n').map((line) => {
|
|
233
|
+
const m = /^(\s*)"([^"]+)":/.exec(line);
|
|
234
|
+
if (!m)
|
|
235
|
+
return line;
|
|
236
|
+
const depth = m[1].length / 2 - 1;
|
|
237
|
+
stack.length = Math.max(0, depth);
|
|
238
|
+
stack.push(m[2]);
|
|
239
|
+
const note = notes.get(stack.join('.'));
|
|
240
|
+
return note ? `${line} ${c.warn(note)}` : line;
|
|
241
|
+
}).join('\n');
|
|
242
|
+
}
|
|
243
|
+
export async function configShow(ctx) {
|
|
244
|
+
const cfg = requireConfig(ctx);
|
|
245
|
+
const { overrides, checked } = await teachOverrides(ctx, cfg);
|
|
246
|
+
const notes = new Map(overrides.filter((o) => o.file !== undefined).map((o) => [o.key, `// overridden to ${JSON.stringify(o.effective)} in the console (settings.teach) — this file's value is not in use`]));
|
|
247
|
+
const body = redact(cfg);
|
|
248
|
+
// The overrides go ABOVE the JSON, so the last thing on screen is still a config.json a script can read off the
|
|
249
|
+
// first `{` — and so the warning is not below the fold of a 200-line config.
|
|
250
|
+
emit(ctx, overrides.length ? { ...body, overrides } : body, () => [
|
|
251
|
+
c.dim(configPath(ctx.home)),
|
|
252
|
+
...(overrides.length ? [
|
|
253
|
+
c.warn(`! ${overrides.length} setting${overrides.length === 1 ? ' is' : 's are'} overridden in the console and outlive a restart — config.json below is not what the node uses:`),
|
|
254
|
+
...overrides.map((o) => ` ${o.key}: ${o.file === undefined ? c.dim('(not in config.json)') : JSON.stringify(o.file)} → ${c.bold(JSON.stringify(o.effective))}`),
|
|
255
|
+
c.dim(` \`${PROG} config set <key> <value>\` now writes both; \`${PROG} config unset <key>\` clears the console override.`),
|
|
256
|
+
'',
|
|
257
|
+
] : checked ? [c.dim('no console overrides — the running node is using exactly this file')] : []),
|
|
258
|
+
annotate(JSON.stringify(redact(cfg), null, 2), notes),
|
|
259
|
+
].join('\n'));
|
|
260
|
+
return cfg;
|
|
261
|
+
}
|
|
262
|
+
/** Walk a dotted path, without creating anything on the way (an unknown key is refused, not invented). */
|
|
263
|
+
function containerOf(cfg, key) {
|
|
264
|
+
const parts = key.split('.');
|
|
265
|
+
let cur = cfg;
|
|
266
|
+
for (const p of parts.slice(0, -1)) {
|
|
267
|
+
if (typeof cur[p] !== 'object' || cur[p] === null)
|
|
268
|
+
cur[p] = {};
|
|
269
|
+
cur = cur[p];
|
|
270
|
+
}
|
|
271
|
+
return { parent: cur, last: parts[parts.length - 1] };
|
|
272
|
+
}
|
|
273
|
+
/** The schema of a settable key, or a CliError naming the nearest real key / the group's children. */
|
|
274
|
+
function settableField(key) {
|
|
275
|
+
if (PROTECTED_CONFIG_KEYS.includes(key)) {
|
|
276
|
+
throw new CliError(key.startsWith('identity')
|
|
277
|
+
? `refusing to set ${key}: the identity is this node's only key pair — see \`${PROG} keys\``
|
|
278
|
+
: `refusing to set ${key}: the operator password is set by \`${PROG} login\``);
|
|
279
|
+
}
|
|
280
|
+
const field = configField(key);
|
|
281
|
+
if (!field) {
|
|
282
|
+
const near = nearestConfigKey(key);
|
|
283
|
+
throw new CliError(`unknown config key '${key}'${near ? ` — did you mean '${near}'?` : `; \`${PROG} config show\` lists every key this node has`}`);
|
|
284
|
+
}
|
|
285
|
+
if (field.def.type === 'object') {
|
|
286
|
+
const children = configKeys().filter((k) => k.startsWith(`${key}.`) && !k.slice(key.length + 1).includes('.'));
|
|
287
|
+
throw new CliError(`${key} is a group of keys, not a value — set one of: ${children.join(', ')}`);
|
|
288
|
+
}
|
|
289
|
+
return field;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Is a node running for this home? The pid file covers `start -d`; the port probe covers a node started in the
|
|
293
|
+
* foreground or by a supervisor (the demo cluster writes no pid file). Either way the edit below only takes
|
|
294
|
+
* effect at the next start, and the operator has to be told so (item 124).
|
|
295
|
+
*/
|
|
296
|
+
async function runningHere(ctx, cfg) {
|
|
297
|
+
const url = `http://localhost:${cfg.port}`;
|
|
298
|
+
const pid = runningPid(ctx.home);
|
|
299
|
+
if (pid)
|
|
300
|
+
return { pid, url };
|
|
301
|
+
const d = await new NodeClient({ ...ctx, nodeUrl: url, token: null })
|
|
302
|
+
.get('/api/info', { auth: false, timeoutMs: 1500 }).catch(() => null);
|
|
303
|
+
return d && d.node.address.toLowerCase() === cfg.identity.address.toLowerCase() ? { pid: null, url } : null;
|
|
304
|
+
}
|
|
305
|
+
export async function configSet(ctx, key, value) {
|
|
306
|
+
const cfg = requireConfig(ctx);
|
|
307
|
+
const field = settableField(key);
|
|
308
|
+
const parsed = coerceConfigValue(field, value);
|
|
309
|
+
const check = field.safeParse(parsed);
|
|
310
|
+
if (!check.success) {
|
|
311
|
+
// the schema's own wording when it has one ("must be a fraction between 0 and 1"), else the field's type
|
|
312
|
+
const why = check.error.issues.map((i) => i.message).find((m) => /^must /.test(m)) ?? `must be ${configFieldType(field)}`;
|
|
313
|
+
throw new CliError(`${key} ${why} — got ${JSON.stringify(value)}`);
|
|
314
|
+
}
|
|
315
|
+
const { parent, last } = containerOf(cfg, key);
|
|
316
|
+
parent[last] = check.data;
|
|
317
|
+
const running = await runningHere(ctx, cfg);
|
|
318
|
+
saveConfig(cfg, ctx.home);
|
|
319
|
+
ok(ctx, `${key} = ${JSON.stringify(check.data)} ${c.dim('(the node reads config.json when it starts)')}`);
|
|
320
|
+
// A teach key set here used to lose to the console's `settings.teach` row for good: config.json said `false`,
|
|
321
|
+
// the running node said `true`, a restart changed nothing and `config show` never mentioned the override (item 125).
|
|
322
|
+
// Write BOTH when a node is up, so the terminal switch actually is the switch.
|
|
323
|
+
const mapped = TEACH_OVERRIDES.find((m) => m.key === key);
|
|
324
|
+
if (running && mapped) {
|
|
325
|
+
const wrote = await writeTeachOverride(ctx, mapped.api, check.data);
|
|
326
|
+
if (wrote === 'ok') {
|
|
327
|
+
ok(ctx, `applied to the running node as well ${c.dim('(the console override for this setting now matches — no restart needed)')}`);
|
|
328
|
+
return cfg;
|
|
329
|
+
}
|
|
330
|
+
const effective = await new NodeClient({ ...ctx, token: null }).get('/api/teach/policy', { auth: false, timeoutMs: 3000 }).catch(() => null);
|
|
331
|
+
const live = effective?.[mapped.setting === 'enabled' ? 'enabled' : mapped.setting];
|
|
332
|
+
if (live !== undefined && JSON.stringify(live) !== JSON.stringify(check.data)) {
|
|
333
|
+
warn(ctx, `the running node still answers ${mapped.setting} = ${JSON.stringify(live)}: that value is a console override in node.sqlite, and it outlives a restart.\n` +
|
|
334
|
+
` ${wrote === 'unauthorised' ? `sign in and run this again to write both (\`${PROG} login\`)` : `clear it in the console's Teaching tab, or run \`${PROG} config unset ${key}\` while signed in`}`);
|
|
335
|
+
return cfg;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (running) {
|
|
339
|
+
warn(ctx, `the node in ${ctx.home} is running${running.pid ? ` (pid ${running.pid})` : ` on ${running.url}`} and keeps using the value it started with` +
|
|
340
|
+
` — restart it to apply this (\`${PROG} stop\` then \`${PROG} start -d\`)`);
|
|
341
|
+
}
|
|
342
|
+
return cfg;
|
|
343
|
+
}
|
|
344
|
+
/** PATCH one teach field on the running node. 'unauthorised' when this terminal is not signed in. */
|
|
345
|
+
async function writeTeachOverride(ctx, apiField, value) {
|
|
346
|
+
if (!ctx.token)
|
|
347
|
+
return 'unauthorised';
|
|
348
|
+
try {
|
|
349
|
+
await new NodeClient(ctx).patch('/api/me/teach/policy', { [apiField]: value }, { timeoutMs: 5000 });
|
|
350
|
+
return 'ok';
|
|
351
|
+
}
|
|
352
|
+
catch (e) {
|
|
353
|
+
return e.exitCode === 3 ? 'unauthorised' : 'failed';
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
/** One key's current value — the half of `config show` an operator actually asked for. */
|
|
357
|
+
export async function configGet(ctx, key) {
|
|
358
|
+
const cfg = requireConfig(ctx);
|
|
359
|
+
if (!configField(key)) {
|
|
360
|
+
const near = nearestConfigKey(key);
|
|
361
|
+
throw new CliError(`unknown config key '${key}'${near ? ` — did you mean '${near}'?` : `; \`${PROG} config show\` lists every key this node has`}`);
|
|
362
|
+
}
|
|
363
|
+
const value = key.split('.').reduce((o, k) => (o && typeof o === 'object' ? o[k] : undefined), redact(cfg));
|
|
364
|
+
// Asking for one teach key and being told the value the node is NOT using is exactly the trap of item 125.
|
|
365
|
+
const override = TEACH_OVERRIDES.some((m) => m.key === key) ? (await teachOverrides(ctx, cfg)).overrides.find((o) => o.key === key) : undefined;
|
|
366
|
+
if (value === undefined && !override) {
|
|
367
|
+
info(ctx, c.dim(`${key} is not set in ${configPath(ctx.home)} (the node uses its built-in default)`));
|
|
368
|
+
return undefined;
|
|
369
|
+
}
|
|
370
|
+
emit(ctx, override ? { value, effective: override.effective, overridden_by: 'console' } : value, () => [
|
|
371
|
+
typeof value === 'object' && value !== null ? JSON.stringify(value, null, 2) : String(value),
|
|
372
|
+
...(override ? [c.warn(`! the running node uses ${JSON.stringify(override.effective)}: a console override (settings.teach) wins over this file, and survives a restart.`),
|
|
373
|
+
c.dim(` \`${PROG} config set ${key} <value>\` writes both; \`${PROG} config unset ${key}\` clears the override.`)] : []),
|
|
374
|
+
].join('\n'));
|
|
375
|
+
return value;
|
|
376
|
+
}
|
|
377
|
+
/** Remove a key so the node falls back to its default; a key the config cannot do without is reset, not deleted. */
|
|
378
|
+
export async function configUnset(ctx, key) {
|
|
379
|
+
const cfg = requireConfig(ctx);
|
|
380
|
+
settableField(key);
|
|
381
|
+
const { parent, last } = containerOf(cfg, key);
|
|
382
|
+
if (!(last in parent))
|
|
383
|
+
throw new CliError(`${key} is not set in ${configPath(ctx.home)}`);
|
|
384
|
+
const had = parent[last];
|
|
385
|
+
delete parent[last];
|
|
386
|
+
// deleting a required key would leave a config the node refuses to boot on — put the built-in default back instead
|
|
387
|
+
const required = validateConfig(cfg).some((p) => p.key === key && p.kind === 'invalid');
|
|
388
|
+
let restored;
|
|
389
|
+
if (required) {
|
|
390
|
+
const fresh = defaultConfig({ home: ctx.home, privateKey: cfg.identity.privateKey });
|
|
391
|
+
restored = key.split('.').reduce((o, k) => (o && typeof o === 'object' ? o[k] : undefined), fresh);
|
|
392
|
+
parent[last] = restored;
|
|
393
|
+
}
|
|
394
|
+
saveConfig(cfg, ctx.home);
|
|
395
|
+
ok(ctx, required
|
|
396
|
+
? `${key} reset to the default ${JSON.stringify(restored)} ${c.dim(`(was ${JSON.stringify(had)}; it cannot be absent)`)}`
|
|
397
|
+
: `${key} unset ${c.dim(`(was ${JSON.stringify(had)} — the node falls back to its built-in default)`)}`);
|
|
398
|
+
// Unsetting a teach key must also clear the console override, or the node keeps the value the file no longer has (item 125).
|
|
399
|
+
const mapped = TEACH_OVERRIDES.find((m) => m.key === key);
|
|
400
|
+
if (mapped && (await runningHere(ctx, cfg))) {
|
|
401
|
+
const wrote = await writeTeachOverride(ctx, mapped.api, null);
|
|
402
|
+
if (wrote === 'ok')
|
|
403
|
+
ok(ctx, `the console override for ${key} was cleared too ${c.dim('(the running node is back on config.json / its built-in default)')}`);
|
|
404
|
+
else
|
|
405
|
+
warn(ctx, `could not clear the console override for ${key}${wrote === 'unauthorised' ? ` — sign in (\`${PROG} login\`) and run this again` : ''}: until it is cleared the running node keeps using it, and a restart will not help`);
|
|
406
|
+
}
|
|
407
|
+
return cfg;
|
|
408
|
+
}
|
|
409
|
+
export async function keysShow(ctx, reveal = false, yes = false) {
|
|
410
|
+
const cfg = requireConfig(ctx);
|
|
411
|
+
const out = { address: cfg.identity.address, publicKey: cfg.identity.publicKey };
|
|
412
|
+
if (reveal) {
|
|
413
|
+
// printing the key puts it in scrollback, in shell history and in any terminal recording (item 122)
|
|
414
|
+
if (!yes && !ctx.json && !ctx.quiet) {
|
|
415
|
+
warn(ctx, 'this prints the node\'s private key on the screen: it will be in your scrollback and in anything recording this terminal.');
|
|
416
|
+
const typed = await promptLine('Type "show" to print it (anything else cancels): ');
|
|
417
|
+
if (typed.toLowerCase() !== 'show')
|
|
418
|
+
throw new CliError('cancelled — nothing was printed');
|
|
419
|
+
}
|
|
420
|
+
out.privateKey = cfg.identity.privateKey;
|
|
421
|
+
}
|
|
422
|
+
emit(ctx, out, (d) => kv([['address', d.address], ['public key', d.publicKey], ...(d.privateKey ? [['private key', c.err(d.privateKey)]] : [])]) +
|
|
423
|
+
(reveal ? `\n${c.dim(`this is the only copy unless you made one: \`${PROG} keys backup <file>\``)}`
|
|
424
|
+
: `\n${c.dim(`add --reveal to print the private key, or \`${PROG} keys backup <file>\` to save it`)}`));
|
|
425
|
+
return out;
|
|
426
|
+
}
|
|
427
|
+
const keyFrom = (pass, salt, n) => scryptSync(pass, salt, 32, { N: n, r: 8, p: 1, maxmem: 128 * 1024 * 1024 });
|
|
428
|
+
export function encryptKey(privateKey, passphrase) {
|
|
429
|
+
const n = 16384;
|
|
430
|
+
const salt = randomBytes(16);
|
|
431
|
+
const iv = randomBytes(12);
|
|
432
|
+
const cipher = createCipheriv('aes-256-gcm', keyFrom(passphrase, salt, n), iv);
|
|
433
|
+
const ciphertext = Buffer.concat([cipher.update(privateKey, 'utf8'), cipher.final()]);
|
|
434
|
+
return { alg: 'aes-256-gcm', kdf: 'scrypt', n, salt: salt.toString('hex'), iv: iv.toString('hex'), tag: cipher.getAuthTag().toString('hex'), ciphertext: ciphertext.toString('hex') };
|
|
435
|
+
}
|
|
436
|
+
export function decryptKey(cipher, passphrase) {
|
|
437
|
+
const d = createDecipheriv('aes-256-gcm', keyFrom(passphrase, Buffer.from(cipher.salt, 'hex'), cipher.n), Buffer.from(cipher.iv, 'hex'));
|
|
438
|
+
d.setAuthTag(Buffer.from(cipher.tag, 'hex'));
|
|
439
|
+
try {
|
|
440
|
+
return Buffer.concat([d.update(Buffer.from(cipher.ciphertext, 'hex')), d.final()]).toString('utf8');
|
|
441
|
+
}
|
|
442
|
+
catch {
|
|
443
|
+
throw new CliError('wrong passphrase for this backup');
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
const passphraseOf = async (ctx, given, question) => {
|
|
447
|
+
const p = given ?? process.env.AINIZE_KEY_PASSPHRASE;
|
|
448
|
+
if (p !== undefined)
|
|
449
|
+
return p;
|
|
450
|
+
if (!process.stdin.isTTY || ctx.quiet || ctx.json)
|
|
451
|
+
return '';
|
|
452
|
+
return promptPassword(question);
|
|
453
|
+
};
|
|
454
|
+
/** Write the node's key to a file: encrypted when there is a passphrase, always mode 0600. */
|
|
455
|
+
export async function keysBackup(ctx, file, a = {}) {
|
|
456
|
+
const cfg = requireConfig(ctx);
|
|
457
|
+
if (existsSync(file) && !a.force)
|
|
458
|
+
throw new CliError(`${file} already exists — pick another name (or pass --force to overwrite it)`);
|
|
459
|
+
const pass = await passphraseOf(ctx, a.passphrase, 'Passphrase to encrypt the backup (empty = store the key in the clear): ');
|
|
460
|
+
const backup = {
|
|
461
|
+
kind: 'ainize-node-key', version: 1, address: cfg.identity.address, publicKey: cfg.identity.publicKey, node: cfg.name,
|
|
462
|
+
created_at: new Date().toISOString(),
|
|
463
|
+
...(pass ? { cipher: encryptKey(cfg.identity.privateKey, pass) } : { privateKey: cfg.identity.privateKey }),
|
|
464
|
+
};
|
|
465
|
+
writeFileSync(file, JSON.stringify(backup, null, 2) + '\n', { mode: 0o600 });
|
|
466
|
+
emit(ctx, backup, () => [
|
|
467
|
+
c.ok('✓ ') + `node key of ${cfg.name} (${cfg.identity.address}) written to ${file}`,
|
|
468
|
+
pass ? c.dim(' encrypted (scrypt + aes-256-gcm) — without the passphrase this file is useless, including to you')
|
|
469
|
+
: c.warn(' the key is in the CLEAR in this file — store it somewhere only you can read (a passphrase encrypts it: --passphrase)'),
|
|
470
|
+
c.dim(` restore it on another machine with \`${PROG} keys import ${file}\``),
|
|
471
|
+
].join('\n'));
|
|
472
|
+
return backup;
|
|
473
|
+
}
|
|
474
|
+
/** Read a backup file (either shape) and return the private key it holds. */
|
|
475
|
+
export async function readKeyBackup(ctx, file, passphrase) {
|
|
476
|
+
if (!existsSync(file))
|
|
477
|
+
throw new CliError(`no such file: ${file}`);
|
|
478
|
+
let backup;
|
|
479
|
+
try {
|
|
480
|
+
backup = JSON.parse(readFileSync(file, 'utf8'));
|
|
481
|
+
}
|
|
482
|
+
catch {
|
|
483
|
+
throw new CliError(`${file} is not a key backup (expected the JSON \`${PROG} keys backup\` writes)`);
|
|
484
|
+
}
|
|
485
|
+
if (backup.privateKey)
|
|
486
|
+
return { privateKey: backup.privateKey.replace(/^0x/, ''), backup };
|
|
487
|
+
if (!backup.cipher)
|
|
488
|
+
throw new CliError(`${file} carries no key (neither \`privateKey\` nor \`cipher\`)`);
|
|
489
|
+
const pass = await passphraseOf(ctx, passphrase, `Passphrase for ${file}: `);
|
|
490
|
+
if (!pass)
|
|
491
|
+
throw new CliError('this backup is encrypted — pass --passphrase (or set AINIZE_KEY_PASSPHRASE)');
|
|
492
|
+
return { privateKey: decryptKey(backup.cipher, pass), backup };
|
|
493
|
+
}
|
|
494
|
+
/** Replace this home's identity, after a typed confirmation and a copy of the old config. */
|
|
495
|
+
async function replaceIdentity(ctx, cfg, next, what) {
|
|
496
|
+
if (next.address.toLowerCase() === cfg.identity.address.toLowerCase())
|
|
497
|
+
throw new CliError(`${next.address} is already this node's identity — nothing to do`);
|
|
498
|
+
if (!ctx.quiet) {
|
|
499
|
+
process.stdout.write([
|
|
500
|
+
c.warn(`! ${what} replaces the node identity `) + c.bold(cfg.identity.address),
|
|
501
|
+
c.dim(' Every knowledge it published stays on the permanent record under an address nobody can sign for, and any'),
|
|
502
|
+
c.dim(` balance or pending payout is orphaned. Back it up first: \`${PROG} keys backup <file>\`.`),
|
|
503
|
+
'',
|
|
504
|
+
].join('\n'));
|
|
505
|
+
}
|
|
506
|
+
const typed = await promptLine(`Type the current address to replace it (${cfg.identity.address}): `);
|
|
507
|
+
if (typed.toLowerCase() !== cfg.identity.address.toLowerCase()) {
|
|
508
|
+
throw new CliError(typed ? 'that is not this node\'s address — nothing was changed' : 'no address typed — nothing was changed');
|
|
509
|
+
}
|
|
510
|
+
const backup = backupConfig(ctx.home);
|
|
511
|
+
cfg.identity = next;
|
|
512
|
+
saveConfig(cfg, ctx.home);
|
|
513
|
+
return { backup, address: next.address };
|
|
514
|
+
}
|
|
515
|
+
/** Install a backed-up key as this node's identity (the way back after a wiped disk). */
|
|
516
|
+
export async function keysImport(ctx, file, a = {}) {
|
|
517
|
+
const cfg = requireConfig(ctx);
|
|
518
|
+
const { privateKey } = await readKeyBackup(ctx, file, a.passphrase);
|
|
519
|
+
let next;
|
|
520
|
+
try {
|
|
521
|
+
next = identityFromPrivateKey(privateKey);
|
|
522
|
+
}
|
|
523
|
+
catch {
|
|
524
|
+
throw new CliError(`${file} does not hold a valid private key`);
|
|
525
|
+
}
|
|
526
|
+
const r = await replaceIdentity(ctx, cfg, next, 'importing a key');
|
|
527
|
+
ok(ctx, `this node is now ${r.address} ${c.dim(`(previous config saved as ${r.backup}; restart the node to apply)`)}`);
|
|
528
|
+
return { address: r.address };
|
|
529
|
+
}
|
|
530
|
+
/** Mint a new identity for this node, keeping every other setting. */
|
|
531
|
+
export async function keysRotate(ctx) {
|
|
532
|
+
const cfg = requireConfig(ctx);
|
|
533
|
+
const previous = cfg.identity.address;
|
|
534
|
+
const r = await replaceIdentity(ctx, cfg, createIdentity(), 'rotating the key');
|
|
535
|
+
ok(ctx, `new identity ${r.address} ${c.dim(`(was ${previous}; previous config saved as ${r.backup}; restart the node to apply)`)}`);
|
|
536
|
+
return { address: r.address, previous };
|
|
537
|
+
}
|
|
538
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3F,OAAO,EACL,qBAAqB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,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C;IACpE,IAAI,IAA4B,CAAC;IACjC,IAAI,CAAC;QAAC,IAAI,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,MAAM,IAAI,QAAQ,CAAC,GAAG,IAAI,oCAAoC,CAAC,CAAC;IAAC,CAAC;IAC7H,MAAM,CAAC,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACnE,EAAE,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,MAAM,8BAA8B,CAAC,EAAE,CAAC,CAAC;IACvH,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AAChC,CAAC;AAED,sEAAsE;AACtE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAe;IAC9C,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC;IACtC,MAAM,CAAC,GAAG,MAAM,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,kBAAkB,CAAC,CAAC;IAChF,EAAE,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,QAAQ,8BAA8B,CAAC,CAAC,MAAM,8BAA8B,CAAC,EAAE,CAAC,CAAC;IACpI,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { LedgerRecord, RecordKind } from '@ainize/core';
|
|
2
|
+
import type { CliContext } from '../context.js';
|
|
3
|
+
export interface LedgerInfo {
|
|
4
|
+
kind: string;
|
|
5
|
+
network: string;
|
|
6
|
+
records: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
head?: string;
|
|
9
|
+
provider?: string;
|
|
10
|
+
app?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function ledgerLs(ctx: CliContext, a?: {
|
|
13
|
+
kind?: RecordKind;
|
|
14
|
+
limit?: number;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
info: LedgerInfo;
|
|
17
|
+
records: LedgerRecord[];
|
|
18
|
+
}>;
|
|
19
|
+
export declare function ledgerVerify(ctx: CliContext): Promise<{
|
|
20
|
+
valid: boolean;
|
|
21
|
+
checked: number;
|
|
22
|
+
errors: string[];
|
|
23
|
+
}>;
|
|
24
|
+
export interface GraphResponse {
|
|
25
|
+
nodes: {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
author: string;
|
|
29
|
+
status: string;
|
|
30
|
+
model: string;
|
|
31
|
+
schema: string;
|
|
32
|
+
branch?: string;
|
|
33
|
+
}[];
|
|
34
|
+
edges: {
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
type: string;
|
|
38
|
+
}[];
|
|
39
|
+
chain: unknown;
|
|
40
|
+
}
|
|
41
|
+
export declare function ledgerGraph(ctx: CliContext): Promise<GraphResponse>;
|
|
42
|
+
export declare function ledgerExport(ctx: CliContext, file: string): Promise<number>;
|
|
43
|
+
//# sourceMappingURL=ledger.d.ts.map
|