aixyz 0.1.1 → 0.2.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/accepts.ts +12 -0
- package/package.json +5 -7
- package/server/index.ts +5 -4
package/accepts.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { FacilitatorClient, HTTPFacilitatorClient } from "@x402/core/server";
|
|
2
|
+
import { getFacilitatorClient } from "./facilitator";
|
|
3
|
+
|
|
1
4
|
export type Accepts = AcceptsX402 | AcceptsFree;
|
|
2
5
|
|
|
3
6
|
export type AcceptsX402 = {
|
|
@@ -10,3 +13,12 @@ export type AcceptsX402 = {
|
|
|
10
13
|
export type AcceptsFree = {
|
|
11
14
|
scheme: "free";
|
|
12
15
|
};
|
|
16
|
+
|
|
17
|
+
export type { FacilitatorClient };
|
|
18
|
+
|
|
19
|
+
export { HTTPFacilitatorClient };
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The default facilitator client provided by aixyz.
|
|
23
|
+
*/
|
|
24
|
+
export const facilitator: FacilitatorClient = getFacilitatorClient();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aixyz",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "AI agent framework for building autonomous agents with X402 and ERC-8004 support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -31,18 +31,16 @@
|
|
|
31
31
|
"@aixyz/cli": "workspace:*",
|
|
32
32
|
"@aixyz/config": "workspace:*",
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
34
|
-
"@next/env": "^16.1.6",
|
|
35
34
|
"@x402/core": "^2.3.1",
|
|
36
35
|
"@x402/evm": "^2.3.1",
|
|
37
36
|
"@x402/express": "^2.3.0",
|
|
38
37
|
"@x402/mcp": "^2.3.0",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"zod": "^4.3.6"
|
|
38
|
+
"express": "^5",
|
|
39
|
+
"jose": "^6.1.3",
|
|
40
|
+
"zod": "^4"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
45
|
-
"@types/express": "^5
|
|
43
|
+
"@types/express": "^5",
|
|
46
44
|
"ai": "^6"
|
|
47
45
|
},
|
|
48
46
|
"peerDependencies": {
|
package/server/index.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { getAixyzConfig, Network } from "../config";
|
|
2
2
|
import initExpress from "express";
|
|
3
|
-
import { x402ResourceServer } from "@x402/core/server";
|
|
3
|
+
import { FacilitatorClient, x402ResourceServer } from "@x402/core/server";
|
|
4
4
|
import { paymentMiddleware, PaymentRequirements } from "@x402/express";
|
|
5
|
-
import { getFacilitatorClient } from "../facilitator";
|
|
6
5
|
import { ExactEvmScheme } from "@x402/evm/exact/server";
|
|
7
6
|
import { z } from "zod";
|
|
8
7
|
import { AcceptsX402 } from "../accepts";
|
|
8
|
+
import { getFacilitatorClient } from "../facilitator";
|
|
9
9
|
|
|
10
10
|
// TODO(@fuxingloh): rename to unstable_AixyzApp?
|
|
11
11
|
export class AixyzServer extends x402ResourceServer {
|
|
12
12
|
constructor(
|
|
13
|
+
facilitator: FacilitatorClient = getFacilitatorClient(),
|
|
13
14
|
public config = getAixyzConfig(),
|
|
14
15
|
public express: initExpress.Express = initExpress(),
|
|
15
16
|
) {
|
|
16
|
-
super(
|
|
17
|
+
super(facilitator);
|
|
17
18
|
this.register(config.x402.network as any, new ExactEvmScheme());
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
public unstable_withIndexPage(path = "/") {
|
|
21
|
-
if (!path
|
|
22
|
+
if (!path?.startsWith("/")) {
|
|
22
23
|
throw new Error(`Invalid path: ${path}. Path must be a string starting with "/"`);
|
|
23
24
|
}
|
|
24
25
|
|