@escro/plugin-sak 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +73 -2
- package/dist/index.cjs +2999 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +91 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.js +2993 -0
- package/dist/index.js.map +1 -0
- package/package.json +68 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 escro.ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @escro/plugin-sak
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Escrow for AI agents, as a [Solana Agent Kit](https://github.com/sendaifun/solana-agent-kit) plugin. Eight actions let
|
|
4
|
+
an agent commission a worker, claim, submit, release, read an escrow, browse the directory and reputation, and pay an
|
|
5
|
+
HTTP 402, settling in USDC on Solana. Escrowed funds release when the buyer approves the delivered work, or 24 hours
|
|
6
|
+
after delivery if the buyer neither releases nor disputes, and default to refund if the work never arrives. Escro never
|
|
7
|
+
judges quality.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @escro/plugin-sak @escro/sdk solana-agent-kit@2.0.10 zod@^3.25.40 @solana/web3.js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`solana-agent-kit` is your agent's own dependency, and this package does not declare it: the plugin imports no runtime value from it. It is verified against `solana-agent-kit@2.0.10`; a later version may work, but check that its plugin contract still matches before relying on it.
|
|
16
|
+
|
|
17
|
+
## Use
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { KeypairWallet, SolanaAgentKit } from "solana-agent-kit";
|
|
21
|
+
import { createEscroPlugin } from "@escro/plugin-sak";
|
|
22
|
+
|
|
23
|
+
const agent = new SolanaAgentKit(new KeypairWallet(keypair, rpcUrl), rpcUrl, {}).use(
|
|
24
|
+
createEscroPlugin({
|
|
25
|
+
wallet: keypair,
|
|
26
|
+
cluster: "mainnet",
|
|
27
|
+
spendCap: { maxOutstandingMicroUsdc: 50_000_000 },
|
|
28
|
+
x402SpendCap: { maxMicroUsdc: 10_000_000 },
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Option | Required | Notes |
|
|
34
|
+
| ------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
35
|
+
| `wallet` | yes | The agent wallet's own `Keypair`. A keypair that is not the agent's wallet is refused at `agent.use`. |
|
|
36
|
+
| `cluster` | yes | `"devnet"` or `"mainnet"`; there is no default. |
|
|
37
|
+
| `spendCap` | on mainnet, to commission or to pay an on-delivery 402 | The most this wallet may hold in open escrows. |
|
|
38
|
+
| `x402SpendCap` | on mainnet, to pay an `exact` 402 | The x402 rail's own budget; `spendCap` does not stand in for it. |
|
|
39
|
+
| `apiUrl`, `rpcUrl` | no | Default to the cluster's public endpoints. |
|
|
40
|
+
| `allowPrivateHosts` | no | `true` lets `escro_pay_402` pay a loopback, link-local or private host, such as a worker on this machine. Absent or `false` refuses such hosts; any other value makes `createEscroPlugin` throw. |
|
|
41
|
+
|
|
42
|
+
Caps and `allowPrivateHosts` are your options and never action input: an LLM cannot set or raise one.
|
|
43
|
+
|
|
44
|
+
## Actions
|
|
45
|
+
|
|
46
|
+
`escro_commission`, `escro_claim`, `escro_submit`, `escro_release`, `escro_read_escrow`, `escro_find_workers`,
|
|
47
|
+
`escro_reputation`, `escro_pay_402`. Each makes one `@escro/sdk` call and never retries.
|
|
48
|
+
|
|
49
|
+
### `escro_pay_402`
|
|
50
|
+
|
|
51
|
+
`{ url, to, amountMicroUsdc, method?, contentType?, body?, maxDeadlineSeconds? }` pays a 402 only to `to` and for
|
|
52
|
+
exactly `amountMicroUsdc`. Before any request it refuses a URL whose host is a loopback, link-local or private
|
|
53
|
+
address, or a name that resolves to one when checked, unless `allowPrivateHosts` is `true`; on mainnet it pays only
|
|
54
|
+
`https:` URLs, following the plugin's `cluster`. The request connects only to addresses that pass the same rule, from
|
|
55
|
+
one resolution of the name, so a name its owner re-points after the check (DNS rebinding) is refused; an escrow entry's
|
|
56
|
+
job specification host is held to that rule before anything is funded. The rule needs direct egress and local DNS: the
|
|
57
|
+
request resolves each host with this machine's resolver and connects directly to the admitted addresses, ignoring an
|
|
58
|
+
HTTP or HTTPS proxy set in the environment, so on a network reachable only through a proxy `escro_pay_402` fails before
|
|
59
|
+
anything is funded or signed.
|
|
60
|
+
|
|
61
|
+
An escrow entry whose deadline is later than now plus `maxDeadlineSeconds` (1 to 604800; 604800, 7 days, when
|
|
62
|
+
omitted) is refused before any chain read, signature or funding, and is never passed over for an `exact` entry.
|
|
63
|
+
|
|
64
|
+
## Custody
|
|
65
|
+
|
|
66
|
+
The key is yours: the plugin hands the keypair only to `@escro/sdk`, which alone signs, and reads no key from the
|
|
67
|
+
environment or a file. A wallet with no local key (an embedded wallet, an MPC signer) is not supported.
|
|
68
|
+
|
|
69
|
+
`escro_commission` and `escro_pay_402` move money. When one fails after money may have moved, its error says what
|
|
70
|
+
was sent and that calling again pays again.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|