@agentcash/discovery 0.1.0 → 0.1.2

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/index.d.cts CHANGED
@@ -94,13 +94,199 @@ interface DiscoverDetailedOptions extends DiscoverOptions {
94
94
  includeInteropMpp?: boolean;
95
95
  }
96
96
 
97
+ type McpFailureCause = 'not_found' | 'network' | 'timeout' | 'parse';
98
+ type McpAuthMode = 'paid' | 'siwx' | 'apiKey' | 'unprotected';
99
+ interface McpOpenApiInfo {
100
+ title: string;
101
+ version?: string;
102
+ description?: string;
103
+ }
104
+ interface McpEndpointSummary {
105
+ path: string;
106
+ method: HttpMethod;
107
+ summary: string;
108
+ price?: string;
109
+ protocols?: string[];
110
+ authMode?: McpAuthMode;
111
+ }
112
+ interface McpGuidance {
113
+ guidanceAvailable: boolean;
114
+ guidanceTokens?: number;
115
+ guidance?: string;
116
+ }
117
+ interface DiscoverForMcpOptions {
118
+ target: string;
119
+ includeGuidance?: boolean;
120
+ guidanceAutoIncludeMaxTokens?: number;
121
+ compatMode?: CompatibilityMode;
122
+ fetcher?: DiscoveryFetcher;
123
+ headers?: Record<string, string>;
124
+ signal?: AbortSignal;
125
+ }
126
+ interface DiscoverForMcpSuccess extends McpGuidance {
127
+ found: true;
128
+ origin: string;
129
+ source: string;
130
+ info?: McpOpenApiInfo;
131
+ endpoints: McpEndpointSummary[];
132
+ warnings: DiscoveryWarning[];
133
+ }
134
+ interface DiscoverForMcpFailure {
135
+ found: false;
136
+ origin: string;
137
+ cause: McpFailureCause;
138
+ message?: string;
139
+ warnings: DiscoveryWarning[];
140
+ }
141
+ type DiscoverForMcpResult = DiscoverForMcpSuccess | DiscoverForMcpFailure;
142
+ interface EndpointMethodAdvisory {
143
+ method: HttpMethod;
144
+ summary?: string;
145
+ estimatedPrice?: string;
146
+ protocols?: string[];
147
+ authMode?: McpAuthMode;
148
+ inputSchema?: Record<string, unknown>;
149
+ operationSchema?: Record<string, unknown>;
150
+ }
151
+ interface InspectEndpointForMcpOptions {
152
+ target: string;
153
+ endpointUrl: string;
154
+ compatMode?: CompatibilityMode;
155
+ fetcher?: DiscoveryFetcher;
156
+ headers?: Record<string, string>;
157
+ signal?: AbortSignal;
158
+ }
159
+ interface InspectEndpointForMcpSuccess {
160
+ found: true;
161
+ origin: string;
162
+ path: string;
163
+ specMethods: HttpMethod[];
164
+ advisories: Partial<Record<HttpMethod, EndpointMethodAdvisory>>;
165
+ warnings: DiscoveryWarning[];
166
+ }
167
+ interface InspectEndpointForMcpFailure {
168
+ found: false;
169
+ origin: string;
170
+ path: string;
171
+ cause: McpFailureCause;
172
+ message?: string;
173
+ warnings: DiscoveryWarning[];
174
+ }
175
+ type InspectEndpointForMcpResult = InspectEndpointForMcpSuccess | InspectEndpointForMcpFailure;
176
+ declare function discoverForMcp(options: DiscoverForMcpOptions): Promise<DiscoverForMcpResult>;
177
+ declare function inspectEndpointForMcp(options: InspectEndpointForMcpOptions): Promise<InspectEndpointForMcpResult>;
178
+
97
179
  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
180
  declare function computeUpgradeSignal(warnings: DiscoveryWarning[]): {
99
181
  upgradeSuggested: boolean;
100
182
  upgradeReasons: string[];
101
183
  };
102
184
 
