@needmoretruth/nmts-cli 0.43.0 → 0.44.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/AGENTS.md +1 -1
- package/CHANGELOG.md +23 -0
- package/README.ko.md +8 -2
- package/README.md +8 -2
- package/dist/account.d.ts +7 -3
- package/dist/account.js +46 -19
- package/dist/arg-options.d.ts +16 -0
- package/dist/args.js +5 -2
- package/dist/artifact-about.d.ts +1 -1
- package/dist/commands/ai-account.d.ts +34 -0
- package/dist/commands/ai-account.js +260 -0
- package/dist/commands/balance.d.ts +68 -0
- package/dist/commands/balance.js +11 -1
- package/dist/commands/extend.d.ts +3 -0
- package/dist/commands/extend.js +1 -0
- package/dist/commands/login.js +2 -2
- package/dist/commands/push-wallet.js +4 -1
- package/dist/commands/push.d.ts +3 -0
- package/dist/commands/put-payer.d.ts +3 -1
- package/dist/commands/put-payer.js +13 -1
- package/dist/commands/put-wallet.d.ts +31 -0
- package/dist/commands/put-wallet.js +84 -10
- package/dist/commands/put.d.ts +5 -0
- package/dist/commands/whoami.d.ts +4 -0
- package/dist/commands/whoami.js +14 -1
- package/dist/crypto-surface.d.ts +11 -0
- package/dist/crypto-surface.js +6 -0
- package/dist/drive-edit/tree.d.ts +12 -0
- package/dist/drive-edit/tree.js +25 -4
- package/dist/drive-erase.d.ts +5 -3
- package/dist/drive-erase.js +7 -2
- package/dist/help-options.d.ts +2 -0
- package/dist/help-options.js +142 -0
- package/dist/help.js +10 -123
- package/dist/main.js +14 -19
- package/dist/mcp-tools/reads.js +4 -3
- package/dist/portable.d.ts +1 -1
- package/dist/portable.js +1 -1
- package/dist/product.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/refill-source.d.ts +69 -0
- package/dist/refill-source.js +143 -0
- package/dist/risk.d.ts +12 -0
- package/dist/risk.js +16 -0
- package/dist/shared/lib/wallet/activity.js +23 -1
- package/dist/standing-tip.d.ts +26 -0
- package/dist/standing-tip.js +31 -0
- package/dist/upload-wallet-plan.d.ts +8 -0
- package/dist/upload-wallet-plan.js +12 -3
- package/dist/walrus.d.ts +9 -1
- package/dist/walrus.js +17 -3
- package/docs/commands/ai-account.md +25 -0
- package/docs/commands/login.md +4 -3
- package/docs/commands/verify.md +1 -1
- package/docs/commands/whoami.md +4 -0
- package/examples/podman.sh +48 -0
- package/package.json +2 -1
- package/server.json +2 -2
- package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +42 -6
- package/vendor/nmts-crypto/nmts_crypto_wasm.js +105 -2
- package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
- package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm.d.ts +9 -4
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// Taking a file that credits paid for and handing it back as something a wallet can pay for:
|
|
2
|
+
// finding it in the sealed list, and getting its plaintext onto this machine once.
|
|
3
|
+
//
|
|
4
|
+
// ⛔ WHY IT IS A DOWNLOAD AND A RE-SEAL RATHER THAN A MOVE. Storage on the network is bought for
|
|
5
|
+
// particular bytes under a particular blob id, and the treasury owns the storage under a
|
|
6
|
+
// credit-paid part. Nothing on the chain can transfer that object to somebody's own wallet, and
|
|
7
|
+
// nothing in NMTS can re-point an existing part at storage bought elsewhere. So the only honest
|
|
8
|
+
// shape is: read the file out, seal it again, buy storage for the new sealing, and let the old
|
|
9
|
+
// file go to the trash — which is what `put --pay wallet --from <path>` does.
|
|
10
|
+
//
|
|
11
|
+
// ⛔ THE PLAINTEXT LANDS IN THIS TOOL'S OWN DIRECTORY, NOT IN THE SYSTEM TEMPORARY ONE. It is
|
|
12
|
+
// somebody's decrypted file; `/tmp` is world-listable on every machine this runs on, and a name
|
|
13
|
+
// other accounts can see is a name they can watch for. The config directory is 0700 where the
|
|
14
|
+
// platform honours it, the file itself is 0600 (`fileSink`), and it is removed on every path out
|
|
15
|
+
// including the failing ones.
|
|
16
|
+
//
|
|
17
|
+
// ⚠ IT IS A COPY ON DISK FOR AS LONG AS THE UPLOAD TAKES, and that is the price of not holding a
|
|
18
|
+
// whole file in memory. A caller who cannot pay it should download and upload by hand, which is
|
|
19
|
+
// the same two acts with the copy in a place they chose.
|
|
20
|
+
import { mkdirSync, rmSync } from "node:fs";
|
|
21
|
+
import { randomBytes } from "node:crypto";
|
|
22
|
+
import { join } from "node:path";
|
|
23
|
+
import { configDir } from "./credentials.js";
|
|
24
|
+
import { setTrashed } from "./item-trash.js";
|
|
25
|
+
import { applyManyToList } from "./manifest-write.js";
|
|
26
|
+
import { fetchFile } from "./download.js";
|
|
27
|
+
import { fileSink } from "./download-sink-node.js";
|
|
28
|
+
import { buildIndex, entryAt, fullPathOf, isLive, KIND_FILE, normalisePath } from "./drive-paths.js";
|
|
29
|
+
import { NmtsError } from "./errors.js";
|
|
30
|
+
import { BINARY_NAME } from "./product.js";
|
|
31
|
+
/**
|
|
32
|
+
* The live file a drive path names, with the place the replacement goes.
|
|
33
|
+
*
|
|
34
|
+
* ⛔ A FOLDER, A TRASHED FILE AND A FILE WITH NO KEY ARE ALL REFUSED HERE, before anything is
|
|
35
|
+
* priced. Each one would fail later, after a price had been quoted and possibly after money had
|
|
36
|
+
* moved, and the third would fail in the worst place of all: the download.
|
|
37
|
+
*/
|
|
38
|
+
export function findOriginal(entries, path) {
|
|
39
|
+
const wanted = normalisePath(path);
|
|
40
|
+
const index = buildIndex(entries);
|
|
41
|
+
const entry = entryAt(entries, wanted, { nothingHappened: "Nothing was signed and nothing was sent." });
|
|
42
|
+
if (entry.kind !== KIND_FILE) {
|
|
43
|
+
throw new NmtsError(`"${wanted}" is a folder.`, {
|
|
44
|
+
exitCode: 4,
|
|
45
|
+
nextStep: `Nothing was signed. --from takes one file at a time.`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (!isLive(index, entry)) {
|
|
49
|
+
throw new NmtsError(`"${wanted}" is in the trash.`, {
|
|
50
|
+
exitCode: 4,
|
|
51
|
+
nextStep: `Nothing was signed. \`${BINARY_NAME} restore\` brings it back, and then this can re-upload it.`,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (entry.dekWrapped === undefined) {
|
|
55
|
+
throw new NmtsError(`The file list holds no key for "${wanted}".`, {
|
|
56
|
+
exitCode: 4,
|
|
57
|
+
nextStep: `Nothing was signed. Without it nothing can open the stored bytes, so there is nothing to re-seal.`,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const full = fullPathOf(index, entry);
|
|
61
|
+
return {
|
|
62
|
+
entry,
|
|
63
|
+
name: entry.name,
|
|
64
|
+
parentId: entry.parentId,
|
|
65
|
+
destination: full.slice(0, Math.max(0, full.length - entry.name.length)).replace(/\/$/, ""),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Read one file out of the account and leave it on this machine, checked.
|
|
70
|
+
*
|
|
71
|
+
* ⛔ THE SAME READ `nmts get` MAKES, including the whole-file hash. A re-upload that sealed bytes
|
|
72
|
+
* the download had not proved would replace a good file with a corrupt one and put the good one
|
|
73
|
+
* in the trash — the one outcome this command must never produce.
|
|
74
|
+
*/
|
|
75
|
+
export async function downloadForRefill(input) {
|
|
76
|
+
const { entry } = input.original;
|
|
77
|
+
const dekWrapped = entry.dekWrapped;
|
|
78
|
+
if (dekWrapped === undefined)
|
|
79
|
+
throw new NmtsError("unreachable: an original with no key");
|
|
80
|
+
const area = join(configDir(), "refill");
|
|
81
|
+
mkdirSync(area, { recursive: true, mode: 0o700 });
|
|
82
|
+
const localPath = join(area, `${randomBytes(9).toString("hex")}.part`);
|
|
83
|
+
const remove = () => rmSync(localPath, { force: true });
|
|
84
|
+
try {
|
|
85
|
+
await fetchFile({
|
|
86
|
+
base: input.server,
|
|
87
|
+
apiKey: input.apiKey,
|
|
88
|
+
accountCode: input.code,
|
|
89
|
+
itemId: entry.id,
|
|
90
|
+
size: entry.size,
|
|
91
|
+
dekWrapped,
|
|
92
|
+
...(entry.contentHashCt === undefined ? {} : { contentHashCt: entry.contentHashCt }),
|
|
93
|
+
chain: input.network,
|
|
94
|
+
sink: fileSink(localPath, { force: true }),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
remove();
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
return { localPath, remove };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Give the new file the old one's name and put the old one in the trash — after the upload, in one
|
|
105
|
+
* write.
|
|
106
|
+
*
|
|
107
|
+
* ⛔ WHY IT IS A SECOND WRITE AND NOT AN OVERWRITE ON THE COMMIT. `collision.ts` refuses to let a
|
|
108
|
+
* per-run answer of "overwrite" take effect while this machine is in the default mode, on
|
|
109
|
+
* purpose: a program passing a flag must not be able to destroy a file. That rule is not worked
|
|
110
|
+
* around here. The upload lands as an ordinary addition — numbered beside the original if the
|
|
111
|
+
* machine renames — and only then, with the paid-for bytes safely in the list, is the name moved
|
|
112
|
+
* across and the original trashed. A person named the file they were replacing; nothing here
|
|
113
|
+
* decides that for anybody.
|
|
114
|
+
*
|
|
115
|
+
* ⛔ AND THE ORDER IS THE ONE THE WHOLE TOOL KEEPS: the new file is committed first, so a failure
|
|
116
|
+
* anywhere in this step leaves both files in the drive rather than neither. Running the same
|
|
117
|
+
* command again is not the repair for that — the file is already there under a numbered name —
|
|
118
|
+
* so what a failure here costs is a rename somebody does by hand, never bytes.
|
|
119
|
+
*
|
|
120
|
+
* ⚠ IT IS DECIDED AGAIN ON EVERY ATTEMPT of the compare-and-swap, which is what makes it safe to
|
|
121
|
+
* replay: a list where another device already trashed the original, or where this run's own
|
|
122
|
+
* earlier attempt already renamed the new file, produces no intent for that half.
|
|
123
|
+
*/
|
|
124
|
+
export async function settleRefill(input, original, newItemId) {
|
|
125
|
+
const at = Date.now();
|
|
126
|
+
const result = await applyManyToList(input, (entries) => {
|
|
127
|
+
const intents = [];
|
|
128
|
+
const old = entries.find((e) => e.id === original.entry.id);
|
|
129
|
+
if (old !== undefined && old.deletedAt === undefined) {
|
|
130
|
+
intents.push({ op: "trash", ids: [original.entry.id], at });
|
|
131
|
+
}
|
|
132
|
+
const fresh = entries.find((e) => e.id === newItemId);
|
|
133
|
+
if (fresh !== undefined && fresh.name !== original.name) {
|
|
134
|
+
intents.push({ op: "rename", id: newItemId, name: original.name, at });
|
|
135
|
+
}
|
|
136
|
+
return intents;
|
|
137
|
+
});
|
|
138
|
+
// ⛔ THE SERVER IS TOLD LAST, and a 404 there is "already in that state" (`item-trash.ts`). Until
|
|
139
|
+
// this line the original is a live row the account still holds — which is the harmless
|
|
140
|
+
// direction: it is restorable, it still expires on its own, and `nmts rm` finishes the job.
|
|
141
|
+
await setTrashed(input.server, input.apiKey, original.entry.id, true);
|
|
142
|
+
return result.seq;
|
|
143
|
+
}
|
package/dist/risk.d.ts
CHANGED
|
@@ -50,6 +50,9 @@ export declare const ACTS: {
|
|
|
50
50
|
readonly losses: {
|
|
51
51
|
readonly tier: "none";
|
|
52
52
|
};
|
|
53
|
+
readonly "ai-account": {
|
|
54
|
+
readonly tier: "none";
|
|
55
|
+
};
|
|
53
56
|
readonly "public-code": {
|
|
54
57
|
readonly tier: "none";
|
|
55
58
|
};
|
|
@@ -335,6 +338,10 @@ export declare const ACTS: {
|
|
|
335
338
|
readonly what: "Create a new account under the Terms in force.";
|
|
336
339
|
readonly asksItself: true;
|
|
337
340
|
};
|
|
341
|
+
readonly "ai-account.create": {
|
|
342
|
+
readonly tier: "high";
|
|
343
|
+
readonly what: "Make a new account for an AI to work in, under the Terms in force.";
|
|
344
|
+
};
|
|
338
345
|
readonly "accept-terms.accept": {
|
|
339
346
|
readonly tier: "high";
|
|
340
347
|
readonly what: "Accept a new version of the Terms for this account.";
|
|
@@ -345,6 +352,11 @@ export declare const ACTS: {
|
|
|
345
352
|
readonly what: "Erase this account's server record, permanently.";
|
|
346
353
|
readonly asksItself: true;
|
|
347
354
|
};
|
|
355
|
+
readonly "ai-account.delete": {
|
|
356
|
+
readonly tier: "ultra-high";
|
|
357
|
+
readonly what: "Erase an AI account this one made, and everything in it, permanently.";
|
|
358
|
+
readonly asksItself: true;
|
|
359
|
+
};
|
|
348
360
|
readonly erase: {
|
|
349
361
|
readonly tier: "ultra-high";
|
|
350
362
|
readonly what: "Erase files for good: the server's record and this account's key to them.";
|
package/dist/risk.js
CHANGED
|
@@ -35,6 +35,9 @@ export const ACTS = {
|
|
|
35
35
|
trial: { tier: "none" },
|
|
36
36
|
expiring: { tier: "none" },
|
|
37
37
|
losses: { tier: "none" },
|
|
38
|
+
// Reading which accounts this one has made for an AI. The two acts that change something are
|
|
39
|
+
// below, under the tiers they belong to.
|
|
40
|
+
"ai-account": { tier: "none" },
|
|
38
41
|
"public-code": { tier: "none" },
|
|
39
42
|
wallet: { tier: "none" },
|
|
40
43
|
get: { tier: "none" },
|
|
@@ -132,9 +135,20 @@ export const ACTS = {
|
|
|
132
135
|
"whoami.reveal": { tier: "high", lock: "reveal", what: "Print the NMTS key on this screen." },
|
|
133
136
|
kit: { tier: "high", lock: "kit", what: "Write the NMTS key into a recovery kit file on this disk." },
|
|
134
137
|
create: { tier: "high", what: "Create a new account under the Terms in force.", asksItself: true },
|
|
138
|
+
// ⛔ BESIDE `create`, BECAUSE IT IS THE SAME ACT aimed at a new account: it makes an account under
|
|
139
|
+
// the Terms in force, and the acceptance recorded for it is this caller's own. It does not ask
|
|
140
|
+
// itself — there is no version for anybody to type, so the gate takes the yes.
|
|
141
|
+
"ai-account.create": { tier: "high", what: "Make a new account for an AI to work in, under the Terms in force." },
|
|
135
142
|
"accept-terms.accept": { tier: "high", what: "Accept a new version of the Terms for this account.", asksItself: true },
|
|
136
143
|
// ── ultra-high: permanent destruction ──
|
|
137
144
|
"delete-account": { tier: "ultra-high", what: "Erase this account's server record, permanently.", asksItself: true },
|
|
145
|
+
// ⛔ THE SAME ERASURE, AIMED AT AN ACCOUNT THIS ONE MADE — the row, the files, the keys and the
|
|
146
|
+
// shares in both directions. It types the same sentence `delete-account` does.
|
|
147
|
+
"ai-account.delete": {
|
|
148
|
+
tier: "ultra-high",
|
|
149
|
+
what: "Erase an AI account this one made, and everything in it, permanently.",
|
|
150
|
+
asksItself: true,
|
|
151
|
+
},
|
|
138
152
|
erase: { tier: "ultra-high", what: "Erase files for good: the server's record and this account's key to them.", asksItself: true },
|
|
139
153
|
"erase.release": {
|
|
140
154
|
tier: "ultra-high",
|
|
@@ -190,6 +204,8 @@ export function actOf(args) {
|
|
|
190
204
|
return args.pay === "wallet" ? "push.wallet" : "push";
|
|
191
205
|
case "key":
|
|
192
206
|
return sub === "new" ? "key.new" : sub === "revoke" ? "key.revoke" : "key";
|
|
207
|
+
case "ai-account":
|
|
208
|
+
return sub === "create" ? "ai-account.create" : sub === "delete" ? "ai-account.delete" : "ai-account";
|
|
193
209
|
case "openers":
|
|
194
210
|
return sub === "add" ? "openers.add" : sub === "remove" ? "openers.remove" : "openers";
|
|
195
211
|
case "trial":
|
|
@@ -83,6 +83,25 @@ function inputObjectIds(tx) {
|
|
|
83
83
|
}
|
|
84
84
|
return ids;
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* One balance change's amount, or null when the RPC's figure is not a whole decimal number.
|
|
88
|
+
*
|
|
89
|
+
* ⛔ WHY NULL RATHER THAN ZERO, AND WHY IT IS CHECKED AT ALL. `BigInt("1.5")` and `BigInt("")`
|
|
90
|
+
* THROW, and this parse sits inside `toActivityRow`, which the list runs once per transaction —
|
|
91
|
+
* so ONE malformed figure from ONE entry threw all the way out and the whole activity list came
|
|
92
|
+
* up EMPTY, with nothing on screen to say why. The declared type says `string`, but the value
|
|
93
|
+
* arrives as JSON from a public mirror we do not control, so the shape is a claim, not a fact.
|
|
94
|
+
* ▶ A figure that cannot be read is ONE entry that cannot be priced: that entry is dropped and
|
|
95
|
+
* every other row still stands. Zero would be worse than dropping it — it would print a real
|
|
96
|
+
* movement as "0", which is the "not knowing drawn as nothing happened" this file forbids.
|
|
97
|
+
*/
|
|
98
|
+
function amountOf(raw) {
|
|
99
|
+
if (typeof raw !== "string")
|
|
100
|
+
return null;
|
|
101
|
+
const text = raw.trim();
|
|
102
|
+
// The regex is what makes BigInt total here: only an optionally-signed run of digits reaches it.
|
|
103
|
+
return /^-?\d+$/.test(text) ? BigInt(text) : null;
|
|
104
|
+
}
|
|
86
105
|
/** The functions of the Walrus `system` module whose names we know → our kind. */
|
|
87
106
|
const WALRUS_FUNCTION_KIND = {
|
|
88
107
|
register_blob: "seal",
|
|
@@ -114,7 +133,10 @@ export function toActivityRow(tx, ctx) {
|
|
|
114
133
|
if (owner === null)
|
|
115
134
|
continue;
|
|
116
135
|
const normalized = normalizeAddress(owner);
|
|
117
|
-
const amount =
|
|
136
|
+
const amount = change.amount === undefined ? 0n : amountOf(change.amount);
|
|
137
|
+
// An entry whose figure we cannot read is skipped; the rest of the transaction is still a row.
|
|
138
|
+
if (amount === null)
|
|
139
|
+
continue;
|
|
118
140
|
if (normalized === me) {
|
|
119
141
|
const coinType = change.coinType ?? "";
|
|
120
142
|
changes.push({
|
package/dist/standing-tip.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { type DonationConfig } from "./commands/wallet-donate.ts";
|
|
2
2
|
import type { Network } from "./network.ts";
|
|
3
3
|
import type { SignTransfer } from "./wallet-sign.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Where a standing gift goes, per network — written into the build, not asked for.
|
|
6
|
+
*
|
|
7
|
+
* ⛔ THE RECEIVING ADDRESS IS NOT THE SERVER'S TO CHOOSE. Until now it was whatever `--server`
|
|
8
|
+
* answered and only its SHAPE was checked, so one wrong or hostile server collected every
|
|
9
|
+
* standing gift from every machine pointed at it — silently, because a well-formed address is
|
|
10
|
+
* indistinguishable from the right one. The browser never had that hole: its address comes from
|
|
11
|
+
* the build the owner ships. This is that same value, and the server's answer is held against
|
|
12
|
+
* it below.
|
|
13
|
+
*
|
|
14
|
+
* ⚠ ONE STRING UNDER TWO NETWORKS, and that is a fact rather than a placeholder: a Sui address
|
|
15
|
+
* belongs to a keypair, not to a network, so the owner's wallet is the same address on both. The
|
|
16
|
+
* table is per network so that the day one of them moves there is a line to change.
|
|
17
|
+
*
|
|
18
|
+
* ⛔ IT IS A PUBLIC VALUE, NOT A SECRET. An address is what you hand out to be paid — the site
|
|
19
|
+
* prints this one on the donation card — and the key behind it is nowhere near this package.
|
|
20
|
+
*/
|
|
21
|
+
export declare const TIP_ADDRESS: Readonly<Record<Network, string>>;
|
|
4
22
|
/** The owner's thank-you, in both languages, printed after every gift whatever its size. */
|
|
5
23
|
export declare const THANKS_EN = "Thank you for your gift. Honestly, I did not know anyone would. Thank you.";
|
|
6
24
|
export declare const THANKS_KO = "\uD6C4\uC6D0\uD574 \uC8FC\uC154\uC11C \uC815\uB9D0 \uAC10\uC0AC\uD569\uB2C8\uB2E4. \uC0AC\uC2E4 \uC800\uB294 \uD6C4\uC6D0\uD574 \uC904 \uC0AC\uB78C\uC774 \uC788\uC744 \uAC70\uB77C\uACE0\uB3C4 \uBAB0\uB790\uC2B5\uB2C8\uB2E4. \uC815\uB9D0 \uAC10\uC0AC\uD569\uB2C8\uB2E4.";
|
|
@@ -19,6 +37,14 @@ export interface StandingTipInput {
|
|
|
19
37
|
* a balance nobody was looking at, and the payment above named this one. */
|
|
20
38
|
wallet: number;
|
|
21
39
|
say: (line: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Send to the address THIS SERVER names, even when it is not the one pinned above.
|
|
42
|
+
*
|
|
43
|
+
* ⛔ OFF BY DEFAULT AND IT HAS TO STAY THAT WAY. It exists for somebody running their own NMTS
|
|
44
|
+
* server, whose developer address is their own and is not ours; switching it on for a server
|
|
45
|
+
* you do not run hands that server every standing gift this machine sends.
|
|
46
|
+
*/
|
|
47
|
+
trustServerAddress?: boolean;
|
|
22
48
|
/** Seams for tests. */
|
|
23
49
|
readDonation?: (server: string) => Promise<DonationConfig>;
|
|
24
50
|
sign?: SignTransfer;
|
package/dist/standing-tip.js
CHANGED
|
@@ -16,6 +16,27 @@ import { asDonationConfig } from "./commands/wallet-donate.js";
|
|
|
16
16
|
import { isValidSuiAddress } from "./shared/lib/wallet/send-rules.js";
|
|
17
17
|
import { percentText, tipFromTenths } from "./shared/lib/wallet/tip.js";
|
|
18
18
|
import { coinAmount, walCoinType } from "./wallet.js";
|
|
19
|
+
/**
|
|
20
|
+
* Where a standing gift goes, per network — written into the build, not asked for.
|
|
21
|
+
*
|
|
22
|
+
* ⛔ THE RECEIVING ADDRESS IS NOT THE SERVER'S TO CHOOSE. Until now it was whatever `--server`
|
|
23
|
+
* answered and only its SHAPE was checked, so one wrong or hostile server collected every
|
|
24
|
+
* standing gift from every machine pointed at it — silently, because a well-formed address is
|
|
25
|
+
* indistinguishable from the right one. The browser never had that hole: its address comes from
|
|
26
|
+
* the build the owner ships. This is that same value, and the server's answer is held against
|
|
27
|
+
* it below.
|
|
28
|
+
*
|
|
29
|
+
* ⚠ ONE STRING UNDER TWO NETWORKS, and that is a fact rather than a placeholder: a Sui address
|
|
30
|
+
* belongs to a keypair, not to a network, so the owner's wallet is the same address on both. The
|
|
31
|
+
* table is per network so that the day one of them moves there is a line to change.
|
|
32
|
+
*
|
|
33
|
+
* ⛔ IT IS A PUBLIC VALUE, NOT A SECRET. An address is what you hand out to be paid — the site
|
|
34
|
+
* prints this one on the donation card — and the key behind it is nowhere near this package.
|
|
35
|
+
*/
|
|
36
|
+
export const TIP_ADDRESS = {
|
|
37
|
+
mainnet: "0x5414efbeeab97a210e3ad48e458056fd62bcfc0d99ea78b632b813a6540c09c1",
|
|
38
|
+
testnet: "0x5414efbeeab97a210e3ad48e458056fd62bcfc0d99ea78b632b813a6540c09c1",
|
|
39
|
+
};
|
|
19
40
|
/** The owner's thank-you, in both languages, printed after every gift whatever its size. */
|
|
20
41
|
export const THANKS_EN = "Thank you for your gift. Honestly, I did not know anyone would. Thank you.";
|
|
21
42
|
export const THANKS_KO = "후원해 주셔서 정말 감사합니다. 사실 저는 후원해 줄 사람이 있을 거라고도 몰랐습니다. 정말 감사합니다."; // shown in Korean
|
|
@@ -33,6 +54,16 @@ export async function standingTipAfter(input) {
|
|
|
33
54
|
input.say(` Your standing ${percentText(tenths)} % gift was not sent: gifts in WAL are not open right now.`);
|
|
34
55
|
return "failed";
|
|
35
56
|
}
|
|
57
|
+
// ⛔ THE ONE CHECK THAT COSTS NOTHING AND CLOSES THE HOLE. Everything above asks whether a gift
|
|
58
|
+
// may be sent; this asks whether it is going where the person meant. A mismatch is refused
|
|
59
|
+
// rather than reported afterwards — money does not come back from a wrong address.
|
|
60
|
+
if (config.devAddress !== TIP_ADDRESS[input.network] && input.trustServerAddress !== true) {
|
|
61
|
+
input.say(` Your standing ${percentText(tenths)} % gift was not sent: this server named a different ` +
|
|
62
|
+
`receiving address than the one built into this tool for ${input.network}.`);
|
|
63
|
+
input.say(` Nothing was signed. On a server you run yourself, --trust-server-tip-address sends to ` +
|
|
64
|
+
`the address that server names.`);
|
|
65
|
+
return "failed";
|
|
66
|
+
}
|
|
36
67
|
const sign = input.sign ?? (await import("./wallet-sign.js")).signTransfer;
|
|
37
68
|
const digest = await sign({
|
|
38
69
|
network: input.network,
|
|
@@ -125,4 +125,12 @@ export declare function describeUploadReview(say: (line: string) => void, facts:
|
|
|
125
125
|
tipMist: bigint;
|
|
126
126
|
storage: StorageChoice;
|
|
127
127
|
heldResources: number | null;
|
|
128
|
+
/**
|
|
129
|
+
* Does this account ask its uploads to carry the recovery list's storage-network copy?
|
|
130
|
+
*
|
|
131
|
+
* ⚠ `null` = it could not be read. The sentence below is said for `true` AND for `null`,
|
|
132
|
+
* because silence would let somebody assume a copy rode along; only a switch known to be
|
|
133
|
+
* off buys silence.
|
|
134
|
+
*/
|
|
135
|
+
networkCopy: boolean | null;
|
|
128
136
|
}, budget: UploadBudget): void;
|
|
@@ -178,7 +178,16 @@ export function describeUploadReview(say, facts, budget) {
|
|
|
178
178
|
say(``);
|
|
179
179
|
say(` This is paid in WAL and SUI from the wallet this NMTS key derives — not from credits, which`);
|
|
180
180
|
say(` is what \`${BINARY_NAME} put\` spends without --pay wallet. Nobody, NMTS included, can reverse it.`);
|
|
181
|
-
say(` The storage is the wallet's own: NMTS records the file and does not hold it
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
say(` The storage is the wallet's own: NMTS records the file and does not hold it.`);
|
|
182
|
+
// ⛔ SAID WHERE IT CHANGES WHAT SOMEBODY GETS, AND NOWHERE ELSE. The wallet rail never carries
|
|
183
|
+
// the recovery list's copy; an account that never asked for one has nothing to be told, and
|
|
184
|
+
// the sentence was printed to everybody until this account's own switch became readable
|
|
185
|
+
// (`GET /v1/account/summary` `network_copy`, 2026-09-20).
|
|
186
|
+
if (facts.networkCopy !== false) {
|
|
187
|
+
say(facts.networkCopy === true
|
|
188
|
+
? ` This account asks for the recovery list to be copied to the storage network with its uploads.`
|
|
189
|
+
: ` Whether this account asks for the recovery list's storage-network copy could not be read.`);
|
|
190
|
+
say(` This upload does not carry that copy — only the browser's small-file uploads write one, and`);
|
|
191
|
+
say(` \`${BINARY_NAME} recovery-list\` writes the list out as a file from here.`);
|
|
192
|
+
}
|
|
184
193
|
}
|
package/dist/walrus.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Curated Walrus aggregator (read) endpoints per network, preference order.
|
|
3
|
+
*
|
|
4
|
+
* ⭐ 2026-09-22: a SECOND one per network, so "if one is down we move on" is true rather than
|
|
5
|
+
* written. Both came from the canonical operator registry (https://docs.wal.app/operators.json)
|
|
6
|
+
* and both answered `GET /v1/api` with 200 the same day. The browser's table carries the full
|
|
7
|
+
* provenance and the reason each host and not another; this copy exists because this package
|
|
8
|
+
* imports nothing from that tree, and `deploy/check-walrus-hosts.mjs` set-compares the two.
|
|
9
|
+
*/
|
|
2
10
|
export declare const AGGREGATOR_HOSTS: Readonly<Record<string, readonly string[]>>;
|
|
3
11
|
/**
|
|
4
12
|
* Curated Walrus upload-relay (write) endpoints per network, preference order.
|
package/dist/walrus.js
CHANGED
|
@@ -14,10 +14,24 @@ import { AGGREGATOR_ENV_VAR, RELAY_ENV_VAR, SUI_RPC_ENV_VAR } from "./env-vars.j
|
|
|
14
14
|
import { NmtsError } from "./errors.js";
|
|
15
15
|
import { host as runtime } from "./host.js";
|
|
16
16
|
import { reach, reachFetch } from "./reach.js";
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Curated Walrus aggregator (read) endpoints per network, preference order.
|
|
19
|
+
*
|
|
20
|
+
* ⭐ 2026-09-22: a SECOND one per network, so "if one is down we move on" is true rather than
|
|
21
|
+
* written. Both came from the canonical operator registry (https://docs.wal.app/operators.json)
|
|
22
|
+
* and both answered `GET /v1/api` with 200 the same day. The browser's table carries the full
|
|
23
|
+
* provenance and the reason each host and not another; this copy exists because this package
|
|
24
|
+
* imports nothing from that tree, and `deploy/check-walrus-hosts.mjs` set-compares the two.
|
|
25
|
+
*/
|
|
18
26
|
export const AGGREGATOR_HOSTS = {
|
|
19
|
-
testnet: [
|
|
20
|
-
|
|
27
|
+
testnet: [
|
|
28
|
+
"https://aggregator.walrus-testnet.walrus.space",
|
|
29
|
+
"https://walrus-testnet-aggregator.nodeinfra.com",
|
|
30
|
+
],
|
|
31
|
+
mainnet: [
|
|
32
|
+
"https://aggregator.walrus-mainnet.walrus.space",
|
|
33
|
+
"https://sui-walrus-mainnet-aggregator.bwarelabs.com",
|
|
34
|
+
],
|
|
21
35
|
};
|
|
22
36
|
/**
|
|
23
37
|
* Curated Walrus upload-relay (write) endpoints per network, preference order.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# nmts ai-account — accounts made under this one for an AI to work in
|
|
2
|
+
|
|
3
|
+
Commands: ai-account
|
|
4
|
+
Tiers: ai-account=none · ai-account.create=high · ai-account.delete=ultra-high
|
|
5
|
+
|
|
6
|
+
An AI account is an ordinary NMTS account with its own NMTS key, its own wallet and its own empty
|
|
7
|
+
drive, made under this one. It exists so that a program never has to be handed this account's key,
|
|
8
|
+
which would hand it the files, the wallet and the right to erase. Files reach it by being shared
|
|
9
|
+
with it; credits and coins reach it the way they reach any account.
|
|
10
|
+
|
|
11
|
+
All three verbs need the NMTS key on this machine and prove it the way a sign-in does. An API key
|
|
12
|
+
cannot reach any of them, on purpose: an agent that could make AI accounts could make more of
|
|
13
|
+
itself, and revoking its key would mean nothing.
|
|
14
|
+
|
|
15
|
+
`ai-account` and `ai-account list` read, and print one line per account: its place (1 to 3), its
|
|
16
|
+
account id, whether it is active or stopped, and the day it was made.
|
|
17
|
+
|
|
18
|
+
`ai-account create [place]` makes one at the lowest free place, or at the place you name. The new
|
|
19
|
+
account's NMTS key is derived here from this account's key and that place — it is never sent — and
|
|
20
|
+
printed once. The same place always gives the same key back, so a place that is erased can be
|
|
21
|
+
re-used and a key that is lost can be derived again. The first one under an account is made in a
|
|
22
|
+
browser instead: turning the feature on costs a human check no terminal can pass.
|
|
23
|
+
|
|
24
|
+
`ai-account delete <account id>` erases one and everything in it, permanently. It types the same
|
|
25
|
+
sentence erasing an account does, and no auto mode reaches it.
|
package/docs/commands/login.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Commands: login
|
|
4
4
|
Tiers: login=none · login.plain=high(unsafe-code-storage) · login.env=high(plain-env)
|
|
5
5
|
|
|
6
|
-
`nmts login`
|
|
7
|
-
(`NMTS_API_KEY_FILE`, `NMTS_API_KEY`) with the
|
|
8
|
-
|
|
6
|
+
`nmts login` takes the NMTS key or its 15-word recovery phrase, stores the key sealed under a
|
|
7
|
+
passphrase, checks whichever API key it finds (`NMTS_API_KEY_FILE`, `NMTS_API_KEY`) with the
|
|
8
|
+
server, and stores that too. It prints the key's public handle and never the key. It does not
|
|
9
|
+
replace a stored key unless the run says so.
|
|
9
10
|
|
|
10
11
|
Every later command needs the passphrase, from `NMTS_PASSPHRASE` or a terminal. A sealed key with
|
|
11
12
|
no passphrase in reach is not a usable credential; `nmts env` says which case this machine is in.
|
package/docs/commands/verify.md
CHANGED
|
@@ -4,7 +4,7 @@ Commands: verify
|
|
|
4
4
|
Tiers: verify=none
|
|
5
5
|
|
|
6
6
|
The server keeps "has a person checked in lately" as a separate question from "is this a valid
|
|
7
|
-
key", and the answer expires every
|
|
7
|
+
key", and the answer expires every twelve weeks. It does not gate the work: reading, writing,
|
|
8
8
|
listing, folders, the trash, the recovery files and the wallet's balances never ask about it.
|
|
9
9
|
Exactly three things do — making another account, the free trial, and creating a share — and
|
|
10
10
|
while it is lapsed the account runs in a tighter rate tier (slower, not refused) and some requests
|
package/docs/commands/whoami.md
CHANGED
|
@@ -10,3 +10,7 @@ to a program.
|
|
|
10
10
|
key — so it is locked until a person runs `nmts unlock reveal` at a terminal, and then asked about
|
|
11
11
|
on every run in every mode but skip-permissions. Never write the NMTS key anywhere it can be read
|
|
12
12
|
again: a log, a commit, a file, a message. It is the only key to the account and cannot be rotated.
|
|
13
|
+
|
|
14
|
+
`--reveal --phrase` prints the same key as its 15-word recovery phrase (BIP-39, the English list;
|
|
15
|
+
`--lang ko` for the Korean one). It is the key in words, under the same lock and the same warning:
|
|
16
|
+
whoever reads the phrase opens the account.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Running this tool in a rootless Podman container, with the NMTS key handed in as a secret.
|
|
3
|
+
#
|
|
4
|
+
# sh examples/podman.sh ls
|
|
5
|
+
# sh examples/podman.sh put ./notes.txt
|
|
6
|
+
#
|
|
7
|
+
# ⛔ THE KEY IS NEVER AN ENVIRONMENT VALUE. `podman inspect` prints a container's whole environment,
|
|
8
|
+
# and so does `docker inspect`; a variable holding the key hands it to anybody who can run
|
|
9
|
+
# either. What the variable below holds is a PATH. The key itself arrives on a tmpfs that Podman
|
|
10
|
+
# mounts for this container alone, and it is not in the image, not in the history, and not in the
|
|
11
|
+
# inspect output.
|
|
12
|
+
#
|
|
13
|
+
# ⛔ NOTHING HERE NEEDS ROOT. Podman builds, stores the secret and runs the container as the user
|
|
14
|
+
# who invoked it; the image runs as an ordinary user inside that. `sudo` on any line of this file
|
|
15
|
+
# would make the config volume root's and the tool unable to write to it.
|
|
16
|
+
#
|
|
17
|
+
# ⚠ THE SECRET IS STORED UNTIL IT IS REMOVED. `podman secret rm nmts-key` takes it out again. It
|
|
18
|
+
# lives in the invoking user's own Podman store, readable by that user — the same standing as the
|
|
19
|
+
# file it came from, which is why this is worth nothing if that file is world-readable.
|
|
20
|
+
set -eu
|
|
21
|
+
|
|
22
|
+
# The file on THIS machine that holds the NMTS key. The same variable name the tool reads on a
|
|
23
|
+
# machine with no container, so one habit covers both.
|
|
24
|
+
key_file="${NMTS_ACCOUNT_CODE_FILE:?name the file holding your NMTS key in NMTS_ACCOUNT_CODE_FILE}"
|
|
25
|
+
image=nmts
|
|
26
|
+
secret=nmts-key
|
|
27
|
+
volume=nmts-config
|
|
28
|
+
|
|
29
|
+
# Built from the repository this file is in — there is no published image.
|
|
30
|
+
podman image exists "$image" || podman build -t "$image" .
|
|
31
|
+
|
|
32
|
+
# ⚠ Created only when it is not there. `podman secret create` on a name that exists is an error, and
|
|
33
|
+
# a script that swallowed it would keep using a secret made from an older file.
|
|
34
|
+
podman secret inspect "$secret" >/dev/null 2>&1 || podman secret create "$secret" "$key_file"
|
|
35
|
+
|
|
36
|
+
# ⛔ THE CONFIG DIRECTORY OUTLIVES THE CONTAINER, and it has to. Unlocks and the mode live there; a
|
|
37
|
+
# container that is removed takes them with it, so the wallet and sharing would ask again on
|
|
38
|
+
# every run and an upload would be refused in a mode nobody set.
|
|
39
|
+
#
|
|
40
|
+
# ⚠ `--secret <name>` mounts the value at /run/secrets/<name>. A bind mount reaches the same place
|
|
41
|
+
# — `--mount type=bind,src=$key_file,dst=/run/secrets/nmts-key,ro` — for a host that keeps its
|
|
42
|
+
# secrets somewhere Podman's store is not.
|
|
43
|
+
exec podman run --rm \
|
|
44
|
+
--secret "$secret" \
|
|
45
|
+
-e NMTS_ACCOUNT_CODE_FILE=/run/secrets/nmts-key \
|
|
46
|
+
-v "$volume":/config \
|
|
47
|
+
-e NMTS_CONFIG_DIR=/config \
|
|
48
|
+
"$image" "$@"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needmoretruth/nmts-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "Command-line and MCP access to NMTS (NeedMoreTruthStorage, https://nmts.me): open-source, end-to-end encrypted storage on the Walrus network. No fee to NMTS; you pay the network from your own wallet. For people and for their agents.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
"files": [
|
|
123
123
|
"dist",
|
|
124
124
|
"vendor",
|
|
125
|
+
"examples",
|
|
125
126
|
"README.md",
|
|
126
127
|
"AGENTS.md",
|
|
127
128
|
"docs",
|
package/server.json
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
"url": "https://github.com/needmoretruth/nmts-cli",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.44.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
14
14
|
"identifier": "@needmoretruth/nmts-cli",
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.44.0",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|