@agent402-dev/bond-seller-mcp 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/tools.js +6 -6
  2. package/package.json +1 -1
package/dist/tools.js CHANGED
@@ -15,9 +15,9 @@ export function serialRunner(b) {
15
15
  }
16
16
  export function createSellerServer(d, run = d.built ? serialRunner(d.built) : null) {
17
17
  const usdc = units(d.config.asset ?? 'USDC'); // amounts in the deal asset (USDC or PREQ)
18
- const server = new McpServer({ name: 'agent402-bond-seller', version: '0.3.0' });
18
+ const server = new McpServer({ name: 'agent402-bond-seller', version: '0.3.1' });
19
19
  const off = () => out({ result: 'not_configured', problems: d.config.problems }, true);
20
- server.tool('sell_status', 'Show this seller: wallet address, the job terms it sells (Agent402 Bond, USDC or PREQ), how buyers reach it, balances and job counts. Read-only.', {}, async () => {
20
+ server.tool('sell_status', 'Show this seller: wallet address, the job terms it sells (Agent402 Bond, USDC or PREQ), how buyers reach it, balances and job counts. Read-only; takes no input. Returns configured: false with the list of problems when the seller is not set up yet. Call it first; then use sell_jobs to see work waiting for you.', {}, async () => {
21
21
  if (!d.built)
22
22
  return out({ configured: false, problems: d.config.problems });
23
23
  const b = d.built;
@@ -55,7 +55,7 @@ export function createSellerServer(d, run = d.built ? serialRunner(d.built) : nu
55
55
  limits: { maxPending: d.config.maxPending, maxPendingPerBuyer: d.config.maxPendingPerBuyer, maxUnconfirmedPerBuyer: d.config.maxUnconfirmedPerBuyer, buyerAllowlist: d.config.buyers },
56
56
  });
57
57
  });
58
- server.tool('sell_prepare', 'Prepare a deal for a buyer who asked for the job by another channel (chat, email, another agent). Returns the open transaction, already signed by this seller, for the buyer to verify and sign (pay-mcp bond_open). The seller bond leaves this wallet only if the buyer sends it.', { buyer: z.string().describe('Buyer wallet address'), input: z.string().min(1).max(16_384).describe('What the buyer asks for (stored with the deal)') }, async ({ buyer, input }) => {
58
+ server.tool('sell_prepare', 'Prepare a deal for a buyer who asked for the job by another channel (chat, email, another agent). Returns the open transaction, already signed by this seller, for the buyer to verify and sign (pay-mcp bond_open). The seller bond leaves this wallet only if the buyer sends it. Returns result "prepared" with the transaction, or "refused" (an error) with the reason (for example limits reached or buyer not allowed). Buyers using the HTTP endpoint do not need this tool.', { buyer: z.string().describe('Buyer wallet address (base58)'), input: z.string().min(1).max(16_384).describe('What the buyer asks for, as text (at most 16,384 characters; stored with the deal and its hash recorded)') }, async ({ buyer, input }) => {
59
59
  if (!d.built)
60
60
  return off();
61
61
  const res = (await d.built.service.handle(new Request('http://seller.local/open', { method: 'POST', body: JSON.stringify({ buyer, input }) })));
@@ -67,7 +67,7 @@ export function createSellerServer(d, run = d.built ? serialRunner(d.built) : nu
67
67
  next: 'Send `transaction` to the buyer. The buyer checks it and signs (for example with pay-mcp bond_open). The deal exists once that lands; if it does not land within about 10 minutes the preparation expires. Then call sell_jobs.',
68
68
  });
69
69
  });
70
- server.tool('sell_jobs', 'Check the chain and run the seller loop (mark finished work, give up on jobs close to their deadline, settle and claim finished deals), then list the jobs waiting for you to do the work. Call it regularly; a background timer also runs the loop while this server is running.', {}, async () => {
70
+ server.tool('sell_jobs', 'Check the chain and run the seller loop (mark finished work, give up on jobs close to their deadline, settle and claim finished deals), then list the jobs waiting for you to do the work. Call it regularly; a background timer also runs the loop while this server is running. Takes no input. Returns the loop steps and the jobs to do (deal, buyer, price, input, deadlines; a job is declined automatically 30 minutes before its mark deadline). Hand in each result with sell_submit, or give up with sell_decline.', {}, async () => {
71
71
  if (!d.built || !run)
72
72
  return off();
73
73
  const steps = await run();
@@ -104,7 +104,7 @@ export function createSellerServer(d, run = d.built ? serialRunner(d.built) : nu
104
104
  loop: steps,
105
105
  });
106
106
  });
107
- server.tool('sell_submit', 'Hand in the result of a job from sell_jobs. Stores it and marks delivery on chain (this wallet pays the network fee). A buyer using the HTTP endpoint fetches it there; otherwise pass the result to the buyer yourself.', { deal: z.string(), result: z.string().min(1).max(200_000).describe('The work, as text (JSON text is fine)') }, async ({ deal, result }) => {
107
+ server.tool('sell_submit', 'Hand in the result of a job from sell_jobs. Stores it and marks delivery on chain (this wallet pays the network fee). A buyer using the HTTP endpoint fetches it there; otherwise pass the result to the buyer yourself. Returns result "delivered" with the mark transaction; "refused" means nothing was marked (for example the deal is not yours or the deadline passed).', { deal: z.string().describe('Deal address (base58) from sell_jobs.'), result: z.string().min(1).max(200_000).describe('The work, as text (JSON text is fine; at most 200,000 characters). Its hash is what the buyer checks.') }, async ({ deal, result }) => {
108
108
  if (!d.built)
109
109
  return off();
110
110
  const r = await d.built.service.submit(deal, result);
@@ -112,7 +112,7 @@ export function createSellerServer(d, run = d.built ? serialRunner(d.built) : nu
112
112
  return out({ result: 'refused', httpStatus: r.status, error: r.error }, r.status !== 202);
113
113
  return out({ result: 'delivered', deal, markTx: r.markTx, next: 'The buyer checks the work and confirms (pays the balance) or not. Settlement runs on its own in sell_jobs and the timer.' });
114
114
  });
115
- server.tool('sell_decline', 'Give up on a job from sell_jobs (cannot be done, or should not be). Delivers a failure notice and marks delivery, so the deal ends neutral: your bond comes back and the buyer gets its deposit back.', { deal: z.string(), reason: z.string().max(300).optional() }, async ({ deal, reason }) => {
115
+ server.tool('sell_decline', 'Give up on a job from sell_jobs (cannot be done, or should not be). Delivers a failure notice and marks delivery, so the deal ends neutral: your bond comes back and the buyer gets its deposit back. Returns result "declined" with the mark transaction, or "refused" (an error). Use sell_submit instead when you have the work.', { deal: z.string().describe('Deal address (base58) from sell_jobs.'), reason: z.string().max(300).optional().describe('Short reason shown to the buyer (at most 300 characters).') }, async ({ deal, reason }) => {
116
116
  if (!d.built)
117
117
  return off();
118
118
  const r = await d.built.service.decline(deal, reason);
package/package.json CHANGED
@@ -27,7 +27,7 @@
27
27
  "zod": "^4.6.7",
28
28
  "tweetnacl": "^1.0.3"
29
29
  },
30
- "version": "0.3.0",
30
+ "version": "0.3.1",
31
31
  "author": "Agent402",
32
32
  "license": "Apache-2.0",
33
33
  "type": "module",