@tinycloud/cli 1.1.0 → 1.2.0-beta.1
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/dist/index.js +3115 -3034
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +13448 -12848
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +4 -4
- package/skills/tc-cli/AUTH.md +20 -7
- package/skills/tc-cli/REFERENCE.md +19 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinycloud/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-beta.1",
|
|
4
4
|
"description": "TinyCloud CLI - manage data, delegations, and nodes from the terminal",
|
|
5
5
|
"author": "TinyCloud, Inc.",
|
|
6
6
|
"license": "EGPL",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@tinycloud/share-sdk": "1.1.0",
|
|
33
33
|
"@tinycloud/share-envelope": "1.1.0",
|
|
34
|
-
"@tinycloud/node-sdk": "3.
|
|
34
|
+
"@tinycloud/node-sdk": "3.2.0-beta.1",
|
|
35
35
|
"@tinycloud/node-sdk-wasm": "1.7.7",
|
|
36
|
-
"@tinycloud/sdk-core": "3.
|
|
37
|
-
"@tinycloud/operations": "0.
|
|
36
|
+
"@tinycloud/sdk-core": "3.2.0-beta.0",
|
|
37
|
+
"@tinycloud/operations": "0.5.0-beta.1",
|
|
38
38
|
"chalk": "^5.3.0",
|
|
39
39
|
"commander": "^14.0.0",
|
|
40
40
|
"open": "^11.0.0",
|
package/skills/tc-cli/AUTH.md
CHANGED
|
@@ -90,7 +90,7 @@ tc --profile agent-secrets secrets get OPENAI_API_KEY --raw
|
|
|
90
90
|
- If the owner unchecks decrypt, the login still succeeds and lists the decrypt entry in `declined`; reads of that secret then fail. Older OpenKey deployments sign decrypt inside the owner's secrets space rather than as a top-level network grant. That does not grant raw decrypt: it is listed in `declined` with an old-deployment warning and omitted from saved approved permissions. A later `auth request --grant` or secret-read escalation refuses that old nested proof before activating or storing a delegation, with `OPENKEY_GRANT_BROADENED`; obtain a new approval from a deployment that signs the raw network grant.
|
|
91
91
|
- A secrets command (`get`, `list`, `put`, `delete`) on an OpenKey profile without a grant for the name fails fast only when neither stdin nor stderr is a terminal: `PERMISSION_DENIED` (exit 5) with a hint naming this scoped login. Redirecting stdout (`|`, `>`, or command substitution) does not prevent a person at a terminal from seeing the browser approval prompt. If the session is missing or expired, a headless secrets command, including the canonical `secrets get` operation, instead fails with `AUTH_REQUIRED` (exit 3) and the scoped paste-login hint before invoking the node or starting an unscoped browser refresh.
|
|
92
92
|
- At a terminal, the owner approves the missing grant in OpenKey. The request carries the missing entries, `tinycloud.capabilities/read` on the space root (the deployed OpenKey refuses a request without it; newer OpenKey releases require it only when it is requested) and raw decrypt in the `encryption` pseudo-space with the owner's address EIP-55 checksummed; a decrypt-only request is placed in the `secrets` space (or `--space`), since OpenKey needs exactly one space. The signed `capabilities/read` counts as requested; anything else beyond the request is refused (`OPENKEY_GRANT_BROADENED`). The grant is stored with its signed SIWE proof (`siweProof`) and a request binding to exactly its signed capabilities (`cli-grant:<cid>`; see below). `secrets get` and other operations (including MCP), in this process or a new one, re-verify that proof against the profile's session key and owner, and hold the grant to its binding, before using it. A stored grant that fails that check (for example one approved by an earlier release, which stored no proof) is not used by them, and a read that needed it asks for approval again. Each such grant is reported by a fixed reason code (`proof_missing`, `unbound`, `outside_request`, `host_mismatch`, `activation_rejected`, ...) and, when the stored CID is the CID of the stored authorization bytes, that CID; never by error text. In JSON mode (`--json`, or stdout not a terminal) the warnings go inside the error's `warnings` array (beside any validated `meta`) when the command fails, or as one `{"warnings": [...]}` line on stderr after the command's output when it succeeds, and stderr carries nothing else; otherwise they are one stderr line saying to approve access again. Expired grants are dropped without a warning. A stale grant needs no cleanup: it expires on its own.
|
|
93
|
-
- A stored session that has expired, or no longer verifies for the profile's key, fails every command that needs it with `AUTH_REQUIRED` (exit 3) before any node request, whatever the profile kind; secrets commands on an owner OpenKey profile whose session has passed its expiry refresh it in the browser at a terminal instead. The hint names a new scoped paste login for a delegate profile, `auth login --method local` for a local owner key, and `auth login --method openkey` for an OpenKey owner; Share commands keep their `auth login --device --manifest builtin:share-publishing` guidance. It is never reported as a retryable node error. Operations and MCP report it as `AUTH_REQUIRED` (`retryable: false`), the code they also use for a node's 401.
|
|
93
|
+
- A stored session that has expired, or no longer verifies for the profile's key, fails every command that needs it with `AUTH_REQUIRED` (exit 3) before any node request, whatever the profile kind; secrets commands on an owner OpenKey profile whose session has passed its expiry refresh it in the browser at a terminal instead. A delegate session created by `tc auth import` has no SIWE; its lifetime is the `exp` its compact-UCAN delegation signs, read from the stored authorization bytes, so it is refused the same way, including sessions imported by earlier releases. Expiry is judged by this machine's clock. `context` reports that expiry, and an expired imported session does not block the scoped paste login the hint names. A session imported from a CACAO (wallet-signed) delegation is still refused only by the node. The hint names a new scoped paste login for a delegate profile, `auth login --method local` for a local owner key, and `auth login --method openkey` for an OpenKey owner; Share commands keep their `auth login --device --manifest builtin:share-publishing` guidance. It is never reported as a retryable node error. Operations and MCP report it as `AUTH_REQUIRED` (`retryable: false`), the code they also use for a node's 401.
|
|
94
94
|
- `secrets get -o FILE` validates the destination and its existing directory before fetching or decrypting secret bytes. It refuses symlinks, directories and devices, syncs a new owner-only (0600) file, then atomically replaces the destination. Directory sync is attempted after replacement where supported; its failure does not report a failed write when the destination was already replaced. A destination that cannot be replaced fails with a sanitized filesystem error naming the destination; there is no unsafe fallback.
|
|
95
95
|
|
|
96
96
|
## More spaces after login
|
|
@@ -105,22 +105,35 @@ tc --profile PROFILE auth request --manifest FILE --grant --device
|
|
|
105
105
|
|
|
106
106
|
## Imported delegations and their request bindings
|
|
107
107
|
|
|
108
|
-
Delegations stored in a profile's `additional-delegations.json`
|
|
108
|
+
Delegations stored in a profile's `additional-delegations.json` replay only into that profile's restored session. Compact-UCAN and signed-login (CACAO) grants must carry a verifiable proof and a valid `authorityRequest` binding whose `requested` capabilities contain all of their signed authority. The CLI, `tc secrets get`, and MCP tools all apply this rule; expired records and cross-user compact grants with a verified CID, signature, and signed audience matching the stored transport audience are skipped silently, while refused replay candidates produce fixed-code `STORED_GRANT_SKIPPED` warnings. A stored record whose `delegationHeader` is anything but a single string `Authorization` installs nothing.
|
|
109
109
|
|
|
110
110
|
- **Request-bound import.** `tc auth import` of an artifact with a `requestId` (from `tc auth grant`, or MCP `tinycloud_auth_import`) binds the delegation to the stored request it was checked against. Importing a stored delegation again this way replaces its record and binding.
|
|
111
|
-
- **Import without a request.** `tc auth import` of a bare portable delegation, a stored record, or an envelope with no `requestId`, addressed to this profile's session key,
|
|
112
|
-
- **
|
|
113
|
-
- **
|
|
111
|
+
- **Import without a request.** `tc auth import` of a bare portable delegation, a stored record, or an envelope with no `requestId`, addressed to this profile's session key, verifies it and binds it to exactly its own signed capabilities: request ID `unbound-import:<cid>`, with an `authorityRequestAudit` note. A signed-login grant must carry its SIWE message and signature; an unproved session-addressed grant fails with `INVALID_AUTH_IMPORT`, and one with an invalid proof fails with `DELEGATION_REJECTED` without being saved. No request limits a valid import: the profile gets the delegation's full signed authority, whatever the artifact's `permissions` say. To limit authority, import against a request instead (`tc auth request --emit`, then `tc auth grant` by the owner, then `tc auth import`). This route never replaces or weakens an existing binding for the same CID.
|
|
112
|
+
- **Proofless cross-user imports.** A portable grant with no signed proof is refused with `INVALID_AUTH_IMPORT` even when addressed to another key. It is not written to the profile or grant history and cannot produce repeated replay warnings.
|
|
113
|
+
- **Expired compact delegations.** A compact-UCAN whose signed expiry has passed, or passes while the import is being stored, fails with `DELEGATION_EXPIRED` (exit 1) and leaves no delegation row or grant-history entry. A provisional first session is rolled back too; if another login or logout changed profile state meanwhile, its newer state is kept.
|
|
114
|
+
- **One-time migration.** Records stored by earlier releases have no binding. The first command that restores the profile's own session binds each verifiable record to exactly its own signed capabilities (`migrated:<cid>`, audit note `source: "migration"`) and writes `delegation-binding-migration.json`, listing bound and unbound CIDs. Records without proof cannot be migrated. Migration is best-effort and restartable under the profile lock: an interrupted run or a busy lock defers remaining records to the next command. The runtime never installs an unbound record during that wait or afterward; it reports `unbound` (or `proof_missing` for records without proof).
|
|
114
115
|
- Older releases ignore the new fields. They do not enforce bindings, and an older `tc auth import` of a CID that is already stored replaces its record with an unbound one, which this release then refuses until it is imported again.
|
|
115
|
-
- **CLI grants.** Signed-login grants from `tc auth request --grant` (OpenKey or local key) and secret-read approvals are checked against the request they answer, then stored with their `siweProof` and bound to
|
|
116
|
+
- **CLI grants.** Signed-login grants from `tc auth request --grant` (OpenKey or local key) and secret-read approvals are checked against the request they answer, then stored with their `siweProof` and bound to their signed capabilities (`cli-grant:<cid>`). A local-key grant of only raw decrypt on the owner's network names no space; it is verified like any other grant. A new grant never replaces an existing bound record for the same CID. Earlier CLI releases stored signed-login grants without a proof: these are now refused with `proof_missing` on every replay path, even if a binding was later added. A grant with proof but without a valid binding reports `unbound`; cross-user delegations addressed to the profile's identity rather than its session key remain separate and are not installed by replay.
|
|
116
117
|
|
|
117
118
|
The binding is local profile data. It stops records written by other paths from granting authority. A request binding limits a stored grant to its signed authority, but it does not prove where the record came from: anyone who can write the profile store and holds a valid grant for this session key can add one. It does not stop someone who can write the profile directory, who already holds the session key and the signed bytes.
|
|
118
119
|
|
|
120
|
+
## Stored grants
|
|
121
|
+
|
|
122
|
+
`tc --profile PROFILE auth grants list --json` reads only the local profile; it makes no node request. Its `session` includes the recomputed session CID when available. Each row reports the stored CID (only if CID-shaped), expiry, source, binding, proof kind, effective scope or stored scope, and `local` verification separately from `node: "not_checked"`. `for_another_key` means the stored audience names another key: this session cannot install it, and its displayed scope is stored metadata rather than locally verified authority. For session-targeted grants, local verification checks compact signatures, CIDs, audience, expiry, resources and binding; for CACAO it checks the owner's signature, audience, lifetime, ReCap, CID and binding. The node still checks delegation chains and revocation, so `local: "verified"` alone is not proof of access. Neither host, request ID nor audit note appears in this output.
|
|
123
|
+
|
|
124
|
+
The `for_another_key` label requires a valid signed compact audience and CID matching the stored Authorization, plus a matching stored `delegateDID`; an edited transport audience or invalid proof is refused with a reason instead. A double `Bearer` prefix is refused; a single prefix is removed before activation.
|
|
125
|
+
|
|
126
|
+
`tc --profile PROFILE auth grants remove <cid>` removes all local rows with that exact CID, without contacting the node; delegates may do this. An owner can add `--revoke --yes` to discover the verified local node (unless a host was explicitly selected), revoke there, then remove local rows only after successful revocation. Delegate-session profiles cannot use `--revoke`. If revocation succeeds but local removal fails, `GRANT_REVOKED_LOCAL_REMOVE_FAILED` includes a hint to retry `auth grants remove <cid>` **without** `--revoke`. `tc delegation revoke <cid>` also revokes a CID directly when its target is known. OpenKey cannot sign raw `urn:cid` ReCap authority today: owner OpenKey revocation falls back to command-scoped `delegation/revoke` on an owner-signed CID-bound space, and fails immediately when no verified fallback space exists. The JavaScript SDK cannot currently issue a delegatee self-revocation, although the node accepts one. Local removal is not revocation.
|
|
127
|
+
|
|
128
|
+
If another process already removed the row after the node revoke, `--revoke` succeeds with `removed: 0`. Other post-revoke local removal errors include the underlying `error.meta.causeCode` (for example `PROFILE_LOCK_TIMEOUT`) so automation can distinguish lock contention from a node failure.
|
|
129
|
+
|
|
130
|
+
To replace an old grant without a proof, an owner can approve again with `tc auth request --grant [--device]`, then remove the old CID. A delegate can emit a request with `tc auth request --emit`, have the owner run `tc auth grant`, import the signed result with `tc auth import`, then remove the old CID. If the original artifact still includes `siweProof`, importing it again is also possible.
|
|
131
|
+
|
|
119
132
|
## Unscoped login and sign-out
|
|
120
133
|
|
|
121
134
|
`tc init` and `tc auth login` without a manifest request broad default-space consent, including writes, and replace the profile's session as before. Prefer `init --key-only` followed by a scoped login. They still verify OpenKey's signed proof whenever it carries one, the profile records an owner, or `--expiry` is given, and they keep the recorded owner. Non-interactive `auth login` never switches to device mode on its own, and never waits on a browser that cannot open: without `--device --manifest`, `--paste` or `--no-popup` it fails fast with `INTERACTIVE_LOGIN_REQUIRED`.
|
|
122
135
|
|
|
123
|
-
Only an explicit `--host` becomes the profile's stored host; `TC_HOST` and a discovered local node apply to that command only.
|
|
136
|
+
Only an explicit `--host` becomes the profile's stored host; `TC_HOST` and a discovered local node apply to that command only. A command that uses the stored session verifies it locally before probing a configured local node (`localNodeUrl`, `localLinkName`); an expired or invalid one is refused without contacting it. Login, logout, rotate, status, whoami, context, node, profile, `space host-request|switch`, `enable` and `auth request` without `--grant` probe as before, as does any command given `--private-key` or `TC_PRIVATE_KEY`, or a profile with no stored session.
|
|
124
137
|
|
|
125
138
|
`tc auth logout` clears the local session and keeps the key. It is not node revocation, app disconnection, or removal of an agent's conversation history.
|
|
126
139
|
|
|
@@ -5,7 +5,7 @@ This release has **Commander coverage tracked, not complete parity**:
|
|
|
5
5
|
|
|
6
6
|
- 1 migrated registration(s).
|
|
7
7
|
- 1 partially migrated registration(s).
|
|
8
|
-
-
|
|
8
|
+
- 125 legacy registration(s) remain Commander-owned.
|
|
9
9
|
|
|
10
10
|
- `auth import [source]` → `tinycloud.auth.import@1` (partial; legacy inputs: v1 delegation artifact, v1 permission artifact without command, bare portable delegation, stored delegation wrapper, cross-user delegation persisted with activated=false).
|
|
11
11
|
- `secrets get <name>` → `tinycloud.secrets.get@1` (migrated).
|
|
@@ -80,7 +80,23 @@ tc delegation revoke <cid>
|
|
|
80
80
|
|
|
81
81
|
Actions are auto-prefixed with `tinycloud.` if not already.
|
|
82
82
|
|
|
83
|
-
`tc auth import` stores delegations in
|
|
83
|
+
`tc auth import` stores delegations in `additional-delegations.json`. Every replay path installs only a grant with a locally verified proof and a binding containing its signed authority; unbound and proof-less grants never install, including while migration is deferred. [AUTH.md](AUTH.md#imported-delegations-and-their-request-bindings) covers migration and recovery.
|
|
84
|
+
|
|
85
|
+
### Stored grants
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
tc --profile PROFILE auth grants list --json
|
|
89
|
+
tc --profile PROFILE auth grants remove <cid>
|
|
90
|
+
tc --profile PROFILE auth grants remove <cid> --revoke --yes
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`list` is local and does not contact the node. Its JSON contains `profile`, `session` (`cid` recomputed from stored header and `expiresAt`, or `null`), `localVerification` (`available`, `session_missing`, `session_expired`, `session_invalid`), and `grants`. Each indexed grant row contains `cid` (CID-shaped or `null`), `expiry`, `expired`, `local` (`verified`, `refused`, `not_checked`, `for_another_key`), `reason` (fixed skip code or `null`), `node: "not_checked"`, `bound`, `proof` (`siwe`, `compact`, `missing`, or `null`), `source`, `scope`, and `scopeSource` (`signed` or `stored`). `for_another_key` means the stored audience names another key; its scope is unverified stored metadata and it cannot install in this session. Local verification checks signed scope and binding, not the node's delegation chain or revocation status. Human output shows `CID | LOCAL | EXPIRES | SOURCE | BOUND | SCOPE` and the session CID.
|
|
94
|
+
|
|
95
|
+
`for_another_key` is decided from a verified signed compact audience, CID, and matching transport DID, not an unsigned `delegateDID` alone. Tampered records retain their refusal reason, and proofless records retain `proof_missing`.
|
|
96
|
+
|
|
97
|
+
Local `remove` deletes every row matching that exact CID, and is available to delegates. `--revoke` alone is owner-only: it uses normal verified local-node discovery unless a host is explicit, revokes on the node, and removes the rows only after success. If the local removal then fails, `GRANT_REVOKED_LOCAL_REMOVE_FAILED` directs a local-only retry without `--revoke`. OpenKey cannot sign raw `urn:cid` authority on the deployed version; owner OpenKey revocation uses a verified CID-bound owner-space fallback, or immediately fails `RAW_RECAP_RESOURCE_UNSUPPORTED`. Local removal does not revoke the delegation; delegated sessions cannot use `--revoke` because this SDK cannot issue a delegatee self-revocation.
|
|
98
|
+
|
|
99
|
+
A concurrent local removal after revocation reports `removed: 0` as success. Other local cleanup failures include `error.meta.causeCode` (for example `PROFILE_LOCK_TIMEOUT`).
|
|
84
100
|
|
|
85
101
|
## Spaces
|
|
86
102
|
|
|
@@ -144,7 +160,7 @@ tc --profile agent secrets get OPENAI_API_KEY --raw
|
|
|
144
160
|
|
|
145
161
|
`secrets: { NAME: true }` requests, in the owner's `secrets` space, `kv/get` on `vault/secrets/NAME` and `capabilities/read` on `""`, plus the raw network entry `{ "service": "tinycloud.encryption", "space": "encryption", "path": "urn:tinycloud:encryption:<ownerDid>:default", "actions": ["tinycloud.encryption/decrypt"] }`. The owner DID comes from the profile's recorded owner, else `--owner`, and its address is EIP-55 checksummed in the URN; with neither the login fails with `OWNER_DID_UNKNOWN`. The JSON result lists approved `permissions` and `declined` entries. A decrypt signed inside the owner's space by an older OpenKey deployment is not a raw grant: scoped login reports it in `declined` and omits it from saved permissions. Browser `auth request --grant` or secret-read escalation refuses that old nested proof before activating or storing a grant (`OPENKEY_GRANT_BROADENED`); a renewed approval must sign the raw network grant.
|
|
146
162
|
|
|
147
|
-
When neither stdin nor stderr is a terminal, `secrets get|list|put|delete` on an OpenKey profile that lacks the grant fails with `PERMISSION_DENIED` (exit 5) and a scoped paste-login hint. Missing or expired sessions instead fail with `AUTH_REQUIRED` (exit 3) before a canonical read invokes the node or starts an unscoped browser refresh. On any profile kind, a stored
|
|
163
|
+
When neither stdin nor stderr is a terminal, `secrets get|list|put|delete` on an OpenKey profile that lacks the grant fails with `PERMISSION_DENIED` (exit 5) and a scoped paste-login hint. Missing or expired sessions instead fail with `AUTH_REQUIRED` (exit 3) before a canonical read invokes the node or starts an unscoped browser refresh. On any profile kind, a stored session that has expired (a signed session, or one `tc auth import` created from a compact UCAN) or no longer verifies fails with `AUTH_REQUIRED` (exit 3) and a sign-in hint before any node request, never as a retryable `NODE_ERROR`; operations and MCP report a non-retryable `AUTH_REQUIRED`. Any service result coded `AUTH_REQUIRED` or `PERMISSION_DENIED` without an HTTP status now exits 3 or 5 instead of 1 in commands using `cliErrorFromService` (account, delegation, DuckDB, encryption, KV, secrets, SQL, and vars); this preserves operation auth codes as typed errors.
|
|
148
164
|
|
|
149
165
|
## Local Replicas
|
|
150
166
|
|