@agentcash/discovery 0.1.2 → 0.1.4
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/README.md +20 -0
- package/dist/cli.cjs +40 -31
- package/dist/cli.js +40 -31
- package/dist/index.cjs +528 -65
- package/dist/index.d.cts +85 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.js +524 -64
- package/package.json +6 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,90 @@
|
|
|
1
1
|
import { CompatibilityMode } from './flags.cjs';
|
|
2
2
|
export { DEFAULT_COMPAT_MODE, LEGACY_SUNSET_DATE, STRICT_ESCALATION_CODES } from './flags.cjs';
|
|
3
3
|
|
|
4
|
+
declare const VALIDATION_CODES: {
|
|
5
|
+
readonly COINBASE_SCHEMA_INVALID: "COINBASE_SCHEMA_INVALID";
|
|
6
|
+
readonly X402_NOT_OBJECT: "X402_NOT_OBJECT";
|
|
7
|
+
readonly X402_VERSION_MISSING: "X402_VERSION_MISSING";
|
|
8
|
+
readonly X402_VERSION_UNSUPPORTED: "X402_VERSION_UNSUPPORTED";
|
|
9
|
+
readonly X402_ACCEPTS_MISSING: "X402_ACCEPTS_MISSING";
|
|
10
|
+
readonly X402_ACCEPTS_INVALID: "X402_ACCEPTS_INVALID";
|
|
11
|
+
readonly X402_ACCEPTS_EMPTY: "X402_ACCEPTS_EMPTY";
|
|
12
|
+
readonly X402_ACCEPT_ENTRY_INVALID: "X402_ACCEPT_ENTRY_INVALID";
|
|
13
|
+
readonly NETWORK_CAIP2_INVALID: "NETWORK_CAIP2_INVALID";
|
|
14
|
+
readonly NETWORK_EIP155_REFERENCE_INVALID: "NETWORK_EIP155_REFERENCE_INVALID";
|
|
15
|
+
readonly NETWORK_SOLANA_ALIAS_INVALID: "NETWORK_SOLANA_ALIAS_INVALID";
|
|
16
|
+
readonly NETWORK_SOLANA_ALIAS_COMPAT: "NETWORK_SOLANA_ALIAS_COMPAT";
|
|
17
|
+
readonly NETWORK_REFERENCE_UNKNOWN: "NETWORK_REFERENCE_UNKNOWN";
|
|
18
|
+
readonly SCHEMA_INPUT_MISSING: "SCHEMA_INPUT_MISSING";
|
|
19
|
+
readonly SCHEMA_OUTPUT_MISSING: "SCHEMA_OUTPUT_MISSING";
|
|
20
|
+
readonly METADATA_TITLE_MISSING: "METADATA_TITLE_MISSING";
|
|
21
|
+
readonly METADATA_DESCRIPTION_MISSING: "METADATA_DESCRIPTION_MISSING";
|
|
22
|
+
readonly METADATA_FAVICON_MISSING: "METADATA_FAVICON_MISSING";
|
|
23
|
+
readonly METADATA_OG_IMAGE_MISSING: "METADATA_OG_IMAGE_MISSING";
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type ValidationSeverity = 'error' | 'warn' | 'info';
|
|
27
|
+
type ValidationStage = 'payment_required' | 'openapi' | 'metadata' | 'compat' | 'runtime_probe';
|
|
28
|
+
interface ValidationIssue {
|
|
29
|
+
code: string;
|
|
30
|
+
severity: ValidationSeverity;
|
|
31
|
+
message: string;
|
|
32
|
+
hint?: string;
|
|
33
|
+
path?: string;
|
|
34
|
+
expected?: string;
|
|
35
|
+
actual?: string;
|
|
36
|
+
docsUrl?: string;
|
|
37
|
+
stage: ValidationStage;
|
|
38
|
+
}
|
|
39
|
+
interface MetadataPreview {
|
|
40
|
+
title?: string | null;
|
|
41
|
+
description?: string | null;
|
|
42
|
+
favicon?: string | null;
|
|
43
|
+
ogImages?: Array<{
|
|
44
|
+
url?: string | null;
|
|
45
|
+
} | string> | null;
|
|
46
|
+
}
|
|
47
|
+
interface NormalizedAccept {
|
|
48
|
+
index: number;
|
|
49
|
+
network: string;
|
|
50
|
+
networkRaw: string;
|
|
51
|
+
scheme?: string;
|
|
52
|
+
asset?: string;
|
|
53
|
+
payTo?: string;
|
|
54
|
+
amount?: string;
|
|
55
|
+
maxTimeoutSeconds?: number;
|
|
56
|
+
}
|
|
57
|
+
interface NormalizedPaymentRequired {
|
|
58
|
+
version: 1 | 2;
|
|
59
|
+
accepts: NormalizedAccept[];
|
|
60
|
+
hasInputSchema: boolean;
|
|
61
|
+
hasOutputSchema: boolean;
|
|
62
|
+
}
|
|
63
|
+
interface ValidatePaymentRequiredOptions {
|
|
64
|
+
compatMode?: CompatibilityMode;
|
|
65
|
+
requireInputSchema?: boolean;
|
|
66
|
+
requireOutputSchema?: boolean;
|
|
67
|
+
metadata?: MetadataPreview;
|
|
68
|
+
}
|
|
69
|
+
interface ValidationSummary {
|
|
70
|
+
errorCount: number;
|
|
71
|
+
warnCount: number;
|
|
72
|
+
infoCount: number;
|
|
73
|
+
byCode: Record<string, number>;
|
|
74
|
+
}
|
|
75
|
+
interface ValidatePaymentRequiredDetailedResult {
|
|
76
|
+
valid: boolean;
|
|
77
|
+
version?: 1 | 2;
|
|
78
|
+
parsed?: Record<string, unknown>;
|
|
79
|
+
normalized?: NormalizedPaymentRequired;
|
|
80
|
+
issues: ValidationIssue[];
|
|
81
|
+
summary: ValidationSummary;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare function evaluateMetadataCompleteness(metadata: MetadataPreview): ValidationIssue[];
|
|
85
|
+
|
|
86
|
+
declare function validatePaymentRequiredDetailed(payload: unknown, options?: ValidatePaymentRequiredOptions): ValidatePaymentRequiredDetailedResult;
|
|
87
|
+
|
|
4
88
|
type DiscoveryStage = 'override' | 'openapi' | 'well-known/x402' | 'dns/_x402' | 'interop/mpp' | 'probe';
|
|
5
89
|
type WarningSeverity = 'error' | 'warn' | 'info';
|
|
6
90
|
type TrustTier = 'unverified' | 'origin_hosted' | 'ownership_verified' | 'runtime_verified';
|
|
@@ -289,4 +373,4 @@ declare function defaultHarnessProbeCandidates(report: ContextHarnessReport): Pr
|
|
|
289
373
|
declare function discover(options: DiscoverOptions): Promise<DiscoverResult>;
|
|
290
374
|
declare function discoverDetailed(options: DiscoverDetailedOptions): Promise<DiscoverDetailedResult>;
|
|
291
375
|
|
|
292
|
-
export { type AuthMode, CompatibilityMode, type ContextHarnessL0, type ContextHarnessL1, type ContextHarnessL2, type ContextHarnessL2Entry, type ContextHarnessL3, type ContextHarnessL4, type ContextHarnessL5, type ContextHarnessReport, type DiscoverDetailedOptions, type DiscoverDetailedResult, type DiscoverForMcpFailure, type DiscoverForMcpOptions, type DiscoverForMcpResult, type DiscoverForMcpSuccess, type DiscoverOptions, type DiscoverResult, type DiscoveryFetcher, type DiscoveryResource, type DiscoveryStage, type DiscoveryWarning, type EndpointMethodAdvisory, type HarnessClientId, type HarnessClientProfile, type HttpMethod, type InspectEndpointForMcpFailure, type InspectEndpointForMcpOptions, type InspectEndpointForMcpResult, type InspectEndpointForMcpSuccess, type PricingMode, type ProbeCandidate, type RawSources, type StageTrace, type TrustTier, type TxtResolver, UPGRADE_WARNING_CODES, type WarningSeverity, auditContextHarness, buildContextHarnessReport, computeUpgradeSignal, defaultHarnessProbeCandidates, discover, discoverDetailed, discoverForMcp, getHarnessClientProfile, inspectEndpointForMcp, listHarnessClientProfiles };
|
|
376
|
+
export { type AuthMode, CompatibilityMode, type ContextHarnessL0, type ContextHarnessL1, type ContextHarnessL2, type ContextHarnessL2Entry, type ContextHarnessL3, type ContextHarnessL4, type ContextHarnessL5, type ContextHarnessReport, type DiscoverDetailedOptions, type DiscoverDetailedResult, type DiscoverForMcpFailure, type DiscoverForMcpOptions, type DiscoverForMcpResult, type DiscoverForMcpSuccess, type DiscoverOptions, type DiscoverResult, type DiscoveryFetcher, type DiscoveryResource, type DiscoveryStage, type DiscoveryWarning, type EndpointMethodAdvisory, type HarnessClientId, type HarnessClientProfile, type HttpMethod, type InspectEndpointForMcpFailure, type InspectEndpointForMcpOptions, type InspectEndpointForMcpResult, type InspectEndpointForMcpSuccess, type MetadataPreview, type NormalizedAccept, type NormalizedPaymentRequired, type PricingMode, type ProbeCandidate, type RawSources, type StageTrace, type TrustTier, type TxtResolver, UPGRADE_WARNING_CODES, VALIDATION_CODES, type ValidatePaymentRequiredDetailedResult, type ValidatePaymentRequiredOptions, type ValidationIssue, type ValidationSeverity, type ValidationStage, type ValidationSummary, type WarningSeverity, auditContextHarness, buildContextHarnessReport, computeUpgradeSignal, defaultHarnessProbeCandidates, discover, discoverDetailed, discoverForMcp, evaluateMetadataCompleteness, getHarnessClientProfile, inspectEndpointForMcp, listHarnessClientProfiles, validatePaymentRequiredDetailed };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,90 @@
|
|
|
1
1
|
import { CompatibilityMode } from './flags.js';
|
|
2
2
|
export { DEFAULT_COMPAT_MODE, LEGACY_SUNSET_DATE, STRICT_ESCALATION_CODES } from './flags.js';
|
|
3
3
|
|
|
4
|
+
declare const VALIDATION_CODES: {
|
|
5
|
+
readonly COINBASE_SCHEMA_INVALID: "COINBASE_SCHEMA_INVALID";
|
|
6
|
+
readonly X402_NOT_OBJECT: "X402_NOT_OBJECT";
|
|
7
|
+
readonly X402_VERSION_MISSING: "X402_VERSION_MISSING";
|
|
8
|
+
readonly X402_VERSION_UNSUPPORTED: "X402_VERSION_UNSUPPORTED";
|
|
9
|
+
readonly X402_ACCEPTS_MISSING: "X402_ACCEPTS_MISSING";
|
|
10
|
+
readonly X402_ACCEPTS_INVALID: "X402_ACCEPTS_INVALID";
|
|
11
|
+
readonly X402_ACCEPTS_EMPTY: "X402_ACCEPTS_EMPTY";
|
|
12
|
+
readonly X402_ACCEPT_ENTRY_INVALID: "X402_ACCEPT_ENTRY_INVALID";
|
|
13
|
+
readonly NETWORK_CAIP2_INVALID: "NETWORK_CAIP2_INVALID";
|
|
14
|
+
readonly NETWORK_EIP155_REFERENCE_INVALID: "NETWORK_EIP155_REFERENCE_INVALID";
|
|
15
|
+
readonly NETWORK_SOLANA_ALIAS_INVALID: "NETWORK_SOLANA_ALIAS_INVALID";
|
|
16
|
+
readonly NETWORK_SOLANA_ALIAS_COMPAT: "NETWORK_SOLANA_ALIAS_COMPAT";
|
|
17
|
+
readonly NETWORK_REFERENCE_UNKNOWN: "NETWORK_REFERENCE_UNKNOWN";
|
|
18
|
+
readonly SCHEMA_INPUT_MISSING: "SCHEMA_INPUT_MISSING";
|
|
19
|
+
readonly SCHEMA_OUTPUT_MISSING: "SCHEMA_OUTPUT_MISSING";
|
|
20
|
+
readonly METADATA_TITLE_MISSING: "METADATA_TITLE_MISSING";
|
|
21
|
+
readonly METADATA_DESCRIPTION_MISSING: "METADATA_DESCRIPTION_MISSING";
|
|
22
|
+
readonly METADATA_FAVICON_MISSING: "METADATA_FAVICON_MISSING";
|
|
23
|
+
readonly METADATA_OG_IMAGE_MISSING: "METADATA_OG_IMAGE_MISSING";
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type ValidationSeverity = 'error' | 'warn' | 'info';
|
|
27
|
+
type ValidationStage = 'payment_required' | 'openapi' | 'metadata' | 'compat' | 'runtime_probe';
|
|
28
|
+
interface ValidationIssue {
|
|
29
|
+
code: string;
|
|
30
|
+
severity: ValidationSeverity;
|
|
31
|
+
message: string;
|
|
32
|
+
hint?: string;
|
|
33
|
+
path?: string;
|
|
34
|
+
expected?: string;
|
|
35
|
+
actual?: string;
|
|
36
|
+
docsUrl?: string;
|
|
37
|
+
stage: ValidationStage;
|
|
38
|
+
}
|
|
39
|
+
interface MetadataPreview {
|
|
40
|
+
title?: string | null;
|
|
41
|
+
description?: string | null;
|
|
42
|
+
favicon?: string | null;
|
|
43
|
+
ogImages?: Array<{
|
|
44
|
+
url?: string | null;
|
|
45
|
+
} | string> | null;
|
|
46
|
+
}
|
|
47
|
+
interface NormalizedAccept {
|
|
48
|
+
index: number;
|
|
49
|
+
network: string;
|
|
50
|
+
networkRaw: string;
|
|
51
|
+
scheme?: string;
|
|
52
|
+
asset?: string;
|
|
53
|
+
payTo?: string;
|
|
54
|
+
amount?: string;
|
|
55
|
+
maxTimeoutSeconds?: number;
|
|
56
|
+
}
|
|
57
|
+
interface NormalizedPaymentRequired {
|
|
58
|
+
version: 1 | 2;
|
|
59
|
+
accepts: NormalizedAccept[];
|
|
60
|
+
hasInputSchema: boolean;
|
|
61
|
+
hasOutputSchema: boolean;
|
|
62
|
+
}
|
|
63
|
+
interface ValidatePaymentRequiredOptions {
|
|
64
|
+
compatMode?: CompatibilityMode;
|
|
65
|
+
requireInputSchema?: boolean;
|
|
66
|
+
requireOutputSchema?: boolean;
|
|
67
|
+
metadata?: MetadataPreview;
|
|
68
|
+
}
|
|
69
|
+
interface ValidationSummary {
|
|
70
|
+
errorCount: number;
|
|
71
|
+
warnCount: number;
|
|
72
|
+
infoCount: number;
|
|
73
|
+
byCode: Record<string, number>;
|
|
74
|
+
}
|
|
75
|
+
interface ValidatePaymentRequiredDetailedResult {
|
|
76
|
+
valid: boolean;
|
|
77
|
+
version?: 1 | 2;
|
|
78
|
+
parsed?: Record<string, unknown>;
|
|
79
|
+
normalized?: NormalizedPaymentRequired;
|
|
80
|
+
issues: ValidationIssue[];
|
|
81
|
+
summary: ValidationSummary;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare function evaluateMetadataCompleteness(metadata: MetadataPreview): ValidationIssue[];
|
|
85
|
+
|
|
86
|
+
declare function validatePaymentRequiredDetailed(payload: unknown, options?: ValidatePaymentRequiredOptions): ValidatePaymentRequiredDetailedResult;
|
|
87
|
+
|
|
4
88
|
type DiscoveryStage = 'override' | 'openapi' | 'well-known/x402' | 'dns/_x402' | 'interop/mpp' | 'probe';
|
|
5
89
|
type WarningSeverity = 'error' | 'warn' | 'info';
|
|
6
90
|
type TrustTier = 'unverified' | 'origin_hosted' | 'ownership_verified' | 'runtime_verified';
|
|
@@ -289,4 +373,4 @@ declare function defaultHarnessProbeCandidates(report: ContextHarnessReport): Pr
|
|
|
289
373
|
declare function discover(options: DiscoverOptions): Promise<DiscoverResult>;
|
|
290
374
|
declare function discoverDetailed(options: DiscoverDetailedOptions): Promise<DiscoverDetailedResult>;
|
|
291
375
|
|
|
292
|
-
export { type AuthMode, CompatibilityMode, type ContextHarnessL0, type ContextHarnessL1, type ContextHarnessL2, type ContextHarnessL2Entry, type ContextHarnessL3, type ContextHarnessL4, type ContextHarnessL5, type ContextHarnessReport, type DiscoverDetailedOptions, type DiscoverDetailedResult, type DiscoverForMcpFailure, type DiscoverForMcpOptions, type DiscoverForMcpResult, type DiscoverForMcpSuccess, type DiscoverOptions, type DiscoverResult, type DiscoveryFetcher, type DiscoveryResource, type DiscoveryStage, type DiscoveryWarning, type EndpointMethodAdvisory, type HarnessClientId, type HarnessClientProfile, type HttpMethod, type InspectEndpointForMcpFailure, type InspectEndpointForMcpOptions, type InspectEndpointForMcpResult, type InspectEndpointForMcpSuccess, type PricingMode, type ProbeCandidate, type RawSources, type StageTrace, type TrustTier, type TxtResolver, UPGRADE_WARNING_CODES, type WarningSeverity, auditContextHarness, buildContextHarnessReport, computeUpgradeSignal, defaultHarnessProbeCandidates, discover, discoverDetailed, discoverForMcp, getHarnessClientProfile, inspectEndpointForMcp, listHarnessClientProfiles };
|
|
376
|
+
export { type AuthMode, CompatibilityMode, type ContextHarnessL0, type ContextHarnessL1, type ContextHarnessL2, type ContextHarnessL2Entry, type ContextHarnessL3, type ContextHarnessL4, type ContextHarnessL5, type ContextHarnessReport, type DiscoverDetailedOptions, type DiscoverDetailedResult, type DiscoverForMcpFailure, type DiscoverForMcpOptions, type DiscoverForMcpResult, type DiscoverForMcpSuccess, type DiscoverOptions, type DiscoverResult, type DiscoveryFetcher, type DiscoveryResource, type DiscoveryStage, type DiscoveryWarning, type EndpointMethodAdvisory, type HarnessClientId, type HarnessClientProfile, type HttpMethod, type InspectEndpointForMcpFailure, type InspectEndpointForMcpOptions, type InspectEndpointForMcpResult, type InspectEndpointForMcpSuccess, type MetadataPreview, type NormalizedAccept, type NormalizedPaymentRequired, type PricingMode, type ProbeCandidate, type RawSources, type StageTrace, type TrustTier, type TxtResolver, UPGRADE_WARNING_CODES, VALIDATION_CODES, type ValidatePaymentRequiredDetailedResult, type ValidatePaymentRequiredOptions, type ValidationIssue, type ValidationSeverity, type ValidationStage, type ValidationSummary, type WarningSeverity, auditContextHarness, buildContextHarnessReport, computeUpgradeSignal, defaultHarnessProbeCandidates, discover, discoverDetailed, discoverForMcp, evaluateMetadataCompleteness, getHarnessClientProfile, inspectEndpointForMcp, listHarnessClientProfiles, validatePaymentRequiredDetailed };
|