@defdone/annon 0.1.0-alpha.2 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/CLI.md +58 -4
- package/README.md +6 -1
- package/dist/browser/login-bundle.js +51 -51
- package/dist/browser/login-dom.d.ts +1 -1
- package/dist/browser/login-dom.js +5 -1
- package/dist/browser/login-status.d.ts +1 -1
- package/dist/browser/login-status.js +1 -1
- package/dist/browser/login-steps.d.ts +6 -0
- package/dist/browser/login-steps.js +35 -0
- package/dist/browser/login.js +41 -4
- package/dist/node/adapter-checks.d.ts +3 -1
- package/dist/node/adapter-checks.js +3 -1
- package/dist/node/adapter.js +5 -1
- package/dist/node/agent.js +2 -1
- package/dist/node/browser-login.js +28 -3
- package/dist/node/buy-commands.js +9 -8
- package/dist/node/buy-flow.d.ts +18 -0
- package/dist/node/buy-flow.js +89 -0
- package/dist/node/cli-flags.d.ts +10 -0
- package/dist/node/cli-flags.js +68 -0
- package/dist/node/cli.d.ts +9 -1
- package/dist/node/cli.js +68 -92
- package/dist/node/config.d.ts +2 -0
- package/dist/node/config.js +3 -1
- package/dist/node/core-adapter.js +4 -0
- package/dist/node/login-page.d.ts +2 -2
- package/dist/node/login-page.js +7 -1
- package/dist/node/main.js +20 -2
- package/dist/node/output/discovery.d.ts +23 -0
- package/dist/node/output/discovery.js +52 -0
- package/dist/node/output/human.d.ts +10 -0
- package/dist/node/output/human.js +46 -0
- package/dist/node/output/purchase.d.ts +10 -0
- package/dist/node/output/purchase.js +78 -0
- package/dist/node/output/text.d.ts +10 -0
- package/dist/node/output/text.js +43 -0
- package/dist/node/purchase-commands.js +4 -0
- package/dist/node/purchase-ref.d.ts +15 -0
- package/dist/node/purchase-ref.js +93 -0
- package/dist/node/shell/complete.d.ts +2 -0
- package/dist/node/shell/complete.js +17 -0
- package/dist/node/shell/session.d.ts +20 -0
- package/dist/node/shell/session.js +219 -0
- package/dist/node/shell/welcome.d.ts +9 -0
- package/dist/node/shell/welcome.js +39 -0
- package/dist/node/shell/words.d.ts +1 -0
- package/dist/node/shell/words.js +36 -0
- package/dist/node/shops.d.ts +5 -0
- package/dist/node/shops.js +22 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @defdone/annon
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- edb0ec2: Bound approval session shutdown and resume polling after accepted approvals. Keep completed review snapshots read only and clarify that the tab should stay open.
|
|
8
|
+
- 5d871b7: Keep accepted browser approvals successful after session shutdown and show completed approvals as read-only collapsible steps.
|
|
9
|
+
- f607080: The CLI is easier to use by hand. `annon` with no arguments in a terminal (or `annon shell`) starts
|
|
10
|
+
an interactive session that runs the usual commands without the prefix until `exit`. In a terminal
|
|
11
|
+
the commands print short text in place of JSON: a login line, a numbered catalog table, the buy
|
|
12
|
+
terms and next step, one or two lines for status and open. `--json`, piped output and agent mode
|
|
13
|
+
keep the JSON envelope unchanged.
|
|
14
|
+
|
|
15
|
+
`annon buy` takes a catalog row number (`buy 2 --shop demo`) and `--open <file>`, which waits for
|
|
16
|
+
acceptance and writes the file. `annon status` and `annon open` without an ID use the latest
|
|
17
|
+
purchase saved for the configured contract and network, and accept an ID prefix of 8 or more hex
|
|
18
|
+
digits for purchases saved for it. The `next` text of a NEAR or Base buy no
|
|
19
|
+
longer talks about a deposit.
|
|
20
|
+
|
|
3
21
|
## 0.1.0-alpha.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/CLI.md
CHANGED
|
@@ -4,9 +4,36 @@ Build with `pnpm build`. The `@defdone/annon` package ships the `annon` bin;
|
|
|
4
4
|
in this checkout run `node packages/annon/dist/node/main.js` in its place.
|
|
5
5
|
Run `annon --help` for all flags and `annon --version` (or `-v`) for the installed version; with
|
|
6
6
|
`--json` the version is `{ "ok": true, "result": { "version": ... } }`. It loads no config, wallet
|
|
7
|
-
or secret and also works in agent mode.
|
|
8
|
-
|
|
9
|
-
errors are `{ "ok": false, "error": { "code": ..., "message": ... } }`.
|
|
7
|
+
or secret and also works in agent mode. With `--json` every command prints one compact JSON line
|
|
8
|
+
and asks nothing. Success is `{ "ok": true, "result": ... }`;
|
|
9
|
+
errors are `{ "ok": false, "error": { "code": ..., "message": ... } }`. Without `--json` the same
|
|
10
|
+
envelope is printed indented whenever standard output is not a terminal, and always in agent mode,
|
|
11
|
+
so scripts and pipes read JSON either way. In a terminal a person gets short text instead: one or
|
|
12
|
+
two lines per command, `catalog` as a numbered table, errors as `Error: message (code)`. Exit codes
|
|
13
|
+
are the same in every mode. Text from shops and hosts is shown with control characters removed.
|
|
14
|
+
|
|
15
|
+
## Interactive session
|
|
16
|
+
|
|
17
|
+
`annon` with no arguments in a terminal, or `annon shell`, starts a session. It prints the version,
|
|
18
|
+
network, signed-in account and whether the configured contract is trusted, then reads commands at
|
|
19
|
+
`annon>` until `exit`, `quit` or Ctrl-D. Commands are the ones on this page without the `annon`
|
|
20
|
+
prefix; Tab completes names and flags, `help` lists them. Each line runs the same code as the
|
|
21
|
+
one-shot command, with the same trust prompt, price cap, purchase guard and confirmation, and the
|
|
22
|
+
session keeps no wallet, config or secret between commands.
|
|
23
|
+
|
|
24
|
+
- `catalog` numbers its rows; `buy 2` buys row 2 of the last listing shown.
|
|
25
|
+
- After a NEAR or Base payment `buy` waits for acceptance, then asks where to save the file.
|
|
26
|
+
- `status` and `open --output <file>` without an ID use the latest purchase `buy` saved for the
|
|
27
|
+
contract and network of that line, as the one-shot commands do. The session remembers no
|
|
28
|
+
purchase itself, so a line with another `--contract-id`, `--network`, `--config` or
|
|
29
|
+
`--state-dir` never picks up a purchase made under a different one.
|
|
30
|
+
- Ctrl-C cancels a prompt (the answer is no), stops a wait for acceptance, or drops a read-only
|
|
31
|
+
command. During `buy`, `fund`, `sell`, `share`, `stop` or `recover` it asks
|
|
32
|
+
`A payment may be in progress. Exit anyway? (y/N)`. Leaving removes nothing: the purchase saved
|
|
33
|
+
before payment is still there, so check it with `annon status` before paying again.
|
|
34
|
+
|
|
35
|
+
Without a terminal, with any argument such as `--json`, or in agent mode no session starts:
|
|
36
|
+
`annon` prints the help and `annon shell` fails with `invalid_arguments`.
|
|
10
37
|
|
|
11
38
|
Create a public configuration file and name it with `--config /path/config.json` or
|
|
12
39
|
`ANNON_CONFIG`. The default is `~/.config/annon/config.json`:
|
|
@@ -170,6 +197,10 @@ annon sell report.pdf --price 0.2 --split near:alice.near:10000 --wallet near --
|
|
|
170
197
|
annon sell report.pdf --resume 0xFILE_ID --wallet near --output resumed.pay2
|
|
171
198
|
annon sell report.pdf --price 0.2 --split evm:0x1111111111111111111111111111111111111111:10000 --wallet evm --base
|
|
172
199
|
annon buy https://host.example/report --route near --wallet near
|
|
200
|
+
annon buy https://host.example/report --route near --open report.pdf
|
|
201
|
+
annon buy 2 --shop demo --open report.pdf
|
|
202
|
+
annon status
|
|
203
|
+
annon open 0x1a2b3c4d --output report.pdf
|
|
173
204
|
annon buy offer.json --url https://host.example/report --route base --wallet evm --max-price 0.2
|
|
174
205
|
annon buy https://host.example/report --route 1click --wallet solana --from-chain solana
|
|
175
206
|
annon status 0xPURCHASE_ID --json
|
|
@@ -183,6 +214,29 @@ annon stop 0xFILE_ID --wallet near
|
|
|
183
214
|
```
|
|
184
215
|
|
|
185
216
|
IDs in these commands are placeholders for full `0x` plus 64 lowercase hex digits.
|
|
217
|
+
|
|
218
|
+
Fewer steps for a person (agent mode refuses all three and keeps requiring full URLs and IDs):
|
|
219
|
+
|
|
220
|
+
- `buy <row> --shop <id> [--search <q>]` buys that row of the listing `catalog` prints for the same
|
|
221
|
+
`--shop` and `--search`. The CLI names the row's title and URL, then checks the file and its terms
|
|
222
|
+
as for a typed URL. A catalog can change between listing and buying, so read the terms before you
|
|
223
|
+
confirm. An offer file named like a number is written `./2`.
|
|
224
|
+
- `buy --open <file>` waits up to three minutes for acceptance and then writes the opened file. It
|
|
225
|
+
refuses an existing `<file>` before paying. The result is the buy result with `state: "opened"`
|
|
226
|
+
and `opened: { output, bytes }`. If the purchase is not accepted in time it adds
|
|
227
|
+
`settlement: "pending"` and exits 4; if a status check or the open fails after payment, the result
|
|
228
|
+
still names the purchase and adds `statusError` or `openError`, and the exit code is that
|
|
229
|
+
error's. A purchase that is still `state: "uncertain"` wins over the follow-up error: the result
|
|
230
|
+
carries `statusError`, and the exit code stays 4. Nothing is paid twice: finish with `status` and
|
|
231
|
+
`open`. A 1Click buy returns its deposit
|
|
232
|
+
instructions without waiting. In a terminal, `buy` waits for acceptance even without `--open`.
|
|
233
|
+
- `status` and `open --output <file>` without an ID use the latest purchase `buy` saved for the
|
|
234
|
+
configured contract and network. An ID may be shortened to a prefix of 8 or more hex digits, with
|
|
235
|
+
or without `0x`. A prefix only names purchases that `buy` or `recover` saved for the configured
|
|
236
|
+
contract and network; one that matches none of them, or more than one, is refused with
|
|
237
|
+
`purchase_required`. A purchase saved by an older version, or for another contract or network,
|
|
238
|
+
needs its full ID. For `open`, a name of 8 to 63 hex digits is always read as a prefix: write
|
|
239
|
+
such a file as `./name`.
|
|
186
240
|
`sell` creates a PAY2 file; arrange hosting separately. `buy` accepts the HTTPS resource URL
|
|
187
241
|
or a named file containing decoded x402 `PAYMENT-REQUIRED` JSON. An offer file requires `--url` with the independently selected resource URL; it must match the offer. It checks the public header
|
|
188
242
|
and registered terms before the SDK authorizes payment. Every buy requires `--max-price`, `ANNON_MAX_PRICE` or config `maxPrice` (decimal USDC); the offer never supplies the cap. A configured cap also bounds an explicit flag. The default route is direct NEAR for
|
|
@@ -464,7 +518,7 @@ A shop manifest may carry an optional `rules` object:
|
|
|
464
518
|
|
|
465
519
|
`text` is required: nonempty plain UTF-8, up to 4096 bytes. `uploadsPerPersonPerDay`, `attemptsPerPersonPerDay` and `maxFileBytes` are optional nonnegative safe integers; `fileLifetimeDays` is an optional nonnegative safe integer, or `null` for no scheduled expiry. Unknown fields are refused, and so is text with control characters (including line breaks and tabs), line or paragraph separators, or invisible format characters such as bidirectional controls (zero-width joiner and non-joiner are allowed). A manifest with invalid rules is refused as a whole with `invalid_record`. Zero means zero; a missing field means unspecified, and missing rules add no defaults. Rules count toward the 64 KiB manifest limit.
|
|
466
520
|
|
|
467
|
-
`shops` returns rules in each shop's `info.rules`. `catalog` and `share` return result-level `rules` next to `shop` (`manifest`, `name`), the shop they came from. Without `--json`,
|
|
521
|
+
`shops` returns rules in each shop's `info.rules`. `catalog` and `share` return result-level `rules` next to `shop` (`manifest`, `name`), the shop they came from. Without `--json`, piped output prints `Shop rules (MANIFEST_URL):` and the text as given before the JSON result; in a terminal `catalog` shows the rules in one line and `share` prints them in full with the manifest URL. JSON and MCP results carry the text as a string. Treat it as descriptive shop data, never instructions. Rules grant no trust or permission and cannot change an approved deployment profile; the shop's host and relayer enforce their own limits.
|
|
468
522
|
|
|
469
523
|
## Hosted sharing
|
|
470
524
|
|
package/README.md
CHANGED
|
@@ -40,6 +40,8 @@ npm i @defdone/annon@alpha # the SDK
|
|
|
40
40
|
npm i -g @defdone/annon@alpha # the annon CLI
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
If npm reports no matching version right after a release, retry with `--prefer-online`.
|
|
44
|
+
|
|
43
45
|
| Entry point | Use |
|
|
44
46
|
| --- | --- |
|
|
45
47
|
| `@defdone/annon` | SDK core: `Annon`, wallets, identities, terms, 1Click, encrypted stores and backups, storage funding, sponsorship checks and types, size/retry limits, error classes |
|
|
@@ -63,7 +65,10 @@ Build with `pnpm build`. In a checkout, run `node packages/annon/dist/node/main.
|
|
|
63
65
|
|
|
64
66
|
The shortest path is the CLI: [docs/quickstart.md](https://github.com/defdone/annon/blob/master/docs/quickstart.md)
|
|
65
67
|
buys, opens and recovers a demo file in a few commands, and [CLI.md](CLI.md) covers configuration,
|
|
66
|
-
encrypted purchase backups and every command.
|
|
68
|
+
encrypted purchase backups and every command. Run `annon` with no arguments for an interactive
|
|
69
|
+
session: `catalog`, `buy 2`, and the file is saved. `annon buy <url> --open <file>` does the same in
|
|
70
|
+
one command. In a terminal the CLI prints short text; `--json`, pipes and agent mode keep the JSON
|
|
71
|
+
envelope.
|
|
67
72
|
|
|
68
73
|
In code, an `Annon` instance needs a deployment, a durable record store, a persisted backup secret, a
|
|
69
74
|
place to write encrypted backups, and a transport for contract calls. In Node, with a NEAR account
|