@oobe-protocol-labs/synapse-sap-sdk 0.5.0 → 0.6.0
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/dist/cjs/index.js +35 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/registries/x402.js +3 -1
- package/dist/cjs/registries/x402.js.map +1 -1
- package/dist/cjs/types/endpoint.js +15 -0
- package/dist/cjs/types/endpoint.js.map +1 -0
- package/dist/cjs/utils/endpoint-validator.js +232 -0
- package/dist/cjs/utils/endpoint-validator.js.map +1 -0
- package/dist/cjs/utils/index.js +30 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/network-normalizer.js +236 -0
- package/dist/cjs/utils/network-normalizer.js.map +1 -0
- package/dist/cjs/utils/rpc-strategy.js +239 -0
- package/dist/cjs/utils/rpc-strategy.js.map +1 -0
- package/dist/cjs/utils/schemas.js +331 -0
- package/dist/cjs/utils/schemas.js.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/registries/x402.js +3 -1
- package/dist/esm/registries/x402.js.map +1 -1
- package/dist/esm/types/endpoint.js +14 -0
- package/dist/esm/types/endpoint.js.map +1 -0
- package/dist/esm/utils/endpoint-validator.js +226 -0
- package/dist/esm/utils/endpoint-validator.js.map +1 -0
- package/dist/esm/utils/index.js +5 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/network-normalizer.js +229 -0
- package/dist/esm/utils/network-normalizer.js.map +1 -0
- package/dist/esm/utils/rpc-strategy.js +231 -0
- package/dist/esm/utils/rpc-strategy.js.map +1 -0
- package/dist/esm/utils/schemas.js +320 -0
- package/dist/esm/utils/schemas.js.map +1 -0
- package/dist/types/index.d.ts +7 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/plugin/schemas.d.ts +6 -6
- package/dist/types/registries/x402.d.ts.map +1 -1
- package/dist/types/types/endpoint.d.ts +161 -0
- package/dist/types/types/endpoint.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utils/endpoint-validator.d.ts +110 -0
- package/dist/types/utils/endpoint-validator.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/network-normalizer.d.ts +120 -0
- package/dist/types/utils/network-normalizer.d.ts.map +1 -0
- package/dist/types/utils/rpc-strategy.d.ts +172 -0
- package/dist/types/utils/rpc-strategy.d.ts.map +1 -0
- package/dist/types/utils/schemas.d.ts +351 -0
- package/dist/types/utils/schemas.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +48 -0
- package/src/registries/x402.ts +5 -1
- package/src/types/endpoint.ts +181 -0
- package/src/types/index.ts +9 -0
- package/src/utils/endpoint-validator.ts +300 -0
- package/src/utils/index.ts +39 -0
- package/src/utils/network-normalizer.ts +240 -0
- package/src/utils/rpc-strategy.ts +322 -0
- package/src/utils/schemas.ts +359 -0
|
@@ -53,10 +53,10 @@ export declare const agentSchemas: {
|
|
|
53
53
|
tokenMint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
54
|
tokenDecimals: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
55
|
settlementMode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
56
|
+
x402: "x402";
|
|
56
57
|
instant: "instant";
|
|
57
58
|
escrow: "escrow";
|
|
58
59
|
batched: "batched";
|
|
59
|
-
x402: "x402";
|
|
60
60
|
}>>>;
|
|
61
61
|
minEscrowDeposit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
62
|
batchIntervalSec: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -100,10 +100,10 @@ export declare const agentSchemas: {
|
|
|
100
100
|
tokenMint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
101
101
|
tokenDecimals: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
102
102
|
settlementMode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
103
|
+
x402: "x402";
|
|
103
104
|
instant: "instant";
|
|
104
105
|
escrow: "escrow";
|
|
105
106
|
batched: "batched";
|
|
106
|
-
x402: "x402";
|
|
107
107
|
}>>>;
|
|
108
108
|
minEscrowDeposit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
109
109
|
batchIntervalSec: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -188,10 +188,10 @@ export declare const agentSchemas: {
|
|
|
188
188
|
tokenMint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
189
|
tokenDecimals: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
190
190
|
settlementMode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
191
|
+
x402: "x402";
|
|
191
192
|
instant: "instant";
|
|
192
193
|
escrow: "escrow";
|
|
193
194
|
batched: "batched";
|
|
194
|
-
x402: "x402";
|
|
195
195
|
}>>>;
|
|
196
196
|
minEscrowDeposit: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
197
197
|
batchIntervalSec: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
@@ -433,8 +433,8 @@ export declare const toolsSchemas: {
|
|
|
433
433
|
compound: "compound";
|
|
434
434
|
}>;
|
|
435
435
|
category: z.ZodEnum<{
|
|
436
|
-
data: "data";
|
|
437
436
|
custom: "custom";
|
|
437
|
+
data: "data";
|
|
438
438
|
swap: "swap";
|
|
439
439
|
lend: "lend";
|
|
440
440
|
stake: "stake";
|
|
@@ -456,9 +456,9 @@ export declare const toolsSchemas: {
|
|
|
456
456
|
readonly input: z.ZodObject<{
|
|
457
457
|
toolName: z.ZodString;
|
|
458
458
|
schemaType: z.ZodEnum<{
|
|
459
|
-
description: "description";
|
|
460
459
|
output: "output";
|
|
461
460
|
input: "input";
|
|
461
|
+
description: "description";
|
|
462
462
|
}>;
|
|
463
463
|
schemaData: z.ZodString;
|
|
464
464
|
compression: z.ZodDefault<z.ZodEnum<{
|
|
@@ -483,8 +483,8 @@ export declare const toolsSchemas: {
|
|
|
483
483
|
compound: "compound";
|
|
484
484
|
}>>>;
|
|
485
485
|
category: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
486
|
-
data: "data";
|
|
487
486
|
custom: "custom";
|
|
487
|
+
data: "data";
|
|
488
488
|
swap: "swap";
|
|
489
489
|
lend: "lend";
|
|
490
490
|
stake: "stake";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x402.d.ts","sourceRoot":"","sources":["../../../src/registries/x402.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAuB,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EACV,iBAAiB,EAEjB,qBAAqB,EAEtB,MAAM,UAAU,CAAC;AAMlB;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC;IACvB,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,QAAQ,CAAC,qBAAqB,EAAE,EAAE,CAAC;IACnC,oCAAoC;IACpC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,C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KAC3C,CAAC,GACD,OAAO,CAAC,qBAAqB,CAAC;IA+CjC;;;;;;;;;;OAUG;IACG,UAAU,CACd,WAAW,EAAE,SAAS,EACtB,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAmChC;;;;;;;;OAQG;IACG,SAAS,CACb,WAAW,EAAE,SAAS,EACtB,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,OAAO,CAAC;IAOnB;;;;;;;;OAQG;IACG,WAAW,CACf,WAAW,EAAE,SAAS,EACtB,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IASpC;;;;;OAKG;IAEH,OAAO,KAAK,OAAO,GAGlB;IAED;;;;;;;;OAQG;YAEW,KAAK;IAKnB;;;;;;;OAOG;YAEW,aAAa;CAI5B"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module types/endpoint
|
|
3
|
+
* @description Typed endpoint metadata for SAP agent discovery.
|
|
4
|
+
*
|
|
5
|
+
* Provides machine-verifiable descriptions of an agent's HTTP endpoints,
|
|
6
|
+
* authentication requirements, health-check expectations, and CORS/CSRF
|
|
7
|
+
* needs. These types solve the "guess the endpoint" interoperability
|
|
8
|
+
* problem highlighted by Kamiyo and AceDataCloud integrations.
|
|
9
|
+
*
|
|
10
|
+
* @category Types
|
|
11
|
+
* @since v0.6.0
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @interface EndpointDescriptor
|
|
15
|
+
* @description Machine-readable description of an agent's HTTP endpoint.
|
|
16
|
+
*
|
|
17
|
+
* Designed so that clients never have to "guess" the method, auth
|
|
18
|
+
* requirements, or content type of an agent's API.
|
|
19
|
+
*
|
|
20
|
+
* @category Types
|
|
21
|
+
* @since v0.6.0
|
|
22
|
+
*/
|
|
23
|
+
export interface EndpointDescriptor {
|
|
24
|
+
/** Full URL of the endpoint (e.g. `https://api.example.com/x402`). */
|
|
25
|
+
readonly url: string;
|
|
26
|
+
/** HTTP method (uppercase). Defaults to `"POST"`. */
|
|
27
|
+
readonly method: "GET" | "POST" | "PUT" | "DELETE";
|
|
28
|
+
/** Expected `Content-Type` of the response (defaults to `"application/json"`). */
|
|
29
|
+
readonly contentType: string;
|
|
30
|
+
/** Whether the endpoint requires an `Authorization` header. */
|
|
31
|
+
readonly requiresAuth: boolean;
|
|
32
|
+
/** Type of auth if `requiresAuth` is true: bearer, api-key, x402, etc. */
|
|
33
|
+
readonly authType?: "bearer" | "api-key" | "x402" | "none";
|
|
34
|
+
/** Whether the endpoint requires CSRF tokens / cookies. */
|
|
35
|
+
readonly requiresCSRF: boolean;
|
|
36
|
+
/** Whether the endpoint requires browser cookies. */
|
|
37
|
+
readonly requiresCookies: boolean;
|
|
38
|
+
/** Expected CORS headers (if any specific origins are required). */
|
|
39
|
+
readonly corsOrigins?: string[];
|
|
40
|
+
/** Additional custom headers that the endpoint requires. */
|
|
41
|
+
readonly requiredHeaders?: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @interface HealthCheckDescriptor
|
|
45
|
+
* @description Health-check endpoint configuration for an agent.
|
|
46
|
+
*
|
|
47
|
+
* Clients and the CLI can use this to verify that an agent's
|
|
48
|
+
* endpoint is reachable and SAP-capable before attempting x402 calls.
|
|
49
|
+
*
|
|
50
|
+
* @category Types
|
|
51
|
+
* @since v0.6.0
|
|
52
|
+
*/
|
|
53
|
+
export interface HealthCheckDescriptor {
|
|
54
|
+
/** Health-check URL (e.g. `https://api.example.com/health`). */
|
|
55
|
+
readonly url: string;
|
|
56
|
+
/** Expected HTTP status code (defaults to `200`). */
|
|
57
|
+
readonly expectedStatus: number;
|
|
58
|
+
/** Timeout in milliseconds for the check (defaults to `5000`). */
|
|
59
|
+
readonly timeoutMs: number;
|
|
60
|
+
/** HTTP method to use (defaults to `"GET"`). */
|
|
61
|
+
readonly method?: "GET" | "HEAD";
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @interface ToolManifestEntry
|
|
65
|
+
* @description Typed descriptor for a single tool in an agent's manifest.
|
|
66
|
+
*
|
|
67
|
+
* Provides enough metadata so clients can statically validate arguments,
|
|
68
|
+
* know the payment mode, and understand prerequisites before calling.
|
|
69
|
+
*
|
|
70
|
+
* @category Types
|
|
71
|
+
* @since v0.6.0
|
|
72
|
+
*/
|
|
73
|
+
export interface ToolManifestEntry {
|
|
74
|
+
/** Tool name (e.g. `"serp:search"`, `"jupiter:swap"`). */
|
|
75
|
+
readonly name: string;
|
|
76
|
+
/** Human-readable description. */
|
|
77
|
+
readonly description: string;
|
|
78
|
+
/** Protocol namespace (e.g. `"kamiyo"`, `"ace_data_cloud"`). */
|
|
79
|
+
readonly protocol: string;
|
|
80
|
+
/** Tool category. */
|
|
81
|
+
readonly category: string;
|
|
82
|
+
/** JSON Schema (draft-07) for input arguments. */
|
|
83
|
+
readonly inputSchema: Record<string, unknown>;
|
|
84
|
+
/** JSON Schema (draft-07) for output shape. */
|
|
85
|
+
readonly outputSchema: Record<string, unknown>;
|
|
86
|
+
/** HTTP method used to invoke this tool. */
|
|
87
|
+
readonly httpMethod: "GET" | "POST" | "PUT" | "DELETE" | "COMPOUND";
|
|
88
|
+
/** Payment mode: `"x402"`, `"free"`, `"prepaid"`, etc. */
|
|
89
|
+
readonly paymentMode: "x402" | "free" | "prepaid" | "subscription";
|
|
90
|
+
/** Price per call (in smallest token unit; 0 for free). */
|
|
91
|
+
readonly pricePerCall: number;
|
|
92
|
+
/** Required arguments (subset of inputSchema.required). */
|
|
93
|
+
readonly requiredArgs: string[];
|
|
94
|
+
/** Prerequisites or preconditions (e.g. "requires escrow"). */
|
|
95
|
+
readonly prerequisites: string[];
|
|
96
|
+
/** Endpoint override for this specific tool (if different from agent default). */
|
|
97
|
+
readonly endpointOverride?: EndpointDescriptor;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @interface AgentManifest
|
|
101
|
+
* @description Complete typed manifest for an agent, including
|
|
102
|
+
* endpoints, health checks, tools, and discovery metadata.
|
|
103
|
+
*
|
|
104
|
+
* Replaces the "stringly typed" approach to agent metadata with
|
|
105
|
+
* machine-verifiable schemas. Generated by the CLI or published
|
|
106
|
+
* to the on-chain registry.
|
|
107
|
+
*
|
|
108
|
+
* @category Types
|
|
109
|
+
* @since v0.6.0
|
|
110
|
+
*/
|
|
111
|
+
export interface AgentManifest {
|
|
112
|
+
/** Manifest schema version. */
|
|
113
|
+
readonly version: "1.0.0";
|
|
114
|
+
/** Agent's wallet address (base58). */
|
|
115
|
+
readonly wallet: string;
|
|
116
|
+
/** Agent name. */
|
|
117
|
+
readonly name: string;
|
|
118
|
+
/** Agent description. */
|
|
119
|
+
readonly description: string;
|
|
120
|
+
/** Primary x402 endpoint descriptor. */
|
|
121
|
+
readonly endpoint: EndpointDescriptor;
|
|
122
|
+
/** Health-check configuration. */
|
|
123
|
+
readonly healthCheck?: HealthCheckDescriptor;
|
|
124
|
+
/** All available tools with typed schemas. */
|
|
125
|
+
readonly tools: ToolManifestEntry[];
|
|
126
|
+
/** Supported network identifiers for x402 headers. */
|
|
127
|
+
readonly supportedNetworks: string[];
|
|
128
|
+
/** Timestamp of manifest generation (ISO 8601). */
|
|
129
|
+
readonly generatedAt: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @interface EndpointValidationResult
|
|
133
|
+
* @description Result of validating an agent's endpoint reachability and capabilities.
|
|
134
|
+
*
|
|
135
|
+
* Returned by the SDK's validation utilities and the CLI's
|
|
136
|
+
* `discovery validate` command.
|
|
137
|
+
*
|
|
138
|
+
* @category Types
|
|
139
|
+
* @since v0.6.0
|
|
140
|
+
*/
|
|
141
|
+
export interface EndpointValidationResult {
|
|
142
|
+
/** The URL that was tested. */
|
|
143
|
+
readonly url: string;
|
|
144
|
+
/** Whether the endpoint is reachable. */
|
|
145
|
+
readonly reachable: boolean;
|
|
146
|
+
/** HTTP status code received (or 0 if unreachable). */
|
|
147
|
+
readonly statusCode: number;
|
|
148
|
+
/** Response time in milliseconds. */
|
|
149
|
+
readonly latencyMs: number;
|
|
150
|
+
/** Whether the response Content-Type is JSON. */
|
|
151
|
+
readonly isJson: boolean;
|
|
152
|
+
/** Whether CORS headers are present. */
|
|
153
|
+
readonly hasCors: boolean;
|
|
154
|
+
/** Whether the endpoint returned SAP-compatible headers. */
|
|
155
|
+
readonly isSapCapable: boolean;
|
|
156
|
+
/** Error message if validation failed. */
|
|
157
|
+
readonly error?: string;
|
|
158
|
+
/** Warnings (e.g. "requires CSRF", "returns HTML"). */
|
|
159
|
+
readonly warnings: string[];
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../../src/types/endpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnD,kFAAkF;IAClF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAC3D,2DAA2D;IAC3D,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,qDAAqD;IACrD,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,oEAAoE;IACpE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,4DAA4D;IAC5D,QAAQ,CAAC,eAAe,CAA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AAE,MAAM,EAAE,CAAC;CAC7B"}
|
|
@@ -25,4 +25,5 @@ export type { Capability, VolumeCurveBreakpoint, PricingTier, PluginRef, Settlem
|
|
|
25
25
|
export type { AgentAccountData, AgentStatsData, FeedbackAccountData, CapabilityIndexData, ProtocolIndexData, ToolCategoryIndexData, GlobalRegistryData, MemoryVaultData, SessionLedgerData, EpochPageData, VaultDelegateData, SessionCheckpointData, ToolDescriptorData, EscrowAccountData, AgentAttestationData, MemoryLedgerData, LedgerPageData, } from "./accounts";
|
|
26
26
|
export type { RegisterAgentArgs, UpdateAgentArgs, GiveFeedbackArgs, UpdateFeedbackArgs, PublishToolArgs, UpdateToolArgs, InscribeToolSchemaArgs, InscribeMemoryArgs, CompactInscribeArgs, CreateEscrowArgs, CreateAttestationArgs, DelegatePermissionBit, SchemaTypeValue, CompressionTypeValue, } from "./instructions";
|
|
27
27
|
export { DelegatePermission, SchemaType, CompressionType, } from "./instructions";
|
|
28
|
+
export type { EndpointDescriptor, HealthCheckDescriptor, ToolManifestEntry, AgentManifest, EndpointValidationResult, } from "./endpoint";
|
|
28
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,UAAU,GACX,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,UAAU,GACX,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,wBAAwB,GACzB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module utils/endpoint-validator
|
|
3
|
+
* @description Endpoint validation utilities for SAP agent discovery.
|
|
4
|
+
*
|
|
5
|
+
* Fetches advertised endpoints and verifies they respond with JSON,
|
|
6
|
+
* proper CORS headers, and SAP-compatible behavior. Designed to
|
|
7
|
+
* fail fast when an endpoint 404s, requires CSRF tokens, or
|
|
8
|
+
* serves HTML instead of JSON.
|
|
9
|
+
*
|
|
10
|
+
* Used by:
|
|
11
|
+
* - CLI `discovery validate` command
|
|
12
|
+
* - SDK programmatic validation before x402 calls
|
|
13
|
+
* - Integration test harnesses
|
|
14
|
+
*
|
|
15
|
+
* @category Utils
|
|
16
|
+
* @since v0.6.0
|
|
17
|
+
*/
|
|
18
|
+
import type { EndpointDescriptor, HealthCheckDescriptor, EndpointValidationResult } from "../types/endpoint";
|
|
19
|
+
/**
|
|
20
|
+
* @interface ValidateEndpointOptions
|
|
21
|
+
* @description Options for endpoint validation.
|
|
22
|
+
* @category Utils
|
|
23
|
+
* @since v0.6.0
|
|
24
|
+
*/
|
|
25
|
+
export interface ValidateEndpointOptions {
|
|
26
|
+
/** Timeout in milliseconds (default: 10000). */
|
|
27
|
+
readonly timeoutMs?: number;
|
|
28
|
+
/** Number of retries on failure (default: 1). */
|
|
29
|
+
readonly retries?: number;
|
|
30
|
+
/** HTTP method override (default: uses descriptor or HEAD). */
|
|
31
|
+
readonly method?: string;
|
|
32
|
+
/** Custom headers to include in the validation request. */
|
|
33
|
+
readonly headers?: Record<string, string>;
|
|
34
|
+
/** If true, also sends a preflight OPTIONS request. */
|
|
35
|
+
readonly checkCors?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @name validateEndpoint
|
|
39
|
+
* @description Validate a single endpoint URL for SAP compatibility.
|
|
40
|
+
*
|
|
41
|
+
* Performs the following checks:
|
|
42
|
+
* 1. URL is reachable (no 4xx/5xx)
|
|
43
|
+
* 2. Response Content-Type is JSON
|
|
44
|
+
* 3. CORS headers are present (if checkCors enabled)
|
|
45
|
+
* 4. No redirect to HTML login pages
|
|
46
|
+
* 5. Measures response latency
|
|
47
|
+
*
|
|
48
|
+
* @param url - The endpoint URL to validate.
|
|
49
|
+
* @param opts - Validation options.
|
|
50
|
+
* @returns An {@link EndpointValidationResult} with detailed check results.
|
|
51
|
+
*
|
|
52
|
+
* @category Utils
|
|
53
|
+
* @since v0.6.0
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const result = await validateEndpoint("https://api.example.com/x402");
|
|
58
|
+
* if (!result.reachable) console.error(result.error);
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function validateEndpoint(url: string, opts?: ValidateEndpointOptions): Promise<EndpointValidationResult>;
|
|
62
|
+
/**
|
|
63
|
+
* @name validateEndpointDescriptor
|
|
64
|
+
* @description Validate an {@link EndpointDescriptor} with context-aware checks.
|
|
65
|
+
*
|
|
66
|
+
* Uses the descriptor's method, auth requirements, and other metadata to
|
|
67
|
+
* perform a more targeted validation than raw URL checking.
|
|
68
|
+
*
|
|
69
|
+
* @param descriptor - The endpoint descriptor to validate.
|
|
70
|
+
* @param opts - Additional options.
|
|
71
|
+
* @returns An {@link EndpointValidationResult}.
|
|
72
|
+
*
|
|
73
|
+
* @category Utils
|
|
74
|
+
* @since v0.6.0
|
|
75
|
+
*/
|
|
76
|
+
export declare function validateEndpointDescriptor(descriptor: EndpointDescriptor, opts?: ValidateEndpointOptions): Promise<EndpointValidationResult>;
|
|
77
|
+
/**
|
|
78
|
+
* @name validateHealthCheck
|
|
79
|
+
* @description Validate an agent's health-check endpoint.
|
|
80
|
+
*
|
|
81
|
+
* @param health - The health-check descriptor.
|
|
82
|
+
* @returns An {@link EndpointValidationResult}.
|
|
83
|
+
*
|
|
84
|
+
* @category Utils
|
|
85
|
+
* @since v0.6.0
|
|
86
|
+
*/
|
|
87
|
+
export declare function validateHealthCheck(health: HealthCheckDescriptor): Promise<EndpointValidationResult>;
|
|
88
|
+
/**
|
|
89
|
+
* @name validateAgentEndpoints
|
|
90
|
+
* @description Validate all endpoints for an agent (primary + health + tool overrides).
|
|
91
|
+
*
|
|
92
|
+
* @param params - Object containing the endpoints to validate.
|
|
93
|
+
* @param params.endpoint - Primary endpoint descriptor.
|
|
94
|
+
* @param params.healthCheck - Optional health-check descriptor.
|
|
95
|
+
* @param params.toolEndpoints - Optional array of tool-specific endpoint overrides.
|
|
96
|
+
* @param opts - Validation options.
|
|
97
|
+
* @returns A map of `label → EndpointValidationResult`.
|
|
98
|
+
*
|
|
99
|
+
* @category Utils
|
|
100
|
+
* @since v0.6.0
|
|
101
|
+
*/
|
|
102
|
+
export declare function validateAgentEndpoints(params: {
|
|
103
|
+
endpoint: EndpointDescriptor;
|
|
104
|
+
healthCheck?: HealthCheckDescriptor;
|
|
105
|
+
toolEndpoints?: Array<{
|
|
106
|
+
name: string;
|
|
107
|
+
endpoint: EndpointDescriptor;
|
|
108
|
+
}>;
|
|
109
|
+
}, opts?: ValidateEndpointOptions): Promise<Map<string, EndpointValidationResult>>;
|
|
110
|
+
//# sourceMappingURL=endpoint-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-validator.d.ts","sourceRoot":"","sources":["../../../src/utils/endpoint-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EACV,kBAAkB,EACl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16,4 +16,10 @@
|
|
|
16
16
|
export { sha256, hashToArray } from "./hash";
|
|
17
17
|
export { assert } from "./validation";
|
|
18
18
|
export { serializeAccount, serializeValue } from "./serialization";
|
|
19
|
+
export { normalizeNetworkId, isNetworkEquivalent, getNetworkGenesisHash, getNetworkClusterName, isKnownNetwork, } from "./network-normalizer";
|
|
20
|
+
export { validateEndpoint, validateEndpointDescriptor, validateHealthCheck, validateAgentEndpoints, } from "./endpoint-validator";
|
|
21
|
+
export type { ValidateEndpointOptions } from "./endpoint-validator";
|
|
22
|
+
export { getRpcUrl, getFallbackRpcUrl, createDualConnection, findATA, classifyAnchorError, extractAnchorErrorCode, } from "./rpc-strategy";
|
|
23
|
+
export type { RpcConfig, DualConnection, AtaResult } from "./rpc-strategy";
|
|
24
|
+
export { createEnvSchema, createEndpointDescriptorSchema, createHealthCheckSchema, createToolManifestEntrySchema, createAgentManifestSchema, createPreparePaymentSchema, createRegisterAgentSchema, createCallArgsSchema, validateOrThrow, } from "./schemas";
|
|
19
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGnE,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,uBAAuB,EACvB,6BAA6B,EAC7B,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,GAChB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module utils/network-normalizer
|
|
3
|
+
* @description Network identifier normalization for x402 payment headers.
|
|
4
|
+
*
|
|
5
|
+
* Solves the canonical-string mismatch between SAP clients and servers:
|
|
6
|
+
* some providers accept `solana:mainnet-beta` while others require
|
|
7
|
+
* the genesis-hash form `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`.
|
|
8
|
+
*
|
|
9
|
+
* This module provides a single source of truth for normalizing
|
|
10
|
+
* network identifiers so that both clients and agents canonicalize
|
|
11
|
+
* before comparing. Catches the Kamiyo "sap network mismatch" error
|
|
12
|
+
* at the SDK level.
|
|
13
|
+
*
|
|
14
|
+
* @category Utils
|
|
15
|
+
* @since v0.6.0
|
|
16
|
+
*/
|
|
17
|
+
import { type SapNetworkId } from "../constants/network";
|
|
18
|
+
/**
|
|
19
|
+
* @name normalizeNetworkId
|
|
20
|
+
* @description Normalize a raw network identifier string to its canonical
|
|
21
|
+
* {@link SapNetworkId} form.
|
|
22
|
+
*
|
|
23
|
+
* Handles:
|
|
24
|
+
* - Case-insensitive matching
|
|
25
|
+
* - Stripping whitespace
|
|
26
|
+
* - Resolving genesis-hash vs. cluster-name aliases
|
|
27
|
+
* - Unknown strings are returned as-is (passthrough)
|
|
28
|
+
*
|
|
29
|
+
* @param raw - Raw network identifier string from headers, env vars, or config.
|
|
30
|
+
* @returns The canonical {@link SapNetworkId}, or the trimmed input if unknown.
|
|
31
|
+
*
|
|
32
|
+
* @category Utils
|
|
33
|
+
* @since v0.6.0
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { normalizeNetworkId } from "@synapse-sap/sdk";
|
|
38
|
+
*
|
|
39
|
+
* normalizeNetworkId("solana:mainnet-beta");
|
|
40
|
+
* // → "solana:mainnet-beta"
|
|
41
|
+
*
|
|
42
|
+
* normalizeNetworkId("5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp");
|
|
43
|
+
* // → "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
|
|
44
|
+
*
|
|
45
|
+
* normalizeNetworkId(" MAINNET ");
|
|
46
|
+
* // → "solana:mainnet-beta"
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function normalizeNetworkId(raw: string): SapNetworkId | string;
|
|
50
|
+
/**
|
|
51
|
+
* @name isNetworkEquivalent
|
|
52
|
+
* @description Check if two network identifier strings refer to the same network,
|
|
53
|
+
* even if they use different formats (cluster-name vs. genesis-hash).
|
|
54
|
+
*
|
|
55
|
+
* This is the key function that prevents the Kamiyo "sap network mismatch"
|
|
56
|
+
* error — instead of comparing strings literally, we compare their
|
|
57
|
+
* canonical equivalence class.
|
|
58
|
+
*
|
|
59
|
+
* @param a - First network identifier.
|
|
60
|
+
* @param b - Second network identifier.
|
|
61
|
+
* @returns `true` if both identifiers refer to the same Solana network.
|
|
62
|
+
*
|
|
63
|
+
* @category Utils
|
|
64
|
+
* @since v0.6.0
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import { isNetworkEquivalent } from "@synapse-sap/sdk";
|
|
69
|
+
*
|
|
70
|
+
* isNetworkEquivalent("solana:mainnet-beta", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp");
|
|
71
|
+
* // → true
|
|
72
|
+
*
|
|
73
|
+
* isNetworkEquivalent("solana:devnet", "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1");
|
|
74
|
+
* // → true
|
|
75
|
+
*
|
|
76
|
+
* isNetworkEquivalent("solana:mainnet-beta", "solana:devnet");
|
|
77
|
+
* // → false
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function isNetworkEquivalent(a: string, b: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* @name getNetworkGenesisHash
|
|
83
|
+
* @description Get the genesis-hash form of a network identifier.
|
|
84
|
+
* Returns the genesis-hash variant for known networks, or the input as-is.
|
|
85
|
+
*
|
|
86
|
+
* Useful for agents that require the genesis-hash form (Kamiyo, Helius x402).
|
|
87
|
+
*
|
|
88
|
+
* @param networkId - Any network identifier.
|
|
89
|
+
* @returns The genesis-hash form, or the input if unknown.
|
|
90
|
+
*
|
|
91
|
+
* @category Utils
|
|
92
|
+
* @since v0.6.0
|
|
93
|
+
*/
|
|
94
|
+
export declare function getNetworkGenesisHash(networkId: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* @name getNetworkClusterName
|
|
97
|
+
* @description Get the cluster-name form of a network identifier.
|
|
98
|
+
* Returns the human-readable cluster name for known networks.
|
|
99
|
+
*
|
|
100
|
+
* Useful for providers that accept cluster names (Coinbase, Phantom).
|
|
101
|
+
*
|
|
102
|
+
* @param networkId - Any network identifier.
|
|
103
|
+
* @returns The cluster-name form, or the input if unknown.
|
|
104
|
+
*
|
|
105
|
+
* @category Utils
|
|
106
|
+
* @since v0.6.0
|
|
107
|
+
*/
|
|
108
|
+
export declare function getNetworkClusterName(networkId: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* @name isKnownNetwork
|
|
111
|
+
* @description Check if a network identifier is recognized by the SDK.
|
|
112
|
+
*
|
|
113
|
+
* @param networkId - The network identifier to check.
|
|
114
|
+
* @returns `true` if the identifier maps to a known Solana network.
|
|
115
|
+
*
|
|
116
|
+
* @category Utils
|
|
117
|
+
* @since v0.6.0
|
|
118
|
+
*/
|
|
119
|
+
export declare function isKnownNetwork(networkId: string): boolean;
|
|
120
|
+
//# sourceMappingURL=network-normalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-normalizer.d.ts","sourceRoot":"","sources":["../../../src/utils/network-normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAsDrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,MAAM,CAcrE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CA2BjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAS/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAS/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAIzD"}
|