@needmoretruth/nmts-cli 0.45.0 → 0.47.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 (252) hide show
  1. package/AGENTS.md +8 -8
  2. package/CHANGELOG.md +78 -0
  3. package/README.ko.md +6 -3
  4. package/README.md +31 -11
  5. package/dist/api-advice.js +17 -2
  6. package/dist/api.d.ts +22 -0
  7. package/dist/api.js +49 -1
  8. package/dist/arg-options.d.ts +19 -1
  9. package/dist/args.js +14 -2
  10. package/dist/artifact-about.d.ts +1 -1
  11. package/dist/autonomy.js +3 -3
  12. package/dist/collision.d.ts +20 -3
  13. package/dist/collision.js +21 -3
  14. package/dist/commands/erase.js +1 -0
  15. package/dist/commands/handover.d.ts +15 -0
  16. package/dist/commands/handover.js +376 -0
  17. package/dist/commands/heavy-run.d.ts +59 -0
  18. package/dist/commands/heavy-run.js +247 -0
  19. package/dist/commands/heavy.d.ts +7 -0
  20. package/dist/commands/heavy.js +123 -0
  21. package/dist/commands/link.d.ts +12 -0
  22. package/dist/commands/link.js +121 -0
  23. package/dist/commands/ls.d.ts +5 -0
  24. package/dist/commands/ls.js +9 -1
  25. package/dist/commands/public-code-manage.d.ts +24 -0
  26. package/dist/commands/public-code-manage.js +217 -0
  27. package/dist/commands/public-code.d.ts +12 -1
  28. package/dist/commands/public-code.js +140 -45
  29. package/dist/commands/push-heavy.d.ts +6 -0
  30. package/dist/commands/push-heavy.js +128 -0
  31. package/dist/commands/push-tree.d.ts +24 -0
  32. package/dist/commands/push-tree.js +91 -0
  33. package/dist/commands/push.d.ts +4 -13
  34. package/dist/commands/push.js +7 -77
  35. package/dist/commands/put-heavy.d.ts +9 -0
  36. package/dist/commands/put-heavy.js +120 -0
  37. package/dist/commands/put-payer.d.ts +21 -0
  38. package/dist/commands/put-payer.js +24 -0
  39. package/dist/commands/put.d.ts +2 -2
  40. package/dist/commands/put.js +8 -7
  41. package/dist/commands/receive.js +14 -8
  42. package/dist/commands/s3.js +44 -10
  43. package/dist/commands/share-dispatch.js +14 -1
  44. package/dist/commands/share.d.ts +2 -0
  45. package/dist/commands/share.js +45 -35
  46. package/dist/commands/shares-sent.js +8 -3
  47. package/dist/crypto-surface.d.ts +35 -0
  48. package/dist/crypto-surface.js +13 -0
  49. package/dist/crypto.d.ts +8 -0
  50. package/dist/crypto.js +8 -0
  51. package/dist/download-part.d.ts +32 -1
  52. package/dist/download-part.js +95 -6
  53. package/dist/download-range.d.ts +19 -0
  54. package/dist/download-range.js +108 -0
  55. package/dist/download-sink.d.ts +15 -0
  56. package/dist/download.d.ts +14 -0
  57. package/dist/download.js +19 -4
  58. package/dist/handover-codes.d.ts +25 -0
  59. package/dist/handover-codes.js +106 -0
  60. package/dist/handover.d.ts +62 -0
  61. package/dist/handover.js +217 -0
  62. package/dist/heavy-api.d.ts +36 -0
  63. package/dist/heavy-api.js +107 -0
  64. package/dist/heavy-copy.d.ts +72 -0
  65. package/dist/heavy-copy.js +108 -0
  66. package/dist/heavy-evm.d.ts +20 -0
  67. package/dist/heavy-evm.js +106 -0
  68. package/dist/heavy-self-pay.d.ts +92 -0
  69. package/dist/heavy-self-pay.js +167 -0
  70. package/dist/heavy-upload.d.ts +87 -0
  71. package/dist/heavy-upload.js +154 -0
  72. package/dist/heavy-wallet-pay.d.ts +39 -0
  73. package/dist/heavy-wallet-pay.js +73 -0
  74. package/dist/help-options.js +13 -4
  75. package/dist/help.js +24 -3
  76. package/dist/links.d.ts +58 -0
  77. package/dist/links.js +206 -0
  78. package/dist/list-tier.d.ts +7 -0
  79. package/dist/list-tier.js +47 -0
  80. package/dist/main.js +13 -10
  81. package/dist/manifest-write.d.ts +4 -3
  82. package/dist/mcp-tools/reads.js +20 -6
  83. package/dist/mcp-tools/share.js +47 -1
  84. package/dist/mcp-tools/tiers.js +16 -1
  85. package/dist/platform-sign.d.ts +4 -4
  86. package/dist/platform-sign.js +3 -3
  87. package/dist/portable.d.ts +23 -0
  88. package/dist/portable.js +19 -0
  89. package/dist/product.d.ts +1 -1
  90. package/dist/product.js +1 -1
  91. package/dist/public-code-activity.d.ts +35 -0
  92. package/dist/public-code-activity.js +88 -0
  93. package/dist/public-code-refusals.d.ts +25 -0
  94. package/dist/public-code-refusals.js +87 -0
  95. package/dist/public-codes.d.ts +76 -0
  96. package/dist/public-codes.js +182 -0
  97. package/dist/recovery-build.js +16 -0
  98. package/dist/recovery-map-part.d.ts +82 -0
  99. package/dist/recovery-map-part.js +83 -0
  100. package/dist/recovery-map.d.ts +5 -40
  101. package/dist/recovery-map.js +18 -1
  102. package/dist/recovery-source.d.ts +3 -0
  103. package/dist/recovery-source.js +9 -0
  104. package/dist/risk.d.ts +55 -1
  105. package/dist/risk.js +55 -3
  106. package/dist/run-log.d.ts +1 -1
  107. package/dist/run-log.js +7 -1
  108. package/dist/s3/address.d.ts +20 -0
  109. package/dist/s3/address.js +97 -0
  110. package/dist/s3/answer.d.ts +48 -0
  111. package/dist/s3/answer.js +330 -0
  112. package/dist/s3/body-deframe.d.ts +49 -0
  113. package/dist/s3/body-deframe.js +264 -0
  114. package/dist/s3/body-measure.d.ts +13 -0
  115. package/dist/s3/body-measure.js +48 -0
  116. package/dist/s3/body-plan.d.ts +31 -0
  117. package/dist/s3/body-plan.js +159 -0
  118. package/dist/s3/body.d.ts +46 -0
  119. package/dist/s3/body.js +117 -0
  120. package/dist/s3/call.d.ts +36 -0
  121. package/dist/s3/call.js +42 -0
  122. package/dist/s3/checksum.d.ts +26 -0
  123. package/dist/s3/checksum.js +176 -0
  124. package/dist/s3/content-type.d.ts +3 -0
  125. package/dist/s3/content-type.js +49 -0
  126. package/dist/s3/contract.d.ts +91 -14
  127. package/dist/s3/drive-conditions.d.ts +47 -0
  128. package/dist/s3/drive-conditions.js +134 -0
  129. package/dist/s3/drive-key.d.ts +11 -0
  130. package/dist/s3/drive-key.js +58 -0
  131. package/dist/s3/drive-limits.d.ts +33 -0
  132. package/dist/s3/drive-limits.js +53 -0
  133. package/dist/s3/drive-lock.d.ts +11 -0
  134. package/dist/s3/drive-lock.js +47 -0
  135. package/dist/s3/drive-trashed-name.d.ts +13 -0
  136. package/dist/s3/drive-trashed-name.js +59 -0
  137. package/dist/s3/drive-write.d.ts +38 -0
  138. package/dist/s3/drive-write.js +258 -0
  139. package/dist/s3/drive.d.ts +59 -25
  140. package/dist/s3/drive.js +46 -77
  141. package/dist/s3/listing.d.ts +27 -1
  142. package/dist/s3/listing.js +62 -20
  143. package/dist/s3/long-answer.d.ts +12 -0
  144. package/dist/s3/long-answer.js +104 -0
  145. package/dist/s3/multipart-assemble.d.ts +17 -0
  146. package/dist/s3/multipart-assemble.js +68 -0
  147. package/dist/s3/multipart-sweep.d.ts +15 -0
  148. package/dist/s3/multipart-sweep.js +87 -0
  149. package/dist/s3/multipart-view.d.ts +45 -0
  150. package/dist/s3/multipart-view.js +232 -0
  151. package/dist/s3/multipart.d.ts +26 -19
  152. package/dist/s3/multipart.js +193 -78
  153. package/dist/s3/object-read.d.ts +17 -0
  154. package/dist/s3/object-read.js +127 -0
  155. package/dist/s3/object-write.d.ts +35 -0
  156. package/dist/s3/object-write.js +198 -0
  157. package/dist/s3/range.d.ts +14 -0
  158. package/dist/s3/range.js +80 -0
  159. package/dist/s3/response-sink.d.ts +12 -2
  160. package/dist/s3/response-sink.js +71 -7
  161. package/dist/s3/routes.d.ts +0 -1
  162. package/dist/s3/routes.js +242 -217
  163. package/dist/s3/same-file.d.ts +4 -1
  164. package/dist/s3/same-file.js +12 -3
  165. package/dist/s3/server.d.ts +54 -4
  166. package/dist/s3/server.js +174 -14
  167. package/dist/s3/sigv4-canonical.d.ts +91 -0
  168. package/dist/s3/sigv4-canonical.js +148 -0
  169. package/dist/s3/sigv4-presigned.d.ts +13 -0
  170. package/dist/s3/sigv4-presigned.js +82 -0
  171. package/dist/s3/sigv4.d.ts +26 -27
  172. package/dist/s3/sigv4.js +137 -102
  173. package/dist/s3/spool.d.ts +37 -0
  174. package/dist/s3/spool.js +104 -0
  175. package/dist/s3/staging.d.ts +90 -7
  176. package/dist/s3/staging.js +97 -66
  177. package/dist/s3/xml-multipart.d.ts +38 -0
  178. package/dist/s3/xml-multipart.js +47 -0
  179. package/dist/s3/xml-read.d.ts +28 -0
  180. package/dist/s3/xml-read.js +235 -0
  181. package/dist/s3/xml.d.ts +45 -2
  182. package/dist/s3/xml.js +72 -13
  183. package/dist/s3-gateway.d.ts +11 -5
  184. package/dist/s3-gateway.js +5 -2
  185. package/dist/seal.d.ts +1 -1
  186. package/dist/share-codes.d.ts +40 -0
  187. package/dist/share-codes.js +151 -0
  188. package/dist/share.d.ts +39 -0
  189. package/dist/share.js +54 -13
  190. package/dist/shared/lib/api/types-heavy.d.ts +167 -0
  191. package/dist/shared/lib/api/types-heavy.js +60 -0
  192. package/dist/shared/lib/drive/rebuild-verify.js +1 -0
  193. package/dist/shared/lib/filecoin/providers.d.ts +25 -0
  194. package/dist/shared/lib/filecoin/providers.js +58 -0
  195. package/dist/shared/lib/heavy/download.d.ts +48 -0
  196. package/dist/shared/lib/heavy/download.js +116 -0
  197. package/dist/shared/lib/heavy/order-plan.d.ts +77 -0
  198. package/dist/shared/lib/heavy/order-plan.js +83 -0
  199. package/dist/shared/lib/heavy/order-runner.d.ts +9 -0
  200. package/dist/shared/lib/heavy/order-runner.js +300 -0
  201. package/dist/shared/lib/heavy/order-types.d.ts +90 -0
  202. package/dist/shared/lib/heavy/order-types.js +6 -0
  203. package/dist/shared/lib/heavy/order-wire.d.ts +55 -0
  204. package/dist/shared/lib/heavy/order-wire.js +113 -0
  205. package/dist/shared/lib/heavy/piece-cid.d.ts +24 -0
  206. package/dist/shared/lib/heavy/piece-cid.js +55 -0
  207. package/dist/shared/lib/heavy/sp-upload.d.ts +37 -0
  208. package/dist/shared/lib/heavy/sp-upload.js +112 -0
  209. package/dist/shared/lib/heavy/synapse-piece.d.ts +1 -0
  210. package/dist/shared/lib/heavy/synapse-piece.js +8 -0
  211. package/dist/shared/lib/share/handover-format.d.ts +129 -0
  212. package/dist/shared/lib/share/handover-format.js +323 -0
  213. package/dist/shared/lib/share/public-link.d.ts +41 -0
  214. package/dist/shared/lib/share/public-link.js +107 -0
  215. package/dist/shared/lib/share/shared-file-info.js +1 -0
  216. package/dist/shared/lib/storage-network.d.ts +4 -4
  217. package/dist/shared/lib/storage-network.js +7 -7
  218. package/dist/shared/lib/storage-tier.d.ts +28 -0
  219. package/dist/shared/lib/storage-tier.js +63 -0
  220. package/dist/shared/lib/wallet/send-rules.js +1 -0
  221. package/dist/upload-file.d.ts +8 -0
  222. package/dist/upload-file.js +57 -25
  223. package/dist/upload-price-node.d.ts +3 -0
  224. package/dist/upload-price-node.js +3 -6
  225. package/dist/upload-price.d.ts +10 -0
  226. package/dist/upload-price.js +13 -1
  227. package/dist/upload-run.d.ts +80 -0
  228. package/dist/upload-run.js +173 -0
  229. package/dist/upload-steps.js +15 -4
  230. package/dist/upload-store.d.ts +15 -6
  231. package/dist/upload-store.js +6 -0
  232. package/dist/upload-wallet-put.d.ts +9 -4
  233. package/dist/upload-wallet-put.js +16 -6
  234. package/dist/upload-wallet.js +4 -0
  235. package/dist/upload-wire.d.ts +25 -0
  236. package/dist/upload-wire.js +20 -1
  237. package/dist/upload.js +28 -13
  238. package/dist/wallet-sign.js +2 -2
  239. package/docs/commands/handover.md +54 -0
  240. package/docs/commands/heavy.md +35 -0
  241. package/docs/commands/link.md +27 -0
  242. package/docs/commands/mcp.md +2 -1
  243. package/docs/commands/public-code.md +25 -6
  244. package/docs/commands/push.md +4 -1
  245. package/docs/commands/put.md +15 -1
  246. package/docs/commands/share.md +8 -3
  247. package/package.json +5 -2
  248. package/server.json +2 -2
  249. package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +106 -4
  250. package/vendor/nmts-crypto/nmts_crypto_wasm.js +286 -3
  251. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
  252. package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm.d.ts +12 -1
