@greenhelix/sdk 1.0.7

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.
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ /**
3
+ * Tests for error classes and raiseForStatus.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const node_test_1 = require("node:test");
40
+ const assert = __importStar(require("node:assert/strict"));
41
+ const errors_1 = require("../errors");
42
+ (0, node_test_1.describe)("Error classes", () => {
43
+ (0, node_test_1.it)("A2AError stores message, code, status", () => {
44
+ const err = new errors_1.A2AError("test msg", "test_code", 418);
45
+ assert.equal(err.message, "test msg");
46
+ assert.equal(err.code, "test_code");
47
+ assert.equal(err.status, 418);
48
+ assert.equal(err.name, "A2AError");
49
+ assert.ok(err instanceof Error);
50
+ });
51
+ (0, node_test_1.it)("AuthenticationError has status 401", () => {
52
+ const err = new errors_1.AuthenticationError("bad key");
53
+ assert.equal(err.status, 401);
54
+ assert.equal(err.name, "AuthenticationError");
55
+ assert.ok(err instanceof errors_1.A2AError);
56
+ });
57
+ (0, node_test_1.it)("InsufficientBalanceError has status 402", () => {
58
+ const err = new errors_1.InsufficientBalanceError("low funds");
59
+ assert.equal(err.status, 402);
60
+ assert.ok(err instanceof errors_1.A2AError);
61
+ });
62
+ (0, node_test_1.it)("InsufficientTierError has status 403", () => {
63
+ const err = new errors_1.InsufficientTierError("need pro");
64
+ assert.equal(err.status, 403);
65
+ assert.ok(err instanceof errors_1.A2AError);
66
+ });
67
+ (0, node_test_1.it)("ToolNotFoundError has status 404", () => {
68
+ const err = new errors_1.ToolNotFoundError("no such tool");
69
+ assert.equal(err.status, 404);
70
+ assert.ok(err instanceof errors_1.A2AError);
71
+ });
72
+ (0, node_test_1.it)("RateLimitError has status 429", () => {
73
+ const err = new errors_1.RateLimitError("slow down");
74
+ assert.equal(err.status, 429);
75
+ assert.ok(err instanceof errors_1.A2AError);
76
+ });
77
+ (0, node_test_1.it)("ServerError defaults to status 500", () => {
78
+ const err = new errors_1.ServerError("boom");
79
+ assert.equal(err.status, 500);
80
+ assert.ok(err instanceof errors_1.A2AError);
81
+ });
82
+ (0, node_test_1.it)("ServerError accepts custom status", () => {
83
+ const err = new errors_1.ServerError("gateway", "bad_gateway", 502);
84
+ assert.equal(err.status, 502);
85
+ assert.equal(err.code, "bad_gateway");
86
+ });
87
+ });
88
+ (0, node_test_1.describe)("RETRYABLE_STATUS_CODES", () => {
89
+ (0, node_test_1.it)("contains 429, 500, 502, 503, 504", () => {
90
+ for (const code of [429, 500, 502, 503, 504]) {
91
+ assert.ok(errors_1.RETRYABLE_STATUS_CODES.has(code), `missing ${code}`);
92
+ }
93
+ });
94
+ (0, node_test_1.it)("does not contain 400, 401, 403, 404", () => {
95
+ for (const code of [400, 401, 403, 404]) {
96
+ assert.ok(!errors_1.RETRYABLE_STATUS_CODES.has(code), `should not have ${code}`);
97
+ }
98
+ });
99
+ });
100
+ (0, node_test_1.describe)("raiseForStatus", () => {
101
+ (0, node_test_1.it)("throws AuthenticationError for 401", () => {
102
+ assert.throws(() => (0, errors_1.raiseForStatus)(401, { error: { message: "bad", code: "invalid_key" } }), (err) => err instanceof errors_1.AuthenticationError && err.code === "invalid_key");
103
+ });
104
+ (0, node_test_1.it)("throws InsufficientBalanceError for 402", () => {
105
+ assert.throws(() => (0, errors_1.raiseForStatus)(402, { error: { message: "low", code: "insufficient_balance" } }), (err) => err instanceof errors_1.InsufficientBalanceError);
106
+ });
107
+ (0, node_test_1.it)("throws InsufficientTierError for 403", () => {
108
+ assert.throws(() => (0, errors_1.raiseForStatus)(403, { error: { message: "need pro", code: "insufficient_tier" } }), (err) => err instanceof errors_1.InsufficientTierError);
109
+ });
110
+ (0, node_test_1.it)("throws ToolNotFoundError for 400", () => {
111
+ assert.throws(() => (0, errors_1.raiseForStatus)(400, { error: { message: "unknown", code: "unknown_tool" } }), (err) => err instanceof errors_1.ToolNotFoundError);
112
+ });
113
+ (0, node_test_1.it)("throws ToolNotFoundError for 404", () => {
114
+ assert.throws(() => (0, errors_1.raiseForStatus)(404, { error: { message: "not found", code: "not_found" } }), (err) => err instanceof errors_1.ToolNotFoundError);
115
+ });
116
+ (0, node_test_1.it)("throws RateLimitError for 429", () => {
117
+ assert.throws(() => (0, errors_1.raiseForStatus)(429, { error: { message: "too fast", code: "rate_limit" } }), (err) => err instanceof errors_1.RateLimitError);
118
+ });
119
+ (0, node_test_1.it)("throws ServerError for unknown status", () => {
120
+ assert.throws(() => (0, errors_1.raiseForStatus)(503, { error: { message: "down", code: "unavailable" } }), (err) => err instanceof errors_1.ServerError);
121
+ });
122
+ (0, node_test_1.it)("handles missing error fields gracefully", () => {
123
+ assert.throws(() => (0, errors_1.raiseForStatus)(500, {}), (err) => err instanceof errors_1.ServerError && err.message === "Unknown error");
124
+ });
125
+ });
126
+ //# sourceMappingURL=errors.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.test.js","sourceRoot":"","sources":["../../src/test/errors.test.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAyC;AACzC,2DAA6C;AAE7C,sCAUmB;AAEnB,IAAA,oBAAQ,EAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAA,cAAE,EAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,GAAG,GAAG,IAAI,iBAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;QACvD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACnC,MAAM,CAAC,EAAE,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,cAAE,EAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,GAAG,GAAG,IAAI,4BAAmB,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QAC9C,MAAM,CAAC,EAAE,CAAC,GAAG,YAAY,iBAAQ,CAAC,CAAC;IACrC,CA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C,CAAC"}
@@ -0,0 +1,224 @@
1
+ /** Response types for the A2A Commerce Gateway SDK. */
2
+ export interface ExecuteResponse {
3
+ success: boolean;
4
+ result: Record<string, any>;
5
+ charged: number;
6
+ }
7
+ export interface HealthResponse {
8
+ status: string;
9
+ version: string;
10
+ tools: number;
11
+ }
12
+ export interface ToolPricing {
13
+ name: string;
14
+ service: string;
15
+ description: string;
16
+ pricing: Record<string, any>;
17
+ tier_required: string;
18
+ input_schema?: Record<string, any>;
19
+ output_schema?: Record<string, any>;
20
+ sla?: Record<string, any>;
21
+ }
22
+ export interface TrustScore {
23
+ server_id: string;
24
+ composite_score: number;
25
+ reliability_score: number;
26
+ security_score: number;
27
+ documentation_score: number;
28
+ responsiveness_score: number;
29
+ confidence: number;
30
+ window: string;
31
+ }
32
+ export interface PaymentIntent {
33
+ id: string;
34
+ status: string;
35
+ amount: number;
36
+ }
37
+ export interface Escrow {
38
+ id: string;
39
+ status: string;
40
+ amount: number;
41
+ }
42
+ export interface CheckoutResult {
43
+ checkout_url: string;
44
+ session_id: string;
45
+ credits: number;
46
+ amount_usd: number;
47
+ }
48
+ export interface BalanceResponse {
49
+ balance: number;
50
+ }
51
+ export interface UsageSummaryResponse {
52
+ total_cost: number;
53
+ total_calls: number;
54
+ total_tokens: number;
55
+ }
56
+ export interface PaymentHistoryResponse {
57
+ history: Record<string, any>[];
58
+ }
59
+ /** Alias for Escrow — used by releaseEscrow, cancelEscrow, createEscrow. */
60
+ export interface EscrowResponse {
61
+ id: string;
62
+ status: string;
63
+ amount: number;
64
+ }
65
+ export interface RefundResponse {
66
+ id: string;
67
+ settlement_id: string;
68
+ amount: number;
69
+ reason?: string;
70
+ status: string;
71
+ }
72
+ export interface SubscriptionResponse {
73
+ id: string;
74
+ status: string;
75
+ amount: number;
76
+ interval: string;
77
+ next_charge_at: number;
78
+ }
79
+ export interface SubscriptionDetailResponse {
80
+ id: string;
81
+ payer: string;
82
+ payee: string;
83
+ amount: number;
84
+ interval: string;
85
+ status: string;
86
+ next_charge_at: number;
87
+ charge_count: number;
88
+ created_at: number;
89
+ }
90
+ export interface SubscriptionListResponse {
91
+ subscriptions: Record<string, any>[];
92
+ }
93
+ export interface ServiceRegistrationResponse {
94
+ id: string;
95
+ name: string;
96
+ status: string;
97
+ }
98
+ export interface ServiceDetailResponse {
99
+ id: string;
100
+ name: string;
101
+ description: string;
102
+ category: string;
103
+ status: string;
104
+ }
105
+ export interface ServiceRatingResponse {
106
+ service_id: string;
107
+ agent_id: string;
108
+ rating: number;
109
+ }
110
+ export interface ServerSearchResult {
111
+ id: string;
112
+ name: string;
113
+ url: string;
114
+ }
115
+ export interface ServerSearchResponse {
116
+ servers: ServerSearchResult[];
117
+ }
118
+ export interface AgentIdentityResponse {
119
+ agent_id: string;
120
+ public_key: string;
121
+ created_at: number;
122
+ org_id?: string;
123
+ found: boolean;
124
+ }
125
+ export interface VerifyAgentResponse {
126
+ valid: boolean;
127
+ }
128
+ export interface MetricsSubmissionResponse {
129
+ agent_id: string;
130
+ commitment_hashes: string[];
131
+ verified_at: number;
132
+ valid_until: number;
133
+ data_source: string;
134
+ signature: string;
135
+ }
136
+ export interface VerifiedClaim {
137
+ agent_id: string;
138
+ metric_name: string;
139
+ claim_type: string;
140
+ bound_value: number;
141
+ valid_until: number;
142
+ }
143
+ export interface VerifiedClaimsResponse {
144
+ claims: VerifiedClaim[];
145
+ }
146
+ export interface WebhookResponse {
147
+ id: string;
148
+ agent_id: string;
149
+ url: string;
150
+ event_types: string[];
151
+ filter_agent_ids: string[] | null;
152
+ created_at: number;
153
+ active: boolean;
154
+ }
155
+ export interface WebhookListResponse {
156
+ webhooks: Record<string, any>[];
157
+ }
158
+ export interface WebhookDeleteResponse {
159
+ deleted: boolean;
160
+ }
161
+ export interface ApiKeyResponse {
162
+ key: string;
163
+ agent_id: string;
164
+ tier: string;
165
+ created_at: number;
166
+ }
167
+ export interface KeyRotationResponse {
168
+ new_key: string;
169
+ tier: string;
170
+ agent_id: string;
171
+ revoked: boolean;
172
+ }
173
+ export interface EventPublishResponse {
174
+ event_id: number;
175
+ }
176
+ export interface EventRecord {
177
+ id: number;
178
+ event_type: string;
179
+ source: string;
180
+ payload: Record<string, any>;
181
+ integrity_hash: string;
182
+ created_at: string;
183
+ }
184
+ export interface EventListResponse {
185
+ events: EventRecord[];
186
+ }
187
+ export interface OrgResponse {
188
+ org_id: string;
189
+ name: string;
190
+ created_at: number;
191
+ }
192
+ export interface OrgDetailResponse {
193
+ org_id: string;
194
+ name: string;
195
+ created_at: number;
196
+ members: any[];
197
+ }
198
+ export interface OrgMemberResponse {
199
+ agent_id: string;
200
+ org_id: string;
201
+ }
202
+ export interface NegotiationResponse {
203
+ negotiation_id: string;
204
+ thread_id: string;
205
+ status: string;
206
+ proposed_amount: number;
207
+ }
208
+ export interface MessageListResponse {
209
+ messages: Record<string, any>[];
210
+ }
211
+ export interface A2AClientOptions {
212
+ /** Base URL of the gateway (default: http://localhost:8000). */
213
+ baseUrl?: string;
214
+ /** API key for authenticated endpoints. */
215
+ apiKey?: string;
216
+ /** Request timeout in milliseconds (default: 30000). */
217
+ timeout?: number;
218
+ /** Max retry attempts for transient failures (default: 3). */
219
+ maxRetries?: number;
220
+ /** Base delay between retries in ms (default: 1000). */
221
+ retryBaseDelay?: number;
222
+ /** TTL for pricing cache in ms (default: 300000). */
223
+ pricingCacheTtl?: number;
224
+ }
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /** Response types for the A2A Commerce Gateway SDK. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@greenhelix/sdk",
3
+ "version": "1.0.7",
4
+ "description": "TypeScript SDK for the A2A Commerce Gateway — agent-to-agent payments, escrow, marketplace, identity, and trust scoring",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "test": "node --test dist/test/*.test.js",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "keywords": [
17
+ "a2a",
18
+ "ai-agent",
19
+ "agent-payments",
20
+ "mcp",
21
+ "escrow",
22
+ "trust",
23
+ "marketplace",
24
+ "commerce",
25
+ "sdk"
26
+ ],
27
+ "author": "Green Helix <dev@greenhelix.net>",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/mirni/a2a.git",
32
+ "directory": "sdk-ts"
33
+ },
34
+ "homepage": "https://greenhelix.net",
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^25.5.0",
40
+ "typescript": "^5.4"
41
+ },
42
+ "engines": {
43
+ "node": ">=18"
44
+ }
45
+ }