aixyz 0.8.0 → 0.10.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/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- require("@aixyz/cli/bin");
2
+ import "@aixyz/cli/bin";
package/config.ts CHANGED
@@ -1 +1,3 @@
1
- export * from "@aixyz/config";
1
+ export { getAixyzConfigRuntime } from "@aixyz/config";
2
+
3
+ export type { AixyzConfig, AixyzConfigRuntime, Network } from "@aixyz/config";
package/erc-8004.ts ADDED
@@ -0,0 +1,55 @@
1
+ import {
2
+ AgentRegistrationFile,
3
+ Service,
4
+ RegistrationEntry,
5
+ TrustMechanism,
6
+ } from "@aixyz/erc-8004/schemas/registration";
7
+
8
+ /**
9
+ * ERC-8004 Agent Registration File
10
+ * Used for registering agents on the MCP and other ERC-8004 compliant platforms
11
+ */
12
+ export type ERC8004Registration = Omit<
13
+ AgentRegistrationFile,
14
+ "type" | "name" | "description" | "image" | "services" | "registrations" | "supportedTrust" | "active" | "x402support"
15
+ > & {
16
+ /**
17
+ * Defaults to `"https://eips.ethereum.org/EIPS/eip-8004#registration-v1"` if not specified.
18
+ */
19
+ type?: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1";
20
+ /**
21
+ * Defaults to `aixyz.config.ts`.`name`.
22
+ */
23
+ name?: string;
24
+ /**
25
+ * Defaults to `aixyz.config.ts`.`description`.
26
+ */
27
+ description?: string;
28
+ /**
29
+ * Defaults to `aixyz.config.ts`.`url` + `/icon.png`.
30
+ */
31
+ image?: string;
32
+ /**
33
+ * Array of service endpoints. Examples: MCP server, A2A endpoint, web interface, OASF spec.
34
+ * Automatically generated by the CLI if not specified.
35
+ */
36
+ services?: Service[];
37
+ /**
38
+ * Registration entry, also links to agent registrations on other chains
39
+ * Format: { agentId: "123", agentRegistry: "eip155:1:0x..." }
40
+ * Will be automatically be populated during `aixyz erc-8004 register`
41
+ */
42
+ registrations?: RegistrationEntry[];
43
+ /**
44
+ * Defaults to `aixyz.config.ts`.`supportedTrust`.
45
+ */
46
+ supportedTrust?: TrustMechanism[];
47
+ /**
48
+ * Defaults to `true`.
49
+ */
50
+ active?: boolean;
51
+ /**
52
+ * Defaults to `true`.
53
+ */
54
+ x402support?: boolean;
55
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aixyz",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Payment-native SDK for AI Agent",
5
5
  "keywords": [
6
6
  "ai",
@@ -23,8 +23,9 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@a2a-js/sdk": "^0.3.10",
26
- "@aixyz/cli": "0.8.0",
27
- "@aixyz/config": "0.8.0",
26
+ "@aixyz/cli": "0.10.0",
27
+ "@aixyz/config": "0.10.0",
28
+ "@aixyz/erc-8004": "0.10.0",
28
29
  "@modelcontextprotocol/sdk": "^1.26.0",
29
30
  "@next/env": "^16.1.6",
30
31
  "@x402/core": "^2.3.1",
@@ -0,0 +1,71 @@
1
+ import { z } from "zod";
2
+ import { getAixyzConfigRuntime } from "@aixyz/config";
3
+ import {
4
+ ERC8004_REGISTRATION_TYPE,
5
+ ServiceSchema,
6
+ StrictAgentRegistrationFile,
7
+ StrictAgentRegistrationFileSchema,
8
+ } from "@aixyz/erc-8004/schemas/registration";
9
+ import { AixyzServer } from "../index";
10
+
11
+ export function getAgentRegistrationFile(
12
+ data: unknown,
13
+ options: {
14
+ mcp: boolean;
15
+ a2a: boolean;
16
+ },
17
+ ): StrictAgentRegistrationFile {
18
+ const config = getAixyzConfigRuntime();
19
+ const services: StrictAgentRegistrationFile["services"] = [];
20
+
21
+ if (options.a2a) {
22
+ services.push({
23
+ name: "A2A",
24
+ endpoint: new URL("/.well-known/agent-card.json", config.url).toString(),
25
+ version: "0.3.0",
26
+ });
27
+ }
28
+
29
+ if (options.mcp) {
30
+ services.push({
31
+ name: "MCP",
32
+ endpoint: new URL("/mcp", config.url).toString(),
33
+ version: "2025-06-18",
34
+ });
35
+ }
36
+
37
+ const withDefault = StrictAgentRegistrationFileSchema.extend({
38
+ type: z.literal(ERC8004_REGISTRATION_TYPE).default(ERC8004_REGISTRATION_TYPE),
39
+ name: z.string().default(config.name),
40
+ description: z.string().default(config.description),
41
+ image: z.string().default(new URL("/icon.png", config.url).toString()),
42
+ services: z.array(ServiceSchema).min(1).default(services),
43
+ active: z.boolean().default(true),
44
+ x402support: z.boolean().default(true),
45
+ });
46
+
47
+ return withDefault.parse(data);
48
+ }
49
+
50
+ export function useERC8004(
51
+ server: AixyzServer,
52
+ exports: {
53
+ default: unknown;
54
+ options: {
55
+ mcp: boolean;
56
+ a2a: boolean;
57
+ };
58
+ },
59
+ ): void {
60
+ const file = getAgentRegistrationFile(exports.default, exports.options);
61
+
62
+ // GET /_aixyz/erc-8004.json
63
+ server.express.get("/_aixyz/erc-8004.json", (_req, res) => {
64
+ res.json(file);
65
+ });
66
+
67
+ // GET /.well-known/erc-8004.json
68
+ server.express.get("/.well-known/erc-8004.json", (_req, res) => {
69
+ res.json(file);
70
+ });
71
+ }
package/server/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { getAixyzConfig, Network } from "../config";
1
+ import { getAixyzConfig, Network } from "@aixyz/config";
2
2
  import initExpress from "express";
3
3
  import { FacilitatorClient, x402ResourceServer } from "@x402/core/server";
4
4
  import { paymentMiddleware, PaymentRequirements } from "@x402/express";