@needmoretruth/nmts-cli 0.43.0 → 0.45.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.
Files changed (86) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +35 -0
  3. package/README.ko.md +8 -2
  4. package/README.md +8 -2
  5. package/dist/account.d.ts +7 -3
  6. package/dist/account.js +46 -19
  7. package/dist/arg-options.d.ts +22 -0
  8. package/dist/args.js +9 -3
  9. package/dist/artifact-about.d.ts +1 -1
  10. package/dist/commands/ai-account.d.ts +34 -0
  11. package/dist/commands/ai-account.js +260 -0
  12. package/dist/commands/balance.d.ts +68 -0
  13. package/dist/commands/balance.js +11 -1
  14. package/dist/commands/extend.d.ts +3 -0
  15. package/dist/commands/extend.js +1 -0
  16. package/dist/commands/get.d.ts +2 -0
  17. package/dist/commands/get.js +13 -1
  18. package/dist/commands/login.js +2 -2
  19. package/dist/commands/ls.d.ts +2 -0
  20. package/dist/commands/ls.js +18 -5
  21. package/dist/commands/push-wallet.js +4 -1
  22. package/dist/commands/push.d.ts +3 -0
  23. package/dist/commands/put-payer.d.ts +3 -1
  24. package/dist/commands/put-payer.js +13 -1
  25. package/dist/commands/put-thumbnail.d.ts +4 -0
  26. package/dist/commands/put-thumbnail.js +119 -0
  27. package/dist/commands/put-wallet.d.ts +33 -0
  28. package/dist/commands/put-wallet.js +86 -11
  29. package/dist/commands/put.d.ts +13 -0
  30. package/dist/commands/put.js +5 -0
  31. package/dist/commands/whoami.d.ts +4 -0
  32. package/dist/commands/whoami.js +14 -1
  33. package/dist/crypto-surface.d.ts +11 -0
  34. package/dist/crypto-surface.js +6 -0
  35. package/dist/drive-edit/trash.js +5 -3
  36. package/dist/drive-edit/tree.d.ts +18 -0
  37. package/dist/drive-edit/tree.js +35 -4
  38. package/dist/drive-erase.d.ts +5 -3
  39. package/dist/drive-erase.js +8 -3
  40. package/dist/drive-paths.d.ts +2 -2
  41. package/dist/drive-paths.js +2 -2
  42. package/dist/help-options.d.ts +2 -0
  43. package/dist/help-options.js +146 -0
  44. package/dist/help.js +10 -123
  45. package/dist/main.js +17 -19
  46. package/dist/mcp-tools/files.js +21 -2
  47. package/dist/mcp-tools/reads.js +13 -4
  48. package/dist/portable.d.ts +3 -2
  49. package/dist/portable.js +3 -2
  50. package/dist/product.d.ts +1 -1
  51. package/dist/product.js +1 -1
  52. package/dist/refill-source.d.ts +69 -0
  53. package/dist/refill-source.js +143 -0
  54. package/dist/risk.d.ts +12 -0
  55. package/dist/risk.js +16 -0
  56. package/dist/shared/lib/drive/manifest-codec.d.ts +11 -31
  57. package/dist/shared/lib/drive/manifest-codec.js +15 -23
  58. package/dist/shared/lib/drive/manifest-index.d.ts +10 -1
  59. package/dist/shared/lib/drive/manifest-index.js +30 -8
  60. package/dist/shared/lib/drive/manifest-wire-extras.d.ts +50 -0
  61. package/dist/shared/lib/drive/manifest-wire-extras.js +65 -0
  62. package/dist/shared/lib/drive/preview-classify.d.ts +17 -0
  63. package/dist/shared/lib/drive/preview-classify.js +96 -0
  64. package/dist/shared/lib/wallet/activity.js +23 -1
  65. package/dist/standing-tip.d.ts +26 -0
  66. package/dist/standing-tip.js +31 -0
  67. package/dist/upload-wallet-plan.d.ts +8 -0
  68. package/dist/upload-wallet-plan.js +12 -3
  69. package/dist/upload-wallet-put.d.ts +2 -0
  70. package/dist/upload-wallet-put.js +1 -0
  71. package/dist/walrus.d.ts +9 -1
  72. package/dist/walrus.js +17 -3
  73. package/docs/commands/ai-account.md +25 -0
  74. package/docs/commands/get.md +3 -0
  75. package/docs/commands/login.md +4 -3
  76. package/docs/commands/ls.md +5 -0
  77. package/docs/commands/put.md +8 -0
  78. package/docs/commands/verify.md +1 -1
  79. package/docs/commands/whoami.md +4 -0
  80. package/examples/podman.sh +48 -0
  81. package/package.json +2 -1
  82. package/server.json +2 -2
  83. package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +42 -6
  84. package/vendor/nmts-crypto/nmts_crypto_wasm.js +105 -2
  85. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
  86. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm.d.ts +9 -4
