dsh-web-search-pro 0.2.3 → 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 +63 -0
- package/README.en.md +117 -0
- package/README.md +72 -674
- package/lib/fiber-config.js +5 -0
- package/lib/fiber-config.js.map +1 -0
- package/lib/index.js +7 -3
- package/lib/index.js.map +1 -1
- package/lib/rpc.js +35 -2
- package/lib/rpc.js.map +1 -1
- package/lib/types/fiber-config.d.ts +18 -0
- package/lib/types/rpc.d.ts +33 -0
- package/package.json +16 -15
- package/scripts/check-docs-links.mjs +107 -0
- package/LOGIN.md +0 -161
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fiber-config.js","sourceRoot":"","sources":["../src/fiber-config.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,eAAe,CAAmB,KAAoC;IACpF,MAAM,KAAK,GAAG,KAAK,EAAE,eAAe,IAAI,KAAK,EAAE,MAAM,CAAA;IACrD,OAAO,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAM,CAAA;AACxE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,7 @@ import { ACTIONS, findAction, flatToolName } from "./actions/registry.js";
|
|
|
31
31
|
import { automationModeOf, resolveWebCall, webCallDecision } from "./actions/approval.js";
|
|
32
32
|
import { registerRpc } from "./rpc.js";
|
|
33
33
|
import { OverlayStore, overlayFileFor } from "./overlay.js";
|
|
34
|
+
import { liveFiberConfig } from "./fiber-config.js";
|
|
34
35
|
import { pendingRestart, restartValues } from "./restart.js";
|
|
35
36
|
export const name = 'web-search-pro';
|
|
36
37
|
// `browser` (dsh-browser) is deliberately NOT injected: Cordis 4.0.4 treats every
|
|
@@ -66,12 +67,15 @@ export function apply(ctx, config) {
|
|
|
66
67
|
const getBrowser = () => ctx.get('browser');
|
|
67
68
|
// 3. Hot-reloadable config source. The plugin's Config schema marks live
|
|
68
69
|
// fields `volatile()` (schemastery), so the Host re-resolves this entry's
|
|
69
|
-
// config in place on every profile-patch edit and the fiber's
|
|
70
|
-
//
|
|
70
|
+
// config in place on every profile-patch edit and the fiber's resolved config
|
|
71
|
+
// (`effectiveConfig` on cordis 4.1, `config` on 4.0.x; see fiber-config.ts) reflects the new values without a remount. Every operation
|
|
71
72
|
// therefore reads through the SAME stable `dynamic` closure that
|
|
72
73
|
// dereferences the live config per call — hot-reloaded sections reach
|
|
73
74
|
// every consumer.
|
|
74
|
-
|
|
75
|
+
// Cordis 4.1 (dsh 0.2.2) keeps the RAW input in `fiber.config` (undefined for an unconfigured entry, no schema
|
|
76
|
+
// defaults, no hooks) and publishes the resolved object as `fiber.effectiveConfig`; 4.0.x has only `config`, and it
|
|
77
|
+
// is already resolved. Hence effectiveConfig first, then config, then {} (see fiber-config.ts).
|
|
78
|
+
const baseline = () => resolveConfig(liveFiberConfig(ctx.fiber));
|
|
75
79
|
// The agent overlay: run-time settings an agent may change (config.* actions), merged over the profile configuration on
|
|
76
80
|
// every read, so each consumer of `dynamic` sees them at once. It lives beside the database; whether an id is a registered
|
|
77
81
|
// source is the router's registry (built below, so it is read through `routerRef`; until then every id passes).
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAK5B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAuB,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAsB,MAAM,qBAAqB,CAAA;A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AAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;aACtG,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAA;QACpB,CAAC;QAAC,MAAM,CAAC,CAAC,2BAA2B,CAAC,CAAC;IACzC,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,4BAA4B,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAA;AAChH,CAAC;AAED,2EAA2E;AAC3E,qEAAqE;AACrE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA"}
|
package/lib/rpc.js
CHANGED
|
@@ -75,11 +75,44 @@ export function createHandler(services) {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Mount the channel and return its disposer.
|
|
80
|
+
*
|
|
81
|
+
* `connection.rpc.handle` mounts the Web route with `owner.webServer`, where `owner` is the Context the `rpc` getter captured
|
|
82
|
+
* (`this.ctx`; packages/client/connection/src/rpc-host.ts:274 in the Host). Under cordis 4.1 (DSH 0.2.2) a service property read is
|
|
83
|
+
* checked against the `inject` list of the Context that DEFINED the service, i.e. the Connection plugin, which does not list `webServer`,
|
|
84
|
+
* so the call throws `cannot get property "webServer" without inject` for every external plugin (cordis 4.0.x did not check). The throw
|
|
85
|
+
* happened inside an inject callback and was never reported: the channel stayed unmounted and the settings card got HTTP 405.
|
|
86
|
+
*
|
|
87
|
+
* The public-API way around it (found by @shuaigekda in anweat/dsh-browser#49): read the service through a derived context that carries
|
|
88
|
+
* the dependency this plugin did inject as its own property, `ctx.extend({ webServer: ctx.get('webServer') })`. `Context.extend` defines
|
|
89
|
+
* those properties directly on the child, so the `rpc` getter captures the child as `owner` and `owner.webServer` resolves as an own
|
|
90
|
+
* property, without the inject check. Same route, same transport and authentication; no private Host method. It is used on every Host
|
|
91
|
+
* (on cordis 4.0.x the own property is simply redundant). Reading `connection` from `ctx.root` or from `ctx` itself does not help.
|
|
92
|
+
*/
|
|
93
|
+
export function openChannel(connectionCtx, handler) {
|
|
94
|
+
const owner = connectionCtx.extend({ webServer: connectionCtx.get('webServer') });
|
|
95
|
+
return owner.connection.rpc.handle(RPC_CHANNEL, handler);
|
|
96
|
+
}
|
|
97
|
+
const stripAnsi = (text) => text.replace(/\u001b\[[0-9;]*[A-Za-z]/g, '');
|
|
98
|
+
/** The one console line for a channel that could not be mounted (exported for the test). */
|
|
99
|
+
export function channelFailureMessage(error) {
|
|
100
|
+
return 'web-search-pro: settings-card RPC channel ' + RPC_CHANNEL + ' was not mounted (' + stripAnsi(String(error instanceof Error ? error.message : error)) + "); the card still renders, but its live status, agent-edits panel and custom-CLI dry-run will not work";
|
|
101
|
+
}
|
|
78
102
|
/** Register the channel when the Host has the transport; the effect unregisters it with the plugin. */
|
|
79
103
|
export function registerRpc(ctx, services) {
|
|
80
104
|
ctx.inject(['connection', 'webServer'], (connectionCtx) => {
|
|
81
|
-
|
|
82
|
-
|
|
105
|
+
connectionCtx.effect(() => {
|
|
106
|
+
try {
|
|
107
|
+
return openChannel(connectionCtx, createHandler(services));
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
// The Host reports nothing for a throw inside an inject callback (this is how the cordis 4.1 failure stayed invisible), and
|
|
111
|
+
// ctx.logger was observed dropping this at its default level, so say it on the console and keep the plugin running.
|
|
112
|
+
console.warn(channelFailureMessage(error));
|
|
113
|
+
return () => { };
|
|
114
|
+
}
|
|
115
|
+
}, 'web-search-pro: settings card RPC channel');
|
|
83
116
|
});
|
|
84
117
|
}
|
|
85
118
|
//# sourceMappingURL=rpc.js.map
|
package/lib/rpc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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AAW,CAAC,aAA0C,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAA;YACzF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,4HAA4H;gBAC5H,oHAAoH;gBACpH,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;gBAC1C,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;YACjB,CAAC;QACH,CAAC,EAAE,2CAA2C,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the live, resolved plugin configuration is read from.
|
|
3
|
+
*
|
|
4
|
+
* Cordis 4.0.x (DSH 0.2.0 / 0.2.1 lines): `fiber.config` is the RESOLVED object (schema defaults applied,
|
|
5
|
+
* `internal/config` hooks run) and there is no `effectiveConfig`. A volatile update swaps its fields in place.
|
|
6
|
+
*
|
|
7
|
+
* Cordis 4.1.x (DSH 0.2.2 line): `fiber.config` is the RAW input - no schema defaults, no hook results, and
|
|
8
|
+
* `undefined` for an entry that has no configuration. The resolved object handed to `apply` is published as
|
|
9
|
+
* `fiber.effectiveConfig` after every successful update. Reading `fiber.config` there skips defaults (nested
|
|
10
|
+
* ones included) and credential/hook resolution, which is why `?? {}` alone only fixes the crash.
|
|
11
|
+
*
|
|
12
|
+
* So: prefer `effectiveConfig`, fall back to `config` (4.0.x), and never hand `undefined` onward.
|
|
13
|
+
*/
|
|
14
|
+
export interface FiberConfigSource {
|
|
15
|
+
readonly effectiveConfig?: unknown;
|
|
16
|
+
readonly config?: unknown;
|
|
17
|
+
}
|
|
18
|
+
export declare function liveFiberConfig<T extends object>(fiber: FiberConfigSource | undefined): T;
|
package/lib/types/rpc.d.ts
CHANGED
|
@@ -36,6 +36,39 @@ export interface RpcServices {
|
|
|
36
36
|
export declare function statusView(router: Pick<SearchRouter, 'providerReport'>, extras?: Pick<RpcServices, 'overlay' | 'pendingRestart'>): Promise<StatusView>;
|
|
37
37
|
/** The handler of the channel: `status` and `trial`. A failure is a value (`ok: false`), never a throw into the transport. */
|
|
38
38
|
export declare function createHandler(services: RpcServices): Handler;
|
|
39
|
+
/** The part of the Host's `connection` service used here. */
|
|
40
|
+
export interface ConnectionRegistrar {
|
|
41
|
+
rpc: {
|
|
42
|
+
handle(channel: string, handler: Handler): () => Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** The part of a cordis Context used to reach the Host's connection transport. */
|
|
46
|
+
export interface ChannelContext {
|
|
47
|
+
get(name: 'webServer'): unknown;
|
|
48
|
+
extend(meta: {
|
|
49
|
+
webServer: unknown;
|
|
50
|
+
}): {
|
|
51
|
+
connection: ConnectionRegistrar;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Mount the channel and return its disposer.
|
|
56
|
+
*
|
|
57
|
+
* `connection.rpc.handle` mounts the Web route with `owner.webServer`, where `owner` is the Context the `rpc` getter captured
|
|
58
|
+
* (`this.ctx`; packages/client/connection/src/rpc-host.ts:274 in the Host). Under cordis 4.1 (DSH 0.2.2) a service property read is
|
|
59
|
+
* checked against the `inject` list of the Context that DEFINED the service, i.e. the Connection plugin, which does not list `webServer`,
|
|
60
|
+
* so the call throws `cannot get property "webServer" without inject` for every external plugin (cordis 4.0.x did not check). The throw
|
|
61
|
+
* happened inside an inject callback and was never reported: the channel stayed unmounted and the settings card got HTTP 405.
|
|
62
|
+
*
|
|
63
|
+
* The public-API way around it (found by @shuaigekda in anweat/dsh-browser#49): read the service through a derived context that carries
|
|
64
|
+
* the dependency this plugin did inject as its own property, `ctx.extend({ webServer: ctx.get('webServer') })`. `Context.extend` defines
|
|
65
|
+
* those properties directly on the child, so the `rpc` getter captures the child as `owner` and `owner.webServer` resolves as an own
|
|
66
|
+
* property, without the inject check. Same route, same transport and authentication; no private Host method. It is used on every Host
|
|
67
|
+
* (on cordis 4.0.x the own property is simply redundant). Reading `connection` from `ctx.root` or from `ctx` itself does not help.
|
|
68
|
+
*/
|
|
69
|
+
export declare function openChannel(connectionCtx: ChannelContext, handler: Handler): () => Promise<void>;
|
|
70
|
+
/** The one console line for a channel that could not be mounted (exported for the test). */
|
|
71
|
+
export declare function channelFailureMessage(error: unknown): string;
|
|
39
72
|
/** Register the channel when the Host has the transport; the effect unregisters it with the plugin. */
|
|
40
73
|
export declare function registerRpc(ctx: Context, services: RpcServices): void;
|
|
41
74
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-web-search-pro",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Enhanced, persistent web search plugin for DeepSeek Harness — multi-engine routing (DeepSeek/Exa/DDG/Bing/Jina + GitHub/B站/YouTube/V2EX/小红书/Twitter/Reddit/RSS), SQLite+LRU cache, userscript-style extraction, and Playwright rendering.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"catalog",
|
|
25
25
|
"cordis.patch.yml",
|
|
26
26
|
"README.md",
|
|
27
|
+
"README.en.md",
|
|
27
28
|
"CHANGELOG.md",
|
|
28
|
-
"LOGIN.md",
|
|
29
29
|
"scripts",
|
|
30
30
|
"LICENSE"
|
|
31
31
|
],
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@anweat/dsh-browser": "^0.2.0",
|
|
37
|
-
"@deepseek-ai/cordis": "~4.0.4",
|
|
38
|
-
"@deepseek-ai/dsh-api-remotes": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
39
|
-
"@deepseek-ai/dsh-client-locale": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
40
|
-
"@deepseek-ai/dsh-client-store": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
41
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
42
|
-
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
43
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
44
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
45
|
-
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
46
|
-
"@deepseek-ai/dsh-credentials": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
47
|
-
"@deepseek-ai/dsh-settings": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
48
|
-
"@deepseek-ai/dsh-tools": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0",
|
|
37
|
+
"@deepseek-ai/cordis": "~4.0.4 || ~4.1.0",
|
|
38
|
+
"@deepseek-ai/dsh-api-remotes": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
39
|
+
"@deepseek-ai/dsh-client-locale": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
40
|
+
"@deepseek-ai/dsh-client-store": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
41
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
42
|
+
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
43
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
44
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
45
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
46
|
+
"@deepseek-ai/dsh-credentials": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
47
|
+
"@deepseek-ai/dsh-settings": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
48
|
+
"@deepseek-ai/dsh-tools": ">=0.2.0-rc.2 <0.2.1-0 || >=0.2.1-rc.2 <0.2.2-0 || >=0.2.2-rc.1 <0.2.3-0",
|
|
49
49
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
@@ -171,7 +171,8 @@
|
|
|
171
171
|
"test": "node --import ./test/isolate-path.mjs --test --experimental-transform-types test/*.test.ts",
|
|
172
172
|
"test:live-cli": "WSP_LIVE_CLI=1 node --import ./test/isolate-path.mjs --test --experimental-transform-types test/cli-live.test.ts",
|
|
173
173
|
"test:client-bundle": "node scripts/check-client-bundle.mjs",
|
|
174
|
-
"
|
|
174
|
+
"check:docs": "node scripts/check-docs-links.mjs",
|
|
175
|
+
"verify": "pnpm run typecheck && pnpm run test:peers && pnpm run build && pnpm test && pnpm run test:client-bundle && pnpm run check:docs",
|
|
175
176
|
"test:peers": "node test/compat/check-peer-ranges.js",
|
|
176
177
|
"bench:typecheck": "tsc -p bench/tsconfig.json",
|
|
177
178
|
"bench:test": "node --test --experimental-transform-types bench/test/*.test.ts",
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Documentation checks, no dependencies:
|
|
4
|
+
* 1. every relative link in the repository's Markdown files points at an existing file, and `#anchor` fragments exist as
|
|
5
|
+
* headings (GitHub slug rules) in the target file;
|
|
6
|
+
* 2. README.md and README.en.md have the same number of second-level headings (the English page mirrors the Chinese one).
|
|
7
|
+
*
|
|
8
|
+
* Skipped: node_modules, lib, .git and bench (bench keeps its own notes), absolute URLs, and anything inside fenced code.
|
|
9
|
+
* Run: node scripts/check-docs-links.mjs (also part of `pnpm run verify`)
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'node:fs'
|
|
12
|
+
import path from 'node:path'
|
|
13
|
+
import { fileURLToPath } from 'node:url'
|
|
14
|
+
|
|
15
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
16
|
+
const SKIP_DIRS = new Set(['node_modules', 'lib', '.git', 'bench', '.codegraph'])
|
|
17
|
+
|
|
18
|
+
function walk(dir, out = []) {
|
|
19
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
20
|
+
if (entry.isDirectory()) {
|
|
21
|
+
if (!SKIP_DIRS.has(entry.name)) walk(path.join(dir, entry.name), out)
|
|
22
|
+
} else if (entry.isFile() && entry.name.endsWith('.md')) out.push(path.join(dir, entry.name))
|
|
23
|
+
}
|
|
24
|
+
return out
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Lines outside fenced code blocks, with their 1-based numbers. */
|
|
28
|
+
function proseLines(text) {
|
|
29
|
+
const lines = text.split('\n')
|
|
30
|
+
const out = []
|
|
31
|
+
let fence = null
|
|
32
|
+
lines.forEach((line, i) => {
|
|
33
|
+
const m = /^\s*(```+|~~~+)/.exec(line)
|
|
34
|
+
if (m) {
|
|
35
|
+
if (!fence) fence = m[1][0]
|
|
36
|
+
else if (m[1][0] === fence) fence = null
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
if (!fence) out.push([i + 1, line])
|
|
40
|
+
})
|
|
41
|
+
return out
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** GitHub's heading slug: lowercase, drop punctuation, spaces to hyphens. */
|
|
45
|
+
function slug(heading) {
|
|
46
|
+
return heading
|
|
47
|
+
.trim()
|
|
48
|
+
.replace(/`/g, '')
|
|
49
|
+
.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
50
|
+
.replace(/<[^>]+>/g, '')
|
|
51
|
+
.toLowerCase()
|
|
52
|
+
.replace(/[^\p{L}\p{N}\p{M}_\- ]/gu, '')
|
|
53
|
+
.replace(/ /g, '-')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const anchorCache = new Map()
|
|
57
|
+
function anchorsOf(file) {
|
|
58
|
+
if (anchorCache.has(file)) return anchorCache.get(file)
|
|
59
|
+
const seen = new Map()
|
|
60
|
+
const set = new Set()
|
|
61
|
+
for (const [, line] of proseLines(fs.readFileSync(file, 'utf8'))) {
|
|
62
|
+
const m = /^(#{1,6})\s+(.*?)\s*#*\s*$/.exec(line)
|
|
63
|
+
if (!m) continue
|
|
64
|
+
const base = slug(m[2])
|
|
65
|
+
const n = seen.get(base) ?? 0
|
|
66
|
+
seen.set(base, n + 1)
|
|
67
|
+
set.add(n === 0 ? base : `${base}-${n}`)
|
|
68
|
+
}
|
|
69
|
+
anchorCache.set(file, set)
|
|
70
|
+
return set
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const problems = []
|
|
74
|
+
const files = walk(root)
|
|
75
|
+
for (const file of files) {
|
|
76
|
+
const rel = path.relative(root, file)
|
|
77
|
+
for (const [lineNo, line] of proseLines(fs.readFileSync(file, 'utf8'))) {
|
|
78
|
+
// [text](target) and <target>-less reference-free links only; inline code is stripped first.
|
|
79
|
+
const stripped = line.replace(/`[^`]*`/g, '')
|
|
80
|
+
for (const m of stripped.matchAll(/\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g)) {
|
|
81
|
+
const target = m[1]
|
|
82
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(target)) continue // http:, https:, mailto: ...
|
|
83
|
+
const [pathPart, rawFragment] = target.split('#')
|
|
84
|
+
const fragment = rawFragment === undefined ? undefined : decodeURIComponent(rawFragment)
|
|
85
|
+
const targetFile = pathPart === '' ? file : path.resolve(path.dirname(file), decodeURIComponent(pathPart))
|
|
86
|
+
if (!fs.existsSync(targetFile)) { problems.push(`${rel}:${lineNo}: missing file ${target}`); continue }
|
|
87
|
+
if (fragment !== undefined && fragment !== '') {
|
|
88
|
+
if (!targetFile.endsWith('.md')) continue
|
|
89
|
+
if (!anchorsOf(targetFile).has(fragment.toLowerCase())) problems.push(`${rel}:${lineNo}: missing anchor #${fragment} in ${path.relative(root, targetFile)}`)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function h2Count(file) {
|
|
96
|
+
return proseLines(fs.readFileSync(file, 'utf8')).filter(([, line]) => /^## /.test(line)).length
|
|
97
|
+
}
|
|
98
|
+
const zh = path.join(root, 'README.md')
|
|
99
|
+
const en = path.join(root, 'README.en.md')
|
|
100
|
+
if (!fs.existsSync(zh) || !fs.existsSync(en)) problems.push('README.md and README.en.md must both exist')
|
|
101
|
+
else if (h2Count(zh) !== h2Count(en)) problems.push(`README.md has ${h2Count(zh)} second-level headings but README.en.md has ${h2Count(en)}`)
|
|
102
|
+
|
|
103
|
+
if (problems.length) {
|
|
104
|
+
console.error(`docs check failed (${problems.length}):\n` + problems.map(p => ' ' + p).join('\n'))
|
|
105
|
+
process.exit(1)
|
|
106
|
+
}
|
|
107
|
+
console.log(`docs check ok: ${files.length} Markdown files, links and anchors resolve, README headings match`)
|
package/LOGIN.md
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
# 中文社区平台登录态(复用你已登录的浏览器)
|
|
2
|
-
|
|
3
|
-
知乎 / 微博 / 豆瓣 / 贴吧 / 抖音 / 快手 / 小红书的搜索页都有反爬与登录墙,
|
|
4
|
-
免登录的公开接口基本都被风控。所以这些平台走 **Playwright 驱动登录态浏览器** 的路径:
|
|
5
|
-
在你已登录的浏览器里打开搜索页、读渲染结果——不需要逆向任何签名。
|
|
6
|
-
|
|
7
|
-
## 方式一:登录一次保存登录态(推荐)
|
|
8
|
-
|
|
9
|
-
运行插件包里的脚本,按提示逐个平台登录一次(扫码/账号密码),
|
|
10
|
-
脚本会把所有 cookies 合并保存成一个 storageState JSON:
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
cd dsh-web-search-pro
|
|
14
|
-
node scripts/save-login.mjs all login-state.json
|
|
15
|
-
# 或只登录一个平台:
|
|
16
|
-
node scripts/save-login.mjs zhihu login-state.json
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
然后在 dsh-browser 的部署配置中创建命名、按域名授权的 AuthProfile:
|
|
20
|
-
|
|
21
|
-
```yaml
|
|
22
|
-
# cordis.yml 中的 dsh-browser 插件行
|
|
23
|
-
- id: browser
|
|
24
|
-
name: '@anweat/dsh-browser'
|
|
25
|
-
config:
|
|
26
|
-
automationMode: standard # read-only | standard | autonomous | unrestricted
|
|
27
|
-
authProfiles:
|
|
28
|
-
china-community:
|
|
29
|
-
storageStatePath: 'D:/secrets/login-state.json'
|
|
30
|
-
allowedDomains: [zhihu.com, weibo.com, douban.com, baidu.com, douyin.com, kuaishou.com]
|
|
31
|
-
persistState: false
|
|
32
|
-
|
|
33
|
-
# $DSH_HOME/settings.yaml
|
|
34
|
-
---
|
|
35
|
-
web-search-pro:
|
|
36
|
-
browserBindings:
|
|
37
|
-
zhihu: { authProfile: china-community }
|
|
38
|
-
weibo: { authProfile: china-community }
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
> storageState 是 Playwright 的标准登录态文件(cookies + origins),
|
|
42
|
-
> 同一份文件可含多个站点登录态,但每个 AuthProfile 必须显式给出 `allowedDomains`;访问其他域名会被拒绝。`persistState` 默认 false,只有明确开启才会原子回写新 Cookie/localStorage。
|
|
43
|
-
> `scripts/save-login.mjs` 优先复用 `@anweat/dsh-browser` 自带的 Playwright;默认启动其 bundled Chromium。如需显式使用已安装的 Chrome,可临时设置 `DSH_BROWSER_CHANNEL=chrome`。
|
|
44
|
-
|
|
45
|
-
## 方式二:用 Cookie 插件导出
|
|
46
|
-
|
|
47
|
-
如果你更习惯手动导出:
|
|
48
|
-
|
|
49
|
-
1. 在浏览器装 Cookie-Editor(或 EditThisCookie)。
|
|
50
|
-
2. 在目标站点导出 cookies(JSON)。
|
|
51
|
-
3. 组装成 storageState 格式:
|
|
52
|
-
|
|
53
|
-
```json
|
|
54
|
-
{ "cookies": [ ...导出的 cookies... ], "origins": [] }
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
每个 cookie 至少需要 `name` `value` `domain` `path`(可补 `expires` `httpOnly` `secure`)。
|
|
58
|
-
|
|
59
|
-
不要把 Cookie JSON 作为模型工具参数传入;导入到本地 storageState 文件后只在配置中引用路径。
|
|
60
|
-
|
|
61
|
-
## 受控脚本增强(RulePack)
|
|
62
|
-
|
|
63
|
-
dsh-browser 可配置命名 RulePack。它适合由部署者长期维护的站点增强,支持有界的 `waitFor` / `click` / `scroll` / `wait` 步骤;可选 init script 只能引用本地文件,必须提供 SHA-256,且文件不超过 64KB。RulePack 同样按 `matches` 限域。
|
|
64
|
-
|
|
65
|
-
```yaml
|
|
66
|
-
rulePacks:
|
|
67
|
-
zhihu-enhanced:
|
|
68
|
-
matches: [zhihu.com]
|
|
69
|
-
initScriptPath: 'D:/dsh/rules/zhihu-init.js'
|
|
70
|
-
initScriptSha256: '<64位sha256>'
|
|
71
|
-
steps:
|
|
72
|
-
- { type: waitFor, selector: '.SearchResult-Card', timeoutMs: 10000 }
|
|
73
|
-
- { type: scroll, deltaY: 1600, repeat: 2, waitMs: 300 }
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## 模型生成 Recipe
|
|
77
|
-
|
|
78
|
-
临时、多步骤操作不必先写持久 RulePack。模型可调用 `browser_recipe_run`,每次最多 25 步:
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"url": "https://example.com",
|
|
83
|
-
"steps": [
|
|
84
|
-
{ "type": "wait", "condition": "selector", "value": "h1" },
|
|
85
|
-
{ "type": "extract", "selector": "h1", "mode": "text" }
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
`wait`、`extract`、`assert`、`screenshot` 是只读路径;一旦包含 `click`、`fill`、`type`、`press`、`select`、`check`、`hover` 或 `scroll`,`standard` 会发起一次性审批,`autonomous` / `unrestricted` 直接执行,`read-only` 拒绝。
|
|
91
|
-
|
|
92
|
-
## 外部模型生成 UserScript
|
|
93
|
-
|
|
94
|
-
外部模型可以输出油猴格式脚本,但需要走“先验证、后执行”两步:
|
|
95
|
-
|
|
96
|
-
```text
|
|
97
|
-
browser_script_validate({ url, source })
|
|
98
|
-
browser_userscript_run({ url, source, authProfile? })
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
```javascript
|
|
102
|
-
// ==UserScript==
|
|
103
|
-
// @name Read page heading
|
|
104
|
-
// @match https://example.com/*
|
|
105
|
-
// @grant none
|
|
106
|
-
// ==/UserScript==
|
|
107
|
-
return { heading: document.querySelector('h1')?.textContent || '' }
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
限制与边界:
|
|
111
|
-
|
|
112
|
-
- 必须声明 HTTP(S) `@match`,`@exclude` 生效;目标 URL 不匹配时拒绝。
|
|
113
|
-
- 只允许 `@grant none`,拒绝 `@require`,源码上限 64KB,输出与运行时间有界。
|
|
114
|
-
- 验证结果包含 SHA-256 和静态能力提示,但能力提示不是安全证明。
|
|
115
|
-
- 脚本运行在目标页主世界,能读写页面并使用该页已有登录态;除 `unrestricted` 外,`browser_userscript_run` 会进入 DSH 原生一次性审批。无审批测试也不要让脚本回传 Cookie、令牌、表单值等秘密。
|
|
116
|
-
|
|
117
|
-
常见只读任务优先用 `browser_script_catalog` 中的内置 `article-clean`、`links`、`jsonld`、`forms`,无需提交任意脚本。
|
|
118
|
-
|
|
119
|
-
## OpenCLI 社区平台
|
|
120
|
-
|
|
121
|
-
Reddit / 小红书 / Twitter / Instagram / Facebook 走 OpenCLI Browser Bridge,使用当前 Chrome 扩展会话,不读取或导出 Cookie。`dsh-browser` 已包含 OpenCLI CLI,但 Chrome 扩展必须已安装并连接:
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
opencli doctor
|
|
125
|
-
opencli reddit search "DeepSeek Harness" -f yaml
|
|
126
|
-
opencli browser research open https://example.com --window background
|
|
127
|
-
opencli browser research state
|
|
128
|
-
opencli browser research extract
|
|
129
|
-
opencli browser research close
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
每个 `opencli browser` 子命令都必须显式给出 session 名(上例为 `research`),同名会话复用标签页状态。优先使用已有站点 adapter;没有 adapter 时优先 `network` / `extract`,最后再使用 `state` / `find` / `click` / `fill` 等 DOM 操作。
|
|
133
|
-
|
|
134
|
-
模型内先用 `browser_opencli_status` 检查 daemon、扩展和 profile;高级调用使用 `browser_opencli_run({ args: [...] })`。argv 示例:`["browser", "research", "state"]`。这个通用入口可能触发发帖、删除等站点 adapter,所以除隔离测试用的 `unrestricted` 外都要求一次性审批。
|
|
135
|
-
|
|
136
|
-
若 `doctor` 显示 daemon 正常但 extension disconnected,请显式启动安装了 OpenCLI Browser Bridge 的 Chrome;不要把 Quark 或禁用扩展的 Playwright 临时 profile 当作替代。只有需要在终端独立诊断时,才需要额外全局安装 `@jackwener/opencli`。
|
|
137
|
-
|
|
138
|
-
## 结果选择器可配置
|
|
139
|
-
|
|
140
|
-
站点改版后如果提取不到结果,不用改代码——在 `settings.yaml` 按平台覆盖选择器:
|
|
141
|
-
|
|
142
|
-
```yaml
|
|
143
|
-
web-search-pro:
|
|
144
|
-
platformRules:
|
|
145
|
-
zhihu:
|
|
146
|
-
item: '.SearchResult-Card'
|
|
147
|
-
title: '.ContentItem-title'
|
|
148
|
-
link: '.ContentItem-title a'
|
|
149
|
-
text: '.Highlight'
|
|
150
|
-
weibo:
|
|
151
|
-
item: '.card-wrap'
|
|
152
|
-
title: '.txt'
|
|
153
|
-
link: '.from a'
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## 安全与合规提醒
|
|
157
|
-
|
|
158
|
-
- 仅做**单次、低频**的搜索调用,不要批量爬取;遵守目标平台的服务条款与 robots.txt。
|
|
159
|
-
- 登录态文件包含你的登录凭据,请勿提交到公开仓库或分享给他人。
|
|
160
|
-
- 本能力借鉴 MediaCrawler 的思路(登录态浏览器驱动搜索页),
|
|
161
|
-
但为 MIT 许可的独立实现,未使用其 NON-COMMERCIAL 许可下的签名算法代码。
|