185
+ type HarnessClientId = 'claude-code' | 'skill-cli' | 'generic-mcp' | 'generic';
186
+ interface HarnessClientProfile {
187
+ id: HarnessClientId;
188
+ label: string;
189
+ surface: 'mcp' | 'skill-cli' | 'generic';
190
+ defaultContextWindowTokens: number;
191
+ zeroHopBudgetPercent: number;
192
+ notes: string;
193
+ }
194
+ interface ContextHarnessL0 {
195
+ layer: 'L0';
196
+ intentTriggers: string[];
197
+ installCommand: string;
198
+ deliverySurfaces: string[];
199
+ summary: string;
200
+ estimatedTokens: number;
201
+ }
202
+ interface ContextHarnessL1 {
203
+ layer: 'L1';
204
+ domain: string;
205
+ domainClass: 'first-party' | 'ugc';
206
+ selectedDiscoveryStage: DiscoverResult['selectedStage'] | null;
207
+ summary: string;
208
+ fanoutCommands: string[];
209
+ estimatedTokens: number;
210
+ }
211
+ interface ContextHarnessL2Entry {
212
+ resourceKey: string;
213
+ method: DiscoveryResource['method'];
214
+ path: string;
215
+ source: DiscoveryResource['source'];
216
+ authMode: DiscoveryResource['authHint'] | null;
217
+ }
218
+ interface ContextHarnessL2 {
219
+ layer: 'L2';
220
+ command: string;
221
+ tokenLight: boolean;
222
+ resourceCount: number;
223
+ resources: ContextHarnessL2Entry[];
224
+ }
225
+ interface ContextHarnessL3 {
226
+ layer: 'L3';
227
+ command: string;
228
+ detailLevel: 'endpoint-schema-and-metadata';
229
+ countsByAuthMode: Record<'paid' | 'siwx' | 'apiKey' | 'unprotected' | 'unknown', number>;
230
+ countsBySource: Record<string, number>;
231
+ pricedResourceCount: number;
232
+ }
233
+ interface ContextHarnessL4 {
234
+ layer: 'L4';
235
+ guidanceSource: 'llms.txt' | 'none';
236
+ llmsTxtUrl: string | null;
237
+ llmsTxtTokenEstimate: number;
238
+ guidancePreview: string | null;
239
+ guidanceStatus: 'present' | 'advertised_but_unfetched' | 'missing' | 'not_advertised';
240
+ }
241
+ interface ContextHarnessL5 {
242
+ layer: 'L5';
243
+ status: 'out_of_scope';
244
+ note: string;
245
+ }
246
+ interface ContextHarnessBudget {
247
+ contextWindowTokens: number;
248
+ zeroHopBudgetTokens: number;
249
+ estimatedZeroHopTokens: number;
250
+ withinBudget: boolean;
251
+ }
252
+ interface ContextHarnessReport {
253
+ target: string;
254
+ origin: string;
255
+ client: HarnessClientProfile;
256
+ budget: ContextHarnessBudget;
257
+ levels: {
258
+ l0: ContextHarnessL0;
259
+ l1: ContextHarnessL1;
260
+ l2: ContextHarnessL2;
261
+ l3: ContextHarnessL3;
262
+ l4: ContextHarnessL4;
263
+ l5: ContextHarnessL5;
264
+ };
265
+ diagnostics: {
266
+ warningCount: number;
267
+ errorWarningCount: number;
268
+ selectedStage: DiscoverResult['selectedStage'] | null;
269
+ upgradeSuggested: boolean;
270
+ upgradeReasons: string[];
271
+ };
272
+ }
273
+ interface BuildContextHarnessReportOptions {
274
+ target: string;
275
+ result: DiscoverDetailedResult;
276
+ client?: HarnessClientId;
277
+ contextWindowTokens?: number;
278
+ }
279
+ interface AuditContextHarnessOptions extends Omit<DiscoverDetailedOptions, 'rawView'> {
280
+ client?: HarnessClientId;
281
+ contextWindowTokens?: number;
282
+ }
283
+ declare function getHarnessClientProfile(client?: HarnessClientId): HarnessClientProfile;
284
+ declare function listHarnessClientProfiles(): HarnessClientProfile[];
285
+ declare function buildContextHarnessReport(options: BuildContextHarnessReportOptions): ContextHarnessReport;
286
+ declare function auditContextHarness(options: AuditContextHarnessOptions): Promise<ContextHarnessReport>;
287
+ declare function defaultHarnessProbeCandidates(report: ContextHarnessReport): ProbeCandidate[];
288
+
103
289
  declare function discover(options: DiscoverOptions): Promise<DiscoverResult>;
104
290
  declare function discoverDetailed(options: DiscoverDetailedOptions): Promise<DiscoverDetailedResult>;
