@sparkysolutions/agentrail 0.1.0 → 0.1.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 (113) hide show
  1. package/README.md +249 -146
  2. package/dist/cli/mcp-stdio.d.ts +8 -0
  3. package/dist/cli/mcp-stdio.js +454 -0
  4. package/dist/cli/pipeline.d.ts +40 -0
  5. package/dist/cli/pipeline.js +114 -0
  6. package/dist/cli/sandbox.d.ts +15 -1
  7. package/dist/cli/sandbox.js +30 -5
  8. package/dist/index.d.ts +13 -0
  9. package/dist/index.js +13 -0
  10. package/dist/lib/agent-badge-issuer.d.ts +36 -0
  11. package/dist/lib/agent-badge-issuer.js +166 -0
  12. package/dist/lib/agent-registry.d.ts +136 -0
  13. package/dist/lib/agent-registry.js +124 -0
  14. package/dist/lib/agenthustle-pipeline.d.ts +68 -0
  15. package/dist/lib/agenthustle-pipeline.js +143 -0
  16. package/dist/lib/agentpass-pipeline.d.ts +44 -0
  17. package/dist/lib/agentpass-pipeline.js +84 -0
  18. package/dist/lib/audit-trail-provider.d.ts +24 -0
  19. package/dist/lib/audit-trail-provider.js +60 -0
  20. package/dist/lib/axis-clob-provider.d.ts +50 -0
  21. package/dist/lib/axis-clob-provider.js +150 -0
  22. package/dist/lib/circuit-breaker.d.ts +60 -0
  23. package/dist/lib/circuit-breaker.js +136 -0
  24. package/dist/lib/conditional-escrow.d.ts +42 -0
  25. package/dist/lib/conditional-escrow.js +126 -0
  26. package/dist/lib/mcp-server.d.ts +29 -0
  27. package/dist/lib/mcp-server.js +165 -0
  28. package/dist/lib/receipts.d.ts +153 -0
  29. package/dist/lib/receipts.js +173 -0
  30. package/dist/lib/reflector-oracle-adapter.d.ts +44 -0
  31. package/dist/lib/reflector-oracle-adapter.js +173 -0
  32. package/dist/lib/scoped-allowance.d.ts +4 -0
  33. package/dist/lib/scoped-allowance.js +22 -1
  34. package/dist/lib/universal-adapters.d.ts +42 -0
  35. package/dist/lib/universal-adapters.js +69 -0
  36. package/dist/lib/x402-gateway.d.ts +86 -0
  37. package/dist/lib/x402-gateway.js +128 -0
  38. package/dist/lib/x402-pipeline.d.ts +51 -0
  39. package/dist/lib/x402-pipeline.js +105 -0
  40. package/dist/types.d.ts +109 -0
  41. package/glama.json +12 -0
  42. package/package.json +56 -40
  43. package/smithery.json +43 -0
  44. package/smithery.yaml +29 -0
  45. package/.github/ISSUE_TEMPLATE/drips_wave_task.md +0 -33
  46. package/.github/workflows/auto-merge.yml +0 -119
  47. package/.github/workflows/ci.yml +0 -35
  48. package/BENCHMARKS.md +0 -67
  49. package/CONTRIBUTING.md +0 -40
  50. package/DRIPS_WAVE.md +0 -81
  51. package/FUNDING.json +0 -7
  52. package/ISSUES_PIPELINE.json +0 -106
  53. package/RUNBOOK.md +0 -95
  54. package/SCF_ACTIVATION_PROPOSAL.md +0 -137
  55. package/assets/sorobanagents_avatar.jpg +0 -0
  56. package/assets/sorobanagents_avatar.png +0 -0
  57. package/assets/sorobanagents_avatar_elite.png +0 -0
  58. package/contracts/agentrail/Cargo.lock +0 -1895
  59. package/contracts/agentrail/Cargo.toml +0 -25
  60. package/contracts/agentrail/src/lib.rs +0 -296
  61. package/contracts/agentrail/src/test.rs +0 -442
  62. package/contracts/agentrail/test_snapshots/test/test_circuit_breaker_pause_and_unpause.1.json +0 -195
  63. package/contracts/agentrail/test_snapshots/test/test_double_initialize_fails.1.json +0 -123
  64. package/contracts/agentrail/test_snapshots/test/test_execute_spend_deducts_and_accumulates.1.json +0 -347
  65. package/contracts/agentrail/test_snapshots/test/test_get_allowance_returns_none_for_unregistered.1.json +0 -61
  66. package/contracts/agentrail/test_snapshots/test/test_get_version_matches_cargo_toml.1.json +0 -61
  67. package/contracts/agentrail/test_snapshots/test/test_grant_allowance_negative_amount_fails.1.json +0 -123
  68. package/contracts/agentrail/test_snapshots/test/test_grant_allowance_success.1.json +0 -250
  69. package/contracts/agentrail/test_snapshots/test/test_grant_allowance_zero_amount_fails.1.json +0 -123
  70. package/contracts/agentrail/test_snapshots/test/test_initialize_and_protocol_fee.1.json +0 -154
  71. package/contracts/agentrail/test_snapshots/test/test_initialize_success.1.json +0 -124
  72. package/contracts/agentrail/test_snapshots/test/test_initialize_with_excessive_fee_fails.1.json +0 -61
  73. package/contracts/agentrail/test_snapshots/test/test_max_protocol_fee_spend_boundary.1.json +0 -298
  74. package/contracts/agentrail/test_snapshots/test/test_multi_agent_allowance_isolation.1.json +0 -426
  75. package/contracts/agentrail/test_snapshots/test/test_multi_owner_isolation.1.json +0 -426
  76. package/contracts/agentrail/test_snapshots/test/test_regrant_allowance_updates_limits.1.json +0 -346
  77. package/contracts/agentrail/test_snapshots/test/test_revoke_allowance_freezes_spending.1.json +0 -292
  78. package/contracts/agentrail/test_snapshots/test/test_set_protocol_fee_by_admin.1.json +0 -165
  79. package/contracts/agentrail/test_snapshots/test/test_spend_after_expiry_fails.1.json +0 -250
  80. package/contracts/agentrail/test_snapshots/test/test_spend_exact_allowance_boundary.1.json +0 -298
  81. package/contracts/agentrail/test_snapshots/test/test_spend_exceeding_allowance_fails.1.json +0 -250
  82. package/contracts/agentrail/test_snapshots/test/test_spend_fails_when_circuit_breaker_tripped.1.json +0 -285
  83. package/contracts/agentrail/test_snapshots/test/test_spend_negative_amount_fails.1.json +0 -250
  84. package/contracts/agentrail/test_snapshots/test/test_spend_non_existent_allowance_fails.1.json +0 -123
  85. package/contracts/agentrail/test_snapshots/test/test_spend_on_revoked_allowance_fails.1.json +0 -292
  86. package/contracts/agentrail/test_snapshots/test/test_spend_with_protocol_fee.1.json +0 -286
  87. package/contracts/agentrail/test_snapshots/test/test_spend_zero_amount_fails.1.json +0 -250
  88. package/contracts/agentrail/test_snapshots/test/test_unpause_restores_spend_operations.1.json +0 -370
  89. package/contracts/agentrail/test_snapshots/test/test_zero_protocol_fee_spend.1.json +0 -298
  90. package/deployment.testnet.json +0 -15
  91. package/docs/assets/favicon.png +0 -0
  92. package/docs/assets/logo.png +0 -0
  93. package/docs/index.html +0 -840
  94. package/scripts/demo-agent.ts +0 -52
  95. package/scripts/deploy-testnet.ts +0 -228
  96. package/scripts/security-audit.mjs +0 -159
  97. package/src/cli/sandbox.ts +0 -127
  98. package/src/index.ts +0 -11
  99. package/src/lib/micro-stream.ts +0 -52
  100. package/src/lib/proof-of-task.ts +0 -39
  101. package/src/lib/scoped-allowance.ts +0 -112
  102. package/src/lib/ttl-keeper.ts +0 -44
  103. package/src/sdk/agent-client.ts +0 -66
  104. package/src/types.ts +0 -78
  105. package/tests/agent-client.test.ts +0 -62
  106. package/tests/cli.test.ts +0 -68
  107. package/tests/micro-stream.test.ts +0 -38
  108. package/tests/proof-of-task.test.ts +0 -78
  109. package/tests/scoped-allowance.test.ts +0 -135
  110. package/tests/security-audit.test.ts +0 -76
  111. package/tests/ttl-keeper.test.ts +0 -36
  112. package/tsconfig.json +0 -16
  113. package/vitest.config.ts +0 -8
