dsh-search-tools 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/CHANGELOG.md +168 -0
  2. package/LICENSE +21 -0
  3. package/README.en.md +728 -0
  4. package/README.md +731 -2
  5. package/README.zh.md +9 -0
  6. package/SECURITY.md +20 -0
  7. package/THIRD_PARTY_NOTICES.md +17 -0
  8. package/cordis.patch.yml +16 -0
  9. package/icon.svg +6 -0
  10. package/lib/client.js +3047 -0
  11. package/lib/client.js.map +1 -0
  12. package/lib/index.js +2221 -0
  13. package/lib/index.js.map +1 -0
  14. package/lib/types/client/ActivationHint.d.ts +6 -0
  15. package/lib/types/client/ActivationHint.d.ts.map +1 -0
  16. package/lib/types/client/ResearchCard.d.ts +7 -0
  17. package/lib/types/client/ResearchCard.d.ts.map +1 -0
  18. package/lib/types/client/SettingsPage.d.ts +65 -0
  19. package/lib/types/client/SettingsPage.d.ts.map +1 -0
  20. package/lib/types/client/TakeoverWarning.d.ts +12 -0
  21. package/lib/types/client/TakeoverWarning.d.ts.map +1 -0
  22. package/lib/types/client/api.d.ts +43 -0
  23. package/lib/types/client/api.d.ts.map +1 -0
  24. package/lib/types/client/components/Field.d.ts +36 -0
  25. package/lib/types/client/components/Field.d.ts.map +1 -0
  26. package/lib/types/client/diagnostic-text.d.ts +4 -0
  27. package/lib/types/client/diagnostic-text.d.ts.map +1 -0
  28. package/lib/types/client/index.d.ts +14 -0
  29. package/lib/types/client/index.d.ts.map +1 -0
  30. package/lib/types/client/issue-text.d.ts +5 -0
  31. package/lib/types/client/issue-text.d.ts.map +1 -0
  32. package/lib/types/client/locales.d.ts +185 -0
  33. package/lib/types/client/locales.d.ts.map +1 -0
  34. package/lib/types/client/styles.d.ts +3 -0
  35. package/lib/types/client/styles.d.ts.map +1 -0
  36. package/lib/types/config.d.ts +20 -0
  37. package/lib/types/config.d.ts.map +1 -0
  38. package/lib/types/core/diagnostics.d.ts +9 -0
  39. package/lib/types/core/diagnostics.d.ts.map +1 -0
  40. package/lib/types/core/dispatchers.d.ts +61 -0
  41. package/lib/types/core/dispatchers.d.ts.map +1 -0
  42. package/lib/types/core/host-types.d.ts +37 -0
  43. package/lib/types/core/host-types.d.ts.map +1 -0
  44. package/lib/types/core/service.d.ts +40 -0
  45. package/lib/types/core/service.d.ts.map +1 -0
  46. package/lib/types/core/types.d.ts +197 -0
  47. package/lib/types/core/types.d.ts.map +1 -0
  48. package/lib/types/fetch/adapters/readable-http/adapter.d.ts +3 -0
  49. package/lib/types/fetch/adapters/readable-http/adapter.d.ts.map +1 -0
  50. package/lib/types/fetch/adapters/readable-http/manifest.d.ts +4 -0
  51. package/lib/types/fetch/adapters/readable-http/manifest.d.ts.map +1 -0
  52. package/lib/types/fetch/adapters/readable-http/provider.d.ts +13 -0
  53. package/lib/types/fetch/adapters/readable-http/provider.d.ts.map +1 -0
  54. package/lib/types/fetch/adapters/readable-http/readability.d.ts +28 -0
  55. package/lib/types/fetch/adapters/readable-http/readability.d.ts.map +1 -0
  56. package/lib/types/fetch/adapters/readable-http/schema.d.ts +18 -0
  57. package/lib/types/fetch/adapters/readable-http/schema.d.ts.map +1 -0
  58. package/lib/types/host/routes.d.ts +18 -0
  59. package/lib/types/host/routes.d.ts.map +1 -0
  60. package/lib/types/index.d.ts +12 -0
  61. package/lib/types/index.d.ts.map +1 -0
  62. package/lib/types/research/pipeline.d.ts +26 -0
  63. package/lib/types/research/pipeline.d.ts.map +1 -0
  64. package/lib/types/research/prompt.d.ts +43 -0
  65. package/lib/types/research/prompt.d.ts.map +1 -0
  66. package/lib/types/research/render.d.ts +4 -0
  67. package/lib/types/research/render.d.ts.map +1 -0
  68. package/lib/types/research/tool.d.ts +7 -0
  69. package/lib/types/research/tool.d.ts.map +1 -0
  70. package/lib/types/search/adapters/searxng/adapter.d.ts +3 -0
  71. package/lib/types/search/adapters/searxng/adapter.d.ts.map +1 -0
  72. package/lib/types/search/adapters/searxng/client.d.ts +31 -0
  73. package/lib/types/search/adapters/searxng/client.d.ts.map +1 -0
  74. package/lib/types/search/adapters/searxng/manifest.d.ts +4 -0
  75. package/lib/types/search/adapters/searxng/manifest.d.ts.map +1 -0
  76. package/lib/types/search/adapters/searxng/parse-html.d.ts +5 -0
  77. package/lib/types/search/adapters/searxng/parse-html.d.ts.map +1 -0
  78. package/lib/types/search/adapters/searxng/parse-json.d.ts +21 -0
  79. package/lib/types/search/adapters/searxng/parse-json.d.ts.map +1 -0
  80. package/lib/types/search/adapters/searxng/schema.d.ts +43 -0
  81. package/lib/types/search/adapters/searxng/schema.d.ts.map +1 -0
  82. package/lib/types/shared/defaults.d.ts +44 -0
  83. package/lib/types/shared/defaults.d.ts.map +1 -0
  84. package/lib/types/shared/diff.d.ts +23 -0
  85. package/lib/types/shared/diff.d.ts.map +1 -0
  86. package/lib/types/shared/errors.d.ts +14 -0
  87. package/lib/types/shared/errors.d.ts.map +1 -0
  88. package/lib/types/shared/limit.d.ts +8 -0
  89. package/lib/types/shared/limit.d.ts.map +1 -0
  90. package/lib/types/shared/localized.d.ts +5 -0
  91. package/lib/types/shared/localized.d.ts.map +1 -0
  92. package/lib/types/shared/path.d.ts +7 -0
  93. package/lib/types/shared/path.d.ts.map +1 -0
  94. package/lib/types/shared/url.d.ts +18 -0
  95. package/lib/types/shared/url.d.ts.map +1 -0
  96. package/lib/types/shared/validation.d.ts +17 -0
  97. package/lib/types/shared/validation.d.ts.map +1 -0
  98. package/locale/en.json +6 -0
  99. package/locale/zh.json +6 -0
  100. package/package.json +149 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,168 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1 — 2026-10-22