105
291
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -94,13 +94,199 @@ interface DiscoverDetailedOptions extends DiscoverOptions {
94
94
  includeInteropMpp?: boolean;
95
95
  }
96
96
 
97
+ type McpFailureCause = 'not_found' | 'network' | 'timeout' | 'parse';
98
+ type McpAuthMode = 'paid' | 'siwx' | 'apiKey' | 'unprotected';
99
+ interface McpOpenApiInfo {
100
+ title: string;
101
+ version?: string;
102
+ description?: string;
103
+ }
104
+ interface McpEndpointSummary {
105
+ path: string;
106
+ method: HttpMethod;
107
+ summary: string;
108
+ price?: string;
109
+ protocols?: string[];
110
+ authMode?: McpAuthMode;
111
+ }
112
+ interface McpGuidance {
113
+ guidanceAvailable: boolean;
114
+ guidanceTokens?: number;
115
+ guidance?: string;
116
+ }
117
+ interface DiscoverForMcpOptions {
118
+ target: string;
119
+ includeGuidance?: boolean;
120
+ guidanceAutoIncludeMaxTokens?: number;
121
+ compatMode?: CompatibilityMode;
122
+ fetcher?: DiscoveryFetcher;
123
+ headers?: Record<string, string>;
124
+ signal?: AbortSignal;
125
+ }
126
+ interface DiscoverForMcpSuccess extends McpGuidance {
127
+ found: true;
128
+ origin: string;
129
+ source: string;
130
+ info?: McpOpenApiInfo;
131
+ endpoints: McpEndpointSummary[];
132
+ warnings: DiscoveryWarning[];
133
+ }
134
+ interface DiscoverForMcpFailure {
135
+ found: false;
136
+ origin: string;
137
+ cause: McpFailureCause;
138
+ message?: string;
139
+ warnings: DiscoveryWarning[];
140
+ }
141
+ type DiscoverForMcpResult = DiscoverForMcpSuccess | DiscoverForMcpFailure;
142
+ interface EndpointMethodAdvisory {
143
+ method: HttpMethod;
144
+ summary?: string;
145
+ estimatedPrice?: string;
146
+ protocols?: string[];
147
+ authMode?: McpAuthMode;
148
+ inputSchema?: Record<string, unknown>;
149
+ operationSchema?: Record<string, unknown>;
150
+ }
151
+ interface InspectEndpointForMcpOptions {
152
+ target: string;
153
+ endpointUrl: string;
154
+ compatMode?: CompatibilityMode;
155
+ fetcher?: DiscoveryFetcher;
156
+ headers?: Record<string, string>;
157
+ signal?: AbortSignal;
158
+ }
159
+ interface InspectEndpointForMcpSuccess {
160
+ found: true;
161
+ origin: string;
162
+ path: string;
163
+ specMethods: HttpMethod[];
164
+ advisories: Partial<Record<HttpMethod, EndpointMethodAdvisory>>;
165
+ warnings: DiscoveryWarning[];
166
+ }
167
+ interface InspectEndpointForMcpFailure {
168
+ found: false;
169
+ origin: string;
170
+ path: string;
171
+ cause: McpFailureCause;
172
+ message?: string;
173
+ warnings: DiscoveryWarning[];
174
+ }
175
+ type InspectEndpointForMcpResult = InspectEndpointForMcpSuccess | InspectEndpointForMcpFailure;
176
+ declare function discoverForMcp(options: DiscoverForMcpOptions): Promise<DiscoverForMcpResult>;
177
+ declare function inspectEndpointForMcp(options: InspectEndpointForMcpOptions): Promise<InspectEndpointForMcpResult>;
178
+
97
179
  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
180
  declare function computeUpgradeSignal(warnings: DiscoveryWarning[]): {
99
181
  upgradeSuggested: boolean;
100
182
  upgradeReasons: string[];
101
183
  };
102
184
 
