@agentcash/discovery 0.1.3 → 1.0.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/schemas.js CHANGED
@@ -1,28 +1,81 @@
1
1
  // src/schemas.ts
2
2
  import { z } from "zod";
3
- var AuthModeSchema = z.enum(["paid", "siwx", "apiKey", "unprotected"]);
4
- var PricingModeSchema = z.enum(["fixed", "range", "quote"]);
5
- var AgentcashAuthSchema = z.object({
6
- mode: AuthModeSchema
7
- });
8
- var PaymentInfoSchema = z.object({
9
- protocols: z.array(z.string()).nonempty().optional(),
10
- pricingMode: PricingModeSchema.optional(),
3
+ var OpenApiPaymentInfoSchema = z.object({
4
+ pricingMode: z.enum(["fixed", "range", "quote"]),
11
5
  price: z.string().optional(),
12
6
  minPrice: z.string().optional(),
13
- maxPrice: z.string().optional()
7
+ maxPrice: z.string().optional(),
8
+ protocols: z.array(z.string()).optional()
9
+ });
10
+ var OpenApiOperationSchema = z.object({
11
+ operationId: z.string().optional(),
12
+ summary: z.string().optional(),
13
+ description: z.string().optional(),
14
+ tags: z.array(z.string()).optional(),
15
+ security: z.array(z.record(z.string(), z.array(z.string()))).optional(),
16
+ parameters: z.array(
17
+ z.object({
18
+ in: z.string(),
19
+ name: z.string(),
20
+ schema: z.unknown().optional(),
21
+ required: z.boolean().optional()
22
+ })
23
+ ).optional(),
24
+ requestBody: z.object({
25
+ required: z.boolean().optional(),
26
+ content: z.record(z.string(), z.object({ schema: z.unknown().optional() }))
27
+ }).optional(),
28
+ responses: z.record(z.string(), z.unknown()).optional(),
29
+ "x-payment-info": OpenApiPaymentInfoSchema.optional()
30
+ });
31
+ var OpenApiPathItemSchema = z.object({
32
+ get: OpenApiOperationSchema.optional(),
33
+ post: OpenApiOperationSchema.optional(),
34
+ put: OpenApiOperationSchema.optional(),
35
+ delete: OpenApiOperationSchema.optional(),
36
+ patch: OpenApiOperationSchema.optional(),
37
+ head: OpenApiOperationSchema.optional(),
38
+ options: OpenApiOperationSchema.optional(),
39
+ trace: OpenApiOperationSchema.optional()
40
+ });
41
+ var OpenApiDocSchema = z.object({
42
+ // TODO(zdql): We should inherit a canonical OpenAPI schema and then extend with our types.
43
+ openapi: z.string(),
44
+ info: z.object({
45
+ title: z.string(),
46
+ version: z.string(),
47
+ description: z.string().optional(),
48
+ guidance: z.string().optional()
49
+ }),
50
+ servers: z.array(z.object({ url: z.string() })).optional(),
51
+ tags: z.array(z.object({ name: z.string() })).optional(),
52
+ components: z.object({ securitySchemes: z.record(z.string(), z.unknown()).optional() }).optional(),
53
+ "x-discovery": z.record(z.string(), z.unknown()).optional(),
54
+ paths: z.record(z.string(), OpenApiPathItemSchema)
14
55
  });
15
- var AgentcashProvenanceSchema = z.object({
16
- ownershipProofs: z.array(z.string()).optional()
56
+ var WellKnownDocSchema = z.object({
57
+ version: z.number().optional(),
58
+ resources: z.array(z.string()).default([]),
59
+ mppResources: z.array(z.string()).optional(),
60
+ // isMmmEnabled
61
+ description: z.string().optional(),
62
+ ownershipProofs: z.array(z.string()).optional(),
63
+ instructions: z.string().optional()
17
64
  });
18
- var AgentcashGuidanceSchema = z.object({
19
- llmsTxtUrl: z.string().url().optional()
65
+ var WellKnownParsedSchema = z.object({
66
+ routes: z.array(
67
+ z.object({
68
+ path: z.string(),
69
+ method: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "TRACE"])
70
+ })
71
+ ),
72
+ instructions: z.string().optional()
20
73
  });
21
74
  export {
22
- AgentcashAuthSchema,
23
- AgentcashGuidanceSchema,
24
- AgentcashProvenanceSchema,
25
- AuthModeSchema,
26
- PaymentInfoSchema,
27
- PricingModeSchema
75
+ OpenApiDocSchema,
76
+ OpenApiOperationSchema,
77
+ OpenApiPathItemSchema,
78
+ OpenApiPaymentInfoSchema,
79
+ WellKnownDocSchema,
80
+ WellKnownParsedSchema
28
81
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentcash/discovery",
3
- "version": "0.1.3",
3
+ "version": "1.0.0",
4
4
  "description": "Canonical OpenAPI-first discovery runtime for the agentcash ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -65,14 +65,16 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@x402/core": "^2.5.0",
68
- "table": "^6.9.0",
69
- "zod": "^4.1.13"
68
+ "neverthrow": "^8.2.0",
69
+ "zod": "^4.0.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@changesets/cli": "^2.29.8",
73
73
  "@eslint/js": "^10.0.1",
74
74
  "@types/node": "^22.18.0",
75
+ "@vitest/coverage-v8": "^3.2.4",
75
76
  "eslint": "^10.0.0",
77
+ "knip": "^5.85.0",
76
78
  "prettier": "^3.8.1",
77
79
  "tsup": "^8.5.0",
78
80
  "typescript": "^5.9.2",
@@ -90,6 +92,7 @@
90
92
  "test:watch": "vitest",
91
93
  "audit:registry": "pnpm build && node scripts/audit-registry.mjs",
92
94
  "audit:registry:quick": "pnpm build && node scripts/audit-registry.mjs --origin-limit 50 --resource-limit 500",
93
- "check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm build && pnpm test"
95
+ "knip": "knip",
96
+ "check": "pnpm format:check && pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm test"
94
97
  }
95
98
  }