scoutline 0.6.3 → 0.7.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.
Files changed (108) hide show
  1. package/README.md +8 -9
  2. package/bin/scoutline.js +2 -3
  3. package/dist/capabilities/crawl.d.ts +93 -0
  4. package/dist/capabilities/crawl.d.ts.map +1 -0
  5. package/dist/capabilities/crawl.js +62 -0
  6. package/dist/capabilities/crawl.js.map +1 -0
  7. package/dist/capabilities/diagnostics.d.ts +45 -43
  8. package/dist/capabilities/diagnostics.d.ts.map +1 -1
  9. package/dist/capabilities/diagnostics.js +58 -71
  10. package/dist/capabilities/diagnostics.js.map +1 -1
  11. package/dist/capabilities/map.d.ts +81 -0
  12. package/dist/capabilities/map.d.ts.map +1 -0
  13. package/dist/capabilities/map.js +60 -0
  14. package/dist/capabilities/map.js.map +1 -0
  15. package/dist/capabilities/quota.js +1 -1
  16. package/dist/capabilities/quota.js.map +1 -1
  17. package/dist/capabilities/research.d.ts +98 -0
  18. package/dist/capabilities/research.d.ts.map +1 -0
  19. package/dist/capabilities/research.js +71 -0
  20. package/dist/capabilities/research.js.map +1 -0
  21. package/dist/capabilities/search.d.ts +9 -1
  22. package/dist/capabilities/search.d.ts.map +1 -1
  23. package/dist/commands/crawl.d.ts +46 -0
  24. package/dist/commands/crawl.d.ts.map +1 -0
  25. package/dist/commands/crawl.js +170 -0
  26. package/dist/commands/crawl.js.map +1 -0
  27. package/dist/commands/doctor.d.ts +7 -8
  28. package/dist/commands/doctor.d.ts.map +1 -1
  29. package/dist/commands/doctor.js +37 -34
  30. package/dist/commands/doctor.js.map +1 -1
  31. package/dist/commands/map.d.ts +39 -0
  32. package/dist/commands/map.d.ts.map +1 -0
  33. package/dist/commands/map.js +121 -0
  34. package/dist/commands/map.js.map +1 -0
  35. package/dist/commands/read.d.ts.map +1 -1
  36. package/dist/commands/read.js +7 -1
  37. package/dist/commands/read.js.map +1 -1
  38. package/dist/commands/research.d.ts +62 -0
  39. package/dist/commands/research.d.ts.map +1 -0
  40. package/dist/commands/research.js +314 -0
  41. package/dist/commands/research.js.map +1 -0
  42. package/dist/commands/search.d.ts +2 -1
  43. package/dist/commands/search.d.ts.map +1 -1
  44. package/dist/commands/search.js +11 -4
  45. package/dist/commands/search.js.map +1 -1
  46. package/dist/index.d.ts +38 -0
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +260 -13
  49. package/dist/index.js.map +1 -1
  50. package/dist/lib/cache.d.ts +13 -0
  51. package/dist/lib/cache.d.ts.map +1 -1
  52. package/dist/lib/cache.js +15 -0
  53. package/dist/lib/cache.js.map +1 -1
  54. package/dist/lib/execution.d.ts +105 -1
  55. package/dist/lib/execution.d.ts.map +1 -1
  56. package/dist/lib/execution.js +73 -1
  57. package/dist/lib/execution.js.map +1 -1
  58. package/dist/lib/redact.d.ts +2 -1
  59. package/dist/lib/redact.d.ts.map +1 -1
  60. package/dist/lib/redact.js +19 -7
  61. package/dist/lib/redact.js.map +1 -1
  62. package/dist/lib/research-state.d.ts +104 -0
  63. package/dist/lib/research-state.d.ts.map +1 -0
  64. package/dist/lib/research-state.js +214 -0
  65. package/dist/lib/research-state.js.map +1 -0
  66. package/dist/lib/search-topic.d.ts +21 -0
  67. package/dist/lib/search-topic.d.ts.map +1 -0
  68. package/dist/lib/search-topic.js +36 -0
  69. package/dist/lib/search-topic.js.map +1 -0
  70. package/dist/providers/minimax/adapter.d.ts.map +1 -1
  71. package/dist/providers/minimax/adapter.js +41 -4
  72. package/dist/providers/minimax/adapter.js.map +1 -1
  73. package/dist/providers/minimax/vision-conformance.d.ts +2 -2
  74. package/dist/providers/minimax/vision-conformance.js +2 -2
  75. package/dist/providers/registry.d.ts.map +1 -1
  76. package/dist/providers/registry.js +2 -0
  77. package/dist/providers/registry.js.map +1 -1
  78. package/dist/providers/tavily/adapter.d.ts +62 -0
  79. package/dist/providers/tavily/adapter.d.ts.map +1 -0
  80. package/dist/providers/tavily/adapter.js +970 -0
  81. package/dist/providers/tavily/adapter.js.map +1 -0
  82. package/dist/providers/tavily/client.d.ts +184 -0
  83. package/dist/providers/tavily/client.d.ts.map +1 -0
  84. package/dist/providers/tavily/client.js +486 -0
  85. package/dist/providers/tavily/client.js.map +1 -0
  86. package/dist/providers/tavily/credentials.d.ts +34 -0
  87. package/dist/providers/tavily/credentials.d.ts.map +1 -0
  88. package/dist/providers/tavily/credentials.js +56 -0
  89. package/dist/providers/tavily/credentials.js.map +1 -0
  90. package/dist/providers/tavily/diagnostics.d.ts +44 -0
  91. package/dist/providers/tavily/diagnostics.d.ts.map +1 -0
  92. package/dist/providers/tavily/diagnostics.js +70 -0
  93. package/dist/providers/tavily/diagnostics.js.map +1 -0
  94. package/dist/providers/tavily/quota.d.ts +60 -0
  95. package/dist/providers/tavily/quota.d.ts.map +1 -0
  96. package/dist/providers/tavily/quota.js +186 -0
  97. package/dist/providers/tavily/quota.js.map +1 -0
  98. package/dist/providers/types.d.ts +14 -2
  99. package/dist/providers/types.d.ts.map +1 -1
  100. package/dist/providers/types.js +1 -1
  101. package/dist/providers/types.js.map +1 -1
  102. package/dist/providers/zai/adapter.d.ts.map +1 -1
  103. package/dist/providers/zai/adapter.js +6 -1
  104. package/dist/providers/zai/adapter.js.map +1 -1
  105. package/dist/providers/zai/encoded-error.d.ts.map +1 -1
  106. package/dist/providers/zai/encoded-error.js +8 -6
  107. package/dist/providers/zai/encoded-error.js.map +1 -1
  108. package/package.json +1 -1
