dsh-web-search-pro 0.2.1 → 0.2.4
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/CHANGELOG.md +227 -0
- package/README.en.md +117 -0
- package/README.md +72 -578
- package/assets/skills/dsh-web-search-pro/SKILL.md +13 -12
- package/assets/skills/dsh-web-search-pro/references/config.md +36 -0
- package/assets/skills/dsh-web-search-pro/references/sources.md +13 -7
- package/assets/skills/dsh-web-search-pro/references/troubleshooting.md +3 -1
- package/catalog/sources.v1.json +16 -14
- package/lib/actions/approval.js +50 -1
- package/lib/actions/approval.js.map +1 -1
- package/lib/actions/config.js +274 -0
- package/lib/actions/config.js.map +1 -0
- package/lib/actions/errors.js +8 -1
- package/lib/actions/errors.js.map +1 -1
- package/lib/actions/format.js +10 -0
- package/lib/actions/format.js.map +1 -1
- package/lib/actions/index-view.js +2 -2
- package/lib/actions/index-view.js.map +1 -1
- package/lib/actions/read.js +7 -3
- package/lib/actions/read.js.map +1 -1
- package/lib/actions/registry.js +3 -1
- package/lib/actions/registry.js.map +1 -1
- package/lib/actions/run.js +2 -2
- package/lib/actions/run.js.map +1 -1
- package/lib/actions/schema.js +18 -0
- package/lib/actions/schema.js.map +1 -1
- package/lib/actions/search.js +7 -2
- package/lib/actions/search.js.map +1 -1
- package/lib/actions/sources.js +76 -18
- package/lib/actions/sources.js.map +1 -1
- package/lib/actions/types.js +19 -1
- package/lib/actions/types.js.map +1 -1
- package/lib/browser-access.js +25 -0
- package/lib/browser-access.js.map +1 -1
- package/lib/catalog/recommend.js +11 -3
- package/lib/catalog/recommend.js.map +1 -1
- package/lib/catalog/schema.js +3 -1
- package/lib/catalog/schema.js.map +1 -1
- package/lib/cli/builtin-specs.js +57 -22
- package/lib/cli/builtin-specs.js.map +1 -1
- package/lib/cli/chain.js +13 -12
- package/lib/cli/chain.js.map +1 -1
- package/lib/cli/chains-spec.js +31 -11
- package/lib/cli/chains-spec.js.map +1 -1
- package/lib/cli/engine.js +19 -3
- package/lib/cli/engine.js.map +1 -1
- package/lib/cli/opencli-sites.js +83 -0
- package/lib/cli/opencli-sites.js.map +1 -0
- package/lib/cli/opencli.js +65 -17
- package/lib/cli/opencli.js.map +1 -1
- package/lib/cli/probe.js +1 -1
- package/lib/cli/probe.js.map +1 -1
- package/lib/cli/runner.js +217 -27
- package/lib/cli/runner.js.map +1 -1
- package/lib/cli/spec.js +100 -20
- package/lib/cli/spec.js.map +1 -1
- package/lib/cli/time-text.js +79 -0
- package/lib/cli/time-text.js.map +1 -0
- package/lib/cli/trial.js +57 -0
- package/lib/cli/trial.js.map +1 -0
- package/lib/client/SettingsCard.js +14 -32
- package/lib/client/SettingsCard.js.map +1 -1
- package/lib/client/agent-mark.js +27 -0
- package/lib/client/agent-mark.js.map +1 -0
- package/lib/client/card-frame.js +118 -0
- package/lib/client/card-frame.js.map +1 -0
- package/lib/client/cli-form.js +257 -0
- package/lib/client/cli-form.js.map +1 -0
- package/lib/client/field-docs.js +130 -0
- package/lib/client/field-docs.js.map +1 -0
- package/lib/client/field-keys.js +81 -0
- package/lib/client/field-keys.js.map +1 -0
- package/lib/client/field-rows.js +71 -0
- package/lib/client/field-rows.js.map +1 -0
- package/lib/client/fill.js +3 -0
- package/lib/client/fill.js.map +1 -0
- package/lib/client/form-specs.js +13 -1
- package/lib/client/form-specs.js.map +1 -1
- package/lib/client/form.js +282 -24
- package/lib/client/form.js.map +1 -1
- package/lib/client/group-advanced.js +23 -0
- package/lib/client/group-advanced.js.map +1 -0
- package/lib/client/group-agent.js +28 -0
- package/lib/client/group-agent.js.map +1 -0
- package/lib/client/group-cli.js +136 -0
- package/lib/client/group-cli.js.map +1 -0
- package/lib/client/group-common.js +29 -0
- package/lib/client/group-common.js.map +1 -0
- package/lib/client/group-judge.js +67 -0
- package/lib/client/group-judge.js.map +1 -0
- package/lib/client/group-order.js +201 -0
- package/lib/client/group-order.js.map +1 -0
- package/lib/client/group-runtime.js +33 -0
- package/lib/client/group-runtime.js.map +1 -0
- package/lib/client/group-sources.js +83 -0
- package/lib/client/group-sources.js.map +1 -0
- package/lib/client/groups-basic.js +36 -0
- package/lib/client/groups-basic.js.map +1 -0
- package/lib/client/index.js.map +1 -1
- package/lib/client/json-list.js +50 -0
- package/lib/client/json-list.js.map +1 -0
- package/lib/client/locales.js +666 -219
- package/lib/client/locales.js.map +1 -1
- package/lib/client/order.js +192 -0
- package/lib/client/order.js.map +1 -0
- package/lib/client/overlay-ops.js +46 -0
- package/lib/client/overlay-ops.js.map +1 -0
- package/lib/client/sources-table.js +1 -0
- package/lib/client/sources-table.js.map +1 -1
- package/lib/client/styles.js +74 -47
- package/lib/client/styles.js.map +1 -1
- package/lib/client/text-view.js +98 -0
- package/lib/client/text-view.js.map +1 -0
- package/lib/client/ui-kit.js +120 -0
- package/lib/client/ui-kit.js.map +1 -0
- package/lib/client/validators.js +8 -1
- package/lib/client/validators.js.map +1 -1
- package/lib/client.js +7313 -1571
- package/lib/client.js.map +1 -1
- package/lib/config-fillers.js +53 -0
- package/lib/config-fillers.js.map +1 -0
- package/lib/config-groups.js +49 -0
- package/lib/config-groups.js.map +1 -0
- package/lib/config.js +84 -108
- package/lib/config.js.map +1 -1
- package/lib/default-chain.js +66 -0
- package/lib/default-chain.js.map +1 -0
- package/lib/deps.js +1 -1
- package/lib/deps.js.map +1 -1
- package/lib/engines.js +3 -3
- package/lib/engines.js.map +1 -1
- package/lib/fetch.js +23 -4
- package/lib/fetch.js.map +1 -1
- package/lib/fiber-config.js +5 -0
- package/lib/fiber-config.js.map +1 -0
- package/lib/index.js +36 -7
- package/lib/index.js.map +1 -1
- package/lib/overlay-types.js +88 -0
- package/lib/overlay-types.js.map +1 -0
- package/lib/overlay.js +683 -0
- package/lib/overlay.js.map +1 -0
- package/lib/pipeline/candidates.js +27 -1
- package/lib/pipeline/candidates.js.map +1 -1
- package/lib/pipeline/compile.js +63 -0
- package/lib/pipeline/compile.js.map +1 -1
- package/lib/pipeline/confidence.js +64 -0
- package/lib/pipeline/confidence.js.map +1 -0
- package/lib/pipeline/fusion.js +50 -3
- package/lib/pipeline/fusion.js.map +1 -1
- package/lib/pipeline/plan.js +2 -2
- package/lib/pipeline/plan.js.map +1 -1
- package/lib/pipeline/render.js +20 -2
- package/lib/pipeline/render.js.map +1 -1
- package/lib/pipeline/run.js +17 -5
- package/lib/pipeline/run.js.map +1 -1
- package/lib/pipeline/sources-spec.js +19 -3
- package/lib/pipeline/sources-spec.js.map +1 -1
- package/lib/providers/builtin.js +3 -0
- package/lib/providers/builtin.js.map +1 -1
- package/lib/providers/deepseek.js +348 -0
- package/lib/providers/deepseek.js.map +1 -0
- package/lib/providers/http.js.map +1 -1
- package/lib/providers/keyed-meta.js +7 -0
- package/lib/providers/keyed-meta.js.map +1 -1
- package/lib/providers/platforms.js +18 -17
- package/lib/providers/platforms.js.map +1 -1
- package/lib/providers/registry.js.map +1 -1
- package/lib/restart.js +47 -0
- package/lib/restart.js.map +1 -0
- package/lib/router.js +145 -26
- package/lib/router.js.map +1 -1
- package/lib/rpc-types.js +15 -0
- package/lib/rpc-types.js.map +1 -0
- package/lib/rpc.js +118 -0
- package/lib/rpc.js.map +1 -0
- package/lib/tools.js +10 -4
- package/lib/tools.js.map +1 -1
- package/lib/types/actions/approval.d.ts +11 -0
- package/lib/types/actions/config.d.ts +54 -0
- package/lib/types/actions/format.d.ts +9 -2
- package/lib/types/actions/run.d.ts +1 -0
- package/lib/types/actions/schema.d.ts +7 -1
- package/lib/types/actions/sources.d.ts +29 -3
- package/lib/types/actions/types.d.ts +28 -2
- package/lib/types/browser-access.d.ts +17 -0
- package/lib/types/catalog/recommend.d.ts +4 -0
- package/lib/types/catalog/schema.d.ts +2 -0
- package/lib/types/cli/builtin-specs.d.ts +11 -3
- package/lib/types/cli/chains-spec.d.ts +12 -3
- package/lib/types/cli/engine.d.ts +10 -3
- package/lib/types/cli/opencli-sites.d.ts +24 -0
- package/lib/types/cli/opencli.d.ts +42 -3
- package/lib/types/cli/runner.d.ts +47 -8
- package/lib/types/cli/spec.d.ts +101 -8
- package/lib/types/cli/time-text.d.ts +12 -0
- package/lib/types/cli/trial.d.ts +19 -0
- package/lib/types/client/SettingsCard.d.ts +17 -1
- package/lib/types/client/agent-mark.d.ts +22 -0
- package/lib/types/client/card-frame.d.ts +35 -0
- package/lib/types/client/cli-form.d.ts +97 -0
- package/lib/types/client/field-docs.d.ts +15 -0
- package/lib/types/client/field-keys.d.ts +41 -0
- package/lib/types/client/field-rows.d.ts +70 -0
- package/lib/types/client/fill.d.ts +2 -0
- package/lib/types/client/form-specs.d.ts +12 -3
- package/lib/types/client/form.d.ts +79 -1
- package/lib/types/client/group-advanced.d.ts +9 -0
- package/lib/types/client/group-agent.d.ts +20 -0
- package/lib/types/client/group-cli.d.ts +52 -0
- package/lib/types/client/group-common.d.ts +12 -0
- package/lib/types/client/group-judge.d.ts +17 -0
- package/lib/types/client/group-order.d.ts +26 -0
- package/lib/types/client/group-runtime.d.ts +15 -0
- package/lib/types/client/group-sources.d.ts +46 -0
- package/lib/types/client/groups-basic.d.ts +18 -0
- package/lib/types/client/index.d.ts +8 -0
- package/lib/types/client/json-list.d.ts +21 -0
- package/lib/types/client/locales.d.ts +1079 -200
- package/lib/types/client/order.d.ts +102 -0
- package/lib/types/client/overlay-ops.d.ts +37 -0
- package/lib/types/client/styles.d.ts +56 -41
- package/lib/types/client/text-view.d.ts +22 -0
- package/lib/types/client/ui-kit.d.ts +200 -0
- package/lib/types/config-fillers.d.ts +9 -0
- package/lib/types/config-groups.d.ts +23 -0
- package/lib/types/config.d.ts +263 -225
- package/lib/types/default-chain.d.ts +63 -0
- package/lib/types/engines.d.ts +29 -1
- package/lib/types/fetch.d.ts +12 -3
- package/lib/types/fiber-config.d.ts +18 -0
- package/lib/types/index.d.ts +164 -150
- package/lib/types/overlay-types.d.ts +98 -0
- package/lib/types/overlay.d.ts +141 -0
- package/lib/types/pipeline/candidates.d.ts +17 -0
- package/lib/types/pipeline/compile.d.ts +11 -0
- package/lib/types/pipeline/confidence.d.ts +35 -0
- package/lib/types/pipeline/fusion.d.ts +23 -1
- package/lib/types/pipeline/render.d.ts +16 -0
- package/lib/types/pipeline/run.d.ts +2 -1
- package/lib/types/pipeline/sources-spec.d.ts +5 -2
- package/lib/types/pipeline/types.d.ts +37 -0
- package/lib/types/providers/deepseek.d.ts +130 -0
- package/lib/types/providers/http.d.ts +2 -1
- package/lib/types/providers/keyed-meta.d.ts +5 -0
- package/lib/types/providers/registry.d.ts +7 -0
- package/lib/types/restart.d.ts +52 -0
- package/lib/types/router.d.ts +57 -10
- package/lib/types/rpc-types.d.ts +79 -0
- package/lib/types/rpc.d.ts +74 -0
- package/lib/types/tools.d.ts +6 -0
- package/lib/types/util.d.ts +10 -0
- package/lib/util.js +10 -1
- package/lib/util.js.map +1 -1
- package/package.json +53 -44
- package/scripts/check-client-bundle.mjs +1 -1
- package/scripts/check-docs-links.mjs +107 -0
- package/scripts/cli-login-check.mjs +214 -0
- package/LOGIN.md +0 -161
- package/lib/client/RubricEditor.js +0 -47
- package/lib/client/RubricEditor.js.map +0 -1
- package/lib/client/fields.js +0 -31
- package/lib/client/fields.js.map +0 -1
- package/lib/types/client/RubricEditor.d.ts +0 -6
- package/lib/types/client/fields.d.ts +0 -65
|
@@ -3,17 +3,43 @@
|
|
|
3
3
|
* and the external CLI dependencies the plugin runs.
|
|
4
4
|
* @module web-search-pro/actions/sources
|
|
5
5
|
*/
|
|
6
|
+
import type { ProviderReport } from '../router.ts';
|
|
6
7
|
import type { ResolvedConfig } from '../config.ts';
|
|
7
|
-
import { type ActionDef } from './types.ts';
|
|
8
|
+
import { type ActionDef, type OutputNode } from './types.ts';
|
|
9
|
+
import type { OverlayStore } from '../overlay.ts';
|
|
10
|
+
/** Settings changed in the configuration that the running plugin only reads at start-up (restart.ts). */
|
|
11
|
+
export declare const PENDING_RESTART_SCHEMA: OutputNode;
|
|
12
|
+
/** The state of the agent overlay in one line of data: revision, the overridden keys, and why it is ignored when it is. */
|
|
13
|
+
export declare const OVERLAY_STATE_SCHEMA: OutputNode;
|
|
8
14
|
/**
|
|
9
15
|
* Whether the twitter platform backend can really run: the `twitter` command works (probed by detectDeps)
|
|
10
|
-
* AND the backend is enabled in settings AND its credentials are
|
|
16
|
+
* AND the backend is enabled in settings AND its credentials are available (same gates as the engine). `env` holds the values
|
|
17
|
+
* the router resolved (settings literal -> DSH credentials -> process environment); without it only the process environment is read.
|
|
11
18
|
*/
|
|
12
19
|
export declare function twitterGate(cfg: Pick<ResolvedConfig, 'enableCliBackends' | 'agentReachEnabled'>, dep: {
|
|
13
20
|
available: boolean;
|
|
14
21
|
diagnostic?: string;
|
|
15
|
-
}): {
|
|
22
|
+
}, env?: Readonly<Record<string, string | undefined>>): {
|
|
16
23
|
available: boolean;
|
|
17
24
|
note?: string;
|
|
18
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* The "常用" (common) sources and whether each can run now. Without a key it is not in the default chain; the line says how to configure it.
|
|
28
|
+
* `providers` is the registry report; a stub router without one reports none.
|
|
29
|
+
*/
|
|
30
|
+
export declare function commonSources(providers: ProviderReport[] | undefined): {
|
|
31
|
+
common?: {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
ready: boolean;
|
|
35
|
+
setup?: string;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
/** Revision, overridden keys and validity of the agent overlay, for `sources.status`. */
|
|
39
|
+
export declare function overlayState(overlay: OverlayStore): {
|
|
40
|
+
revision: number;
|
|
41
|
+
keys: string[];
|
|
42
|
+
valid: boolean;
|
|
43
|
+
problem?: string;
|
|
44
|
+
};
|
|
19
45
|
export declare const SOURCES_ACTIONS: ActionDef[];
|
|
@@ -16,7 +16,9 @@ import type { Store } from '../store.ts';
|
|
|
16
16
|
import type { EvidenceService } from '../pipeline/service.ts';
|
|
17
17
|
import type { BrowserGetter } from '../browser-access.ts';
|
|
18
18
|
import type { ProviderState } from '../provider.ts';
|
|
19
|
-
|
|
19
|
+
import type { OverlayStore } from '../overlay.ts';
|
|
20
|
+
import type { PendingRestart } from '../restart.ts';
|
|
21
|
+
export declare const ACTION_GROUPS: readonly ["search", "read", "history", "sources", "rules", "cache", "config"];
|
|
20
22
|
export type ActionGroup = typeof ACTION_GROUPS[number];
|
|
21
23
|
/**
|
|
22
24
|
* One parameter node. A subset of the Host's tool parameter DSL, so the same
|
|
@@ -51,8 +53,10 @@ export interface OutputSchema {
|
|
|
51
53
|
* - `none`: runs directly.
|
|
52
54
|
* - `install`: runs an external installer (`sources.install`).
|
|
53
55
|
* - `local-write`: changes or deletes locally stored data (cache, history rows, extraction rules).
|
|
56
|
+
* - `config`: changes the agent overlay (search order, confidence, platform chains); runs without asking, denied in read-only mode.
|
|
57
|
+
* - `run-program`: lets the plugin run a local program (a custom CLI spec); always asks the user, denied in read-only mode.
|
|
54
58
|
*/
|
|
55
|
-
export type ApprovalClass = 'none' | 'install' | 'local-write';
|
|
59
|
+
export type ApprovalClass = 'none' | 'install' | 'local-write' | 'config' | 'run-program';
|
|
56
60
|
export interface ActionExample {
|
|
57
61
|
args: Record<string, unknown>;
|
|
58
62
|
note?: string;
|
|
@@ -74,9 +78,15 @@ export interface ActionServices {
|
|
|
74
78
|
providerState?: () => ProviderState;
|
|
75
79
|
/** Default characters one text exit may return (config `fetchDefaultChars`). */
|
|
76
80
|
outputCap: () => number;
|
|
81
|
+
/** The agent overlay (run-time settings an agent may change); absent where the host of the actions has none (`config.*` then reports it). */
|
|
82
|
+
overlay?: OverlayStore;
|
|
83
|
+
/** Settings changed in the configuration that the running plugin only reads at start-up. */
|
|
84
|
+
pendingRestart?: () => PendingRestart[];
|
|
77
85
|
}
|
|
78
86
|
export interface ActionContext extends ActionServices {
|
|
79
87
|
signal: AbortSignal;
|
|
88
|
+
/** The session the call belongs to (recorded in the overlay audit trail); undefined outside a session. */
|
|
89
|
+
sessionId?: string;
|
|
80
90
|
}
|
|
81
91
|
export interface ActionDef {
|
|
82
92
|
/** `group.action`. */
|
|
@@ -103,6 +113,12 @@ export interface ActionDef {
|
|
|
103
113
|
unavailable?(env: {
|
|
104
114
|
browserReady: boolean;
|
|
105
115
|
}): string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Checks beyond the parameter schema that need no state and run no side effect, one message per problem ([] when fine).
|
|
118
|
+
* Run on the schema-validated arguments by `runAction` before `execute`, and by the approval hook before the user is asked,
|
|
119
|
+
* so a call that would be refused as INVALID_ARGS never becomes an approval prompt. Keep it a pure function of `args`.
|
|
120
|
+
*/
|
|
121
|
+
precheck?(args: Record<string, any>): string[];
|
|
106
122
|
execute(args: Record<string, any>, ctx: ActionContext): Promise<unknown>;
|
|
107
123
|
/** The result as the text the model reads. */
|
|
108
124
|
render(result: any, args: Record<string, any>): string;
|
|
@@ -117,6 +133,16 @@ export declare class ActionNotFoundError extends Error {
|
|
|
117
133
|
readonly hint?: string | undefined;
|
|
118
134
|
constructor(message: string, hint?: string | undefined);
|
|
119
135
|
}
|
|
136
|
+
/** Raised when something the call needs is not set up here (a broken overlay file, say); mapped to CAPABILITY_UNAVAILABLE. */
|
|
137
|
+
export declare class ActionUnavailableError extends Error {
|
|
138
|
+
readonly hint?: string | undefined;
|
|
139
|
+
constructor(message: string, hint?: string | undefined);
|
|
140
|
+
}
|
|
141
|
+
/** Raised when a write is refused because the stored state moved on since the caller read it (revision mismatch); mapped to ACTION_FAILED with the hint to read again. */
|
|
142
|
+
export declare class ActionConflictError extends Error {
|
|
143
|
+
readonly hint?: string | undefined;
|
|
144
|
+
constructor(message: string, hint?: string | undefined);
|
|
145
|
+
}
|
|
120
146
|
export declare const ERROR_CODES: readonly ["INVALID_ARGS", "UNKNOWN_ACTION", "CAPABILITY_UNAVAILABLE", "POLICY_DENIED", "DEADLINE", "CANCELLED", "NOT_FOUND", "ACTION_FAILED"];
|
|
121
147
|
export type ErrorCode = typeof ERROR_CODES[number];
|
|
122
148
|
export interface ActionErrorBody {
|
|
@@ -42,3 +42,20 @@ export declare function browserState(browser: BrowserService | undefined): {
|
|
|
42
42
|
state: 'ready' | 'incomplete' | 'legacy' | 'missing';
|
|
43
43
|
reason?: string;
|
|
44
44
|
};
|
|
45
|
+
/** What a launch of the browser would do on this machine, as dsh-browser reports it (0.2.2+ `status().browser`). */
|
|
46
|
+
export interface BrowserLaunchReadiness {
|
|
47
|
+
ready: boolean;
|
|
48
|
+
/** Which browser a launch will use (`playwright-chromium`, `system-browser`, ...). */
|
|
49
|
+
source?: string;
|
|
50
|
+
/** Where it is. */
|
|
51
|
+
path?: string;
|
|
52
|
+
/** The one command (or step) that fixes `ready: false`, in dsh-browser's own words. */
|
|
53
|
+
advice?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Whether the browser service can actually launch a browser. The service being present only means the plugin is loaded: a new user
|
|
57
|
+
* has no Playwright Chromium, and whether a system Chrome stands in is dsh-browser's decision. It is asked, never guessed, and
|
|
58
|
+
* only a dsh-browser that reports it (`status().browser`) is believed; any other answer (older plugin, a failing status call)
|
|
59
|
+
* is `undefined`, which callers treat as unknown and say nothing about.
|
|
60
|
+
*/
|
|
61
|
+
export declare function browserLaunchReadiness(browser: BrowserService | undefined): Promise<BrowserLaunchReadiness | undefined>;
|
|
@@ -60,6 +60,10 @@ export interface Suggestion {
|
|
|
60
60
|
/** First counter-example of the entry. */
|
|
61
61
|
notFor?: string;
|
|
62
62
|
verified: boolean;
|
|
63
|
+
/** "常用": the plugin's recommended source (it leads once its key is configured). */
|
|
64
|
+
common?: boolean;
|
|
65
|
+
/** The CLI backend this source runs through, when its adapter was not verified with a real search (`twitter: contract-only — …`). */
|
|
66
|
+
backend?: string;
|
|
63
67
|
sourceFamily?: string;
|
|
64
68
|
}
|
|
65
69
|
export interface Recommendation {
|
|
@@ -62,6 +62,8 @@ export interface CatalogEntry {
|
|
|
62
62
|
invoke?: string;
|
|
63
63
|
/** Curation order among equals (lower first, default 50). */
|
|
64
64
|
rank?: number;
|
|
65
|
+
/** "常用": the plugin's recommended source. Once its key is configured it leads the recommendations, and `search.recommend` marks it. Mirrors the provider descriptor's `common`. */
|
|
66
|
+
common?: boolean;
|
|
65
67
|
/** Short install or configuration text. */
|
|
66
68
|
install: string;
|
|
67
69
|
license: string;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* The built-in CLI adapter specs (dev-plan M12). Every argv, flag and output field was derived from the tool's own
|
|
3
3
|
* `--help` (and, where the help does not show the output shape, from the installed package source or the upstream
|
|
4
4
|
* README), and `verification` records how far each was checked:
|
|
5
|
-
* - `live`: a real read-only search was run and its output parsed (bili, gh, omnireach
|
|
5
|
+
* - `live`: a real read-only search was run and its output parsed (bili, gh, omnireach, yt-dlp, wx-search-cli, xhs; the standalone
|
|
6
|
+
* opencli for the twitter and zhihu sites, see opencli-sites.ts; and Exa through mcporter, which is not a spec);
|
|
6
7
|
* - `contract-only`: help and version probed on a real install, output shape taken from the tool's own source,
|
|
7
|
-
* README or documented output option, because a search needs the user's login or reads browser cookies
|
|
8
|
-
*
|
|
8
|
+
* README or documented output option, because a search needs the user's login or reads browser cookies
|
|
9
|
+
* (zhihu, rdt, twitter, the other opencli sites);
|
|
9
10
|
* - `docs-only`: not installed here; derived from the upstream README (tanso).
|
|
10
11
|
* Fixtures for the contract-only and docs-only parsers are marked "constructed from help/docs" in test/fixtures/cli.
|
|
11
12
|
* @module web-search-pro/cli/builtin-specs
|
|
@@ -24,7 +25,14 @@ export declare const TWITTER_CLI_INSTALLS: {
|
|
|
24
25
|
}[];
|
|
25
26
|
/** The date of the checks recorded below. */
|
|
26
27
|
export declare const SPEC_CHECK_DATE = "2026-10-06";
|
|
28
|
+
/** The omnireach sources that need neither a key, a login nor a browser (the others are `heavy` / booster tiers or need a URL query). */
|
|
29
|
+
export declare const OMNIREACH_KEYLESS_SOURCES = "hackernews,youtube,github,wechat,bilibili";
|
|
27
30
|
/** The `wechat` platform's two tools and the multi-source `omnireach` platform come from the same specs; ids are the backend ids. */
|
|
28
31
|
export declare const BUILTIN_CLI_SPECS: readonly CliAdapterSpec[];
|
|
32
|
+
/**
|
|
33
|
+
* How far the adapter of a command (by its first bin name) was verified: a built-in spec's own record, and for the standalone
|
|
34
|
+
* OpenCLI that of the site of `platform` (`live` for twitter and zhihu), else `contract-only`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function cliVerificationOf(bin: string, platform?: string): string | undefined;
|
|
29
37
|
export declare const builtinSpecById: (id: string) => CliAdapterSpec | undefined;
|
|
30
38
|
export type { CliSearchSpec };
|
|
@@ -4,12 +4,17 @@
|
|
|
4
4
|
* ids exist and which platforms each can serve.
|
|
5
5
|
* @module web-search-pro/cli/chains-spec
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import { OPENCLI_SITE_OF } from './opencli-sites.ts';
|
|
8
|
+
/**
|
|
9
|
+
* The default chain of each platform: first usable backend answers, empty or failing ones fall through in order. The platforms
|
|
10
|
+
* that need a login (xiaohongshu, reddit, twitter, zhihu) try the standalone OpenCLI first: it reads the login of the user's
|
|
11
|
+
* own day-to-day Chrome through the OpenCLI Browser Bridge, so nothing is logged in by the plugin. The standalone CLIs
|
|
12
|
+
* (xhs, rdt, twitter, zhihu) stay as the optional fallback for users who logged them in themselves.
|
|
13
|
+
*/
|
|
8
14
|
export declare const DEFAULT_CHAINS: Readonly<Record<string, readonly string[]>>;
|
|
9
15
|
/** Platforms whose provider is a chain (everything in the default table). */
|
|
10
16
|
export declare const CHAIN_PLATFORMS: readonly string[];
|
|
11
|
-
|
|
12
|
-
export declare const OPENCLI_SITE_OF: Readonly<Record<string, string>>;
|
|
17
|
+
export { OPENCLI_SITE_OF };
|
|
13
18
|
/** Platforms the dsh-browser OpenCLI bridge has a site adapter for (pinned to engines.ts by a test). */
|
|
14
19
|
export declare const BROWSER_OPENCLI_PLATFORMS: readonly string[];
|
|
15
20
|
/** Platforms with a built-in rendered-search-page spec in dsh-browser's searchResults (pinned to platform-search.ts by a test). */
|
|
@@ -18,6 +23,8 @@ export declare const BROWSER_SEARCH_PLATFORMS: readonly string[];
|
|
|
18
23
|
export declare const REST_PLATFORMS: readonly string[];
|
|
19
24
|
/** Backend ids that are not CLI specs. */
|
|
20
25
|
export declare const FIXED_BACKENDS: readonly ["opencli", "browser-opencli", "browser-search", "rest"];
|
|
26
|
+
/** Whether `id` names a platform backend: a built-in CLI spec, a fixed backend, or a custom CLI (`custom-cli:<id>`). */
|
|
27
|
+
export declare function isBackendId(id: string): boolean;
|
|
21
28
|
export interface BackendServing {
|
|
22
29
|
ok: boolean;
|
|
23
30
|
why?: string;
|
|
@@ -32,6 +39,8 @@ export declare function specPlatformsOf(cliAdapters: unknown): {
|
|
|
32
39
|
platforms: Map<string, readonly string[]>;
|
|
33
40
|
diagnostics: string[];
|
|
34
41
|
};
|
|
42
|
+
/** The declared platforms of the user's CLI adapters that no backend chain exists for (the spec would serve nothing there). */
|
|
43
|
+
export declare function customCliPlatformIssues(cliAdapters: unknown): string[];
|
|
35
44
|
/**
|
|
36
45
|
* Every problem of the `platformBackends` setting (shape, unknown platform, unknown or foreign backend id) given the
|
|
37
46
|
* `cliAdapters` setting. The settings card and `sources.status` both call this.
|
|
@@ -7,10 +7,15 @@
|
|
|
7
7
|
import type { Engine, EngineDeps } from '../engines.ts';
|
|
8
8
|
import { CliAdapterError } from './runner.ts';
|
|
9
9
|
import { type CliProbeResult } from './probe.ts';
|
|
10
|
-
import type
|
|
10
|
+
import { type CliAdapterSpec } from './spec.ts';
|
|
11
11
|
import type { runCli } from '../util.ts';
|
|
12
12
|
/** Why a spec is switched off by settings, or undefined when it may run. */
|
|
13
13
|
export declare function disabledBySettings(spec: Pick<CliAdapterSpec, 'id'>, deps: Pick<EngineDeps, 'enableCli' | 'agentReachEnabled'>): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* The environment a spec's credential variables are read from: the process environment overlaid with the values the router
|
|
16
|
+
* resolved (settings literal -> DSH credentials -> process environment). Undefined = the process environment as it is.
|
|
17
|
+
*/
|
|
18
|
+
export declare function specEnv(deps: Pick<EngineDeps, 'cliEnv'>): NodeJS.ProcessEnv | undefined;
|
|
14
19
|
export interface CliLegOptions {
|
|
15
20
|
/** Engine id (default: the spec id). */
|
|
16
21
|
id?: string;
|
|
@@ -21,10 +26,12 @@ export interface CliLegOptions {
|
|
|
21
26
|
home?: string;
|
|
22
27
|
/** The credentials are checked by the caller (the legacy twitter engine). */
|
|
23
28
|
skipCredentialGate?: boolean;
|
|
29
|
+
/** A user-defined spec: every row it returns says which CLI it came from and that nothing here verified it. */
|
|
30
|
+
userDefined?: boolean;
|
|
24
31
|
}
|
|
25
32
|
/** The probe verdict as the structured error a search would raise, or undefined when the command is usable. */
|
|
26
33
|
export declare function probeError(spec: Pick<CliAdapterSpec, 'bins' | 'packageNote'>, probe: CliProbeResult): CliAdapterError | undefined;
|
|
27
|
-
export declare function cliSpecEngine(spec: CliAdapterSpec, platform: string, deps: Pick<EngineDeps, 'enableCli' | 'agentReachEnabled'>, options?: CliLegOptions): Engine;
|
|
34
|
+
export declare function cliSpecEngine(spec: CliAdapterSpec, platform: string, deps: Pick<EngineDeps, 'enableCli' | 'agentReachEnabled' | 'cliEnv'>, options?: CliLegOptions): Engine;
|
|
28
35
|
export interface SpecReadiness {
|
|
29
36
|
ready: boolean;
|
|
30
37
|
installation: 'missing' | 'detected' | 'incompatible';
|
|
@@ -37,7 +44,7 @@ export interface SpecReadiness {
|
|
|
37
44
|
code: 'ok' | 'disabled' | 'cli_missing' | 'cli_incompatible' | 'not_logged_in';
|
|
38
45
|
}
|
|
39
46
|
/** Local readiness of one spec: settings, contract probe, then the credentials it needs. Never runs a search. */
|
|
40
|
-
export declare function specReadiness(spec: CliAdapterSpec, deps: Pick<EngineDeps, 'enableCli' | 'agentReachEnabled'>, options?: {
|
|
47
|
+
export declare function specReadiness(spec: CliAdapterSpec, deps: Pick<EngineDeps, 'enableCli' | 'agentReachEnabled' | 'cliEnv'>, options?: {
|
|
41
48
|
env?: NodeJS.ProcessEnv;
|
|
42
49
|
home?: string;
|
|
43
50
|
}): Promise<SpecReadiness>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The static facts of the standalone OpenCLI sites the plugin searches (free of Node imports, so the catalog and the chain
|
|
3
|
+
* specs can read them): which site serves which platform, how each site's `search` rows map to sources, and how far each
|
|
4
|
+
* mapping was verified. The spec generation itself (src/cli/opencli.ts) reads the live command table.
|
|
5
|
+
* @module web-search-pro/cli/opencli-sites
|
|
6
|
+
*/
|
|
7
|
+
import type { CliAdapterSpec, CliOutputSpec } from './spec.ts';
|
|
8
|
+
/** Platform -> site of the standalone OpenCLI (`opencli <site> search`). */
|
|
9
|
+
export declare const OPENCLI_SITE_OF: Readonly<Record<string, string>>;
|
|
10
|
+
export declare const GENERIC_OUTPUT: CliOutputSpec;
|
|
11
|
+
/**
|
|
12
|
+
* The output mapping of the sites the plugin knows by their real columns. All four print a JSON array of flat rows under `-f json`.
|
|
13
|
+
* - twitter, zhihu: MEASURED (opencli 1.8.8, 2026-10-27, fixtures live-opencli-*). twitter rows are `id, author (handle), bio, text,
|
|
14
|
+
* created_at (X API format), likes (number), views (string), url (https://x.com/i/status/<id>), has_media, media_urls, ...`; the
|
|
15
|
+
* title and meta line follow the standalone twitter backend (text, then author · likes · views · time). zhihu rows are
|
|
16
|
+
* `rank, title, type, author, votes, url` and carry no excerpt and no time.
|
|
17
|
+
* - xiaohongshu, reddit: NOT MEASURED. The only runs failed (login wall; an HTML page instead of JSON), so the mapping is the
|
|
18
|
+
* documented columns of clis/xiaohongshu/search.js (`rank, title, author, likes, published_at (date from the note id), url`,
|
|
19
|
+
* the url is a signed search_result link) and clis/reddit/search.js (`id, title, subreddit (r/x), author, score, comments, url,
|
|
20
|
+
* created_utc (epoch seconds), selftext, ...`), read from the source of 1.8.8.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SITE_OUTPUT: Readonly<Record<string, CliOutputSpec>>;
|
|
23
|
+
/** How far the search of one OpenCLI site was checked (`live`, `contract-only`). */
|
|
24
|
+
export declare function opencliSiteVerification(site: string): NonNullable<CliAdapterSpec['verification']>;
|
|
@@ -8,10 +8,22 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { runCli } from '../util.ts';
|
|
10
10
|
import { type ProbeSubject } from './probe.ts';
|
|
11
|
-
import { type CliAdapterSpec } from './spec.ts';
|
|
11
|
+
import { type CliAdapterSpec, type CliErrorCodesSpec } from './spec.ts';
|
|
12
|
+
import { opencliSiteVerification } from './opencli-sites.ts';
|
|
12
13
|
export { OPENCLI_SITE_OF } from './chains-spec.ts';
|
|
14
|
+
export { opencliSiteVerification };
|
|
13
15
|
/** The command that proves this is the OpenCLI whose `list` output the adapter understands. Verified on 1.8.8. */
|
|
14
16
|
export declare const OPENCLI_PROBE: ProbeSubject;
|
|
17
|
+
/**
|
|
18
|
+
* The browser options every browser-backed site command of OpenCLI accepts (read from `opencli <site> search --help` and
|
|
19
|
+
* dist/src/execution.js of 1.8.8): the command runs in a background window (no focus is taken from the user's Chrome), with an
|
|
20
|
+
* ephemeral site session whose tab is released when it finishes. These are also its defaults; the plugin passes them
|
|
21
|
+
* explicitly so a changed `OPENCLI_WINDOW` / `OPENCLI_SITE_SESSION` environment cannot bring a window to the front, and only
|
|
22
|
+
* when the command itself lists the three options (a command without a browser rejects unknown options).
|
|
23
|
+
*/
|
|
24
|
+
export declare const OPENCLI_SILENT_ARGS: readonly string[];
|
|
25
|
+
/** The probe of one site's search command: it must list the three silent browser options (`opencli <site> search --help`). Local, cached, no browser. */
|
|
26
|
+
export declare function opencliSiteProbe(site: string): ProbeSubject;
|
|
15
27
|
export interface OpencliSite {
|
|
16
28
|
site: string;
|
|
17
29
|
/** `cookie` sites use the user's logged-in Chrome; `public` sites need no login. */
|
|
@@ -19,7 +31,8 @@ export interface OpencliSite {
|
|
|
19
31
|
/** Whether the command drives the browser at all. */
|
|
20
32
|
browser: boolean;
|
|
21
33
|
hasLimit: boolean;
|
|
22
|
-
|
|
34
|
+
/** The site's domain as the command table gives it (`www.zhihu.com`), for the "log in to ..." hint. */
|
|
35
|
+
domain?: string;
|
|
23
36
|
}
|
|
24
37
|
/** Sites with a read `search` command taking a positional query, from the JSON of `opencli list -f json`. Pure. */
|
|
25
38
|
export declare function parseOpencliList(json: string): Map<string, OpencliSite>;
|
|
@@ -34,5 +47,31 @@ export declare function listOpencliSites(options?: {
|
|
|
34
47
|
sites?: Map<string, OpencliSite>;
|
|
35
48
|
problem?: string;
|
|
36
49
|
}>;
|
|
50
|
+
/**
|
|
51
|
+
* The failure format of OpenCLI 1.8.8 (dist/src/errors.js `toEnvelope`, printed as YAML on stderr whatever `-f` says):
|
|
52
|
+
* `ok: false` / `error: { code, message, help?, exitCode }`. Codes, from that file and the site adapters:
|
|
53
|
+
* - AUTH_REQUIRED (exit 77): the Chrome has no login for the site -> not logged in (measured on xiaohongshu);
|
|
54
|
+
* - LOGIN_WALL (77), SECURITY_BLOCK, RATE_LIMITED, FORBIDDEN: an HTML page where JSON was expected, a risk-control block -> blocked;
|
|
55
|
+
* UNKNOWN with a JSON parse error on an HTML body (`Unexpected token '<'`) is the same thing from an adapter that does not
|
|
56
|
+
* check (measured on reddit through a proxy);
|
|
57
|
+
* - EMPTY_RESULT (66), NO_DATA, EMPTY_RESPONSE: nothing found; BROWSER_CONNECT (69): no Chrome / bridge; TIMEOUT (75);
|
|
58
|
+
* - ARGUMENT, INVALID_ARGUMENT, ...: the arguments of this adapter are not accepted by that version.
|
|
59
|
+
* Anything else (COMMAND_EXEC, FETCH_ERROR, HTTP_ERROR, ...) keeps OpenCLI's own message.
|
|
60
|
+
*/
|
|
61
|
+
export declare const OPENCLI_ERROR_CODES: CliErrorCodesSpec;
|
|
37
62
|
/** The spec that runs `opencli <site> search` for one platform, or undefined when the generated spec is invalid (a site named like a write command). */
|
|
38
|
-
export declare function opencliSearchSpec(platform: string, entry: OpencliSite
|
|
63
|
+
export declare function opencliSearchSpec(platform: string, entry: OpencliSite, options?: {
|
|
64
|
+
silent?: boolean;
|
|
65
|
+
}): CliAdapterSpec | undefined;
|
|
66
|
+
export interface OpencliSearchPlan {
|
|
67
|
+
spec?: CliAdapterSpec;
|
|
68
|
+
entry?: OpencliSite;
|
|
69
|
+
problem?: string;
|
|
70
|
+
hint?: string;
|
|
71
|
+
silent: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Everything a search of one platform through the standalone OpenCLI needs, checked locally (the command table and the site's
|
|
75
|
+
* `--help`, never a search): the site's entry, whether its command takes the silent browser options, and the generated spec.
|
|
76
|
+
*/
|
|
77
|
+
export declare function planOpencliSearch(platform: string, site: string): Promise<OpencliSearchPlan>;
|
|
@@ -5,14 +5,20 @@
|
|
|
5
5
|
* @module web-search-pro/cli/runner
|
|
6
6
|
*/
|
|
7
7
|
import type { WebSearchSource } from '@deepseek-ai/dsh-web';
|
|
8
|
-
import { runCli } from '../util.ts';
|
|
8
|
+
import { runCli, type CliResult } from '../util.ts';
|
|
9
9
|
import { EngineError } from '../engine-error.ts';
|
|
10
|
-
import { type CliAdapterSpec, type CliErrorCode, type CliOutputSpec, type CliSearchSpec, type FieldSource } from './spec.ts';
|
|
10
|
+
import { type CliAdapterSpec, type CliErrorCode, type CliErrorCodesSpec, type CliOutputSpec, type CliSearchSpec, type FieldSource } from './spec.ts';
|
|
11
11
|
/** A structured failure of a CLI adapter: `code` is one of {@link CliErrorCode}; `hint` says what the user can do. */
|
|
12
12
|
export declare class CliAdapterError extends EngineError {
|
|
13
13
|
readonly hint?: string | undefined;
|
|
14
14
|
constructor(message: string, code: CliErrorCode, hint?: string | undefined, retryable?: boolean);
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* A NO_PROXY list with its IPv6 entries written without brackets (`[::1]` / `[::1]:8080` -> `::1`). Python's httpx (omnireach, and
|
|
18
|
+
* any tool built on it) refuses a bracketed entry with "Invalid port: ':1]'" and the whole search fails; the DSH Host sets
|
|
19
|
+
* `NO_PROXY` with `[::1]`, which a plain terminal does not (found live 2026-10-26). Every tool that takes NO_PROXY accepts the bare form.
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalizeNoProxy(list: string): string;
|
|
16
22
|
/** The environment a spec's command runs with: the base set, what the spec lists, and the fixed UTF-8 / `env.set` values. */
|
|
17
23
|
export declare function buildCliEnv(spec: Pick<CliAdapterSpec, 'env'>, source?: NodeJS.ProcessEnv): Record<string, string>;
|
|
18
24
|
/** Names of the credential variables a spec relies on that are not set. */
|
|
@@ -22,15 +28,29 @@ export declare function savedLoginPresent(spec: Pick<CliAdapterSpec, 'login'>, o
|
|
|
22
28
|
home?: string;
|
|
23
29
|
exists?: (file: string) => boolean;
|
|
24
30
|
}): boolean | undefined;
|
|
31
|
+
/** Credential variables the plugin also resolves from its own settings / DSH credentials (config literal -> credentials ref -> environment). */
|
|
32
|
+
export declare const SETTINGS_BACKED_ENV: Readonly<Record<string, string>>;
|
|
25
33
|
/** What the user must do to log in: the tool's own command run by them, or the environment variables they set. Never run by the plugin. */
|
|
26
34
|
export declare function loginHint(spec: Pick<CliAdapterSpec, 'bins' | 'login' | 'env'>): string;
|
|
27
35
|
export declare function getPath(root: unknown, dotted: string): unknown;
|
|
28
|
-
export declare function resolveField(source: FieldSource | undefined, item: unknown, empty?: ReadonlySet<string
|
|
36
|
+
export declare function resolveField(source: FieldSource | undefined, item: unknown, empty?: ReadonlySet<string>, now?: number): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the whole stdout of a text-mode command is a JSON object / array or a YAML mapping / sequence document: the tool then
|
|
39
|
+
* printed a structured format the text parsers must not guess at (twitter-cli prints YAML when piped, issue #38).
|
|
40
|
+
*/
|
|
41
|
+
export declare function structuredKind(text: string): 'JSON' | 'YAML' | undefined;
|
|
29
42
|
/**
|
|
30
43
|
* Parse a tool's stdout into the items its output spec describes. A broken payload is CLI_CONTRACT_MISMATCH (the tool is not
|
|
31
44
|
* what the spec says); a payload that says it failed (`expect` not met) is CLI_FAILED with the tool's own message.
|
|
32
45
|
*/
|
|
33
46
|
export declare function parseCliItems(spec: Pick<CliAdapterSpec, 'bins'>, output: CliOutputSpec, stdout: string): unknown[];
|
|
47
|
+
/** The failure payload (`ok: false`, `error: { code, message }`) a tool prints on stderr or stdout: JSON, or a YAML document after any notices. */
|
|
48
|
+
export declare function parseFailurePayload(text: string): unknown;
|
|
49
|
+
/**
|
|
50
|
+
* A failed command run (non-zero exit) as the structured error its own code and message call for, or undefined when the
|
|
51
|
+
* spec lists no codes or the output carries nothing readable (the generic handling then applies).
|
|
52
|
+
*/
|
|
53
|
+
export declare function mapToolFailure(codes: CliErrorCodesSpec | undefined, result: Pick<CliResult, 'code' | 'stdout' | 'stderr'>, spec: Pick<CliAdapterSpec, 'bins' | 'login' | 'env'>, redact?: (text: string) => string): CliAdapterError | EngineError | undefined;
|
|
34
54
|
/** The tool's own error text from a parsed json / yaml payload (`errorPaths`), when it carries one. */
|
|
35
55
|
export declare function payloadError(output: CliOutputSpec, stdout: string): string | undefined;
|
|
36
56
|
/**
|
|
@@ -42,15 +62,26 @@ export declare function stripMarkup(input: string): string;
|
|
|
42
62
|
* Map parsed items to sources by the output spec: http(s) URLs only, snippets and titles capped, tags stripped when asked.
|
|
43
63
|
* `skipped` counts the items (objects) that had no usable link, so the caller can say so instead of silently returning fewer.
|
|
44
64
|
*/
|
|
45
|
-
export declare function mapCliItemsDetailed(output: CliOutputSpec, items: readonly unknown[], count: number): {
|
|
65
|
+
export declare function mapCliItemsDetailed(output: CliOutputSpec, items: readonly unknown[], count: number, now?: number): {
|
|
46
66
|
sources: WebSearchSource[];
|
|
47
67
|
skipped: number;
|
|
48
68
|
};
|
|
49
|
-
export declare function mapCliItems(output: CliOutputSpec, items: readonly unknown[], count: number): WebSearchSource[];
|
|
69
|
+
export declare function mapCliItems(output: CliOutputSpec, items: readonly unknown[], count: number, now?: number): WebSearchSource[];
|
|
70
|
+
/**
|
|
71
|
+
* The result of a `lines: { mode: 'whole' }` command: the whole stdout as ONE source. The text is cut at `maxChars` with a note that
|
|
72
|
+
* says how much was shown; the title is "<id>: <query>"; the link is the stand-in `cli://<id>?q=<query>` (it is no web page, so the
|
|
73
|
+
* evidence pipeline lists it but never fetches it). Undefined when the tool printed nothing.
|
|
74
|
+
*/
|
|
75
|
+
export declare function wholeOutputSource(spec: Pick<CliAdapterSpec, 'id'>, output: CliOutputSpec, query: string, stdout: string): WebSearchSource | undefined;
|
|
50
76
|
/** Parse and map in one go (what the fixtures tests call). */
|
|
51
|
-
export declare function parseCliOutput(spec: Pick<CliAdapterSpec, 'bins'>, search: CliSearchSpec, stdout: string, count?: number): WebSearchSource[];
|
|
52
|
-
/**
|
|
53
|
-
export declare function
|
|
77
|
+
export declare function parseCliOutput(spec: Pick<CliAdapterSpec, 'bins'>, search: CliSearchSpec, stdout: string, count?: number, now?: number): WebSearchSource[];
|
|
78
|
+
/** Split a query into words; double quotes keep a phrase in one word (`a "b c" d` -> `a`, `b c`, `d`) and are dropped. */
|
|
79
|
+
export declare function splitTerms(query: string): string[];
|
|
80
|
+
/**
|
|
81
|
+
* Fill the placeholders of an argv template. A value that would read as a flag gets a leading space (the tool then takes it as the query)
|
|
82
|
+
* unless a `--` precedes it. A `{terms}` token becomes one token per word of the query.
|
|
83
|
+
*/
|
|
84
|
+
export declare function buildArgv(search: Pick<CliSearchSpec, 'argv' | 'maxCount' | 'overfetch'>, input: {
|
|
54
85
|
query: string;
|
|
55
86
|
count: number;
|
|
56
87
|
}): string[];
|
|
@@ -73,6 +104,14 @@ export interface CliRunOptions {
|
|
|
73
104
|
exists?: (file: string) => boolean;
|
|
74
105
|
/** The caller checks the credentials itself (the legacy twitter engine): skip the pre-run credential gate. */
|
|
75
106
|
skipCredentialGate?: boolean;
|
|
107
|
+
/** Test seam: the clock `{ time }` fields read relative texts (`3小时前`) against. */
|
|
108
|
+
now?: number;
|
|
109
|
+
/** Sees what the command printed (secrets redacted) before it is interpreted: the settings card's trial shows the tool's own words. */
|
|
110
|
+
observe?: (result: {
|
|
111
|
+
code: number;
|
|
112
|
+
stdout: string;
|
|
113
|
+
stderr: string;
|
|
114
|
+
}) => void;
|
|
76
115
|
}
|
|
77
116
|
/**
|
|
78
117
|
* Run one spec command for a query and return its sources. Throws {@link CliAdapterError} (CLI_NOT_FOUND,
|