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,852 @@
|
|
|
1
|
+
import type { BenchmarkSpec, CatalogEntry, Contributor, LedgerRecord, PatchAnchor } from '@ainize/core';
|
|
2
|
+
import { NodeClient } from '../client.js';
|
|
3
|
+
import { type ResolveOptions } from '../ens.js';
|
|
4
|
+
import { type CliContext } from '../context.js';
|
|
5
|
+
export interface LsArgs {
|
|
6
|
+
status?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
schema?: string;
|
|
9
|
+
branch?: string;
|
|
10
|
+
author?: string;
|
|
11
|
+
q?: string;
|
|
12
|
+
sort?: string;
|
|
13
|
+
limit?: number;
|
|
14
|
+
mine?: boolean;
|
|
15
|
+
drafts?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Position in the serving model's stack, by knowledge id (`GET /api/runtime/stack`) — item 216. */
|
|
18
|
+
export declare function loadedPositions(client: NodeClient): Promise<Map<string, number>>;
|
|
19
|
+
/**
|
|
20
|
+
* A catalogue row as `/api/catalog` returns it: the derived entry plus the demand numbers the marketplace computes
|
|
21
|
+
* (item 201). `downloads` is the raw settlement count and stays for compatibility; `sales` is what a sale is.
|
|
22
|
+
*/
|
|
23
|
+
export type CatalogRow = CatalogEntry & {
|
|
24
|
+
sales?: {
|
|
25
|
+
sales_all: number;
|
|
26
|
+
sales_30d: number;
|
|
27
|
+
};
|
|
28
|
+
built_on?: number;
|
|
29
|
+
};
|
|
30
|
+
export declare function patchLs(ctx: CliContext, a?: LsArgs): Promise<CatalogRow[]>;
|
|
31
|
+
/**
|
|
32
|
+
* What this knowledge is built on, in the words the browse card uses (item 282).
|
|
33
|
+
*
|
|
34
|
+
* `add-on: <ids>` — `base.stack`, a body trained against those tables: it does not work without them, and its price
|
|
35
|
+
* has to be read together with theirs. `<ids>` alone — declared `parents`: it stands on its own and shares revenue
|
|
36
|
+
* with them. `-` — a root. Ids are listed, not counted, because the one thing the reader needs is WHICH knowledge
|
|
37
|
+
* they also have to hold.
|
|
38
|
+
*/
|
|
39
|
+
export declare function builtOnCell(e: CatalogRow): string;
|
|
40
|
+
/** `2/2 passed ✓ quorum` — clamped, with the extra evidence spelled out instead of an unreadable `3/2`. */
|
|
41
|
+
export declare function verificationLine(e: CatalogEntry): string;
|
|
42
|
+
/**
|
|
43
|
+
* How many distinct model servers are behind those attestations (item 329). Two verifier processes pointed at one
|
|
44
|
+
* vLLM sign two attestations and are not two independent verifications; the record can now tell the difference, so
|
|
45
|
+
* the line says which of the two it is instead of printing a fraction that means either.
|
|
46
|
+
*/
|
|
47
|
+
export declare function executorLine(e: CatalogEntry): string;
|
|
48
|
+
/**
|
|
49
|
+
* "3 CREDIT → node-b 2.1 (seller) · node-a 0.9 (creator of pixel-parent)" (item 280).
|
|
50
|
+
*
|
|
51
|
+
* The seller returns the whole split in `x-payment-response` on the same reply that hands over the manifest, and
|
|
52
|
+
* the buyer's receipt printed six timeline steps and a tx hash. A payee this node's own lineage view did not
|
|
53
|
+
* expect is marked, because that is the one thing the split is worth checking for.
|
|
54
|
+
*/
|
|
55
|
+
export declare function payeeLines(r: PurchaseResult, currency: string): string[];
|
|
56
|
+
/** `split` as `GET /api/patches/:id` returns it. */
|
|
57
|
+
export interface SaleSplitView {
|
|
58
|
+
patch_id: string;
|
|
59
|
+
amount: string;
|
|
60
|
+
currency: string;
|
|
61
|
+
share: number;
|
|
62
|
+
verifier_share: number;
|
|
63
|
+
/** The rule that decides the split, in one sentence (item 322). */
|
|
64
|
+
rule?: string;
|
|
65
|
+
payees?: number;
|
|
66
|
+
/** What one sale costs to settle on this chain, from measured gas (item 366); null when nothing has been charged. */
|
|
67
|
+
cost?: {
|
|
68
|
+
writes: number;
|
|
69
|
+
gas_avg: number;
|
|
70
|
+
floor: string;
|
|
71
|
+
measured_writes: number;
|
|
72
|
+
} | null;
|
|
73
|
+
lines: {
|
|
74
|
+
address: string;
|
|
75
|
+
amount: string;
|
|
76
|
+
name: string | null;
|
|
77
|
+
role: 'seller' | 'ancestor' | 'contributor' | 'verifier';
|
|
78
|
+
knowledge: string[];
|
|
79
|
+
}[];
|
|
80
|
+
parents: {
|
|
81
|
+
id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
price: string | null;
|
|
84
|
+
currency: string;
|
|
85
|
+
author: string | null;
|
|
86
|
+
author_name: string | null;
|
|
87
|
+
status: string | null;
|
|
88
|
+
}[];
|
|
89
|
+
cheaper_than: {
|
|
90
|
+
id: string;
|
|
91
|
+
price: string;
|
|
92
|
+
currency: string;
|
|
93
|
+
}[];
|
|
94
|
+
unresolved: Record<string, string>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* "Each sale of 3 CREDIT → 2.1 to you, 0.9 shared by the creators of krx-all-2761" (item 189), and the one thing a
|
|
98
|
+
* publisher undercutting their own base is never told (item 318). Printed at publish, before the announce, because
|
|
99
|
+
* afterwards the price is on the permanent record.
|
|
100
|
+
*/
|
|
101
|
+
export declare function splitLines(s: SaleSplitView): string[];
|
|
102
|
+
/** A parent or child as `GET /api/patches/:id` returns it, with its price and (for the author) what it has paid. */
|
|
103
|
+
export interface LineageRef {
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
author: string;
|
|
107
|
+
status: string;
|
|
108
|
+
price?: string;
|
|
109
|
+
currency?: string;
|
|
110
|
+
author_name?: string | null;
|
|
111
|
+
sales?: number | null;
|
|
112
|
+
earned?: string | null;
|
|
113
|
+
}
|
|
114
|
+
export interface PatchDetail extends CatalogEntry {
|
|
115
|
+
lineage: {
|
|
116
|
+
parents: LineageRef[];
|
|
117
|
+
children: LineageRef[];
|
|
118
|
+
earned?: {
|
|
119
|
+
amount: string;
|
|
120
|
+
currency: string;
|
|
121
|
+
sales: number;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
conflicts: {
|
|
125
|
+
patch_id: string;
|
|
126
|
+
overlap_rows: number;
|
|
127
|
+
same_schema: boolean;
|
|
128
|
+
status: string;
|
|
129
|
+
cross_branch?: boolean;
|
|
130
|
+
same_author?: boolean;
|
|
131
|
+
author?: string;
|
|
132
|
+
author_name?: string | null;
|
|
133
|
+
created_at?: number;
|
|
134
|
+
sales?: number;
|
|
135
|
+
lineage?: 'parent' | 'child' | null;
|
|
136
|
+
}[];
|
|
137
|
+
/** What one sale pays and to whom, by name (items 189, 318) — from the node's `royaltyPlan`. */
|
|
138
|
+
split?: SaleSplitView;
|
|
139
|
+
retired_at?: number | null;
|
|
140
|
+
retire_reason?: string | null;
|
|
141
|
+
branches: {
|
|
142
|
+
name: string;
|
|
143
|
+
context: Record<string, string>;
|
|
144
|
+
}[];
|
|
145
|
+
/** The bases this knowledge needs underneath it, deepest first, with their prices (item 270). */
|
|
146
|
+
requires?: {
|
|
147
|
+
id: string;
|
|
148
|
+
name: string;
|
|
149
|
+
held: boolean;
|
|
150
|
+
price: string | null;
|
|
151
|
+
currency?: string;
|
|
152
|
+
author?: string;
|
|
153
|
+
author_name?: string | null;
|
|
154
|
+
depth?: number;
|
|
155
|
+
known?: boolean;
|
|
156
|
+
purchased?: boolean;
|
|
157
|
+
mine?: boolean;
|
|
158
|
+
}[];
|
|
159
|
+
owned: boolean;
|
|
160
|
+
purchased: boolean;
|
|
161
|
+
has_body: boolean;
|
|
162
|
+
applied: boolean;
|
|
163
|
+
gateway_url: string | null;
|
|
164
|
+
/**
|
|
165
|
+
* What is still to happen before this is LISTED (item 254) — who has not attested, how many of them can run this
|
|
166
|
+
* model, and how long verification has actually taken on this node. Null once the quorum is met.
|
|
167
|
+
*/
|
|
168
|
+
verifying?: {
|
|
169
|
+
patch_id: string;
|
|
170
|
+
since: number;
|
|
171
|
+
waited_ms: number;
|
|
172
|
+
counted: number;
|
|
173
|
+
quorum: number;
|
|
174
|
+
waiting_on: {
|
|
175
|
+
name: string;
|
|
176
|
+
address: string;
|
|
177
|
+
model: string | null;
|
|
178
|
+
can_run: boolean;
|
|
179
|
+
}[];
|
|
180
|
+
capable: number;
|
|
181
|
+
typical_ms: number | null;
|
|
182
|
+
eta_ms: number | null;
|
|
183
|
+
samples: number;
|
|
184
|
+
} | null;
|
|
185
|
+
/** Why an announced knowledge has not been verified yet — null while it is still within its normal wait (item 154). */
|
|
186
|
+
stalled?: {
|
|
187
|
+
patch_id: string;
|
|
188
|
+
since: number;
|
|
189
|
+
waited_minutes: number;
|
|
190
|
+
counted: number;
|
|
191
|
+
quorum: number;
|
|
192
|
+
hash_only: number;
|
|
193
|
+
needs_benchmark: boolean;
|
|
194
|
+
model: string;
|
|
195
|
+
verifiers: {
|
|
196
|
+
name: string | null;
|
|
197
|
+
endpoint: string;
|
|
198
|
+
address: string | null;
|
|
199
|
+
model: string | null;
|
|
200
|
+
attested: 'no' | 'hash-only' | 'executed';
|
|
201
|
+
}[];
|
|
202
|
+
reason: string;
|
|
203
|
+
} | null;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Holding a file is not owning the knowledge (items 173, 343).
|
|
207
|
+
*
|
|
208
|
+
* A verifier fetches every body it scores, so `body on this node: yes` was true on knowledge nobody had bought and
|
|
209
|
+
* nobody was licensed to use, teach on, or subscribe with — and `patch buy` then charged for it and reported
|
|
210
|
+
* "body already present", which reads as "nothing happened". The node has known the difference all along
|
|
211
|
+
* (`licenseOf(e).source === 'verification'`); this is that fact, in the buyer's words.
|
|
212
|
+
*/
|
|
213
|
+
export declare function licenceLine(e: {
|
|
214
|
+
owned: boolean;
|
|
215
|
+
purchased: boolean;
|
|
216
|
+
has_body: boolean;
|
|
217
|
+
}, tx?: string | null): string;
|
|
218
|
+
export declare function patchGet(ctx: CliContext, id: string): Promise<PatchDetail>;
|
|
219
|
+
export interface PublishArgs {
|
|
220
|
+
file: string;
|
|
221
|
+
name: string;
|
|
222
|
+
model: string;
|
|
223
|
+
benchmark: string;
|
|
224
|
+
id?: string;
|
|
225
|
+
price?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
parents?: string;
|
|
228
|
+
branch?: string;
|
|
229
|
+
topic?: string;
|
|
230
|
+
license?: string;
|
|
231
|
+
billing?: 'per_download' | 'per_apply_hour' | 'per_hit';
|
|
232
|
+
announce?: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* The day the DATA is true of (item 267), YYYY-MM-DD — not the day it was uploaded. Everything else on an anchor
|
|
235
|
+
* is a publishing timestamp, so a daily baker had nowhere to put the one date a consumer needs and put it in the
|
|
236
|
+
* name string instead. The node validates it (a real date, not in the future) and every surface reads it.
|
|
237
|
+
*/
|
|
238
|
+
asOf?: string;
|
|
239
|
+
/** What this knowledge is to its bases (item 188): extend | contradict | update | merge. The node measures the rows. */
|
|
240
|
+
kind?: 'extend' | 'contradict' | 'update' | 'merge';
|
|
241
|
+
/** hidden from public catalogs (e2e/test publishing on a shared chain) */
|
|
242
|
+
test?: boolean;
|
|
243
|
+
/** data providers credited on the record: `addr:name:share` (name optional: `addr:share`), up to 4, Σ share ≤ 1 */
|
|
244
|
+
contributor?: string[];
|
|
245
|
+
/** the training set beside the body (lineage design §12.4): a local .jsonl/.csv the node pins under its own sha */
|
|
246
|
+
dataset?: string;
|
|
247
|
+
datasetAccess?: 'public' | 'derivative' | 'private';
|
|
248
|
+
datasetLicense?: string;
|
|
249
|
+
/** publish past `duplicate_body` (your own bytes, same subject) and `model_mismatch` — never past another author's bytes */
|
|
250
|
+
force?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* The listings this publish retires: required when the overlap rule found any (item 150), and the DECLARATION
|
|
253
|
+
* when it did not — today's bake replacing yesterday's on rows that do not overlap (item 248).
|
|
254
|
+
*/
|
|
255
|
+
supersede?: string[];
|
|
256
|
+
/** Keep every overlapping listing of yours on sale — a dated snapshot published on purpose (item 248). */
|
|
257
|
+
keepOthers?: boolean;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* `--contributor 0xabc…:Alice:0.7` → Contributor (role data_provider, proof declared — the operator vouches for the address;
|
|
261
|
+
* a *signed* proof only comes from the browser teach flow). `0xabc…:0.7` omits the name; `0xabc…:Alice:0` is credit-only.
|
|
262
|
+
*/
|
|
263
|
+
export declare function parseContributors(list: string[] | undefined): Contributor[] | undefined;
|
|
264
|
+
/** The node's own id rule (`market.createDraft`), mirrored so the CLI can say what will happen before it happens. */
|
|
265
|
+
export declare const slugForId: (name: string) => string;
|
|
266
|
+
/**
|
|
267
|
+
* The id of a knowledge whose publisher did not choose one (item 158).
|
|
268
|
+
*
|
|
269
|
+
* The node derives it from the name by dropping everything outside `a-z 0-9 . _ -`, so every Korean, Japanese or
|
|
270
|
+
* Chinese name collapsed to the empty string and the publisher was told `invalid patch id (use 2-64 chars …)` —
|
|
271
|
+
* a rule about a flag they never passed, on the product's own flagship subject. A name with no usable ASCII gets a
|
|
272
|
+
* derived, stable id here instead, and the command says so; `--id` still wins over everything.
|
|
273
|
+
*/
|
|
274
|
+
export declare function idFromName(name: string): {
|
|
275
|
+
id: string;
|
|
276
|
+
from: 'name' | 'hash';
|
|
277
|
+
};
|
|
278
|
+
/** The benchmark, from a path or from inline JSON — with the three mistakes told apart (item 159). */
|
|
279
|
+
export declare function readBenchmarkArg(value: string): unknown;
|
|
280
|
+
/**
|
|
281
|
+
* A knowledge body is a numpy archive, which is a ZIP (item 159). Publishing something else used to reach the npz
|
|
282
|
+
* reader on the node and come back as `npz: end of central directory not found` — a ZIP structure term, with no
|
|
283
|
+
* filename, that gives no hint the file is simply the wrong kind.
|
|
284
|
+
*/
|
|
285
|
+
export declare function assertNpzBody(file: string): void;
|
|
286
|
+
export declare function patchPublish(ctx: CliContext, a: PublishArgs): Promise<{
|
|
287
|
+
anchor: PatchAnchor;
|
|
288
|
+
announced: boolean;
|
|
289
|
+
}>;
|
|
290
|
+
/** `ainize --json publish` — the record hash, the derived status and what the announce retired, without the sketch. */
|
|
291
|
+
export declare function publishDocument(anchor: PatchAnchor, announced: AnnounceResult | null): Record<string, unknown>;
|
|
292
|
+
/** What the node's `verifierReach()` reports back with an announce (item 147). */
|
|
293
|
+
export interface VerifierReach {
|
|
294
|
+
known: number;
|
|
295
|
+
reachable: number;
|
|
296
|
+
verifiers: number;
|
|
297
|
+
quorum: number;
|
|
298
|
+
self_attest: boolean;
|
|
299
|
+
endpoints: string[];
|
|
300
|
+
}
|
|
301
|
+
/** Everything an announce establishes: the record it wrote, what it retired, and who can verify it (item 253). */
|
|
302
|
+
export interface AnnounceResult {
|
|
303
|
+
patch_id: string;
|
|
304
|
+
record: LedgerRecord;
|
|
305
|
+
retires: PatchDetail['conflicts'];
|
|
306
|
+
verifiers: VerifierReach | null;
|
|
307
|
+
visibility: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* The overlaps an announce would RETIRE: same subject, same branch, still tradeable, and published by this same node
|
|
311
|
+
* — the node's own rule (market.supersedable). A cross-author overlap is not in this list any more: it coexists.
|
|
312
|
+
*/
|
|
313
|
+
export declare function retiredByAnnounce(d: PatchDetail): PatchDetail['conflicts'];
|
|
314
|
+
/**
|
|
315
|
+
* DRAFT → ANNOUNCED, with the two things the publisher was never told (items 147, 150):
|
|
316
|
+
* - what this announce retires, listed with each item's status and sales, and refused until every one of them is
|
|
317
|
+
* named with `--supersede` — the same friction the console demands before the same, permanent, irreversible write;
|
|
318
|
+
* - whether any reachable peer on this network actually verifies. Below the quorum nothing announced here can ever
|
|
319
|
+
* be LISTED, so the old unconditional "verifiers will now attest" was a promise the node could not keep.
|
|
320
|
+
*/
|
|
321
|
+
export declare function patchAnnounce(ctx: CliContext, id: string, opts?: {
|
|
322
|
+
supersede?: string[];
|
|
323
|
+
keepOthers?: boolean;
|
|
324
|
+
document?: boolean;
|
|
325
|
+
}): Promise<AnnounceResult>;
|
|
326
|
+
/**
|
|
327
|
+
* `ainize patch retire <id>` — the exit (item 148). `patch forget` deletes this node's copy of the file and keeps
|
|
328
|
+
* selling it; this writes an author-signed `retire` record: off the catalogue, 410 at the gateway, permanent.
|
|
329
|
+
*/
|
|
330
|
+
export declare function patchRetire(ctx: CliContext, id: string, opts?: {
|
|
331
|
+
reason?: string;
|
|
332
|
+
}): Promise<{
|
|
333
|
+
patch_id: string;
|
|
334
|
+
retired_at: number;
|
|
335
|
+
reason: string;
|
|
336
|
+
}>;
|
|
337
|
+
/**
|
|
338
|
+
* A Python traceback from the model container, turned into one English line (item 160).
|
|
339
|
+
*
|
|
340
|
+
* `Runtime.verify` rethrows the applier's stderr verbatim, so a failed verification reached the operator as eight
|
|
341
|
+
* lines of `scripts/patch.py` and `engram/live.py` internals ending in a Korean sentence — a stack trace from a file
|
|
342
|
+
* they do not own, in a language the rest of the product does not use, with no statement of what failed or where to
|
|
343
|
+
* look. The trace is not hidden (its last line is the container's own words, quoted as such); it is framed.
|
|
344
|
+
*/
|
|
345
|
+
export declare function runtimeFailure(err: unknown, nodeUrl: string, what: string): unknown;
|
|
346
|
+
export declare function patchVerify(ctx: CliContext, id: string, opts?: {
|
|
347
|
+
recheck?: boolean;
|
|
348
|
+
}): Promise<unknown>;
|
|
349
|
+
/**
|
|
350
|
+
* `ainize patch challenge <id> --reason …`. A challenge is free to file and expensive for everyone else: it stops
|
|
351
|
+
* every sale of the knowledge and spends another operator's GPU minutes on the re-run (item 328). The command says
|
|
352
|
+
* that before it sends, and afterwards it reports what actually happens next — which, for a knowledge that was never
|
|
353
|
+
* LISTED, is not "off sale" but "the verifiers are asked to run it again" (item 242).
|
|
354
|
+
*/
|
|
355
|
+
export declare function patchChallenge(ctx: CliContext, id: string, reason: string): Promise<void>;
|
|
356
|
+
export interface PurchaseResult {
|
|
357
|
+
patch_id: string;
|
|
358
|
+
steps: {
|
|
359
|
+
step: string;
|
|
360
|
+
detail: string;
|
|
361
|
+
at: number;
|
|
362
|
+
}[];
|
|
363
|
+
manifest: {
|
|
364
|
+
patch_sha256: string;
|
|
365
|
+
size_bytes: number;
|
|
366
|
+
rows: number;
|
|
367
|
+
};
|
|
368
|
+
path: string;
|
|
369
|
+
tx_hash: string;
|
|
370
|
+
amount: string;
|
|
371
|
+
scheme: string;
|
|
372
|
+
/** every knowledge this call paid for, bases first (item 270) */
|
|
373
|
+
purchases?: {
|
|
374
|
+
patch_id: string;
|
|
375
|
+
amount: string;
|
|
376
|
+
currency: string;
|
|
377
|
+
scheme: string;
|
|
378
|
+
tx_hash: string;
|
|
379
|
+
free?: boolean;
|
|
380
|
+
}[];
|
|
381
|
+
total?: string;
|
|
382
|
+
currency?: string;
|
|
383
|
+
/** the payment was already settled and the seller re-issued the manifest — nothing was charged (item 273) */
|
|
384
|
+
redeemed?: boolean;
|
|
385
|
+
/** who this purchase paid, from the seller's `x-payment-response` (item 280) */
|
|
386
|
+
royalty?: Record<string, string>;
|
|
387
|
+
payees?: {
|
|
388
|
+
address: string;
|
|
389
|
+
amount: string;
|
|
390
|
+
name: string | null;
|
|
391
|
+
role: string;
|
|
392
|
+
knowledge: string[];
|
|
393
|
+
promised: boolean;
|
|
394
|
+
}[];
|
|
395
|
+
}
|
|
396
|
+
/** `GET /api/patches/:id/quote` — what this purchase costs before anyone pays for it (item 270). */
|
|
397
|
+
export interface PatchQuote {
|
|
398
|
+
patch_id: string;
|
|
399
|
+
price: string;
|
|
400
|
+
currency: string;
|
|
401
|
+
requires: {
|
|
402
|
+
id: string;
|
|
403
|
+
name: string;
|
|
404
|
+
price: string;
|
|
405
|
+
currency: string;
|
|
406
|
+
author: string;
|
|
407
|
+
author_name?: string | null;
|
|
408
|
+
depth: number;
|
|
409
|
+
known: boolean;
|
|
410
|
+
held: boolean;
|
|
411
|
+
licensed: boolean;
|
|
412
|
+
purchased: boolean;
|
|
413
|
+
mine: boolean;
|
|
414
|
+
}[];
|
|
415
|
+
missing: string[];
|
|
416
|
+
unknown: string[];
|
|
417
|
+
total: string;
|
|
418
|
+
self_contained: boolean;
|
|
419
|
+
export: 'delta' | 'squash' | null;
|
|
420
|
+
derivation: string | null;
|
|
421
|
+
}
|
|
422
|
+
/** `GET /api/credit/:address` — where local credit comes from and what it is worth (item 364). */
|
|
423
|
+
export interface CreditInfo {
|
|
424
|
+
address: string;
|
|
425
|
+
currency: string;
|
|
426
|
+
balance: number;
|
|
427
|
+
grant: {
|
|
428
|
+
amount: string;
|
|
429
|
+
reason: string;
|
|
430
|
+
granted_at: number;
|
|
431
|
+
} | null;
|
|
432
|
+
would_grant: string | null;
|
|
433
|
+
issued_by: {
|
|
434
|
+
address: string;
|
|
435
|
+
name: string | null;
|
|
436
|
+
url: string;
|
|
437
|
+
};
|
|
438
|
+
issuance: {
|
|
439
|
+
cap: number;
|
|
440
|
+
addresses: number;
|
|
441
|
+
amount: number;
|
|
442
|
+
per_address: string;
|
|
443
|
+
currency: string;
|
|
444
|
+
issues: boolean;
|
|
445
|
+
};
|
|
446
|
+
note: string;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* `ainize patch price <id> <price>` — change what a published knowledge sells for (item 278).
|
|
450
|
+
*
|
|
451
|
+
* Anchors are immutable, so this was impossible: no discount, no raise, no "make it free". The only path was
|
|
452
|
+
* republishing, which supersedes your own item, restarts verification and splits its sales history — so every
|
|
453
|
+
* price was a one-shot guess made before a single sale. The change is a signed record on the ledger, it applies to
|
|
454
|
+
* the next sale, and it takes nothing away from anyone who already bought.
|
|
455
|
+
*/
|
|
456
|
+
export declare function patchPrice(ctx: CliContext, id: string, price: string, opts?: {
|
|
457
|
+
reason?: string;
|
|
458
|
+
yes?: boolean;
|
|
459
|
+
}): Promise<PriceChange>;
|
|
460
|
+
export interface PriceChange {
|
|
461
|
+
ok: true;
|
|
462
|
+
patch_id: string;
|
|
463
|
+
price: string;
|
|
464
|
+
previous: string;
|
|
465
|
+
currency: string;
|
|
466
|
+
created_at: number;
|
|
467
|
+
history: {
|
|
468
|
+
price: string;
|
|
469
|
+
created_at: number;
|
|
470
|
+
}[];
|
|
471
|
+
}
|
|
472
|
+
export interface BuyArgs {
|
|
473
|
+
apply?: boolean;
|
|
474
|
+
/** buy the bases this knowledge needs underneath it too, deepest first */
|
|
475
|
+
withRequired?: boolean;
|
|
476
|
+
/** answer the confirmation in advance */
|
|
477
|
+
yes?: boolean;
|
|
478
|
+
/** refuse if the TOTAL (this knowledge plus the bases it needs) is above this */
|
|
479
|
+
maxPrice?: number;
|
|
480
|
+
/** pay a second time for something this node has already bought (item 271) — off, so a retry never charges twice */
|
|
481
|
+
again?: boolean;
|
|
482
|
+
/** one step of `use a b` / `buy a b`: the terminal still gets its lines, the JSON document is the batch's (item 219) */
|
|
483
|
+
batched?: boolean;
|
|
484
|
+
/** buy a SUPERSEDED version on purpose (item 236) — without it, a script is stopped instead of silently stacking last month's build */
|
|
485
|
+
allowSuperseded?: boolean;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* `ainize patch buy <id>` — the quote, the decision, then the money (item 102).
|
|
489
|
+
*
|
|
490
|
+
* It used to print `✓ bought <id> for 25 (local-credit)` as its FIRST line: the price was never quoted, no
|
|
491
|
+
* confirmation existed anywhere in this CLI, and on an AIN node the first keystroke moved real money. Now the
|
|
492
|
+
* quote is printed, `--max-price` is checked against the family total (not just this item), a terminal is asked,
|
|
493
|
+
* and a non-terminal without `--yes` is refused instead of taken as a yes.
|
|
494
|
+
*/
|
|
495
|
+
export declare function patchBuy(ctx: CliContext, id: string, opts?: BuyArgs | boolean): Promise<PurchaseResult>;
|
|
496
|
+
/**
|
|
497
|
+
* A seller's refusal, as a sentence (item 293).
|
|
498
|
+
*
|
|
499
|
+
* `market.buy` throws `payment rejected: 402 {"error":"insufficient credit: 2 < 5"}` and every surface printed it
|
|
500
|
+
* verbatim: at the moment a purchase fails, the buyer was shown a status code and a JSON blob. The seller's reasons
|
|
501
|
+
* are readable sentences on the other side; this unwraps them and names the seller, the balance and the price.
|
|
502
|
+
*/
|
|
503
|
+
export declare function refusalError(err: unknown, ctxInfo: {
|
|
504
|
+
seller: string;
|
|
505
|
+
id: string;
|
|
506
|
+
price: string;
|
|
507
|
+
currency: string;
|
|
508
|
+
balance: number | null;
|
|
509
|
+
}): unknown;
|
|
510
|
+
/**
|
|
511
|
+
* `ainize patch download <id>` — collect a knowledge this node has ALREADY paid for, without paying again (item 273).
|
|
512
|
+
*
|
|
513
|
+
* The recovery path existed in the node and was invisible: a buyer whose manifest was lost, or whose purchase died
|
|
514
|
+
* between the transfer and the download (item 274), was told "payment already used" and offered "Buy again".
|
|
515
|
+
*/
|
|
516
|
+
export declare function patchDownload(ctx: CliContext, id: string): Promise<PurchaseResult>;
|
|
517
|
+
/** One layer of the runtime stack as the node reports it (design §5.4). */
|
|
518
|
+
export interface StackLayer {
|
|
519
|
+
patch_id: string;
|
|
520
|
+
name: string | null;
|
|
521
|
+
sha256: string;
|
|
522
|
+
position: number;
|
|
523
|
+
applied_at: number;
|
|
524
|
+
reason: string;
|
|
525
|
+
rows: number | null;
|
|
526
|
+
export: 'delta' | 'squash' | null;
|
|
527
|
+
base_stack: string[];
|
|
528
|
+
journal: boolean;
|
|
529
|
+
journal_path: string | null;
|
|
530
|
+
stack_sha256: string | null;
|
|
531
|
+
body_present: boolean;
|
|
532
|
+
}
|
|
533
|
+
/** A queued apply/remove on the node (`GET /api/runtime/jobs/:id`). */
|
|
534
|
+
export interface RuntimeJob {
|
|
535
|
+
id: string;
|
|
536
|
+
kind: 'apply' | 'remove';
|
|
537
|
+
patch_id: string;
|
|
538
|
+
state: 'queued' | 'running' | 'done' | 'failed';
|
|
539
|
+
queued_at: number;
|
|
540
|
+
started_at: number | null;
|
|
541
|
+
finished_at: number | null;
|
|
542
|
+
result: string | null;
|
|
543
|
+
error: string | null;
|
|
544
|
+
status?: number;
|
|
545
|
+
queue?: {
|
|
546
|
+
running: {
|
|
547
|
+
label: string;
|
|
548
|
+
since: number;
|
|
549
|
+
} | null;
|
|
550
|
+
waiting: number;
|
|
551
|
+
lock: {
|
|
552
|
+
label: string;
|
|
553
|
+
owner: string;
|
|
554
|
+
since: number;
|
|
555
|
+
mine: boolean;
|
|
556
|
+
} | null;
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
export declare function patchApply(ctx: CliContext, id: string, opts?: {
|
|
560
|
+
withBase?: boolean;
|
|
561
|
+
batched?: boolean;
|
|
562
|
+
}): Promise<string>;
|
|
563
|
+
export declare function patchRemove(ctx: CliContext, id: string, opts?: {
|
|
564
|
+
cascade?: boolean;
|
|
565
|
+
batched?: boolean;
|
|
566
|
+
}): Promise<string>;
|
|
567
|
+
/**
|
|
568
|
+
* `ainize use a b`, `patch apply a b`, `patch buy a,b` — a set, in the order given (item 219).
|
|
569
|
+
*
|
|
570
|
+
* The product's stated purpose is combining several knowledges, and `use a,b` answered `patch not found` while
|
|
571
|
+
* `patch apply a b` answered `Unknown argument: b`: the set had to be assembled one command at a time, with no
|
|
572
|
+
* stated order. The order typed IS the load order, and the last one wins on any memory entry two of them share —
|
|
573
|
+
* so the run ends by saying which order that was. Under `--json` the batch writes one document, not one per step.
|
|
574
|
+
*/
|
|
575
|
+
export declare function overIds<T>(ctx: CliContext, ids: string[], verb: 'loaded' | 'unloaded' | 'bought' | null, one: (id: string, batched: boolean) => Promise<T>): Promise<T[]>;
|
|
576
|
+
/**
|
|
577
|
+
* `a,b`, `a b` and repeated flags all mean the same set, in the order typed (item 219). `chat` had this and
|
|
578
|
+
* nothing else did, so the comma form was sent to the node verbatim as one id and came back "patch not found".
|
|
579
|
+
*/
|
|
580
|
+
export declare function parseIds(input: string | string[] | undefined): string[];
|
|
581
|
+
/**
|
|
582
|
+
* `ainize patch stack` — what is loaded in the serving model, bottom first, and what each layer sits on.
|
|
583
|
+
*
|
|
584
|
+
* Item 216: the position, why the layer is there and when it was loaded were all in the answer and none of them on
|
|
585
|
+
* screen, and the rows two neighbouring layers share — the thing that decides which of them the model actually
|
|
586
|
+
* answers from — were nowhere at all. Positions are 1-based here and in `patch ls`'s LOADED column, so the two
|
|
587
|
+
* listings cannot disagree about where a knowledge sits.
|
|
588
|
+
*/
|
|
589
|
+
export declare function patchStack(ctx: CliContext): Promise<StackLayer[]>;
|
|
590
|
+
/** One knowledge in the tree, as the node reports it (`GET /api/patches/:id/tree`). */
|
|
591
|
+
export interface TreeNodeView {
|
|
592
|
+
id: string;
|
|
593
|
+
name: string;
|
|
594
|
+
missing?: boolean;
|
|
595
|
+
author_name?: string | null;
|
|
596
|
+
taught_by?: string | null;
|
|
597
|
+
status?: string;
|
|
598
|
+
added: {
|
|
599
|
+
questions: number;
|
|
600
|
+
changed: number;
|
|
601
|
+
removed: number;
|
|
602
|
+
rows: number;
|
|
603
|
+
new: number;
|
|
604
|
+
};
|
|
605
|
+
signals: Record<string, number>;
|
|
606
|
+
depth: number;
|
|
607
|
+
legacy?: boolean;
|
|
608
|
+
export?: 'delta' | 'squash' | null;
|
|
609
|
+
}
|
|
610
|
+
export interface TreeView {
|
|
611
|
+
root: string;
|
|
612
|
+
depth: number;
|
|
613
|
+
truncated: boolean;
|
|
614
|
+
nodes: TreeNodeView[];
|
|
615
|
+
edges: {
|
|
616
|
+
from: string;
|
|
617
|
+
to: string;
|
|
618
|
+
kind: string;
|
|
619
|
+
}[];
|
|
620
|
+
family: {
|
|
621
|
+
sales: number;
|
|
622
|
+
knowledges: number;
|
|
623
|
+
authors: number;
|
|
624
|
+
};
|
|
625
|
+
money: {
|
|
626
|
+
seller_pct: number;
|
|
627
|
+
lineage_pct: number;
|
|
628
|
+
contributor_pct: number;
|
|
629
|
+
seller_name: string | null;
|
|
630
|
+
lineage_names: string[];
|
|
631
|
+
recipients: {
|
|
632
|
+
address: string;
|
|
633
|
+
pct: number;
|
|
634
|
+
name: string | null;
|
|
635
|
+
kind: 'lineage' | 'contributor';
|
|
636
|
+
}[];
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* `ainize patch tree <id>` — the family tree as text: ancestors above, this knowledge, then what was built on it,
|
|
641
|
+
* each line saying what that knowledge ADDED. The relation is the child's own claim ("built on" / "newer version" /
|
|
642
|
+
* "correction" / "combined"), and `declared` prints as the honest "declared parent — not trained on top" (§14).
|
|
643
|
+
*/
|
|
644
|
+
export declare function patchTree(ctx: CliContext, id: string, opts?: {
|
|
645
|
+
depth?: number;
|
|
646
|
+
dir?: 'up' | 'down' | 'both';
|
|
647
|
+
}): Promise<TreeView>;
|
|
648
|
+
export interface IssueView {
|
|
649
|
+
id: string;
|
|
650
|
+
kind: string;
|
|
651
|
+
count: number;
|
|
652
|
+
people: number;
|
|
653
|
+
topic: string | null;
|
|
654
|
+
text: string | null;
|
|
655
|
+
sample_index: number | null;
|
|
656
|
+
status: string;
|
|
657
|
+
covered_by: string | null;
|
|
658
|
+
first_seen: number;
|
|
659
|
+
last_seen: number;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* `ainize patch missing <id>` — the open questions of a knowledge. A row with no text is not a bug: the question was
|
|
663
|
+
* counted without being kept, because nobody consented to share it (§10).
|
|
664
|
+
*/
|
|
665
|
+
export declare function patchMissing(ctx: CliContext, id: string, opts?: {
|
|
666
|
+
kind?: string;
|
|
667
|
+
limit?: number;
|
|
668
|
+
all?: boolean;
|
|
669
|
+
}): Promise<IssueView[]>;
|
|
670
|
+
/** `ainize patch signals <id>` — what it is doing, with the two scopes kept apart (SC-11). */
|
|
671
|
+
export declare function patchSignals(ctx: CliContext, id: string): Promise<{
|
|
672
|
+
network: Record<string, number | string>;
|
|
673
|
+
node: Record<string, number>;
|
|
674
|
+
}>;
|
|
675
|
+
/**
|
|
676
|
+
* `ainize patch conflicts <id>` — the bodies that write the same memory rows, and which of them is winning (item 216).
|
|
677
|
+
*
|
|
678
|
+
* The table used to print an overlap and stop, leaving the only question that matters — whose answer does the model
|
|
679
|
+
* actually give on those rows — unanswerable from any surface. An overlap decides nothing until both are loaded;
|
|
680
|
+
* when they are, the one loaded later wins, and that is what the row says.
|
|
681
|
+
*/
|
|
682
|
+
export declare function patchConflicts(ctx: CliContext, id: string): Promise<PatchDetail['conflicts']>;
|
|
683
|
+
/** One purchase this node made, as `GET /api/me/purchases` reports it (the row plus the anchor it belongs to). */
|
|
684
|
+
export interface PurchaseRowView {
|
|
685
|
+
patch_id: string;
|
|
686
|
+
sha256: string;
|
|
687
|
+
tx_hash: string;
|
|
688
|
+
scheme: string;
|
|
689
|
+
amount: string;
|
|
690
|
+
path: string | null;
|
|
691
|
+
created_at: number;
|
|
692
|
+
applied?: boolean;
|
|
693
|
+
entry?: (CatalogEntry & {
|
|
694
|
+
anchor: PatchAnchor;
|
|
695
|
+
}) | null;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* `ainize purchases` — what this node bought, from whom, for how much, and whether it is loaded.
|
|
699
|
+
*
|
|
700
|
+
* `patch ls --mine` is "knowledge I registered" and hid every purchase (item 216), so a buyer's own node could not
|
|
701
|
+
* list what it owned; and the purchase row itself names no counterparty (item 289), which is the first thing anyone
|
|
702
|
+
* needs for a refund, a dispute or an audit. The seller is resolved here from the anchor the same call returns.
|
|
703
|
+
*/
|
|
704
|
+
export declare function purchasesLs(ctx: CliContext): Promise<PurchaseRowView[]>;
|
|
705
|
+
export declare function patchRecords(ctx: CliContext, id: string): Promise<LedgerRecord[]>;
|
|
706
|
+
/**
|
|
707
|
+
* `ainize patch rm <id>` — delete a draft, after saying what goes (item 168).
|
|
708
|
+
*
|
|
709
|
+
* The friction was inverted twice over: the console makes you type the full id to delete a draft, while this
|
|
710
|
+
* command did it on one keystroke — no prompt, no `--yes`, no report of what was deleted, and no undo. The draft
|
|
711
|
+
* may be the only record of a lesson trained somewhere else, whose recipe the operator no longer has.
|
|
712
|
+
*/
|
|
713
|
+
export declare function patchRm(ctx: CliContext, id: string, opts?: {
|
|
714
|
+
yes?: boolean;
|
|
715
|
+
}): Promise<void>;
|
|
716
|
+
export interface SharedBody {
|
|
717
|
+
id: string;
|
|
718
|
+
name: string;
|
|
719
|
+
status: string;
|
|
720
|
+
sales: number;
|
|
721
|
+
}
|
|
722
|
+
export interface ForgetResult {
|
|
723
|
+
ok: true;
|
|
724
|
+
patch_id: string;
|
|
725
|
+
sha256: string;
|
|
726
|
+
deleted_file: boolean;
|
|
727
|
+
also_affects: SharedBody[];
|
|
728
|
+
}
|
|
729
|
+
/** `ainize patch forget <id>` — stop serving the knowledge file from this node (the public record is untouched). */
|
|
730
|
+
/**
|
|
731
|
+
* `ainize patch forget <id>` — stop serving the body from this node. The file is content-addressed, so it is also
|
|
732
|
+
* the body of every other id trained from the same output: the node refuses and lists them, and `--all-sharing`
|
|
733
|
+
* is the operator saying yes to the whole list (item 149).
|
|
734
|
+
*/
|
|
735
|
+
export declare function patchForget(ctx: CliContext, id: string, opts?: {
|
|
736
|
+
allSharing?: boolean;
|
|
737
|
+
}): Promise<ForgetResult>;
|
|
738
|
+
/**
|
|
739
|
+
* `ainize use <id>` — the one-line consumer path: check it is verified, pay automatically (x402), download,
|
|
740
|
+
* verify the body hash and load it into this node's model. Falls back gracefully when the runtime is off.
|
|
741
|
+
*/
|
|
742
|
+
export declare function patchUse(ctx: CliContext, id: string, opts?: BuyArgs): Promise<PurchaseResult | {
|
|
743
|
+
already: true;
|
|
744
|
+
}>;
|
|
745
|
+
/** `recipe.json` as served by `GET /api/teach/jobs/:id/recipe` (trainer recipe + node-side `lesson` block + `benchmark`); every field optional. */
|
|
746
|
+
export interface LessonRecipe {
|
|
747
|
+
model_id?: string;
|
|
748
|
+
model?: {
|
|
749
|
+
id_M?: string;
|
|
750
|
+
[k: string]: unknown;
|
|
751
|
+
};
|
|
752
|
+
facts?: {
|
|
753
|
+
prompt: string;
|
|
754
|
+
answer: string;
|
|
755
|
+
alt_prompt?: string;
|
|
756
|
+
}[];
|
|
757
|
+
benchmark_samples?: {
|
|
758
|
+
prompt: string;
|
|
759
|
+
expect: string;
|
|
760
|
+
}[];
|
|
761
|
+
benchmark?: Partial<BenchmarkSpec> & {
|
|
762
|
+
schema?: string;
|
|
763
|
+
};
|
|
764
|
+
lesson?: {
|
|
765
|
+
job_id?: string;
|
|
766
|
+
draft_id?: string | null;
|
|
767
|
+
name?: string;
|
|
768
|
+
model_id?: string;
|
|
769
|
+
sha256?: string;
|
|
770
|
+
rows?: number;
|
|
771
|
+
filename?: string;
|
|
772
|
+
facts?: {
|
|
773
|
+
prompt: string;
|
|
774
|
+
answer: string;
|
|
775
|
+
alt_prompt?: string;
|
|
776
|
+
}[];
|
|
777
|
+
contributor?: {
|
|
778
|
+
address: string;
|
|
779
|
+
name?: string;
|
|
780
|
+
};
|
|
781
|
+
context_patch_ids?: string[];
|
|
782
|
+
builds_on_context?: boolean;
|
|
783
|
+
node?: {
|
|
784
|
+
address?: string;
|
|
785
|
+
name?: string;
|
|
786
|
+
url?: string;
|
|
787
|
+
};
|
|
788
|
+
};
|
|
789
|
+
[k: string]: unknown;
|
|
790
|
+
}
|
|
791
|
+
export interface ImportArgs {
|
|
792
|
+
file: string;
|
|
793
|
+
recipe: string;
|
|
794
|
+
id?: string;
|
|
795
|
+
name?: string;
|
|
796
|
+
model?: string;
|
|
797
|
+
price?: string;
|
|
798
|
+
license?: string;
|
|
799
|
+
description?: string;
|
|
800
|
+
dropLineage?: boolean;
|
|
801
|
+
}
|
|
802
|
+
export interface ImportResult {
|
|
803
|
+
anchor: PatchAnchor;
|
|
804
|
+
sha256: string;
|
|
805
|
+
sha_matches: boolean | null;
|
|
806
|
+
model_matches: boolean | null;
|
|
807
|
+
first_prompt: string | null;
|
|
808
|
+
}
|
|
809
|
+
/** What the draft is built from — pure, so the unit test can pin the mapping without a node. */
|
|
810
|
+
export declare function draftFromRecipe(file: string, r: LessonRecipe, a?: Partial<ImportArgs>): {
|
|
811
|
+
id: string;
|
|
812
|
+
name: string;
|
|
813
|
+
model_id: string | undefined;
|
|
814
|
+
benchmark: BenchmarkSpec;
|
|
815
|
+
description: string;
|
|
816
|
+
contributors?: Contributor[];
|
|
817
|
+
parents: string[];
|
|
818
|
+
first_prompt: string | null;
|
|
819
|
+
};
|
|
820
|
+
/**
|
|
821
|
+
* Import a downloaded lesson (`lesson-<slug>.npz` + `recipe.json`) as a PRIVATE draft on this node: the file stays where it is
|
|
822
|
+
* (`keepInPlace`), the benchmark comes from the recipe, nothing is announced and no ledger record is written.
|
|
823
|
+
* The data provider is kept on the draft as credit only (share 0) and the origin is `teach`, so a later `patch announce`
|
|
824
|
+
* still shows "Taught by …" — raise the share with `PATCH /api/patches/:id` / the web form before announcing if you want to pay them.
|
|
825
|
+
*/
|
|
826
|
+
export declare function patchImport(ctx: CliContext, a: ImportArgs): Promise<ImportResult>;
|
|
827
|
+
export interface ByNameArgs extends BuyArgs, ResolveOptions {
|
|
828
|
+
/** stop after resolving and printing where the name points — do not buy anything */
|
|
829
|
+
resolveOnly?: boolean;
|
|
830
|
+
/** do not add the seller's node as a peer (the blob then has to come from somewhere this node already knows) */
|
|
831
|
+
noPeer?: boolean;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* One line to use knowledge somebody else published, given only its name.
|
|
835
|
+
*
|
|
836
|
+
* This replaces a three-command sequence in which the operator carried an id between two machines by hand:
|
|
837
|
+
*
|
|
838
|
+
* ainize patch ls --node http://their-node:3402 --status LISTED -q "<topic>"
|
|
839
|
+
* ainize login && ainize use <id>
|
|
840
|
+
*
|
|
841
|
+
* WHAT THE NAME SUPPLIES is exactly what those commands supplied by hand: `ainize.node` is the `--node` of the
|
|
842
|
+
* first line, `ainize.patch` is the `<id>` of the third. Nothing else changes, and in particular THE BUYING
|
|
843
|
+
* STILL HAPPENS ON YOUR OWN NODE. `--node` in `patch ls` points at the seller because you are reading their
|
|
844
|
+
* catalogue; `use` has always run against your node, because your node is what pays, downloads and applies.
|
|
845
|
+
* Resolving a name must not quietly move that: a command that logged you into someone else's node and applied
|
|
846
|
+
* knowledge there would be a different operation wearing this one's name.
|
|
847
|
+
*
|
|
848
|
+
* So the seller's endpoint is used for the one thing it is for — telling your node where to fetch from, as a
|
|
849
|
+
* peer — and the rest of the flow is the local one you would have typed.
|
|
850
|
+
*/
|
|
851
|
+
export declare function patchByName(ctx: CliContext, name: string, a?: ByNameArgs): Promise<unknown>;
|
|
852
|
+
//# sourceMappingURL=patch.d.ts.map
|