@temporalabs/treasury 0.1.0 → 0.1.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.
Files changed (75) hide show
  1. package/NOTICE +4 -2
  2. package/README.md +108 -111
  3. package/THIRD_PARTY_NOTICES.connect-page.md +7420 -0
  4. package/THIRD_PARTY_NOTICES.md +4 -196
  5. package/dist/cli.d.ts +6 -0
  6. package/dist/cli.js +220 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/client.d.ts +224 -239
  9. package/dist/client.js +147 -25
  10. package/dist/client.js.map +1 -1
  11. package/dist/config/earn.d.ts +33 -12
  12. package/dist/config/earn.js +33 -12
  13. package/dist/config/earn.js.map +1 -1
  14. package/dist/connect/ack.d.ts +59 -0
  15. package/dist/connect/ack.js +111 -0
  16. package/dist/connect/ack.js.map +1 -0
  17. package/dist/connect/commands.d.ts +78 -0
  18. package/dist/connect/commands.js +411 -0
  19. package/dist/connect/commands.js.map +1 -0
  20. package/dist/connect/config.d.ts +22 -0
  21. package/dist/connect/config.js +33 -0
  22. package/dist/connect/config.js.map +1 -0
  23. package/dist/connect/gate.d.ts +37 -0
  24. package/dist/connect/gate.js +115 -0
  25. package/dist/connect/gate.js.map +1 -0
  26. package/dist/connect/http.d.ts +54 -0
  27. package/dist/connect/http.js +205 -0
  28. package/dist/connect/http.js.map +1 -0
  29. package/dist/connect/open.d.ts +2 -0
  30. package/dist/connect/open.js +35 -0
  31. package/dist/connect/open.js.map +1 -0
  32. package/dist/connect/page.d.ts +5 -0
  33. package/dist/connect/page.js +69 -0
  34. package/dist/connect/page.js.map +1 -0
  35. package/dist/connect/session.d.ts +16 -0
  36. package/dist/connect/session.js +73 -0
  37. package/dist/connect/session.js.map +1 -0
  38. package/dist/connect/verify.d.ts +37 -0
  39. package/dist/connect/verify.js +89 -0
  40. package/dist/connect/verify.js.map +1 -0
  41. package/dist/connect-page.js +5141 -0
  42. package/dist/disclosures.d.ts +21 -6
  43. package/dist/disclosures.js +32 -7
  44. package/dist/disclosures.js.map +1 -1
  45. package/dist/earn/commands.d.ts +46 -0
  46. package/dist/earn/commands.js +483 -0
  47. package/dist/earn/commands.js.map +1 -0
  48. package/dist/links.d.ts +2 -0
  49. package/dist/links.js +38 -14
  50. package/dist/links.js.map +1 -1
  51. package/dist/position.d.ts +7 -5
  52. package/dist/position.js +35 -18
  53. package/dist/position.js.map +1 -1
  54. package/dist/preflight.d.ts +9 -0
  55. package/dist/preflight.js +14 -3
  56. package/dist/preflight.js.map +1 -1
  57. package/dist/quote.js +24 -7
  58. package/dist/quote.js.map +1 -1
  59. package/dist/redact.d.ts +3 -3
  60. package/dist/redact.js +3 -3
  61. package/dist/redact.js.map +1 -1
  62. package/dist/registry-schema.d.ts +5 -5
  63. package/dist/registry-schema.js +30 -16
  64. package/dist/registry-schema.js.map +1 -1
  65. package/dist/registry.d.ts +29 -6
  66. package/dist/registry.js +80 -16
  67. package/dist/registry.js.map +1 -1
  68. package/dist/{mcp-server.mjs → treasury.mjs} +29289 -44702
  69. package/dist/version.js +6 -3
  70. package/dist/version.js.map +1 -1
  71. package/package.json +9 -7
  72. package/registry/vaults.json +105 -4
  73. package/dist/mcp/server.d.ts +0 -33
  74. package/dist/mcp/server.js +0 -346
  75. package/dist/mcp/server.js.map +0 -1