4
+
5
+ ### Changed
6
+
7
+ - `README.md` is now the complete Simplified Chinese guide; `README.en.md` is the
8
+ full English counterpart. `README.zh.md` remains only as a compatibility pointer
9
+ to the canonical Chinese README.
10
+ - The npm tarball ships `README.md` and `README.en.md`. `README.zh.md` remains a
11
+ small compatibility pointer; npm's automatic README handling may still include
12
+ it even though it is not in the explicit `files` list.
13
+ - Status metadata and the default SearXNG/Readability User-Agents report
14
+ `0.1.1`.
15
+ - Added the v0.1.1 release checklist. No functional behavior changed.
16
+
17
+ ### Verified
18
+
19
+ - The full `pnpm release` gate passes after the documentation and metadata
20
+ changes.
21
+
22
+ ## 0.1.0 — 2026-10-22
23
+
24
+ ### Added
25
+
26
+ - Adapter-first core: `ctx.searchTools` registry, stable search/fetch dispatchers,
27
+ manifest-driven settings metadata.
28
+ - SearXNG search adapter skeleton: config validation, JSON/HTML parsing, auth
29
+ lookup, failover, pagination, cache, probe.
30
+ - Readability HTTP fetch adapter skeleton: DSH safe fetch, lazily imported
31
+ linkedom/Readability, fail-open extraction.
32
+ - `web_research` tool and conversation card.
33
+ - Settings section registration (`settings.section`) and authenticated host
34
+ routes for status, adapters, probe, search preview, fetch preview, cache clear.
35
+ - YAML-backed config through DSH settings; credentials-backed secrets.
36
+ - Project skeleton: TypeScript, tsdown host/client builds, Vitest, CI/release
37
+ workflows, bilingual README, MIT license.
38
+ - Component tests for the settings page and `web_research` card
39
+ (`tests/settings-page.spec.tsx`, `tests/research-card.spec.tsx`), with jsdom
40
+ as a dev-only test environment.
41
+ - Code-based adapter issue messages, localized for `zh` / `en`; the settings
42
+ page falls back to the English message when no code is present.
43
+ - Generic manifest validation for external adapters, so a new adapter's required
44
+ fields and numeric bounds are checked before saving without importing its code
45
+ into the browser.
46
+ - The research card only turns `http(s)` source URLs into links and drops
47
+ malformed presentation-meta entries instead of rendering empty rows.
48
+ - `web_research` pipeline integration test: real HTML extraction, per-page
49
+ failure isolation, text clipping, total-budget accounting, disabled mode, and
50
+ presentation-meta projection.
51
+ - The research card reports successful fetches separately when some pages fail
52
+ (`1/2 fetched`) instead of counting attempts as successes.
53
+ - Search and Fetch tabs now have inline test panels. Results are structured:
54
+ elapsed time, safe `http(s)` source links, snippets, and fetch metadata/content,
55
+ instead of the previous single text blob. Tests refuse to run while the draft
56
+ has validation errors.
57
+ - Advanced diagnostics can copy a credential-free summary and clear the in-memory
58
+ error ring (`POST /api/dsh-search-tools/diagnostics/clear`).
59
+ - Search and Fetch validation is section-scoped: a broken search draft no longer
60
+ blocks a fetch test, and fetch errors no longer attach to search fields that
61
+ happen to share a key.
62
+ - Tab semantics (`role=tablist/tab/tabpanel`, arrow/Home/End navigation),
63
+ `aria-invalid` on invalid fields, an aria-live save/diagnostic status, and
64
+ `Cmd/Ctrl+S` save.
65
+ - The active-takeover instance rule is driven by the selected manifest's
66
+ `instances` field rather than a hard-coded SearXNG check. External adapters
67
+ without instances no longer produce a false save error.
68
+ - `/status` lists credential refs declared by every registered adapter manifest,
69
+ not just SearXNG's two refs.
70
+ - The settings footer is no longer sticky, so it cannot cover a long test result
71
+ in the 800px settings pane. Overview cards use `auto-fit` columns to avoid
72
+ label overlap at that width.
73
+ - Activation-hint and takeover-warning cards use token fallbacks, so they render
74
+ with a real border/background outside the settings theme scope.
75
+ - Adapter picker shows the selected manifest's description/capabilities and keeps
76
+ a visible “not installed” option for orphaned config.
77
+ - Adapter picker is now a radio-card group with per-adapter
78
+ configured/needs-setup/needs-attention status, a “not installed” orphan card,
79
+ and a Refresh adapters action.
80
+ - Research tab previews the model-facing `web_research` description and parameter
81
+ bounds from the current draft. The contract lives in `src/research/prompt.ts`
82
+ and is shared with the registered tool, so the preview cannot drift from the
83
+ tool description.
84
+ - Instance rows stack the URL/label fields and their actions in the 800px
85
+ settings pane, and show a visible “Enabled” label next to the switch. This
86
+ fixes a 4px-wide URL input caused by the action row consuming the grid.
87
+ - SearXNG's `unresponsive_engines` are surfaced as `Search notes` in the settings
88
+ preview, so an empty result caused by suspended engines is distinguishable from
89
+ a genuinely empty search.
90
+
91
+ ### Changed
92
+
93
+ - `pnpm release` now uses a narrow publint policy that ignores only the known
94
+ `FILE_INVALID_FORMAT` verdict for `lib/client.js` (a DSH browser CJS factory)
95
+ and reports every other diagnostic. The same check runs in CI.
96
+ - Package metadata now includes search keywords, `publishConfig.access: public`,
97
+ and publishes `CHANGELOG.md` / `SECURITY.md` in the tarball.
98
+
99
+ ### Verified
100
+
101
+ - M0 on DSH `0.2.1-rc.2`: Settings → Search Tools renders; Save writes
102
+ `cordis.patch.yml`; authenticated routes return 401 without the browser
103
+ cookie and 200 with it; probe/search-preview work against a mock SearXNG;
104
+ search/fetch takeover and restore work; secret write stays out of YAML.
105
+ Details: `docs/m0-verification.md`.
106
+ - A scripted model drove `web_research` through the real DSH agent loop and Web
107
+ GUI: the tool executed against a mock SearXNG, fetched two public pages, wrote
108
+ a `tool/result` with presentation meta, and rendered the card in the
109
+ conversation (`2 sources`, `2 fetched`, source links, fetched details).
110
+ - 65 tests across 13 files, including settings-page, activation-hint,
111
+ research-card, takeover-warning, diagnostics text, publint policy, and
112
+ `web_research` pipeline tests (`pnpm test`).
113
+ - A live Web GUI pass on the new form UX: inline search test rendered two
114
+ structured sources, the footer no longer covered the result, the zero-instance
115
+ empty state and one-column Overview layout rendered correctly, `Copy
116
+ diagnostics`/`diagnostics/clear` worked, and the activation hint rendered as a
117
+ bordered card after disabling/re-enabling the bundle. Dark theme and a 700px
118
+ narrow viewport also rendered correctly; tabs wrap instead of clipping.
119
+ - A live Web GUI pass on the product-polish surface: the picker rendered as a
120
+ one-card radiogroup with `Configured`, `Refresh adapters` reported success, the
121
+ research prompt rendered at 530×272 with current bounds, and at 700px the prompt
122
+ reflowed to 382px without horizontal overflow. The same pass caught and fixed a
123
+ 4px-wide instance URL input caused by the action row consuming the instance
124
+ grid; URL/label now render full width with actions below.
125
+ - A real authenticated SearXNG instance was probed and searched through the
126
+ settings page: JSON API and Basic auth worked, 10 real sources rendered, and
127
+ credentials stayed out of YAML (`Source: env`). With the instance's default
128
+ engines suspended, the preview showed `Search notes`; selecting `bing` returned
129
+ real results. Details: `docs/m0-verification.md`.
130
+ - A real OpenAI-compatible model (`agnes-3.0-flash`) called `web_research`,
131
+ built-in `web_search`, and built-in `web_fetch` through the live Web GUI. The
132
+ research turn returned 8 real SearXNG sources and fetched 2 pages (1,792 and
133
+ 868 chars); `web_search` used the taken-over provider; `web_fetch` returned
134
+ HTTP 200 for example.com. The provider key stayed in the process environment,
135
+ with no secret in YAML, the repository, or the three test-session logs (the
136
+ chat transcript that supplied it is separate and should be treated as exposed).
137
+ Details: `docs/m0-verification.md`.
138
+ - Final v0.1.0 gate: `pnpm release` passed with 65 tests / 13 files, host/client/
139
+ type builds, a pack dry run, and no publint issues after the documented
140
+ client-bundle exemption. `npm publish --dry-run` accepted the 99-file, 158.4 kB
141
+ tarball, including `CHANGELOG.md` / `SECURITY.md`; publication itself remains
142
+ pending npm authentication and a reachable repository remote.
143
+
144
+ ### Fixed during M0
145
+
146
+ - Resolve credentials per request instead of capturing them at plugin apply.
147
+ - Read the `{ ok, value }` envelope from `remote.credentials.describe`.
148
+ - Render write-only secret fields from `manifest.secretRefs`.
149
+ - Require a passing search test before search takeover and restore the previous
150
+ provider on disable.
151
+ - Allow an empty instance list when takeover is off.
152
+ - Localize page copy and adapter manifests for `zh` / `en`.
153
+ - Rebuild the LRU when cache bounds change; wire `undici.ProxyAgent`.
154
+ - Validate a missing `userAgent` against the adapter default.
155
+ - Use linkedom instead of jsdom for Readability: jsdom's `tr46` dependency
156
+ calls `createRequire(...).resolve.paths`, which DSH's profile-resolution hook
157
+ breaks; linkedom is smaller and works inside the Host.
158
+ - Add the `plugins.detail.section` takeover warning with a direct
159
+ “disable takeover” action.
160
+ - Add per-instance probe buttons and an empty-state guide.
161
+ - Add localized adapter manifests so external adapters can ship `en` / `zh`
162
+ labels without changing the page.
163
+ - Drop malformed `web_research` presentation-meta entries instead of rendering
164
+ empty list items or duplicate React keys.
165
+ - Give research number fields real label/id associations, so they are reachable
166
+ by accessible name as well as by mouse.
167
+ - Recognize a scoped package name (`@scope/dsh-search-tools`) in the Plugins-page
168
+ takeover warning instead of requiring the unscoped name verbatim.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ThzxxArt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.