185
+ type HarnessClientId = 'claude-code' | 'skill-cli' | 'generic-mcp' | 'generic';
186
+ interface HarnessClientProfile {
187
+ id: HarnessClientId;
188
+ label: string;
189
+ surface: 'mcp' | 'skill-cli' | 'generic';
190
+ defaultContextWindowTokens: number;
191
+ zeroHopBudgetPercent: number;
192
+ notes: string;
193
+ }
194
+ interface ContextHarnessL0 {
195
+ layer: 'L0';
196
+ intentTriggers: string[];
197
+ installCommand: string;
198
+ deliverySurfaces: string[];
199
+ summary: string;
200
+ estimatedTokens: number;
201
+ }
202
+ interface ContextHarnessL1 {
203
+ layer: 'L1';
204
+ domain: string;
205
+ domainClass: 'first-party' | 'ugc';
206
+ selectedDiscoveryStage: DiscoverResult['selectedStage'] | null;
207
+ summary: string;
208
+ fanoutCommands: string[];
209
+ estimatedTokens: number;
210
+ }
211
+ interface ContextHarnessL2Entry {
212
+ resourceKey: string;
213
+ method: DiscoveryResource['method'];
214
+ path: string;
215
+ source: DiscoveryResource['source'];
216
+ authMode: DiscoveryResource['authHint'] | null;
217
+ }
218
+ interface ContextHarnessL2 {
219
+ layer: 'L2';
220
+ command: string;
221
+ tokenLight: boolean;
222
+ resourceCount: number;
223
+ resources: ContextHarnessL2Entry[];
224
+ }
225
+ interface ContextHarnessL3 {
226
+ layer: 'L3';
227
+ command: string;
228
+ detailLevel: 'endpoint-schema-and-metadata';
229
+ countsByAuthMode: Record<'paid' | 'siwx' | 'apiKey' | 'unprotected' | 'unknown', number>;
230
+ countsBySource: Record<string, number>;
231
+ pricedResourceCount: number;
232
+ }
233
+ interface ContextHarnessL4 {
234
+ layer: 'L4';
235
+ guidanceSource: 'llms.txt' | 'none';
236
+ llmsTxtUrl: string | null;
237
+ llmsTxtTokenEstimate: number;
238
+ guidancePreview: string | null;
239
+ guidanceStatus: 'present' | 'advertised_but_unfetched' | 'missing' | 'not_advertised';
240
+ }
241
+ interface ContextHarnessL5 {
242
+ layer: 'L5';
243
+ status: 'out_of_scope';
244
+ note: string;
245
+ }
246
+ interface ContextHarnessBudget {
247
+ contextWindowTokens: number;
248
+ zeroHopBudgetTokens: number;
249
+ estimatedZeroHopTokens: number;
250
+ withinBudget: boolean;
251
+ }
252
+ interface ContextHarnessReport {
253
+ target: string;
254
+ origin: string;
255
+ client: HarnessClientProfile;
256
+ budget: ContextHarnessBudget;
257
+ levels: {
258
+ l0: ContextHarnessL0;
259
+ l1: ContextHarnessL1;
260
+ l2: ContextHarnessL2;
261
+ l3: ContextHarnessL3;
262
+ l4: ContextHarnessL4;
263
+ l5: ContextHarnessL5;
264
+ };
265
+ diagnostics: {
266
+ warningCount: number;
267
+ errorWarningCount: number;
268
+ selectedStage: DiscoverResult['selectedStage'] | null;
269
+ upgradeSuggested: boolean;
270
+ upgradeReasons: string[];
271
+ };
272
+ }
273
+ interface BuildContextHarnessReportOptions {
274
+ target: string;
275
+ result: DiscoverDetailedResult;
276
+ client?: HarnessClientId;
277
+ contextWindowTokens?: number;
278
+ }
279
+ interface AuditContextHarnessOptions extends Omit<DiscoverDetailedOptions, 'rawView'> {
280
+ client?: HarnessClientId;
281
+ contextWindowTokens?: number;
282
+ }
283
+ declare function getHarnessClientProfile(client?: HarnessClientId): HarnessClientProfile;
284
+ declare function listHarnessClientProfiles(): HarnessClientProfile[];
285
+ declare function buildContextHarnessReport(options: BuildContextHarnessReportOptions): ContextHarnessReport;
286
+ declare function auditContextHarness(options: AuditContextHarnessOptions): Promise<ContextHarnessReport>;
287
+ declare function defaultHarnessProbeCandidates(report: ContextHarnessReport): ProbeCandidate[];
288
+
103
289
  declare function discover(options: DiscoverOptions): Promise<DiscoverResult>;
104
290
  declare function discoverDetailed(options: DiscoverDetailedOptions): Promise<DiscoverDetailedResult>;
105
291
 
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 };
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 };