@priors/mcp 0.19.0 → 0.19.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @priors/mcp changelog
2
2
 
3
+ ## 0.19.1 (2026-11-10)
4
+
5
+ - **`line_key_spend` pays only for an agent this wallet owns or is the declared ERC-8004 wallet of, and that wallet
6
+ repays under LineKey** (GHSA-45h8-v5q8-4j43, reported by @pa-khan). An agent's owner names its spending key's operator
7
+ with no word from it, as it names a pool delegate (GHSA-9pw7), and `line_key_spend` (0.18.0, with
8
+ `PRIORS_LINE_KEY=on`) took being the operator as enough: a stranger who named this wallet, and a model told to pass
9
+ that `agent_id`, had it pay from the stranger's line with its own gas and borrowing limits. It now refuses a wallet
10
+ that is neither the agent's owner nor its declared wallet before the key is read, and `line_key_status` says so. Once
11
+ LineKey is the agent's pool delegate, the agent's own key controls nothing at the pool, and `repay` and `autopay_on`
12
+ refused it, though `line_key_spend`'s answer sends it there: the declared wallet now repays and turns Autopay on
13
+ whether or not the pool names it the delegate; any other wallet is refused as before. With `@priors/x402` 0.8.9.
14
+
3
15
  ## 0.19.0 (2026-11-09)
4
16
 
5
17
  - **The agent's open loans, named when a session starts.** `initialize`'s instructions end with each open loan of the
package/README.md CHANGED
@@ -34,7 +34,7 @@ repaying.
34
34
  | `stock_assets(symbol?)` | the stock tokens the Priors stock vault accepts: live Chainlink price, whether it lends against each now (or why not: a sharp price move, a multiplier change, a paused or blocked token), loan-to-value | no |
35
35
  | `stock_position(agent_id?)` | the stock tokens behind an agent's stock line: amount, what the vault values them at, loan-to-value, what the line can draw now, any lending hold | no (with `agent_id`) |
36
36
  | `borrow(amount_usd, days, dry_run?)` | borrow USDG from the line into the wallet; both amounts required; `dry_run` quotes the fee. (0.10.2) Needs the wallet to be the agent's owner or its declared ERC-8004 wallet, the same rule as `repay`. A borrow sent whose answer is lost is counted and said to be possibly open (check `credit_status`); (0.12.0) so is one the node refused for "insufficient funds" while it holds the signed borrow (a copy sent again after an HTTP 429). (0.12.1) On a line SeatVaultV5 backs, a term over 10 days is refused before anything is sent | yes |
37
- | `repay(loan_id? \| all, use_savings?)` | repay one of the agent's own loans, or all of them earliest due first; another agent's loan is refused, and (0.8.1) so is a loan opened while someone else held the agent; (0.10.2) a wallet that is neither the agent's owner nor its declared ERC-8004 wallet (a pool delegate the owner named) repays nothing — and, symmetrically, borrows nothing, so no loan is drawn that this server would then refuse to repay: the owner declares the agent's key with `priors-mcp link-wallet`. If the wallet is short of what is due, it first takes the difference out of savings (unless `use_savings: false`). From 0.8.0 its answer ends with share facts for each loan repaid (amount, on time or late, the record's page; also as structured content); the server never posts | yes |
37
+ | `repay(loan_id? \| all, use_savings?)` | repay one of the agent's own loans, or all of them earliest due first; another agent's loan is refused, and (0.8.1) so is a loan opened while someone else held the agent; (0.10.2) a wallet that is neither the agent's owner nor its declared ERC-8004 wallet (a pool delegate the owner named) repays nothing — and, symmetrically, borrows nothing, so no loan is drawn that this server would then refuse to repay: the owner declares the agent's key with `priors-mcp link-wallet`. (0.19.1) The declared wallet repays whether or not the pool names it the agent's delegate (an agent whose delegate is the spending key, LineKey, below), and `autopay_on` takes the same rule. If the wallet is short of what is due, it first takes the difference out of savings (unless `use_savings: false`). From 0.8.0 its answer ends with share facts for each loan repaid (amount, on time or late, the record's page; also as structured content); the server never posts | yes |
38
38
  | `savings(address?)` | what the wallet (or any address) has saved in the savings vault, how much can come out right now, and the USDG in the wallet | no (with `address`) |
39
39
  | `save(amount_usd)` | move spare USDG from the wallet into the savings vault, where it earns the vault's rate (at most `PRIORS_MAX_SAVE_USD` per call, `PRIORS_MAX_SAVE_TOTAL_USD` per run); needs ETH for gas | yes |