package/README.md CHANGED
@@ -398,11 +398,10 @@ Cache hits construct and close no transport.
398
398
 
399
399
  ### Diagnostics inventory
400
400
 
401
- `sharedCapabilities` and `zaiOnlyCapabilities` are derived from descriptor
402
- metadata (intersection across built-in Providers; Z.AI minus the union of
403
- the others). `repository-exploration` is therefore `zaiOnlyCapabilities`
404
- while still participating in Provider selection. Doctor help names MiniMax
405
- as unsupported for `repo`.
401
+ `capabilityMatrix` is derived from descriptor metadata: for each advertised
402
+ capability, the providers that supply it (in descriptor order).
403
+ `repository-exploration` therefore lists only `zai` while still participating
404
+ in Provider selection. Doctor help names MiniMax as unsupported for `repo`.
406
405
 
407
406
  ### Non-goals
408
407
 
@@ -502,10 +501,10 @@ result. Cache hits construct and close no transport.
502
501
 
503
502
  ### Diagnostics inventory
504
503
 
505
- `sharedCapabilities` and `zaiOnlyCapabilities` are derived from descriptor
506
- metadata. `reader` is therefore `zaiOnlyCapabilities` while still
507
- participating in Provider selection, and Doctor help names MiniMax as
508
- unsupported for `read`.
504
+ `capabilityMatrix` is derived from descriptor metadata: for each advertised
505
+ capability, the providers that supply it. `reader` therefore lists only
506
+ `zai` while still participating in Provider selection, and Doctor help names
507
+ MiniMax as unsupported for `read`.
509
508
 
510
509
  ### Non-goals
511
510
 
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,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,iDAAiD;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACtC,oEAAoE;IACpE,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzC,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,UAAU,GAAG,MAAM,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAMD;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,eAAe,CAAC,YAAY,EAAE,WAAW,CAAC;IAChF,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;CAChC;AAkBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CA6BpE"}
@@ -0,0 +1,62 @@
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
+ // ===========================================================================
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,CA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AAU,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-1 diagnostics report every `doctor`
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 (P6-06):
26
- * - `sharedCapabilities` is the intersection across every descriptor
27
- * passed to `buildDiagnosticsReport`, preserving deterministic
28
- * canonical order from the FIRST descriptor.
29
- * - `zaiOnlyCapabilities` is the Z.AI descriptor's capabilities
30
- * minus the union of every OTHER built-in descriptor's
31
- * capabilities, preserving Z.AI descriptor order. Values are
32
- * descriptor capability IDs only no hand-maintained aliases.
33
- * - `repository-exploration` is excluded from shared while any
34
- * built-in lacks it, and included in Z.AI-only the moment Z.AI
35
- * advertises it and another built-in does not.
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: 1;
67
+ readonly schemaVersion: 2;
56
68
  readonly effectiveProvider: ProviderId;
