@needmoretruth/nmts-cli 0.17.2 → 0.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +125 -517
- package/CHANGELOG.md +104 -0
- package/README.ko.md +377 -469
- package/README.md +394 -474
- package/dist/account-proof.d.ts +29 -0
- package/dist/account-proof.js +6 -6
- package/dist/account.d.ts +18 -0
- package/dist/account.js +5 -5
- package/dist/agent-host.d.ts +71 -0
- package/dist/agent-host.js +169 -0
- package/dist/api-advice.d.ts +2 -0
- package/dist/api-advice.js +210 -0
- package/dist/api-key.d.ts +79 -0
- package/dist/api-key.js +7 -7
- package/dist/api-refusal.d.ts +14 -0
- package/dist/api-refusal.js +8 -0
- package/dist/api.d.ts +114 -0
- package/dist/api.js +59 -162
- package/dist/args.d.ts +160 -0
- package/dist/args.js +118 -30
- package/dist/artifact-about.d.ts +49 -0
- package/dist/autonomy.d.ts +39 -0
- package/dist/autonomy.js +110 -32
- package/dist/code-access.d.ts +29 -0
- package/dist/code-access.js +3 -3
- package/dist/code-vault.d.ts +38 -0
- package/dist/code-vault.js +8 -8
- package/dist/collision.d.ts +67 -0
- package/dist/collision.js +1 -1
- package/dist/commands/accept-terms.d.ts +11 -0
- package/dist/commands/accept-terms.js +106 -0
- package/dist/commands/balance.d.ts +7 -0
- package/dist/commands/balance.js +54 -1
- package/dist/commands/create-code-file.d.ts +24 -0
- package/dist/commands/create-code-file.js +93 -0
- package/dist/commands/create-link.d.ts +10 -0
- package/dist/commands/create-link.js +232 -0
- package/dist/commands/create.d.ts +20 -0
- package/dist/commands/create.js +43 -102
- package/dist/commands/credits.d.ts +9 -0
- package/dist/commands/credits.js +110 -0
- package/dist/commands/delete-account.d.ts +11 -0
- package/dist/commands/delete-account.js +63 -0
- package/dist/commands/deposit.d.ts +7 -0
- package/dist/commands/deposit.js +85 -0
- package/dist/commands/devices.d.ts +12 -0
- package/dist/commands/devices.js +144 -0
- package/dist/commands/documents.d.ts +35 -0
- package/dist/commands/documents.js +212 -0
- package/dist/commands/env.d.ts +5 -0
- package/dist/commands/env.js +10 -2
- package/dist/commands/erase.d.ts +13 -0
- package/dist/commands/erase.js +193 -0
- package/dist/commands/expiring.d.ts +19 -0
- package/dist/commands/extend.d.ts +33 -0
- package/dist/commands/extend.js +54 -15
- package/dist/commands/get.d.ts +18 -0
- package/dist/commands/key-manage.d.ts +11 -0
- package/dist/commands/key-manage.js +162 -0
- package/dist/commands/key.d.ts +28 -0
- package/dist/commands/key.js +249 -0
- package/dist/commands/kit.d.ts +11 -0
- package/dist/commands/kit.js +7 -7
- package/dist/commands/listfile.d.ts +13 -0
- package/dist/commands/listfile.js +12 -5
- package/dist/commands/login.d.ts +18 -0
- package/dist/commands/login.js +19 -19
- package/dist/commands/logout.d.ts +1 -0
- package/dist/commands/logout.js +1 -1
- package/dist/commands/losses.d.ts +12 -0
- package/dist/commands/losses.js +180 -0
- package/dist/commands/ls.d.ts +23 -0
- package/dist/commands/marks-dispatch.d.ts +2 -0
- package/dist/commands/marks-dispatch.js +51 -0
- package/dist/commands/marks.d.ts +46 -0
- package/dist/commands/marks.js +80 -0
- package/dist/commands/mcp.d.ts +24 -0
- package/dist/commands/mcp.js +70 -5
- package/dist/commands/mode.d.ts +8 -0
- package/dist/commands/mode.js +60 -24
- package/dist/commands/on-collision.d.ts +6 -0
- package/dist/commands/organise.d.ts +46 -0
- package/dist/commands/padding.d.ts +7 -0
- package/dist/commands/padding.js +114 -0
- package/dist/commands/public-code.d.ts +9 -0
- package/dist/commands/public-code.js +8 -8
- package/dist/commands/pull.d.ts +27 -0
- package/dist/commands/push-wallet.d.ts +19 -0
- package/dist/commands/push-wallet.js +69 -0
- package/dist/commands/push.d.ts +47 -0
- package/dist/commands/push.js +37 -7
- package/dist/commands/put-wallet.d.ts +77 -0
- package/dist/commands/put-wallet.js +316 -0
- package/dist/commands/put.d.ts +56 -0
- package/dist/commands/put.js +53 -6
- package/dist/commands/rebuild.d.ts +18 -0
- package/dist/commands/rebuild.js +108 -10
- package/dist/commands/receive.d.ts +24 -0
- package/dist/commands/recovery-dispatch.d.ts +2 -0
- package/dist/commands/recovery-dispatch.js +34 -0
- package/dist/commands/recovery-list.d.ts +11 -0
- package/dist/commands/recovery-list.js +6 -6
- package/dist/commands/recovery.d.ts +25 -0
- package/dist/commands/recovery.js +2 -2
- package/dist/commands/rollback.d.ts +9 -0
- package/dist/commands/rollback.js +118 -0
- package/dist/commands/s3.d.ts +23 -0
- package/dist/commands/s3.js +6 -6
- package/dist/commands/settings.d.ts +5 -0
- package/dist/commands/settings.js +21 -6
- package/dist/commands/share-dispatch.d.ts +2 -0
- package/dist/commands/share-dispatch.js +46 -0
- package/dist/commands/share.d.ts +14 -0
- package/dist/commands/share.js +13 -3
- package/dist/commands/shares-sent.d.ts +18 -0
- package/dist/commands/shares-sent.js +95 -0
- package/dist/commands/support.d.ts +24 -0
- package/dist/commands/support.js +321 -0
- package/dist/commands/sweep.d.ts +11 -0
- package/dist/commands/tip.d.ts +11 -0
- package/dist/commands/tip.js +86 -0
- package/dist/commands/trash.d.ts +17 -0
- package/dist/commands/trash.js +1 -1
- package/dist/commands/trial.d.ts +7 -0
- package/dist/commands/trial.js +16 -18
- package/dist/commands/unlock.d.ts +16 -0
- package/dist/commands/unlock.js +159 -0
- package/dist/commands/update.d.ts +42 -0
- package/dist/commands/update.js +1 -1
- package/dist/commands/usage.d.ts +8 -0
- package/dist/commands/verify.d.ts +18 -0
- package/dist/commands/verify.js +10 -6
- package/dist/commands/wallet-activity.d.ts +26 -0
- package/dist/commands/wallet-activity.js +117 -0
- package/dist/commands/wallet-donate.d.ts +26 -0
- package/dist/commands/wallet-donate.js +163 -0
- package/dist/commands/wallet-hall.d.ts +35 -0
- package/dist/commands/wallet-hall.js +214 -0
- package/dist/commands/wallet-send.d.ts +22 -0
- package/dist/commands/wallet-send.js +153 -0
- package/dist/commands/wallet-storage-ops.d.ts +24 -0
- package/dist/commands/wallet-storage-ops.js +215 -0
- package/dist/commands/wallet-storage.d.ts +18 -0
- package/dist/commands/wallet-storage.js +95 -0
- package/dist/commands/wallet-swap.d.ts +32 -0
- package/dist/commands/wallet-swap.js +287 -0
- package/dist/commands/wallet.d.ts +36 -0
- package/dist/commands/wallet.js +57 -15
- package/dist/commands/whoami.d.ts +10 -0
- package/dist/commands/whoami.js +24 -6
- package/dist/consent.d.ts +140 -0
- package/dist/consent.js +89 -30
- package/dist/credentials.d.ts +146 -0
- package/dist/credentials.js +10 -10
- package/dist/crypto-surface.d.ts +197 -0
- package/dist/crypto.d.ts +81 -0
- package/dist/crypto.js +13 -0
- package/dist/deposit.d.ts +25 -0
- package/dist/deposit.js +78 -0
- package/dist/download-part.d.ts +40 -0
- package/dist/download-sink.d.ts +76 -0
- package/dist/download.d.ts +79 -0
- package/dist/download.js +3 -3
- package/dist/drive-paths.d.ts +73 -0
- package/dist/environment.d.ts +62 -0
- package/dist/environment.js +29 -9
- package/dist/errors.d.ts +22 -0
- package/dist/errors.js +3 -3
- package/dist/exit.d.ts +44 -0
- package/dist/expiry.d.ts +58 -0
- package/dist/extend-budget.d.ts +35 -0
- package/dist/extend-budget.js +81 -0
- package/dist/extend-chain.d.ts +43 -0
- package/dist/extend-chain.js +40 -3
- package/dist/extend-plan.d.ts +148 -0
- package/dist/extend-plan.js +1 -1
- package/dist/gate.d.ts +18 -0
- package/dist/gate.js +100 -0
- package/dist/guards.d.ts +2 -0
- package/dist/help.d.ts +20 -0
- package/dist/help.js +199 -33
- package/dist/human-check.d.ts +23 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +49 -0
- package/dist/item-trash.d.ts +1 -0
- package/dist/kit-file.d.ts +56 -0
- package/dist/kit-file.js +10 -10
- package/dist/list-file.d.ts +88 -0
- package/dist/list-file.js +90 -7
- package/dist/list-view-find.d.ts +15 -0
- package/dist/list-view-order.d.ts +32 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.js +112 -113
- package/dist/manifest-chunk-cache.d.ts +14 -0
- package/dist/manifest-chunk-cache.js +103 -0
- package/dist/manifest-chunk-flow.d.ts +81 -0
- package/dist/manifest-chunk-flow.js +307 -0
- package/dist/manifest-create.d.ts +23 -0
- package/dist/manifest-create.js +26 -30
- package/dist/manifest-write.d.ts +161 -0
- package/dist/manifest-write.js +42 -33
- package/dist/manifest.d.ts +82 -0
- package/dist/manifest.js +69 -21
- package/dist/mark-render.d.ts +26 -0
- package/dist/mcp-args.d.ts +17 -0
- package/dist/mcp-ask.d.ts +43 -0
- package/dist/mcp-ask.js +100 -0
- package/dist/mcp-tools/context.d.ts +46 -0
- package/dist/mcp-tools/credits.d.ts +3 -0
- package/dist/mcp-tools/credits.js +61 -0
- package/dist/mcp-tools/files.d.ts +3 -0
- package/dist/mcp-tools/files.js +34 -0
- package/dist/mcp-tools/organise.d.ts +3 -0
- package/dist/mcp-tools/organise.js +82 -2
- package/dist/mcp-tools/reads.d.ts +3 -0
- package/dist/mcp-tools/reads.js +132 -4
- package/dist/mcp-tools/share.d.ts +3 -0
- package/dist/mcp-tools/share.js +26 -7
- package/dist/mcp-tools/support.d.ts +3 -0
- package/dist/mcp-tools/support.js +140 -0
- package/dist/mcp-tools/tiers.d.ts +31 -0
- package/dist/mcp-tools/tiers.js +147 -0
- package/dist/mcp.d.ts +80 -0
- package/dist/mcp.js +110 -9
- package/dist/net-retry.d.ts +38 -0
- package/dist/network.d.ts +10 -0
- package/dist/notice.d.ts +7 -0
- package/dist/notice.js +7 -7
- package/dist/product.d.ts +29 -0
- package/dist/product.js +1 -1
- package/dist/progress.d.ts +37 -0
- package/dist/prompt.d.ts +31 -0
- package/dist/prompt.js +1 -1
- package/dist/rebuild-key-check.d.ts +26 -0
- package/dist/rebuild-key-check.js +90 -0
- package/dist/rebuild.d.ts +87 -0
- package/dist/rebuild.js +26 -4
- package/dist/recovery-assemble.d.ts +40 -0
- package/dist/recovery-assemble.js +1 -1
- package/dist/recovery-build.d.ts +40 -0
- package/dist/recovery-map-file.d.ts +53 -0
- package/dist/recovery-map-file.js +4 -4
- package/dist/recovery-map.d.ts +197 -0
- package/dist/recovery-release.d.ts +104 -0
- package/dist/recovery-seq.d.ts +10 -0
- package/dist/recovery-source.d.ts +50 -0
- package/dist/redact.d.ts +70 -0
- package/dist/redact.js +212 -0
- package/dist/registration.d.ts +30 -0
- package/dist/registration.js +5 -5
- package/dist/risk.d.ts +380 -0
- package/dist/risk.js +206 -0
- package/dist/run-log.d.ts +78 -0
- package/dist/run-log.js +301 -0
- package/dist/s3/listing.d.ts +47 -0
- package/dist/s3/multipart.d.ts +21 -0
- package/dist/s3/response-sink.d.ts +8 -0
- package/dist/s3/same-file.d.ts +54 -0
- package/dist/s3/server.d.ts +58 -0
- package/dist/s3/server.js +2 -2
- package/dist/s3/sigv4.d.ts +46 -0
- package/dist/s3/sigv4.js +1 -1
- package/dist/s3/staging.d.ts +10 -0
- package/dist/s3/xml.d.ts +28 -0
- package/dist/safe-path.d.ts +41 -0
- package/dist/seal.d.ts +120 -0
- package/dist/secret-reader.d.ts +28 -0
- package/dist/server.d.ts +9 -0
- package/dist/session.d.ts +32 -0
- package/dist/session.js +1 -1
- package/dist/setup-questions.d.ts +7 -0
- package/dist/share.d.ts +108 -0
- package/dist/share.js +1 -1
- package/dist/shared/lib/crypto/size-padding.d.ts +55 -0
- package/dist/shared/lib/crypto/size-padding.js +5 -0
- package/dist/shared/lib/drive/manifest-chunks.d.ts +95 -0
- package/dist/shared/lib/drive/manifest-chunks.js +252 -0
- package/dist/shared/lib/drive/manifest-codec.d.ts +214 -0
- package/dist/shared/lib/drive/manifest-codec.js +7 -7
- package/dist/shared/lib/drive/manifest-index.d.ts +98 -0
- package/dist/shared/lib/drive/manifest-ops.d.ts +167 -0
- package/dist/shared/lib/drive/manifest-ops.js +9 -4
- package/dist/shared/lib/drive/manifest-pack.d.ts +65 -0
- package/dist/shared/lib/drive/manifest-pack.js +287 -0
- package/dist/shared/lib/drive/manifest-settings.d.ts +113 -0
- package/dist/shared/lib/drive/manifest-settings.js +87 -6
- package/dist/shared/lib/drive/name-conflict.d.ts +76 -0
- package/dist/shared/lib/drive/rebuild-verify.d.ts +73 -0
- package/dist/shared/lib/drive/rebuild-verify.js +112 -0
- package/dist/shared/lib/drive/unique-name.d.ts +9 -0
- package/dist/shared/lib/drive/zstd.d.ts +27 -0
- package/dist/shared/lib/drive/zstd.js +74 -0
- package/dist/shared/lib/extend/epochs.d.ts +205 -0
- package/dist/shared/lib/net/retry-budget.d.ts +79 -0
- package/dist/shared/lib/share/shared-file-info.d.ts +21 -0
- package/dist/shared/lib/storage-control/chain.d.ts +57 -0
- package/dist/shared/lib/storage-control/chain.js +82 -0
- package/dist/shared/lib/storage-control/plan.d.ts +40 -0
- package/dist/shared/lib/storage-control/plan.js +72 -0
- package/dist/shared/lib/storage-control/reuse.d.ts +72 -0
- package/dist/shared/lib/storage-control/reuse.js +95 -0
- package/dist/shared/lib/storage-network.d.ts +25 -0
- package/dist/shared/lib/upload/part-plan.d.ts +24 -0
- package/dist/shared/lib/wallet/activity.d.ts +138 -0
- package/dist/shared/lib/wallet/activity.js +208 -0
- package/dist/shared/lib/wallet/send-rules.d.ts +68 -0
- package/dist/shared/lib/wallet/send-rules.js +116 -0
- package/dist/shared/lib/wallet/swap-rules.d.ts +115 -0
- package/dist/shared/lib/wallet/swap-rules.js +199 -0
- package/dist/shared/lib/wallet/tip.d.ts +14 -0
- package/dist/shared/lib/wallet/tip.js +34 -0
- package/dist/shared/lib/wallet/venue-ids.d.ts +23 -0
- package/dist/shared/lib/wallet/venue-ids.js +53 -0
- package/dist/standing-tip.d.ts +24 -0
- package/dist/standing-tip.js +52 -0
- package/dist/stdout.d.ts +38 -0
- package/dist/storage-control-chain.d.ts +38 -0
- package/dist/storage-control-chain.js +78 -0
- package/dist/sui-rpc.d.ts +15 -0
- package/dist/sui-rpc.js +59 -0
- package/dist/support-attach.d.ts +24 -0
- package/dist/support-attach.js +72 -0
- package/dist/support-copy.d.ts +42 -0
- package/dist/support-copy.js +109 -0
- package/dist/support-wire.d.ts +49 -0
- package/dist/support-wire.js +194 -0
- package/dist/trash-sweep.d.ts +55 -0
- package/dist/units.d.ts +2 -0
- package/dist/update-check.d.ts +50 -0
- package/dist/update-source.d.ts +63 -0
- package/dist/upload-api.d.ts +3 -0
- package/dist/upload-file.d.ts +97 -0
- package/dist/upload-file.js +3 -2
- package/dist/upload-price.d.ts +50 -0
- package/dist/upload-steps.d.ts +26 -0
- package/dist/upload-steps.js +29 -9
- package/dist/upload-store.d.ts +182 -0
- package/dist/upload-wallet-chain.d.ts +54 -0
- package/dist/upload-wallet-chain.js +203 -0
- package/dist/upload-wallet-plan.d.ts +128 -0
- package/dist/upload-wallet-plan.js +184 -0
- package/dist/upload-wallet.d.ts +24 -0
- package/dist/upload-wallet.js +208 -0
- package/dist/upload-wire.d.ts +244 -0
- package/dist/upload.d.ts +18 -0
- package/dist/upload.js +10 -0
- package/dist/usage-report.d.ts +35 -0
- package/dist/wallet-activity-chain.d.ts +5 -0
- package/dist/wallet-activity-chain.js +31 -0
- package/dist/wallet-chain.d.ts +19 -0
- package/dist/wallet-chain.js +2 -2
- package/dist/wallet-grant.d.ts +50 -0
- package/dist/wallet-grant.js +218 -0
- package/dist/wallet-send-chain.d.ts +24 -0
- package/dist/wallet-send-chain.js +49 -0
- package/dist/wallet-sign.d.ts +133 -0
- package/dist/wallet-sign.js +317 -0
- package/dist/wallet-storage-chain.d.ts +3 -0
- package/dist/wallet-storage-chain.js +20 -0
- package/dist/wallet-swap-chain.d.ts +52 -0
- package/dist/wallet-swap-chain.js +186 -0
- package/dist/wallet-swap-quote.d.ts +22 -0
- package/dist/wallet-swap-quote.js +126 -0
- package/dist/wallet.d.ts +135 -0
- package/dist/wallet.js +5 -5
- package/dist/walrus-write.d.ts +56 -0
- package/dist/walrus-write.js +5 -4
- package/dist/walrus.d.ts +86 -0
- package/dist/walrus.js +48 -10
- package/dist/zstd-node.d.ts +11 -0
- package/dist/zstd-node.js +71 -0
- package/docs/commands/accept-terms.md +15 -0
- package/docs/commands/create.md +17 -0
- package/docs/commands/credits.md +34 -0
- package/docs/commands/delete-account.md +14 -0
- package/docs/commands/deposit.md +27 -0
- package/docs/commands/devices.md +9 -0
- package/docs/commands/documents.md +10 -0
- package/docs/commands/env.md +21 -0
- package/docs/commands/extend.md +27 -0
- package/docs/commands/folders.md +10 -0
- package/docs/commands/get.md +14 -0
- package/docs/commands/key.md +14 -0
- package/docs/commands/login.md +23 -0
- package/docs/commands/logout.md +11 -0
- package/docs/commands/losses.md +13 -0
- package/docs/commands/ls.md +16 -0
- package/docs/commands/marks.md +9 -0
- package/docs/commands/mcp.md +33 -0
- package/docs/commands/mode.md +29 -0
- package/docs/commands/on-collision.md +13 -0
- package/docs/commands/padding.md +13 -0
- package/docs/commands/public-code.md +9 -0
- package/docs/commands/pull.md +9 -0
- package/docs/commands/push.md +12 -0
- package/docs/commands/put.md +36 -0
- package/docs/commands/rebuild.md +13 -0
- package/docs/commands/recovery.md +18 -0
- package/docs/commands/s3.md +17 -0
- package/docs/commands/share.md +15 -0
- package/docs/commands/support.md +16 -0
- package/docs/commands/tip.md +21 -0
- package/docs/commands/trash.md +25 -0
- package/docs/commands/trial.md +12 -0
- package/docs/commands/unlock.md +25 -0
- package/docs/commands/update.md +14 -0
- package/docs/commands/usage.md +14 -0
- package/docs/commands/verify.md +18 -0
- package/docs/commands/wallet.md +67 -0
- package/docs/commands/whoami.md +12 -0
- package/package.json +67 -8
- package/server.json +28 -0
- package/vendor/nmts-crypto/nmts_crypto_wasm.d.ts +23 -2
- package/vendor/nmts-crypto/nmts_crypto_wasm.js +44 -2
- package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm +0 -0
- package/vendor/nmts-crypto/nmts_crypto_wasm_bg.wasm.d.ts +1 -0
- package/vendor/nmts-crypto/package.json +1 -1
- package/dist/commands/consent.js +0 -77
- package/dist/extend-sign.js +0 -130
package/dist/args.d.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
export interface ParsedArgs {
|
|
2
|
+
command: string | null;
|
|
3
|
+
/** Positional arguments after the command. */
|
|
4
|
+
operands: string[];
|
|
5
|
+
server?: string;
|
|
6
|
+
network?: string;
|
|
7
|
+
help: boolean;
|
|
8
|
+
version: boolean;
|
|
9
|
+
/** Machine-readable output where a command has one. */
|
|
10
|
+
json: boolean;
|
|
11
|
+
/** Include what is in the trash. */
|
|
12
|
+
all: boolean;
|
|
13
|
+
/** Where to write a fetched file. */
|
|
14
|
+
out?: string;
|
|
15
|
+
/** Replace a file that is already there. */
|
|
16
|
+
force: boolean;
|
|
17
|
+
/** The name an uploaded file gets in the drive. */
|
|
18
|
+
name?: string;
|
|
19
|
+
/** The destination folder for an upload. */
|
|
20
|
+
to?: string;
|
|
21
|
+
/** Say what an upload would cost and stop. */
|
|
22
|
+
dryRun: boolean;
|
|
23
|
+
/** `put`: how much of a file goes into one part. A byte count, optionally with a unit. */
|
|
24
|
+
partSize?: string;
|
|
25
|
+
/** `put`/`push`: what THIS run does about a name already in use. Absent = this machine's setting. */
|
|
26
|
+
onCollision?: string;
|
|
27
|
+
/** `put`/`push`: credits THIS upload sets aside per file, 0 to 64. Absent = the account's default. */
|
|
28
|
+
deposit?: string;
|
|
29
|
+
/** Answer yes to a warning this run would otherwise stop on. */
|
|
30
|
+
yes: boolean;
|
|
31
|
+
/** `public-code`: publish this account's public code on the server. Permanent. */
|
|
32
|
+
publish: boolean;
|
|
33
|
+
/** `login`: store the NMTS key unsealed rather than under a passphrase. */
|
|
34
|
+
plain: boolean;
|
|
35
|
+
/** `login`: store nothing; print the environment variable to set. */
|
|
36
|
+
env: boolean;
|
|
37
|
+
/** `verify`: report whether the human check is live and stop, asking for no new code. */
|
|
38
|
+
status: boolean;
|
|
39
|
+
/** `create`: print the registration address and stop, rather than waiting for a person. */
|
|
40
|
+
noWait?: boolean;
|
|
41
|
+
/** `ls`: keep only files whose name contains this text, case-insensitively. */
|
|
42
|
+
find?: string;
|
|
43
|
+
/** `ls`: which order to list in — `name`, `size` or `date`. Absent = the path order. */
|
|
44
|
+
sort?: string;
|
|
45
|
+
/** `ls`: reverse whichever order is in effect. */
|
|
46
|
+
desc: boolean;
|
|
47
|
+
/** `push`: include entries whose name begins with a dot. */
|
|
48
|
+
hidden: boolean;
|
|
49
|
+
/** `extend`: how many of the storage network's epochs to add; `put`/`push --pay wallet`: how many to buy. */
|
|
50
|
+
epochs?: string;
|
|
51
|
+
/** `put`/`push`: who pays for the storage — `credits` (the default) or `wallet`. */
|
|
52
|
+
pay?: string;
|
|
53
|
+
/** `put --pay wallet`: `fit`, `whole`, or a held storage resource's object id. */
|
|
54
|
+
storage?: string;
|
|
55
|
+
/** `consent grant wallet`: how long the grant lasts (days, at most 30), or until a date.
|
|
56
|
+
* `key new`: how many days the new API key lasts. The server clamps at its own ceiling. */
|
|
57
|
+
days?: string;
|
|
58
|
+
until?: string;
|
|
59
|
+
/** `consent grant wallet`: `storage` or `all`. */
|
|
60
|
+
scope?: string;
|
|
61
|
+
/** `key new`: which permissions the key carries — `read`, `write`, `spend`, comma-separated. */
|
|
62
|
+
scopes?: string;
|
|
63
|
+
/** `consent grant wallet`: ceilings in coins. */
|
|
64
|
+
capWal?: string;
|
|
65
|
+
capSui?: string;
|
|
66
|
+
/** `wallet send` · `wallet swap`: a ceiling on the chain fee, in SUI. */
|
|
67
|
+
feeCap?: string;
|
|
68
|
+
/** `wallet swap`: which venue, deepbook or bluefin. Without it both are quoted and the run stops. */
|
|
69
|
+
venue?: string;
|
|
70
|
+
/** `wallet swap`: the slippage allowance in whole bps (1 bps = 0.01%). */
|
|
71
|
+
slippageBps?: string;
|
|
72
|
+
/** `wallet swap`: a person's say past the extremes gate. Refused while a mode is on. */
|
|
73
|
+
acceptExtremes: boolean;
|
|
74
|
+
/** `s3`: which loopback port the gateway listens on. */
|
|
75
|
+
port?: string;
|
|
76
|
+
/**
|
|
77
|
+
* `create`: the version of the Terms of Service a PERSON read and accepts for the new account.
|
|
78
|
+
*
|
|
79
|
+
* ⛔ IT IS A VALUE AND NOT A FLAG, so that what was accepted is on the command line rather than
|
|
80
|
+
* implied by it. A tool that could accept "whatever is current" would be agreeing on behalf
|
|
81
|
+
* of somebody who never saw a version number.
|
|
82
|
+
*/
|
|
83
|
+
acceptTerms?: string;
|
|
84
|
+
/** `create`: the version of the Privacy Policy accepted in the same act. */
|
|
85
|
+
acceptPrivacy?: string;
|
|
86
|
+
/** `losses`: ask the chain about ONE listed storage object now, instead of listing. */
|
|
87
|
+
recheck?: string;
|
|
88
|
+
/** `losses`: take ONE line off this account's own drive, instead of listing. ⛔ A VALUE AND NOT
|
|
89
|
+
* A FLAG, so the line put down is named on the command line: a person reads one and puts it down. */
|
|
90
|
+
dismiss?: string;
|
|
91
|
+
/** `shares`: who ONE file was shared with, instead of what was shared with this account. */
|
|
92
|
+
sent?: string;
|
|
93
|
+
/** ultra-high acts under skip-permissions: why this is right to do now. Kept in the run log. */
|
|
94
|
+
reason?: string;
|
|
95
|
+
releaseStorage: boolean;
|
|
96
|
+
size?: string;
|
|
97
|
+
/** `devices`: sign ONE device out by id, or `all` — a person's act, proved by the NMTS key. */
|
|
98
|
+
signOut?: string;
|
|
99
|
+
/**
|
|
100
|
+
* `label`: the label to rename. The NEW name follows as the operand.
|
|
101
|
+
*
|
|
102
|
+
* ⛔ ONE VALUE, NOT TWO, because the table above gives every option exactly one — and a second
|
|
103
|
+
* spelling of "how many values does this take" is how an option ends up parsed one way and
|
|
104
|
+
* tested another. What a person types is still `label --rename <old> <new>`: the new name is
|
|
105
|
+
* read from the operands, which is where `label <name> <files>` already reads a name from.
|
|
106
|
+
*/
|
|
107
|
+
rename?: string;
|
|
108
|
+
/** `support send`: what the report is about, and optionally which part of that. */
|
|
109
|
+
category?: string;
|
|
110
|
+
sub?: string;
|
|
111
|
+
/** `support`: the message itself, or the file holding it. */
|
|
112
|
+
message?: string;
|
|
113
|
+
messageFile?: string;
|
|
114
|
+
/**
|
|
115
|
+
* `support send`: attach the run log, and how many runs of it.
|
|
116
|
+
* ⛔ THE EMPTY STRING IS "GIVEN WITH NO NUMBER", which is different from absent. A boolean
|
|
117
|
+
* beside a count would be two fields answering one question, and the pair can disagree.
|
|
118
|
+
*/
|
|
119
|
+
attachLog?: string;
|
|
120
|
+
/**
|
|
121
|
+
* `support`: values that must not travel, replaced wherever they appear.
|
|
122
|
+
*
|
|
123
|
+
* ⛔ THE ONLY REPEATABLE OPTION, and it is repeatable because what it names is one value at a
|
|
124
|
+
* time. A comma-separated list would make a comma impossible to omit.
|
|
125
|
+
*/
|
|
126
|
+
omit?: string[];
|
|
127
|
+
/**
|
|
128
|
+
* `whoami`: print the NMTS key itself.
|
|
129
|
+
*
|
|
130
|
+
* ⛔ A FLAG AND NOT A VALUE — it names no secret, it asks for the one this machine already
|
|
131
|
+
* holds. The option table is checked for names that look like credentials; this one carries
|
|
132
|
+
* nothing and says what it does.
|
|
133
|
+
*/
|
|
134
|
+
reveal: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* `key new`: put the new key on the screen once, as well as storing it. A flag and not a value
|
|
137
|
+
* for the reason above: it names no secret, it asks for the one this run was just handed.
|
|
138
|
+
*/
|
|
139
|
+
print: boolean;
|
|
140
|
+
/** `nmts wallet address --qr` — the address as a QR code in the terminal as well. */
|
|
141
|
+
qr: boolean;
|
|
142
|
+
/** `wallet hall --remove`: be listed by a shortened address again. Never with `--name`. */
|
|
143
|
+
remove: boolean;
|
|
144
|
+
/** `terms`/`privacy`: which language to fetch — `en` or `ko`. Absent = English. */
|
|
145
|
+
lang?: string;
|
|
146
|
+
/** `terms`: the message board's terms rather than the service's. */
|
|
147
|
+
board: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* `notices`/`terms`/`privacy`: keep the document as a file instead of printing it.
|
|
150
|
+
*
|
|
151
|
+
* ⛔ A FLAG, AND THE NOTICE'S ID IS STILL THE OPERAND. `notices --save <id>` reads exactly like
|
|
152
|
+
* `notices <id>`, which is the point: one way to name a notice, whichever of the two things
|
|
153
|
+
* is being done with it. The file's NAME is never an option — it is the server's, so that a
|
|
154
|
+
* copy kept here and a copy kept from the browser are the same file.
|
|
155
|
+
*/
|
|
156
|
+
save: boolean;
|
|
157
|
+
}
|
|
158
|
+
export declare const OPTIONS_TAKING_A_VALUE: string[];
|
|
159
|
+
export declare const FLAGS: string[];
|
|
160
|
+
export declare function parseArgs(argv: readonly string[]): ParsedArgs;
|
package/dist/args.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
// Turning argv into a command and its options.
|
|
2
2
|
//
|
|
3
|
-
// ⛔ NO SECRET IS EVER AN OPTION. There is no --code and no --api-key
|
|
4
|
-
//
|
|
5
|
-
// line, and the shell records it. A test asserts that no option name here looks like a secret.
|
|
3
|
+
// ⛔ NO SECRET IS EVER AN OPTION. There is no --code and no --api-key: on Linux any process can read
|
|
4
|
+
// another's command line, and the shell records it. A test asserts no option name looks like one.
|
|
6
5
|
//
|
|
7
|
-
// ⛔ AN UNKNOWN OPTION IS AN ERROR, NOT A SHRUG
|
|
8
|
-
// talks to the live server, and an agent retrying with a typo would never learn why.
|
|
6
|
+
// ⛔ AN UNKNOWN OPTION IS AN ERROR, NOT A SHRUG: `--serverr` must not silently talk to the live server.
|
|
9
7
|
//
|
|
10
|
-
// ⛔ THE OPTIONS ARE A TABLE, NOT A LADDER OF `if`s
|
|
11
|
-
//
|
|
12
|
-
// meant remembering all three. Now the table below is the only place, so an option cannot exist
|
|
13
|
-
// in one spelling and not the other.
|
|
8
|
+
// ⛔ THE OPTIONS ARE A TABLE, NOT A LADDER OF `if`s: the tables below are the only place an option
|
|
9
|
+
// is spelled, so it cannot exist as `--x value` and not as `--x=value`.
|
|
14
10
|
import { NmtsError } from "./errors.js";
|
|
15
11
|
/** Which field a value-taking option fills. */
|
|
16
12
|
const VALUE_OPTIONS = {
|
|
@@ -21,12 +17,56 @@ const VALUE_OPTIONS = {
|
|
|
21
17
|
"--to": "to",
|
|
22
18
|
"--part-size": "partSize",
|
|
23
19
|
"--on-collision": "onCollision",
|
|
20
|
+
"--deposit": "deposit",
|
|
24
21
|
"--find": "find",
|
|
25
22
|
"--sort": "sort",
|
|
26
23
|
"--epochs": "epochs",
|
|
24
|
+
"--pay": "pay",
|
|
25
|
+
"--storage": "storage",
|
|
26
|
+
"--days": "days",
|
|
27
|
+
"--until": "until",
|
|
28
|
+
"--scope": "scope",
|
|
29
|
+
"--scopes": "scopes",
|
|
30
|
+
"--cap-wal": "capWal",
|
|
31
|
+
"--cap-sui": "capSui",
|
|
32
|
+
"--fee-cap": "feeCap",
|
|
33
|
+
"--venue": "venue",
|
|
34
|
+
"--slippage-bps": "slippageBps",
|
|
27
35
|
"--port": "port",
|
|
28
36
|
"--accept-terms": "acceptTerms",
|
|
29
37
|
"--accept-privacy": "acceptPrivacy",
|
|
38
|
+
"--recheck": "recheck",
|
|
39
|
+
"--dismiss": "dismiss",
|
|
40
|
+
"--sent": "sent",
|
|
41
|
+
"--reason": "reason",
|
|
42
|
+
"--size": "size",
|
|
43
|
+
"--sign-out": "signOut",
|
|
44
|
+
"--rename": "rename",
|
|
45
|
+
"--category": "category",
|
|
46
|
+
"--sub": "sub",
|
|
47
|
+
"--message": "message",
|
|
48
|
+
"--message-file": "messageFile",
|
|
49
|
+
"--lang": "lang",
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Which field an option that may be given more than once appends to.
|
|
53
|
+
*
|
|
54
|
+
* ⛔ ITS OWN TABLE, so that "repeatable" is a property of the option rather than of the code that
|
|
55
|
+
* happens to read it. An option in the value table that a caller repeats today keeps only the
|
|
56
|
+
* last one, silently, which is the wrong answer for a list of values to remove.
|
|
57
|
+
*/
|
|
58
|
+
const LIST_OPTIONS = {
|
|
59
|
+
"--omit": "omit",
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Which field an option that MAY carry a value fills, with "" for a bare one.
|
|
63
|
+
*
|
|
64
|
+
* ⛔ THE VALUE IS TAKEN ONLY WHEN IT IS A NUMBER. `--attach-log send` must not read `send` as a
|
|
65
|
+
* count and leave the command line without its action; every value this shape of option takes
|
|
66
|
+
* is a count, so "is it digits" is the whole question.
|
|
67
|
+
*/
|
|
68
|
+
const OPTIONAL_VALUE_OPTIONS = {
|
|
69
|
+
"--attach-log": "attachLog",
|
|
30
70
|
};
|
|
31
71
|
/** Which field a flag sets to true. */
|
|
32
72
|
const FLAG_OPTIONS = {
|
|
@@ -44,39 +84,59 @@ const FLAG_OPTIONS = {
|
|
|
44
84
|
"--plain": "plain",
|
|
45
85
|
"--env": "env",
|
|
46
86
|
"--status": "status",
|
|
47
|
-
"--
|
|
87
|
+
"--no-wait": "noWait",
|
|
48
88
|
"--desc": "desc",
|
|
49
89
|
"--hidden": "hidden",
|
|
90
|
+
"--reveal": "reveal",
|
|
91
|
+
"--release-storage": "releaseStorage",
|
|
92
|
+
"--print": "print",
|
|
93
|
+
"--qr": "qr",
|
|
94
|
+
"--board": "board",
|
|
95
|
+
"--save": "save",
|
|
96
|
+
"--remove": "remove",
|
|
97
|
+
"--accept-extremes": "acceptExtremes",
|
|
50
98
|
};
|
|
51
99
|
// ⛔ Derived from the tables, not written again. A hand-kept list is how an option ends up tested
|
|
52
|
-
// for one property and accepted with another.
|
|
53
|
-
|
|
100
|
+
// for one property and accepted with another. ⚠ Every option that carries a value is in here,
|
|
101
|
+
// whichever table it lives in — the test that refuses a secret-looking option name reads this.
|
|
102
|
+
export const OPTIONS_TAKING_A_VALUE = [
|
|
103
|
+
...Object.keys(VALUE_OPTIONS),
|
|
104
|
+
...Object.keys(LIST_OPTIONS),
|
|
105
|
+
...Object.keys(OPTIONAL_VALUE_OPTIONS),
|
|
106
|
+
];
|
|
54
107
|
export const FLAGS = Object.keys(FLAG_OPTIONS);
|
|
55
108
|
function isValueOption(token) {
|
|
56
109
|
return Object.hasOwn(VALUE_OPTIONS, token);
|
|
57
110
|
}
|
|
111
|
+
function isListOption(token) {
|
|
112
|
+
return Object.hasOwn(LIST_OPTIONS, token);
|
|
113
|
+
}
|
|
114
|
+
function isOptionalValueOption(token) {
|
|
115
|
+
return Object.hasOwn(OPTIONAL_VALUE_OPTIONS, token);
|
|
116
|
+
}
|
|
58
117
|
function isFlag(token) {
|
|
59
118
|
return Object.hasOwn(FLAG_OPTIONS, token);
|
|
60
119
|
}
|
|
120
|
+
/** A whole number and nothing else. What an optional value is allowed to be. */
|
|
121
|
+
const DIGITS = /^[0-9]+$/u;
|
|
122
|
+
/** Add one more value to a repeatable option's field. */
|
|
123
|
+
function append(parsed, field, value) {
|
|
124
|
+
const held = parsed[field];
|
|
125
|
+
parsed[field] = held === undefined ? [value] : [...held, value];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Every flag starts false. ⛔ THE KEY TYPE IS DERIVED FROM THE TABLE, so a flag added above and
|
|
129
|
+
* forgotten here stops the build — and written out one flag at a time rather than built at run
|
|
130
|
+
* time, because a shape the compiler cannot see would let a new flag arrive as `undefined`.
|
|
131
|
+
*/
|
|
132
|
+
const FLAG_DEFAULTS = {
|
|
133
|
+
help: false, version: false, json: false, all: false, force: false, dryRun: false, releaseStorage: false,
|
|
134
|
+
yes: false, publish: false, plain: false, env: false, status: false,
|
|
135
|
+
desc: false, hidden: false, reveal: false, print: false, qr: false, board: false,
|
|
136
|
+
save: false, acceptExtremes: false, remove: false, noWait: false,
|
|
137
|
+
};
|
|
61
138
|
export function parseArgs(argv) {
|
|
62
|
-
const parsed = {
|
|
63
|
-
command: null,
|
|
64
|
-
operands: [],
|
|
65
|
-
help: false,
|
|
66
|
-
version: false,
|
|
67
|
-
json: false,
|
|
68
|
-
all: false,
|
|
69
|
-
force: false,
|
|
70
|
-
publish: false,
|
|
71
|
-
dryRun: false,
|
|
72
|
-
yes: false,
|
|
73
|
-
plain: false,
|
|
74
|
-
env: false,
|
|
75
|
-
status: false,
|
|
76
|
-
iAcceptTheRisk: false,
|
|
77
|
-
desc: false,
|
|
78
|
-
hidden: false,
|
|
79
|
-
};
|
|
139
|
+
const parsed = { command: null, operands: [], ...FLAG_DEFAULTS };
|
|
80
140
|
let index = 0;
|
|
81
141
|
// ⛔ EVERYTHING AFTER `--` IS A NAME, NOT AN OPTION. Files in a drive are named by people and by
|
|
82
142
|
// other programs, and a name is allowed to start with a dash. Without this, `nmts rm -h`
|
|
@@ -100,6 +160,26 @@ export function parseArgs(argv) {
|
|
|
100
160
|
parsed[FLAG_OPTIONS[token]] = true;
|
|
101
161
|
continue;
|
|
102
162
|
}
|
|
163
|
+
if (isListOption(token)) {
|
|
164
|
+
const value = argv[index];
|
|
165
|
+
if (value === undefined || (value.startsWith("-") && value !== "-")) {
|
|
166
|
+
throw new NmtsError(`${token} needs a value after it.`, { exitCode: 2 });
|
|
167
|
+
}
|
|
168
|
+
index += 1;
|
|
169
|
+
append(parsed, LIST_OPTIONS[token], value);
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (isOptionalValueOption(token)) {
|
|
173
|
+
const value = argv[index];
|
|
174
|
+
if (value !== undefined && DIGITS.test(value)) {
|
|
175
|
+
index += 1;
|
|
176
|
+
parsed[OPTIONAL_VALUE_OPTIONS[token]] = value;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
parsed[OPTIONAL_VALUE_OPTIONS[token]] = "";
|
|
180
|
+
}
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
103
183
|
if (isValueOption(token)) {
|
|
104
184
|
const value = argv[index];
|
|
105
185
|
// ⛔ A LONE `-` IS A VALUE, NOT AN OPTION. It is how every tool spells "the standard
|
|
@@ -121,6 +201,14 @@ export function parseArgs(argv) {
|
|
|
121
201
|
parsed[VALUE_OPTIONS[head]] = token.slice(equals + 1);
|
|
122
202
|
continue;
|
|
123
203
|
}
|
|
204
|
+
if (isListOption(head)) {
|
|
205
|
+
append(parsed, LIST_OPTIONS[head], token.slice(equals + 1));
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (isOptionalValueOption(head)) {
|
|
209
|
+
parsed[OPTIONAL_VALUE_OPTIONS[head]] = token.slice(equals + 1);
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
124
212
|
}
|
|
125
213
|
if (token.startsWith("-") && token !== "-") {
|
|
126
214
|
throw new NmtsError(`Unknown option: ${token}`, {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** The product these artefacts come from, spelled as the formats carry it. */
|
|
2
|
+
export declare const PRODUCT = "NMTS";
|
|
3
|
+
/** Where the recovery list's format is written down, in the copy anybody can reach. */
|
|
4
|
+
export declare const RECOVERY_SPEC_URL = "https://github.com/needmoretruth/nmts-recovery/blob/main/docs/RECOVERY-MANIFEST.md";
|
|
5
|
+
/** Where the envelope format is — key derivation, header layout, domain separators. */
|
|
6
|
+
export declare const CRYPTO_SPEC_URL = "https://github.com/needmoretruth/nmts-recovery/blob/main/docs/CRYPTO-FORMAT-NCF3.md";
|
|
7
|
+
/**
|
|
8
|
+
* Which build wrote the file.
|
|
9
|
+
*
|
|
10
|
+
* ⚠ A CLAIM, NEVER A REQUIREMENT. It names THIS PROGRAM rather than the site release, because that
|
|
11
|
+
* is the field's own contract — what the writer says about itself — and a person holding two
|
|
12
|
+
* copies of one account's artefacts can then tell which program made each.
|
|
13
|
+
*/
|
|
14
|
+
export declare const WRITTEN_BY = "nmts-cli 0.34.2";
|
|
15
|
+
/** Which of the three artefacts a wrapper is. A reader holding several can sort them. */
|
|
16
|
+
export type ArtifactKind = "recovery-list" | "file-list" | "recovery-kit";
|
|
17
|
+
/**
|
|
18
|
+
* How a sealed payload is put together — enough for a stranger to open it with the format
|
|
19
|
+
* document and an NMTS key, and nothing else.
|
|
20
|
+
*
|
|
21
|
+
* `context` is the NCF-3 domain separator the envelope was sealed under. It is not a secret and it
|
|
22
|
+
* is not a key: it is the string a re-implementation has to pass to the same function, and one
|
|
23
|
+
* that guesses it wrong gets an authentication failure with nothing to explain it.
|
|
24
|
+
*/
|
|
25
|
+
export interface SealedDescription {
|
|
26
|
+
format: "ncf3";
|
|
27
|
+
context: string;
|
|
28
|
+
encoding: "base64url";
|
|
29
|
+
/** What the reader must supply. One value, and the person has it or they do not. */
|
|
30
|
+
opened_with: "nmts-account-code";
|
|
31
|
+
spec_url: string;
|
|
32
|
+
}
|
|
33
|
+
/** The plaintext self-description a wrapper carries. */
|
|
34
|
+
export interface ArtifactAbout {
|
|
35
|
+
product: string;
|
|
36
|
+
product_url: string;
|
|
37
|
+
app_version: string;
|
|
38
|
+
artifact: ArtifactKind;
|
|
39
|
+
tool: string;
|
|
40
|
+
tool_url: string;
|
|
41
|
+
/** Where THIS artefact's format is written down. */
|
|
42
|
+
spec_url: string;
|
|
43
|
+
/** Absent on the kit, which is a text file that EMBEDS a sealed document rather than being one. */
|
|
44
|
+
sealed?: SealedDescription;
|
|
45
|
+
/** Kit only: what is inside it, so its danger is legible before it is opened. */
|
|
46
|
+
contains?: readonly string[];
|
|
47
|
+
}
|
|
48
|
+
/** The block for one wrapper. */
|
|
49
|
+
export declare function artifactAbout(artifact: ArtifactKind): ArtifactAbout;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** What an agent may decide without asking. */
|
|
2
|
+
export type Autonomy = "default" | "auto-low" | "auto-high" | "skip-permissions";
|
|
3
|
+
export declare const AUTONOMY_MODES: readonly Autonomy[];
|
|
4
|
+
/** What each mode means, in the words the tool prints. One line each, no more. */
|
|
5
|
+
export declare const MODE_MEANS: Readonly<Record<Autonomy, string>>;
|
|
6
|
+
/**
|
|
7
|
+
* The whole explanation of one mode — what it is, what can go wrong, what is gained, and the way
|
|
8
|
+
* out. ⛔ AN AGENT THAT RECOMMENDS A MODE SHOWS THIS TEXT, whole, to the person (AGENTS.md).
|
|
9
|
+
*/
|
|
10
|
+
export declare function explain(mode: Autonomy): string[];
|
|
11
|
+
/** The sentence a person types to turn skip-permissions on. Nobody types it by accident. */
|
|
12
|
+
export declare const SKIP_SENTENCE = "NOTHING WILL ASK ME AND I ACCEPT THAT";
|
|
13
|
+
/** Whether an agent, rather than a person, is taken to be driving. */
|
|
14
|
+
export declare function isAgentMode(mode: Autonomy): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Read a stored name, including the two this tool wrote before 2026-09-06: `off` is `default`
|
|
17
|
+
* and `auto` is `auto-low`. Anything else counts as `default`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function modeFromStored(value: unknown): Autonomy;
|
|
20
|
+
/**
|
|
21
|
+
* What this machine is set to.
|
|
22
|
+
*
|
|
23
|
+
* ⛔ Unreadable counts as `default`. The fail-safe direction for "I do not know" is the one where
|
|
24
|
+
* somebody is still asked -- a file that switches autonomy on when it cannot be parsed is worse
|
|
25
|
+
* than no file at all.
|
|
26
|
+
*/
|
|
27
|
+
export declare function currentMode(): Autonomy;
|
|
28
|
+
/** When it was set, or null when it is default or unreadable. */
|
|
29
|
+
export declare function setAt(): string | null;
|
|
30
|
+
/** Write the choice down, with the date and the version that was asked. */
|
|
31
|
+
export declare function setMode(mode: Autonomy, version: string, now: Date): void;
|
|
32
|
+
/**
|
|
33
|
+
* The line every run prints when a mode is on.
|
|
34
|
+
*
|
|
35
|
+
* ⛔ IT IS PRINTED EVERY TIME, not once. A setting that stops announcing itself is a setting people
|
|
36
|
+
* forget they turned on, and this one decides whether anybody is asked before money is spent.
|
|
37
|
+
* ⚠ It goes to stderr: stdout belongs to whatever is reading this tool's output.
|
|
38
|
+
*/
|
|
39
|
+
export declare function announcement(mode: Autonomy): string | null;
|
package/dist/autonomy.js
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
// How much
|
|
1
|
+
// How much an agent driving this tool may decide on its own — the four modes.
|
|
2
2
|
//
|
|
3
|
-
// ⛔ THIS IS A DIFFERENT AXIS FROM
|
|
4
|
-
// about.
|
|
5
|
-
//
|
|
6
|
-
// this tool may decide for me" -- it is about WHO CHOOSES, and it
|
|
7
|
-
//
|
|
8
|
-
// sixth consent, and the count of consents is a number this package deliberately holds down.
|
|
3
|
+
// ⛔ THIS IS A DIFFERENT AXIS FROM UNLOCKING, and mixing the two would make both harder to reason
|
|
4
|
+
// about. An unlock says "this machine's owner opened this capability" -- it is about WHAT the
|
|
5
|
+
// tool may do, it is recorded, and it stands until it is locked again. A mode says "an agent
|
|
6
|
+
// driving this tool may decide for me" -- it is about WHO CHOOSES, and it opens nothing that is
|
|
7
|
+
// locked. They are stored in different files for that reason.
|
|
9
8
|
//
|
|
10
|
-
// ⛔
|
|
11
|
-
//
|
|
12
|
-
//
|
|
9
|
+
// ⛔ THE FOUR, AND WHAT EACH ONE CHANGES (owner, 2026-09-06). Every act this tool performs carries a
|
|
10
|
+
// risk tier (`risk.ts`: none · low · medium · high · ultra-high), and a mode decides which tiers
|
|
11
|
+
// go ahead without a person:
|
|
12
|
+
// default a person is at the terminal. none runs; everything else is asked about;
|
|
13
|
+
// high is locked until unlocked; ultra-high takes a typed sentence.
|
|
14
|
+
// auto-low the agent judges whether the person asked for it, or whether it is a
|
|
15
|
+
// reasonable thing to do unasked. none and low run; medium is the agent's
|
|
16
|
+
// call (the code does not stop it, the instructions say to ask); high is
|
|
17
|
+
// asked about AND locked; ultra-high never.
|
|
18
|
+
// auto-high the same limits in code as auto-low. The instructions ask the agent to
|
|
19
|
+
// reason more autonomously — for a model the person judges able to keep
|
|
20
|
+
// itself safe. What differs is the instructions, not the tool.
|
|
21
|
+
// skip-permissions the person has left the chair. Nothing is refused and nothing asks;
|
|
22
|
+
// ultra-high still demands a written reason, kept in the run log.
|
|
13
23
|
//
|
|
14
|
-
// ⛔
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
24
|
+
// ⛔ A MODE IS SWITCHED AT A TERMINAL, BY A PERSON, and that is the lock: the command refuses when
|
|
25
|
+
// stdin is not a terminal, which is how an agent's subprocess usually arrives. It is not a
|
|
26
|
+
// perfect lock — a pseudo-terminal can be made — so the instructions say the same thing in
|
|
27
|
+
// words: an agent may RECOMMEND a mode, with the full explanation, and never turn one on.
|
|
28
|
+
// Turning one OFF (`nmts mode default`) needs no terminal: the safe direction is never harder.
|
|
19
29
|
//
|
|
20
30
|
// ⚠ AND WHAT NO COMMAND-LINE TOOL CAN DO: tell whether a person or a program typed this. The
|
|
21
31
|
// protection here is that the choice is explicit, written down, dated, and announced on every
|
|
@@ -23,25 +33,94 @@
|
|
|
23
33
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync, chmodSync } from "node:fs";
|
|
24
34
|
import { join } from "node:path";
|
|
25
35
|
import { configDir, modesAreEnforced } from "./credentials.js";
|
|
26
|
-
export const AUTONOMY_MODES = ["
|
|
36
|
+
export const AUTONOMY_MODES = ["default", "auto-low", "auto-high", "skip-permissions"];
|
|
27
37
|
/** What each mode means, in the words the tool prints. One line each, no more. */
|
|
28
38
|
export const MODE_MEANS = {
|
|
29
|
-
|
|
30
|
-
auto: "The agent decides whether you asked for it, or whether it is fine to do unasked, and goes ahead
|
|
31
|
-
|
|
39
|
+
default: "A person is asked before anything but reading and tidying. This is the default.",
|
|
40
|
+
"auto-low": "The agent decides whether you asked for it, or whether it is fine to do unasked, and goes ahead " +
|
|
41
|
+
"with low and medium acts. High acts still ask and stay locked; irreversible ones are refused.",
|
|
42
|
+
"auto-high": "Like auto-low, but the agent is told to reason for itself more — for a model you trust to keep " +
|
|
43
|
+
"itself safe. The tool refuses exactly what auto-low refuses.",
|
|
44
|
+
"skip-permissions": "Nothing asks and nothing is refused. You have left the chair. Irreversible acts still need a " +
|
|
45
|
+
"written reason, kept in the run log.",
|
|
32
46
|
};
|
|
33
|
-
/**
|
|
34
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The whole explanation of one mode — what it is, what can go wrong, what is gained, and the way
|
|
49
|
+
* out. ⛔ AN AGENT THAT RECOMMENDS A MODE SHOWS THIS TEXT, whole, to the person (AGENTS.md).
|
|
50
|
+
*/
|
|
51
|
+
export function explain(mode) {
|
|
52
|
+
const off = `Turn it off at any time: \`nmts mode default\`.`;
|
|
53
|
+
switch (mode) {
|
|
54
|
+
case "default":
|
|
55
|
+
return [
|
|
56
|
+
`default — ${MODE_MEANS.default}`,
|
|
57
|
+
`What happens: reading, downloading, listing, moving, renaming, labelling run at once. Anything`,
|
|
58
|
+
`that changes or spends is asked about (y/N here, or --yes from an agent that asked you).`,
|
|
59
|
+
`High acts — sharing, signing with the wallet, signing devices out, exposing the NMTS key — are`,
|
|
60
|
+
`locked until you unlock them (\`nmts unlock\`). Erasing the account or files takes a typed sentence.`,
|
|
61
|
+
`Risk: the smallest. Cost: an agent stops for you often.`,
|
|
62
|
+
];
|
|
63
|
+
case "auto-low":
|
|
64
|
+
return [
|
|
65
|
+
`auto-low — ${MODE_MEANS["auto-low"]}`,
|
|
66
|
+
`What happens: the agent runs reads, tidying and reversible changes without asking, and may run`,
|
|
67
|
+
`medium acts — uploads that spend credits within the server's daily ceiling, making an API key,`,
|
|
68
|
+
`publishing your public code — when it judges you asked for them or would want them. High acts`,
|
|
69
|
+
`(sharing, wallet signing, signing devices out) are still asked about and stay locked until you`,
|
|
70
|
+
`unlock them. Erasing the account or files is refused however it is asked.`,
|
|
71
|
+
`Risk: credits can be spent and metadata changed without a question each time. What you gain:`,
|
|
72
|
+
`an agent that finishes a task instead of stopping at every step.`,
|
|
73
|
+
off,
|
|
74
|
+
];
|
|
75
|
+
case "auto-high":
|
|
76
|
+
return [
|
|
77
|
+
`auto-high — ${MODE_MEANS["auto-high"]}`,
|
|
78
|
+
`What happens: the tool refuses exactly what auto-low refuses; what changes is the instruction`,
|
|
79
|
+
`the agent reads. In auto-low it asks itself "did they ask for this?"; in auto-high it is told to`,
|
|
80
|
+
`weigh the situation itself and act on its own judgement where a question would only delay.`,
|
|
81
|
+
`Use it only for a model you would trust with the decisions a careful assistant makes unasked.`,
|
|
82
|
+
`Risk: the same acts as auto-low, decided with less deference to you. What you gain: fewer stops`,
|
|
83
|
+
`from a capable model.`,
|
|
84
|
+
off,
|
|
85
|
+
];
|
|
86
|
+
case "skip-permissions":
|
|
87
|
+
return [
|
|
88
|
+
`skip-permissions — ${MODE_MEANS["skip-permissions"]}`,
|
|
89
|
+
`What happens: every act runs, locked or not, asked or not. The agent may unlock things, share,`,
|
|
90
|
+
`sign with the wallet, sign devices out, erase files and the account. Erasing still needs`,
|
|
91
|
+
`--reason "<why now>", and the reason is kept in this machine's run log.`,
|
|
92
|
+
`Risk: everything this account holds and everything its wallet holds. This is the mode for "I do`,
|
|
93
|
+
`not want to be asked anything and I accept whatever happens". What you gain: nothing waits.`,
|
|
94
|
+
off,
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** The sentence a person types to turn skip-permissions on. Nobody types it by accident. */
|
|
99
|
+
export const SKIP_SENTENCE = "NOTHING WILL ASK ME AND I ACCEPT THAT";
|
|
100
|
+
/** Whether an agent, rather than a person, is taken to be driving. */
|
|
101
|
+
export function isAgentMode(mode) {
|
|
102
|
+
return mode !== "default";
|
|
103
|
+
}
|
|
35
104
|
function path() {
|
|
36
105
|
return join(configDir(), "autonomy.json");
|
|
37
106
|
}
|
|
38
|
-
|
|
39
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Read a stored name, including the two this tool wrote before 2026-09-06: `off` is `default`
|
|
109
|
+
* and `auto` is `auto-low`. Anything else counts as `default`.
|
|
110
|
+
*/
|
|
111
|
+
export function modeFromStored(value) {
|
|
112
|
+
if (value === "off")
|
|
113
|
+
return "default";
|
|
114
|
+
if (value === "auto")
|
|
115
|
+
return "auto-low";
|
|
116
|
+
return typeof value === "string" && AUTONOMY_MODES.includes(value)
|
|
117
|
+
? value
|
|
118
|
+
: "default";
|
|
40
119
|
}
|
|
41
120
|
/**
|
|
42
121
|
* What this machine is set to.
|
|
43
122
|
*
|
|
44
|
-
* ⛔ Unreadable counts as `
|
|
123
|
+
* ⛔ Unreadable counts as `default`. The fail-safe direction for "I do not know" is the one where
|
|
45
124
|
* somebody is still asked -- a file that switches autonomy on when it cannot be parsed is worse
|
|
46
125
|
* than no file at all.
|
|
47
126
|
*/
|
|
@@ -49,15 +128,14 @@ export function currentMode() {
|
|
|
49
128
|
try {
|
|
50
129
|
const parsed = JSON.parse(readFileSync(path(), "utf8"));
|
|
51
130
|
if (typeof parsed !== "object" || parsed === null)
|
|
52
|
-
return "
|
|
53
|
-
|
|
54
|
-
return isMode(mode) ? mode : "off";
|
|
131
|
+
return "default";
|
|
132
|
+
return modeFromStored(Reflect.get(parsed, "mode"));
|
|
55
133
|
}
|
|
56
134
|
catch {
|
|
57
|
-
return "
|
|
135
|
+
return "default";
|
|
58
136
|
}
|
|
59
137
|
}
|
|
60
|
-
/** When it was set, or null when it is
|
|
138
|
+
/** When it was set, or null when it is default or unreadable. */
|
|
61
139
|
export function setAt() {
|
|
62
140
|
try {
|
|
63
141
|
const parsed = JSON.parse(readFileSync(path(), "utf8"));
|
|
@@ -72,7 +150,7 @@ export function setAt() {
|
|
|
72
150
|
}
|
|
73
151
|
/** Write the choice down, with the date and the version that was asked. */
|
|
74
152
|
export function setMode(mode, version, now) {
|
|
75
|
-
if (mode === "
|
|
153
|
+
if (mode === "default") {
|
|
76
154
|
if (existsSync(path()))
|
|
77
155
|
rmSync(path(), { force: true });
|
|
78
156
|
return;
|
|
@@ -91,8 +169,8 @@ export function setMode(mode, version, now) {
|
|
|
91
169
|
* ⚠ It goes to stderr: stdout belongs to whatever is reading this tool's output.
|
|
92
170
|
*/
|
|
93
171
|
export function announcement(mode) {
|
|
94
|
-
if (mode === "
|
|
172
|
+
if (mode === "default")
|
|
95
173
|
return null;
|
|
96
|
-
return `${BANNER_PREFIX}${mode} — ${MODE_MEANS[mode]} Turn it off with \`nmts mode
|
|
174
|
+
return `${BANNER_PREFIX}${mode} — ${MODE_MEANS[mode]} Turn it off with \`nmts mode default\`.`;
|
|
97
175
|
}
|
|
98
176
|
const BANNER_PREFIX = "nmts: autonomy is ";
|