@@ -1,137 +0,0 @@
1
- # Stellar Community Fund (SCF) — Activation Award Proposal 🛰️
2
-
3
- ## Project Overview
4
-
5
- - **Project Name:** AgentRail
6
- - **Tagline:** Autonomous AI Agent Scoped-Allowance & Micro-Settlement Protocol on Soroban
7
- - **Organization / Repository:** [SorobanAgents/agentrail](https://github.com/SorobanAgents/agentrail)
8
- - **Live Testnet Contract:** [`CBSWWN2CLUPW4VLYTGVJTT4XWXKF6LLJFQXEC7KK2KTAW3A26WIBZIN6`](https://stellar.expert/explorer/testnet/contract/CBSWWN2CLUPW4VLYTGVJTT4XWXKF6LLJFQXEC7KK2KTAW3A26WIBZIN6)
9
- - **Interactive Web Simulator:** [https://sorobanagents.github.io/agentrail/](https://sorobanagents.github.io/agentrail/)
10
- - **Track:** Activation Award ($15,000 in USDC / XLM)
11
- - **Duration:** 60 Days (2 Milestones)
12
- - **Applicant:** Mukesh Biswas (`sparkysolutions10-pixel` / Sparky Solutions)
13
- - **Discord Handle:** `mukesh_sparky` (Stellar Devs Discord: `#scf-general`)
14
-
15
- ---
16
-
17
- ## 1. Executive Summary & Problem Statement
18
-
19
- As autonomous AI agents (powered by LLM frameworks such as ElizaOS, LangChain, AutoGen, and CrewAI) transition from passive text chatbots into active economic actors, they urgently require the ability to conduct **sub-cent, programmatic micropayments** to purchase data, pay for model inference, trigger compute jobs, and contract peer agents.
20
-
21
- However, traditional Web3 infrastructure presents critical security and economic roadblocks for autonomous agents:
22
-
23
- 1. **Root Key Custody Vulnerability:** Granting an autonomous agent root custody of a private key (`S...`) exposes the entire treasury. A single prompt injection attack, hallucination, or logic flaw can result in total balance drainage.
24
- 2. **Interactive Wallet Prompts Break Autonomy:** Standard Web3 browser extensions (e.g. Freighter, MetaMask) rely on interactive user confirmation popups. Fully autonomous, 24/7 background agents cannot click human confirmation modals.
25
- 3. **Prohibitive Transaction Fees on Other L1s:** Gas fees on Ethereum ($2–$10) or network congestion on other networks make streaming $0.0005 per-query micro-settlements economically infeasible.
26
- 4. **Soroban State Archival Hazards:** Smart contract state on Soroban requires active Time-to-Live (TTL) rent management. Without automated TTL bumping, an agent's allowance state risks archival freeze during critical execution windows.
27
-
28
- ---
29
-
30
- ## 2. The Solution: Why Stellar & Soroban?
31
-
32
- **AgentRail** solves these challenges by establishing an autonomous economic layer natively on Soroban:
33
-
34
- - **Cryptographic Scoped Allowances:** Human treasury managers or smart contracts provision time-bounded, maximum-spend allowances to ephemeral agent session keys. Agents can autonomously sign micro-transactions without ever touching master private keys.
35
- - **Strict Budget & Velocity Caps:** Allowances enforce maximum cumulative spend limits, epoch time windows (validFrom / validUntil), and explicit destination whitelist filters directly inside Soroban contract storage.
36
- - **Circuit Breaker Emergency Freeze:** If an agent encounters anomalous behavior, the allowance owner can instantly pause spending with single-transaction finality.
37
- - **Why Stellar?**
38
- - **Sub-Second Finality (3-5s):** Enables real-time pay-as-you-go inference streams.
39
- - **Fraction-of-a-Cent Fees (~0.00001 XLM):** Makes sub-cent machine-to-machine micro-settlements economically viable.
40
- - **Predictable State Rent Model:** Soroban's TTL architecture allows AgentRail to implement automated rent extension keepers.
41
- - **Native USDC Liquidity:** Direct settlement in Circle USDC on Stellar without fragile cross-chain bridges.
42
-
43
- ---
44
-
45
- ## 3. Current Progress & Proof of Execution
46
-
47
- AgentRail is **NOT** a theoretical concept. Prior to requesting grant funding, we have already developed, tested, and deployed a fully working testnet prototype:
48
-
49
- - **Soroban Smart Contract (Rust):**
50
- - Compiled and optimized to **20.7 KB wasm** (`wasm32v1-none`).
51
- - **27 automated Rust contract unit tests** covering allowance provisioning, balance deduction, epoch validation, unauthorized signer rejection, circuit breaker pause/unpause, 20 bps protocol fee routing, and TTL rent bumping.
52
- - **100% test pass rate** (`cargo test` -> 27 passed, 0 failed).
53
- - **TypeScript SDK:**
54
- - Written in strict TypeScript with comprehensive type safety.
55
- - **29 automated tests** via Vitest covering client allowance registration, spend authorization, velocity limits, and error handling.
56
- - **Live Stellar Testnet Deployment:**
57
- - Contract ID: [`CBSWWN2CLUPW4VLYTGVJTT4XWXKF6LLJFQXEC7KK2KTAW3A26WIBZIN6`](https://stellar.expert/explorer/testnet/contract/CBSWWN2CLUPW4VLYTGVJTT4XWXKF6LLJFQXEC7KK2KTAW3A26WIBZIN6)
58
- - Deployer: `GDQZK73NVQCDJTTUMOOLF7IZ55IY4GS2TF6SNE7P7DVJ7XWICYAGJJA5`
59
- - Treasury: `GDDJH64X5VEXI7UWZMJA3YUG7ANYHKRRRFHLD2SF5OWEETNFBVYMRXZT`
60
- - Protocol Fee: 20 bps (0.20% routed automatically to treasury).
61
- - **Interactive Web Simulator Dashboard:**
62
- - Deployed at [`https://sorobanagents.github.io/agentrail/`](https://sorobanagents.github.io/agentrail/)
63
- - Features real-time Freighter testnet wallet connection, interactive allowance vault creation, emergency pause toggle, real-time micro-spend triggers, 10x swarm burst simulation, and live Soroban event logging.
64
-
65
- ---
66
-
67
- ## 4. Architecture & Technical Design
68
-
69
- ```
70
- +--------------------------------------------------------------------------+
71
- | HUMAN TREASURY / DAPP |
72
- | - Holds Master Account (GDQZ...JJA5) |
73
- | - Provisions Scoped Allowance via Soroban Contract |
74
- +-------------------------------------+------------------------------------+
75
- |
76
- v
77
- +--------------------------------------------------------------------------+
78
- | AGENTRAIL SOROBAN SMART CONTRACT |
79
- | (CBSWWN2CLUPW4VLYTGVJTT4XWXKF6LLJF...) |
80
- | - Allowance Vault: (Owner, AgentSessionKey, MaxStroops, Spent, Epoch) |
81
- | - Security: Only designated agent key can spend within active epoch |
82
- | - Circuit Breaker: Emergency pause flag disables unauthorized drains |
83
- | - Fee Engine: 20 bps split (99.8% to Service, 0.2% to Protocol Treasury)|
84
- | - TTL Keeper: Automated ledger extension prevents state archival |
85
- +-------------------+-----------------------------------+------------------+
86
- | |
87
- v v
88
- +--------------------------------------+ +--------------------------------+
89
- | AUTONOMOUS AI AGENT | | API / SERVICE HOST |
90
- | - Holds ephemeral session key | | - Receives micro-settlement |
91
- | - Autonomous spend(allowance_id, | | - Delivers inference / data |
92
- | amount, destination) | | output without human 2FA |
93
- +--------------------------------------+ +--------------------------------+
94
- ```
95
-
96
- ---
97
-
98
- ## 5. Milestones & Deliverables
99
-
100
- ### Milestone 1: Core Protocol Hardening, Testnet Validation & Live Visualizer (Month 1 — $7,500)
101
- - **Status:** Complete & Ready for Verification
102
- - **Deliverables:**
103
- 1. **Rust Soroban Core Contract:** Finalized smart contract implementing scoped allowances, epoch time boundaries, cumulative spend tracking, 20 bps protocol fee split, and emergency circuit breaker.
104
- 2. **Comprehensive Test Suite:** 27 Rust unit tests and 29 TypeScript SDK tests verifying all security boundaries, reentrancy guards, and error codes.
105
- 3. **Stellar Testnet Deployment:** Live verified contract deployed and initialized on Stellar Testnet (`CBSWWN2...`).
106
- 4. **Interactive Web Simulator:** Live browser visualizer on GitHub Pages allowing anyone in the Stellar community to connect Freighter, create an allowance, test micro-spends, and inspect contract events.
107
- 5. **Open Source Documentation & CI:** Complete setup documentation, test instructions, and GitHub Actions CI workflow running on every commit.
108
-
109
- ### Milestone 2: AI Agent Framework Adapters & Developer Onboarding (Month 2 — $7,500)
110
- - **Status:** In Progress
111
- - **Deliverables:**
112
- 1. **Official npm SDK Package:** Publish `@soroban-agents/agentrail` to npm with full TypeScript definitions, ESM/CJS dual-build, and zero-config RPC clients.
113
- 2. **ElizaOS & LangChain Plugin Adapters:** Ready-to-use tool definitions allowing AI agent developers to plug Stellar micro-payments into ElizaOS or LangChain agents with 3 lines of code.
114
- 3. **Automated Soroban TTL Keeper Daemon:** A lightweight background worker utility that monitors active agent allowances and automatically triggers ledger rent bumping.
115
- 4. **SEP-10 Session Authentication Guide:** Reference implementation showing how web services can verify agent identity and allowance proofs via Stellar SEP-10.
116
- 5. **Public Video Walkthrough & Tutorial:** Step-by-step video demonstration showcasing an autonomous agent buying inference on Stellar Testnet with zero human intervention.
117
-
118
- ---
119
-
120
- ## 6. Budget Breakdown ($15,000 USD)
121
-
122
- | Item | Allocation | Description |
123
- | :--- | :--- | :--- |
124
- | **Smart Contract Engineering & Security Audit** | $5,000 | Soroban contract development, formal invariant testing, fuzzing, and gas optimization |
125
- | **Agent SDK & Framework Adapters** | $4,500 | TypeScript SDK, ElizaOS plugin, LangChain tool bindings, and npm package packaging |
126
- | **Frontend Visualizer & Tooling** | $3,000 | Interactive testnet simulator, Freighter wallet integration, and live event monitoring |
127
- | **Documentation, Video Tutorials & DevRel** | $2,500 | Developer quickstart guides, architecture runbooks, video tutorial, and community support |
128
- | **Total** | **$15,000** | Paid upon milestone delivery according to SCF Activation guidelines |
129
-
130
- ---
131
-
132
- ## 7. Community & Ecosystem Impact
133
-
134
- 1. **New Use Case on Stellar:** Positions Stellar and Soroban as the go-to layer for the burgeoning Autonomous Agent Economy.
135
- 2. **Developer Adoption:** Gives AI developers an out-of-the-box payment rail that eliminates the need to build custom wallet management logic.
136
- 3. **Transaction Volume:** Every autonomous agent query drives micro-transactions on the Stellar network, increasing on-chain ledger activity and utility.
137
- 4. **100% Open Source:** Licensed under MIT, built transparently under [SorobanAgents](https://github.com/SorobanAgents).
Binary file
Binary file