scoutline 0.6.4 → 0.9.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/README.md +19 -12
- package/bin/scoutline.js +2 -3
- package/dist/capabilities/crawl.d.ts +93 -0
- package/dist/capabilities/crawl.d.ts.map +1 -0
- package/dist/capabilities/crawl.js +62 -0
- package/dist/capabilities/crawl.js.map +1 -0
- package/dist/capabilities/diagnostics.d.ts +45 -43
- package/dist/capabilities/diagnostics.d.ts.map +1 -1
- package/dist/capabilities/diagnostics.js +58 -71
- package/dist/capabilities/diagnostics.js.map +1 -1
- package/dist/capabilities/map.d.ts +81 -0
- package/dist/capabilities/map.d.ts.map +1 -0
- package/dist/capabilities/map.js +60 -0
- package/dist/capabilities/map.js.map +1 -0
- package/dist/capabilities/quota.d.ts +11 -0
- package/dist/capabilities/quota.d.ts.map +1 -1
- package/dist/capabilities/quota.js +1 -1
- package/dist/capabilities/quota.js.map +1 -1
- package/dist/capabilities/research.d.ts +98 -0
- package/dist/capabilities/research.d.ts.map +1 -0
- package/dist/capabilities/research.js +71 -0
- package/dist/capabilities/research.js.map +1 -0
- package/dist/capabilities/search.d.ts +19 -1
- package/dist/capabilities/search.d.ts.map +1 -1
- package/dist/commands/crawl.d.ts +46 -0
- package/dist/commands/crawl.d.ts.map +1 -0
- package/dist/commands/crawl.js +170 -0
- package/dist/commands/crawl.js.map +1 -0
- package/dist/commands/doctor.d.ts +7 -8
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +40 -34
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/map.d.ts +39 -0
- package/dist/commands/map.d.ts.map +1 -0
- package/dist/commands/map.js +121 -0
- package/dist/commands/map.js.map +1 -0
- package/dist/commands/quota.d.ts +23 -0
- package/dist/commands/quota.d.ts.map +1 -1
- package/dist/commands/quota.js +21 -4
- package/dist/commands/quota.js.map +1 -1
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +7 -1
- package/dist/commands/read.js.map +1 -1
- package/dist/commands/repo.js +1 -1
- package/dist/commands/research.d.ts +62 -0
- package/dist/commands/research.d.ts.map +1 -0
- package/dist/commands/research.js +314 -0
- package/dist/commands/research.js.map +1 -0
- package/dist/commands/search.d.ts +3 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +26 -10
- package/dist/commands/search.js.map +1 -1
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +291 -13
- package/dist/index.js.map +1 -1
- package/dist/lib/cache.d.ts +13 -0
- package/dist/lib/cache.d.ts.map +1 -1
- package/dist/lib/cache.js +15 -0
- package/dist/lib/cache.js.map +1 -1
- package/dist/lib/execution.d.ts +105 -1
- package/dist/lib/execution.d.ts.map +1 -1
- package/dist/lib/execution.js +73 -1
- package/dist/lib/execution.js.map +1 -1
- package/dist/lib/redact.d.ts +2 -1
- package/dist/lib/redact.d.ts.map +1 -1
- package/dist/lib/redact.js +14 -1
- package/dist/lib/redact.js.map +1 -1
- package/dist/lib/research-state.d.ts +104 -0
- package/dist/lib/research-state.d.ts.map +1 -0
- package/dist/lib/research-state.js +214 -0
- package/dist/lib/research-state.js.map +1 -0
- package/dist/lib/search-topic.d.ts +21 -0
- package/dist/lib/search-topic.d.ts.map +1 -0
- package/dist/lib/search-topic.js +36 -0
- package/dist/lib/search-topic.js.map +1 -0
- package/dist/providers/brave/adapter.d.ts +42 -0
- package/dist/providers/brave/adapter.d.ts.map +1 -0
- package/dist/providers/brave/adapter.js +504 -0
- package/dist/providers/brave/adapter.js.map +1 -0
- package/dist/providers/brave/client.d.ts +161 -0
- package/dist/providers/brave/client.d.ts.map +1 -0
- package/dist/providers/brave/client.js +297 -0
- package/dist/providers/brave/client.js.map +1 -0
- package/dist/providers/brave/credentials.d.ts +33 -0
- package/dist/providers/brave/credentials.d.ts.map +1 -0
- package/dist/providers/brave/credentials.js +55 -0
- package/dist/providers/brave/credentials.js.map +1 -0
- package/dist/providers/brave/diagnostics.d.ts +46 -0
- package/dist/providers/brave/diagnostics.d.ts.map +1 -0
- package/dist/providers/brave/diagnostics.js +76 -0
- package/dist/providers/brave/diagnostics.js.map +1 -0
- package/dist/providers/brave/quota.d.ts +86 -0
- package/dist/providers/brave/quota.d.ts.map +1 -0
- package/dist/providers/brave/quota.js +247 -0
- package/dist/providers/brave/quota.js.map +1 -0
- package/dist/providers/exa/adapter.d.ts +58 -0
- package/dist/providers/exa/adapter.d.ts.map +1 -0
- package/dist/providers/exa/adapter.js +892 -0
- package/dist/providers/exa/adapter.js.map +1 -0
- package/dist/providers/exa/client.d.ts +143 -0
- package/dist/providers/exa/client.d.ts.map +1 -0
- package/dist/providers/exa/client.js +328 -0
- package/dist/providers/exa/client.js.map +1 -0
- package/dist/providers/exa/credentials.d.ts +34 -0
- package/dist/providers/exa/credentials.d.ts.map +1 -0
- package/dist/providers/exa/credentials.js +56 -0
- package/dist/providers/exa/credentials.js.map +1 -0
- package/dist/providers/exa/diagnostics.d.ts +42 -0
- package/dist/providers/exa/diagnostics.d.ts.map +1 -0
- package/dist/providers/exa/diagnostics.js +69 -0
- package/dist/providers/exa/diagnostics.js.map +1 -0
- package/dist/providers/minimax/adapter.d.ts.map +1 -1
- package/dist/providers/minimax/adapter.js +7 -2
- package/dist/providers/minimax/adapter.js.map +1 -1
- package/dist/providers/minimax/vision-conformance.d.ts +2 -2
- package/dist/providers/minimax/vision-conformance.js +2 -2
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/registry.js +6 -0
- package/dist/providers/registry.js.map +1 -1
- package/dist/providers/tavily/adapter.d.ts +62 -0
- package/dist/providers/tavily/adapter.d.ts.map +1 -0
- package/dist/providers/tavily/adapter.js +975 -0
- package/dist/providers/tavily/adapter.js.map +1 -0
- package/dist/providers/tavily/client.d.ts +184 -0
- package/dist/providers/tavily/client.d.ts.map +1 -0
- package/dist/providers/tavily/client.js +486 -0
- package/dist/providers/tavily/client.js.map +1 -0
- package/dist/providers/tavily/credentials.d.ts +34 -0
- package/dist/providers/tavily/credentials.d.ts.map +1 -0
- package/dist/providers/tavily/credentials.js +56 -0
- package/dist/providers/tavily/credentials.js.map +1 -0
- package/dist/providers/tavily/diagnostics.d.ts +44 -0
- package/dist/providers/tavily/diagnostics.d.ts.map +1 -0
- package/dist/providers/tavily/diagnostics.js +70 -0
- package/dist/providers/tavily/diagnostics.js.map +1 -0
- package/dist/providers/tavily/quota.d.ts +60 -0
- package/dist/providers/tavily/quota.d.ts.map +1 -0
- package/dist/providers/tavily/quota.js +186 -0
- package/dist/providers/tavily/quota.js.map +1 -0
- package/dist/providers/types.d.ts +14 -2
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/providers/types.js +1 -1
- package/dist/providers/types.js.map +1 -1
- package/dist/providers/zai/adapter.d.ts.map +1 -1
- package/dist/providers/zai/adapter.js +13 -2
- package/dist/providers/zai/adapter.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
- **Repo** - Search and read GitHub repository code via ZRead
|
|
22
22
|
- **Tools** - MCP tool discovery, schemas, and raw calls
|
|
23
23
|
- **Code Mode** - TypeScript tool chaining for agent automation
|
|
24
|
-
- **Provider selection** - Run shared capabilities through Z.AI
|
|
24
|
+
- **Provider selection** - Run shared capabilities through Z.AI, MiniMax Token Plan, Tavily, or Brave
|
|
25
25
|
|
|
26
26
|
## Quick Start
|
|
27
27
|
|
|
@@ -42,6 +42,14 @@ export MINIMAX_API_KEY="your-minimax-key"
|
|
|
42
42
|
npx scoutline --provider minimax search "latest LLM benchmarks"
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
To use Brave (Search: web, news, video):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
export BRAVE_SEARCH_API_KEY="your-brave-key"
|
|
49
|
+
npx scoutline --provider brave search "AI policy news" --topic news
|
|
50
|
+
npx scoutline --provider brave search "rust async" --type video
|
|
51
|
+
```
|
|
52
|
+
|
|
45
53
|
## Installation
|
|
46
54
|
|
|
47
55
|
### As an Agent Skill
|
|
@@ -74,9 +82,9 @@ npx scoutline --help
|
|
|
74
82
|
## Provider Selection
|
|
75
83
|
|
|
76
84
|
Shared commands (`search`, `vision`, `quota`, `doctor`, `repo`) accept a global
|
|
77
|
-
`--provider <zai|minimax>` flag. Resolution precedence:
|
|
85
|
+
`--provider <zai|minimax|tavily|brave>` flag. Resolution precedence:
|
|
78
86
|
|
|
79
|
-
1. Explicit `--provider <zai|minimax>` on the command line
|
|
87
|
+
1. Explicit `--provider <zai|minimax|tavily|brave>` on the command line
|
|
80
88
|
2. `SCOUTLINE_PROVIDER` environment variable
|
|
81
89
|
3. Compatibility default `zai`
|
|
82
90
|
|
|
@@ -398,11 +406,10 @@ Cache hits construct and close no transport.
|
|
|
398
406
|
|
|
399
407
|
### Diagnostics inventory
|
|
400
408
|
|
|
401
|
-
`
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
as unsupported for `repo`.
|
|
409
|
+
`capabilityMatrix` is derived from descriptor metadata: for each advertised
|
|
410
|
+
capability, the providers that supply it (in descriptor order).
|
|
411
|
+
`repository-exploration` therefore lists only `zai` while still participating
|
|
412
|
+
in Provider selection. Doctor help names MiniMax as unsupported for `repo`.
|
|
406
413
|
|
|
407
414
|
### Non-goals
|
|
408
415
|
|
|
@@ -502,10 +509,10 @@ result. Cache hits construct and close no transport.
|
|
|
502
509
|
|
|
503
510
|
### Diagnostics inventory
|
|
504
511
|
|
|
505
|
-
`
|
|
506
|
-
|
|
507
|
-
participating in Provider selection, and Doctor help names
|
|
508
|
-
unsupported for `read`.
|
|
512
|
+
`capabilityMatrix` is derived from descriptor metadata: for each advertised
|
|
513
|
+
capability, the providers that supply it. `reader` therefore lists only
|
|
514
|
+
`zai` while still participating in Provider selection, and Doctor help names
|
|
515
|
+
MiniMax as unsupported for `read`.
|
|
509
516
|
|
|
510
517
|
### Non-goals
|
|
511
518
|
|
package/bin/scoutline.js
CHANGED
|
@@ -10,12 +10,11 @@ import("../dist/index.js")
|
|
|
10
10
|
env: process.env,
|
|
11
11
|
});
|
|
12
12
|
adapter.setExitCode(status);
|
|
13
|
+
process.exit(status);
|
|
13
14
|
})
|
|
14
15
|
.catch(async (err) => {
|
|
15
16
|
try {
|
|
16
|
-
const { formatLoadFailure } = await import(
|
|
17
|
-
"../dist/node-command-invocation-adapter.js"
|
|
18
|
-
);
|
|
17
|
+
const { formatLoadFailure } = await import("../dist/node-command-invocation-adapter.js");
|
|
19
18
|
console.error(formatLoadFailure(err));
|
|
20
19
|
} catch {
|
|
21
20
|
// If the dist module is unavailable for any reason, fall back to a
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral Crawl Capability Contract (tech-plan §2a).
|
|
3
|
+
*
|
|
4
|
+
* Declares the single Crawl operation (`crawl-fetch`), its
|
|
5
|
+
* provider-neutral request, identity, cache, and result shapes, and a
|
|
6
|
+
* total normalized cache decoder.
|
|
7
|
+
*
|
|
8
|
+
* It imports NO concrete Provider, transport, or Adapter. It does no URL
|
|
9
|
+
* validation, raw response parsing, Provider field mapping, Provider
|
|
10
|
+
* selection, retries, or presentation.
|
|
11
|
+
*/
|
|
12
|
+
import type { CachedOperation } from "../lib/execution.js";
|
|
13
|
+
/**
|
|
14
|
+
* The single Crawl Capability operation. Cache identity partitions by
|
|
15
|
+
* the composite `${capability}-${operation}` literal; the v2 partitioned
|
|
16
|
+
* key shape is
|
|
17
|
+
* `v2.crawl-crawl-fetch.<provider>.<credential-hash>.<request-hash>.json`.
|
|
18
|
+
*
|
|
19
|
+
* `--max-chars` is a handler-level projection and does NOT participate in
|
|
20
|
+
* the cache identity.
|
|
21
|
+
*/
|
|
22
|
+
export type CrawlOperationKind = "crawl-fetch";
|
|
23
|
+
/**
|
|
24
|
+
* Provider-neutral crawl request. `url` MUST be supplied explicitly (the
|
|
25
|
+
* handler rejects non-`http(s)` values at parse time before this request
|
|
26
|
+
* reaches the Adapter).
|
|
27
|
+
*
|
|
28
|
+
* Every field except `url` participates in the v2 partitioned cache
|
|
29
|
+
* identity. `--max-chars` and `--no-cache` NEVER appear here — they are
|
|
30
|
+
* projections applied after the cached normalized result.
|
|
31
|
+
*/
|
|
32
|
+
export interface CrawlRequest {
|
|
33
|
+
readonly url: string;
|
|
34
|
+
/** Crawl depth, 1-5. Default 1 (single page). */
|
|
35
|
+
readonly depth?: number;
|
|
36
|
+
/** Max links to follow per page, 1-500. Default 20. */
|
|
37
|
+
readonly breadth?: number;
|
|
38
|
+
/** Total number of links to process, default 50. */
|
|
39
|
+
readonly limit?: number;
|
|
40
|
+
/** Regex patterns to select only matching URL paths. */
|
|
41
|
+
readonly selectPaths?: string;
|
|
42
|
+
/** Regex patterns to exclude matching URL paths. */
|
|
43
|
+
readonly excludePaths?: string;
|
|
44
|
+
/** Natural language instructions guiding which pages to crawl. */
|
|
45
|
+
readonly instructions?: string;
|
|
46
|
+
/** Output format: markdown (default) or text. */
|
|
47
|
+
readonly format?: "markdown" | "text";
|
|
48
|
+
/** Extraction depth: medium (basic, default) or high (advanced). */
|
|
49
|
+
readonly contentSize?: "medium" | "high";
|
|
50
|
+
/** Request timeout in seconds, default 150. */
|
|
51
|
+
readonly timeout?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A single crawled page. `truncated` and `originalContentLength` are NOT
|
|
55
|
+
* part of this contract — they are handler-level projections applied by
|
|
56
|
+
* `commands/crawl.ts` after the cached normalized result is produced.
|
|
57
|
+
* The cache stores the full content; truncation state is recomputed on
|
|
58
|
+
* every read.
|
|
59
|
+
*/
|
|
60
|
+
export interface CrawlPage {
|
|
61
|
+
readonly url: string;
|
|
62
|
+
readonly content: string;
|
|
63
|
+
readonly contentFormat: "markdown" | "text";
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Normalized crawl result. `schemaVersion: 1` is the breaking shape.
|
|
67
|
+
*/
|
|
68
|
+
export interface CrawlResult {
|
|
69
|
+
readonly schemaVersion: 1;
|
|
70
|
+
readonly baseUrl: string;
|
|
71
|
+
readonly pages: readonly CrawlPage[];
|
|
72
|
+
readonly totalPages: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Generic Crawl operation descriptor. The Adapter supplies one of these
|
|
76
|
+
* for the `crawl-fetch` operation it supports.
|
|
77
|
+
*/
|
|
78
|
+
export interface CrawlOperation extends CachedOperation<CrawlRequest, CrawlResult> {
|
|
79
|
+
readonly kind: CrawlOperationKind;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Crawl Capability contract. Every Adapter that supports crawl
|
|
83
|
+
* implements this interface and exposes it as `adapter.crawl`.
|
|
84
|
+
*/
|
|
85
|
+
export interface CrawlCapability {
|
|
86
|
+
readonly fetch: CrawlOperation;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Decode a CrawlResult from the cache. Returns the canonical
|
|
90
|
+
* `CrawlResult` on success, `null` for any malformed value.
|
|
91
|
+
*/
|
|
92
|
+
export declare function decodeCrawlResult(value: unknown): CrawlResult | null;
|
|
93
|
+
//# sourceMappingURL=crawl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawl.d.ts","sourceRoot":"","sources":["../../src/capabilities/crawl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAiB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAM1E;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAM/C;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,K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
|
+
* Provider-neutral Crawl Capability Contract (tech-plan §2a).
|
|
3
|
+
*
|
|
4
|
+
* Declares the single Crawl operation (`crawl-fetch`), its
|
|
5
|
+
* provider-neutral request, identity, cache, and result shapes, and a
|
|
6
|
+
* total normalized cache decoder.
|
|
7
|
+
*
|
|
8
|
+
* It imports NO concrete Provider, transport, or Adapter. It does no URL
|
|
9
|
+
* validation, raw response parsing, Provider field mapping, Provider
|
|
10
|
+
* selection, retries, or presentation.
|
|
11
|
+
*/
|
|
12
|
+
// ===========================================================================
|
|
13
|
+
// Total normalized cache decoder
|
|
14
|
+
// ===========================================================================
|
|
15
|
+
//
|
|
16
|
+
// Accepts `unknown`, returns the typed result or `null`, never throws, and
|
|
17
|
+
// never trusts a generic cast. Shape contract is local; the Adapter is
|
|
18
|
+
// responsible for producing values that conform to `CrawlResult`.
|
|
19
|
+
function isPlainObject(value) {
|
|
20
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21
|
+
}
|
|
22
|
+
function isNonEmptyString(value) {
|
|
23
|
+
return typeof value === "string" && value.length > 0;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Decode a CrawlResult from the cache. Returns the canonical
|
|
27
|
+
* `CrawlResult` on success, `null` for any malformed value.
|
|
28
|
+
*/
|
|
29
|
+
export function decodeCrawlResult(value) {
|
|
30
|
+
if (!isPlainObject(value))
|
|
31
|
+
return null;
|
|
32
|
+
if (value.schemaVersion !== 1)
|
|
33
|
+
return null;
|
|
34
|
+
if (!isNonEmptyString(value.baseUrl))
|
|
35
|
+
return null;
|
|
36
|
+
const pages = value.pages;
|
|
37
|
+
if (!Array.isArray(pages))
|
|
38
|
+
return null;
|
|
39
|
+
const decodedPages = [];
|
|
40
|
+
for (const page of pages) {
|
|
41
|
+
if (!isPlainObject(page))
|
|
42
|
+
return null;
|
|
43
|
+
if (!isNonEmptyString(page.url))
|
|
44
|
+
return null;
|
|
45
|
+
if (!isNonEmptyString(page.content))
|
|
46
|
+
return null;
|
|
47
|
+
const contentFormat = page.contentFormat;
|
|
48
|
+
if (contentFormat !== "markdown" && contentFormat !== "text")
|
|
49
|
+
return null;
|
|
50
|
+
decodedPages.push({ url: page.url, content: page.content, contentFormat });
|
|
51
|
+
}
|
|
52
|
+
const totalPages = value.totalPages;
|
|
53
|
+
if (typeof totalPages !== "number" || !Number.isFinite(totalPages))
|
|
54
|
+
return null;
|
|
55
|
+
return {
|
|
56
|
+
schemaVersion: 1,
|
|
57
|
+
baseUrl: value.baseUrl,
|
|
58
|
+
pages: decodedPages,
|
|
59
|
+
totalPages,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=crawl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawl.js","sourceRoot":"","sources":["../../src/capabilities/crawl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqGH,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAC9E,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,kEAAkE;AAElE,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEvC,IAAI,KAAK,CAAC,aAAa,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE3C,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAElD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEvC,MAAM,YAAY,GAAgB,EAAE,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC7C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QACjD,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,IAAI,aAAa,KAAK,UAAU,IAAI,aAAa,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC;QAC1E,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACpC,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IAEhF,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,YAAY;QACnB,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Diagnostics Capability Contract (DESIGN.md §14, P4-04, P6-06).
|
|
2
|
+
* Diagnostics Capability Contract (DESIGN.md §14, P4-04, P6-06, Doctor Schema v2).
|
|
3
3
|
*
|
|
4
|
-
* Defines the schema-version-
|
|
4
|
+
* Defines the schema-version-2 diagnostics report every `doctor`
|
|
5
5
|
* invocation returns, plus the capability contract each Provider
|
|
6
6
|
* Adapter implements so its connectivity can be probed without a
|
|
7
7
|
* generative request.
|
|
@@ -22,17 +22,19 @@
|
|
|
22
22
|
* hand-maintained inventory required those imports; the
|
|
23
23
|
* descriptor-derived inventory does not.
|
|
24
24
|
*
|
|
25
|
-
* Inventory derivation (
|
|
26
|
-
* - `
|
|
27
|
-
* passed to `buildDiagnosticsReport
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* -
|
|
34
|
-
*
|
|
35
|
-
*
|
|
25
|
+
* Inventory derivation (Doctor Schema v2):
|
|
26
|
+
* - `capabilityMatrix` is the per-capability provider list across
|
|
27
|
+
* every descriptor passed to `buildDiagnosticsReport`. It replaced
|
|
28
|
+
* the schema-version-1 `sharedCapabilities` (intersection) and
|
|
29
|
+
* `zaiOnlyCapabilities` (Z.AI-minus-others) pair, which silently
|
|
30
|
+
* hid any capability shared by 2-of-3 providers under three
|
|
31
|
+
* built-ins. The matrix is strictly more informative: every
|
|
32
|
+
* capability is visible with exactly the providers that supply it.
|
|
33
|
+
* - Capability order: first descriptor's declared order, then
|
|
34
|
+
* capabilities unique to subsequent descriptors in descriptor
|
|
35
|
+
* order. Provider order within an entry: descriptor order.
|
|
36
|
+
* - Values are descriptor capability IDs only — no hand-maintained
|
|
37
|
+
* aliases.
|
|
36
38
|
*/
|
|
37
39
|
import type { ProviderCapability, ProviderDescriptor, ProviderId } from "../providers/types.js";
|
|
38
40
|
import { type ScoutlineErrorCode } from "../lib/errors.js";
|
|
@@ -51,11 +53,20 @@ export interface ProviderDiagnostic {
|
|
|
51
53
|
help?: string;
|
|
52
54
|
};
|
|
53
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* One row of the schema-version-2 capability matrix: a capability and
|
|
58
|
+
* the providers (in descriptor order) that advertise it. Replaces the
|
|
59
|
+
* schema-version-1 `sharedCapabilities`/`zaiOnlyCapabilities` pair,
|
|
60
|
+
* which could not represent a capability supplied by 2-of-3 providers.
|
|
61
|
+
*/
|
|
62
|
+
export interface CapabilityProviderEntry {
|
|
63
|
+
readonly capability: ProviderCapability;
|
|
64
|
+
readonly providers: readonly ProviderId[];
|
|
65
|
+
}
|
|
54
66
|
export interface DiagnosticsReport {
|
|
55
|
-
readonly schemaVersion:
|
|
67
|
+
readonly schemaVersion: 2;
|
|
56
68
|
readonly effectiveProvider: ProviderId;
|
|
57
|
-
readonly
|
|
58
|
-
readonly zaiOnlyCapabilities: readonly string[];
|
|
69
|
+
readonly capabilityMatrix: readonly CapabilityProviderEntry[];
|
|
59
70
|
readonly node: {
|
|
60
71
|
readonly version: string;
|
|
61
72
|
readonly visionMcpCompatible: boolean;
|
|
@@ -87,40 +98,31 @@ export interface DiagnosticsCapability {
|
|
|
87
98
|
invoke(options: DiagnosticOptions): Promise<void>;
|
|
88
99
|
}
|
|
89
100
|
/**
|
|
90
|
-
* Derive the
|
|
91
|
-
*
|
|
92
|
-
*
|
|
101
|
+
* Derive the schema-version-2 capability matrix: for each capability
|
|
102
|
+
* advertised by any descriptor, the list of providers (in descriptor
|
|
103
|
+
* order) that supply it.
|
|
93
104
|
*
|
|
94
|
-
*
|
|
95
|
-
* -
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* every other descriptor also advertises it.
|
|
105
|
+
* Capability order:
|
|
106
|
+
* - First, the FIRST descriptor's capabilities in their declared
|
|
107
|
+
* order.
|
|
108
|
+
* - Then, capabilities unique to each subsequent descriptor, in
|
|
109
|
+
* descriptor order.
|
|
100
110
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
|
-
export declare function deriveSharedCapabilities(descriptors: readonly ProviderDescriptor[]): readonly ProviderCapability[];
|
|
105
|
-
/**
|
|
106
|
-
* Derive the Z.AI-only Capabilities inventory: capabilities advertised
|
|
107
|
-
* by the Z.AI descriptor minus the union of capabilities advertised by
|
|
108
|
-
* every OTHER descriptor in the list. Preserves Z.AI descriptor order.
|
|
111
|
+
* Provider order within an entry: descriptor order (the order
|
|
112
|
+
* descriptors appear in the passed-in list).
|
|
109
113
|
*
|
|
110
114
|
* Edge cases:
|
|
111
115
|
* - Empty descriptor list: returns an empty array.
|
|
112
|
-
* -
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
116
|
+
* - Single descriptor: one entry per capability, each listing only
|
|
117
|
+
* that descriptor's id.
|
|
118
|
+
* - Two or more: a capability supplied by multiple descriptors lists
|
|
119
|
+
* every supplying descriptor's id — unlike the schema-version-1
|
|
120
|
+
* intersection/minus pair, nothing is hidden.
|
|
117
121
|
*
|
|
118
|
-
* The returned
|
|
119
|
-
*
|
|
120
|
-
* invented names. `repository-exploration` lands here naturally the
|
|
121
|
-
* moment Z.AI advertises it and another built-in does not.
|
|
122
|
+
* The returned array (and each entry's `providers`) is frozen so
|
|
123
|
+
* callers cannot mutate the cached derivation in place.
|
|
122
124
|
*/
|
|
123
|
-
export declare function
|
|
125
|
+
export declare function deriveCapabilityMatrix(descriptors: readonly ProviderDescriptor[]): readonly CapabilityProviderEntry[];
|
|
124
126
|
/**
|
|
125
127
|
* Map a thrown error into a normalized diagnostic error entry. The
|
|
126
128
|
* caller is responsible for recursive redaction before the entry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/capabilities/diagnostics.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/capabilities/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAM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AAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAYD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,SAAS,kBAAkB,EAAE,GACzC,SAAS,uBAAuB,EAAE,CAiCpC;AAMD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG;IACxD,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAYA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Diagnostics Capability Contract (DESIGN.md §14, P4-04, P6-06).
|
|
2
|
+
* Diagnostics Capability Contract (DESIGN.md §14, P4-04, P6-06, Doctor Schema v2).
|
|
3
3
|
*
|
|
4
|
-
* Defines the schema-version-
|
|
4
|
+
* Defines the schema-version-2 diagnostics report every `doctor`
|
|
5
5
|
* invocation returns, plus the capability contract each Provider
|
|
6
6
|
* Adapter implements so its connectivity can be probed without a
|
|
7
7
|
* generative request.
|
|
@@ -22,17 +22,19 @@
|
|
|
22
22
|
* hand-maintained inventory required those imports; the
|
|
23
23
|
* descriptor-derived inventory does not.
|
|
24
24
|
*
|
|
25
|
-
* Inventory derivation (
|
|
26
|
-
* - `
|
|
27
|
-
* passed to `buildDiagnosticsReport
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* -
|
|
34
|
-
*
|
|
35
|
-
*
|
|
25
|
+
* Inventory derivation (Doctor Schema v2):
|
|
26
|
+
* - `capabilityMatrix` is the per-capability provider list across
|
|
27
|
+
* every descriptor passed to `buildDiagnosticsReport`. It replaced
|
|
28
|
+
* the schema-version-1 `sharedCapabilities` (intersection) and
|
|
29
|
+
* `zaiOnlyCapabilities` (Z.AI-minus-others) pair, which silently
|
|
30
|
+
* hid any capability shared by 2-of-3 providers under three
|
|
31
|
+
* built-ins. The matrix is strictly more informative: every
|
|
32
|
+
* capability is visible with exactly the providers that supply it.
|
|
33
|
+
* - Capability order: first descriptor's declared order, then
|
|
34
|
+
* capabilities unique to subsequent descriptors in descriptor
|
|
35
|
+
* order. Provider order within an entry: descriptor order.
|
|
36
|
+
* - Values are descriptor capability IDs only — no hand-maintained
|
|
37
|
+
* aliases.
|
|
36
38
|
*/
|
|
37
39
|
import { ScoutlineError } from "../lib/errors.js";
|
|
38
40
|
// ---------------------------------------------------------------------------
|
|
@@ -45,74 +47,59 @@ import { ScoutlineError } from "../lib/errors.js";
|
|
|
45
47
|
// indexing accidents.
|
|
46
48
|
// ---------------------------------------------------------------------------
|
|
47
49
|
/**
|
|
48
|
-
* Derive the
|
|
49
|
-
*
|
|
50
|
-
*
|
|
50
|
+
* Derive the schema-version-2 capability matrix: for each capability
|
|
51
|
+
* advertised by any descriptor, the list of providers (in descriptor
|
|
52
|
+
* order) that supply it.
|
|
51
53
|
*
|
|
52
|
-
*
|
|
53
|
-
* -
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* every other descriptor also advertises it.
|
|
54
|
+
* Capability order:
|
|
55
|
+
* - First, the FIRST descriptor's capabilities in their declared
|
|
56
|
+
* order.
|
|
57
|
+
* - Then, capabilities unique to each subsequent descriptor, in
|
|
58
|
+
* descriptor order.
|
|
58
59
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*/
|
|
62
|
-
export function deriveSharedCapabilities(descriptors) {
|
|
63
|
-
if (descriptors.length === 0)
|
|
64
|
-
return Object.freeze([]);
|
|
65
|
-
const [first, ...rest] = descriptors;
|
|
66
|
-
if (rest.length === 0) {
|
|
67
|
-
return Object.freeze([...first.capabilities()]);
|
|
68
|
-
}
|
|
69
|
-
const otherSets = rest.map((d) => d.capabilities());
|
|
70
|
-
const out = [];
|
|
71
|
-
for (const cap of first.capabilities()) {
|
|
72
|
-
if (otherSets.every((set) => set.has(cap))) {
|
|
73
|
-
out.push(cap);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return Object.freeze(out);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Derive the Z.AI-only Capabilities inventory: capabilities advertised
|
|
80
|
-
* by the Z.AI descriptor minus the union of capabilities advertised by
|
|
81
|
-
* every OTHER descriptor in the list. Preserves Z.AI descriptor order.
|
|
60
|
+
* Provider order within an entry: descriptor order (the order
|
|
61
|
+
* descriptors appear in the passed-in list).
|
|
82
62
|
*
|
|
83
63
|
* Edge cases:
|
|
84
64
|
* - Empty descriptor list: returns an empty array.
|
|
85
|
-
* -
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
65
|
+
* - Single descriptor: one entry per capability, each listing only
|
|
66
|
+
* that descriptor's id.
|
|
67
|
+
* - Two or more: a capability supplied by multiple descriptors lists
|
|
68
|
+
* every supplying descriptor's id — unlike the schema-version-1
|
|
69
|
+
* intersection/minus pair, nothing is hidden.
|
|
90
70
|
*
|
|
91
|
-
* The returned
|
|
92
|
-
*
|
|
93
|
-
* invented names. `repository-exploration` lands here naturally the
|
|
94
|
-
* moment Z.AI advertises it and another built-in does not.
|
|
71
|
+
* The returned array (and each entry's `providers`) is frozen so
|
|
72
|
+
* callers cannot mutate the cached derivation in place.
|
|
95
73
|
*/
|
|
96
|
-
export function
|
|
97
|
-
|
|
98
|
-
if (!zai)
|
|
74
|
+
export function deriveCapabilityMatrix(descriptors) {
|
|
75
|
+
if (descriptors.length === 0)
|
|
99
76
|
return Object.freeze([]);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
out.push(cap);
|
|
77
|
+
// Materialize each descriptor's capability set once (pure metadata).
|
|
78
|
+
const capabilitySets = descriptors.map((d) => d.capabilities());
|
|
79
|
+
// Establish deterministic capability order: first descriptor's
|
|
80
|
+
// declared order, then capabilities unique to subsequent descriptors
|
|
81
|
+
// in descriptor order.
|
|
82
|
+
const seen = new Set();
|
|
83
|
+
const ordered = [];
|
|
84
|
+
for (const set of capabilitySets) {
|
|
85
|
+
for (const cap of set) {
|
|
86
|
+
if (!seen.has(cap)) {
|
|
87
|
+
seen.add(cap);
|
|
88
|
+
ordered.push(cap);
|
|
89
|
+
}
|
|
114
90
|
}
|
|
115
91
|
}
|
|
92
|
+
// For each capability, list the providers that advertise it, in
|
|
93
|
+
// descriptor order.
|
|
94
|
+
const out = ordered.map((cap) => {
|
|
95
|
+
const providers = [];
|
|
96
|
+
capabilitySets.forEach((set, index) => {
|
|
97
|
+
if (set.has(cap)) {
|
|
98
|
+
providers.push(descriptors[index].id);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return { capability: cap, providers: Object.freeze(providers) };
|
|
102
|
+
});
|
|
116
103
|
return Object.freeze(out);
|
|
117
104
|
}
|
|
118
105
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/capabilities/diagnostics.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/capabilities/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,EAAE,cAAc,EAA2B,MAAM,kBAAkB,CAAC;AAgE3E,8EAA8E;AAC9E,wCAAwC;AACxC,EAAE;AACF,6DAA6D;AAC7D,qEAAqE;AACrE,iEAAiE;AACjE,gEAAgE;AAChE,sBAAsB;AACtB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,sBAAsB,CACpC,WAA0C;IAE1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A8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IAKrD,MAAM,IAAI,GACR,KAAK,YAAY,cAAc,CAAC,CAAC,CAAE,KAAK,CAAC,IAA2B,CAAC,CAAC,CAAC,eAAe,CAAC;IACzF,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,MAAM,GAAiE;QAC3E,IAAI;QACJ,OAAO;KACR,CAAC;IACF,IAAI,KAAK,YAAY,cAAc,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral Map Capability Contract (tech-plan §2b).
|
|
3
|
+
*
|
|
4
|
+
* Declares the single Map operation (`map-fetch`), its provider-neutral
|
|
5
|
+
* request, identity, cache, and result shapes, and a total normalized
|
|
6
|
+
* cache decoder.
|
|
7
|
+
*
|
|
8
|
+
* It imports NO concrete Provider, transport, or Adapter. It does no URL
|
|
9
|
+
* validation, raw response parsing, Provider field mapping, Provider
|
|
10
|
+
* selection, retries, or presentation.
|
|
11
|
+
*
|
|
12
|
+
* Map is the simplest of the three new Tavily capabilities: the API
|
|
13
|
+
* returns URLs only (no per-page content), so there is no per-page
|
|
14
|
+
* projection or truncation concern. The handler therefore needs no
|
|
15
|
+
* `--max-chars` flag.
|
|
16
|
+
*/
|
|
17
|
+
import type { CacheIdentity, CachedOperation } from "../lib/execution.js";
|
|
18
|
+
/**
|
|
19
|
+
* The single Map Capability operation. Cache identity partitions by the
|
|
20
|
+
* composite `${capability}-${operation}` literal; the v2 partitioned key
|
|
21
|
+
* shape is
|
|
22
|
+
* `v2.map-map-fetch.<provider>.<credential-hash>.<request-hash>.json`.
|
|
23
|
+
*/
|
|
24
|
+
export type MapOperationKind = "map-fetch";
|
|
25
|
+
/**
|
|
26
|
+
* Provider-neutral map request. `url` MUST be supplied explicitly (the
|
|
27
|
+
* handler rejects non-`http(s)` values at parse time before this request
|
|
28
|
+
* reaches the Adapter).
|
|
29
|
+
*
|
|
30
|
+
* Every field except `url` participates in the v2 partitioned cache
|
|
31
|
+
* identity. `--no-cache` and output mode never appear here — they are
|
|
32
|
+
* policy applied around the cached normalized result.
|
|
33
|
+
*/
|
|
34
|
+
export interface MapRequest {
|
|
35
|
+
readonly url: string;
|
|
36
|
+
/** Map depth, 1-5. Default 1 (single page). */
|
|
37
|
+
readonly depth?: number;
|
|
38
|
+
/** Max links to follow per page, 1-500. Default 20. */
|
|
39
|
+
readonly breadth?: number;
|
|
40
|
+
/** Total number of links to process, default 50. */
|
|
41
|
+
readonly limit?: number;
|
|
42
|
+
/** Regex patterns to select only matching URL paths. */
|
|
43
|
+
readonly selectPaths?: string;
|
|
44
|
+
/** Regex patterns to exclude matching URL paths. */
|
|
45
|
+
readonly excludePaths?: string;
|
|
46
|
+
/** Natural language instructions guiding which pages to map. */
|
|
47
|
+
readonly instructions?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Normalized map result. `schemaVersion: 1` is the breaking shape.
|
|
51
|
+
* `urls` is the exact set of URLs the Provider returned (in Provider
|
|
52
|
+
* order); `totalUrls` is the array length. `baseUrl` is the request
|
|
53
|
+
* URL, recorded for symmetry with the Crawl result.
|
|
54
|
+
*/
|
|
55
|
+
export interface MapResult {
|
|
56
|
+
readonly schemaVersion: 1;
|
|
57
|
+
readonly baseUrl: string;
|
|
58
|
+
readonly urls: readonly string[];
|
|
59
|
+
readonly totalUrls: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Generic Map operation descriptor. The Adapter supplies one of these
|
|
63
|
+
* for the `map-fetch` operation it supports.
|
|
64
|
+
*/
|
|
65
|
+
export interface MapOperation extends CachedOperation<MapRequest, MapResult> {
|
|
66
|
+
readonly kind: MapOperationKind;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Map Capability contract. Every Adapter that supports map implements
|
|
70
|
+
* this interface and exposes it as `adapter.map`.
|
|
71
|
+
*/
|
|
72
|
+
export interface MapCapability {
|
|
73
|
+
readonly fetch: MapOperation;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Decode a MapResult from the cache. Returns the canonical `MapResult`
|
|
77
|
+
* on success, `null` for any malformed value.
|
|
78
|
+
*/
|
|
79
|
+
export declare function decodeMapResult(value: unknown): MapResult | null;
|
|
80
|
+
export type MapCacheIdentity = CacheIdentity<MapRequest, MapResult>;
|
|
81
|
+
//# sourceMappingURL=map.d.ts.map
|