scoutline 0.7.0 → 0.10.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 +31 -20
- package/dist/capabilities/quota.d.ts +12 -1
- package/dist/capabilities/quota.d.ts.map +1 -1
- package/dist/capabilities/quota.js.map +1 -1
- package/dist/capabilities/search.d.ts +11 -1
- package/dist/capabilities/search.d.ts.map +1 -1
- package/dist/commands/crawl.js +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +13 -10
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/map.js +1 -1
- 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.js +1 -1
- package/dist/commands/repo.js +1 -1
- package/dist/commands/research.js +5 -5
- package/dist/commands/research.js.map +1 -1
- package/dist/commands/search.d.ts +2 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +21 -12
- package/dist/commands/search.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/async-job-state.d.ts +119 -0
- package/dist/lib/async-job-state.d.ts.map +1 -0
- package/dist/lib/{research-state.js → async-job-state.js} +43 -34
- package/dist/lib/async-job-state.js.map +1 -0
- package/dist/lib/cache.d.ts +16 -8
- package/dist/lib/cache.d.ts.map +1 -1
- package/dist/lib/cache.js +33 -8
- package/dist/lib/cache.js.map +1 -1
- package/dist/lib/execution.d.ts.map +1 -1
- package/dist/lib/execution.js +8 -4
- package/dist/lib/execution.js.map +1 -1
- package/dist/lib/redact.d.ts +2 -2
- package/dist/lib/redact.d.ts.map +1 -1
- package/dist/lib/redact.js +16 -2
- package/dist/lib/redact.js.map +1 -1
- 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 +894 -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/firecrawl/adapter.d.ts +53 -0
- package/dist/providers/firecrawl/adapter.d.ts.map +1 -0
- package/dist/providers/firecrawl/adapter.js +962 -0
- package/dist/providers/firecrawl/adapter.js.map +1 -0
- package/dist/providers/firecrawl/client.d.ts +182 -0
- package/dist/providers/firecrawl/client.d.ts.map +1 -0
- package/dist/providers/firecrawl/client.js +426 -0
- package/dist/providers/firecrawl/client.js.map +1 -0
- package/dist/providers/firecrawl/credentials.d.ts +38 -0
- package/dist/providers/firecrawl/credentials.d.ts.map +1 -0
- package/dist/providers/firecrawl/credentials.js +60 -0
- package/dist/providers/firecrawl/credentials.js.map +1 -0
- package/dist/providers/firecrawl/diagnostics.d.ts +36 -0
- package/dist/providers/firecrawl/diagnostics.d.ts.map +1 -0
- package/dist/providers/firecrawl/diagnostics.js +65 -0
- package/dist/providers/firecrawl/diagnostics.js.map +1 -0
- package/dist/providers/firecrawl/quota.d.ts +46 -0
- package/dist/providers/firecrawl/quota.d.ts.map +1 -0
- package/dist/providers/firecrawl/quota.js +120 -0
- package/dist/providers/firecrawl/quota.js.map +1 -0
- package/dist/providers/minimax/adapter.js +1 -1
- package/dist/providers/minimax/adapter.js.map +1 -1
- 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 +2 -2
- package/dist/providers/tavily/adapter.d.ts.map +1 -1
- package/dist/providers/tavily/adapter.js +10 -3
- package/dist/providers/tavily/adapter.js.map +1 -1
- package/dist/providers/types.d.ts +1 -1
- 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 +7 -1
- package/dist/providers/zai/adapter.js.map +1 -1
- package/package.json +1 -1
- package/dist/lib/research-state.d.ts +0 -104
- package/dist/lib/research-state.d.ts.map +0 -1
- package/dist/lib/research-state.js.map +0 -1
- package/dist/providers/minimax/sdk-client.d.ts +0 -29
- package/dist/providers/minimax/sdk-client.d.ts.map +0 -1
- package/dist/providers/minimax/sdk-client.js +0 -50
- package/dist/providers/minimax/sdk-client.js.map +0 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exa Diagnostics Capability (tech-plan §7, Diagnostics Probe).
|
|
3
|
+
*
|
|
4
|
+
* Probes Exa connectivity with a single, cheapest-possible request —
|
|
5
|
+
* `POST /search` with `type: "auto"` and a stub query — so the doctor
|
|
6
|
+
* command can verify a credential authenticates without burning deep
|
|
7
|
+
* credits. Mirrors `providers/tavily/diagnostics.ts`.
|
|
8
|
+
*
|
|
9
|
+
* The probe intentionally avoids the (deferred) usage endpoint entirely.
|
|
10
|
+
* `/search` with `type: "auto"` is the cheapest credible connectivity
|
|
11
|
+
* check; doctor catches the throw and records a redacted error entry.
|
|
12
|
+
*
|
|
13
|
+
* Boundary rules (ARCHITECTURE.md §2):
|
|
14
|
+
* - May import the diagnostics capability contract, Adapter-local
|
|
15
|
+
* config, Adapter-local search transport, and normalized errors.
|
|
16
|
+
* - Must NOT import command presentation or another Provider's
|
|
17
|
+
* Adapter.
|
|
18
|
+
*/
|
|
19
|
+
import type { DiagnosticsCapability } from "../../capabilities/diagnostics.js";
|
|
20
|
+
import { type ExaTransportDeps } from "./client.js";
|
|
21
|
+
/**
|
|
22
|
+
* Options for the Exa DiagnosticsCapability. The API key is
|
|
23
|
+
* resolved from `env`; transport dependencies (`fetch`, timer) are
|
|
24
|
+
* injectable for deterministic tests through the unified `transport`
|
|
25
|
+
* seam.
|
|
26
|
+
*/
|
|
27
|
+
export interface ExaDiagnosticsCapabilityOptions {
|
|
28
|
+
readonly env: NodeJS.ProcessEnv;
|
|
29
|
+
readonly transport?: ExaTransportDeps;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build the Exa DiagnosticsCapability. The probe performs ONE
|
|
33
|
+
* `/search` request with `type: "auto"` and a stub query so it costs
|
|
34
|
+
* the cheapest credible request. Shared execution owns the retry policy;
|
|
35
|
+
* this transport performs exactly one attempt per invocation.
|
|
36
|
+
*
|
|
37
|
+
* When `options.probe` is false, `invoke` resolves immediately without
|
|
38
|
+
* touching the network — the doctor command skips probing unconfigured
|
|
39
|
+
* or tools-disabled Providers before reaching this Capability.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createExaDiagnosticsCapability(options: ExaDiagnosticsCapabilityOptions): DiagnosticsCapability;
|
|
42
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../src/providers/exa/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAqB,MAAM,mCAAmC,CAAC;AAUlG,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA8BpE;;;;;GAKG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,+BAA+B,GACvC,qBAAqB,CAcvB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exa Diagnostics Capability (tech-plan §7, Diagnostics Probe).
|
|
3
|
+
*
|
|
4
|
+
* Probes Exa connectivity with a single, cheapest-possible request —
|
|
5
|
+
* `POST /search` with `type: "auto"` and a stub query — so the doctor
|
|
6
|
+
* command can verify a credential authenticates without burning deep
|
|
7
|
+
* credits. Mirrors `providers/tavily/diagnostics.ts`.
|
|
8
|
+
*
|
|
9
|
+
* The probe intentionally avoids the (deferred) usage endpoint entirely.
|
|
10
|
+
* `/search` with `type: "auto"` is the cheapest credible connectivity
|
|
11
|
+
* check; doctor catches the throw and records a redacted error entry.
|
|
12
|
+
*
|
|
13
|
+
* Boundary rules (ARCHITECTURE.md §2):
|
|
14
|
+
* - May import the diagnostics capability contract, Adapter-local
|
|
15
|
+
* config, Adapter-local search transport, and normalized errors.
|
|
16
|
+
* - Must NOT import command presentation or another Provider's
|
|
17
|
+
* Adapter.
|
|
18
|
+
*/
|
|
19
|
+
import { ApiError, AuthError, ConfigurationError, NetworkError, QuotaError, TimeoutError, } from "../../lib/errors.js";
|
|
20
|
+
import { requireExaApiKey } from "./credentials.js";
|
|
21
|
+
import { fetchExaSearch } from "./client.js";
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// Failure normalization (mirror the Adapter's search-path mapping)
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
/**
|
|
26
|
+
* Probe failure wrapper. Mirrors the Adapter's `normalizeExaError`
|
|
27
|
+
* for the subset of errors the probe can surface. The probe throws on
|
|
28
|
+
* failure; the doctor command catches the throw and records a redacted
|
|
29
|
+
* error entry. We never embed raw Provider bodies.
|
|
30
|
+
*/
|
|
31
|
+
function normalizeProbeError(error) {
|
|
32
|
+
if (error instanceof AuthError ||
|
|
33
|
+
error instanceof QuotaError ||
|
|
34
|
+
error instanceof ApiError ||
|
|
35
|
+
error instanceof NetworkError ||
|
|
36
|
+
error instanceof TimeoutError ||
|
|
37
|
+
error instanceof ConfigurationError) {
|
|
38
|
+
return error;
|
|
39
|
+
}
|
|
40
|
+
return new ApiError("Exa diagnostics probe failed", 500);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Build the Exa DiagnosticsCapability. The probe performs ONE
|
|
44
|
+
* `/search` request with `type: "auto"` and a stub query so it costs
|
|
45
|
+
* the cheapest credible request. Shared execution owns the retry policy;
|
|
46
|
+
* this transport performs exactly one attempt per invocation.
|
|
47
|
+
*
|
|
48
|
+
* When `options.probe` is false, `invoke` resolves immediately without
|
|
49
|
+
* touching the network — the doctor command skips probing unconfigured
|
|
50
|
+
* or tools-disabled Providers before reaching this Capability.
|
|
51
|
+
*/
|
|
52
|
+
export function createExaDiagnosticsCapability(options) {
|
|
53
|
+
const { env, transport } = options;
|
|
54
|
+
return {
|
|
55
|
+
async invoke(diagOptions) {
|
|
56
|
+
if (!diagOptions.probe)
|
|
57
|
+
return;
|
|
58
|
+
const apiKey = requireExaApiKey(env);
|
|
59
|
+
try {
|
|
60
|
+
// `type: "auto"` -> cheapest credible probe.
|
|
61
|
+
await fetchExaSearch(apiKey, "scoutline-doctor-probe", { type: "auto" }, transport);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw normalizeProbeError(error);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../../src/providers/exa/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAyB,MAAM,aAAa,CAAC;AAEpE,8EAA8E;AAC9E,mEAAmE;AACnE,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,KAAc;IACzC,IACE,KAAK,YAAY,SAAS;QAC1B,KAAK,YAAY,UAAU;QAC3B,KAAK,YAAY,QAAQ;QACzB,KAAK,YAAY,YAAY;QAC7B,KAAK,YAAY,YAAY;QAC7B,KAAK,YAAY,kBAAkB,EACnC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;AAC3D,CAAC;AAiBD;;;;;;;;;GASG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAAwC;IAExC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IACnC,OAAO;QACL,KAAK,CAAC,MAAM,CAAC,WAA8B;YACzC,IAAI,CAAC,WAAW,CAAC,KAAK;gBAAE,OAAO;YAC/B,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,CAAC;gBACH,6CAA6C;gBAC7C,MAAM,cAAc,CAAC,MAAM,EAAE,wBAAwB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,CAAC;YACtF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firecrawl Provider Adapter (firecrawl tech-plan §1, D3–D6).
|
|
3
|
+
*
|
|
4
|
+
* Implements the Firecrawl Provider Descriptor with Search, Reader, Map,
|
|
5
|
+
* async Crawl, Quota, and Diagnostics capabilities on top of the
|
|
6
|
+
* direct-HTTP transport (`./client.ts`). The Adapter owns credentials,
|
|
7
|
+
* transport lifecycle, Provider field mapping, and failure normalization;
|
|
8
|
+
* shared execution owns cache and retry policy.
|
|
9
|
+
*
|
|
10
|
+
* Boundary rules (ARCHITECTURE.md §2):
|
|
11
|
+
* - May import capability types, normalized errors, Provider identity
|
|
12
|
+
* types, and the Adapter-local credential and transport Modules.
|
|
13
|
+
* - Must NOT import command presentation, output mode, or another
|
|
14
|
+
* Provider's Adapter.
|
|
15
|
+
*
|
|
16
|
+
* Field mapping (tech-plan D4/D5/D6; investigation §3.1–§3.4):
|
|
17
|
+
* Search data[].title -> title
|
|
18
|
+
* Search data[].url -> url
|
|
19
|
+
* Search data[].markdown -> summary (high content-size; else description)
|
|
20
|
+
* Search data[].description -> summary (medium content-size fallback)
|
|
21
|
+
*
|
|
22
|
+
* Scrape data.markdown|text -> content
|
|
23
|
+
* Scrape data.metadata.sourceURL -> finalUrl
|
|
24
|
+
* Scrape data.metadata.title -> title (better than Tavily's null)
|
|
25
|
+
*
|
|
26
|
+
* Map links[] -> urls
|
|
27
|
+
*/
|
|
28
|
+
import type { ProviderDescriptor } from "../types.js";
|
|
29
|
+
import { type AsyncJobStateFile } from "../../lib/async-job-state.js";
|
|
30
|
+
import { type FirecrawlTransportDeps } from "./client.js";
|
|
31
|
+
/**
|
|
32
|
+
* Dependencies the Firecrawl Adapter accepts. The unified `transport`
|
|
33
|
+
* seam carries `fetch` and timer injection; `crawlStateFile` is the
|
|
34
|
+
* async-job-state port the async Crawl Capability uses for
|
|
35
|
+
* resume-on-restart (tech-plan D2). Production defaults to the on-disk
|
|
36
|
+
* implementation under `~/.scoutline/crawl/`; tests inject in-memory
|
|
37
|
+
* doubles to exercise the lifecycle deterministically.
|
|
38
|
+
*/
|
|
39
|
+
export interface FirecrawlAdapterDependencies {
|
|
40
|
+
readonly transport?: FirecrawlTransportDeps;
|
|
41
|
+
readonly crawlStateFile?: AsyncJobStateFile;
|
|
42
|
+
/** Disk dir for the crawl create-lock; defaults to asyncJobStateDir("crawl"). */
|
|
43
|
+
readonly crawlStateDir?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Build the Firecrawl Provider Descriptor. Advertises the full Firecrawl
|
|
47
|
+
* capability set. `create()` wires all six capabilities — Search, Reader,
|
|
48
|
+
* Map, async Crawl (create→poll→resume + reclaim-on-miss), Quota
|
|
49
|
+
* (`unit:"credits"`), and Diagnostics (single-scrape probe). Construction
|
|
50
|
+
* is side-effect-free; the transport is invoked per Capability call.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createFirecrawlDescriptor(dependencies?: FirecrawlAdapterDependencies): ProviderDescriptor;
|
|
53
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/providers/firecrawl/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAMH,OAAO,KAAK,EAIV,kBAAkB,EACnB,MAAM,aAAa,CAAC;AA4BrB,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,8BAA8B,CAAC;AAYtC,OAAO,EAYL,KAAK,sBAAsB,EAC5B,MAAM,aAAa,CAAC;AA0hCrB;;;;;;;GAOG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,SAAS,CAAC,EAAE,sBAAsB,CAAC;IAC5C,QAAQ,CAAC,cAAc,CAAC,EAAE,iBAAiB,CAAC;IAC5C,iFAAiF;IACjF,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,CAAC,EAAE,4BAA4B,GAC1C,kBAAkB,CAoCpB"}
|