dsh-web-search-pro 0.2.1 → 0.2.3
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 +164 -0
- package/README.md +154 -58
- 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/index.js +30 -5
- 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 +85 -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/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 +41 -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 +50 -42
- package/scripts/check-client-bundle.mjs +1 -1
- package/scripts/cli-login-check.mjs +214 -0
- 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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trial run of a custom CLI spec (settings card, "Try it"): what a search with the draft spec would do, shown before it is saved.
|
|
3
|
+
* It is a real run, not a simulation: the spec is validated by the rule every spec goes through (the read-only guard, no shell, no
|
|
4
|
+
* credentials in argv), the command is probed (version and help only), then ONE search for the sample query runs through the same
|
|
5
|
+
* runner with the spec's own timeout and output cap. The first results and the tool's own words come back; secrets are redacted,
|
|
6
|
+
* a login is never run, and nothing is stored.
|
|
7
|
+
* @module web-search-pro/cli/trial
|
|
8
|
+
*/
|
|
9
|
+
import { type runCli } from '../util.ts';
|
|
10
|
+
import type { TrialResult } from '../rpc-types.ts';
|
|
11
|
+
export interface TrialOptions {
|
|
12
|
+
/** `enableCliBackends`: with it off no custom command runs, trial or search. */
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
/** Test seams. */
|
|
16
|
+
run?: typeof runCli;
|
|
17
|
+
env?: NodeJS.ProcessEnv;
|
|
18
|
+
}
|
|
19
|
+
export declare function trialCli(id: string, rawSpec: unknown, query: string, options: TrialOptions): Promise<TrialResult>;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Web Search Pro settings card, as the Plugins page renders it.
|
|
3
|
+
*
|
|
4
|
+
* The page owns the card frame (its title, disclosure and artwork come from the slot registration), so this component renders
|
|
5
|
+
* only what goes inside: the one-liner for `view: 'summary'`, and for `view: 'page'` a status summary, twelve groups (only
|
|
6
|
+
* "Common" open) and a save bar that stays in view.
|
|
7
|
+
*
|
|
8
|
+
* Common · Search order · Sources · Custom CLI · Reading and evidence · Scoring model · Built-in web tool route ·
|
|
9
|
+
* Runtime and backends · Network and cache · Ranking weights · Agent changes · Advanced: text mode and raw JSON
|
|
10
|
+
*
|
|
11
|
+
* Each group is its own module (`group-*.tsx`) built from the controls in `ui-kit.tsx`: the Host's own switches, buttons,
|
|
12
|
+
* badges, dialogs and help bubbles, plus the few controls the Host has no component for. Every public config field has
|
|
13
|
+
* exactly one entry in the groups (test/settings-card-render.test.ts counts them); the text of the last group is a view of
|
|
14
|
+
* the same fields, not a second place they live.
|
|
15
|
+
* @module web-search-pro/client/SettingsCard
|
|
16
|
+
*/
|
|
1
17
|
import type { SettingsCardProps } from './index.ts';
|
|
2
|
-
export declare function SettingsCard(props: SettingsCardProps):
|
|
18
|
+
export declare function SettingsCard(props: SettingsCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mark beside a setting that an agent changed with `config.*`: "Changed by agent", whose tooltip says what the agent set, what the
|
|
3
|
+
* configuration holds, why and when, and (outside the cramped list rows) the two buttons that settle it: adopt the value into the
|
|
4
|
+
* configuration, or revoke it. The data is the plugin's overlay, read once over the card's RPC channel when the panel opens and again
|
|
5
|
+
* on the refresh button (see group-agent.tsx).
|
|
6
|
+
* @module web-search-pro/client/agent-mark
|
|
7
|
+
*/
|
|
8
|
+
import type { OverlayItem } from '../overlay-types.ts';
|
|
9
|
+
import type { Card } from './field-rows.tsx';
|
|
10
|
+
/** The overlay item of a key in the card's state, or undefined. */
|
|
11
|
+
export declare function useOverlayItem(card: Card, key: string): OverlayItem | undefined;
|
|
12
|
+
/** One sentence for the tooltip: the value the agent set, the one in the configuration, the reason, who and when. */
|
|
13
|
+
export declare function agentTip(t: Card['t'], item: OverlayItem): string;
|
|
14
|
+
/**
|
|
15
|
+
* `compact` shows the tag only (list rows have no room for buttons; the "Agent changes" group holds them); otherwise the tag is followed
|
|
16
|
+
* by "Adopt into configuration" and "Revoke".
|
|
17
|
+
*/
|
|
18
|
+
export declare function AgentMark({ card, itemKey, compact }: {
|
|
19
|
+
card: Card;
|
|
20
|
+
itemKey: string;
|
|
21
|
+
compact?: boolean;
|
|
22
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The frame around the groups: the status summary on top (with the warnings dialog) and the save bar at the bottom.
|
|
3
|
+
*
|
|
4
|
+
* The Host's `SettingsForm` offers one save button below the controls. This card needs the bar to stay in view while a long
|
|
5
|
+
* page scrolls, to say how many edits are waiting, and to offer "Discard", so the frame is built here; the behaviors a
|
|
6
|
+
* settings form has are kept: it says so when the settings are not served or read-only, and it drops the staged edits when
|
|
7
|
+
* the page is left.
|
|
8
|
+
* @module web-search-pro/client/card-frame
|
|
9
|
+
*/
|
|
10
|
+
import { type ReactNode } from 'react';
|
|
11
|
+
import { type ChainInput } from '../default-chain.ts';
|
|
12
|
+
import { type Card } from './field-rows.tsx';
|
|
13
|
+
import type { WebSearchCardState } from './form.ts';
|
|
14
|
+
/** What the default chain rule reads from the staged settings: the list, the preferences, the ready common sources, the policy. */
|
|
15
|
+
export declare function chainInputOf(snapshot: Pick<WebSearchCardState, 'fields' | 'credentials'>): ChainInput;
|
|
16
|
+
/** The chain a plain search would try, from the staged settings; undefined when the draft leaves nothing to try. */
|
|
17
|
+
export declare function chainOf(snapshot: Pick<WebSearchCardState, 'fields' | 'credentials'>): string[] | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The chain a plain search tries once the agent's changes (engines, priority, disabled of the overlay) are on top of the staged settings,
|
|
20
|
+
* by the same rule; undefined while the agent changed none of the three, an empty list when it would leave nothing to try.
|
|
21
|
+
*/
|
|
22
|
+
export declare function agentChainOf(snapshot: Pick<WebSearchCardState, 'fields' | 'credentials' | 'server'>): string[] | undefined;
|
|
23
|
+
/** Everything the warnings badge counts: what the validation says about a field, and the rubric problems. */
|
|
24
|
+
export declare function warningsOf(snapshot: WebSearchCardState, t: Card['t']): string[];
|
|
25
|
+
export declare function SummaryBar({ card }: {
|
|
26
|
+
card: Card;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
export declare function SaveBar({ card }: {
|
|
29
|
+
card: Card;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/** The page frame: nothing but a notice while the settings are not served; the staged edits are dropped when the page is left. */
|
|
32
|
+
export declare function Frame({ card, children }: {
|
|
33
|
+
card: Card;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The form side of the custom CLI editor: a `cliAdapters` entry (the JSON spec) as the fields of the edit dialog and back. Two
|
|
3
|
+
* views of one object: the form writes the keys it has controls for onto a copy of the spec and leaves every other key as it
|
|
4
|
+
* was (searches, read, env, login, errorCodes, a field mapping that is not a plain path), and the JSON box edits the whole spec.
|
|
5
|
+
* Validation is `validateCliAdapterSpec`, the function the server registers specs with; its messages are sorted to the field they
|
|
6
|
+
* are about. `allowedSubcommands` is derived from the command words of the argv templates, never typed.
|
|
7
|
+
* Pure: no Host, no DOM.
|
|
8
|
+
* @module web-search-pro/client/cli-form
|
|
9
|
+
*/
|
|
10
|
+
import { WHOLE_OUTPUT_DEFAULT_CHARS, type OutputFormat } from '../cli/spec.ts';
|
|
11
|
+
type Json = Record<string, unknown>;
|
|
12
|
+
/** The result fields the form maps, in display order; each takes a dotted path into one item of the tool's output. */
|
|
13
|
+
export declare const FIELD_KEYS: readonly ["url", "title", "snippet", "publishedAt"];
|
|
14
|
+
export type FieldKey = typeof FIELD_KEYS[number];
|
|
15
|
+
/** How a plain text tool's lines become items (`whole` is a switch of its own). */
|
|
16
|
+
export declare const LINE_MODES: readonly ["url-lines", "tsv"];
|
|
17
|
+
export type LineMode = typeof LINE_MODES[number];
|
|
18
|
+
export interface CliForm {
|
|
19
|
+
/** The key in `cliAdapters` (`custom-cli:<id>` everywhere else). */
|
|
20
|
+
id: string;
|
|
21
|
+
/** The command: a name on PATH, never a path. */
|
|
22
|
+
bin: string;
|
|
23
|
+
/** The argument template, one token per entry; `{query}`, `{count}` and `{terms}` are filled in. */
|
|
24
|
+
argv: string[];
|
|
25
|
+
format: OutputFormat;
|
|
26
|
+
/** Text output only: the whole stdout is one result (no field mapping). */
|
|
27
|
+
whole: boolean;
|
|
28
|
+
wholeMax: string;
|
|
29
|
+
/** json / yaml: dotted path of the result array (empty = the root array or the first array found). */
|
|
30
|
+
itemsPath: string;
|
|
31
|
+
linesMode: LineMode;
|
|
32
|
+
/** tsv: the column names, comma separated. */
|
|
33
|
+
columns: string;
|
|
34
|
+
/** A plain dotted path per result field; a mapping that is more than a path is kept as it is and listed in `complex`. */
|
|
35
|
+
fields: Record<FieldKey, string>;
|
|
36
|
+
complex: FieldKey[];
|
|
37
|
+
timeoutMs: string;
|
|
38
|
+
maxOutputBytes: string;
|
|
39
|
+
/** The purposes: a general search engine, and/or the platforms whose backend chain it may sit in. */
|
|
40
|
+
engine: boolean;
|
|
41
|
+
platforms: string[];
|
|
42
|
+
/** Empty = the default (0.5). */
|
|
43
|
+
confidence: string;
|
|
44
|
+
packageNote: string;
|
|
45
|
+
/** The probe: the help command (space separated) and the fragments its output must contain. */
|
|
46
|
+
helpArgs: string;
|
|
47
|
+
mustContain: string[];
|
|
48
|
+
}
|
|
49
|
+
/** The spec a new entry starts from: a JSON-printing tool mapped url / title / snippet. The form fills the command in. */
|
|
50
|
+
export declare function newSpec(): Json;
|
|
51
|
+
/** The example of the dialog: `echo`, whose whole output is the result (no field mapping), a way to see the pieces work without a real tool. */
|
|
52
|
+
export declare function echoSpec(): Json;
|
|
53
|
+
/** The form fields of a spec (plain or not): everything the dialog shows, as text. */
|
|
54
|
+
export declare function specToForm(id: string, raw: unknown): CliForm;
|
|
55
|
+
/** The command words the argv templates of a spec use, in order, without repeats: what `allowedSubcommands` must list. */
|
|
56
|
+
export declare function derivedSubcommands(spec: Json): string[];
|
|
57
|
+
/**
|
|
58
|
+
* The spec the form describes, built on `base` (the entry as it was: every key the form has no control for is kept). Nothing is
|
|
59
|
+
* validated here; a value that is not what its box wants is written as typed so `validateCliAdapterSpec` names it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function formToSpec(form: CliForm, base?: Json): Json;
|
|
62
|
+
/** The names of the dialog's fields that an error message can be about. */
|
|
63
|
+
export type ErrorField = 'id' | 'bin' | 'argv' | 'format' | 'itemsPath' | 'lines' | 'fields' | FieldKey | 'timeoutMs' | 'maxOutputBytes' | 'platforms' | 'engine' | 'confidence' | 'packageNote' | 'probe' | 'general';
|
|
64
|
+
/** Sort the validator's messages (`cliAdapters.<id>.<path>: ...`) to the dialog field they are about. */
|
|
65
|
+
export declare function errorsByField(id: string, errors: readonly string[]): Partial<Record<ErrorField, string[]>>;
|
|
66
|
+
export interface CliCheck {
|
|
67
|
+
spec: Json;
|
|
68
|
+
/** The validator's messages (empty = valid). */
|
|
69
|
+
errors: string[];
|
|
70
|
+
byField: Partial<Record<ErrorField, string[]>>;
|
|
71
|
+
ok: boolean;
|
|
72
|
+
}
|
|
73
|
+
/** Build the spec of a form and validate it the way the server does; `taken` are the ids of the other entries (a new id may not repeat one). */
|
|
74
|
+
export declare function checkForm(form: CliForm, base: Json, taken?: readonly string[]): CliCheck;
|
|
75
|
+
/** Validate a spec (the JSON view): the server's function, plus the one rule only the editor has (an id is not used twice). */
|
|
76
|
+
export declare function checkSpec(id: string, spec: Json, taken?: readonly string[]): CliCheck;
|
|
77
|
+
/** The confidence the entry has: its own, else the default. */
|
|
78
|
+
export declare const confidenceOfForm: (form: CliForm) => number;
|
|
79
|
+
export { WHOLE_OUTPUT_DEFAULT_CHARS };
|
|
80
|
+
/** The JSON text of a spec as the dialog's raw box prints it. */
|
|
81
|
+
export declare const specText: (spec: Json) => string;
|
|
82
|
+
/** The spec a raw JSON text holds, or the reason it is not one. */
|
|
83
|
+
export declare function parseSpecText(text: string): {
|
|
84
|
+
spec: Json;
|
|
85
|
+
} | {
|
|
86
|
+
error: string;
|
|
87
|
+
};
|
|
88
|
+
/** The `cliAdapters` object of the staged text (empty text = no entries); undefined when it is not an object. */
|
|
89
|
+
export declare function adaptersOf(text: string): Json | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* The `cliAdapters` text with entry `id` set to `spec` (a new key goes last), or removed when `spec` is undefined. The other
|
|
92
|
+
* entries are kept as they were. The object with no entries comes back as the empty text, which the form model stores as "not set".
|
|
93
|
+
* Undefined when the current text is not an object (the raw JSON box has to be fixed first).
|
|
94
|
+
*/
|
|
95
|
+
export declare function withAdapter(text: string, id: string, spec: Json | undefined): string | undefined;
|
|
96
|
+
/** A free id for a copy or a new entry: `base`, `base-2`, `base-3`, ... */
|
|
97
|
+
export declare function freeId(base: string, taken: readonly string[]): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The comment printed in front of every key of the text view ("Advanced: text mode"), in the language of the card: what the
|
|
3
|
+
* setting is for, its allowed values or range, its default, and the risk when there is one. Comment lines start with `#`, so
|
|
4
|
+
* the text stays valid YAML and a round trip never reads a comment as data. Pure (it imports only config-groups.ts): the text view and the
|
|
5
|
+
* tests read it, and the client bundle includes it. Nothing here names a secret value: keys are only ever referenced by name.
|
|
6
|
+
* @module web-search-pro/client/field-docs
|
|
7
|
+
*/
|
|
8
|
+
export type DocLang = 'en' | 'zh';
|
|
9
|
+
/** The doc of a config field in a language; undefined only for a field the card does not know. */
|
|
10
|
+
export declare function fieldDoc(field: string, lang?: DocLang | string): string | undefined;
|
|
11
|
+
/** The docs of the groups of keys and the header of the text view. */
|
|
12
|
+
export declare function textViewDocs(lang?: DocLang | string): {
|
|
13
|
+
header: readonly string[];
|
|
14
|
+
group: Readonly<Record<string, string>>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which dictionary entry names a field, which fields carry a `?` text of their own, and the facts about the sources the
|
|
3
|
+
* card lists. Pure data (no imports): the rows, the text view and the tests all read it.
|
|
4
|
+
* @module web-search-pro/client/field-keys
|
|
5
|
+
*/
|
|
6
|
+
import { type ConfigGroupId } from '../config-groups.ts';
|
|
7
|
+
export declare function labelKey(field: string): string;
|
|
8
|
+
/** The fields whose dictionary has a `<key>Help` text (a longer explanation behind the `?`). */
|
|
9
|
+
export declare const WITH_HELP: ReadonlySet<string>;
|
|
10
|
+
/** `?` text applies to the generic budget keys too. */
|
|
11
|
+
export declare const hasHelp: (field: string) => boolean;
|
|
12
|
+
/** Dictionary key of the sentence saying why a start-up-only field needs a plugin restart (restart.ts lists the fields). */
|
|
13
|
+
export declare function restartWhyKey(field: string): string;
|
|
14
|
+
export type SourceTier = 'paid' | 'free-quota' | 'anonymous';
|
|
15
|
+
/** One source the "Sources" list shows and its edit dialog is made of. */
|
|
16
|
+
export interface SourceDef {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
tier: SourceTier;
|
|
20
|
+
/** "常用": the plugin's recommended source (pinned to the registry descriptors by a test). */
|
|
21
|
+
common?: boolean;
|
|
22
|
+
/** The write-only key of the source (`CredentialId`), and the field naming the credential / variable it is stored under. */
|
|
23
|
+
credential?: string;
|
|
24
|
+
envField?: string;
|
|
25
|
+
defaultEnv?: string;
|
|
26
|
+
baseUrlField?: string;
|
|
27
|
+
/** Other fields the dialog holds, in order. */
|
|
28
|
+
extra?: readonly string[];
|
|
29
|
+
/** The request budget of the source (`sources.budget.<id>.total|daily`). */
|
|
30
|
+
budget?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare const SOURCE_DEFS: readonly SourceDef[];
|
|
33
|
+
/** Fields of a source dialog in display order (the key itself is a credential, not a field). */
|
|
34
|
+
export declare function sourceFields(def: SourceDef): string[];
|
|
35
|
+
/** Fields shown as JSON objects, each in its own dialog: the field, the group it sits in. */
|
|
36
|
+
export declare const JSON_FIELDS: readonly {
|
|
37
|
+
field: string;
|
|
38
|
+
group: 'judge' | 'runtime' | 'platform' | 'advanced';
|
|
39
|
+
}[];
|
|
40
|
+
/** Group of the text view of any field: the group of its top-level key (see config-groups.ts, the one list of the layout). */
|
|
41
|
+
export declare function textGroupOf(field: string): ConfigGroupId;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rows for the configuration fields the groups edit, wired to the card's staged form state.
|
|
3
|
+
*
|
|
4
|
+
* One component per control kind (switch, select, text, number, list of ids). Each is the single entry of its field: it renders
|
|
5
|
+
* `data-wsp-field="<field>"`, which test/settings-card-render.test.ts counts, and it reads the label, the one-line hint and the
|
|
6
|
+
* optional `?` text from the dictionary by the field's name (`<key>`, `<key>Hint`, `<key>Help`, see field-keys.ts).
|
|
7
|
+
* @module web-search-pro/client/field-rows
|
|
8
|
+
*/
|
|
9
|
+
import type { SettingsCardProps } from './index.ts';
|
|
10
|
+
import type { CardFieldState, WebSearchCardState } from './form.ts';
|
|
11
|
+
import { fill } from './fill.ts';
|
|
12
|
+
import { type RowLabels, type SelectOption } from './ui-kit.tsx';
|
|
13
|
+
export type Card = SettingsCardProps;
|
|
14
|
+
export type Translator = Card['t'];
|
|
15
|
+
export type LabelKey = Parameters<Translator>[0];
|
|
16
|
+
export { fill };
|
|
17
|
+
export declare function rowLabels(t: Translator): RowLabels;
|
|
18
|
+
/** The id of a field's control, tied to its label. */
|
|
19
|
+
export declare const controlId: (field: string) => string;
|
|
20
|
+
/** The units a number field is written with. */
|
|
21
|
+
declare const UNIT_KEYS: {
|
|
22
|
+
readonly ms: "unitMs";
|
|
23
|
+
readonly sec: "unitSeconds";
|
|
24
|
+
readonly chars: "unitChars";
|
|
25
|
+
readonly count: "unitCount";
|
|
26
|
+
readonly tokens: "unitTokens";
|
|
27
|
+
readonly days: "unitDays";
|
|
28
|
+
readonly rounds: "unitCount";
|
|
29
|
+
};
|
|
30
|
+
export type Unit = keyof typeof UNIT_KEYS;
|
|
31
|
+
export interface FieldProps {
|
|
32
|
+
card: Card;
|
|
33
|
+
/** The setting field this row is the entry of. */
|
|
34
|
+
field: string;
|
|
35
|
+
/** Replaces the dictionary hint. */
|
|
36
|
+
hint?: string;
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
/** Replaces the dictionary label. */
|
|
39
|
+
label?: string;
|
|
40
|
+
/** A short warning badge beside the label. */
|
|
41
|
+
risk?: string;
|
|
42
|
+
/** Hide the "overridden" badge and reset: for fields whose "default" is a computed one. */
|
|
43
|
+
code?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** How many of these fields carry an override: the number a group's badge shows. */
|
|
46
|
+
export declare function useOverriddenCount(card: Card, fields: readonly string[]): number;
|
|
47
|
+
/** The staged state of a field. */
|
|
48
|
+
export declare const stateOf: (snapshot: WebSearchCardState, field: string) => CardFieldState | undefined;
|
|
49
|
+
export declare function useField(card: Card, field: string): {
|
|
50
|
+
state: CardFieldState;
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
edit: (text: string) => void;
|
|
53
|
+
reset: () => void;
|
|
54
|
+
};
|
|
55
|
+
/** A boolean field as a switch. */
|
|
56
|
+
export declare function SwitchRow(props: FieldProps): import("react").JSX.Element;
|
|
57
|
+
/** An enumerated field as a drop-down. */
|
|
58
|
+
export declare function SelectRow(props: FieldProps & {
|
|
59
|
+
options: readonly SelectOption[];
|
|
60
|
+
}): import("react").JSX.Element;
|
|
61
|
+
/** A free-text field. */
|
|
62
|
+
export declare function TextRow(props: FieldProps): import("react").JSX.Element;
|
|
63
|
+
/** A number field with its unit written after the input. */
|
|
64
|
+
export declare function NumberRow(props: FieldProps & {
|
|
65
|
+
unit?: Unit;
|
|
66
|
+
}): import("react").JSX.Element;
|
|
67
|
+
declare const parseList: (text: string) => string[];
|
|
68
|
+
/** A comma-separated list (engine ids, domains) as removable chips with an add box. */
|
|
69
|
+
export declare function ListRow(props: FieldProps): import("react").JSX.Element;
|
|
70
|
+
export { parseList };
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export type Json = Record<string, unknown>;
|
|
14
14
|
/** Top-level config fields (one Host write each). */
|
|
15
|
-
export type TopField = 'engines' | 'parallelEngines' | 'searchMaxResults' | 'timeoutMs' | 'fetchDefaultChars' | 'exaContentsPerUrlChars' | 'exaContentsTotalChars' | 'exaApiKeyEnv' | 'jinaApiKeyEnv' | 'githubTokenEnv' | 'bochaApiKeyEnv' | 'bochaBaseUrl' | 'bochaSummary' | 'searxngUrl' | 'openalexMailto' | 'enableCliBackends' | 'opencliEnabled' | 'agentReachEnabled' | 'providerId' | 'registerProvider' | 'toolSurface' | 'playwright' | 'ttlSeconds' | 'memoryCacheEntries' | 'rrfConstant' | 'freshnessBoost' | 'freshnessDays' | 'authorityBoost' | 'authorityDomains' | 'dbPath' | 'allowProxyFakeIp' | 'platformRules' | 'customPlatforms' | 'browserBindings' | 'platformBackends' | 'cliAdapters' | 'verbose';
|
|
15
|
+
export type TopField = 'engines' | 'parallelEngines' | 'searchMaxResults' | 'timeoutMs' | 'fetchDefaultChars' | 'exaContentsPerUrlChars' | 'exaContentsTotalChars' | 'exaApiKeyEnv' | 'jinaApiKeyEnv' | 'githubTokenEnv' | 'twitterAuthTokenEnv' | 'twitterCt0Env' | 'bochaApiKeyEnv' | 'bochaBaseUrl' | 'bochaSummary' | 'deepseekFetch' | 'searxngUrl' | 'openalexMailto' | 'enableCliBackends' | 'opencliEnabled' | 'agentReachEnabled' | 'providerId' | 'registerProvider' | 'toolSurface' | 'playwright' | 'ttlSeconds' | 'memoryCacheEntries' | 'rrfConstant' | 'freshnessBoost' | 'freshnessDays' | 'authorityBoost' | 'authorityDomains' | 'dbPath' | 'allowProxyFakeIp' | 'platformRules' | 'customPlatforms' | 'browserBindings' | 'platformBackends' | 'cliAdapters' | 'verbose';
|
|
16
16
|
/** Options inside `evidence` / `provider`, addressed by their dotted config path. */
|
|
17
17
|
export type PathField = 'evidence.autoProviders' | 'evidence.sourcePolicy' | 'evidence.maxRounds' | 'evidence.maxQueries' | 'evidence.judge.mode' | 'evidence.hybridBorderline' | 'evidence.judge.provider' | 'evidence.maxJevQuestions' | 'evidence.judge.allowLlm' | 'evidence.judge.providers' | 'evidence.coverage.mode' | 'evidence.coverage.provider' | 'evidence.coverage.thresholds.weak' | 'evidence.coverage.thresholds.covered' | 'evidence.budget.perSearchInputTokens' | 'evidence.budget.dailyInputTokens' | 'evidence.budget.timezone' | 'evidence.budget.providers' | 'provider.evidence' | 'provider.deadlineMs' | 'sources.priority' | 'sources.disabled';
|
|
18
18
|
/** One rubric override entry (`evidence.rubrics.<id>`) and one keyed-source field. */
|
|
@@ -20,7 +20,9 @@ export type RubricField = `evidence.rubrics.${string}`;
|
|
|
20
20
|
export type KeyedField = `keyedSources.${string}.apiKeyEnv` | `keyedSources.${string}.baseUrl`;
|
|
21
21
|
/** One axis of one source's request budget (`sources.budget.<id>.total|daily`). */
|
|
22
22
|
export type BudgetField = `sources.budget.${string}.${'total' | 'daily'}`;
|
|
23
|
-
|
|
23
|
+
/** The confidence of one source or platform backend (`sources.confidence.<id>`): the ids are open, so these fields are made on demand. */
|
|
24
|
+
export type ConfidenceField = `sources.confidence.${string}`;
|
|
25
|
+
export type SettingField = TopField | PathField | RubricField | KeyedField | BudgetField | ConfidenceField;
|
|
24
26
|
export type RootKey = 'evidence' | 'provider' | 'keyedSources' | 'sources';
|
|
25
27
|
export type FieldWrite = {
|
|
26
28
|
kind: 'set';
|
|
@@ -89,8 +91,11 @@ export declare const DEFAULTS: {
|
|
|
89
91
|
};
|
|
90
92
|
readonly toolSurface: "indexed";
|
|
91
93
|
readonly bochaApiKeyEnv: "BOCHA_SEARCH_API_KEY";
|
|
94
|
+
readonly twitterAuthTokenEnv: "TWITTER_AUTH_TOKEN";
|
|
95
|
+
readonly twitterCt0Env: "TWITTER_CT0";
|
|
92
96
|
readonly bochaBaseUrl: "https://api.bocha.cn";
|
|
93
97
|
readonly bochaSummary: true;
|
|
98
|
+
readonly deepseekFetch: false;
|
|
94
99
|
};
|
|
95
100
|
/** Top-level fields, in display order. */
|
|
96
101
|
export declare const FIELD_SPECS: readonly FieldSpec[];
|
|
@@ -105,11 +110,15 @@ export declare const KEYED_SPECS: readonly PathSpec[];
|
|
|
105
110
|
/** The sources the card has a request budget for: Bocha and the keyed sources (any registered id works in settings.yaml). */
|
|
106
111
|
export declare const BUDGETED_SOURCES: readonly string[];
|
|
107
112
|
export declare const BUDGET_SPECS: readonly PathSpec[];
|
|
113
|
+
/** `sources.confidence.<id>`: a number 0..1; empty = the default (1 for a built-in source, the spec's own for a custom CLI). */
|
|
114
|
+
export declare const confidenceSpec: (id: string) => PathSpec;
|
|
115
|
+
export declare const confidenceField: (id: string) => ConfidenceField;
|
|
116
|
+
export declare const CONFIDENCE_PREFIX = "sources.confidence.";
|
|
108
117
|
/** The spec of a rubric override entry: the whole object as one JSON draft, which the rubric editor builds field by field. */
|
|
109
118
|
export declare const rubricSpec: (id: string) => PathSpec;
|
|
110
119
|
export declare const rubricField: (id: string) => RubricField;
|
|
111
120
|
/** Fields that a Host write can never take as text (credentials go through the credentials remote). */
|
|
112
|
-
export declare const CREDENTIAL_IDS: readonly ["exa", "jina", "github", "bocha", ...`keyed:${string}`[]];
|
|
121
|
+
export declare const CREDENTIAL_IDS: readonly ["exa", "jina", "github", "bocha", "twitter-auth-token", "twitter-ct0", ...`keyed:${string}`[]];
|
|
113
122
|
export type CredentialId = typeof CREDENTIAL_IDS[number];
|
|
114
123
|
/** The settings field holding the credentials ref / environment variable name of each credential, and its default name. */
|
|
115
124
|
export declare function credentialRef(id: CredentialId): {
|
|
@@ -2,7 +2,8 @@ import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
|
2
2
|
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
3
3
|
import { type RubricKind } from '../pipeline/rubrics-spec.ts';
|
|
4
4
|
import type { Context } from './context-types.ts';
|
|
5
|
-
import { BUDGET_SPECS, CREDENTIAL_IDS, FIELD_SPECS, KEYED_SPECS, PATH_SPECS, type CredentialId, type SettingField } from './form-specs.ts';
|
|
5
|
+
import { BUDGET_SPECS, CREDENTIAL_IDS, FIELD_SPECS, KEYED_SPECS, PATH_SPECS, type CredentialId, type FieldSpec, type SettingField } from './form-specs.ts';
|
|
6
|
+
import { type OverlayView, type StatusView, type TrialRequest, type TrialResult } from '../rpc-types.ts';
|
|
6
7
|
export { BUDGET_SPECS, CREDENTIAL_IDS, FIELD_SPECS, KEYED_SPECS, PATH_SPECS };
|
|
7
8
|
export type { CredentialId, SettingField };
|
|
8
9
|
export interface CardFieldState {
|
|
@@ -45,10 +46,42 @@ export interface RubricCardState {
|
|
|
45
46
|
invalid: boolean;
|
|
46
47
|
problems: string[];
|
|
47
48
|
}
|
|
49
|
+
/** What the card knows of the agent overlay (the settings an agent changed with `config.*`), read over the RPC channel. */
|
|
50
|
+
export interface OverlayCardState {
|
|
51
|
+
loading: boolean;
|
|
52
|
+
/** The channel answered with an error, or there is none. */
|
|
53
|
+
failed: boolean;
|
|
54
|
+
/** An adopt or revoke is running: the buttons wait. */
|
|
55
|
+
busy: boolean;
|
|
56
|
+
/** The last adopt / revoke that did not go through, as a dictionary key with its `{why}`. */
|
|
57
|
+
error?: {
|
|
58
|
+
key: 'agentAdoptFailed' | 'agentAdoptHalf' | 'agentRevokeFailed';
|
|
59
|
+
why?: string;
|
|
60
|
+
};
|
|
61
|
+
view?: OverlayView;
|
|
62
|
+
}
|
|
63
|
+
/** What the card knows from the running plugin over its private RPC channel (rpc-types.ts); empty where the Host has no transport. */
|
|
64
|
+
export interface ServerState {
|
|
65
|
+
/** The Host has the transport: live readiness and "Try it" are possible. */
|
|
66
|
+
available: boolean;
|
|
67
|
+
loading: boolean;
|
|
68
|
+
failed: boolean;
|
|
69
|
+
status?: StatusView;
|
|
70
|
+
/** The trial run of a custom CLI draft: idle, running, or the last outcome. */
|
|
71
|
+
trial: {
|
|
72
|
+
state: 'idle' | 'running' | 'done' | 'failed';
|
|
73
|
+
id?: string;
|
|
74
|
+
result?: TrialResult;
|
|
75
|
+
error?: string;
|
|
76
|
+
};
|
|
77
|
+
overlay: OverlayCardState;
|
|
78
|
+
}
|
|
48
79
|
export interface WebSearchCardState {
|
|
49
80
|
available: boolean;
|
|
50
81
|
writable: boolean;
|
|
51
82
|
dirty: boolean;
|
|
83
|
+
/** How many staged edits a save would write: fields whose draft differs from what is stored, plus pending secrets. */
|
|
84
|
+
changes: number;
|
|
52
85
|
invalid: boolean;
|
|
53
86
|
saving: boolean;
|
|
54
87
|
failed: boolean;
|
|
@@ -57,9 +90,16 @@ export interface WebSearchCardState {
|
|
|
57
90
|
/** Ids the judge / coverage provider controls offer: the presets plus the valid custom entries of the draft. */
|
|
58
91
|
providerChoices: string[];
|
|
59
92
|
rubrics: RubricCardState[];
|
|
93
|
+
/** Settings read only when the plugin starts (restart.ts) that have an edit waiting to be saved: a save would not take effect until a restart. */
|
|
94
|
+
restartTouched: string[];
|
|
60
95
|
/** Overrides in settings that name no built-in rubric. */
|
|
61
96
|
unknownRubrics: string[];
|
|
97
|
+
server: ServerState;
|
|
62
98
|
}
|
|
99
|
+
/** Every field spec of the form model, in display order. */
|
|
100
|
+
export declare const ALL_SPECS: readonly FieldSpec[];
|
|
101
|
+
/** The specs of the dynamic fields among `fields` (the text view prints them next to the fixed ones). */
|
|
102
|
+
export declare function dynamicSpecsOf(fields: Readonly<Record<string, unknown>>): FieldSpec[];
|
|
63
103
|
export declare class WebSearchSettingsController {
|
|
64
104
|
private readonly scope;
|
|
65
105
|
private readonly ctx;
|
|
@@ -75,7 +115,26 @@ export declare class WebSearchSettingsController {
|
|
|
75
115
|
private credentialGeneration;
|
|
76
116
|
private credentialRefSignature;
|
|
77
117
|
private credentialStates;
|
|
118
|
+
private server;
|
|
119
|
+
private trialGeneration;
|
|
78
120
|
constructor(scope: ConfigForm<Record<string, unknown>>, ctx: Context);
|
|
121
|
+
/** The Host's RPC client, read when it is used (the service may arrive after the card was registered); undefined where there is none. */
|
|
122
|
+
private rpc;
|
|
123
|
+
/** Ask the plugin what is ready now (the same local probes as `sources.status`). Silent when the Host has no transport. */
|
|
124
|
+
refreshStatus(): Promise<void>;
|
|
125
|
+
private setOverlay;
|
|
126
|
+
/** Read what the agent overlay holds (once when the panel opens, and on the refresh button). Silent where the Host has no transport. */
|
|
127
|
+
refreshOverlay(): Promise<void>;
|
|
128
|
+
/** Drop overlay entries (keys, or `'all'`) as the user. The plugin audits it; the card shows the overlay as it is afterwards. */
|
|
129
|
+
revokeOverlay(keys: readonly string[] | 'all', adopted?: boolean): Promise<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* "Adopt into configuration": write the overlay item's value into the profile with the Host's atomic `mutate` (the same call the save bar
|
|
132
|
+
* makes, at the leaf the item is about), and only when that landed ask the plugin to drop the entry. A failed write leaves both as they were.
|
|
133
|
+
*/
|
|
134
|
+
adoptOverlay(key: string): Promise<boolean>;
|
|
135
|
+
/** Run one search of a custom CLI draft (rpc-types.ts `trial`). The outcome lands in `server.trial`. */
|
|
136
|
+
runTrial(request: TrialRequest): Promise<void>;
|
|
137
|
+
clearTrial(): void;
|
|
79
138
|
inject(): {
|
|
80
139
|
hooks: {
|
|
81
140
|
webSearchPro: SnapshotStore<WebSearchCardState>;
|
|
@@ -89,6 +148,12 @@ export declare class WebSearchSettingsController {
|
|
|
89
148
|
save: () => void;
|
|
90
149
|
discard: () => void;
|
|
91
150
|
refreshCredentials: () => void;
|
|
151
|
+
refreshStatus: () => void;
|
|
152
|
+
refreshOverlay: () => void;
|
|
153
|
+
revokeOverlay: (keys: readonly string[] | "all") => void;
|
|
154
|
+
adoptOverlay: (key: string) => void;
|
|
155
|
+
runTrial: (request: TrialRequest) => void;
|
|
156
|
+
clearTrial: () => void;
|
|
92
157
|
};
|
|
93
158
|
snapshot(): WebSearchCardState;
|
|
94
159
|
edit(field: SettingField, text: string): void;
|
|
@@ -107,6 +172,12 @@ export declare class WebSearchSettingsController {
|
|
|
107
172
|
refreshCredentials(): Promise<void>;
|
|
108
173
|
dispose(): void;
|
|
109
174
|
private project;
|
|
175
|
+
/** The start-up-only settings (restart.ts) whose staged edit differs from what is stored. */
|
|
176
|
+
private restartTouched;
|
|
177
|
+
/** `playwright` is one JSON field; only its `snapshotDir` is a start-up setting (`enabled` is live). */
|
|
178
|
+
private snapshotDirTouched;
|
|
179
|
+
/** Staged fields that differ from what is stored (a pending reset counts only when something is stored). */
|
|
180
|
+
private changedFields;
|
|
110
181
|
private decorate;
|
|
111
182
|
private projectRubrics;
|
|
112
183
|
/** The state of one control from the staged draft, else from the Host section. */
|
|
@@ -117,11 +188,18 @@ export declare class WebSearchSettingsController {
|
|
|
117
188
|
* evidence settings the draft would produce are then checked with the server's own validators.
|
|
118
189
|
*/
|
|
119
190
|
private analyze;
|
|
191
|
+
/**
|
|
192
|
+
* The Host ops of a top-level field. A container the schema does not declare volatile as a whole (`playwright`: its keys are)
|
|
193
|
+
* is written key by key; every other field is one `set` or one `unset`.
|
|
194
|
+
*/
|
|
195
|
+
private topOps;
|
|
120
196
|
private opsOf;
|
|
121
197
|
private credentialPlan;
|
|
122
198
|
private writeCredential;
|
|
123
199
|
/** The credentials ref / environment variable name each key is read from, from the saved settings (else the default). */
|
|
124
200
|
private credentialRefs;
|
|
201
|
+
/** The `sources.confidence.<id>` fields that hold a value now or in the draft: the card shows these ids with their values. */
|
|
202
|
+
private dynamicFields;
|
|
125
203
|
private spec;
|
|
126
204
|
private resolvedRoot;
|
|
127
205
|
private sectionValue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Advanced: text mode": the settings as one commented YAML text, to read or copy. It is a view of the controls (it prints
|
|
3
|
+
* the staged state, secrets excluded), not a second place the settings live. Every key has a comment in front of it.
|
|
4
|
+
* @module web-search-pro/client/group-advanced
|
|
5
|
+
*/
|
|
6
|
+
import { type Card } from './field-rows.tsx';
|
|
7
|
+
export declare function AdvancedGroup({ card }: {
|
|
8
|
+
card: Card;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Agent changes": what an agent changed with the `config.*` actions, kept apart from the user's configuration. The plugin keeps those
|
|
3
|
+
* changes in a managed overlay file that takes effect at once and never edits the profile; this group lists every entry with the reason
|
|
4
|
+
* and time the agent gave, the newest audit records, and for each entry two buttons: "Adopt into configuration" (write the value into
|
|
5
|
+
* the profile with the card's atomic write, then drop the overlay entry) and "Revoke" (drop it). "Revoke all" empties the overlay, which
|
|
6
|
+
* also repairs a file the plugin had to ignore. The card reads the overlay once when it opens and on the refresh button.
|
|
7
|
+
* @module web-search-pro/client/group-agent
|
|
8
|
+
*/
|
|
9
|
+
import type { OverlayItem } from '../overlay-types.ts';
|
|
10
|
+
import { type Card } from './field-rows.tsx';
|
|
11
|
+
/** One overlay entry: what it is, the value the agent set against the one in the configuration, why and when, and the two buttons. */
|
|
12
|
+
export declare function AgentItem({ card, item, busy, items }: {
|
|
13
|
+
card: Card;
|
|
14
|
+
item: OverlayItem;
|
|
15
|
+
busy: boolean;
|
|
16
|
+
items: readonly OverlayItem[];
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
export declare function AgentGroup({ card }: {
|
|
19
|
+
card: Card;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Custom CLI": the command-line tools the user adds, as a list (id, command, purpose, confidence, whether the spec is valid) and one
|
|
3
|
+
* edit dialog per tool. The dialog is a form over the same spec the JSON box holds ("View JSON" at the bottom): editing either side
|
|
4
|
+
* rewrites the other, every problem is the server's own message shown by the control it is about, "Done" puts the spec into the
|
|
5
|
+
* draft (only when it is valid), and "Try it" runs the draft once through the plugin. The entries live inside `cliAdapters`.
|
|
6
|
+
* @module web-search-pro/client/group-cli
|
|
7
|
+
*/
|
|
8
|
+
import { type CliCheck, type CliForm } from './cli-form.ts';
|
|
9
|
+
import { type Card } from './field-rows.tsx';
|
|
10
|
+
type Json = Record<string, unknown>;
|
|
11
|
+
/** What the dialog holds: the spec (the source of truth), the form fields read from it, the JSON box text, and the trial's sample query. */
|
|
12
|
+
export interface CliDraft {
|
|
13
|
+
mode: 'new' | 'edit';
|
|
14
|
+
id: string;
|
|
15
|
+
spec: Json;
|
|
16
|
+
form: CliForm;
|
|
17
|
+
jsonText: string;
|
|
18
|
+
jsonError?: string;
|
|
19
|
+
query: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function draftOf(mode: 'new' | 'edit', id: string, spec: Json): CliDraft;
|
|
22
|
+
/** The draft after a form edit: the spec is rebuilt from the fields on top of the spec as it was, the JSON text follows. */
|
|
23
|
+
export declare function editForm(draft: CliDraft, patch: Partial<CliForm>): CliDraft;
|
|
24
|
+
/** A new entry's id; an existing one cannot be renamed (copy it instead). */
|
|
25
|
+
export declare function editId(draft: CliDraft, id: string): CliDraft;
|
|
26
|
+
/** The draft after the JSON box changed: a text that parses becomes the spec and the form is read from it; one that does not leaves both alone. */
|
|
27
|
+
export declare function editJson(draft: CliDraft, text: string): CliDraft;
|
|
28
|
+
/** What the form of one custom CLI shows and edits; presentational (the dialog and the render test both mount it). */
|
|
29
|
+
export declare function CliBody({ card, draft, check, disabled, onForm, onId, onJson, onQuery, onTrial }: {
|
|
30
|
+
card: Card;
|
|
31
|
+
draft: CliDraft;
|
|
32
|
+
check: CliCheck;
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
onForm: (patch: Partial<CliForm>) => void;
|
|
35
|
+
onId: (id: string) => void;
|
|
36
|
+
onJson: (text: string) => void;
|
|
37
|
+
onQuery: (text: string) => void;
|
|
38
|
+
onTrial: () => void;
|
|
39
|
+
}): import("react").JSX.Element;
|
|
40
|
+
export declare function CliDialog({ card, initial, taken, onClose }: {
|
|
41
|
+
card: Card;
|
|
42
|
+
initial: CliDraft;
|
|
43
|
+
taken: readonly string[];
|
|
44
|
+
onClose: () => void;
|
|
45
|
+
}): import("react").JSX.Element;
|
|
46
|
+
export declare function CliList({ card }: {
|
|
47
|
+
card: Card;
|
|
48
|
+
}): import("react").JSX.Element;
|
|
49
|
+
export declare function CliGroup({ card }: {
|
|
50
|
+
card: Card;
|
|
51
|
+
}): import("react").JSX.Element;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Common": what nearly everyone touches, open by default (every other group starts closed): the default engine chain with the
|
|
3
|
+
* order a search would really try, the result count, parallel fusion, the tool surface, the proxy fake-IP switch, and the
|
|
4
|
+
* DeepSeek Search source (常用) with its page-reading switch.
|
|
5
|
+
* @module web-search-pro/client/group-common
|
|
6
|
+
*/
|
|
7
|
+
import { type Card } from './field-rows.tsx';
|
|
8
|
+
/** The names of the common group's fields, in order. */
|
|
9
|
+
export declare const COMMON_FIELDS: readonly ["searchMaxResults", "parallelEngines", "toolSurface", "allowProxyFakeIp", "deepseekFetch"];
|
|
10
|
+
export declare function CommonGroup({ card }: {
|
|
11
|
+
card: Card;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Scoring model": the optional model judge (mode, provider, coverage judge, usage caps), its custom providers as a JSON list,
|
|
3
|
+
* and the judge prompts (rubrics) as a list: a row each (name, active version, default or overridden) and an edit dialog that
|
|
4
|
+
* puts the built-in text beside your override. The dialog edits the same staged entry the rest of the card writes on save.
|
|
5
|
+
* @module web-search-pro/client/group-judge
|
|
6
|
+
*/
|
|
7
|
+
import { BUILTIN_RUBRIC_IDS } from '../pipeline/rubrics-spec.ts';
|
|
8
|
+
import { type Card } from './field-rows.tsx';
|
|
9
|
+
/** The controls of one rubric override: each is a view of the one staged entry; the built-in text sits beside it. */
|
|
10
|
+
export declare function RubricForm({ card, id }: {
|
|
11
|
+
card: Card;
|
|
12
|
+
id: string;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
export { BUILTIN_RUBRIC_IDS };
|
|
15
|
+
export declare function JudgeGroup({ card }: {
|
|
16
|
+
card: Card;
|
|
17
|
+
}): import("react").JSX.Element;
|