package/NOTICE CHANGED
@@ -3,8 +3,10 @@ Copyright 2026 Tempora Labs
3
3
 
4
4
  This product includes software developed by Tempora Labs.
5
5
 
6
- The third-party components bundled into dist/mcp-server.mjs keep their own licences. Each is
7
- reproduced in full, for the exact version bundled, in THIRD_PARTY_NOTICES.md.
6
+ The third-party components bundled into dist/treasury.mjs keep their own licences. Each is
7
+ reproduced in full, for the exact version bundled, in THIRD_PARTY_NOTICES.md. The same holds for
8
+ dist/connect-page.js, the page `treasury connect` serves, whose components are reproduced in
9
+ THIRD_PARTY_NOTICES.connect-page.md.
8
10
 
9
11
  "Tempora", "Tempora Labs" and "Agent Treasury" are names of Tempora Labs. The Apache License
10
12
  (section 6) does not grant permission to use them beyond describing where the work came from.
package/README.md CHANGED
@@ -1,153 +1,150 @@
1
- # Agent Treasury
1
+ # Open Agent Treasury
2
2
 
3
- **Treasury management system for AI agents.** By Tempora Labs.
3
+ **The open-source treasury management system (TMS) for AI agents.** Built by Tempora Labs and contributors.
4
4
 
