@ainize/core 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 +20 -0
- package/dist/ain-ledger.d.ts +191 -0
- package/dist/ain-ledger.d.ts.map +1 -0
- package/dist/ain-ledger.js +714 -0
- package/dist/ain-ledger.js.map +1 -0
- package/dist/browser.d.ts +15 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +16 -0
- package/dist/browser.js.map +1 -0
- package/dist/bytes.d.ts +3 -0
- package/dist/bytes.d.ts.map +1 -0
- package/dist/bytes.js +14 -0
- package/dist/bytes.js.map +1 -0
- package/dist/canonical.d.ts +5 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +70 -0
- package/dist/canonical.js.map +1 -0
- package/dist/catalog.d.ts +181 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +496 -0
- package/dist/catalog.js.map +1 -0
- package/dist/config-schema.d.ts +222 -0
- package/dist/config-schema.d.ts.map +1 -0
- package/dist/config-schema.js +302 -0
- package/dist/config-schema.js.map +1 -0
- package/dist/config.d.ts +128 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +330 -0
- package/dist/config.js.map +1 -0
- package/dist/events.d.ts +14 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +20 -0
- package/dist/events.js.map +1 -0
- package/dist/identity.d.ts +15 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +59 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/ledger.d.ts +134 -0
- package/dist/ledger.d.ts.map +1 -0
- package/dist/ledger.js +2 -0
- package/dist/ledger.js.map +1 -0
- package/dist/lineage.d.ts +63 -0
- package/dist/lineage.d.ts.map +1 -0
- package/dist/lineage.js +156 -0
- package/dist/lineage.js.map +1 -0
- package/dist/local-ledger.d.ts +74 -0
- package/dist/local-ledger.d.ts.map +1 -0
- package/dist/local-ledger.js +229 -0
- package/dist/local-ledger.js.map +1 -0
- package/dist/npz.d.ts +107 -0
- package/dist/npz.d.ts.map +1 -0
- package/dist/npz.js +502 -0
- package/dist/npz.js.map +1 -0
- package/dist/ops.d.ts +65 -0
- package/dist/ops.d.ts.map +1 -0
- package/dist/ops.js +9 -0
- package/dist/ops.js.map +1 -0
- package/dist/teach-auth.d.ts +19 -0
- package/dist/teach-auth.d.ts.map +1 -0
- package/dist/teach-auth.js +33 -0
- package/dist/teach-auth.js.map +1 -0
- package/dist/types.d.ts +1096 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +98 -0
- package/dist/types.js.map +1 -0
- package/dist/x402.d.ts +35 -0
- package/dist/x402.d.ts.map +1 -0
- package/dist/x402.js +84 -0
- package/dist/x402.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of config.json, as a schema the CLI and the node can both check against (review-2 item 123).
|
|
3
|
+
*
|
|
4
|
+
* `ainize config set` used to accept any dotted path and any value with a green tick — `port notanumber`,
|
|
5
|
+
* `verifier.stak 5`, `roles admin`, `market.royaltyShare 47` — and the node then booted on whatever was written.
|
|
6
|
+
* This file is the single description of what a config key is, what type it holds and what range it may take:
|
|
7
|
+
* • `configField(path)` — the schema of one dotted key, or null when the key does not exist
|
|
8
|
+
* • `nearestConfigKey()` — "did you mean …?" for a typo
|
|
9
|
+
* • `coerceConfigValue()` — turn one command-line string into the type the key actually wants
|
|
10
|
+
* • `validateConfig()` — every problem in a whole config.json, for `config set` and for start-up
|
|
11
|
+
*
|
|
12
|
+
* Unknown keys are reported, never silently dropped: a config written by a newer build must still boot on an
|
|
13
|
+
* older one, so start-up treats an unknown key as a warning and a wrong *value* as a refusal.
|
|
14
|
+
*/
|
|
15
|
+
import { z, type ZodType } from 'zod';
|
|
16
|
+
export declare const ROLES: readonly ["seller", "verifier", "serving", "gateway"];
|
|
17
|
+
export declare const nodeConfigSchema: z.ZodObject<{
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
dataDir: z.ZodString;
|
|
20
|
+
port: z.ZodNumber;
|
|
21
|
+
host: z.ZodString;
|
|
22
|
+
publicUrl: z.ZodOptional<z.ZodString>;
|
|
23
|
+
roles: z.ZodArray<z.ZodEnum<{
|
|
24
|
+
seller: "seller";
|
|
25
|
+
verifier: "verifier";
|
|
26
|
+
serving: "serving";
|
|
27
|
+
gateway: "gateway";
|
|
28
|
+
}>>;
|
|
29
|
+
peers: z.ZodArray<z.ZodString>;
|
|
30
|
+
ledger: z.ZodObject<{
|
|
31
|
+
kind: z.ZodEnum<{
|
|
32
|
+
local: "local";
|
|
33
|
+
ain: "ain";
|
|
34
|
+
}>;
|
|
35
|
+
ain: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
providerUrl: z.ZodString;
|
|
37
|
+
eventHandlerUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
38
|
+
chainId: z.ZodNumber;
|
|
39
|
+
appName: z.ZodString;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
identity: z.ZodObject<{
|
|
43
|
+
privateKey: z.ZodString;
|
|
44
|
+
address: z.ZodString;
|
|
45
|
+
publicKey: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
operatorPasswordHash: z.ZodOptional<z.ZodString>;
|
|
48
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
50
|
+
api: z.ZodOptional<z.ZodString>;
|
|
51
|
+
hookApi: z.ZodOptional<z.ZodString>;
|
|
52
|
+
python: z.ZodOptional<z.ZodString>;
|
|
53
|
+
patchDir: z.ZodOptional<z.ZodString>;
|
|
54
|
+
gpus: z.ZodOptional<z.ZodString>;
|
|
55
|
+
sampling: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
verifier: z.ZodOptional<z.ZodObject<{
|
|
58
|
+
quorum: z.ZodNumber;
|
|
59
|
+
stake: z.ZodOptional<z.ZodString>;
|
|
60
|
+
allowSelfAttest: z.ZodBoolean;
|
|
61
|
+
intervalMs: z.ZodNumber;
|
|
62
|
+
auto: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
minBalance: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
includeTest: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
minPrice: z.ZodOptional<z.ZodString>;
|
|
66
|
+
maxPerHour: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
maxModelMinutesPerHour: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
window: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
69
|
+
from: z.ZodString;
|
|
70
|
+
to: z.ZodString;
|
|
71
|
+
}, z.core.$strip>>>;
|
|
72
|
+
retainBodies: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
market: z.ZodObject<{
|
|
75
|
+
currency: z.ZodEnum<{
|
|
76
|
+
AIN: "AIN";
|
|
77
|
+
CREDIT: "CREDIT";
|
|
78
|
+
}>;
|
|
79
|
+
defaultPrice: z.ZodString;
|
|
80
|
+
royaltyShare: z.ZodNumber;
|
|
81
|
+
verifierShare: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
initialCredit: z.ZodString;
|
|
83
|
+
creditGrants: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
p2p: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
acceptExchange: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
maxPeers: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
evictAfterFailures: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
staleDays: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
server: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
trustProxy: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
93
|
+
}, z.core.$strip>>;
|
|
94
|
+
events: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
retentionDays: z.ZodNumber;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
teach: z.ZodOptional<z.ZodObject<{
|
|
98
|
+
enabled: z.ZodBoolean;
|
|
99
|
+
publish: z.ZodEnum<{
|
|
100
|
+
review: "review";
|
|
101
|
+
auto: "auto";
|
|
102
|
+
never: "never";
|
|
103
|
+
}>;
|
|
104
|
+
factsPerJob: z.ZodNumber;
|
|
105
|
+
jobsPerKeyPerDay: z.ZodNumber;
|
|
106
|
+
jobsPerIpPerDay: z.ZodNumber;
|
|
107
|
+
queueMax: z.ZodNumber;
|
|
108
|
+
contributorShare: z.ZodNumber;
|
|
109
|
+
draftTtlDays: z.ZodNumber;
|
|
110
|
+
backend: z.ZodEnum<{
|
|
111
|
+
gradient: "gradient";
|
|
112
|
+
stub: "stub";
|
|
113
|
+
}>;
|
|
114
|
+
stubOffline: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
trainer: z.ZodObject<{
|
|
116
|
+
container: z.ZodString;
|
|
117
|
+
script: z.ZodString;
|
|
118
|
+
gpus: z.ZodString;
|
|
119
|
+
maxSteps: z.ZodNumber;
|
|
120
|
+
timeoutMs: z.ZodNumber;
|
|
121
|
+
minFreeGpuMb: z.ZodNumber;
|
|
122
|
+
idleStopMin: z.ZodNumber;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
locality: z.ZodObject<{
|
|
125
|
+
prompts: z.ZodArray<z.ZodString>;
|
|
126
|
+
minSame: z.ZodNumber;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
dataset: z.ZodObject<{
|
|
129
|
+
maxBytes: z.ZodNumber;
|
|
130
|
+
maxSourceLines: z.ZodNumber;
|
|
131
|
+
maxRows: z.ZodNumber;
|
|
132
|
+
perKeyPerDay: z.ZodNumber;
|
|
133
|
+
keptPerKey: z.ZodNumber;
|
|
134
|
+
rowsPerKeyPerDay: z.ZodNumber;
|
|
135
|
+
rowsPerIpPerDay: z.ZodNumber;
|
|
136
|
+
bytesPerKeyPerDay: z.ZodNumber;
|
|
137
|
+
ttlDays: z.ZodNumber;
|
|
138
|
+
stagedTtlHours: z.ZodNumber;
|
|
139
|
+
createsPerIpPerMin: z.ZodNumber;
|
|
140
|
+
declarationRows: z.ZodNumber;
|
|
141
|
+
}, z.core.$strip>;
|
|
142
|
+
rowsPerJob: z.ZodObject<{
|
|
143
|
+
floorGradient: z.ZodNumber;
|
|
144
|
+
floorStub: z.ZodNumber;
|
|
145
|
+
ceiling: z.ZodNumber;
|
|
146
|
+
safetyFactor: z.ZodNumber;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
effort: z.ZodObject<{
|
|
149
|
+
quick: z.ZodObject<{
|
|
150
|
+
maxSteps: z.ZodNumber;
|
|
151
|
+
evalEvery: z.ZodNumber;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
balanced: z.ZodObject<{
|
|
154
|
+
maxSteps: z.ZodNumber;
|
|
155
|
+
evalEvery: z.ZodNumber;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
thorough: z.ZodObject<{
|
|
158
|
+
maxSteps: z.ZodNumber;
|
|
159
|
+
evalEvery: z.ZodNumber;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
lr: z.ZodNumber;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
check: z.ZodObject<{
|
|
164
|
+
callBudget: z.ZodNumber;
|
|
165
|
+
sampleRows: z.ZodNumber;
|
|
166
|
+
chatFormRows: z.ZodNumber;
|
|
167
|
+
parentSamplesMax: z.ZodNumber;
|
|
168
|
+
lockTargetMs: z.ZodNumber;
|
|
169
|
+
lockAbortMs: z.ZodNumber;
|
|
170
|
+
lockGraceMs: z.ZodOptional<z.ZodNumber>;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
preflight: z.ZodObject<{
|
|
173
|
+
sampleRows: z.ZodNumber;
|
|
174
|
+
perCall: z.ZodNumber;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
queuedRowsMax: z.ZodNumber;
|
|
177
|
+
checkStubLessons: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
trustedKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
179
|
+
lineage: z.ZodOptional<z.ZodBoolean>;
|
|
180
|
+
}, z.core.$strip>>;
|
|
181
|
+
gossipIntervalMs: z.ZodNumber;
|
|
182
|
+
version: z.ZodString;
|
|
183
|
+
includeTestAnchors: z.ZodOptional<z.ZodBoolean>;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
/** Keys `config set` refuses to touch: the identity is the node's only key pair, the hash is set by `login`. */
|
|
186
|
+
export declare const PROTECTED_CONFIG_KEYS: string[];
|
|
187
|
+
type AnyZod = ZodType & {
|
|
188
|
+
def: {
|
|
189
|
+
type: string;
|
|
190
|
+
innerType?: AnyZod;
|
|
191
|
+
shape?: Record<string, AnyZod>;
|
|
192
|
+
element?: AnyZod;
|
|
193
|
+
entries?: Record<string, string>;
|
|
194
|
+
options?: AnyZod[];
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
/** The schema of one dotted config key, or null when no such key exists. */
|
|
198
|
+
export declare function configField(path: string): AnyZod | null;
|
|
199
|
+
/** Every dotted key the config knows, leaves and the objects above them. */
|
|
200
|
+
export declare function configKeys(): string[];
|
|
201
|
+
/** The closest known key to a typo, or null when nothing is close enough to suggest. */
|
|
202
|
+
export declare function nearestConfigKey(key: string): string | null;
|
|
203
|
+
/** A human name for what a key holds, for the "expected" half of an error message. */
|
|
204
|
+
export declare function configFieldType(field: AnyZod): string;
|
|
205
|
+
/**
|
|
206
|
+
* Turn one command-line string into the type the key wants. Unlike a guessing parser this never stores a number
|
|
207
|
+
* where the product uses a string (prices) or a string where it uses a number.
|
|
208
|
+
*/
|
|
209
|
+
export declare function coerceConfigValue(field: AnyZod, raw: string): unknown;
|
|
210
|
+
export interface ConfigProblem {
|
|
211
|
+
key: string;
|
|
212
|
+
message: string;
|
|
213
|
+
kind: 'invalid' | 'unknown';
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Every problem in a config object: values that break the schema (`invalid`) and keys the schema has never
|
|
217
|
+
* heard of (`unknown`). Start-up refuses on `invalid` and only warns about `unknown`, so a config written by a
|
|
218
|
+
* newer build still boots here.
|
|
219
|
+
*/
|
|
220
|
+
export declare function validateConfig(cfg: unknown): ConfigProblem[];
|
|
221
|
+
export {};
|
|
222
|
+
//# sourceMappingURL=config-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../src/config-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAC,EAAE,KAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAgBtC,eAAO,MAAM,KAAK,uDAAwD,CAAC;AAyD3E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqE3B,CAAC;AAEH,gHAAgH;AAChH,eAAO,MAAM,qBAAqB,UAAwG,CAAC;AAI3I,KAAK,MAAM,GAAG,OAAO,GAAG;IAAE,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CAAE,CAAC;AAS9K,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQvD;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAarC;AAgBD,wFAAwF;AACxF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU3D;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUrD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAarE;AAED,MAAM,WAAW,aAAa;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE;AAE5F;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,EAAE,CAyB5D"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of config.json, as a schema the CLI and the node can both check against (review-2 item 123).
|
|
3
|
+
*
|
|
4
|
+
* `ainize config set` used to accept any dotted path and any value with a green tick — `port notanumber`,
|
|
5
|
+
* `verifier.stak 5`, `roles admin`, `market.royaltyShare 47` — and the node then booted on whatever was written.
|
|
6
|
+
* This file is the single description of what a config key is, what type it holds and what range it may take:
|
|
7
|
+
* • `configField(path)` — the schema of one dotted key, or null when the key does not exist
|
|
8
|
+
* • `nearestConfigKey()` — "did you mean …?" for a typo
|
|
9
|
+
* • `coerceConfigValue()` — turn one command-line string into the type the key actually wants
|
|
10
|
+
* • `validateConfig()` — every problem in a whole config.json, for `config set` and for start-up
|
|
11
|
+
*
|
|
12
|
+
* Unknown keys are reported, never silently dropped: a config written by a newer build must still boot on an
|
|
13
|
+
* older one, so start-up treats an unknown key as a warning and a wrong *value* as a refusal.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
const port = z.number().int('must be a whole number').min(1, 'must be between 1 and 65535').max(65535, 'must be between 1 and 65535');
|
|
17
|
+
const share = z.number().min(0, 'must be a fraction between 0 and 1').max(1, 'must be a fraction between 0 and 1');
|
|
18
|
+
const positive = z.number().int('must be a whole number').min(1, 'must be at least 1');
|
|
19
|
+
const nonNegative = z.number().int('must be a whole number').min(0, 'must not be negative');
|
|
20
|
+
/** Money is a decimal string everywhere in this product (anchors, receipts, the ledger) — never a JSON number. */
|
|
21
|
+
const amount = z.string().regex(/^\d+(\.\d+)?$/, 'must be a decimal amount in quotes, e.g. "0.1"');
|
|
22
|
+
const url = z.string().url('must be an http(s) URL');
|
|
23
|
+
/** An interface to bind: an IPv4/IPv6 literal or a resolvable-looking hostname — not `999.999.999.999`. */
|
|
24
|
+
const host = z.string().refine((v) => {
|
|
25
|
+
if (v === 'localhost' || v === '::' || /^[0-9a-fA-F:]+$/.test(v) && v.includes(':'))
|
|
26
|
+
return true;
|
|
27
|
+
if (/^\d{1,3}(\.\d{1,3}){3}$/.test(v))
|
|
28
|
+
return v.split('.').every((o) => Number(o) <= 255);
|
|
29
|
+
return /^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/.test(v);
|
|
30
|
+
}, 'must be an interface to bind: an IP address (0.0.0.0, 127.0.0.1, ::) or a hostname');
|
|
31
|
+
export const ROLES = ['seller', 'verifier', 'serving', 'gateway'];
|
|
32
|
+
const effortPreset = z.object({ maxSteps: positive, evalEvery: positive });
|
|
33
|
+
const teachSchema = z.object({
|
|
34
|
+
enabled: z.boolean(),
|
|
35
|
+
publish: z.enum(['review', 'auto', 'never']),
|
|
36
|
+
factsPerJob: positive,
|
|
37
|
+
jobsPerKeyPerDay: nonNegative,
|
|
38
|
+
jobsPerIpPerDay: nonNegative,
|
|
39
|
+
queueMax: nonNegative,
|
|
40
|
+
contributorShare: share,
|
|
41
|
+
draftTtlDays: positive,
|
|
42
|
+
backend: z.enum(['gradient', 'stub']),
|
|
43
|
+
stubOffline: z.boolean().optional(),
|
|
44
|
+
trainer: z.object({
|
|
45
|
+
container: z.string(),
|
|
46
|
+
script: z.string(),
|
|
47
|
+
gpus: z.string(),
|
|
48
|
+
maxSteps: positive,
|
|
49
|
+
timeoutMs: positive,
|
|
50
|
+
minFreeGpuMb: nonNegative,
|
|
51
|
+
idleStopMin: nonNegative,
|
|
52
|
+
}),
|
|
53
|
+
locality: z.object({ prompts: z.array(z.string()), minSame: nonNegative }),
|
|
54
|
+
dataset: z.object({
|
|
55
|
+
maxBytes: positive,
|
|
56
|
+
maxSourceLines: positive,
|
|
57
|
+
maxRows: positive,
|
|
58
|
+
perKeyPerDay: nonNegative,
|
|
59
|
+
keptPerKey: nonNegative,
|
|
60
|
+
rowsPerKeyPerDay: nonNegative,
|
|
61
|
+
rowsPerIpPerDay: nonNegative,
|
|
62
|
+
bytesPerKeyPerDay: nonNegative,
|
|
63
|
+
ttlDays: positive,
|
|
64
|
+
stagedTtlHours: positive,
|
|
65
|
+
createsPerIpPerMin: nonNegative,
|
|
66
|
+
declarationRows: nonNegative,
|
|
67
|
+
}),
|
|
68
|
+
rowsPerJob: z.object({ floorGradient: positive, floorStub: positive, ceiling: positive, safetyFactor: positive }),
|
|
69
|
+
effort: z.object({ quick: effortPreset, balanced: effortPreset, thorough: effortPreset, lr: z.number().min(0, 'must not be negative') }),
|
|
70
|
+
check: z.object({
|
|
71
|
+
callBudget: positive, sampleRows: positive, chatFormRows: positive, parentSamplesMax: nonNegative,
|
|
72
|
+
lockTargetMs: positive, lockAbortMs: positive,
|
|
73
|
+
/** how long a lesson waits for a BUSY shared model before it is saved unchecked (item 244) */
|
|
74
|
+
lockGraceMs: positive.optional(),
|
|
75
|
+
}),
|
|
76
|
+
preflight: z.object({ sampleRows: positive, perCall: positive }),
|
|
77
|
+
queuedRowsMax: positive,
|
|
78
|
+
/** run the live side-effect check on a placeholder lesson from the demo trainer (item 247) */
|
|
79
|
+
checkStubLessons: z.boolean().optional(),
|
|
80
|
+
/** teaching keys this node does not ration (item 246) */
|
|
81
|
+
trustedKeys: z.array(z.string().regex(/^0x[0-9a-fA-F]{40}$/, 'must be an AIN address (0x + 40 hex)')).optional(),
|
|
82
|
+
/** feature flag — `ainize config set teach.lineage true` (lineage design §18) */
|
|
83
|
+
lineage: z.boolean().optional(),
|
|
84
|
+
});
|
|
85
|
+
export const nodeConfigSchema = z.object({
|
|
86
|
+
name: z.string().min(1, 'must not be empty'),
|
|
87
|
+
dataDir: z.string().min(1, 'must not be empty'),
|
|
88
|
+
port,
|
|
89
|
+
host,
|
|
90
|
+
publicUrl: url.optional(),
|
|
91
|
+
roles: z.array(z.enum(ROLES)).min(1, 'must name at least one of seller, verifier, serving, gateway'),
|
|
92
|
+
peers: z.array(url),
|
|
93
|
+
ledger: z.object({
|
|
94
|
+
kind: z.enum(['local', 'ain']),
|
|
95
|
+
ain: z.object({
|
|
96
|
+
providerUrl: url,
|
|
97
|
+
eventHandlerUrl: url.nullable().optional(),
|
|
98
|
+
chainId: nonNegative,
|
|
99
|
+
appName: z.string().min(1, 'must not be empty'),
|
|
100
|
+
}).optional(),
|
|
101
|
+
}),
|
|
102
|
+
identity: z.object({ privateKey: z.string(), address: z.string(), publicKey: z.string() }),
|
|
103
|
+
operatorPasswordHash: z.string().optional(),
|
|
104
|
+
runtime: z.object({
|
|
105
|
+
repo: z.string().optional(),
|
|
106
|
+
api: url.optional(),
|
|
107
|
+
hookApi: url.optional(),
|
|
108
|
+
python: z.string().optional(),
|
|
109
|
+
patchDir: z.string().optional(),
|
|
110
|
+
/** GPUs the serving instance occupies, e.g. "4,5" — checked against teach.trainer.gpus (item 145) */
|
|
111
|
+
gpus: z.string().optional(),
|
|
112
|
+
sampling: z.record(z.string(), z.unknown()).optional(),
|
|
113
|
+
}).optional(),
|
|
114
|
+
verifier: z.object({
|
|
115
|
+
quorum: positive,
|
|
116
|
+
/** @deprecated never escrowed (item 127) — kept so configs written before 2026-09 still validate */
|
|
117
|
+
stake: amount.optional(),
|
|
118
|
+
allowSelfAttest: z.boolean(),
|
|
119
|
+
intervalMs: positive,
|
|
120
|
+
auto: z.boolean().optional(),
|
|
121
|
+
/** stop attesting below this balance on a gas-charging chain (item 341); 0 = never stop */
|
|
122
|
+
minBalance: z.number().min(0, 'must not be negative').optional(),
|
|
123
|
+
/** What this node will spend verifying other people's knowledge (items 332 / 333 / 336). */
|
|
124
|
+
includeTest: z.boolean().optional(),
|
|
125
|
+
minPrice: amount.optional(),
|
|
126
|
+
maxPerHour: z.number().int().min(0).optional(),
|
|
127
|
+
maxModelMinutesPerHour: z.number().min(0).optional(),
|
|
128
|
+
window: z.object({ from: z.string().regex(/^\d{2}:\d{2}$/, 'must be HH:MM'), to: z.string().regex(/^\d{2}:\d{2}$/, 'must be HH:MM') }).nullable().optional(),
|
|
129
|
+
retainBodies: z.boolean().optional(),
|
|
130
|
+
}).optional(),
|
|
131
|
+
market: z.object({
|
|
132
|
+
currency: z.enum(['AIN', 'CREDIT']),
|
|
133
|
+
defaultPrice: amount,
|
|
134
|
+
royaltyShare: share,
|
|
135
|
+
/** fraction of the seller side paid to the verifiers that attested each sale (item 325); floored at NETWORK_MIN_VERIFIER_SHARE */
|
|
136
|
+
verifierShare: share.optional(),
|
|
137
|
+
initialCredit: amount,
|
|
138
|
+
/** how many addresses this node will hand starting credit to before it stops issuing (item 364) */
|
|
139
|
+
creditGrants: positive.optional(),
|
|
140
|
+
}),
|
|
141
|
+
/** What this node accepts from peer exchange (items 136/137). */
|
|
142
|
+
p2p: z.object({
|
|
143
|
+
acceptExchange: z.boolean().optional(),
|
|
144
|
+
maxPeers: nonNegative.optional(),
|
|
145
|
+
evictAfterFailures: nonNegative.optional(),
|
|
146
|
+
staleDays: nonNegative.optional(),
|
|
147
|
+
}).optional(),
|
|
148
|
+
server: z.object({ trustProxy: z.union([z.boolean(), z.number(), z.string(), z.array(z.string())]).optional() }).optional(),
|
|
149
|
+
events: z.object({ retentionDays: positive }).optional(),
|
|
150
|
+
teach: teachSchema.optional(),
|
|
151
|
+
gossipIntervalMs: positive,
|
|
152
|
+
version: z.string().min(1, 'must not be empty'),
|
|
153
|
+
includeTestAnchors: z.boolean().optional(),
|
|
154
|
+
});
|
|
155
|
+
/** Keys `config set` refuses to touch: the identity is the node's only key pair, the hash is set by `login`. */
|
|
156
|
+
export const PROTECTED_CONFIG_KEYS = ['identity', 'identity.privateKey', 'identity.address', 'identity.publicKey', 'operatorPasswordHash'];
|
|
157
|
+
/** Strip optional / nullable / default wrappers to reach the type that actually describes the value. */
|
|
158
|
+
function unwrap(s) {
|
|
159
|
+
let cur = s;
|
|
160
|
+
for (let i = 0; i < 8 && cur?.def?.innerType; i++)
|
|
161
|
+
cur = cur.def.innerType;
|
|
162
|
+
return cur;
|
|
163
|
+
}
|
|
164
|
+
/** The schema of one dotted config key, or null when no such key exists. */
|
|
165
|
+
export function configField(path) {
|
|
166
|
+
let cur = unwrap(nodeConfigSchema);
|
|
167
|
+
for (const seg of path.split('.')) {
|
|
168
|
+
const shape = cur?.def?.shape;
|
|
169
|
+
if (!shape || !(seg in shape))
|
|
170
|
+
return null;
|
|
171
|
+
cur = unwrap(shape[seg]);
|
|
172
|
+
}
|
|
173
|
+
return cur ?? null;
|
|
174
|
+
}
|
|
175
|
+
/** Every dotted key the config knows, leaves and the objects above them. */
|
|
176
|
+
export function configKeys() {
|
|
177
|
+
const out = [];
|
|
178
|
+
const walk = (s, prefix) => {
|
|
179
|
+
const shape = unwrap(s)?.def?.shape;
|
|
180
|
+
if (!shape)
|
|
181
|
+
return;
|
|
182
|
+
for (const [k, v] of Object.entries(shape)) {
|
|
183
|
+
const p = prefix ? `${prefix}.${k}` : k;
|
|
184
|
+
out.push(p);
|
|
185
|
+
walk(v, p);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
walk(nodeConfigSchema, '');
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
const distance = (a, b) => {
|
|
192
|
+
const prev = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
193
|
+
for (let i = 1; i <= a.length; i++) {
|
|
194
|
+
let diag = prev[0];
|
|
195
|
+
prev[0] = i;
|
|
196
|
+
for (let j = 1; j <= b.length; j++) {
|
|
197
|
+
const tmp = prev[j];
|
|
198
|
+
prev[j] = Math.min(prev[j] + 1, prev[j - 1] + 1, diag + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
199
|
+
diag = tmp;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return prev[b.length];
|
|
203
|
+
};
|
|
204
|
+
/** The closest known key to a typo, or null when nothing is close enough to suggest. */
|
|
205
|
+
export function nearestConfigKey(key) {
|
|
206
|
+
const lower = key.toLowerCase();
|
|
207
|
+
let best = null;
|
|
208
|
+
let bestScore = Infinity;
|
|
209
|
+
for (const k of configKeys()) {
|
|
210
|
+
// a pure case difference (market.defaultprice) is the commonest typo of all — always suggest it
|
|
211
|
+
const d = k.toLowerCase() === lower ? 0.5 : distance(lower, k.toLowerCase());
|
|
212
|
+
if (d < bestScore) {
|
|
213
|
+
bestScore = d;
|
|
214
|
+
best = k;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return best !== null && bestScore <= Math.max(2, Math.ceil(key.length / 3)) ? best : null;
|
|
218
|
+
}
|
|
219
|
+
/** A human name for what a key holds, for the "expected" half of an error message. */
|
|
220
|
+
export function configFieldType(field) {
|
|
221
|
+
const t = field.def.type;
|
|
222
|
+
if (t === 'enum')
|
|
223
|
+
return `one of ${Object.values(field.def.entries ?? {}).map((v) => `'${v}'`).join(', ')}`;
|
|
224
|
+
if (t === 'array') {
|
|
225
|
+
const el = unwrap(field.def.element);
|
|
226
|
+
return el?.def?.type === 'enum' ? `a comma list of ${Object.values(el.def.entries ?? {}).map((v) => `'${v}'`).join(', ')}` : 'a comma list';
|
|
227
|
+
}
|
|
228
|
+
if (t === 'union')
|
|
229
|
+
return 'a boolean, number or string';
|
|
230
|
+
if (t === 'object')
|
|
231
|
+
return 'an object (set its keys one at a time)';
|
|
232
|
+
return `a ${t}`;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Turn one command-line string into the type the key wants. Unlike a guessing parser this never stores a number
|
|
236
|
+
* where the product uses a string (prices) or a string where it uses a number.
|
|
237
|
+
*/
|
|
238
|
+
export function coerceConfigValue(field, raw) {
|
|
239
|
+
const t = field.def.type;
|
|
240
|
+
if (t === 'boolean')
|
|
241
|
+
return raw === 'true' ? true : raw === 'false' ? false : raw;
|
|
242
|
+
if (t === 'number') {
|
|
243
|
+
const n = Number(raw);
|
|
244
|
+
return raw.trim() !== '' && Number.isFinite(n) ? n : raw;
|
|
245
|
+
}
|
|
246
|
+
if (t === 'array')
|
|
247
|
+
return raw.split(',').map((s) => s.trim()).filter(Boolean);
|
|
248
|
+
if (t === 'union') {
|
|
249
|
+
if (raw === 'true' || raw === 'false')
|
|
250
|
+
return raw === 'true';
|
|
251
|
+
const n = Number(raw);
|
|
252
|
+
return raw.trim() !== '' && Number.isFinite(n) ? n : raw;
|
|
253
|
+
}
|
|
254
|
+
if (t === 'object' || t === 'record') {
|
|
255
|
+
try {
|
|
256
|
+
return JSON.parse(raw);
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
return raw;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (raw === 'null')
|
|
263
|
+
return null;
|
|
264
|
+
return raw;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Every problem in a config object: values that break the schema (`invalid`) and keys the schema has never
|
|
268
|
+
* heard of (`unknown`). Start-up refuses on `invalid` and only warns about `unknown`, so a config written by a
|
|
269
|
+
* newer build still boots here.
|
|
270
|
+
*/
|
|
271
|
+
export function validateConfig(cfg) {
|
|
272
|
+
const out = [];
|
|
273
|
+
const res = nodeConfigSchema.safeParse(cfg);
|
|
274
|
+
if (!res.success) {
|
|
275
|
+
for (const issue of res.error.issues) {
|
|
276
|
+
const key = issue.path.join('.') || '(root)';
|
|
277
|
+
// prefer the schema's own wording ("must be a fraction between 0 and 1") over zod's generic type sentence
|
|
278
|
+
const field = configField(key.replace(/\.\d+$/, ''));
|
|
279
|
+
const message = /^must /.test(issue.message) ? issue.message
|
|
280
|
+
: /received undefined$/.test(issue.message) ? 'is missing'
|
|
281
|
+
: `must be ${field ? configFieldType(field) : issue.message}`;
|
|
282
|
+
out.push({ key, message, kind: 'invalid' });
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const known = new Set(configKeys());
|
|
286
|
+
const walk = (o, prefix) => {
|
|
287
|
+
if (!o || typeof o !== 'object' || Array.isArray(o))
|
|
288
|
+
return;
|
|
289
|
+
for (const [k, v] of Object.entries(o)) {
|
|
290
|
+
const p = prefix ? `${prefix}.${k}` : k;
|
|
291
|
+
if (!known.has(p)) {
|
|
292
|
+
out.push({ key: p, message: `unknown config key${nearestConfigKey(p) ? ` — did you mean '${nearestConfigKey(p)}'?` : ''}`, kind: 'unknown' });
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (configField(p)?.def.type === 'object')
|
|
296
|
+
walk(v, p);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
walk(cfg, '');
|
|
300
|
+
return out;
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../src/config-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CA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