57
- readonly sharedCapabilities: readonly ProviderCapability[];
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 shared Capabilities inventory: the intersection of every
91
- * descriptor's `capabilities()` set, preserving deterministic
92
- * canonical order from the FIRST descriptor in the list.
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
- * Edge cases:
95
- * - Empty descriptor list: returns an empty array.
96
- * - Single descriptor: returns that descriptor's capabilities in
97
- * their declared order (the intersection of one set is itself).
98
- * - Two or more: keeps a capability from the first descriptor iff
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
- * The returned array is frozen so callers cannot mutate the cached
102
- * derivation in place.
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
- * - Z.AI absent from the list: returns an empty array.
113
- * - Z.AI present as the only descriptor: returns its capabilities
114
- * verbatim (the "minus nothing" case).
115
- * - Z.AI with other descriptors: each capability in Z.AI descriptor
116
- * order is kept iff no other descriptor advertises it.
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 values are descriptor capability IDs only. No
119
- * hand-maintained aliases, no parallel base-release list, no
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 deriveZaiOnlyCapabilities(descriptors: readonly ProviderDescriptor[]): readonly ProviderCapability[];
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,UAAU,EAA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diagnostics Capability Contract (DESIGN.md §14, P4-04, P6-06, Doctor Schema v2).
3
3
  *
4
- * Defines the schema-version-1 diagnostics report every `doctor`
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 (P6-06):
26
- * - `sharedCapabilities` is the intersection across every descriptor
27
- * passed to `buildDiagnosticsReport`, preserving deterministic
28
- * canonical order from the FIRST descriptor.
29
- * - `zaiOnlyCapabilities` is the Z.AI descriptor's capabilities
30
- * minus the union of every OTHER built-in descriptor's
31
- * capabilities, preserving Z.AI descriptor order. Values are
32
- * descriptor capability IDs only no hand-maintained aliases.
33
- * - `repository-exploration` is excluded from shared while any
34
- * built-in lacks it, and included in Z.AI-only the moment Z.AI
35
- * advertises it and another built-in does not.
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 shared Capabilities inventory: the intersection of every
49
- * descriptor's `capabilities()` set, preserving deterministic
50
- * canonical order from the FIRST descriptor in the list.
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
- * Edge cases:
53
- * - Empty descriptor list: returns an empty array.
54
- * - Single descriptor: returns that descriptor's capabilities in
55
- * their declared order (the intersection of one set is itself).
56
- * - Two or more: keeps a capability from the first descriptor iff
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
- * The returned array is frozen so callers cannot mutate the cached
60
- * derivation in place.
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
- * - Z.AI absent from the list: returns an empty array.
86
- * - Z.AI present as the only descriptor: returns its capabilities
87
- * verbatim (the "minus nothing" case).
88
- * - Z.AI with other descriptors: each capability in Z.AI descriptor
89
- * order is kept iff no other descriptor advertises it.
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 values are descriptor capability IDs only. No
92
- * hand-maintained aliases, no parallel base-release list, no
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 deriveZaiOnlyCapabilities(descriptors) {
97
- const zai = descriptors.find((d) => d.id === "zai");
98
- if (!zai)
74
+ export function deriveCapabilityMatrix(descriptors) {
75
+ if (descriptors.length === 0)
99
76
  return Object.freeze([]);
100
- const others = descriptors.filter((d) => d.id !== "zai");
101
- if (others.length === 0) {
102
- return Object.freeze([...zai.capabilities()]);
103
- }
104
- const union = new Set();
105
- for (const descriptor of others) {
106
- for (const cap of descriptor.capabilities()) {
107
- union.add(cap);
108
- }
109
- }
110
- const out = [];
111
- for (const cap of zai.capabilities()) {
112
- if (!union.has(cap)) {
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;;;;;;;;;;;;;;;;;;;;;;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 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/capabilities/map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAM1E;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAM3C;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,QAAQ,CAAC,YAAY,CAAC,EAAE,M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