@needmoretruth/nmts-cli 0.52.3 → 0.54.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/CHANGELOG.md +14 -0
- package/README.ko.md +9 -1
- package/README.md +10 -1
- package/dist/artifact-about.d.ts +1 -1
- package/dist/client-id.d.ts +1 -1
- package/dist/client-id.js +1 -1
- package/dist/commands/put-payer.d.ts +1 -0
- package/dist/commands/put-payer.js +6 -0
- package/dist/commands/put-wallet-facts.d.ts +3 -0
- package/dist/commands/put-wallet-facts.js +26 -0
- package/dist/commands/put-wallet.d.ts +3 -0
- package/dist/commands/put-wallet.js +19 -38
- package/dist/commands/put.d.ts +5 -0
- package/dist/exit.d.ts +14 -0
- package/dist/exit.js +31 -1
- package/dist/help-options.js +2 -1
- package/dist/main.js +5 -3
- package/dist/openers-key-file.d.ts +6 -0
- package/dist/openers-key-file.js +29 -2
- package/dist/payer-key-file.d.ts +13 -0
- package/dist/payer-key-file.js +47 -0
- package/dist/product.d.ts +6 -1
- package/dist/product.js +6 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
Each version's entry is what changed for the person or the program using `nmts`. The product's own
|
|
4
4
|
update history, which covers the site and the server too, is at https://nmts.me/updates.
|
|
5
5
|
|
|
6
|
+
## 0.54.0 — 2026-11-08
|
|
7
|
+
|
|
8
|
+
- `put --pay wallet --sui-key-file <file>` pays for the upload from another Sui wallet you hold, read
|
|
9
|
+
from a key file, instead of from your NMTS key's wallet. The review names that wallet. A key file
|
|
10
|
+
other users can read is refused with a `chmod 600` hint, and the key is never printed. It cannot be
|
|
11
|
+
combined with `--wallet` or used with `push`.
|
|
12
|
+
|
|
13
|
+
## 0.53.0 — 2026-11-08
|
|
14
|
+
|
|
15
|
+
- A command that fails for a reason other than how it was typed now ends its error with one line
|
|
16
|
+
that points to the NMTS Discord: `Stuck? Ask in the NMTS Discord: https://discord.gg/HtrUwhb2Mz
|
|
17
|
+
(the developer answers in English and Korean)`. Usage errors, `--json` output and `nmts mcp` do
|
|
18
|
+
not get it, and every error sentence and exit code is as before.
|
|
19
|
+
|
|
6
20
|
## 0.52.3 — 2026-11-08
|
|
7
21
|
|
|
8
22
|
- The crypto engine uses ml-dsa 0.1.2, whose key generation no longer branches on secret values.
|
package/README.ko.md
CHANGED
|
@@ -50,7 +50,7 @@ nmts --help
|
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
52
|
npm install -g github:needmoretruth/nmts-cli # 기본 브랜치
|
|
53
|
-
npm install -g github:needmoretruth/nmts-cli#v0.
|
|
53
|
+
npm install -g github:needmoretruth/nmts-cli#v0.54.0 # 버전을 고정할 때
|
|
54
54
|
npm install -g https://github.com/needmoretruth/nmts-cli/releases/latest/download/nmts.tgz
|
|
55
55
|
```
|
|
56
56
|
|
|
@@ -245,6 +245,7 @@ nmts put film.mov --part-size 256MiB # 조각을 키우면: 구매 횟수는
|
|
|
245
245
|
nmts put film.mov --pay wallet --dry-run # 검토만: WAL 값, 팁, 수수료, 잔액, 날수. 서명하지 않습니다
|
|
246
246
|
nmts put film.mov --pay wallet --epochs 6 # 저장 네트워크의 에포크 6개(기본 2)
|
|
247
247
|
nmts put film.mov --pay wallet --storage fit # 지갑이 이미 든 저장 자원을 크기에 맞춰 잘라 씁니다
|
|
248
|
+
nmts put film.mov --pay wallet --sui-key-file ~/.sui/agent.key # 가지고 있는 다른 Sui 지갑이 냅니다
|
|
248
249
|
```
|
|
249
250
|
|
|
250
251
|
파일을 같은 조각으로 나누고, 체인이 조각마다 WAL 값과 중계의 팁(SUI)을
|
|
@@ -260,6 +261,10 @@ nmts put film.mov --pay wallet --storage fit # 지갑이 이미 든 저
|
|
|
260
261
|
목록의 저장 네트워크 사본을 싣지 않습니다 — 오늘은 브라우저의 작은 파일 업로드만 싣습니다.
|
|
261
262
|
`push --pay wallet`은 같은 일을 파일마다 합니다.
|
|
262
263
|
|
|
264
|
+
`--sui-key-file <파일>`을 주면 `put`이 NMTS 키의 지갑 대신 가지고 있는 다른 Sui 지갑에서 내고, 검토가 그
|
|
265
|
+
지갑을 밝힙니다. 파일에는 그 지갑의 `suiprivkey1…` 줄이 들어 있어야 합니다. 다른 사용자가 읽을 수 있는
|
|
266
|
+
파일은 거절하고, 키는 어디에도 찍지 않습니다. `--wallet`과 함께 쓸 수 없고 `push`에는 쓰지 않습니다.
|
|
267
|
+
|
|
263
268
|
`push`는 디렉터리를 올리고 **첫 실패에서 멈추며**, 이미 올라간 것을 말합니다. 목적지에 같은
|
|
264
269
|
이름이 이미 있는 파일은 건너뛰므로 다시 돌려도 안전합니다. 점으로 시작하는 이름은 `--hidden`을
|
|
265
270
|
주지 않는 한 건드리지 않고, 심볼릭 링크는 따라가지 않습니다.
|
|
@@ -560,6 +565,9 @@ auto 모드 둘에서 거절됩니다. 모드가 켜져 있는 동안 모든 명
|
|
|
560
565
|
|
|
561
566
|
도구 자체가 돌지 않으면 **nmts@nmts.me**로, 무엇을 돌렸고 무엇이 찍혔는지 적어 보내십시오.
|
|
562
567
|
|
|
568
|
+
공개된 곳에서 묻고 싶으면, 실패한 명령 끝에 나오는 NMTS 디스코드 링크로 오십시오. 개발자가 영어와
|
|
569
|
+
한국어로 답합니다: https://discord.gg/HtrUwhb2Mz
|
|
570
|
+
|
|
563
571
|
## 이 위에 만드셨습니까?
|
|
564
572
|
|
|
565
573
|
이 코드 위에 무엇을 만드셨다면 — 서비스, 포크, 다른 언어로의 이식, 더 가벼운 클라이언트 —
|
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ default branch, from a pinned version, or from the tarball attached to the
|
|
|
51
51
|
|
|
52
52
|
```sh
|
|
53
53
|
npm install -g github:needmoretruth/nmts-cli # the default branch
|
|
54
|
-
npm install -g github:needmoretruth/nmts-cli#v0.
|
|
54
|
+
npm install -g github:needmoretruth/nmts-cli#v0.54.0 # a pinned version
|
|
55
55
|
npm install -g https://github.com/needmoretruth/nmts-cli/releases/latest/download/nmts.tgz
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -256,6 +256,7 @@ interrupted upload: the retry costs nothing more.
|
|
|
256
256
|
nmts put film.mov --pay wallet --dry-run # the review: WAL price, tip, fee, balances, days. Signs nothing
|
|
257
257
|
nmts put film.mov --pay wallet --epochs 6 # six of the storage network's epochs (default 2)
|
|
258
258
|
nmts put film.mov --pay wallet --storage fit # use a storage resource the wallet already holds, cut to size
|
|
259
|
+
nmts put film.mov --pay wallet --sui-key-file ~/.sui/agent.key # another Sui wallet you hold pays instead
|
|
259
260
|
```
|
|
260
261
|
|
|
261
262
|
The file is planned into the same parts, the chain quotes each part in WAL
|
|
@@ -273,6 +274,11 @@ can extend it. A wallet-paid upload does not carry the recovery list's storage-n
|
|
|
273
274
|
whichever way the account's switch is set — today only the browser's small-file uploads do. `push
|
|
274
275
|
--pay wallet` does the same one file at a time.
|
|
275
276
|
|
|
277
|
+
With `--sui-key-file <file>`, `put` pays from another Sui wallet you hold instead of your NMTS key's
|
|
278
|
+
wallet, and the review names that wallet. The file holds the wallet's `suiprivkey1…` line; a file other
|
|
279
|
+
users can read is refused, and the key is never printed. It cannot be combined with `--wallet` or used
|
|
280
|
+
with `push`.
|
|
281
|
+
|
|
276
282
|
`push` uploads a directory and **stops at the first failure**, saying what is already uploaded.
|
|
277
283
|
Files whose name is already in the destination are skipped, so running it again is safe. Names
|
|
278
284
|
beginning with a dot are left alone unless `--hidden` is given, and symbolic links are not followed.
|
|
@@ -606,6 +612,9 @@ preferred; Korean is read too.
|
|
|
606
612
|
|
|
607
613
|
If the tool itself cannot run, write to **nmts@nmts.me** with what you ran and what it said.
|
|
608
614
|
|
|
615
|
+
To ask in public instead, a failed command ends with a link to the NMTS Discord, where the developer
|
|
616
|
+
answers in English and Korean: https://discord.gg/HtrUwhb2Mz
|
|
617
|
+
|
|
609
618
|
## Built on this?
|
|
610
619
|
|
|
611
620
|
If you built something on this code — a service, a fork, a port to another language, a lighter
|
package/dist/artifact-about.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const CRYPTO_SPEC_URL = "https://github.com/needmoretruth/nmts-re
|
|
|
11
11
|
* is the field's own contract — what the writer says about itself — and a person holding two
|
|
12
12
|
* copies of one account's artefacts can then tell which program made each.
|
|
13
13
|
*/
|
|
14
|
-
export declare const WRITTEN_BY = "nmts-cli 0.
|
|
14
|
+
export declare const WRITTEN_BY = "nmts-cli 0.54.0";
|
|
15
15
|
/** Which of the three artefacts a wrapper is. A reader holding several can sort them. */
|
|
16
16
|
export type ArtifactKind = "recovery-list" | "file-list" | "recovery-kit";
|
|
17
17
|
/**
|
package/dist/client-id.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export type ClientKind = "cli" | "mcp" | "sdk";
|
|
|
7
7
|
* points with `"sdk"` and the SDK's own version.
|
|
8
8
|
*/
|
|
9
9
|
export declare function identifyClient(next: ClientKind, nextVersion?: string): void;
|
|
10
|
-
/** `cli/0.
|
|
10
|
+
/** `cli/0.54.0`, `mcp/0.54.0`, `sdk/0.17.0`. */
|
|
11
11
|
export declare function clientHeaderValue(): string;
|
package/dist/client-id.js
CHANGED
|
@@ -24,7 +24,7 @@ export function identifyClient(next, nextVersion = VERSION) {
|
|
|
24
24
|
kind = next;
|
|
25
25
|
version = nextVersion;
|
|
26
26
|
}
|
|
27
|
-
/** `cli/0.
|
|
27
|
+
/** `cli/0.54.0`, `mcp/0.54.0`, `sdk/0.17.0`. */
|
|
28
28
|
export function clientHeaderValue() {
|
|
29
29
|
return `${kind}/${version}`;
|
|
30
30
|
}
|
|
@@ -8,6 +8,7 @@ export declare function refuseWalletOnlyOptions(options: {
|
|
|
8
8
|
wallet?: string | undefined;
|
|
9
9
|
trustServerTipAddress?: boolean;
|
|
10
10
|
from?: string | undefined;
|
|
11
|
+
suiKeyFile?: string | undefined;
|
|
11
12
|
}): void;
|
|
12
13
|
/** What NMTS Heavy adds to an upload command line: the tier, and the self-paid knobs. */
|
|
13
14
|
export interface HeavyFlags {
|
|
@@ -40,6 +40,12 @@ export function refuseWalletOnlyOptions(options) {
|
|
|
40
40
|
nextStep: `Nothing was sent. Add --pay wallet to use a storage resource this wallet holds.`,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
if (options.suiKeyFile !== undefined) {
|
|
44
|
+
throw new NmtsError("--sui-key-file only applies with --pay wallet: credits are not paid from a wallet.", {
|
|
45
|
+
exitCode: 2,
|
|
46
|
+
nextStep: `Nothing was sent. Add --pay wallet to pay this upload from the wallet in that file.`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
43
49
|
if (options.from !== undefined) {
|
|
44
50
|
throw new NmtsError("--from only applies with --pay wallet: it is how a credit-paid file moves onto the wallet.", {
|
|
45
51
|
exitCode: 2,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { coinAmount } from "../wallet.js";
|
|
2
|
+
/** The review as `--json` prints it: base units as strings, with the coin amounts beside them. */
|
|
3
|
+
export function factsOf(review) {
|
|
4
|
+
const { budget, storage } = review;
|
|
5
|
+
return {
|
|
6
|
+
bytes: review.bytes,
|
|
7
|
+
sealedBytes: review.sealedBytes,
|
|
8
|
+
parts: review.parts,
|
|
9
|
+
epochs: review.epochs,
|
|
10
|
+
days: review.days,
|
|
11
|
+
endEpoch: review.endEpoch,
|
|
12
|
+
paidFrom: "wallet",
|
|
13
|
+
priceFrost: budget.walNeededFrost.toString(),
|
|
14
|
+
priceWal: coinAmount(budget.walNeededFrost),
|
|
15
|
+
tipMist: review.tipMist.toString(),
|
|
16
|
+
tipSui: coinAmount(review.tipMist),
|
|
17
|
+
feeMist: budget.feeMist === null ? null : budget.feeMist.toString(),
|
|
18
|
+
feeSui: budget.feeMist === null ? null : coinAmount(budget.feeMist),
|
|
19
|
+
wallet: budget.address,
|
|
20
|
+
walletWal: budget.walFrost === null ? null : coinAmount(budget.walFrost),
|
|
21
|
+
walletSui: budget.suiMist === null ? null : coinAmount(budget.suiMist),
|
|
22
|
+
storage: storage.kind === "buy"
|
|
23
|
+
? { kind: "buy" }
|
|
24
|
+
: { kind: "reuse", objectId: storage.objectId, cutToBytes: storage.cutToBytes, leftoverBytes: storage.leftoverBytes },
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -7,6 +7,7 @@ import type { AccountSettings } from "../shared/lib/drive/manifest-settings.ts";
|
|
|
7
7
|
import type { StandingTipInput } from "../standing-tip.ts";
|
|
8
8
|
import { type WalletUploadReads } from "../upload-wallet-plan.ts";
|
|
9
9
|
import type { BlobProtocol, UploadApi } from "../upload-wire.ts";
|
|
10
|
+
import type { ExternalPayer } from "../wallet-sign-external.ts";
|
|
10
11
|
import type { SignBlobCertify, SignBlobRegister } from "../wallet-sign.ts";
|
|
11
12
|
import { type PutOptions } from "./put.ts";
|
|
12
13
|
/** What paying from the wallet adds to an upload command. */
|
|
@@ -75,6 +76,8 @@ export interface WalletUploadContext {
|
|
|
75
76
|
settings?: AccountSettings | undefined;
|
|
76
77
|
/** Which of this key's wallets pays (`wallet-pay-index.ts`). Read from the same list as above. */
|
|
77
78
|
wallet: number;
|
|
79
|
+
/** A wallet this key does not derive pays instead (`--sui-key-file` · L338); `wallet` is then unused. */
|
|
80
|
+
payer?: ExternalPayer | undefined;
|
|
78
81
|
/**
|
|
79
82
|
* Does this account ask its uploads to carry the recovery list's storage-network copy?
|
|
80
83
|
*
|
|
@@ -35,9 +35,9 @@ import { measureLocal } from "../upload-price-node.js";
|
|
|
35
35
|
import { downloadForRefill, findOriginal, settleRefill } from "../refill-source.js";
|
|
36
36
|
import { describeUploadReview } from "../upload-wallet-plan.js";
|
|
37
37
|
import { walletPut } from "../upload-wallet-put.js";
|
|
38
|
-
import { coinAmount } from "../wallet.js";
|
|
39
38
|
import { recordWalletSpend, requireWalletGrant } from "../wallet-grant.js";
|
|
40
39
|
import { folderIdFor } from "./put.js";
|
|
40
|
+
import { factsOf } from "./put-wallet-facts.js";
|
|
41
41
|
export async function putWithWallet(target, options) {
|
|
42
42
|
const say = options.write ?? ((line) => process.stdout.write(`${line}\n`));
|
|
43
43
|
const from = options.from;
|
|
@@ -45,6 +45,7 @@ export async function putWithWallet(target, options) {
|
|
|
45
45
|
if (from === undefined && (target === undefined || target === "")) {
|
|
46
46
|
throw new NmtsError("Say which file to put.", { exitCode: 2, nextStep: `\`${BINARY_NAME} put <file> --pay wallet\`` });
|
|
47
47
|
}
|
|
48
|
+
const payer = options.suiKeyFile === undefined ? undefined : (await import("../payer-key-file.js")).keyFilePayer(options.suiKeyFile, options.wallet);
|
|
48
49
|
const resolved = await requireAccountCode();
|
|
49
50
|
const key = resolveApiKey();
|
|
50
51
|
if (key === null) {
|
|
@@ -88,6 +89,7 @@ export async function putWithWallet(target, options) {
|
|
|
88
89
|
onCollision: asked,
|
|
89
90
|
settings: list.manifest?.settings,
|
|
90
91
|
wallet,
|
|
92
|
+
payer,
|
|
91
93
|
networkCopy: options.json === true ? false : await readNetworkCopy(server, key.key),
|
|
92
94
|
progress: new Progress(options.json === true ? silentSink() : stderrSink(), "uploading"),
|
|
93
95
|
say,
|
|
@@ -180,12 +182,14 @@ export async function uploadOneWithWallet(ctx, file, options) {
|
|
|
180
182
|
partSize: ctx.partSize,
|
|
181
183
|
rule: ctx.rule,
|
|
182
184
|
onCollision: ctx.onCollision,
|
|
185
|
+
...(ctx.payer === undefined ? {} : { payer: { address: ctx.payer.address } }),
|
|
183
186
|
}, { source: fileSource(file.localPath, file.size), name: file.name, parentId: file.parentId, destination: file.destination, thumbOf: file.thumbOf }, {
|
|
184
187
|
epochs: options.epochs,
|
|
185
188
|
storage: options.storage,
|
|
186
189
|
dryRun: options.dryRun,
|
|
187
190
|
readChain: options.readChain,
|
|
188
|
-
|
|
191
|
+
// ⛔ THE KEY FILE'S WALLET SIGNS WHAT ITS ADDRESS WAS PRICED FOR (the SDK's `pay: { signer }` road).
|
|
192
|
+
sign: options.sign ?? (ctx.payer === undefined ? undefined : (await import("../wallet-sign-external.js")).externalBlobSigners(ctx.payer)),
|
|
189
193
|
protocol: options.protocol,
|
|
190
194
|
api: options.api,
|
|
191
195
|
onProgress: (sent, total) => ctx.progress.update(sent, total),
|
|
@@ -231,17 +235,19 @@ export async function uploadOneWithWallet(ctx, file, options) {
|
|
|
231
235
|
// ⛔ THE STANDING SHARE, AFTER THE PAYMENT AND NEVER INSIDE IT: a gift that fails must not fail
|
|
232
236
|
// the upload. A resumed run paid nothing now, so it owes nothing now. In --json the tip speaks
|
|
233
237
|
// on stderr — stdout carries the machine's one answer and nothing else.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
238
|
+
// ⛔ NOT WHEN A KEY FILE PAID: the gift would leave a wallet the person did not name for it.
|
|
239
|
+
if (ctx.payer === undefined)
|
|
240
|
+
await (await import("../standing-tip.js")).standingTipAfter({
|
|
241
|
+
server: ctx.server,
|
|
242
|
+
network: ctx.network,
|
|
243
|
+
code: ctx.code,
|
|
244
|
+
settings: ctx.settings,
|
|
245
|
+
wallet: ctx.wallet,
|
|
246
|
+
paidWalFrost: outcome.resumed ? 0n : outcome.review.budget.walNeededFrost,
|
|
247
|
+
say: ctx.json ? (line) => void process.stderr.write(`${line}\n`) : say,
|
|
248
|
+
trustServerAddress: options.trustServerTipAddress === true,
|
|
249
|
+
...(options.tip ?? {}),
|
|
250
|
+
});
|
|
245
251
|
return { itemId: outcome.itemId, savedAs: outcome.savedAs, replaced: outcome.replaced, seq: outcome.fileListVersion, resumed: outcome.resumed, facts };
|
|
246
252
|
}
|
|
247
253
|
/**
|
|
@@ -261,31 +267,6 @@ export async function readNetworkCopy(server, apiKey) {
|
|
|
261
267
|
return null;
|
|
262
268
|
}
|
|
263
269
|
}
|
|
264
|
-
/** The review as `--json` prints it: base units as strings, with the coin amounts beside them. */
|
|
265
|
-
function factsOf(review) {
|
|
266
|
-
const { budget, storage } = review;
|
|
267
|
-
return {
|
|
268
|
-
bytes: review.bytes,
|
|
269
|
-
sealedBytes: review.sealedBytes,
|
|
270
|
-
parts: review.parts,
|
|
271
|
-
epochs: review.epochs,
|
|
272
|
-
days: review.days,
|
|
273
|
-
endEpoch: review.endEpoch,
|
|
274
|
-
paidFrom: "wallet",
|
|
275
|
-
priceFrost: budget.walNeededFrost.toString(),
|
|
276
|
-
priceWal: coinAmount(budget.walNeededFrost),
|
|
277
|
-
tipMist: review.tipMist.toString(),
|
|
278
|
-
tipSui: coinAmount(review.tipMist),
|
|
279
|
-
feeMist: budget.feeMist === null ? null : budget.feeMist.toString(),
|
|
280
|
-
feeSui: budget.feeMist === null ? null : coinAmount(budget.feeMist),
|
|
281
|
-
wallet: budget.address,
|
|
282
|
-
walletWal: budget.walFrost === null ? null : coinAmount(budget.walFrost),
|
|
283
|
-
walletSui: budget.suiMist === null ? null : coinAmount(budget.suiMist),
|
|
284
|
-
storage: storage.kind === "buy"
|
|
285
|
-
? { kind: "buy" }
|
|
286
|
-
: { kind: "reuse", objectId: storage.objectId, cutToBytes: storage.cutToBytes, leftoverBytes: storage.leftoverBytes },
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
270
|
/** Each step, for a person watching. The signatures are named as what they are. */
|
|
290
271
|
function tell(ctx, size, step) {
|
|
291
272
|
if (ctx.json || step.step === "planning")
|
package/dist/commands/put.d.ts
CHANGED
|
@@ -39,6 +39,11 @@ export interface PutOptions extends HeavyFlags {
|
|
|
39
39
|
from?: string | undefined;
|
|
40
40
|
/** `--pay wallet`: which of this key's wallets pays, this run only. Absent = the account's own. */
|
|
41
41
|
wallet?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* `--pay wallet --sui-key-file <file>`: a wallet this NMTS key does not derive pays, signed with
|
|
44
|
+
* the key in that file (`payer-key-file.ts` · L338). Not with `--wallet`: one payer per run.
|
|
45
|
+
*/
|
|
46
|
+
suiKeyFile?: string | undefined;
|
|
42
47
|
/** `--trust-server-tip-address`: let THIS SERVER name where the standing gift goes. Off unless
|
|
43
48
|
* typed, and only for a server the caller runs (`standing-tip.ts`). */
|
|
44
49
|
trustServerTipAddress?: boolean;
|
package/dist/exit.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
/** The exit code a failure asks for, or the generic one. */
|
|
2
2
|
export declare function exitCodeFor(error: unknown): number;
|
|
3
|
+
/** The last line of a failure a person could be stuck on (owner 2026-11-07 · E2, E3). */
|
|
4
|
+
export declare const STUCK_LINE = "Stuck? Ask in the NMTS Discord: https://discord.gg/HtrUwhb2Mz (the developer answers in English and Korean)";
|
|
5
|
+
/**
|
|
6
|
+
* What follows the rendered failure on stderr: {@link STUCK_LINE} and a newline, or nothing.
|
|
7
|
+
*
|
|
8
|
+
* ⛔ NOT UNDER THE CALLER'S OWN INPUT. A mistyped command or option, a key in the wrong shape (2),
|
|
9
|
+
* no key on this machine (3), an agreement still to give (5), a cancel (130) and an announced
|
|
10
|
+
* but unbuilt command each name the next keystroke; "stuck?" would be the wrong sentence there.
|
|
11
|
+
* What is left is 1 (something went wrong) and 4 (it could not be done), and unknown failures.
|
|
12
|
+
* ⛔ NOT IN A MODE THAT PRINTS JSON (`--json`, `mcp`): whatever reads that output parses it, and a
|
|
13
|
+
* sentence is not part of the contract. A command line that cannot be read is a usage error.
|
|
14
|
+
* ⛔ `renderError` STAYS AS IT WAS: the MCP server returns its text to an agent as the tool result.
|
|
15
|
+
*/
|
|
16
|
+
export declare function stuckLineFor(error: unknown, argv: readonly string[]): string;
|
|
3
17
|
/**
|
|
4
18
|
* Stop a closed pipe from becoming a crash.
|
|
5
19
|
*
|
package/dist/exit.js
CHANGED
|
@@ -8,13 +8,43 @@
|
|
|
8
8
|
// one, whether it was the program at all, and the last line it prints.
|
|
9
9
|
import { realpathSync } from "node:fs";
|
|
10
10
|
import { parseArgs } from "./args.js";
|
|
11
|
-
import { NmtsError, UNKNOWN_FAILURE_EXIT } from "./errors.js";
|
|
11
|
+
import { NmtsError, NotBuiltYetError, UNKNOWN_FAILURE_EXIT } from "./errors.js";
|
|
12
|
+
import { DISCORD_HELP_URL } from "./product.js";
|
|
12
13
|
/** The exit code a failure asks for, or the generic one. */
|
|
13
14
|
export function exitCodeFor(error) {
|
|
14
15
|
if (error instanceof NmtsError)
|
|
15
16
|
return error.exitCode;
|
|
16
17
|
return UNKNOWN_FAILURE_EXIT;
|
|
17
18
|
}
|
|
19
|
+
/** The last line of a failure a person could be stuck on (owner 2026-11-07 · E2, E3). */
|
|
20
|
+
export const STUCK_LINE = `Stuck? Ask in the NMTS Discord: ${DISCORD_HELP_URL} (the developer answers in English and Korean)`;
|
|
21
|
+
/**
|
|
22
|
+
* What follows the rendered failure on stderr: {@link STUCK_LINE} and a newline, or nothing.
|
|
23
|
+
*
|
|
24
|
+
* ⛔ NOT UNDER THE CALLER'S OWN INPUT. A mistyped command or option, a key in the wrong shape (2),
|
|
25
|
+
* no key on this machine (3), an agreement still to give (5), a cancel (130) and an announced
|
|
26
|
+
* but unbuilt command each name the next keystroke; "stuck?" would be the wrong sentence there.
|
|
27
|
+
* What is left is 1 (something went wrong) and 4 (it could not be done), and unknown failures.
|
|
28
|
+
* ⛔ NOT IN A MODE THAT PRINTS JSON (`--json`, `mcp`): whatever reads that output parses it, and a
|
|
29
|
+
* sentence is not part of the contract. A command line that cannot be read is a usage error.
|
|
30
|
+
* ⛔ `renderError` STAYS AS IT WAS: the MCP server returns its text to an agent as the tool result.
|
|
31
|
+
*/
|
|
32
|
+
export function stuckLineFor(error, argv) {
|
|
33
|
+
if (error instanceof NotBuiltYetError)
|
|
34
|
+
return "";
|
|
35
|
+
const code = exitCodeFor(error);
|
|
36
|
+
if (code !== 1 && code !== 4)
|
|
37
|
+
return "";
|
|
38
|
+
try {
|
|
39
|
+
const args = parseArgs(argv);
|
|
40
|
+
if (args.json || args.command === "mcp")
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
return `${STUCK_LINE}\n`;
|
|
47
|
+
}
|
|
18
48
|
/**
|
|
19
49
|
* Stop a closed pipe from becoming a crash.
|
|
20
50
|
*
|
package/dist/help-options.js
CHANGED
|
@@ -147,7 +147,8 @@ export function optionLines() {
|
|
|
147
147
|
// file path; the account number is inside what is signed, so another number is another
|
|
148
148
|
// signature; without `--app` one wallet opens the same account in every product that asks.
|
|
149
149
|
` --wallet The NMTS key comes from a wallet's signature (login, create)`,
|
|
150
|
-
` --sui-key-file <p> File holding the wallet's \`suiprivkey1…\` line. Never the key itself
|
|
150
|
+
` --sui-key-file <p> File holding the wallet's \`suiprivkey1…\` line. Never the key itself.`,
|
|
151
|
+
` With put --pay wallet, that wallet pays for the upload`,
|
|
151
152
|
` --account <n> Which of that wallet's accounts. Default 1; it is inside what is signed`,
|
|
152
153
|
` --app <name> Scope the signature to one product. Without it, one account everywhere`,
|
|
153
154
|
` --version Print the version and exit`,
|
package/dist/main.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
// whole command surface can be driven from a test without ending the test runner.
|
|
27
27
|
import { parseArgs } from "./args.js";
|
|
28
28
|
import { NmtsError, NotBuiltYetError, renderError } from "./errors.js";
|
|
29
|
-
import { endQuietlyOnClosedPipe, exitCodeFor, invokedDirectly, noteUpdateAfter } from "./exit.js";
|
|
29
|
+
import { endQuietlyOnClosedPipe, exitCodeFor, invokedDirectly, noteUpdateAfter, stuckLineFor } from "./exit.js";
|
|
30
30
|
import { printHelp } from "./help.js";
|
|
31
31
|
import { BINARY_NAME, VERSION } from "./product.js";
|
|
32
32
|
/**
|
|
@@ -186,12 +186,14 @@ export async function run(argv) {
|
|
|
186
186
|
onCollision: args.onCollision,
|
|
187
187
|
deposit: args.deposit, pay: args.pay, epochs: args.epochs,
|
|
188
188
|
storage: args.storage, from: args.from,
|
|
189
|
-
json: args.json, wallet: args.wallet, trustServerTipAddress: args.trustServerTipAddress,
|
|
189
|
+
json: args.json, wallet: args.wallet, trustServerTipAddress: args.trustServerTipAddress, suiKeyFile: args.suiKeyFile,
|
|
190
190
|
tier: args.tier, copies: args.copies, providers: args.providers, evmWallet: args.evmWallet, days: args.days,
|
|
191
191
|
thumbnail: args.thumbnail, thumbnailFile: args.thumbnailFile,
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
case "push": {
|
|
195
|
+
if (args.suiKeyFile !== undefined)
|
|
196
|
+
(await import("./payer-key-file.js")).refuseKeyFileForPush();
|
|
195
197
|
const { push } = await import("./commands/push.js");
|
|
196
198
|
return await push(args.operands[0], {
|
|
197
199
|
server: args.server,
|
|
@@ -375,7 +377,7 @@ async function main() {
|
|
|
375
377
|
process.exitCode = await run(argv);
|
|
376
378
|
}
|
|
377
379
|
catch (error) {
|
|
378
|
-
process.stderr.write(`${renderError(error, BINARY_NAME)}\n`);
|
|
380
|
+
process.stderr.write(`${renderError(error, BINARY_NAME)}\n${stuckLineFor(error, argv)}`);
|
|
379
381
|
process.exitCode = exitCodeFor(error);
|
|
380
382
|
failed = error instanceof Error ? error.message : String(error);
|
|
381
383
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Signer } from "@mysten/sui/cryptography";
|
|
1
2
|
import type { SignWallet } from "./openers.ts";
|
|
2
3
|
/** A wallet this run can ask for signatures: which address it is, and how to ask. */
|
|
3
4
|
export interface KeyFileWallet {
|
|
@@ -12,3 +13,8 @@ export interface KeyFileWallet {
|
|
|
12
13
|
* to a file with `echo` appends one and refusing it would be a puzzle with no clue.
|
|
13
14
|
*/
|
|
14
15
|
export declare function walletFromKeyFile(path: string): KeyFileWallet;
|
|
16
|
+
/**
|
|
17
|
+
* The keypair held in `path`, for a caller that signs more than a message — `put --pay wallet
|
|
18
|
+
* --sui-key-file` signs the upload's transactions with it (`payer-key-file.ts`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function signerFromKeyFile(path: string): Signer;
|
package/dist/openers-key-file.js
CHANGED
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
//
|
|
18
18
|
// ⚠ NODE ONLY, WHICH IS WHY IT IS NOT IN `openers/`. That folder is bundled into a page by the
|
|
19
19
|
// SDK's browser entry; a page's wallet is an extension, and this one is a file on a disk.
|
|
20
|
-
import { readFileSync } from "node:fs";
|
|
20
|
+
import { readFileSync, statSync } from "node:fs";
|
|
21
21
|
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
|
|
22
22
|
import { Secp256k1Keypair } from "@mysten/sui/keypairs/secp256k1";
|
|
23
23
|
import { Secp256r1Keypair } from "@mysten/sui/keypairs/secp256r1";
|
|
24
24
|
import { decodeSuiPrivateKey } from "@mysten/sui/cryptography";
|
|
25
|
+
import { modesAreEnforced } from "./credentials.js";
|
|
25
26
|
import { NmtsError } from "./errors.js";
|
|
26
27
|
/**
|
|
27
28
|
* The wallet held in `path`, ready to sign the opener message.
|
|
@@ -31,7 +32,7 @@ import { NmtsError } from "./errors.js";
|
|
|
31
32
|
* to a file with `echo` appends one and refusing it would be a puzzle with no clue.
|
|
32
33
|
*/
|
|
33
34
|
export function walletFromKeyFile(path) {
|
|
34
|
-
const keypair =
|
|
35
|
+
const keypair = signerFromKeyFile(path);
|
|
35
36
|
return {
|
|
36
37
|
address: keypair.toSuiAddress(),
|
|
37
38
|
// ⛔ THE CLOSURE HOLDS THE KEYPAIR AND NOTHING HOLDS THE CLOSURE PAST THE RUN. What it answers
|
|
@@ -40,6 +41,31 @@ export function walletFromKeyFile(path) {
|
|
|
40
41
|
sign: async (message) => keypair.signPersonalMessage(message),
|
|
41
42
|
};
|
|
42
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* The keypair held in `path`, for a caller that signs more than a message — `put --pay wallet
|
|
46
|
+
* --sui-key-file` signs the upload's transactions with it (`payer-key-file.ts`).
|
|
47
|
+
*/
|
|
48
|
+
export function signerFromKeyFile(path) {
|
|
49
|
+
return keypairFrom(readOneLine(path), path);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A key file other users of this machine can read is refused, as the credentials file is
|
|
53
|
+
* (`credentials.ts` `readCredentialsFile`).
|
|
54
|
+
*
|
|
55
|
+
* ⛔ CHECKED ONLY ONCE THE FILE IS KNOWN TO HOLD A KEY. A file that holds no key leaks nothing, and
|
|
56
|
+
* telling somebody to tighten the permissions of the wrong file sends them the wrong way.
|
|
57
|
+
*/
|
|
58
|
+
function refuseOpenKeyFile(path) {
|
|
59
|
+
if (!modesAreEnforced())
|
|
60
|
+
return;
|
|
61
|
+
const mode = statSync(path).mode & 0o777;
|
|
62
|
+
if ((mode & 0o077) === 0)
|
|
63
|
+
return;
|
|
64
|
+
throw new NmtsError(`${path} can be read by other users of this machine (mode ${mode.toString(8)}).`, {
|
|
65
|
+
exitCode: 2,
|
|
66
|
+
nextStep: `Nothing was signed. Make it yours alone with \`chmod 600 ${path}\`, then run this again.`,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
43
69
|
/** The first line with anything on it, or this tool's own refusal. */
|
|
44
70
|
function readOneLine(path) {
|
|
45
71
|
let raw;
|
|
@@ -63,6 +89,7 @@ function readOneLine(path) {
|
|
|
63
89
|
nextStep: "Nothing was signed. The file holds one line beginning `suiprivkey1`.",
|
|
64
90
|
});
|
|
65
91
|
}
|
|
92
|
+
refuseOpenKeyFile(path);
|
|
66
93
|
return line;
|
|
67
94
|
}
|
|
68
95
|
/** The keypair that line names, for the three schemes an opener may use. */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ExternalPayer } from "./wallet-sign-external.ts";
|
|
2
|
+
/**
|
|
3
|
+
* `--sui-key-file` for one put, judged before the account is opened: a file that cannot pay is a
|
|
4
|
+
* command line to fix (`openers-key-file.ts` says which).
|
|
5
|
+
*
|
|
6
|
+
* ⛔ ONE PAYER PER RUN (the SDK's TWO_PAYERS rule, `put-wallet.ts` there): `--wallet` names one of
|
|
7
|
+
* this key's wallets and the key file names another.
|
|
8
|
+
*/
|
|
9
|
+
export declare function keyFilePayer(path: string, wallet: string | undefined): ExternalPayer;
|
|
10
|
+
/** ⛔ REFUSED, NOT IGNORED: ignored, a push would pay from this key's own wallet instead. */
|
|
11
|
+
export declare function refuseKeyFileForPush(): never;
|
|
12
|
+
/** The wallet in `path` as the payer of an upload. */
|
|
13
|
+
export declare function payerFromKeyFile(path: string): ExternalPayer;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// A wallet that pays for one upload from a key file (`put --pay wallet --sui-key-file <file>` · L338).
|
|
2
|
+
//
|
|
3
|
+
// ⛔ THE SAME ROAD AS EVERY OUTSIDE WALLET. The key file becomes an `ExternalPayer`, and the upload is
|
|
4
|
+
// priced, signed and judged by `wallet-sign-external.ts` exactly as an extension's or the SDK's
|
|
5
|
+
// `pay: { signer }` is: the payer's address goes in before anything is priced, so the review, both
|
|
6
|
+
// balances and the measured fee name the wallet that will sign. Nothing here builds a transaction.
|
|
7
|
+
//
|
|
8
|
+
// ⛔ THE KEY IS READ THROUGH THE ONE READER (`openers-key-file.ts`), which refuses a file other users
|
|
9
|
+
// can read and never quotes its contents.
|
|
10
|
+
import { fromBase64 } from "@mysten/sui/utils";
|
|
11
|
+
import { NmtsError } from "./errors.js";
|
|
12
|
+
import { signerFromKeyFile } from "./openers-key-file.js";
|
|
13
|
+
import { BINARY_NAME } from "./product.js";
|
|
14
|
+
/**
|
|
15
|
+
* `--sui-key-file` for one put, judged before the account is opened: a file that cannot pay is a
|
|
16
|
+
* command line to fix (`openers-key-file.ts` says which).
|
|
17
|
+
*
|
|
18
|
+
* ⛔ ONE PAYER PER RUN (the SDK's TWO_PAYERS rule, `put-wallet.ts` there): `--wallet` names one of
|
|
19
|
+
* this key's wallets and the key file names another.
|
|
20
|
+
*/
|
|
21
|
+
export function keyFilePayer(path, wallet) {
|
|
22
|
+
if (wallet !== undefined) {
|
|
23
|
+
throw new NmtsError("--wallet names one of this key's wallets, and --sui-key-file names another.", {
|
|
24
|
+
exitCode: 2,
|
|
25
|
+
nextStep: "Nothing was sent and nothing was signed. Keep one of the two: one run, one payer.",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return payerFromKeyFile(path);
|
|
29
|
+
}
|
|
30
|
+
/** ⛔ REFUSED, NOT IGNORED: ignored, a push would pay from this key's own wallet instead. */
|
|
31
|
+
export function refuseKeyFileForPush() {
|
|
32
|
+
throw new NmtsError("--sui-key-file pays for one put, not for a push.", {
|
|
33
|
+
exitCode: 2,
|
|
34
|
+
nextStep: `Nothing was sent. Put each file with \`${BINARY_NAME} put <file> --pay wallet --sui-key-file <file>\`.`,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** The wallet in `path` as the payer of an upload. */
|
|
38
|
+
export function payerFromKeyFile(path) {
|
|
39
|
+
const signer = signerFromKeyFile(path);
|
|
40
|
+
return {
|
|
41
|
+
address: signer.toSuiAddress(),
|
|
42
|
+
signTransaction: async ({ bytes }) => {
|
|
43
|
+
const signed = await signer.signTransaction(bytes);
|
|
44
|
+
return { bytes: fromBase64(signed.bytes), signature: signed.signature };
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
package/dist/product.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const BINARY_NAME = "nmts";
|
|
|
9
9
|
* beside it. Here rather than in `main.ts` because the MCP server has to say it too, and a
|
|
10
10
|
* command importing the entry point is a cycle waiting to bite.
|
|
11
11
|
*/
|
|
12
|
-
export declare const VERSION = "0.
|
|
12
|
+
export declare const VERSION = "0.54.0";
|
|
13
13
|
/** Where the product lives, for messages that need to send somebody somewhere real. */
|
|
14
14
|
export declare const HOME_URL = "https://nmts.me";
|
|
15
15
|
/** The source, so a person holding only the built program can find what it was built from. */
|
|
@@ -25,5 +25,10 @@ export declare const COPYRIGHT = "Copyright 2026 needmoretruth";
|
|
|
25
25
|
* invisible from here.
|
|
26
26
|
*/
|
|
27
27
|
export declare const SUPPORT_EMAIL = "nmts@nmts.me";
|
|
28
|
+
/**
|
|
29
|
+
* The NMTS Discord's #help forum, a permanent invite (owner 2026-11-07). The web drive links the
|
|
30
|
+
* same address under its failure sentences (`web/src/lib/discord.ts`); this is the CLI's copy.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DISCORD_HELP_URL = "https://discord.gg/HtrUwhb2Mz";
|
|
28
33
|
/** The document in the source repository that is written for an agent rather than for a person. */
|
|
29
34
|
export declare const AGENTS_DOC = "AGENTS.md";
|
package/dist/product.js
CHANGED
|
@@ -18,7 +18,7 @@ export const BINARY_NAME = "nmts";
|
|
|
18
18
|
* beside it. Here rather than in `main.ts` because the MCP server has to say it too, and a
|
|
19
19
|
* command importing the entry point is a cycle waiting to bite.
|
|
20
20
|
*/
|
|
21
|
-
export const VERSION = "0.
|
|
21
|
+
export const VERSION = "0.54.0";
|
|
22
22
|
/** Where the product lives, for messages that need to send somebody somewhere real. */
|
|
23
23
|
export const HOME_URL = "https://nmts.me";
|
|
24
24
|
/** The source, so a person holding only the built program can find what it was built from. */
|
|
@@ -34,5 +34,10 @@ export const COPYRIGHT = "Copyright 2026 needmoretruth";
|
|
|
34
34
|
* invisible from here.
|
|
35
35
|
*/
|
|
36
36
|
export const SUPPORT_EMAIL = "nmts@nmts.me";
|
|
37
|
+
/**
|
|
38
|
+
* The NMTS Discord's #help forum, a permanent invite (owner 2026-11-07). The web drive links the
|
|
39
|
+
* same address under its failure sentences (`web/src/lib/discord.ts`); this is the CLI's copy.
|
|
40
|
+
*/
|
|
41
|
+
export const DISCORD_HELP_URL = "https://discord.gg/HtrUwhb2Mz";
|
|
37
42
|
/** The document in the source repository that is written for an agent rather than for a person. */
|
|
38
43
|
export const AGENTS_DOC = "AGENTS.md";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needmoretruth/nmts-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.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": {
|
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.54.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.54.0",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|