5
5
  [![ci](https://github.com/TemporaLabs/treasury/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/TemporaLabs/treasury/actions/workflows/ci.yml)
6
6
  [![DCO](https://github.com/TemporaLabs/treasury/actions/workflows/dco.yml/badge.svg)](https://github.com/TemporaLabs/treasury/actions/workflows/dco.yml)
7
7
 
8
- Agent Treasury gives an agent the tools to manage on-chain capital, starting with earning yield on
9
- idle USDC. Its first skill, **Earn**, lets an agent inspect Tempora-curated vaults on Base, check
10
- what a position is worth and how much of it is withdrawable now, and prepare deposits and
11
- withdrawals. The agent's own wallet stays the account and the agent's own signer stays the only
12
- thing that can move money — Agent Treasury prepares unsigned transactions; it never signs.
8
+ <p align="center">
9
+ <img src="docs/assets/oat-mascot.svg" alt="Open Agent Treasury mascot: a blue pirate robot holding a purple treasure chest" width="320" height="320">
10
+ </p>
13
11
 
14
- > **Experimental — pre-1.0.** Behaviour may change between versions. Review every transaction before
15
- > signing it, and read [`docs/risks.md`](docs/risks.md) before a first deposit.
16
12
 
17
- ## Why
13
+ Open Agent Treasury (OAT) helps agents manage on-chain capital. Its first skill, **Earn**, lets
14
+ agents inspect vaults curated by Tempora Labs on Base, Arbitrum One and Robinhood Chain, track positions, and prepare deposits and
15
+ withdrawals. It ships as an agent plugin, a command-line program, and a TypeScript/JavaScript library.
18
16
 
19
- Agents are starting to hold real balances — budgets, revenue, working capital — and most of it sits
20
- idle in a wallet. Treasury management is the discipline of knowing what money is available,
21
- deciding what must stay available, controlling how it moves, and putting genuine surplus to work
22
- within a risk budget. Agent Treasury gives an agent that discipline as tools, with the rule a
23
- treasurer works under built in: it can measure, decide and prepare, and only the owner's signer can
24
- execute.
17
+ **OAT prepares transactions. Your wallet executes them.** It never holds private keys or signs: with
18
+ `treasury connect` your agent opens a page where you connect your own wallet — a browser wallet, or
19
+ an email or social login — and confirm each transaction; or it hands you unsigned calls for any signer.
20
+ A transaction goes out only from your own wallet, after you approve it there. You decide how much capital an agent may put to work.
25
21
 
26
- ## The first skill: Earn
22
+ > **Experimental — pre-1.0. Real funds, real risk.** Returns are variable, capital is at risk,
23
+ > and withdrawals depend on available liquidity. Review every transaction before signing and
24
+ > read the [risks](docs/risks.md) before depositing.
27
25
 
28
- Agent Treasury ships one skill today, **`earn`** — put idle USDC to work in a Tempora vault and
29
- manage the position.
26
+ ## What you can do
30
27
 
31
- - **Deposit.** Idle USDC goes into a Tempora vault. Before anything is built, the skill shows the
32
- terms once and checks, by simulating the deposit, that this account is actually allowed in.
33
- - **Hold.** The position earns the vault's variable yield. The skill reports what it is worth, what
34
- went in and what it has earned, read from the vault's own on-chain records — never a guess.
35
- - **Withdraw.** Some or all, subject to the vault's available liquidity. No vault offered today has a
36
- lock-up or queues withdrawals: a withdrawal settles in the same transaction, and the skill
37
- measures what can be withdrawn *right now* before you sign.
28
+ - **Inspect vaults:** check assets, fees, and deposit access.
29
+ - **Prepare a deposit:** review terms and simulate access before building unsigned calls.
30
+ - **Track a position:** see its value, deposits, and earnings from on-chain records.
31
+ - **Prepare a withdrawal:** check how much is withdrawable now and build unsigned calls.
38
32
 
39
- What amount is surplus is the operator's call, not the skill's: a balance in a wallet is not
40
- permission to invest it. Everything is USDC in, USDC out, and every action comes back as
41
- **unsigned** transactions for the agent's own signer:
33
+ Earn currently supports **USDC in, USDC out** through Tempora Labs' ERC-4626 vaults on Base and
34
+ Arbitrum One, and **USDG in, USDG out** on Robinhood Chain. Base is the default chain, and Test 2B its
35
+ default vault; the agent asks which chain when you have not said, and the funds have to be on that
36
+ chain already. See [Vaults](#vaults).
37
+ See the [command reference](docs/tools.md), the eight `earn` commands and the five `connect` commands, for inputs, outputs, and limits.
42
38
 
43
- ```
44
- agent ──▶ Agent Treasury ──▶ { requires_signature: true, status: "unsigned", calls: [...] }
45
- │
46
- your signer — a wallet, a policy engine, a token-bound account
47
- │
48
- Base
49
- ```
50
-
51
- Agent Treasury cannot sign, send or transfer, and there is no tool that would let it. A test fails
52
- the build if anything in this package reads a private key.
53
-
54
- ## Where the money goes
39
+ ## Quick start
55
40
 
56
- A Tempora vault is an ERC-4626 vault on Base, curated by Tempora Labs, that lends USDC into
57
- on-chain lending markets. **Cash Plus USDC** is the offering: stablecoin only, no lock-up, yield
58
- from lending, positions readable on-chain by anyone. These are experimental, yield-bearing vault
59
- positions, not bank savings accounts: returns are variable, capital is at risk, and a withdrawal
60
- depends on the liquidity available when it is made.
41
+ **Requires Node.js 22+ on your `PATH`.** Use a keyed RPC for each chain you use; the public fallbacks rate-limit quickly.
61
42
 
62
- | vault | chassis | deposits | address |
63
- |---|---|---|---|
64
- | **Cash Plus USDC (Test 2)** — the default | Morpho Vault V2 | open to any account | [`0x040fCA…134Cf`](https://basescan.org/address/0x040fCA12673778FEED5DA7b2ccFbbAb0cc0134Cf) |
65
- | Cash Plus USDC (Test 2A) | IPOR Fusion | whitelist-gated | [`0x1516D2…299ef`](https://basescan.org/address/0x1516D2c082b9cc9af852B1Ebc828f168F27299ef) |
66
-
67
- **The default is Cash Plus USDC (Test 2).** It lends through Morpho on Base, keeps a liquid balance
68
- for withdrawals, and any account can deposit. "Test" is in the name on purpose: these are the
69
- test-series vaults — real contracts, real USDC, real positions — operated by Tempora while the
70
- product is proven. The full detail, with the block each fact was measured at, is in
71
- [`docs/vaults.md`](docs/vaults.md).
43
+ ### Claude Code
72
44
 
73
- **Liquidity.** No vault offered today has a lock-up. A withdrawal is paid from the
74
- vault's liquid balance and then by unwinding positions in the same transaction; under stress part
75
- of a position may take longer, and the skill measures what is exitable now rather than promising.
45
+ ```bash
46
+ export TREASURY_RPC_BASE=https://... # replace with your Base RPC URL
47
+ export TREASURY_RPC_ARBITRUM=https://... # only if you will use a vault on Arbitrum One
48
+ export TREASURY_RPC_ROBINHOOD=https://... # only if you will use a vault on Robinhood Chain
49
+ claude plugin marketplace add TemporaLabs/treasury@v0.1.2
50
+ claude plugin install treasury@treasury
51
+ ```
76
52
 
77
- **Yield.** A floating USDC lending rate — what the vault's positions earn, less any vault fee. The
78
- default charged no fee and was earning **4.4% net APY** (30-day average 4.4%) when measured on
79
- 2026-09-17 through Morpho's public API — by a human, not by this client, which quotes no rate at
80
- all. The skill reports the share price and what your own position has earned, from the vault's
81
- events. The live rate is
82
- on-chain, and a yield is always a measurement of the past, not a promise.
53
+ Start a new Claude Code session after installing so the Earn skill loads. Keep the `TemporaLabs/treasury@v0.1.2` ref
54
+ explicit so the install stays on a release rather than tracking the default branch. Upgrading an
55
+ earlier install? Run `claude plugin marketplace remove treasury` first, then the two `claude plugin` lines above
56
+ ([details](docs/install.md#upgrading-an-earlier-install)).
83
57
 
84
- **Fees and interest.** The default is a Tempora-curated destination. Its fees are readable on-chain
85
- — none was set at the last measurement — and Tempora can set them as curator. Agent Treasury offers it
86
- because it is Tempora's, not because it is the best-yielding vault available.
58
+ The plugin is the [`plugin/`](plugin/) folder of this repository: its manifests, the Earn skill, and a
59
+ copy of this repository's own CLI bundle and the page `treasury connect` serves, made in the same commit. The skill runs it with `node`, one
60
+ command at a time; nothing stays running.
87
61
 
88
- ## An example
62
+ ### Any agent with a shell
89
63
 
64
+ ```bash
65
+ npm install --save-exact @temporalabs/treasury@0.1.2
66
+ npx --no-install treasury earn --help # every command and flag, as JSON
90
67
  ```
91
- you Put 25 USDC to work.
92
68
 
93
- agent Cash Plus USDC (Test 2) is open to this account. 25 USDC buys <shares> at today's
94
- share price. Two transactions to sign, in order:
95
- { requires_signature: true, status: "unsigned",
96
- calls: [ approve(USDC → vault, 25 USDC), deposit(25 USDC, account) ] }
69
+ Each command prints one JSON document; a refusal exits 1 with `{ "error": … }` on stderr.
70
+ For library usage, other hosts, and troubleshooting, see [installation](docs/install.md).
97
71
 
98
- you Sign them — or don't. Nothing has happened yet.
72
+ ### Try it
99
73
 
100
- …later…
74
+ Ask your agent:
101
75
 
102
- you What is it worth, and how much can I take out today?
103
-
104
- agent 25.09 USDC; 25.09 withdrawable now. Put in 25.00, earned 0.09.
105
- ```
76
+ > Show me the available vaults and their risks. Then prepare a 25 USDC deposit into the default vault.
106
77
 
107
- ## Install
78
+ To try the demo vault or another chain, name it: *“…into the demo vault”*, or *“…on Arbitrum”*.
108
79
 
109
- **Claude Code** — pin to a release tag; a tag is immutable, so the install cannot drift:
80
+ With a browser on the machine, you sign in once with `treasury connect`. For each deposit the agent first
81
+ shows you a fixed confirmation text, and only on your yes opens a page where you confirm each call in your
82
+ own wallet. Otherwise OAT returns unsigned calls for your signer. Preparing a deposit moves no money.
83
+ Later, ask: **“What is my position worth, and how much can I withdraw now?”**
110
84
 
111
- ```bash
112
- claude plugin marketplace add TemporaLabs/treasury-plugin@v0.1.0
113
- claude plugin install treasury@treasury
114
- export TREASURY_RPC_BASE=https://... # a keyed Base RPC; unset = the public RPC, which rate-limits quickly
115
- ```
85
+ ## Vaults
116
86
 
117
- Before a release is tagged, pin its release branch instead —
118
- `claude plugin marketplace add TemporaLabs/treasury-plugin@release/v0.1.0`. Dropping the `@<ref>`
119
- suffix tracks the plugin repository's default branch.
87
+ A command that names no vault or chain uses **Cash Plus USDC (Test 2B)** on Base; the agent still asks
88
+ which chain first when you have not said. There are other options, and a demo.
120
89
 
121
- The plugin is packaged in [TemporaLabs/treasury-plugin](https://github.com/TemporaLabs/treasury-plugin)
122
- from this repository's releases. Any other MCP host runs the same bundled server —
123
- [`docs/install.md`](docs/install.md).
90
+ | | vault | chain | choose it by |
91
+ |---|---|---|---|
92
+ | **Default** | **Cash Plus USDC (Test 2B)** | Base | naming nothing, or `--chain base` |
93
+ | **Demo** | **Cash Plus USDC (Test 2)** | Base | `--vault tlCashPlusUSDC2` |
94
+ | Option | **Cash Plus USDC (Test 2C)** | Arbitrum One | `--chain arbitrum` |
95
+ | Option | **Cash Plus USDG (Test 2D)** | Robinhood Chain | `--chain robinhood` |
96
+ | Option | **Cash Plus USDC (Test 2A)** | Base | `--vault tlCashPlusUSDC2A` (whitelist only) |
97
+
98
+ - **Test 2B, the default.** A Morpho Vault V2 on Base, open to any account. Its first position is a
99
+ savings-rate token rather than a lending vault, and its other two positions differ from Test 2's too
100
+ ([how](docs/vaults.md#offered-today)). [BaseScan](https://basescan.org/address/0x91BcEbA5feCB9E92d80F1845B55cC56621E9352F);
101
+ Morpho's own app has no page for it.
102
+ - **Test 2, the demo.** The same kind of vault, and the one to show people: it has a page on Morpho's
103
+ app, [here](https://app.morpho.org/base/vault/0x040fCA12673778FEED5DA7b2ccFbbAb0cc0134Cf/tempora-labs-cash-plus-usdc-test-2#overview).
104
+ Its three positions are different vaults from Test 2B's, and the first is a lending vault. Open to any
105
+ account, but an agent uses it only when it is named.
106
+ - **Test 2C, Arbitrum One.** A Morpho Vault V2 over native USDC, open to any account.
107
+ [Arbiscan](https://arbiscan.io/address/0x4057a63953142Ac2b3E5dB1954Fc14d578662587). The USDC has to
108
+ be on Arbitrum already; OAT does not bridge.
109
+ - **Test 2D, Robinhood Chain.** A Morpho Vault V2 over **USDG**, not USDC, open to any account.
110
+ [Blockscout](https://robinhoodchain.blockscout.com/address/0x758f00731943aA88e8C7fB709e0B727903B4F833).
111
+ The USDG has to be on Robinhood Chain already.
112
+ - **Test 2A.** IPOR Fusion, listed so an admitted account can read and exit its position.
113
+
114
+ When you have not said which chain, the agent shows these and asks before it prepares a deposit.
115
+
116
+ All of them are experimental vaults using real funds (USDC, or USDG on Robinhood Chain), not bank savings accounts. None currently has a
117
+ lock-up, but liquidity can limit withdrawals.
118
+
119
+ Tempora Labs curates these vaults and can set fees. OAT offers Tempora Labs' vaults; it does not compare
120
+ them against the market or promise the best yield. It reports your position's value and earnings,
121
+ not a quoted APY.
122
+
123
+ See [vault details](docs/vaults.md) for addresses, access rules, fees, and dated measurements.
124
124
 
125
125
  ## Security
126
126
 
127
- - **No keys, no custody.** Funds move only in transactions your signer approves, from your account.
128
- - **No telemetry.** The server calls the RPC you configure and nothing else — no analytics, no
129
- yield API, no vendor. A keyed RPC URL is treated as a secret and never repeated in output.
130
- - **A verifiable bundle.** The server is rebuilt in CI and must match byte-for-byte; every build
131
- carries a provenance attestation you can check —
132
- [`docs/runbooks/verify_the_bundle.md`](docs/runbooks/verify_the_bundle.md).
133
- - **Found a vulnerability?** [`SECURITY.md`](SECURITY.md) — privately, never as a public issue.
127
+ - **No keys or custody:** your wallet holds the position; Treasury never holds a key. With an email or social login, that wallet's keys are managed by Privy; see [risks](docs/risks.md).
128
+ - **Direct RPC access:** the `earn` commands talk only to the chain's RPC (yours, or the chain's public endpoint when none is set or a history scan needs it; see [configuration](docs/configuration.md)), with no Tempora Labs service in the request path and no telemetry. Keyed RPC URLs are redacted.
129
+ - **Sign-in through Privy:** `treasury connect` signs you in through [Privy](https://privy.io), using Tempora Labs' Privy app unless you set `PRIVY_APP_ID`. Privy, and Tempora Labs as that app's owner, see your login and wallet address, and Privy's script on the page sends its own analytics. The page also loads Cloudflare's bot check (challenges.cloudflare.com) for Privy's sign-in.
130
+ - **Verifiable builds:** CI checks the committed bundle; [verify its provenance](docs/runbooks/verify_the_bundle.md).
131
+ - **Private vulnerability reporting:** follow [SECURITY.md](SECURITY.md), not a public issue.
134
132
 
135
133
  ## Documentation
136
134
 
137
- [`docs/`](docs/README.md) — install, the tools under the skill, the vaults, the risks,
138
- configuration, the security model, and a runbook for signing and sending.
139
- Release notes: [`CHANGELOG.md`](CHANGELOG.md).
135
+ - [Command reference](docs/tools.md) · [Configuration](docs/configuration.md)
136
+ - [Risks](docs/risks.md) · [Security model](docs/security-model.md)
137
+ - [Signing and sending](docs/runbooks/sign_and_send.md) · [All docs](docs/README.md) · [Changelog](CHANGELOG.md)
140
138
 
141
139
  ## Contributing
142
140
 
143
- Pull requests are welcome. Commits carry a `Signed-off-by` trailer (`git commit -s`) certifying the
144
- [Developer Certificate of Origin](DCO.md). How to build, test and what a change must keep true:
145
- [`CONTRIBUTING.md`](CONTRIBUTING.md).
141
+ Feedback and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for development,
142
+ testing, and contribution guidelines. Every commit needs a `Signed-off-by` trailer (`git commit -s`)
143
+ certifying the [Developer Certificate of Origin](DCO.md).
146
144
 
147
145
  ## Licence
148
146
 
149
- Agent Treasury is open source under the [Apache License, Version 2.0](LICENSE). Use it, modify it,
150
- redistribute it — inside commercial agents, wallets and hosted services — keeping [`LICENSE`](LICENSE)
151
- and [`NOTICE`](NOTICE). The Tempora names and marks are not licensed (section 6): a fork may say it is based on
152
- Agent Treasury; it may not present itself as the official distribution. Tempora's fund-operations infrastructure is separate and is not
153
- part of this repository. More: [`docs/licensing.md`](docs/licensing.md).
147
+ [Apache-2.0](LICENSE). Keep [LICENSE](LICENSE) and [NOTICE](NOTICE) when redistributing.
148
+ The licence does not grant rights to Tempora Labs' names or marks ("Tempora", "Tempora Labs" and "Agent Treasury", as NOTICE lists them); forks must not claim to be the
149
+ official distribution. Tempora Labs' fund-operations infrastructure is separate from this repository.
150
+ See [licensing](docs/licensing.md) for details.