@@ -0,0 +1,17 @@
1
+ /** How a file may be shown. `none` means "not previewed", which is a valid and often correct answer. */
2
+ export type PreviewKind = "image" | "video" | "audio" | "text" | "pdf" | "none";
3
+ /**
4
+ * Decide how a file named `name` may be shown, from its extension alone.
5
+ *
6
+ * Extension-only is deliberate: the alternative is sniffing the decrypted bytes, which means
7
+ * deciding "is this really a PNG?" on content an attacker chose. An extension the person can see
8
+ * in their own file list is a worse signal about the format and a much better one about intent —
9
+ * and every branch below is safe even when the extension lies, because none of them hands the
10
+ * bytes to a renderer that would execute them.
11
+ *
12
+ * Unknown ⇒ `none`. The default must be refusal, never a guess about whether a format can execute.
13
+ */
14
+ export declare function classify(name: string): {
15
+ kind: PreviewKind;
16
+ mime: string;
17
+ };
@@ -0,0 +1,96 @@
1
+ // The one decision that decides whether a previewed file can run code. Split out of
2
+ // FilePreview.tsx during the E-stage audit (2026-07-28) so it can be tested on every commit —
3
+ // `node --test` cannot load a `.tsx`, which is the whole reason this rule went untested for as
4
+ // long as it did.
5
+ //
6
+ // WHY IT MATTERS MORE HERE THAN IN AN ORDINARY VIEWER. A file in this drive can come from ANOTHER
7
+ // PERSON (private shares). Rendering one as a live document would run it in OUR origin, and this
8
+ // origin's IndexedDB is where "remember this device" keeps the account code. Stored XSS on an E2EE
9
+ // drive is not defacement — it is key theft, and the account code has no reset (GUIDE invariant
10
+ // #10).
11
+ //
12
+ // The rendering side of the contract, in FilePreview.tsx:
13
+ // · image → `<img src=blob:>` — an <img> never executes its contents, whatever the bytes are
14
+ // · text → textContent in `<pre>` — React escapes; NEVER innerHTML
15
+ // · pdf → `<iframe sandbox="">` — no scripts, opaque origin, download fallback beside it
16
+ // · video → `<video src=blob:>` — a media element plays its bytes, it never executes them
17
+ // · audio → `<audio src=blob:>` — the same, for sound
18
+ // · none → not previewed at all — the honest fallback points at the download
19
+ //
20
+ // ⭐ 2026-09-22 (C30 ①): video and audio joined so the gallery (image ∪ video) and the music place
21
+ // (audio) can gather files by kind. Stage ① gives them no player yet — FilePreview still treats
22
+ // both as "not previewed" until the streaming stages land.
23
+ //
24
+ // Pure: no DOM, no I/O, no state.
25
+ // ⚠ THE ORDER INSIDE `classify` IS THE SAFETY PROPERTY, not this table's contents.
26
+ // `svg` is present here, and only the early return below keeps it out of an
27
+ // `<img src=blob:image/svg+xml>`. Reorder those two lines — or delete the early return as
28
+ // "dead code, svg is right there in the table" — and an SVG someone else sent becomes a live
29
+ // document that can read this origin. `web/test/preview-classify.test.ts` makes that fail.
30
+ const IMAGE_MIME = {
31
+ png: "image/png",
32
+ jpg: "image/jpeg",
33
+ jpeg: "image/jpeg",
34
+ gif: "image/gif",
35
+ webp: "image/webp",
36
+ avif: "image/avif",
37
+ bmp: "image/bmp",
38
+ svg: "image/svg+xml",
39
+ };
40
+ // ⚠ No video/audio format can carry script into a `<video>`/`<audio>` element, and none of these
41
+ // extensions is also a document format — which is what lets them sit AFTER the svg early return
42
+ // without an early return of their own.
43
+ const VIDEO_MIME = {
44
+ mp4: "video/mp4",
45
+ m4v: "video/mp4",
46
+ mov: "video/quicktime",
47
+ webm: "video/webm",
48
+ mkv: "video/x-matroska",
49
+ };
50
+ const AUDIO_MIME = {
51
+ mp3: "audio/mpeg",
52
+ m4a: "audio/mp4",
53
+ aac: "audio/aac",
54
+ flac: "audio/flac",
55
+ ogg: "audio/ogg",
56
+ opus: "audio/ogg",
57
+ wav: "audio/wav",
58
+ };
59
+ // HTML/SVG source files are TEXT here on purpose — shown as source, never rendered as a document.
60
+ const TEXT_EXT = new Set([
61
+ "txt", "text", "md", "markdown", "csv", "tsv", "json", "log", "xml",
62
+ "yaml", "yml", "ini", "conf", "toml", "js", "mjs", "ts", "css", "html", "htm", "svg",
63
+ ]);
64
+ /**
65
+ * Decide how a file named `name` may be shown, from its extension alone.
66
+ *
67
+ * Extension-only is deliberate: the alternative is sniffing the decrypted bytes, which means
68
+ * deciding "is this really a PNG?" on content an attacker chose. An extension the person can see
69
+ * in their own file list is a worse signal about the format and a much better one about intent —
70
+ * and every branch below is safe even when the extension lies, because none of them hands the
71
+ * bytes to a renderer that would execute them.
72
+ *
73
+ * Unknown ⇒ `none`. The default must be refusal, never a guess about whether a format can execute.
74
+ */
75
+ export function classify(name) {
76
+ const dot = name.lastIndexOf(".");
77
+ const ext = dot >= 0 ? name.slice(dot + 1).toLowerCase() : "";
78
+ if (ext === "svg")
79
+ return { kind: "text", mime: "text/plain" }; // source, not a rendered SVG
80
+ // Read through `hasOwn` so `constructor` or `__proto__` is never an extension; the second check is
81
+ // for the command-line build, which reads every index as possibly missing.
82
+ const image = Object.hasOwn(IMAGE_MIME, ext) ? IMAGE_MIME[ext] : undefined;
83
+ if (image !== undefined)
84
+ return { kind: "image", mime: image };
85
+ const video = Object.hasOwn(VIDEO_MIME, ext) ? VIDEO_MIME[ext] : undefined;
86
+ if (video !== undefined)
87
+ return { kind: "video", mime: video };
88
+ const audio = Object.hasOwn(AUDIO_MIME, ext) ? AUDIO_MIME[ext] : undefined;
89
+ if (audio !== undefined)
90
+ return { kind: "audio", mime: audio };
91
+ if (ext === "pdf")
92
+ return { kind: "pdf", mime: "application/pdf" };
93
+ if (TEXT_EXT.has(ext))
94
+ return { kind: "text", mime: "text/plain" };
95
+ return { kind: "none", mime: "application/octet-stream" };
96
+ }
@@ -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 = BigInt(change.amount ?? "0");
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({
@@ -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;
@@ -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. This upload does`);
182
- say(` not carry the recovery list's storage-network copy, whatever the account's switch says —`);
183
- say(` only the browser's small-file uploads do.`);
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
  }
@@ -54,6 +54,8 @@ export interface WalletPutFile {
54
54
  parentId: string | null;
55
55
  /** The destination AS TYPED — part of the reservation key, so both runs of a resume agree. */
56
56
  destination: string;
57
+ /** A video's preview picture: the video's item id, written on the entry as `thumbOf`. */
58
+ thumbOf?: string | undefined;
57
59
  }
58
60
  /** The chain, the signatures, the wire and the four things a caller may be told. */
59
61
  export interface WalletPutSeams {
@@ -194,6 +194,7 @@ export async function walletPut(ctx, file, seams = {}) {
194
194
  updatedAt: now,
195
195
  dekWrapped: result.entry.dekWrapped,
196
196
  contentHashCt: result.entry.contentHashCt,
197
+ ...(file.thumbOf !== undefined ? { thumbOf: file.thumbOf } : {}),
197
198
  },
198
199
  });