40
40
  | `unsave(amount_usd? \| all)` | take USDG back out of savings into the wallet: a normal withdrawal, and when that is not enough, the rest from the vault's other markets in the same transaction (only where that costs no penalty); refused before any transaction when even that cannot pay it; needs ETH for gas | yes |
@@ -54,7 +54,7 @@ repaying.
54
54
  | `join()` | (since 0.11.0) only with `PRIORS_JOIN=on`: register an ERC-8004 identity on Robinhood Chain for the wallet when it owns none (one transaction, its gas in the wallet's ETH; too little is refused before anything is signed) and answer its id and its routes to a first line; a wallet that owns one gets its id and nothing is sent; a registration whose answer is lost is never sent twice | yes |
55
55
  | `first_line(agent_id?)` | (since 0.12.0) only with `PRIORS_JOIN=on`: take the treasury's first line by invite for the identity the wallet owns, when it has no Priors record (after `join`), with no clone or Telegram: post the invite's 5 USDG bond from the wallet (USDG's approve, then InviteBond's deposit; it comes back by InviteBond's release, and a default forfeits it), get the invite from Priors' invite bot with one signature that proves ownership (only the bot's own start-page text, rebuilt here byte for byte, is signed), then sign the pool consent and redeem it (treasury v4's `firstLine`). Refused before anything is signed when the wallet does not own the identity, the identity already has a record (its state is the answer), the wallet lacks the ETH or the USDG, the bond would pass `PRIORS_MAX_BOND_TOTAL_USD` or `PRIORS_MAX_SPEND_DAY_USD`, or the bot says no invite is open now (its reason, with `line_options`' routes). A transaction whose answer is lost answers `TX_UNCONFIRMED`, and a second call never posts a second bond; needs ETH for gas | yes |
56
56
  | `line_key_status(agent_id?)` | only with `PRIORS_LINE_KEY=on` (below): the agent's spending key on LineKey: whether one is set and live (or stale: the agent changed hands; expired; not the line's delegate: each pays nothing), its operator and whether that is this wallet, its caps per payment and per trailing period, its expiry, each payment's loan term and most fee, the payees with their own caps and what each can be paid now, what was paid in the period and when room frees up, and the pool's smallest loan (5 USDG) | no (with `agent_id`) |
57
- | `line_key_spend(payee, amount_usdg, ref?, agent_id?, dry_run?)` | only with `PRIORS_LINE_KEY=on`: pay a payee the agent's owner listed on the key, from the agent's line, as a loan of the agent: the pool pays the payee directly, never through this wallet, which must be the key's operator. A `ref` (a job or an invoice: up to 31 bytes of text, or 32 in hex) is paid once per payee. Refused before anything is signed when the key's `check` refuses (each reason in words), the amount is under the pool's smallest loan or over its largest, the line refuses it in a simulation (no room, its backer's rule, a fee above the key's most), the wallet lacks the ETH for the gas, or a borrowing limit would pass. One transaction to LineKey, gas limit 900,000; the answer names the loan (from LineKey's `Paid` log), its fee and due date, to repay with `repay`; `dry_run` lists the call; needs ETH for gas | yes |
57
+ | `line_key_spend(payee, amount_usdg, ref?, agent_id?, dry_run?)` | only with `PRIORS_LINE_KEY=on`: pay a payee the agent's owner listed on the key, from the agent's line, as a loan of the agent: the pool pays the payee directly, never through this wallet, which must be the key's operator and (0.19.1) the agent's owner or its declared ERC-8004 wallet (the owner names an operator with no word from it). A `ref` (a job or an invoice: up to 31 bytes of text, or 32 in hex) is paid once per payee. Refused before anything is signed when the key's `check` refuses (each reason in words), the amount is under the pool's smallest loan or over its largest, the line refuses it in a simulation (no room, its backer's rule, a fee above the key's most), the wallet lacks the ETH for the gas, or a borrowing limit would pass. One transaction to LineKey, gas limit 900,000; the answer names the loan (from LineKey's `Paid` log), its fee and due date, to repay with `repay`; `dry_run` lists the call; needs ETH for gas | yes |
58
58
 
59
59
  Tools that move money state the amounts in their answer, are marked destructive for MCP clients, and their
60
60
  descriptions tell the assistant to confirm with you first. They run one at a time and each answers within 45 s, under an
@@ -128,10 +128,13 @@ spending key for an agent's Priors line. The agent's owner names it the line's d
128
128
  an operator (a hot key, such as this server's wallet), caps per payment and per trailing period, the payees it may pay
129
129
  (each with an optional cap of its own), an expiry, the loan term and the most fee. The owner sets it up in Go mode's
130
130
  agent panel, Spending key (on the test site for now). With `PRIORS_LINE_KEY=on`, `line_key_status` reads the key, and
131
- `line_key_spend` pays a listed payee from this wallet when it is the key's operator: the pool lends the amount and pays
132
- it straight to the payee, so every payment is an ordinary loan of the agent, repaid like any other before its due date.
133
- The operator holds nothing for it and pays only its own gas, in ETH. The key's caps bound what a stolen operator key
134
- could pay, and only to the listed payees; this server's borrowing limits count each payment too.
131
+ `line_key_spend` pays a listed payee from this wallet when it is the key's operator and (0.19.1) the agent's owner or
132
+ its declared ERC-8004 wallet (`priors-mcp link-wallet` declares it; the owner names an operator with no word from it):
133
+ the pool lends the amount and pays it straight to the payee, so every payment is an ordinary loan of the agent, repaid
134
+ like any other before its due date, by `repay` from the agent's owner or its declared wallet (the pool no longer names
135
+ that wallet the agent's delegate: the key is). The operator holds nothing for it and pays only its own gas, in ETH.
136
+ The key's caps bound what a stolen operator key could pay, and only to the listed payees; this server's borrowing
137
+ limits count each payment too.
135
138
 
136
139
  ## Asking for a line on the line board (off by default, since 0.19.0)
137
140
 
@@ -422,7 +425,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
422
425
  "mcpServers": {
423
426
  "priors": {
424
427
  "command": "npx",
425
- "args": ["-y", "@priors/mcp@0.19.0"],
428
+ "args": ["-y", "@priors/mcp@0.19.1"],
426
429
  "env": {
427
430
  "PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
428
431
  "PRIORS_AGENT_ID": "1234"
@@ -444,7 +447,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
444
447
  "mcpServers": {
445
448
  "priors": {
446
449
  "command": "npx",
447
- "args": ["-y", "@priors/mcp@0.19.0"],
450
+ "args": ["-y", "@priors/mcp@0.19.1"],
448
451
  "env": {
449
452
  "PRIORS_KEY": "${PRIORS_KEY}",
450
453
  "PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
@@ -457,7 +460,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
457
460
  or, for your user only, from a macOS or Linux terminal:
458
461
 
459
462
  ```sh
460
- (read -rs PRIORS_KEY && umask 077 && mkdir -p ~/.config/priors && rm -f ~/.config/priors/agent.key && printf '%s\n' "$PRIORS_KEY" > ~/.config/priors/agent.key) && claude mcp add priors --scope user -- sh -c 'read -r PRIORS_KEY < "$1" && export PRIORS_KEY && exec npx -y @priors/mcp@0.19.0' priors-mcp ~/.config/priors/agent.key
463
+ (read -rs PRIORS_KEY && umask 077 && mkdir -p ~/.config/priors && rm -f ~/.config/priors/agent.key && printf '%s\n' "$PRIORS_KEY" > ~/.config/priors/agent.key) && claude mcp add priors --scope user -- sh -c 'read -r PRIORS_KEY < "$1" && export PRIORS_KEY && exec npx -y @priors/mcp@0.19.1' priors-mcp ~/.config/priors/agent.key
461
464
  ```
462
465
 
463
466
  It waits for the key without showing it (paste it, then Enter), saves it in a file only you can read, and gives Claude
@@ -538,7 +541,7 @@ to approve a borrow; this package, with the key, pays for APIs. With borrowing o
538
541
  approves each loan in Priors' Go mode. ElizaOS (`@elizaos/plugin-mcp`):
539
542
 
540
543
  ```ts
541
- "priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.19.0"],
544
+ "priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.19.1"],
542
545
  env: { PRIORS_KEY_FILE: "/home/agent/.config/priors/agent-7311.key", PRIORS_AGENT_ID: "7311",
543
546
  PRIORS_MAX_BORROW_USD: "0", PRIORS_MAX_BORROW_DAY_USD: "0", PRIORS_MAX_SPEND_DAY_USD: "1", PRIORS_MAX_PRICE_USD: "0.10",
544
547
  PRIORS_PAY_HOSTS: "api.example.com" } }
@@ -550,7 +553,7 @@ OpenClaw (`mcp.servers`, JSON5) takes the same `command`, `args` and `env`; Herm
550
553
  mcp_servers:
551
554
  priors-wallet:
552
555
  command: npx
553
- args: ["-y", "@priors/mcp@0.19.0"]
556
+ args: ["-y", "@priors/mcp@0.19.1"]
554
557
  env:
555
558
  PRIORS_KEY_FILE: /home/agent/.config/priors/agent-7311.key
556
559
  PRIORS_AGENT_ID: "7311"
@@ -577,7 +580,7 @@ key proves it is there: it signs the ERC-8004 identity registry's `AgentWalletSe
577
580
  agent's).
578
581
 
579
582
  ```sh
580
- PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.19.0 link-wallet --agent 7311
583
+ PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.19.1 link-wallet --agent 7311
581
584
  ```
582
585
 
583
586
  It reads the registry's EIP-712 domain and refuses to sign for any other, takes the owner from the chain (`--owner`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@priors/mcp",
3
3
  "mcpName": "io.github.priors-agents/priors",
4
- "version": "0.19.0",
4
+ "version": "0.19.1",
5
5
  "private": false,
6
6
  "description": "MCP server for Priors on Robinhood Chain: pay x402 URLs in USDG, read balances, credit lines and scores, borrow and repay, and buy, sell and redeem PT-USDG. Key from PRIORS_KEY_FILE (a file only you can read) or PRIORS_KEY, never the command line.",
7
7
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@modelcontextprotocol/sdk": "^1.30.1",
48
- "@priors/x402": "0.8.8",
48
+ "@priors/x402": "0.8.9",
49
49
  "ethers": "^6.13.4",
50
50
  "undici": "6.29.1",
51
51
  "viem": "^2.56.9",
package/src/server.mjs CHANGED
@@ -1141,11 +1141,26 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
1141
1141
  */
1142
1142
  async function needController(id, did = "done") {
1143
1143
  if (!(await credit.isController(id, wallet.address))) throw new ToolError(`This wallet (${wallet.address}) does not control agent #${id} on the pool (it is neither the owner nor its delegate).`);
1144
+ await needActsFor(id, did);
1145
+ }
1146
+ /** The wallet is agent `id`'s current owner or its declared ERC-8004 wallet: needController's proof, on its own. */
1147
+ async function needActsFor(id, did = "done", named = "the pool lets an owner name any address its delegate") {
1144
1148
  const me = wallet.address.toLowerCase();
1145
1149
  const holder = String(await credit.agentOwner(id));
1146
1150
  if (holder.toLowerCase() === me) return;
1147
1151
  if (String(await credit.agentWallet(id)).toLowerCase() === me) return;
1148
- throw new ToolError(`This wallet (${wallet.address}) is neither agent #${id}'s owner (${holder}) nor its declared ERC-8004 wallet, so nothing shows it acts for that owner: the pool lets an owner name any address its delegate. Nothing was ${did}. If this is the agent's own key, declare it as the agent's wallet (\`priors-mcp link-wallet\`, then its owner sends the registry's setAgentWallet), or act from the owner's key.`);
1152
+ throw new ToolError(`This wallet (${wallet.address}) is neither agent #${id}'s owner (${holder}) nor its declared ERC-8004 wallet, so nothing shows it acts for that owner: ${named}. Nothing was ${did}. If this is the agent's own key, declare it as the agent's wallet (\`priors-mcp link-wallet\`, then its owner sends the registry's setAgentWallet), or act from the owner's key.`);
1153
+ }
1154
+ /**
1155
+ * Before this wallet's USDG repays agent `id`'s loans, or its allowance goes to Autopay: needController, except that
1156
+ * the agent's declared ERC-8004 wallet needs no control at the pool. The pool has one delegate per agent, and once
1157
+ * the owner names LineKey (the spending key, docs/LINE-KEY.md) its delegate, the agent's own key controls nothing
1158
+ * there, while repaying stays its job (AutoRepayV2's wallet plan asks the declared wallet only). GHSA-45h8-v5q8-4j43.
1159
+ */
1160
+ async function needPayer(id, did = "done") {
1161
+ if (String(await credit.agentWallet(id)).toLowerCase() === wallet.address.toLowerCase()) return;
1162
+ if (!(await credit.isController(id, wallet.address))) throw new ToolError(`This wallet (${wallet.address}) does not control agent #${id} on the pool (it is neither the owner nor its delegate), and is not its declared ERC-8004 wallet.`);
1163
+ await needActsFor(id, did);
1149
1164
  }
1150
1165
 
1151
1166
  // Every answer as the model gets it (fence.mjs guarded): the third-party strings it quotes outside the server's own
@@ -1780,10 +1795,11 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
1780
1795
  needWallet("repay");
1781
1796
  const pre = [];
1782
1797
  if ((loan_id === undefined) === (all !== true)) throw new ToolError("Give exactly one of loan_id or all: true.");
1783
- // Only the loans of an agent this wallet controls: the pool lets anyone repay any loan, and this wallet's USDG is
1784
- // not for others. PRIORS_AGENT_ID alone is not proof: a stale or mistyped id would point at someone else's agent.
1798
+ // Only the loans of an agent this wallet acts for (its owner, or its declared ERC-8004 wallet whether or not the pool
1799
+ // names it the delegate: needPayer): the pool lets anyone repay any loan, and this wallet's USDG is not for others.
1800
+ // PRIORS_AGENT_ID alone is not proof: a stale or mistyped id would point at someone else's agent.
1785
1801
  const id = await resolveAgent();
1786
- await needController(id, "paid");
1802
+ await needPayer(id, "paid");
1787
1803
  // Only loans the agent's current owner took: one opened while someone else held the agent is theirs (the pool marks
1788
1804
  // them if it defaults), and an identity that changed hands can arrive carrying it (GHSA-mmp8).
1789
1805
  const holder = String(await credit.agentOwner(id)).toLowerCase();
@@ -1986,7 +2002,7 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
1986
2002
  needWallet("autopay_on");
1987
2003
  const ap = needAutopay();
1988
2004
  const id = await resolveAgent();
1989
- await needController(id, "sent"); // autopay_on approves an allowance: the same rule
2005
+ await needPayer(id, "sent"); // autopay_on approves an allowance: repay's rule
1990
2006
  let cap = cap_usd !== undefined ? dollars(cap_usd, "cap_usd") : null;
1991
2007
  if (cap === null) { const st = await credit.status(id); cap = A.defaultCap(st.line, maxAutopayCap); }
1992
2008
  if (cap === 0n) throw new ToolError("cap_usd must be above zero");
@@ -2409,8 +2425,10 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
2409
2425
  // refusals as codes, the payment's call and the key's state read back are ./line-key-core.cjs (web/line-key-core.js
2410
2426
  // byte for byte: what Go mode's Spending key uses).
2411
2427
  // line_key_status reads the key, no wallet needed: its state (the core's view()), terms, payees, window and room.
2412
- // line_key_spend pays from this wallet, which must be the key's operator. Refused before anything is signed: no
2413
- // wallet; a bad payee or ref; an amount of 0, over PRIORS_MAX_BORROW_USD, under the pool's smallest loan or over its
2428
+ // line_key_spend pays from this wallet, which must be the key's operator and the agent's owner or declared ERC-8004
2429
+ // wallet (needActsFor: the owner names an operator with no word from it). Refused before anything is signed: no
2430
+ // wallet; neither the agent's owner nor its declared wallet; a bad payee or ref; an amount of 0, over
2431
+ // PRIORS_MAX_BORROW_USD, under the pool's smallest loan or over its
2414
2432
  // largest (getParams, read now); the key's check() other than ok, in words; the line's refusal in a simulation of the
2415
2433
  // spend from this wallet (the core's refusal(): the key's Refused, or the pool's own error inside LineRefused); too
2416
2434
  // little ETH for the gas. Then ONE transaction to LineKey, its gas limit the core's STAGE.spendGas, simulated again
@@ -2463,17 +2481,19 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
2463
2481
  const me = wallet ? wallet.address : null;
2464
2482
  let r;
2465
2483
  try {
2466
- const [[key], [list], spent, [room], [active], owner, [delegate], [pp], latest] = await Promise.all([
2484
+ const [[key], [list], spent, [room], [active], owner, [delegate], [pp], latest, declared] = await Promise.all([
2467
2485
  kc(LINE_KEY, "keyOf", [id]), kc(LINE_KEY, "payeesOf", [id]), kc(LINE_KEY, "spentInPeriod", [id, ethers.ZeroAddress]), kc(LINE_KEY, "remaining", [id]), kc(LINE_KEY, "isActive", [id]),
2468
2486
  // a registry that gives no owner (an id never minted): a key pays nothing then (LineKey fails closed)
2469
- kc(REGISTRY, "ownerOf", [id]).then(([o]) => o, () => null), kc(POOL, "delegateOf", [id]), kc(POOL, "getParams"), withinTime(provider.getBlock("latest"), requestTimeoutMs)]);
2487
+ kc(REGISTRY, "ownerOf", [id]).then(([o]) => o, () => null), kc(POOL, "delegateOf", [id]), kc(POOL, "getParams"), withinTime(provider.getBlock("latest"), requestTimeoutMs),
2488
+ // the agent's declared ERC-8004 wallet, for whether line_key_spend pays from this one (needActsFor); null unread
2489
+ me ? Promise.resolve().then(() => credit.agentWallet(id)).then(String, () => null) : null]);
2470
2490
  const v = LK.view({ key, owner, delegate, payees: list, spent, remaining: room, active, conf, now: Number(latest.timestamp) });
2471
2491
  // each payee: what the key's rules let it be paid now, and what it was paid in the window
2472
2492
  const per = v.state === "none" ? [] : await Promise.all(v.payees.map(async (p) => {
2473
2493
  const [[max], s] = await Promise.all([kc(LINE_KEY, "maxPayment", [id, p.payee]), kc(LINE_KEY, "spentInPeriod", [id, p.payee])]);
2474
2494
  return { ...p, max, spent: s[0], payments: Number(s[1]) };
2475
2495
  }));
2476
- r = { v, owner, per, minLoan: pp.minLoan, maxLoan: pp.maxLoan };
2496
+ r = { v, owner, declared, per, minLoan: pp.minLoan, maxLoan: pp.maxLoan };
2477
2497
  } catch (e) { throw new ToolError(`agent #${id}'s spending key could not be read from the chain just now (${explain(e)}): try again in a minute.`); }
2478
2498
  const { v } = r;
2479
2499
  if (v.state === "none") return `Agent #${id} has no spending key (LineKey ${LINE_KEY}): nothing can be paid through one. ${SETUP}: it names the key the line's delegate and sets its operator, caps and payees.${v.delegateIsKey ? " The pool already names LineKey the line's delegate." : ""}`;
@@ -2484,7 +2504,9 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
2484
2504
  expired: `expired on ${when(t.expiresAt)}: the key pays nothing until its owner sets a later expiry.`,
2485
2505
  "not-delegate": `not the line's delegate: the pool names ${noAddr(v.delegate) ? "no delegate" : v.delegate} as agent #${id}'s delegate, so the key pays nothing until its owner names it the delegate again (Spending key, in Go mode's agent panel).`,
2486
2506
  }[v.state];
2487
- const who = !me ? " (this server has no wallet configured: line_key_spend pays only from the operator's)" : sameAddr(t.operator, me) ? " (this server's wallet: line_key_spend pays from it)" : ` (not this server's wallet, ${me}: line_key_spend pays only from the operator's)`;
2507
+ // an operator that is neither the agent's owner nor its declared wallet: line_key_spend refuses it (needActsFor)
2508
+ const stranger = me && r.declared !== null && r.owner && !sameAddr(r.owner, me) && !sameAddr(r.declared, me);
2509
+ const who = !me ? " (this server has no wallet configured: line_key_spend pays only from the operator's)" : sameAddr(t.operator, me) ? (stranger ? ` (this server's wallet, but neither agent #${id}'s owner nor its declared ERC-8004 wallet, so line_key_spend does not pay from it: if it is the agent's own key, its owner declares it as the agent's wallet, \`priors-mcp link-wallet\`)` : " (this server's wallet: line_key_spend pays from it)") : ` (not this server's wallet, ${me}: line_key_spend pays only from the operator's)`;
2488
2510
  return [
2489
2511
  `Agent #${id}'s spending key (LineKey ${LINE_KEY}, generation ${v.generation}, set by ${v.owner}): ${head}`,
2490
2512
  `Operator: ${t.operator}${who}.`,
@@ -2594,6 +2616,10 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
2594
2616
  if (!dry_run) count("borrowed", units); // until this call ends (GHSA-cq9v)
2595
2617
  try {
2596
2618
  const id = await resolveAgent(agent_id);
2619
+ // the operator alone is no proof this wallet acts for the agent's owner: configure names any address with no
2620
+ // word from it, as setDelegate does (GHSA-9pw7). Payments for an agent it is neither the owner nor the declared
2621
+ // ERC-8004 wallet of would spend its gas and its borrowing limits on a stranger's line (GHSA-45h8-v5q8-4j43).
2622
+ await needActsFor(id, "signed or sent", "the agent's owner names its spending key's operator with no word from that address");
2597
2623
  const me = signer.address;
2598
2624
  let pp, reason, key;
2599
2625
  try {