@sparkysolutions/agentrail 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +249 -3
- package/dist/cli/mcp-stdio.d.ts +8 -0
- package/dist/cli/mcp-stdio.js +454 -0
- package/dist/cli/pipeline.d.ts +40 -0
- package/dist/cli/pipeline.js +114 -0
- package/dist/cli/sandbox.d.ts +55 -0
- package/dist/cli/sandbox.js +107 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +39 -0
- package/dist/lib/agent-badge-issuer.d.ts +36 -0
- package/dist/lib/agent-badge-issuer.js +166 -0
- package/dist/lib/agent-registry.d.ts +136 -0
- package/dist/lib/agent-registry.js +124 -0
- package/dist/lib/agenthustle-pipeline.d.ts +68 -0
- package/dist/lib/agenthustle-pipeline.js +143 -0
- package/dist/lib/agentpass-pipeline.d.ts +44 -0
- package/dist/lib/agentpass-pipeline.js +84 -0
- package/dist/lib/audit-trail-provider.d.ts +24 -0
- package/dist/lib/audit-trail-provider.js +60 -0
- package/dist/lib/axis-clob-provider.d.ts +50 -0
- package/dist/lib/axis-clob-provider.js +150 -0
- package/dist/lib/circuit-breaker.d.ts +60 -0
- package/dist/lib/circuit-breaker.js +136 -0
- package/dist/lib/conditional-escrow.d.ts +42 -0
- package/dist/lib/conditional-escrow.js +126 -0
- package/dist/lib/mcp-server.d.ts +29 -0
- package/dist/lib/mcp-server.js +165 -0
- package/dist/lib/micro-stream.d.ts +21 -0
- package/dist/lib/micro-stream.js +41 -0
- package/dist/lib/proof-of-task.d.ts +12 -0
- package/dist/lib/proof-of-task.js +32 -0
- package/dist/lib/receipts.d.ts +153 -0
- package/dist/lib/receipts.js +173 -0
- package/dist/lib/reflector-oracle-adapter.d.ts +44 -0
- package/dist/lib/reflector-oracle-adapter.js +173 -0
- package/dist/lib/scoped-allowance.d.ts +15 -0
- package/dist/lib/scoped-allowance.js +116 -0
- package/dist/lib/ttl-keeper.d.ts +10 -0
- package/dist/lib/ttl-keeper.js +36 -0
- package/dist/lib/universal-adapters.d.ts +42 -0
- package/dist/lib/universal-adapters.js +69 -0
- package/dist/lib/x402-gateway.d.ts +86 -0
- package/dist/lib/x402-gateway.js +128 -0
- package/dist/lib/x402-pipeline.d.ts +51 -0
- package/dist/lib/x402-pipeline.js +105 -0
- package/dist/sdk/agent-client.d.ts +26 -0
- package/dist/sdk/agent-client.js +53 -0
- package/dist/types.d.ts +181 -0
- package/dist/types.js +5 -0
- package/glama.json +12 -0
- package/package.json +56 -6
- package/smithery.json +43 -0
- package/smithery.yaml +29 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for AgentRail Protocol.
|
|
3
|
+
*/
|
|
4
|
+
export interface ScopedAllowance {
|
|
5
|
+
/** Unique allowance identifier. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Human or organization master account public key (G...). */
|
|
8
|
+
ownerPublicKey: string;
|
|
9
|
+
/** Autonomous AI Agent session public key (G...). */
|
|
10
|
+
agentPublicKey: string;
|
|
11
|
+
/** Maximum allowance amount in stroops (1 USDC = 10^7 stroops). */
|
|
12
|
+
maxStroops: bigint;
|
|
13
|
+
/** Currently spent stroops in the active epoch. */
|
|
14
|
+
spentStroops: bigint;
|
|
15
|
+
/** Unix timestamp in seconds when the allowance window opens. */
|
|
16
|
+
validFrom: number;
|
|
17
|
+
/** Unix timestamp in seconds when the allowance window expires. */
|
|
18
|
+
validUntil: number;
|
|
19
|
+
/** Array of approved destination public keys or contract IDs. */
|
|
20
|
+
allowedDestinations?: string[];
|
|
21
|
+
/** Whether the allowance is currently active or paused. */
|
|
22
|
+
active: boolean;
|
|
23
|
+
/** Protocol fee basis points (e.g. 20 bps = 0.20%). Defaults to 20 if omitted. */
|
|
24
|
+
protocolFeeBps?: number;
|
|
25
|
+
/** Protocol treasury wallet address that collects transaction fees. */
|
|
26
|
+
treasuryPublicKey?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SpendRequest {
|
|
29
|
+
allowanceId: string;
|
|
30
|
+
agentPublicKey: string;
|
|
31
|
+
destination: string;
|
|
32
|
+
amountStroops: bigint;
|
|
33
|
+
timestamp: number;
|
|
34
|
+
memo?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface SpendResult {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
code: string;
|
|
39
|
+
message: string;
|
|
40
|
+
remainingStroops?: bigint;
|
|
41
|
+
spentStroops?: bigint;
|
|
42
|
+
/** Protocol monetization fee in stroops routed to treasury. */
|
|
43
|
+
feeStroops?: bigint;
|
|
44
|
+
/** Net amount in stroops routed to recipient. */
|
|
45
|
+
netStroops?: bigint;
|
|
46
|
+
/** Treasury address where fee was routed. */
|
|
47
|
+
treasuryPublicKey?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface EscrowTask {
|
|
50
|
+
taskId: string;
|
|
51
|
+
payerPublicKey: string;
|
|
52
|
+
agentWorkerPublicKey: string;
|
|
53
|
+
rewardStroops: bigint;
|
|
54
|
+
taskCommitmentHash: string;
|
|
55
|
+
expiresAt: number;
|
|
56
|
+
status: "pending" | "fulfilled" | "refunded" | "disputed";
|
|
57
|
+
}
|
|
58
|
+
export interface ProofOfTaskSubmission {
|
|
59
|
+
taskId: string;
|
|
60
|
+
agentWorkerPublicKey: string;
|
|
61
|
+
outputPayload: string;
|
|
62
|
+
nonce: string;
|
|
63
|
+
}
|
|
64
|
+
export interface SorobanTtlStatus {
|
|
65
|
+
contractId: string;
|
|
66
|
+
currentLedger: number;
|
|
67
|
+
liveUntilLedger: number;
|
|
68
|
+
remainingLedgers: number;
|
|
69
|
+
thresholdLedgers: number;
|
|
70
|
+
needsBump: boolean;
|
|
71
|
+
recommendedExtendLedgers: number;
|
|
72
|
+
}
|
|
73
|
+
export type AxisOrderSide = "buy" | "sell";
|
|
74
|
+
export type AxisOrderType = "limit" | "market";
|
|
75
|
+
export interface AxisMarketInfo {
|
|
76
|
+
contract: string;
|
|
77
|
+
symbol: string;
|
|
78
|
+
volume: string;
|
|
79
|
+
quoteVolume: string;
|
|
80
|
+
}
|
|
81
|
+
export interface AxisLimitOrder {
|
|
82
|
+
orderId: string;
|
|
83
|
+
agentPublicKey: string;
|
|
84
|
+
marketContract: string;
|
|
85
|
+
baseAsset: string;
|
|
86
|
+
quoteAsset: string;
|
|
87
|
+
side: AxisOrderSide;
|
|
88
|
+
orderType: AxisOrderType;
|
|
89
|
+
price: number;
|
|
90
|
+
amount: number;
|
|
91
|
+
quoteAmountStroops: bigint;
|
|
92
|
+
expiresAt: number;
|
|
93
|
+
clientNonce: string;
|
|
94
|
+
}
|
|
95
|
+
export interface AxisTradingScopePolicy {
|
|
96
|
+
allowedMarkets: string[];
|
|
97
|
+
allowedPairs: string[];
|
|
98
|
+
maxSingleOrderStroops: bigint;
|
|
99
|
+
maxSlippagePercent: number;
|
|
100
|
+
allowMarketOrders: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface AxisOrderValidationResult {
|
|
103
|
+
ok: boolean;
|
|
104
|
+
code: string;
|
|
105
|
+
message: string;
|
|
106
|
+
effectiveSpendStroops?: bigint;
|
|
107
|
+
remainingAllowanceStroops?: bigint;
|
|
108
|
+
marketContract?: string;
|
|
109
|
+
expectedExecutionPrice?: number;
|
|
110
|
+
}
|
|
111
|
+
export type OracleFeedStatus = "live" | "stale" | "circuit_broken";
|
|
112
|
+
export interface ReflectorPriceFeed {
|
|
113
|
+
symbol: string;
|
|
114
|
+
priceUsd: number;
|
|
115
|
+
decimals: number;
|
|
116
|
+
timestamp: number;
|
|
117
|
+
ledgerSeq: number;
|
|
118
|
+
oracleContractId?: string;
|
|
119
|
+
status: OracleFeedStatus;
|
|
120
|
+
}
|
|
121
|
+
export interface ReflectorAdapterConfig {
|
|
122
|
+
reflectorContractId?: string;
|
|
123
|
+
maxStalenessSeconds?: number;
|
|
124
|
+
maxDeviationPercent?: number;
|
|
125
|
+
fallbackEnabled?: boolean;
|
|
126
|
+
}
|
|
127
|
+
export interface ReflectorValidationResult {
|
|
128
|
+
ok: boolean;
|
|
129
|
+
code: string;
|
|
130
|
+
message: string;
|
|
131
|
+
referencePriceUsd?: number;
|
|
132
|
+
deviationPercent?: number;
|
|
133
|
+
feedStatus?: OracleFeedStatus;
|
|
134
|
+
}
|
|
135
|
+
export type AgentBadgeType = "autonomous_agent_verified" | "inference_worker" | "dex_arbitrageur" | "risk_auditor";
|
|
136
|
+
export type AgentBadgeTier = "bronze" | "silver" | "gold" | "diamond";
|
|
137
|
+
export interface AgentBadgeMetadata {
|
|
138
|
+
badgeId: string;
|
|
139
|
+
agentPublicKey: string;
|
|
140
|
+
agentName: string;
|
|
141
|
+
badgeType: AgentBadgeType;
|
|
142
|
+
tier: AgentBadgeTier;
|
|
143
|
+
reputationScore: number;
|
|
144
|
+
issuedAt: number;
|
|
145
|
+
expiresAt: number;
|
|
146
|
+
taskCommitmentHash?: string;
|
|
147
|
+
ipfsAuditCid?: string;
|
|
148
|
+
revoked: boolean;
|
|
149
|
+
revocationReason?: string;
|
|
150
|
+
issuerPublicKey: string;
|
|
151
|
+
sep50Standard: "SEP-0050-v1";
|
|
152
|
+
}
|
|
153
|
+
export interface IssueBadgeRequest {
|
|
154
|
+
agentPublicKey: string;
|
|
155
|
+
agentName: string;
|
|
156
|
+
badgeType: AgentBadgeType;
|
|
157
|
+
completedTasksCount: number;
|
|
158
|
+
auditScore: number;
|
|
159
|
+
latestTaskCommitmentHash?: string;
|
|
160
|
+
ipfsAuditCid?: string;
|
|
161
|
+
validityDays?: number;
|
|
162
|
+
}
|
|
163
|
+
export interface BadgeVerificationResult {
|
|
164
|
+
valid: boolean;
|
|
165
|
+
code: string;
|
|
166
|
+
message: string;
|
|
167
|
+
badge?: AgentBadgeMetadata;
|
|
168
|
+
}
|
|
169
|
+
export interface XoxnoListingMetadata {
|
|
170
|
+
id: string;
|
|
171
|
+
name: string;
|
|
172
|
+
description: string;
|
|
173
|
+
image: string;
|
|
174
|
+
external_url: string;
|
|
175
|
+
attributes: Array<{
|
|
176
|
+
trait_type: string;
|
|
177
|
+
value: string | number;
|
|
178
|
+
}>;
|
|
179
|
+
seller_fee_basis_points: number;
|
|
180
|
+
fee_recipient: string;
|
|
181
|
+
}
|
package/dist/types.js
ADDED
package/glama.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://glama.ai/mcp/schema.json",
|
|
3
|
+
"name": "agentrail",
|
|
4
|
+
"displayName": "AgentRail MCP Server",
|
|
5
|
+
"description": "Stellar Soroban autonomous settlement, 24-agent earning fleet, x402 micropayment oracle, and SEP-50 reputation badges.",
|
|
6
|
+
"icon": "https://raw.githubusercontent.com/SorobanAgents/agentrail/main/assets/xoxno/badge-diamond.png",
|
|
7
|
+
"repository": "https://github.com/SorobanAgents/agentrail",
|
|
8
|
+
"homepage": "https://sorobanagents.github.io/agentrail",
|
|
9
|
+
"entrypoint": "dist/cli/mcp-stdio.js",
|
|
10
|
+
"transport": "stdio",
|
|
11
|
+
"runtime": "node"
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@sparkysolutions/agentrail",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@sparkysolutions/agentrail",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Autonomous AI Agent Scoped-Allowance & Micro-Settlement Protocol on Stellar & Soroban",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"agentrail": "./dist/cli/mcp-stdio.js",
|
|
9
|
+
"agentrail-mcp": "./dist/cli/mcp-stdio.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"smithery.yaml",
|
|
14
|
+
"smithery.json",
|
|
15
|
+
"glama.json",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.json",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"lint": "tsc --noEmit",
|
|
23
|
+
"demo": "tsx scripts/demo-agent.ts",
|
|
24
|
+
"demo:agent": "tsx scripts/demo-agent.ts",
|
|
25
|
+
"demo:receipt": "tsx scripts/demo-agent.ts --receipt",
|
|
26
|
+
"pipeline:settle": "tsx scripts/pipeline-settle.ts",
|
|
27
|
+
"pipeline:settle:mainnet": "tsx scripts/pipeline-settle-mainnet.ts",
|
|
28
|
+
"verify:master": "npx tsx scripts/verify-unified-master-pipeline-mainnet.ts",
|
|
29
|
+
"start:24-7": "npx tsx scripts/run-24-7-autonomous-fleet.ts --continuous",
|
|
30
|
+
"security:check": "node scripts/security-audit.mjs"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"stellar",
|
|
34
|
+
"soroban",
|
|
35
|
+
"ai-agents",
|
|
36
|
+
"micropayments",
|
|
37
|
+
"scoped-allowance",
|
|
38
|
+
"drips-wave",
|
|
39
|
+
"smart-contracts"
|
|
40
|
+
],
|
|
41
|
+
"author": {
|
|
42
|
+
"name": "Mukesh Biswas (sparkysolutions10-pixel)",
|
|
43
|
+
"orcid": "https://orcid.org/0009-0008-2818-6579"
|
|
44
|
+
},
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@stellar/stellar-sdk": "^13.1.0",
|
|
48
|
+
"zod": "^3.23.8"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^22.5.0",
|
|
52
|
+
"tsx": "^4.19.0",
|
|
53
|
+
"typescript": "^5.5.4",
|
|
54
|
+
"vitest": "^2.1.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/smithery.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://smithery.ai/docs/config/schema.json",
|
|
3
|
+
"name": "@sparkysolutions/agentrail",
|
|
4
|
+
"displayName": "AgentRail - Autonomous AI Agent Settlement Protocol",
|
|
5
|
+
"description": "Autonomous AI Agent Scoped-Allowance, Reflector Oracle, SEP-50 Verification Badges & x402 Micropayments on Stellar & Soroban.",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"icon": "https://raw.githubusercontent.com/SorobanAgents/agentrail/main/assets/xoxno/badge-diamond.png",
|
|
8
|
+
"repository": "https://github.com/SorobanAgents/agentrail",
|
|
9
|
+
"homepage": "https://sorobanagents.github.io/agentrail",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"stellar",
|
|
13
|
+
"soroban",
|
|
14
|
+
"mcp",
|
|
15
|
+
"ai-agents",
|
|
16
|
+
"x402",
|
|
17
|
+
"micropayments",
|
|
18
|
+
"oracle",
|
|
19
|
+
"reflector",
|
|
20
|
+
"sep50",
|
|
21
|
+
"badges"
|
|
22
|
+
],
|
|
23
|
+
"startCommand": {
|
|
24
|
+
"type": "stdio",
|
|
25
|
+
"configSchema": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"network": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"enum": ["public", "testnet"],
|
|
31
|
+
"default": "public",
|
|
32
|
+
"description": "Stellar network for settlement and oracle feeds"
|
|
33
|
+
},
|
|
34
|
+
"defaultCurrency": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"default": "USDC",
|
|
37
|
+
"description": "Default settlement currency"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"commandLine": "npx -y @sparkysolutions/agentrail"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/smithery.yaml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
|
|
2
|
+
startCommand:
|
|
3
|
+
type: stdio
|
|
4
|
+
configSchema:
|
|
5
|
+
type: object
|
|
6
|
+
properties:
|
|
7
|
+
network:
|
|
8
|
+
type: string
|
|
9
|
+
enum:
|
|
10
|
+
- public
|
|
11
|
+
- testnet
|
|
12
|
+
default: public
|
|
13
|
+
description: Stellar network for settlement and oracle feeds
|
|
14
|
+
defaultCurrency:
|
|
15
|
+
type: string
|
|
16
|
+
default: XLM
|
|
17
|
+
description: Default settlement currency (XLM / USDC)
|
|
18
|
+
commandFunction: |-
|
|
19
|
+
(config) => ({
|
|
20
|
+
command: 'npx',
|
|
21
|
+
args: ['-y', '@sparkysolutions/agentrail'],
|
|
22
|
+
env: {
|
|
23
|
+
STELLAR_NETWORK: config.network || 'public',
|
|
24
|
+
DEFAULT_CURRENCY: config.defaultCurrency || 'XLM'
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
exampleConfig:
|
|
28
|
+
network: public
|
|
29
|
+
defaultCurrency: XLM
|