199
200
  // ⛔ ONLY NOW, AND EVERY PART — the same order the credit rail keeps and for the same reason: a
package/dist/walrus.d.ts CHANGED
@@ -1,4 +1,12 @@
1
- /** Curated Walrus aggregator (read) endpoints per network, preference order. */
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
- /** Curated Walrus aggregator (read) endpoints per network, preference order. */
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: ["https://aggregator.walrus-testnet.walrus.space"],
20
- mainnet: ["https://aggregator.walrus-mainnet.walrus.space"],
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.
@@ -12,3 +12,6 @@ into place only once the hash matches, one part held in memory at a time. `--out
12
12
  to stdout and writes nothing; in that mode every line for a person, including `--json`, goes to
13
13
  stderr, binary bytes are refused when stdout is a terminal, and files over 64 MiB are refused
14
14
  because a pipe cannot be taken back.
15
+
16
+ `--thumbnail` fetches the video's preview picture instead of the video (the one `put --thumbnail`
17
+ or the browser sent with it). A video without one exits 4 and writes nothing.
@@ -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` stores the NMTS key sealed under a passphrase, checks whichever API key it finds
7
- (`NMTS_API_KEY_FILE`, `NMTS_API_KEY`) with the server, and stores that too. It prints the key's
8
- public handle and never the key. It does not replace a stored key unless the run says so.
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.
@@ -14,3 +14,8 @@ already seen, or a different list at the same version. Report that and stop; it
14
14
 