package/AGENTS.md CHANGED
@@ -61,11 +61,11 @@ Four things need a person, all at the beginning. If you are being set up, hand t
61
61
  | 4. Get credits into the account | you, for the free trial (`nmts trial apply`, while step 3 is live) — a person, for a funded wallet | a terminal, or nmts.me | once, then as they run out |
62
62
 
63
63
  **Step 3 does not gate the work.** Reading, writing, listing, folders, the trash, the recovery files and the
64
- wallet's balances never ask about it. Exactly four things do — making another account, the free trial,
65
- creating a share, and moving credits between your own accounts. A lapsed check does not stop you storing and
66
- fetching files; it stops you growing the account, and the account runs in a tighter rate tier until a person
67
- checks in again. `nmts verify --status` says whether it is live and until when; you cannot pass it
68
- (`nmts help verify`).
64
+ wallet's balances never ask about it. Exactly six things do — making another account, the free trial,
65
+ creating a share, making a public link, making a new public code, and
66
+ moving credits between your own accounts. A lapsed check does not stop you storing and fetching files; it
67
+ stops you growing the account, and the account runs in a tighter rate tier until a person checks in again.
68
+ `nmts verify --status` says whether it is live and until when; you cannot pass it (`nmts help verify`).
69
69
 
70
70
  **An account and the accounts made under it count as one.** The check is shared — one passed anywhere in that
