@darwin.finance/cli 1.0.1 → 1.1.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/README.md +36 -9
- package/dist/darwin.js +4095 -221
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,10 +7,13 @@ your computer's secret store, and turns every agent action into a command — fo
|
|
|
7
7
|
|
|
8
8
|
Chat apps like Claude or ChatGPT don't use the CLI — they connect to Darwin directly instead.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
> (below) for testing only.
|
|
10
|
+
## Install
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
```sh
|
|
13
|
+
npm i -g @darwin.finance/cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Install from source (for testing)
|
|
14
17
|
|
|
15
18
|
Requires Node.js 20+ and [Bun](https://bun.sh) to build.
|
|
16
19
|
|
|
@@ -23,7 +26,7 @@ npm i -g .
|
|
|
23
26
|
darwin --version
|
|
24
27
|
```
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
Always install it — never run it
|
|
27
30
|
through `npx`: the CLI refuses to read a saved key when it runs from npx or from a project's
|
|
28
31
|
`node_modules`, because a project you are merely working in could substitute its own copy.
|
|
29
32
|
|
|
@@ -43,7 +46,30 @@ What each command does is documented by Darwin itself: the command list is fetch
|
|
|
43
46
|
logged in to (`darwin help`, `darwin <command> --help`, `darwin help --json`), so new commands appear
|
|
44
47
|
without a new release of this program. The API reference: <https://darwin.finance/agents/docs>.
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
### Trading (1.1)
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
darwin quote --sell USDC --amount 5 --for SOL # then: darwin order --quote <id> …
|
|
53
|
+
darwin instant --sell SOL --amount 0.1 --for USDC --max-slippage-bps 50
|
|
54
|
+
darwin perps collateral deposit --amount 5 # USDC: agent wallet → its own perps account
|
|
55
|
+
darwin perps order SOL --side long --size 0.01 --type market
|
|
56
|
+
darwin perps protect SOL --sl 120 --tp 160 [--percent 50] # or --cancel tp|sl|both
|
|
57
|
+
darwin perps close SOL [--size 0.01]
|
|
58
|
+
darwin perps collateral withdraw --amount 5 # back to the agent's own wallet
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
On a site that supports it, every order is two steps behind the scenes: Darwin first **checks** it
|
|
62
|
+
(the agent can trade, perps is set up, there is free collateral, the position or quote is there) and
|
|
63
|
+
stores exactly what it will send — pinning a close's size and side, and which TP/SL a change
|
|
64
|
+
replaces — then sends it **once**. After sending, the CLI waits a few seconds (reading only) and
|
|
65
|
+
says whether it went through. `--dry-run` runs Darwin's real checks and sends nothing.
|
|
66
|
+
|
|
67
|
+
If an order's answer is lost (exit 6), **don't run the command again**: run the `darwin retry <id>`
|
|
68
|
+
it printed. It only reads what happened — went through, still pending, failed or never sent — and
|
|
69
|
+
never sends anything. `darwin cancel <id>` makes sure an order that hasn't started never runs.
|
|
70
|
+
|
|
71
|
+
`darwin mcp` runs the same commands as a local MCP server for desktop AI clients (writes go through
|
|
72
|
+
the same check-then-send; `check_prepared` is the read-only recovery tool, `cancel_prepared` the cancel);
|
|
47
73
|
`darwin mcp --print-config claude|cursor|gemini` prints the registration.
|
|
48
74
|
|
|
49
75
|
## Security model
|
|
@@ -59,9 +85,10 @@ without a new release of this program. The API reference: <https://darwin.financ
|
|
|
59
85
|
- **No more than the key.** Every command is an ordinary agent API call under the key's own limits;
|
|
60
86
|
Darwin signs server-side under the agent's policy. Nothing here can withdraw or move funds between
|
|
61
87
|
your accounts — no such command exists.
|
|
62
|
-
- **No silent retries, no prompts.** A write is never re-sent. If its answer is lost, the CLI
|
|
63
|
-
|
|
64
|
-
|
|
88
|
+
- **No silent retries, no prompts.** A write is never re-sent. If its answer is lost, the CLI reads
|
|
89
|
+
what happened (never re-sends), and if that is still unknown exits 6 with the `darwin retry <id>`
|
|
90
|
+
to run later (on a site without checked orders: check `darwin orders`). There is no `[y/N]`
|
|
91
|
+
prompt; use `--dry-run` to have Darwin check a command without sending anything. Writes and reads are distinct commands, so your
|
|
65
92
|
agent harness can allow reads and ask before writes.
|
|
66
93
|
- **Server text is data.** Text a third party can influence (a token's name, a venue's message) is
|
|
67
94
|
stripped of terminal escapes, control and bidi characters before it reaches a terminal. In JSON
|
|
@@ -79,7 +106,7 @@ without a new release of this program. The API reference: <https://darwin.financ
|
|
|
79
106
|
| 3 | no key / key refused |
|
|
80
107
|
| 4 | refused by Darwin |
|
|
81
108
|
| 5 | rate limited |
|
|
82
|
-
| 6 | a write's outcome is uncertain — don't re-run;
|
|
109
|
+
| 6 | a write's outcome is uncertain — don't re-run; `darwin retry <id>` (or `darwin orders`) |
|
|
83
110
|
| 7 | this CLI is too old |
|
|
84
111
|
| 8 | network unreachable before sending |
|
|
85
112
|
| 10 | the agent is paused |
|