@agentcash/discovery 0.1.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/.claude/CLAUDE.md +24 -0
- package/AGENTS.md +23 -0
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/bin/discovery.js +6 -0
- package/dist/cli.cjs +1825 -0
- package/dist/cli.d.cts +15 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.js +1798 -0
- package/dist/flags.cjs +44 -0
- package/dist/flags.d.cts +6 -0
- package/dist/flags.d.ts +6 -0
- package/dist/flags.js +17 -0
- package/dist/index.cjs +1448 -0
- package/dist/index.d.cts +106 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +1415 -0
- package/dist/schemas.cjs +58 -0
- package/dist/schemas.d.cts +40 -0
- package/dist/schemas.d.ts +40 -0
- package/dist/schemas.js +28 -0
- package/package.json +95 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { CompatibilityMode } from './flags.cjs';
|
|
2
|
+
export { DEFAULT_COMPAT_MODE, LEGACY_SUNSET_DATE, STRICT_ESCALATION_CODES } from './flags.cjs';
|
|
3
|
+
|
|
4
|
+
type DiscoveryStage = 'override' | 'openapi' | 'well-known/x402' | 'dns/_x402' | 'interop/mpp' | 'probe';
|
|
5
|
+
type WarningSeverity = 'error' | 'warn' | 'info';
|
|
6
|
+
type TrustTier = 'unverified' | 'origin_hosted' | 'ownership_verified' | 'runtime_verified';
|
|
7
|
+
type AuthMode = 'paid' | 'siwx' | 'apiKey' | 'unprotected';
|
|
8
|
+
type PricingMode = 'fixed' | 'range' | 'quote';
|
|
9
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'TRACE';
|
|
10
|
+
interface DiscoveryWarning {
|
|
11
|
+
code: string;
|
|
12
|
+
severity: WarningSeverity;
|
|
13
|
+
message: string;
|
|
14
|
+
hint?: string;
|
|
15
|
+
stage?: DiscoveryStage;
|
|
16
|
+
resourceKey?: string;
|
|
17
|
+
}
|
|
18
|
+
interface PricingHint {
|
|
19
|
+
pricingMode: PricingMode;
|
|
20
|
+
price?: string;
|
|
21
|
+
minPrice?: string;
|
|
22
|
+
maxPrice?: string;
|
|
23
|
+
}
|
|
24
|
+
interface ResourceLinks {
|
|
25
|
+
openapiUrl?: string;
|
|
26
|
+
wellKnownUrl?: string;
|
|
27
|
+
discoveryUrl?: string;
|
|
28
|
+
llmsTxtUrl?: string;
|
|
29
|
+
}
|
|
30
|
+
interface DiscoveryResource {
|
|
31
|
+
resourceKey: string;
|
|
32
|
+
origin: string;
|
|
33
|
+
method: HttpMethod;
|
|
34
|
+
path: string;
|
|
35
|
+
source: DiscoveryStage;
|
|
36
|
+
verified: boolean;
|
|
37
|
+
protocolHints?: string[];
|
|
38
|
+
priceHint?: string;
|
|
39
|
+
pricing?: PricingHint;
|
|
40
|
+
authHint?: AuthMode;
|
|
41
|
+
summary?: string;
|
|
42
|
+
confidence?: number;
|
|
43
|
+
trustTier?: TrustTier;
|
|
44
|
+
links?: ResourceLinks;
|
|
45
|
+
}
|
|
46
|
+
interface StageTrace {
|
|
47
|
+
stage: DiscoveryStage;
|
|
48
|
+
attempted: boolean;
|
|
49
|
+
valid: boolean;
|
|
50
|
+
resourceCount: number;
|
|
51
|
+
durationMs: number;
|
|
52
|
+
warnings: DiscoveryWarning[];
|
|
53
|
+
links?: ResourceLinks;
|
|
54
|
+
}
|
|
55
|
+
interface RawSources {
|
|
56
|
+
openapi?: unknown;
|
|
57
|
+
llmsTxt?: string;
|
|
58
|
+
wellKnownX402?: unknown[];
|
|
59
|
+
dnsRecords?: string[];
|
|
60
|
+
interopMpp?: unknown;
|
|
61
|
+
}
|
|
62
|
+
interface DiscoverResult {
|
|
63
|
+
origin: string;
|
|
64
|
+
resources: DiscoveryResource[];
|
|
65
|
+
warnings: DiscoveryWarning[];
|
|
66
|
+
compatMode: CompatibilityMode;
|
|
67
|
+
upgradeSuggested: boolean;
|
|
68
|
+
upgradeReasons: string[];
|
|
69
|
+
selectedStage?: DiscoveryStage;
|
|
70
|
+
}
|
|
71
|
+
interface DiscoverDetailedResult extends DiscoverResult {
|
|
72
|
+
trace: StageTrace[];
|
|
73
|
+
resourceWarnings: Record<string, DiscoveryWarning[]>;
|
|
74
|
+
rawSources?: RawSources;
|
|
75
|
+
}
|
|
76
|
+
type DiscoveryFetcher = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
77
|
+
type TxtResolver = (fqdn: string) => Promise<string[]>;
|
|
78
|
+
interface ProbeCandidate {
|
|
79
|
+
path: string;
|
|
80
|
+
methods?: HttpMethod[];
|
|
81
|
+
}
|
|
82
|
+
interface DiscoverOptions {
|
|
83
|
+
target: string;
|
|
84
|
+
compatMode?: CompatibilityMode;
|
|
85
|
+
overrideUrls?: string[];
|
|
86
|
+
fetcher?: DiscoveryFetcher;
|
|
87
|
+
txtResolver?: TxtResolver;
|
|
88
|
+
probeCandidates?: ProbeCandidate[];
|
|
89
|
+
headers?: Record<string, string>;
|
|
90
|
+
signal?: AbortSignal;
|
|
91
|
+
}
|
|
92
|
+
interface DiscoverDetailedOptions extends DiscoverOptions {
|
|
93
|
+
rawView?: 'none' | 'full';
|
|
94
|
+
includeInteropMpp?: boolean;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
declare const UPGRADE_WARNING_CODES: readonly ["LEGACY_WELL_KNOWN_USED", "LEGACY_DNS_USED", "LEGACY_DNS_PLAIN_URL", "LEGACY_INSTRUCTIONS_USED", "LEGACY_OWNERSHIP_PROOFS_USED", "OPENAPI_AUTH_MODE_MISSING", "OPENAPI_TOP_LEVEL_INVALID"];
|
|
98
|
+
declare function computeUpgradeSignal(warnings: DiscoveryWarning[]): {
|
|
99
|
+
upgradeSuggested: boolean;
|
|
100
|
+
upgradeReasons: string[];
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
declare function discover(options: DiscoverOptions): Promise<DiscoverResult>;
|
|
104
|
+
declare function discoverDetailed(options: DiscoverDetailedOptions): Promise<DiscoverDetailedResult>;
|
|
105
|
+
|
|
106
|
+
export { type AuthMode, CompatibilityMode, type DiscoverDetailedOptions, type DiscoverDetailedResult, type DiscoverOptions, type DiscoverResult, type DiscoveryFetcher, type DiscoveryResource, type DiscoveryStage, type DiscoveryWarning, type HttpMethod, type PricingMode, type ProbeCandidate, type RawSources, type StageTrace, type TrustTier, type TxtResolver, UPGRADE_WARNING_CODES, type WarningSeverity, computeUpgradeSignal, discover, discoverDetailed };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { CompatibilityMode } from './flags.js';
|
|
2
|
+
export { DEFAULT_COMPAT_MODE, LEGACY_SUNSET_DATE, STRICT_ESCALATION_CODES } from './flags.js';
|
|
3
|
+
|
|
4
|
+
type DiscoveryStage = 'override' | 'openapi' | 'well-known/x402' | 'dns/_x402' | 'interop/mpp' | 'probe';
|
|
5
|
+
type WarningSeverity = 'error' | 'warn' | 'info';
|
|
6
|
+
type TrustTier = 'unverified' | 'origin_hosted' | 'ownership_verified' | 'runtime_verified';
|
|
7
|
+
type AuthMode = 'paid' | 'siwx' | 'apiKey' | 'unprotected';
|
|
8
|
+
type PricingMode = 'fixed' | 'range' | 'quote';
|
|
9
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'TRACE';
|
|
10
|
+
interface DiscoveryWarning {
|
|
11
|
+
code: string;
|
|
12
|
+
severity: WarningSeverity;
|
|
13
|
+
message: string;
|
|
14
|
+
hint?: string;
|
|
15
|
+
stage?: DiscoveryStage;
|
|
16
|
+
resourceKey?: string;
|
|
17
|
+
}
|
|
18
|
+
interface PricingHint {
|
|
19
|
+
pricingMode: PricingMode;
|
|
20
|
+
price?: string;
|
|
21
|
+
minPrice?: string;
|
|
22
|
+
maxPrice?: string;
|
|
23
|
+
}
|
|
24
|
+
interface ResourceLinks {
|
|
25
|
+
openapiUrl?: string;
|
|
26
|
+
wellKnownUrl?: string;
|
|
27
|
+
discoveryUrl?: string;
|
|
28
|
+
llmsTxtUrl?: string;
|
|
29
|
+
}
|
|
30
|
+
interface DiscoveryResource {
|
|
31
|
+
resourceKey: string;
|
|
32
|
+
origin: string;
|
|
33
|
+
method: HttpMethod;
|
|
34
|
+
path: string;
|
|
35
|
+
source: DiscoveryStage;
|
|
36
|
+
verified: boolean;
|
|
37
|
+
protocolHints?: string[];
|
|
38
|
+
priceHint?: string;
|
|
39
|
+
pricing?: PricingHint;
|
|
40
|
+
authHint?: AuthMode;
|
|
41
|
+
summary?: string;
|
|
42
|
+
confidence?: number;
|
|
43
|
+
trustTier?: TrustTier;
|
|
44
|
+
links?: ResourceLinks;
|
|
45
|
+
}
|
|
46
|
+
interface StageTrace {
|
|
47
|
+
stage: DiscoveryStage;
|
|
48
|
+
attempted: boolean;
|
|
49
|
+
valid: boolean;
|
|
50
|
+
resourceCount: number;
|
|
51
|
+
durationMs: number;
|
|
52
|
+
warnings: DiscoveryWarning[];
|
|
53
|
+
links?: ResourceLinks;
|
|
54
|
+
}
|
|
55
|
+
interface RawSources {
|
|
56
|
+
openapi?: unknown;
|
|
57
|
+
llmsTxt?: string;
|
|
58
|
+
wellKnownX402?: unknown[];
|
|
59
|
+
dnsRecords?: string[];
|
|
60
|
+
interopMpp?: unknown;
|
|
61
|
+
}
|
|
62
|
+
interface DiscoverResult {
|
|
63
|
+
origin: string;
|
|
64
|
+
resources: DiscoveryResource[];
|
|
65
|
+
warnings: DiscoveryWarning[];
|
|
66
|
+
compatMode: CompatibilityMode;
|
|
67
|
+
upgradeSuggested: boolean;
|
|
68
|
+
upgradeReasons: string[];
|
|
69
|
+
selectedStage?: DiscoveryStage;
|
|
70
|
+
}
|
|
71
|
+
interface DiscoverDetailedResult extends DiscoverResult {
|
|
72
|
+
trace: StageTrace[];
|
|
73
|
+
resourceWarnings: Record<string, DiscoveryWarning[]>;
|
|
74
|
+
rawSources?: RawSources;
|
|
75
|
+
}
|
|
76
|
+
type DiscoveryFetcher = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
77
|
+
type TxtResolver = (fqdn: string) => Promise<string[]>;
|
|
78
|
+
interface ProbeCandidate {
|
|
79
|
+
path: string;
|
|
80
|
+
methods?: HttpMethod[];
|
|
81
|
+
}
|
|
82
|
+
interface DiscoverOptions {
|
|
83
|
+
target: string;
|
|
84
|
+
compatMode?: CompatibilityMode;
|
|
85
|
+
overrideUrls?: string[];
|
|
86
|
+
fetcher?: DiscoveryFetcher;
|
|
87
|
+
txtResolver?: TxtResolver;
|
|
88
|
+
probeCandidates?: ProbeCandidate[];
|
|
89
|
+
headers?: Record<string, string>;
|
|
90
|
+
signal?: AbortSignal;
|
|
91
|
+
}
|
|
92
|
+
interface DiscoverDetailedOptions extends DiscoverOptions {
|
|
93
|
+
rawView?: 'none' | 'full';
|
|
94
|
+
includeInteropMpp?: boolean;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
declare const UPGRADE_WARNING_CODES: readonly ["LEGACY_WELL_KNOWN_USED", "LEGACY_DNS_USED", "LEGACY_DNS_PLAIN_URL", "LEGACY_INSTRUCTIONS_USED", "LEGACY_OWNERSHIP_PROOFS_USED", "OPENAPI_AUTH_MODE_MISSING", "OPENAPI_TOP_LEVEL_INVALID"];
|
|
98
|
+
declare function computeUpgradeSignal(warnings: DiscoveryWarning[]): {
|
|
99
|
+
upgradeSuggested: boolean;
|
|
100
|
+
upgradeReasons: string[];
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
declare function discover(options: DiscoverOptions): Promise<DiscoverResult>;
|
|
104
|
+
declare function discoverDetailed(options: DiscoverDetailedOptions): Promise<DiscoverDetailedResult>;
|
|
105
|
+
|
|
106
|
+
export { type AuthMode, CompatibilityMode, type DiscoverDetailedOptions, type DiscoverDetailedResult, type DiscoverOptions, type DiscoverResult, type DiscoveryFetcher, type DiscoveryResource, type DiscoveryStage, type DiscoveryWarning, type HttpMethod, type PricingMode, type ProbeCandidate, type RawSources, type StageTrace, type TrustTier, type TxtResolver, UPGRADE_WARNING_CODES, type WarningSeverity, computeUpgradeSignal, discover, discoverDetailed };
|