71
71
  group is live for all of it — and so is the free trial: the whole group gets one application a week, not one
@@ -102,8 +102,8 @@ week's free places are gone, so it needs a funded wallet" is something a person
102
102
 
103
103
  Every act this tool performs has a tier: **none** (free and reversible: listing, fetching,
104
104
  folders, marks), **low** (reversible but worth a word: the trash, a setting, a report), **medium**
105
- (spends credits or is permanent: uploading, publishing the public code, a new key), **high**
106
- (signs with the wallet, hands a file to somebody, reveals or stores the NMTS key unsealed), and
105
+ (spends credits or is hard to undo: uploading, publishing or making a public code, a new key), **high**
106
+ (signs with the wallet, hands a file to somebody, revokes a public code, reveals or stores the NMTS key unsealed), and
107
107
  **ultra-high** (erasing the account). The person's **mode** says what each tier meets:
108
108
 
109
109
  | | default | auto-low | auto-high | skip-permissions |
@@ -141,7 +141,7 @@ folders, marks), **low** (reversible but worth a word: the trash, a setting, a r
141
141
  | where am I | `env` · `whoami` · `mode` · `unlock` / `lock` |
142
142
  | credentials | `login` · `logout` · `key` (new · list · revoke) · `devices` · `verify` |
143
143
  | files | `ls` / `listfile` · `get` · `pull` · `put` · `push` · `rm` / `restore` / `sweep` · `mkdir` / `mv` / `rename` · `star` / `pin` / `label` |
144
- | the account | `usage` / `balance` / `expiring` · `losses` · `trial` · `credits` · `public-code` · `create` · `delete-account` · `accept-terms` |
144
+ | the account | `usage` / `balance` / `expiring` · `losses` · `trial` · `credits` · `public-code` (list · new · revoke) · `create` · `delete-account` · `accept-terms` |
145
145
  | paying and the wallet | `extend` · `wallet` (address · activity · storage · send · swap · donate · hall) |
146
146
  | other accounts | `share` / `shares` / `receive` / `unshare` |
147
147
  | settings | `on-collision` · `padding` · `deposit` · `tip` |
package/CHANGELOG.md CHANGED
@@ -3,6 +3,84 @@
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.47.0 — 2026-09-27
7
+
8
+ - **Public links.** `nmts link make <path>` makes a link to one file that anyone can open without
9
+ an account, and prints it. The file's key travels in the part after `#`, which no request
10
+ carries. `--hide-name` leaves the name out and `--expires <n>d` ends the link after 1 to 3650
11
+ days. `link list <path>` prints every link to that file with its download count, `link revoke
12
+ <id>` cuts one, and `link open <link>` downloads and checks a file from a link without logging
13
+ in. `make` sits behind the same unlock as `share`. See `nmts help link`.
14
+ - **Up to three public codes.** Every code comes from the one NMTS key at a number.
15
+ `nmts public-code list` shows them all, live and revoked, with what went through each;
16
+ `public-code new` publishes the next one (`--replace <n>` revokes one in the same request); and
17
+ `public-code revoke <n>` revokes one for good, asking every time. `share`, `handover make` and
18
+ `public-code --save` take `--as <n>` to use a code other than the lowest-numbered live one.
19
+ - **NMTS Heavy on nmts.me.** nmts.me switched Heavy on, paid with credits. Its `--pay wallet`
20
+ payment is still off and answers `heavy_wallet_pay_off`; `--pay evm` works as before.
21
+
22
+ ## 0.46.0 — 2026-09-27
23
+
24
+ - **NMTS Heavy.** `nmts put --tier heavy` and `nmts push --tier heavy` keep each part of a file whole
25
+ in two separate places on Filecoin instead of spreading it across Walrus storage nodes. Paid with
26
+ credits, each part costs half the Standard credits, rounded up and at least one, and the file is
27
+ kept 28 days. `get`, `pull` and `receive` open Heavy files from their recorded Filecoin copies,
28
+ `ls --long` has a tier column, and the recovery list records Heavy parts so `nmts-recovery` can
29
+ read them. A server that has not switched Heavy on answers `heavy_unavailable` before anything is
30
+ charged; nmts.me has not switched it on yet.
31
+ - **Paying Filecoin yourself.** `nmts heavy wallet` shows the EVM wallet your NMTS key derives
32
+ (NCF-3 §1.9), its FIL and USDFC, and its Filecoin Pay deposit. `nmts heavy fund <USDFC>` deposits
33
+ into Filecoin Pay. `put --tier heavy --pay evm` then pays the storage providers from that deposit,
34
+ with `--copies` (1 to 12, default 2) and `--providers` choosing where; it does not go through
35
+ NMTS's treasury. See `nmts help heavy`.
36
+ - **Empty files:** `put` and `nmts s3` store an empty file on NMTS Standard instead of refusing it.
37
+ `push` still skips empty files, and `--tier heavy` refuses one.
38
+ - **`nmts s3`:**
39
+ - A range is read from the stored part it starts in. Each range used to be decrypted from the
40
+ file's first byte, so a client fetching a 1 GB file in 8 MiB ranges read about 64 GB and the
41
+ late ranges timed out.
42
+ - A large upload is no longer cut after five minutes. The connection closes only when the body
43
+ stops arriving for two minutes, and a request sent with `Expect: 100-continue` is refused
44
+ before its body when its signature or bucket is wrong.
45
+ - Presigned URLs work, and every `aws-chunked` body form is decoded with each chunk signature and
46
+ checksum checked. A request whose signature leaves out `host` or an `x-amz-` header is refused.
47
+ - A listing without a delimiter shows folders as `folder/` markers of 0 bytes, and a `PUT` of
48
+ `folder/` with no bytes makes one.
49
+ - Refusals are answered with the S3 codes clients act on (`AccessDenied`, `AccountProblem`,
50
+ `OperationAborted`, `InvalidRequest`, `NotImplemented`, `SlowDown`) and one fixed sentence each;
51
+ the details go to the log line. Before, most became a `500` the client retried.
52
+ - Served files carry `Content-Security-Policy: sandbox` and `X-Content-Type-Options: nosniff`, and a
53
+ signed link can set the type and disposition with `response-content-type` and
54
+ `response-content-disposition`.
55
+ - `CompleteMultipartUpload` and `CopyObject` answer at once and keep the connection alive while the
56
+ file is stored. A batch delete that puts a condition on one of its keys is refused.
57
+ - Uploading the same bytes to the same place a second time is a new upload with its own keys. It
58
+ used to rebuild the first upload's keys, so each reservation was refused and a wallet-paid second
59
+ run was answered with the first file.
60
+ - For programs: a library call that says whether to rename or overwrite is taken as the program's
61
+ choice; `null` means the machine's setting. Upload refusals carry the server's code, status and
62
+ `Retry-After`, and a wallet known to be short is refused with the code `WALLET_SHORT`.
63
+
64
+ - **Handover files.** `nmts handover make <path> --to <public code | public code file>` writes one
65
+ file of your drive into a handover file sealed to one recipient, which you pass on yourself; no
66
+ share is registered. `nmts handover open <file>` opens it with your NMTS key, needs no API key,
67
+ asks the NMTS server nothing and fetches the pieces from Walrus aggregators. A handover cannot be
68
+ taken back: the recipient can download the file until its storage ends or its stored bytes are
69
+ destroyed, and removing the file from your drive does not stop it. The format is NCF-3 §5.6.
70
+ - **Public code files.** `nmts public-code --save [file]` writes your public code and the identity
71
+ behind it (`nmts-public-code-<code>.nmtscode` by default). Someone who has it can make a handover
72
+ file for you without looking your code up, so NMTS does not learn who is sending to you. It proves
73
+ only itself: compare the code it shows with the one you were given. The format is NCF-3 §5.7.
74
+ - `nmts receive <id>` without `--out` now saves into the current directory under the last segment
75
+ of the name the sender sealed. A name such as `../x` or an absolute path used to be written where
76
+ it pointed.
77
+ - A download refuses a stored piece whose header names a different position than the one it was
78
+ listed in, as NCF-3 §4.1 requires.
79
+ - `nmts erase` says that anyone you gave a handover file to can still open the file until its
80
+ storage ends or its stored bytes are destroyed.
81
+ - The local run log no longer writes down `--to` or the public code a recipient lookup asked for.
82
+ - Download errors no longer speak of "this account" where the reader may be a recipient.
83
+
6
84
  ## 0.45.0 — 2026-09-24
7
85
 
8
86
  - **Video preview pictures.** `nmts put <video> --thumbnail` takes one frame with ffmpeg, when it is
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.45.0 # 버전을 고정할 때
53
+ npm install -g github:needmoretruth/nmts-cli#v0.47.0 # 버전을 고정할 때
54
54
  npm install -g https://github.com/needmoretruth/nmts-cli/releases/latest/download/nmts.tgz
55
55
  ```
56
56
 
@@ -182,11 +182,13 @@ NMTS 키는 한 번에 전부입니다. 그것을 가진 프로그램은 모든
182
182
  | `nmts trial` | 이번 주 무료 크레딧이 얼마나 남았는지. `trial apply`가 신청합니다 |
183
183
  | `nmts create` | 새 계정을 만들고 NMTS 키를 한 번 찍습니다. 다시 찍을 수 있는 것은 없습니다. 이 기기에 확인된 API 키가 없으면 NMTS 키를 여기서 만들고 주소 하나를 찍은 뒤, 사람이 그 주소를 열어 그 NMTS 키를 입력하고 사람 확인을 통과할 때까지 기다립니다 — 그 순간 계정이 생깁니다. `--no-wait`는 주소만 찍고 멈춥니다 |
184
184
  | `nmts verify` | 이 계정의 한도를 여는 사람 확인을 부탁합니다. 계정 주인만 할 수 있습니다 — 그 브라우저에서 이 계정에 로그인돼 있거나, 거기서 NMTS 키를 입력합니다 |
185
- | `nmts public-code` | 다른 계정이 파일을 보내는 코드. `--publish`가 받을 수 있게 합니다 |
185
+ | `nmts public-code` | 다른 계정이 파일을 보내는 코드. `--publish`가 받을 수 있게 합니다. `--save [파일]`은 공개 코드 파일을 씁니다 |
186
186
  | `nmts share <path> <address>` | 파일 하나를 다른 계정에 줍니다 — **거둬도 이미 받아 간 사본은 못 되돌립니다**. `nmts unlock share`로 열기 전에는 잠겨 있고, 공유마다 멈춰서 `--yes`가 이 파일 하나에 답합니다 |
187
187
  | `nmts shares` | 이 계정에 공유된 것. `--sent <경로>`는 파일 하나가 누구에게 갔는지 |
188
188
  | `nmts receive <id>` | 누군가 이 계정에 공유한 파일 하나를 다운로드합니다 |
189
189
  | `nmts unshare <id>` | 보낸 공유를 거두거나, 받은 공유를 지웁니다 |
190
+ | `nmts handover make <path> --to <공개 코드 \| 공개 코드 파일>` | 한 계정에게 건넬 건네기 파일을 쓰고, 직접 전합니다 — **되돌릴 수 없고**, NMTS에는 기록이 남지 않습니다. `share`처럼 잠겨 있습니다 |
191
+ | `nmts handover open <file>` | 건네기 파일에 든 파일을 다운로드합니다. NMTS 키만 있으면 되고 API 키는 필요 없으며, NMTS 서버에 아무것도 묻지 않습니다 |
190
192
  | `nmts rebuild` | 목록이 없는 계정에서, 서버의 줄로 파일 목록을 다시 짓습니다 |
191
193
  | `nmts rollback` | 파일 목록의 이전 버전을 되돌립니다 — 사람이 하는 일 |
192
194
  | `nmts listfile` | 이 기계가 가진 암호화된 파일 목록을 파일로 씁니다 |
@@ -462,7 +464,8 @@ $ nmts s3
462
464
  ```
463
465
 
464
466
  - 버킷은 `drive` 하나. 키는 앞 슬래시를 뺀 파일 경로입니다. 폴더는 빈 것까지 common prefix로
465
- 돌아옵니다.
467
+ 돌아오고, 구분자 없는 목록에서는 0바이트 `folder/` 표시로도 돌아옵니다. 바이트 없이 `folder/`를
468
+ `PUT`하면 그 폴더가 생깁니다. 빈 파일도 다른 파일처럼 저장됩니다.
466
469
  - 자격은 명령이 시작될 때 만들어지고, 어디에도 저장되지 않으며, 명령과 함께 죽습니다.
467
470
  - 127.0.0.1에만 귀를 기울이고, 바꾸는 옵션은 없습니다.
468
471
  - 시작할 때 한 번 묻습니다(이것을 거친 업로드는 크레딧을 씁니다). 스크립트는 `--yes`로 답합니다. 삭제는
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.45.0 # a pinned version
54
+ npm install -g github:needmoretruth/nmts-cli#v0.47.0 # a pinned version
55
55
  npm install -g https://github.com/needmoretruth/nmts-cli/releases/latest/download/nmts.tgz
56
56
  ```
57
57
 
@@ -186,11 +186,18 @@ your main one.
186
186
  | `nmts trial` | What is left of this week's free credits. `trial apply` asks for some |
187
187
  | `nmts create` | Make a NEW account and print its NMTS key once. Nothing can print it again. With no verified API key on this machine it makes the NMTS key here, prints an address, and waits while a person opens it, types that NMTS key and passes the human check — the account exists the moment they finish. `--no-wait` prints the address and stops |
188
188
  | `nmts verify` | Ask a person to pass the check that opens this account's limits. Only the account holder can: signed in to this account in that browser, or typing its NMTS key there |
189
- | `nmts public-code` | The code other accounts send files to. `--publish` makes it reachable |
189
+ | `nmts public-code` | The code other accounts send files to. `--publish` makes it reachable; `--save [file]` writes your public code file |
190
+ | `nmts public-code list · new · revoke <n>` | Every code your NMTS key has published; publish the next one (`--replace <n>` revokes one in the same step); revoke one — nobody can send to it again. Revoking asks every time |
190
191
  | `nmts share <path> <address>` | Give one file to another account — **withdrawing does not recall it**. Locked until `nmts unlock share`; every share stops and `--yes` answers for that one file |
191
192
  | `nmts shares` | What was shared with this account; `--sent <path>` shows who one file went to |
192
193
  | `nmts receive <id>` | Download one file somebody shared with this account |
193
194
  | `nmts unshare <id>` | Withdraw a share you sent, or remove one you were sent |
195
+ | `nmts handover make <path> --to <public code \| public code file>` | Write a handover file for one account and pass it on yourself — **it cannot be taken back**, and NMTS keeps no record of it. Locked like `share` |
196
+ | `nmts handover open <file>` | Download the file a handover file carries. Needs the NMTS key and no API key; tells the NMTS server nothing about the file |
197
+ | `nmts link make <path> [--hide-name] [--expires <n>d]` | Make a public link to a file |
198
+ | `nmts link list <path>` | List a file's public links |
199
+ | `nmts link revoke <id>` | Cut a public link |
200
+ | `nmts link open <link> [--out <path>]` | Download and decrypt a file from a public link, without logging in |
194
201
  | `nmts rebuild` | Build a file list from the server's rows, for an account with none |
195
202
  | `nmts rollback` | Put the previous version of the file list back — locked until `nmts unlock rollback`, `--yes` every run |
196
203
  | `nmts listfile` | Write this machine's copy of the sealed file list out as a file |
@@ -356,13 +363,24 @@ share stops further downloads and cannot reach a copy already taken, which is wh
356
363
  for an agreement the first time.
357
364
 
358
365
  `public-code` prints the value other accounts send files to and says whether it is published.
359
- Until it is published nobody can send to you. `--publish` writes it, permanently: it derives from
360
- your NMTS key, so it cannot be chosen or changed. It is not your NMTS key, and it opens
361
- nothing on its own.
366
+ Until it is published nobody can send to you. `--publish` writes it. Every code derives from your
367
+ NMTS key at a number, so it cannot be chosen; you hold one to three live ones, make the next with
368
+ `public-code new`, and revoke one with `public-code revoke <n>` — nobody can send to a revoked code,
369
+ and files already received with it stay. `share --as <n>` picks which code sends. A public code is
370
+ not your NMTS key, and it opens nothing on its own.
362
371
 
363
372
  `nmts shares --sent <path>` lists who one file was shared with — the recipient address, since when,
364
373
  and the share id `unshare` takes.
365
374
 
375
+ A share tells NMTS who shared with whom. A handover does not: `nmts handover make <path> --to
376
+ <recipient>` writes the file, sealed to one recipient, into a handover file you pass on yourself,
377
+ and no share is registered. The recipient opens it with `nmts handover open <file>`, which needs no
378
+ API key and tells the NMTS server nothing about the file. Give `--to` their public code file (`nmts public-code
379
+ --save` on their side) and the server is not even asked whose code it is; give it the code and the
380
+ server sees that lookup. Whoever holds a handover file sees your public code in it. It cannot be
381
+ taken back: the recipient can download the file until its storage ends or its stored bytes are
382
+ destroyed, and removing the file from your drive does not stop it. The format is NCF-3 §5.6–§5.7.
383
+
366
384
  ### Recovery
367
385
 
368
386
  `recovery-list` writes the encrypted file that locates your bytes on the storage network; it holds
@@ -426,10 +444,11 @@ nmts openers remove <locator> # take one off
426
444
  ## What it stops to ask about
427
445
 
428
446
  Every act has a tier. **None** (listing, fetching, folders, marks) never asks. **Low** (the trash,
429
- a setting, a report) and **medium** (uploading, publishing the public code, a new key) ask once
430
- per run — y/N at the terminal, or `--yes`. **High** (signing with the wallet, giving another
447
+ a setting, a report) and **medium** (uploading, publishing or making a public code, a new key) ask
448
+ once per run — y/N at the terminal, or `--yes`. **High** (signing with the wallet, giving another
431
449
  account a file, revealing or storing your NMTS key unsealed) is locked until you run `nmts unlock
432
- <key>` once on this machine, and then still asks on every run. **Ultra-high** (erasing the
450
+ <key>` once on this machine, and then still asks on every run; revoking a public code is high too,
451
+ with no unlock, and asks every time. **Ultra-high** (erasing the
433
452
  account) is a typed sentence. `nmts unlock` lists the keys; each unlock prints what it opens, what
434
453
  could go wrong and what it does not cover before it asks. `nmts help <command>` prints any
435
454
  command's document, with its tier at the top.
@@ -486,7 +505,8 @@ $ nmts s3
486
505
  ```
487
506
 
488
507
  - One bucket, `drive`. A key is the file's path without the leading slash. Folders come back as
489
- common prefixes, including empty ones.
508
+ common prefixes, including empty ones, and as `folder/` markers of 0 bytes in a listing without a
509
+ delimiter; a `PUT` of `folder/` with no bytes makes one. An empty file is stored like any other.
490
510
  - The credentials are made when the command starts, stored nowhere, and die with it.
491
511
  - It listens on 127.0.0.1 only, with no option to change that.
492
512
  - Starting it asks once (uploads through it spend credits); `--yes` answers for a script. Deleting
@@ -530,14 +550,14 @@ the arguments `mcp --out <directory>`, for example in opencode's own file:
530
550
  { "mcp": { "nmts": { "type": "local", "command": ["nmts", "mcp", "--out", "/where/files/should/land"] } } }
531
551
  ```
532
552
 
533
- It offers thirty-eight tools: reading the account (`nmts_whoami`, `nmts_list`, `nmts_usage`,
553
+ It offers forty tools: reading the account (`nmts_whoami`, `nmts_list`, `nmts_usage`,
534
554
  `nmts_expiring`, `nmts_balance`, `nmts_shares`, `nmts_shares_sent`), the wallet's own reads
535
555
  (`nmts_wallet_activity`, `nmts_wallet_storage`), the signed-in devices (`nmts_devices`), storage the daily check could
536
556
  not find (`nmts_losses`, `nmts_loss_recheck`), fetching (`nmts_get`, `nmts_pull`, `nmts_receive`),
537
557
  uploading (`nmts_put`, `nmts_push`, `nmts_padding`, `nmts_deposit`), rearranging (`nmts_mkdir`, `nmts_move`,
538
558
  `nmts_rename`, `nmts_mark`, `nmts_label_rename`, `nmts_unlabel_all`, `nmts_trash`, `nmts_restore`),
539
559
  moving credits between accounts of your own (`nmts_credits_transfer`),
540
- sharing (`nmts_public_code`, `nmts_share`, `nmts_unshare`), writing to the developer
560
+ sharing (`nmts_public_code`, `nmts_public_code_new`, `nmts_public_code_revoke`, `nmts_share`, `nmts_unshare`), writing to the developer
541
561
  (`nmts_support_send`, `nmts_support_list`, `nmts_support_show`, `nmts_support_reply`) and the
542
562
  documents this service publishes (`nmts_notices`, `nmts_notice`, `nmts_terms`, `nmts_privacy`).
543
563
 
@@ -14,6 +14,7 @@
14
14
  // nothing it can act on; "this key was revoked — make a new one" tells it whether to retry, to
15
15
  // ask a person, or to stop. Several entries exist only to stop an agent from retrying the one
16
16
  // remedy that cannot possibly work.
17
+ import { HEAVY_COPY } from "./heavy-copy.js";
17
18
  /** What a caller does next about a refusal, when the tool knows something the message does not. */
18
19
  export function adviseFor(code) {
19
20
  switch (code) {
@@ -117,9 +118,12 @@ export function adviseFor(code) {
117
118
  return ("There is nothing to accept, so accepting cannot be what is missing. This is a server " +
118
119
  "condition; report it rather than retrying.");
119
120
  // ── Credits and the free trial ────────────────────────────────────────────────────────────
121
+ // NMTS Heavy's order route names the same three credit refusals in its own spelling (lower case).
122
+ case "file_credits_cap":
120
123
  case "CREDIT_FILE_CAP":
121
124
  return ("One file may cost at most the published cap in credits, and this one costs more. The " +
122
125
  "refusal carries both numbers. Splitting the file is the way through; more credits is not.");
126
+ case "day_credits_cap":
123
127
  case "CREDIT_DAILY_CAP":
124
128
  return ("The account has spent its allowance for today. The refusal carries the cap and what is " +
125
129
  "spent. Waiting for the day to turn is the only remedy — buying credits does not lift it.");
@@ -176,8 +180,9 @@ export function adviseFor(code) {
176
180
  "Storage bought from a wallet is released by that wallet.");
177
181
  case "SPONSORED_IDEM_MISMATCH":
178
182
  return ("This reservation key already names a different blob: the piece was re-encrypted after it " +
179
- "was reserved. Repeating the call under this key cannot work. Start the upload again so it " +
180
- "derives new keys; nothing was charged for this call.");
183
+ "was reserved. Repeating the call under this key cannot work, and nothing was charged for " +
184
+ "it. Reserve the new bytes under a key the account has never used — a key made fresh for " +
185
+ "each upload, not one worked out from the file, which gives the same answer again.");
181
186
  case "SPONSORED_STATE":
182
187
  return ("The upload is not at the step that call belongs to — the steps have an order and one was " +
183
188
  "skipped or already done. Start the upload again rather than repeating this call.");
@@ -212,8 +217,18 @@ export function adviseFor(code) {
212
217
  case "ERASE_BLOCKED":
213
218
  return ("The account cannot be erased while retained records still point at it. This will not " +
214
219
  "clear by retrying; the records have their own retention and it has to run out.");
220
+ case "credits_insufficient":
215
221
  case "CREDITS_SHORT":
216
222
  return "The account does not have enough credits for this upload.";
223
+ // ── NMTS Heavy ── the words are the copy table's (`heavy-copy.ts`).
224
+ case "heavy_wallet_pay_off":
225
+ return HEAVY_COPY.adviceWalletPayOff;
226
+ case "heavy_unavailable":
227
+ return HEAVY_COPY.adviceUnavailable;
228
+ case "heavy_price_unavailable":
229
+ return HEAVY_COPY.advicePriceUnavailable;
230
+ case "unpaid_orders_cap":
231
+ return HEAVY_COPY.adviceUnpaidCap;
217
232
  default:
218
233
  return null;
219
234
  }
package/dist/api.d.ts CHANGED
@@ -121,3 +121,25 @@ export declare function request(base: string, path: string, options: RequestOpti
121
121
  as: "bytes";
122
122
  }): Promise<Uint8Array>;
123
123
  export declare function request(base: string, path: string, options?: RequestOptions): Promise<unknown>;
124
+ /**
125
+ * A bearer that is asked for at the moment of each request instead of being fixed when a client is
126
+ * made: what a delegation token that runs out needs, the way an AWS credential provider is asked.
127
+ * It may answer at once or after its own round trip; this module keeps no copy of what it answers.
128
+ */
129
+ export type BearerSource = () => string | Promise<string>;
130
+ /**
131
+ * Stand a source in for a bearer everywhere one is passed as text.
132
+ *
133
+ * ⛔ A STAND-IN RATHER THAN A SECOND PARAMETER ON EVERY FUNCTION. The credential travels as a
134
+ * string through every verb of this package — the file list, the upload, the download, the
135
+ * trash — and each of them hands it to `request` in the end. Resolving the stand-in HERE, per
136
+ * attempt, is what makes every one of those requests carry a token that is current when it
137
+ * leaves, including the ones an upload makes after it has already spent.
138
+ *
139
+ * ⚠ `release` forgets the source; a request that still carries the stand-in afterwards is refused
140
+ * by name rather than sent without a credential.
141
+ */
142
+ export declare function bearerSource(source: BearerSource): {
143
+ bearer: string;
144
+ release(): void;
145
+ };
package/dist/api.js CHANGED
@@ -77,9 +77,57 @@ export async function request(base, path, options = {}) {
77
77
  ...(options.retryBudgetMs === undefined ? {} : { budgetMs: options.retryBudgetMs }),
78
78
  });
79
79
  }
80
+ /** What a stand-in handed out by `bearerSource` starts with. Not a secret, and never sent. */
81
+ const SOURCE_MARK = "nmts-bearer-source:";
82
+ const sources = new Map();
83
+ let issued = 0;
84
+ /**
85
+ * Stand a source in for a bearer everywhere one is passed as text.
86
+ *
87
+ * ⛔ A STAND-IN RATHER THAN A SECOND PARAMETER ON EVERY FUNCTION. The credential travels as a
88
+ * string through every verb of this package — the file list, the upload, the download, the
89
+ * trash — and each of them hands it to `request` in the end. Resolving the stand-in HERE, per
90
+ * attempt, is what makes every one of those requests carry a token that is current when it
91
+ * leaves, including the ones an upload makes after it has already spent.
92
+ *
93
+ * ⚠ `release` forgets the source; a request that still carries the stand-in afterwards is refused
94
+ * by name rather than sent without a credential.
95
+ */
96
+ export function bearerSource(source) {
97
+ issued += 1;
98
+ const bearer = `${SOURCE_MARK}${issued}`;
99
+ sources.set(bearer, source);
100
+ return { bearer, release: () => void sources.delete(bearer) };
101
+ }
102
+ /** The bearer one attempt sends: the text it was given, or what its source answers now. */
103
+ async function bearerFor(token) {
104
+ if (token === undefined || !token.startsWith(SOURCE_MARK))
105
+ return token;
106
+ const source = sources.get(token);
107
+ const refuse = (why) => new NmtsError(why, {
108
+ exitCode: 3,
109
+ nextStep: "Nothing was sent. The function passed as `delegation` has to answer the current token.",
110
+ });
111
+ if (source === undefined)
112
+ throw refuse("This client's delegation source was released, so there is no token to send.");
113
+ let answered;
114
+ try {
115
+ answered = await source();
116
+ }
117
+ catch (error) {
118
+ // ⛔ The source's own words, which are the caller's; never a token, because none was answered.
119
+ throw refuse(`The delegation source failed: ${error instanceof Error ? error.message : String(error)}`);
120
+ }
121
+ if (typeof answered !== "string" || answered.trim() === "")
122
+ throw refuse("The delegation source answered no token.");
123
+ return answered.trim();
124
+ }
80
125
  /** One attempt. `request` above decides whether there may be another. */
81
126
  async function once(base, path, options) {
82
- const { method = "GET", body, token, timeoutMs = DEFAULT_TIMEOUT_MS } = options;
127
+ const { method = "GET", body, timeoutMs = DEFAULT_TIMEOUT_MS } = options;
128
+ // ⚠ Asked BEFORE the deadline starts, so a source with a round trip of its own does not spend the
129
+ // request's time.
130
+ const token = await bearerFor(options.token);
83
131
  const controller = new AbortController();
84
132
  const deadline = setTimeout(() => controller.abort(), timeoutMs);
85
133
  if (options.signal)
@@ -34,8 +34,14 @@ export interface ParsedArgs {
34
34
  deposit?: string;
35
35
  /** Answer yes to a warning this run would otherwise stop on. */
36
36
  yes: boolean;
37
- /** `public-code`: publish this account's public code on the server. Permanent. */
37
+ /** `public-code`: publish this account's public code on the server. */
38
38
  publish: boolean;
39
+ /** `public-code list`: each code's shares as well as its counts. */
40
+ activity: boolean;
41
+ /** `public-code new`: the number of the live code the new one replaces, revoked in the same step. */
42
+ replace?: string;
43
+ /** `share`: which of this account's live public codes sends. Absent = the lowest-numbered live one. */
44
+ as?: string;
39
45
  /** `login`: store the NMTS key unsealed rather than under a passphrase. */
40
46
  plain: boolean;
41
47
  /** `login`: store nothing; print the environment variable to set. */
@@ -56,6 +62,14 @@ export interface ParsedArgs {
56
62
  epochs?: string;
57
63
  /** `put`/`push`: who pays for the storage — `credits` (the default) or `wallet`. */
58
64
  pay?: string;
65
+ /** `put`/`push`: `standard` (the default) or `heavy` — NMTS Standard on Walrus, NMTS Heavy on Filecoin. */
66
+ tier?: string;
67
+ /** `put`/`push --tier heavy --pay evm`: copies, 1..12; the storage companies by id; which EVM wallet. */
68
+ copies?: string;
69
+ providers?: string;
70
+ evmWallet?: string;
71
+ /** `ls`: the long listing — adds the tier each file is stored on (one more read of the server). */
72
+ long: boolean;
59
73
  /** `put --pay wallet`: `fit`, `whole`, or a held storage resource's object id. */
60
74
  storage?: string;
61
75
  /**
@@ -135,6 +149,10 @@ export interface ParsedArgs {
135
149
  dismiss?: string;
136
150
  /** `shares`: who ONE file was shared with, instead of what was shared with this account. */
137
151
  sent?: string;
152
+ /** `link make`: how long the link lasts, `<n>d` (1 to 3650 days). Absent = until it is cut. */
153
+ expires?: string;
154
+ /** `link make`: seal the size without the file's name, and the page shows 「Shared file」. */
155
+ hideName: boolean;
138
156
  /** ultra-high acts under skip-permissions: why this is right to do now. Kept in the run log. */
139
157
  reason?: string;
140
158
  releaseStorage: boolean;
package/dist/args.js CHANGED
@@ -41,6 +41,9 @@ const VALUE_OPTIONS = {
41
41
  "--recheck": "recheck",
42
42
  "--dismiss": "dismiss",
43
43
  "--sent": "sent",
44
+ "--expires": "expires",
45
+ "--replace": "replace",
46
+ "--as": "as",
44
47
  "--reason": "reason",
45
48
  "--size": "size",
46
49
  "--sign-out": "signOut",
@@ -55,6 +58,11 @@ const VALUE_OPTIONS = {
55
58
  // this tool already recommends for every other secret (`NMTS_ACCOUNT_CODE_FILE`).
56
59
  "--sui-key-file": "suiKeyFile",
57
60
  "--from": "from",
61
+ // NMTS Heavy: which tier, and the self-paid path's knobs (developer mode).
62
+ "--tier": "tier",
63
+ "--copies": "copies",
64
+ "--providers": "providers",
65
+ "--evm-wallet": "evmWallet",
58
66
  "--account": "account",
59
67
  "--app": "app",
60
68
  };
@@ -98,6 +106,7 @@ const FLAG_OPTIONS = {
98
106
  "--yes": "yes",
99
107
  "-y": "yes",
100
108
  "--publish": "publish",
109
+ "--activity": "activity",
101
110
  "--plain": "plain",
102
111
  "--env": "env",
103
112
  "--status": "status",
@@ -114,6 +123,8 @@ const FLAG_OPTIONS = {
114
123
  "--remove": "remove",
115
124
  "--accept-extremes": "acceptExtremes",
116
125
  "--trust-server-tip-address": "trustServerTipAddress",
126
+ "--long": "long",
127
+ "--hide-name": "hideName",
117
128
  };
118
129
  // ⛔ Derived from the tables, not written again. A hand-kept list is how an option ends up tested
119
130
  // for one property and accepted with another. ⚠ Every option that carries a value is in here,
@@ -150,9 +161,10 @@ function append(parsed, field, value) {
150
161
  */
151
162
  const FLAG_DEFAULTS = {
152
163
  help: false, version: false, json: false, all: false, force: false, dryRun: false, thumbnail: false, releaseStorage: false,
153
- yes: false, publish: false, plain: false, env: false, status: false,
164
+ yes: false, publish: false, activity: false, plain: false, env: false, status: false,
154
165
  desc: false, hidden: false, reveal: false, phrase: false, print: false, qr: false, board: false,
155
- save: false, acceptExtremes: false, remove: false, noWait: false, trustServerTipAddress: false,
166
+ save: false, acceptExtremes: false, remove: false, noWait: false, trustServerTipAddress: false, long: false,
167
+ hideName: false,
156
168
  };
157
169
  export function parseArgs(argv) {
158
170
  const parsed = { command: null, operands: [], ...FLAG_DEFAULTS };
@@ -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.45.0";
14
+ export declare const WRITTEN_BY = "nmts-cli 0.47.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/autonomy.js CHANGED
@@ -66,9 +66,9 @@ export function explain(mode) {
66
66
  `auto-low — ${MODE_MEANS["auto-low"]}`,
67
67
  `What happens: the agent runs reads, tidying and reversible changes without asking, and may run`,
68
68
  `medium acts — uploads that spend credits within the server's daily ceiling, making an API key,`,
69
- `publishing your public code — when it judges you asked for them or would want them. High acts`,
70
- `(sharing, wallet signing, signing devices out) are still asked about and stay locked until you`,
71
- `unlock them. Erasing the account or files is refused however it is asked.`,
69
+ `publishing or making a public code — when it judges you asked for them or would want them.`,
70
+ `High acts (sharing, wallet signing, signing devices out) are still asked about and stay locked`,
71
+ `until you unlock them. Erasing the account or files is refused however it is asked.`,
72
72
  `Risk: credits can be spent and metadata changed without a question each time. What you gain:`,
73
73
  `an agent that finishes a task instead of stopping at every step.`,
74
74
  off,
@@ -1,6 +1,16 @@
1
1
  import { type Autonomy } from "./autonomy.ts";
2
2
  /** What to do with a name that is already in use. Mirrors the browser's two buttons. */
3
3
  export type OnCollision = "rename" | "overwrite";
4
+ /** What a program passed in its own call, for that one upload. Taken as given — see the header. */
5
+ export interface ProgramChoice {
6
+ readonly choice: OnCollision;
7
+ readonly by: "program";
8
+ }
9
+ /**
10
+ * What one upload was told about a taken name: a bare word from a command line or a tool call,
11
+ * which is held to the modes, or a program's own choice, which is not.
12
+ */
13
+ export type CollisionAsk = OnCollision | ProgramChoice;
4
14
  export declare const COLLISION_CHOICES: readonly OnCollision[];
5
15
  /** What each choice does, in the words the tool prints. One line each. */
6
16
  export declare const COLLISION_MEANS: Readonly<Record<OnCollision, string>>;
@@ -35,8 +45,9 @@ export interface Decision {
35
45
  * `setting` — what a person answered at setup, or the default when nobody has.
36
46
  * `asked-for` — an agent asked for this run to overwrite, and a mode allows it.
37
47
  * `agent-refused` — an agent asked to overwrite while no mode is on, so it renames instead.
48
+ * `program` — a program's own call said which, and that is the answer.
38
49
  */
39
- readonly by: "setting" | "asked-for" | "agent-refused";
50
+ readonly by: "setting" | "asked-for" | "agent-refused" | "program";
40
51
  }
41
52
  /**
42
53
  * What to do with this collision, and what settled it.
@@ -51,10 +62,16 @@ export interface Decision {
51
62
  *
52
63
  * ⛔ THE OVERRIDE IS ONE-WAY. A mode can let `overwrite` through; nothing here turns a `rename`
53
64
  * into an `overwrite`.
65
+ *
66
+ * ⛔ A PROGRAM'S CHOICE IS ANSWERED BEFORE ANY OF THAT, and only a `ProgramChoice` is one. A bare
67
+ * `"overwrite"` is a command line's, whoever hands it in.
54
68
  */
55
69
  export declare function decide(
56
- /** What this run asked for, if anything. `undefined` means "use what this machine is set to". */
57
- askedFor?: OnCollision, setting?: OnCollision, mode?: Autonomy): Promise<Decision>;
70
+ /**
71
+ * What this run asked for, if anything. `undefined` — or `null`, which is how untyped code and
72
+ * JSON say "nothing" — means "use what this machine is set to".
73
+ */
74
+ askedFor?: CollisionAsk | null, setting?: OnCollision, mode?: Autonomy): Promise<Decision>;
58
75
  /** How the two answers are numbered where setup asks. Kept here so the question and the reading agree. */
59
76
  export declare const ANSWER_NUMBER: Readonly<Record<OnCollision, string>>;
60
77
  /**
package/dist/collision.js CHANGED
@@ -23,6 +23,12 @@
23
23
  // ⚠ WHAT THIS CANNOT DO is tell an agent from a person. Nothing on a command line can. What it can
24
24
  // do is make the destructive answer require a setting that was turned on deliberately, and say
25
25
  // which setting decided.
26
+ //
27
+ // ⛔ A PROGRAM'S OWN CALL IS NOT A COMMAND LINE. `put(file, { onCollision })` in a library is
28
+ // written into a program by whoever wrote the program, and calling it is that program's
29
+ // decision — the same way calling it is the agreement to spend. It arrives here as a
30
+ // `ProgramChoice`, which nothing that reads a command line or a tool call can produce: those
31
+ // parse into a bare word and stay held to the modes.
26
32
  import { currentMode } from "./autonomy.js";
27
33
  import { fromUtf8, utf8 } from "./bytes.js";
28
34
  import { NmtsError } from "./errors.js";
@@ -104,13 +110,25 @@ export async function forgetChoice() {
104
110
  *
105
111
  * ⛔ THE OVERRIDE IS ONE-WAY. A mode can let `overwrite` through; nothing here turns a `rename`
106
112
  * into an `overwrite`.
113
+ *
114
+ * ⛔ A PROGRAM'S CHOICE IS ANSWERED BEFORE ANY OF THAT, and only a `ProgramChoice` is one. A bare
115
+ * `"overwrite"` is a command line's, whoever hands it in.
107
116
  */
108
117
  export async function decide(
109
- /** What this run asked for, if anything. `undefined` means "use what this machine is set to". */
118
+ /**
119
+ * What this run asked for, if anything. `undefined` — or `null`, which is how untyped code and
120
+ * JSON say "nothing" — means "use what this machine is set to".
121
+ */
110
122
  askedFor, setting, mode) {
111
- if (askedFor === undefined)
123
+ // ⛔ NULL IS CHECKED BEFORE `typeof … === "object"`, which is also true of null: read as a
124
+ // program's choice it threw on `.choice` instead of answering.
125
+ if (askedFor === undefined || askedFor === null)
112
126
  return { choice: setting ?? (await currentChoice()), by: "setting" };
113
- if (askedFor === "rename")
127
+ // ⚠ Only the exact word overwrites, as at the setup question: a value from untyped code that is
128
+ // neither word is the answer that destroys nothing.
129
+ if (typeof askedFor === "object")
130
+ return { choice: askedFor.choice === "overwrite" ? "overwrite" : "rename", by: "program" };
131
+ if (askedFor !== "overwrite")
114
132
  return { choice: "rename", by: "asked-for" };
115
133
  if ((mode ?? (await currentMode())) === "default")
116
134
  return { choice: "rename", by: "agent-refused" };
@@ -57,6 +57,7 @@ export async function erase(paths, options = {}) {
57
57
  say(` \`--release-storage\` also destroys the storage bought with credits under them.`);
58
58
  }
59
59
  say(` Not refunded: storage already paid for.`);
60
+ say(` Anyone you gave a handover file to can still open that file until its storage ends or its stored bytes are destroyed.`);
60
61
  say(``);
61
62
  const typed = typedFor ? CONFIRM_SENTENCE : (await ask(`Type exactly: ${CONFIRM_SENTENCE}\n> `)).trim();
62
63
  if (typed !== CONFIRM_SENTENCE) {