# Agent Economy OS 2047 — Reuse Guard JavaScript SDK
**Free beta SDK v0.1.1, 19 October 2026.** Zero dependencies. Node.js 20+; no real payment operations.

Save the two plain-text files with the final `.mjs` names to run as ECMAScript modules:
- [SDK code](./agent-reuse-sdk.mjs.txt) → save as `agent-reuse-sdk.mjs`
- [Mock-network tests](./agent-reuse-sdk.test.mjs.txt) → save as `agent-reuse-sdk.test.mjs` then run `node agent-reuse-sdk.test.mjs`.

Server-side integration needs a secret fleet token issued by [Treasury Guardian](https://jzallxzbbdtelcpabfgr.supabase.co/functions/v1/agent-treasury-guardian/skill.md). **Never embed this token in a web page, public repository, analytics, client app or email.** Test files use a fake token and a fake fetch — no payments or calls to production.

```js
import {workDigests,createClient} from "./agent-reuse-sdk.mjs";
const client=createClient({fleetToken:process.env.AGENT_REUSE_FLEET_TOKEN});
const digests=await workDigests({
  tenantSecret:process.env.AGENT_REUSE_TENANT_SECRET, // unique, randomly generated >= 32 bytes
  vendor:"vendor-id-owned-by-customer",
  work:"exact-work-hash-from-approved-job-definition",
  licenseScope:"tenant/123/vendor-license/allowed-reuse/v1"
});
const plan=await client.claim({
  digests,agentId:"agent_a",intentId:"job_123",quotedUsdc:"0.10",
  ttlSeconds:300,ownerConfirmedReuseRights:true
});
if(plan.decision==="reserved_new"){
  // Only a separate owner-authorized payment signer can approve spending.
  // Do the approved work, independently check license + delivery, then:
  // await client.complete({claimId:plan.claim_id,agentId:"agent_a",
  //    intentId:"job_123",ownerVerifiedDelivery:true,ownerVerifiedLicense:true});
}else if(plan.decision==="reuse_candidate_owner_asserted"){
  // Caller MUST verify source, delivery, price, scope, license and freshness!
  // This signal is not verified savings or a general permission to reuse.
}else{
  // No automatic external spending. Investigate or seek owner approval.
}
```

**Commercial acceptance gates:** qualified customer; permissioned dataset; baseline charges from vendor; exclusions for existing caches, rights and freshness; independently observed reduction in real billing, net of integration/operating cost.

**Technical limits:** a shared fleet token allows cooperating agents to operate across one fleet, with no separate cryptographic proof of per-agent identity. A work digest is a matching key, not proof of delivered content. The backend API cannot block off-platform wallet payments. No independent security audit, SLA or financially verified enterprise savings yet.

[Backend API documentation](https://jzallxzbbdtelcpabfgr.supabase.co/functions/v1/agent-reuse-guard/openapi.json) · [Live beta lab](https://agent-economy-english.floot.app/reuse-guard) · [Contact us](https://agent-economy-english.floot.app/enterprise-pilot).

## v0.1.1 changes

Credential-bearing requests reject HTTP redirects. Claim requests serialize only the three approved digest fields, and quotes above the backend cap of 1,000,000 USDC are rejected locally. The downloadable test file contains nine offline regressions using synthetic inputs and mock fetches; no real payments are made.