15
15
  `nmts listfile` writes this machine's copy of the sealed file list out as a file (`--out`, or
16
16
  `--out -` for stdout). It is sealed: without the NMTS key it says nothing.
17
+
18
+ `--media image|video|audio` keeps only files of that kind, judged by the name's extension. A
19
+ video's preview picture is never a line of its own while its video is in the list: fetch it with
20
+ `nmts get <video> --thumbnail`. It goes to the trash, comes back and is erased with its video. A
21
+ picture whose video is gone is listed like any file, so it can still be deleted.
@@ -34,3 +34,11 @@ fit|whole|<object id>` uses a free storage resource the wallet holds for a one-p
34
34
  cuts it to size and leaves the rest free, `whole` binds all of it with the file. Do not choose
35
35
  `--storage` for the person: the leftover is their decision. `--epochs` and `--storage` without
36
36
  `--pay wallet` exit 2.
37
+
38
+ **`--thumbnail`** on a video also sends one frame of it as `<saved name>.thumb.jpg`: an ordinary
39
+ small file, priced, sealed and paid for like any other, linked to the video so every app shows it
40
+ as the video's tile. The frame is taken by `ffmpeg` (one second in, 512 px on the long side);
41
+ `--thumbnail-file <picture>` sends that picture instead. Without `ffmpeg` the video is still stored
42
+ and the output says why it went alone. `--dry-run` prices both. With `--json` the one object is
43
+ the video's, with the picture's result under `thumbnail` (`{"skipped": "<why>"}` when none went).
44
+ On a file that is not a video the flag sends nothing more.
@@ -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 four weeks. It does not gate the work: reading, writing,
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
@@ -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.43.0",
3
+ "version": "0.45.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.34.2",
9
+ "version": "0.45.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.34.2",
15
+ "version": "0.45.0",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  },
@@ -138,11 +138,18 @@ export function account_code_display(code_bytes: Uint8Array): string;
138
138
  export function account_code_generate(): string;
139
139
 
140
140
  /**
141
- * Parses+validates a user-entered account code (any spacing/case), returning the 20 raw
142
- * bytes. Errors if the check symbol fails.
141
+ * Parses+validates a user-entered account code (any spacing/case) OR its 15-word recovery
142
+ * phrase, returning the 20 raw bytes. Errors if the check symbol or the phrase's
143
+ * checksum fails. A phrase error's message starts with `phrase:` (`phrase:count:12` ·
144
+ * `phrase:word:5` · `phrase:checksum`) so a screen can say which one.
143
145
  */
144
146
  export function account_code_parse(input: string): Uint8Array;
145
147
 
148
+ /**
149
+ * The 15-word recovery phrase for 20 raw account-code bytes, in `en` or `ko`.
150
+ */
151
+ export function account_code_phrase(code_bytes: Uint8Array, lang: string): string;
152
+
146
153
  /**
147
154
  * Unpadded base64url of arbitrary bytes. The textual `accountId` is
148
155
  * `b64_encode(account_id_16_bytes)`.
@@ -303,6 +310,30 @@ export function opener_open(serialized_signature: Uint8Array, slot: Uint8Array):
303
310
  */
304
311
  export function opener_seal(serialized_signature: Uint8Array, nmts_key: Uint8Array): Uint8Array;
305
312
 
313
+ /**
314
+ * The 16-byte LOCATOR a passkey's 32-byte PRF result yields — what a passkey sign-in asks the
315
+ * server for (NCF-3 §1.7). Throws for a result of any other length.
316
+ */
317
+ export function passkey_locator(prf: Uint8Array): Uint8Array;
318
+
319
+ /**
320
+ * The 20 NMTS-key bytes inside a passkey's slot. One indistinguishable refusal for a different
321
+ * passkey or altered bytes, for the reason `opener_open` gives.
322
+ */
323
+ export function passkey_open(prf: Uint8Array, slot: Uint8Array): Uint8Array;
324
+
325
+ /**
326
+ * The PRF salt every NMTS passkey is asked about (NCF-3 §1.7): SHA-256 of
327
+ * `nmts/v3/passkey-prf/1`. The page passes these 32 bytes as WebAuthn `prf.eval.first`.
328
+ */
329
+ export function passkey_prf_salt(): Uint8Array;
330
+
331
+ /**
332
+ * The 62-byte SLOT holding `nmts_key` under a passkey's PRF result — kind `0x02`, a fresh nonce
333
+ * from WebCrypto, the same layout as a wallet's slot.
334
+ */
335
+ export function passkey_seal(prf: Uint8Array, nmts_key: Uint8Array): Uint8Array;
336
+
306
337
  /**
307
338
  * The name this account's recovery manifest is stored under inside a quilt (NCF-3 §2.5).
308
339
  *
@@ -465,9 +496,6 @@ export interface InitOutput {
465
496
  readonly __wbg_sha256hasher_free: (a: number, b: number) => void;
466
497
  readonly __wbg_streamdecryptor_free: (a: number, b: number) => void;
467
498
  readonly __wbg_streamencryptor_free: (a: number, b: number) => void;
468
- readonly account_code_display: (a: number, b: number) => [number, number, number, number];
469
- readonly account_code_generate: () => [number, number];
470
- readonly account_code_parse: (a: number, b: number) => [number, number, number, number];
471
499
  readonly b64_encode: (a: number, b: number) => [number, number];
472
500
  readonly derive_ai_account_code: (a: number, b: number, c: number) => [number, number, number, number];
473
501
  readonly device_wrap_key: (a: number, b: number, c: number, d: number) => [number, number, number, number];
@@ -505,12 +533,20 @@ export interface InitOutput {
505
533
  readonly streamencryptor_push: (a: number, b: number, c: number) => [number, number, number, number];
506
534
  readonly streamencryptor_resumeFromHeader: (a: number, b: number, c: number, d: number) => [number, number, number];
507
535
  readonly verify_part_set: (a: number, b: number) => [number, number];
508
- readonly voucher_hash_from_input: (a: number, b: number) => [number, number];
509
536
  readonly wallet_seed_for: (a: number, b: number, c: number) => [number, number, number, number];
510
537
  readonly opener_locator: (a: number, b: number) => [number, number, number, number];
511
538
  readonly opener_message: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
512
539
  readonly opener_open: (a: number, b: number, c: number, d: number) => [number, number, number, number];
513
540
  readonly opener_seal: (a: number, b: number, c: number, d: number) => [number, number, number, number];
541
+ readonly passkey_locator: (a: number, b: number) => [number, number, number, number];
542
+ readonly passkey_open: (a: number, b: number, c: number, d: number) => [number, number, number, number];
543
+ readonly passkey_prf_salt: () => [number, number];
544
+ readonly passkey_seal: (a: number, b: number, c: number, d: number) => [number, number, number, number];
545
+ readonly account_code_display: (a: number, b: number) => [number, number, number, number];
546
+ readonly account_code_generate: () => [number, number];
547
+ readonly account_code_parse: (a: number, b: number) => [number, number, number, number];
548
+ readonly account_code_phrase: (a: number, b: number, c: number, d: number) => [number, number, number, number];
549
+ readonly voucher_hash_from_input: (a: number, b: number) => [number, number];
514
550
  readonly __wbindgen_exn_store: (a: number) => void;
515
551
  readonly __externref_table_alloc: () => number;
516
552
  readonly __wbindgen_externrefs: WebAssembly.Table;