@curio-data/mcp-intelli-search 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -21
- package/dist/{chunk-JIW7J65N.js → chunk-67MPZQF2.js} +198 -21
- package/dist/{chunk-VYV3EUCW.js → chunk-GNQNWFYE.js} +2 -2
- package/dist/cli.js +21 -16
- package/dist/runtime.js +2 -2
- package/dist/server.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@curio-data/mcp-intelli-search)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
[](https://github.com/Curio-Data/pi-intelli-search/blob/main/LICENSE)
|
|
9
|
-

|
|
10
10
|
|
|
11
11
|
Intelligent web research for coding agents: search, extract, collate, and cache grounded web context in one tool call.
|
|
12
12
|
|
|
@@ -21,6 +21,7 @@ Intelligent web research for coding agents: search, extract, collate, and cache
|
|
|
21
21
|
- 🌐 **Fetch:** Dual-fetch each page (Hypertext Markup Language (HTML) → [_Defuddle_](https://github.com/kepano/defuddle) versus Markdown endpoint), compare quality, pick the cleaner version.
|
|
22
22
|
- 📄 **Extract:** Per-page large language model (LLM) extraction guided by a _focused prompt_. Compresses ≈50K to ≈3-5K chars of query-relevant content.
|
|
23
23
|
- 🔗 **Collate:** Cross-source deduplication, inconsistency detection, and synthesis into a focused ≈5K-character summary.
|
|
24
|
+
- 📚 **Batch Research:** One `intelli_research` call accepts two or more questions known at launch (up to ten by default) and returns either a separate answer for each (independent mode) or one merged report on a common topic (expansion mode). The entries run concurrently, four at a time by default, and the agent receives every answer in one result instead of making one call per question. In one paired benchmark on the native `Pi` host, a session that submitted five questions on one topic as one expansion batch used ≈74% less main-model input and finished ≈63% sooner than a session making five separate calls. The main-model charge fell ≈25%, because most of the separate calls' input was cached context billed below the full input price. That is one pair on one topic, not a general result. Batching follows observed use: in a survey of one host's agent transcripts, 39% of `Pi` messages calling `intelli_research` issued two to five calls, and 15 of 30 sampled follow-up calls made within five minutes were steps the agent had already planned. See [Planned Research Questions](#planned-research-questions), the [benchmark](https://github.com/Curio-Data/pi-intelli-search/blob/main/docs/BENCHMARKS.md#batch-research-on-the-native-host) and the [survey](https://github.com/Curio-Data/pi-intelli-search/blob/main/docs/proposals/BATCH-RESEARCH.md#evidence).
|
|
24
25
|
- 🧠 **Reasoning-Aware Output Budget:** When a reasoning model spends its output cap on hidden reasoning, research retries at a doubled cap (8,000, then 16,000, then 32,000 tokens by default) before reporting a failure. See [Output Budget Retry](#output-budget-retry).
|
|
25
26
|
- 📏 **Long Pages, Bounded Collation:** Extraction reads up to 400,000 characters of each page. When the extractions exceed the [collation input budget](#collation-input-budget), the longest are trimmed at clean boundaries, and the result gives the path of each trimmed extraction's full saved file.
|
|
26
27
|
- 🧾 **Recoverable Failures:** When no extraction succeeds, research saves the fetched pages and a failure report; when synthesis fails, it saves the pages and extractions as well. The result names the saved files, so the agent can read them rather than repeat the paid stages. See [Extraction Diagnostics](#extraction-diagnostics).
|
|
@@ -35,7 +36,7 @@ For [`Pi`](https://github.com/earendil-works/pi), the sibling `@curio-data/pi-in
|
|
|
35
36
|
|
|
36
37
|
The shared pipeline searches via a search-grounded model ([_Perplexity Sonar_](https://docs.perplexity.ai), the native default) and merges prose links with harvested citations before selecting pages. It fetches pages through a dual-fetch comparison ([_Defuddle_](https://github.com/kepano/defuddle) versus Markdown endpoint), then extracts query-relevant content per page with a dedicated large language model (LLM) guided by a _focused prompt_. Collation deduplicates findings, flags inconsistencies, and synthesises a concise summary. Reports, extractions and fetched content are cached for offline reuse in `.search/` by default. Cache suggest surfaces related previous searches on each query.
|
|
37
38
|
|
|
38
|
-
##
|
|
39
|
+
## Three Packages, One Engine
|
|
39
40
|
|
|
40
41
|
Choose the installation route for the host:
|
|
41
42
|
|
|
@@ -44,22 +45,24 @@ Choose the installation route for the host:
|
|
|
44
45
|
| Native `Pi` Extension | `Pi` | `@curio-data/pi-intelli-search` |
|
|
45
46
|
| Direct MCP Registration | Any MCP-compatible host | `@curio-data/mcp-intelli-search` |
|
|
46
47
|
| Host Plugin | Claude Code or Codex | Repository marketplace launching the pinned MCP package |
|
|
48
|
+
| Host Plugin | DeepSeek Harness | Profile bundle `@curio-data/dsh-intelli-search`; installation by name requires its matching MCP release. |
|
|
47
49
|
|
|
48
|
-
The install branches: [`Pi` Native Extension](https://github.com/Curio-Data/pi-intelli-search/blob/main/README.md#pi-native-extension) and [MCP Server](#mcp-server), with host instructions for [Claude Code](#claude-code), [Codex](#codex) and any [Generic MCP Host](#generic-mcp-host).
|
|
50
|
+
The install branches: [`Pi` Native Extension](https://github.com/Curio-Data/pi-intelli-search/blob/main/README.md#pi-native-extension) and [MCP Server](#mcp-server), with host instructions for [Claude Code](#claude-code), [Codex](#codex), [DeepSeek Harness](https://github.com/Curio-Data/pi-intelli-search/blob/mcp-v0.25.0/README.md#deepseek-harness) and any [Generic MCP Host](#generic-mcp-host).
|
|
49
51
|
|
|
50
|
-
The native extension uses `Pi` settings and authentication. Generic MCP registration requires explicit configuration and a workspace; the Codex
|
|
52
|
+
The native extension uses `Pi` settings and authentication. Generic MCP registration requires explicit configuration and a workspace; the Codex and DeepSeek Harness launchers take the workspace from the host working directory and use built-in defaults unless a per-user configuration is supplied. Inference uses an OpenRouter key supplied through the configured environment variable or credential file. The MCP server does not read `Pi` settings or credentials.
|
|
51
53
|
|
|
52
54
|
## Contents
|
|
53
55
|
|
|
54
56
|
<!-- TOC:START -->
|
|
55
57
|
|
|
56
|
-
- [
|
|
58
|
+
- [Three Packages, One Engine](#three-packages-one-engine)
|
|
57
59
|
- [Install](#install)
|
|
58
60
|
- [MCP Server](#mcp-server)
|
|
59
61
|
- [MCP Prerequisites](#mcp-prerequisites)
|
|
60
62
|
- [Claude Code](#claude-code)
|
|
61
63
|
- [Claude Code Plugin](#claude-code-plugin)
|
|
62
64
|
- [Codex](#codex)
|
|
65
|
+
- [DeepSeek Harness](#deepseek-harness)
|
|
63
66
|
- [Generic MCP Host](#generic-mcp-host)
|
|
64
67
|
- [Tools](#tools)
|
|
65
68
|
- [Evidence and Provenance](#evidence-and-provenance)
|
|
@@ -104,12 +107,12 @@ The native extension uses `Pi` settings and authentication. Generic MCP registra
|
|
|
104
107
|
|
|
105
108
|
#### MCP Prerequisites
|
|
106
109
|
|
|
107
|
-
- [_Node.js_](https://nodejs.org/) 22 or later, with `node` and `npx` on `PATH`.
|
|
110
|
+
- [_Node.js_](https://nodejs.org/) 22 or later for the standalone package, with `node` and `npx` on `PATH`. The [DeepSeek Harness](#deepseek-harness) bundle follows that host's own floor, Node.js 24.9 or later.
|
|
108
111
|
- [_Claude Code_](https://code.claude.com/docs/en/overview) installed for the example below.
|
|
109
112
|
- An [OpenRouter API key](https://openrouter.ai/keys) with credit for inference. One key covers all three model roles; charges are separate from the host subscription.
|
|
110
113
|
- An existing project folder for the research cache. The server and host must be able to read the same filesystem.
|
|
111
114
|
|
|
112
|
-
Generic registration requires an explicit JavaScript Object Notation (JSON) configuration and absolute workspace path. The Codex
|
|
115
|
+
Generic registration requires an explicit JavaScript Object Notation (JSON) configuration and absolute workspace path. The Codex and DeepSeek Harness launchers use the host working directory and built-in model defaults when no per-user configuration exists. The server reads no host credential stores, `Pi` settings or discovered project configuration. Native fetch assets are verified on _Linux_ x86-64; _macOS_ and _Windows_ are not verified. See [Compatibility](#mcp-server-compatibility) for the recorded scope.
|
|
113
116
|
|
|
114
117
|
#### Claude Code
|
|
115
118
|
|
|
@@ -250,6 +253,36 @@ In the session, ask: “Use intelli_search to find the current TypeScript releas
|
|
|
250
253
|
|
|
251
254
|
The installed `intelli-search` skill covers configuration and unattended tool approval; see the [compatibility matrix](https://github.com/Curio-Data/pi-intelli-search/blob/main/docs/COMPATIBILITY.md#host-plugins) for verified host behaviour.
|
|
252
255
|
|
|
256
|
+
#### DeepSeek Harness
|
|
257
|
+
|
|
258
|
+
[_DeepSeek Harness_](https://github.com/deepseek-ai/deepseek-harness) (`dsh`) ships a Model Context Protocol client bridge, so this route is a generated configuration bundle rather than an extension: one inserted bridge row starts the pinned `@curio-data/mcp-intelli-search` package through `npx` with `--host dsh`, and one registrar registers the `intelli-search` skill with the harness. Neither carries pipeline code.
|
|
259
|
+
|
|
260
|
+
**Installation by name requires two public packages:** the profile bundle and the exact MCP server version its launcher selects. The local-bundle checks below do not test that registry route. See [Compatibility](https://github.com/Curio-Data/pi-intelli-search/blob/mcp-v0.25.0/docs/COMPATIBILITY.md#deepseek-harness-evidence-and-limits) for the recorded installation evidence.
|
|
261
|
+
|
|
262
|
+
The bundle is published separately from this server. Check the [repository installation guide](https://github.com/Curio-Data/pi-intelli-search#readme) for availability before installing. Its example uses the `tui` profile.
|
|
263
|
+
|
|
264
|
+
Start the same profile from the project directory with `dsh --profile tui`. The first start downloads the MCP package through `npx`, so it needs network access.
|
|
265
|
+
|
|
266
|
+
Credentials reach the server through the harness environment layer. Precedence: an `OPENROUTER_API_KEY` exported in the launching environment, then a `.env` file in the launch directory, then `$DSH_HOME/.env`. Accepted values are copied into the environment once at launch, so restart that profile after changing a key. To use the key across launching shells, prepare the harness-home file before entering the key:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
(umask 077; touch "${DSH_HOME:-$HOME/.dsh}/.env") && chmod 600 "${DSH_HOME:-$HOME/.dsh}/.env"
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
After the command succeeds, open the file in an editor so the key stays out of shell history. Put `OPENROUTER_API_KEY=<key>` on its own line, replacing any previous definition.
|
|
273
|
+
|
|
274
|
+
The bridge row forwards `process.env.OPENROUTER_API_KEY` to the server; the server treats an empty value as absent and starts without a key. A key stored through the harness model-settings page does not provision this server: that credential is resolved through a service a child process cannot read. As an alternative, `npx -y --package @curio-data/mcp-intelli-search mcp-intelli-search setup` reads a key from standard input and stores it in a user-only credential file beside the shared per-user configuration at `${XDG_CONFIG_HOME:-$HOME/.config}/mcp-intelli-search`, the same location the [Codex](#codex) launcher reads. The file is reread on each call, but a nonempty environment key takes precedence. Remove `OPENROUTER_API_KEY` from all three environment layers and restart to use the file.
|
|
275
|
+
|
|
276
|
+
Start the harness from the project folder: the server uses the harness working directory as its workspace and writes the research cache below it, and a directory change later in the session does not move the cache. For a fixed project root, override the row with id `mcp-intelli-search` in `$DSH_HOME/profiles/<name>/cordis.patch.yml` and set `cwd`. The override replaces that row's entire `config`. Copy its other `config` fields from the bundle and update the pinned package version after each bundle upgrade. A home or filesystem-root working directory produces an actionable `WORKSPACE` tool error instead of an accidental shared cache. The four tools appear before a key is configured.
|
|
277
|
+
|
|
278
|
+
This host names the MCP server `intelli`, so the tools are `mcp__intelli__intelli_search`, `mcp__intelli__intelli_extract`, `mcp__intelli__intelli_collate` and `mcp__intelli__intelli_research`. Research calls can take minutes: the bundle raises the bridge call limit to ten minutes, while server startup and tool discovery use a separate request timeout (60 seconds on `0.2.2-rc.1`), so a slow first `npx` download can still lose the tools on a first start. A missing tool set means the bridge row did not start; the bundle sets `failOnStartupError: false`, so the harness keeps running and logs the failure. Run `dsh --profile <name> --dump-config` to confirm the two bundle rows, then report the missing tools with the startup log rather than substituting the harness's own web search. On `0.2.2-rc.1`, a project skill with the same name outranks the bundle's registration; a user-level skill does not.
|
|
279
|
+
|
|
280
|
+
In the session, ask: “Use mcp__intelli__intelli_search to find the current TypeScript release and cite the official source.” Confirm a successful MCP tool call and an answer with sources; a registered tool list alone does not prove provider access.
|
|
281
|
+
|
|
282
|
+
Uninstall with `dsh plugin --profile <name> remove @curio-data/dsh-intelli-search`, restart the same profile with `dsh --profile <name>`, and confirm with `dsh --profile <name> --dump-config` that both bundle rows are gone.
|
|
283
|
+
|
|
284
|
+
Credential-free installation, tool registration, skill loading, workspace guards and dummy credential delivery are verified against `dsh` `0.2.2-rc.1` and `0.2.2-rc.5` on Linux with the local bundle. On `0.2.2-rc.1`, a separate credentialed run also verified search, three-page research and the credential-file fallback. See [DeepSeek Harness Evidence and Limits](https://github.com/Curio-Data/pi-intelli-search/blob/mcp-v0.25.0/docs/COMPATIBILITY.md#deepseek-harness-evidence-and-limits).
|
|
285
|
+
|
|
253
286
|
<a id="route-a-direct-mcp-configuration"></a>
|
|
254
287
|
#### Generic MCP Host
|
|
255
288
|
|
|
@@ -285,7 +318,7 @@ Both packages expose these four operations. Start with `intelli_search` for fact
|
|
|
285
318
|
|
|
286
319
|
| Tool | Description |
|
|
287
320
|
| ------------------ | --------------------------------------------------------------------------------------------------- |
|
|
288
|
-
| `intelli_search` | Search the web and return a concise answer with a source list (
|
|
321
|
+
| `intelli_search` | Search the web and return a concise answer with a source list numbered to the answer's citation markers where they can be matched (see [Source Harvesting from Citations](https://github.com/Curio-Data/pi-intelli-search/blob/main/README.md#source-harvesting-from-citations)). |
|
|
289
322
|
| `intelli_extract` | Extract query-relevant content from a web page, preserving code and technical detail verbatim. |
|
|
290
323
|
| `intelli_collate` | Deduplicate and synthesise multiple extractions into a summary. Writes cache. |
|
|
291
324
|
| `intelli_research` | Search, fetch, extract, collate and cache multi-page research in one call. |
|
|
@@ -476,11 +509,11 @@ This reference applies to `@curio-data/mcp-intelli-search` only. Installation ro
|
|
|
476
509
|
### Requirements
|
|
477
510
|
|
|
478
511
|
- [_Node.js_](https://nodejs.org/) satisfying the `engines` range in the [standalone manifest](https://github.com/Curio-Data/pi-intelli-search/blob/main/packages/mcp/package.json).
|
|
479
|
-
- An existing absolute workspace directory and JSON configuration file for generic registration or direct runtime use. Codex
|
|
512
|
+
- An existing absolute workspace directory and JSON configuration file for generic registration or direct runtime use. Codex and DeepSeek Harness modes use the launch directory and supply model defaults.
|
|
480
513
|
- A separately billed OpenRouter API key supplied through a named environment variable before constructing the runtime, or through `setup` and a user-only credential file. Environment changes require a runtime restart; each operation rereads the selected credential file, so a new or replacement key takes effect on the next operation.
|
|
481
514
|
- A platform supported by [_wreq-js_](https://github.com/sqdshguy/wreq-js), the browser-fingerprint fetch dependency. The installation gate exercises its native assets on the running platform; it does not establish support for other platforms.
|
|
482
515
|
|
|
483
|
-
The package neither reads host credential stores nor loads project configuration automatically. Codex
|
|
516
|
+
The package neither reads host credential stores nor loads project configuration automatically. Codex and DeepSeek Harness modes share per-user configuration and credential paths. Native `Pi` settings, authentication, providers and defaults remain independent.
|
|
484
517
|
|
|
485
518
|
### Verification
|
|
486
519
|
|
|
@@ -496,7 +529,7 @@ Use the same configuration and workspace as the registered server. If a project-
|
|
|
496
529
|
|
|
497
530
|
### Serving the Protocol
|
|
498
531
|
|
|
499
|
-
An invocation without `--check-config` validates the selected workspace, then serves the four canonical tools (`intelli_search`, `intelli_extract`, `intelli_collate`, `intelli_research`) over stdio until the input stream closes. An explicitly selected missing, unreadable or invalid configuration file does not prevent connection: each tool call returns an actionable `CONFIGURATION` error, and the server rereads the file on each call until it loads. Repair the file and call again. Once loaded, configuration remains fixed until restart. Generic registration rejects missing launcher arguments and invalid workspaces at startup; `--check-config` remains strict.
|
|
532
|
+
An invocation without `--check-config` validates the selected workspace, then serves the four canonical tools (`intelli_search`, `intelli_extract`, `intelli_collate`, `intelli_research`) over stdio until the input stream closes. An explicitly selected missing, unreadable or invalid configuration file does not prevent connection: each tool call returns an actionable `CONFIGURATION` error, and the server rereads the file on each call until it loads. Repair the file and call again. Once loaded, configuration remains fixed until restart. Generic registration rejects missing launcher arguments and invalid workspaces at startup; `--check-config` remains strict. Each host mode uses its working directory and built-in defaults when its per-user configuration is absent. Serving performs no inference at startup; credentials are only required when an operation runs.
|
|
500
533
|
|
|
501
534
|
- **Registration and Schemas.** Tool names and JSON input schemas mirror the native `Pi` tools verbatim; descriptions adapt the native guidance for protocol clients (host-neutral cache wording, embedded `focusPrompt` and breadth guidance), because the protocol offers no separate guidance channel. Invalid tool arguments are reported as tool errors (`isError` results), matching the software development kit (SDK) distinction between malformed protocol requests and invalid arguments.
|
|
502
535
|
- **Results.** Successful calls return the complete operation text both as text content and as `structuredContent.text`, alongside `outcome` and `details`. Hosts that prefer the structured representation receive the same answer, sources and cache suggestions. The duplication is intentional for host compatibility; a host that forwards both representations can consume extra context. Degraded research (`no-links`, `fetch-failed`, `extraction-failed`, `collate-failed`) remains a normal result. Execution failures return `isError` results tagged with the safe `StandaloneError` category rather than raw provider causes.
|
|
@@ -510,9 +543,9 @@ Startup diagnostics go to standard error. The SDK version range is declared in `
|
|
|
510
543
|
|
|
511
544
|
### Configuration
|
|
512
545
|
|
|
513
|
-
Select the configuration with `--config FILE` or `INTELLI_SEARCH_CONFIG`. Select the workspace with `--workspace ABSOLUTE_DIRECTORY` or `INTELLI_SEARCH_WORKSPACE`. Command-line values take precedence. Relative workspace paths are rejected; existing workspace symlinks are canonicalised. `--host codex` instead selects the working root and `${XDG_CONFIG_HOME:-$HOME/.config}/mcp-intelli-search/config.json`; explicit selections still take precedence.
|
|
546
|
+
Select the configuration with `--config FILE` or `INTELLI_SEARCH_CONFIG`. Select the workspace with `--workspace ABSOLUTE_DIRECTORY` or `INTELLI_SEARCH_WORKSPACE`. Command-line values take precedence. Relative workspace paths are rejected; existing workspace symlinks are canonicalised. Either `--host codex` or `--host dsh` instead selects the working root and `${XDG_CONFIG_HOME:-$HOME/.config}/mcp-intelli-search/config.json`; explicit selections still take precedence.
|
|
514
547
|
|
|
515
|
-
The [minimal configuration](#create-the-configuration) explicitly selects OpenRouter for every role; add an optional `tuning` object (for example `"cacheDir": ".search"`) beside `providers` and `models`. Generic registration has no model defaults.
|
|
548
|
+
The [minimal configuration](#create-the-configuration) explicitly selects OpenRouter for every role; add an optional `tuning` object (for example `"cacheDir": ".search"`) beside `providers` and `models`. Generic registration has no model defaults. Both host modes use `perplexity/sonar` for search and `minimax/minimax-m3` for extraction and collation when no per-user file exists.
|
|
516
549
|
|
|
517
550
|
Only `providers`, `models` and optional `tuning` are accepted at the top level. All three model roles are required in a configuration file. The provider object accepts `apiKeyEnv`, an environment-variable name rather than a key value, and optional `apiKeyFile`, an absolute path to a separately stored key. The environment variable takes precedence. Setup writes the key with user-only permissions; each file read rejects symbolic links, hard links, other owners and group or world access on platforms with POSIX permissions. Setup manages the default per-user configuration. For a separately selected generic configuration, set `providers.openrouter.apiKeyFile` to the credential path printed by setup and restart after changing loaded configuration. The initial provider scope is OpenRouter at its fixed `https://openrouter.ai/api/v1` endpoint; custom endpoints, proxy settings, provider fallback and dynamic router model identifiers are not accepted.
|
|
518
551
|
|
|
@@ -526,7 +559,7 @@ Unspecified tuning comes from the canonical [shared defaults](https://github.com
|
|
|
526
559
|
|
|
527
560
|
| Setting | Default and Effect | Accepted Values |
|
|
528
561
|
|---|---|---|
|
|
529
|
-
| `defaultUrls` | `10`: fallback page budget and one-shot search source-list
|
|
562
|
+
| `defaultUrls` | `10`: fallback page budget and one-shot search source-list size (a cited higher-numbered entry can exceed it) | Integer from 1 to 100; must not exceed `maxUrls` |
|
|
530
563
|
| `maxUrls` | `20`: hard cap on research pages | Integer from 1 to 100 |
|
|
531
564
|
| `extractMaxChars` | `400000`: per-page extraction input character limit (≈100,000 tokens) | Integer from 1 to 2,000,000 |
|
|
532
565
|
| `fetchTimeoutMs` | `20000`: page-fetch timeout in milliseconds | Integer from 1 to 600,000 |
|
|
@@ -646,9 +679,9 @@ Every startup failure is diagnostic-only and lands on standard error; standard o
|
|
|
646
679
|
| Configuration rejected with an unknown-key or range error | The loader is strict: unknown keys, invalid types and out-of-range values fail validation. Correct the configuration and call again if it has not yet loaded. The [Tuning](#tuning) table lists accepted keys and ranges. |
|
|
647
680
|
| Tools never appear in the host | Check absent launcher arguments, an unusable workspace or an unsafe cache. Read the host's MCP server logs for the standard-error diagnostic. Claude Code can cache a startup failure from an older server: try `/mcp` reconnect, then restart ([evidence and limits](https://github.com/Curio-Data/pi-intelli-search/blob/main/docs/COMPATIBILITY.md#claude-code-evidence-and-limits)). A connected server still needs a successful tool call to verify inference. |
|
|
648
681
|
| `CONFIGURATION` persists after the file is repaired | A file that has not yet loaded is reread on the next call; once loaded, configuration changes require a restart. |
|
|
649
|
-
| Diagnostic names a missing credential environment variable | Supply the named variable before host launch. Codex users can instead run
|
|
682
|
+
| Diagnostic names a missing credential environment variable | Supply the named variable before host launch. Codex and DeepSeek Harness users can instead run the [setup command](#codex) with the key on standard input. For a separately selected configuration, set `providers.openrouter.apiKeyFile` to the printed credential path. Environment or loaded-configuration changes require restart; file credentials are reread on each call. |
|
|
650
683
|
| Catalogue preflight names a model role or capability | Correct the model identifier or required capabilities using [Configuration](#configuration). Read the diagnostic; catalogue lookup failures are not proof of invalid credentials. Restart after changing loaded model selections. |
|
|
651
|
-
| `PROVIDER` reports authentication, access, credit or transport failure | Follow the specific diagnostic: check credentials, model access, account credit or connectivity. Restart after changing an environment credential. For the default Codex
|
|
684
|
+
| `PROVIDER` reports authentication, access, credit or transport failure | Follow the specific diagnostic: check credentials, model access, account credit or connectivity. Restart after changing an environment credential. For the default per-user configuration shared by Codex and DeepSeek Harness, replace a stored key with `setup` and call again. For a separately selected configuration, replace the file named by `providers.openrouter.apiKeyFile`, or select setup's printed path and restart. The category alone does not identify a rejected key. |
|
|
652
685
|
| Repeated `429` retries | Tune pacing to observed account/provider limits. For an observed limit of approximately 0.33 requests per second, try `minRequestIntervalMs: 3000` and `extractionConcurrency: 2`; adjust retry attempts as needed. Raise `llmTimeoutMs` only when its model-call timer expires. |
|
|
653
686
|
| Cache paths unreadable from the host | The host must share the server's filesystem. Sandboxed or remote hosts cannot read local cache paths; run the server where the host can read the workspace. |
|
|
654
687
|
|
|
@@ -704,12 +737,12 @@ To suppress both telemetry files in the MCP server, set `"disableTelemetry": tru
|
|
|
704
737
|
|
|
705
738
|
### MCP Server Compatibility
|
|
706
739
|
|
|
707
|
-
- Direct stdio registration serves MCP-compatible hosts; repository plugin routes serve Claude Code and Codex. Recorded live research clients include `Pi
|
|
740
|
+
- Direct stdio registration serves MCP-compatible hosts; repository plugin routes serve Claude Code and Codex, and the [DeepSeek Harness](#deepseek-harness) bundle launches the same server from a named profile. Recorded live research clients include `Pi`, Claude Code, Codex and DeepSeek Harness.
|
|
708
741
|
- The runtime must satisfy the Node.js `engines` range in the [standalone manifest](https://github.com/Curio-Data/pi-intelli-search/blob/main/packages/mcp/package.json). The server uses the [`@modelcontextprotocol/server` SDK](https://github.com/modelcontextprotocol/typescript-sdk), with its dependency range declared in that manifest and the verified release pinned in [package-lock.json](https://github.com/Curio-Data/pi-intelli-search/blob/main/package-lock.json).
|
|
709
742
|
- Standalone fetch assets are verified on _Linux_ x86-64 only; _macOS_ and _Windows_ are not verified.
|
|
710
|
-
- Full research through local-tarball plugins and registry-pin installation checks are separate evidence classes
|
|
743
|
+
- Full research through local-tarball plugins and registry-pin installation checks are separate evidence classes, and the compatibility matrix records these checks for the standalone MCP package and the Claude Code and Codex plugins. For DeepSeek Harness, the matrix distinguishes credential-free host checks from credentialed local-bundle research. No registry-pin installation has been verified for this host. Publication alone does not establish host compatibility.
|
|
711
744
|
|
|
712
|
-
For the standalone MCP server and host plugins, including exact tested versions of _Claude Code_, _Codex_, Node.js and the MCP SDK, see [docs/COMPATIBILITY.md](https://github.com/Curio-Data/pi-intelli-search/blob/main/docs/COMPATIBILITY.md).
|
|
745
|
+
For the standalone MCP server and host plugins, including exact tested versions of _Claude Code_, _Codex_, DeepSeek Harness, Node.js and the MCP SDK, see [docs/COMPATIBILITY.md](https://github.com/Curio-Data/pi-intelli-search/blob/main/docs/COMPATIBILITY.md).
|
|
713
746
|
|
|
714
747
|
## Documentation
|
|
715
748
|
|
|
@@ -718,12 +751,12 @@ For the standalone MCP server and host plugins, including exact tested versions
|
|
|
718
751
|
- [Architecture](https://github.com/Curio-Data/pi-intelli-search/blob/main/docs/ARCHITECTURE.md): Detailed design decisions and pipeline internals.
|
|
719
752
|
- [Compatibility](https://github.com/Curio-Data/pi-intelli-search/blob/main/docs/COMPATIBILITY.md): Tested host versions and artefacts for the native extension, MCP server and plugins.
|
|
720
753
|
- [Components](https://github.com/Curio-Data/pi-intelli-search/blob/main/docs/COMPONENTS.md): Third-party dependencies and licence attribution.
|
|
721
|
-
- [Claude Code skill](https://github.com/Curio-Data/pi-intelli-search/blob/main/plugins/claude-code/skills/intelli-search/SKILL.md)
|
|
754
|
+
- [Claude Code skill](https://github.com/Curio-Data/pi-intelli-search/blob/main/plugins/claude-code/skills/intelli-search/SKILL.md), [Codex skill](https://github.com/Curio-Data/pi-intelli-search/blob/main/plugins/codex/skills/intelli-search/SKILL.md) and [DeepSeek Harness skill](https://github.com/Curio-Data/pi-intelli-search/blob/mcp-v0.25.0/plugins/dsh/skills/intelli-search/SKILL.md): Host-specific setup and agent-facing usage instructions.
|
|
722
755
|
- [Contributor guide](https://github.com/Curio-Data/pi-intelli-search/blob/main/AGENTS.md): Coding conventions and project structure.
|
|
723
756
|
|
|
724
757
|
## Downloads
|
|
725
758
|
|
|
726
|
-
Weekly npm downloads for
|
|
759
|
+
Weekly npm downloads for the native extension and MCP server packages, stacked by package and refreshed every Monday by a scheduled GitHub Action. The native extension is the lower segment of each bar and the MCP server is the upper segment; a DeepSeek Harness series is deferred until that package has download history. The chart is rendered with [rough.js](https://roughjs.com) from daily caches in `data/downloads.json` and `data/downloads-mcp.json` (see [`scripts/plot-downloads.mts`](https://github.com/Curio-Data/pi-intelli-search/blob/main/scripts/plot-downloads.mts)); the caches are append-only with a short trailing re-fetch window so npm's revisions of recent days are picked up. Only complete Monday-to-Sunday weeks are drawn, so a package's segment appears from the first refresh after its first complete week.
|
|
727
760
|
|
|
728
761
|
Daily counts come from npm's downloads API and are summed into weeks without additional filtering. [npm's counting documentation](https://blog.npmjs.org/post/92574016600/numeric-precision-matters-how-npm-download-counts-work.html) describes these totals as naïve by design: every served package tarball counts, including automation and mirrors, so read the bars as relative uptake, not unique-user counts. Verification runs that fetch the published tarballs from the registry, such as the registry-pin plugin checks, also count toward release-week totals.
|
|
729
762
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
resolveCredential,
|
|
7
7
|
validateCacheDir,
|
|
8
8
|
validateDomains
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GNQNWFYE.js";
|
|
10
10
|
|
|
11
11
|
// packages/mcp/src/runtime.ts
|
|
12
12
|
import { Check } from "typebox/value";
|
|
@@ -29,6 +29,17 @@ function displayCachePath(paths, physicalPath) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// src/core/annotations.ts
|
|
32
|
+
function dedupeCitations(list) {
|
|
33
|
+
const seen = /* @__PURE__ */ new Set();
|
|
34
|
+
const out = [];
|
|
35
|
+
for (const citation of list) {
|
|
36
|
+
if (!/^https?:\/\//.test(citation.url)) continue;
|
|
37
|
+
if (seen.has(citation.url)) continue;
|
|
38
|
+
seen.add(citation.url);
|
|
39
|
+
out.push(citation);
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
32
43
|
function citationsFromChunk(parsed) {
|
|
33
44
|
if (typeof parsed !== "object" || parsed === null) return [];
|
|
34
45
|
const choices = parsed.choices;
|
|
@@ -55,14 +66,8 @@ function citationsFromChunk(parsed) {
|
|
|
55
66
|
}
|
|
56
67
|
function parseCitations(bodyText2) {
|
|
57
68
|
const out = [];
|
|
58
|
-
const seen = /* @__PURE__ */ new Set();
|
|
59
69
|
const add = (list) => {
|
|
60
|
-
|
|
61
|
-
if (!seen.has(c.url)) {
|
|
62
|
-
seen.add(c.url);
|
|
63
|
-
out.push(c);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
70
|
+
out.push(...list);
|
|
66
71
|
};
|
|
67
72
|
const trimmed = bodyText2.trim();
|
|
68
73
|
if (trimmed.startsWith("{")) {
|
|
@@ -414,12 +419,19 @@ var RETRYABLE_PATTERNS = [
|
|
|
414
419
|
"connection.?error",
|
|
415
420
|
"connection.?refused",
|
|
416
421
|
"connection.?lost",
|
|
422
|
+
// Gateway mid-stream drop relayed as an Anthropic-style api_error event
|
|
423
|
+
// (pi #12064; upstream since pi-ai 1.6.0).
|
|
424
|
+
"connection.?closed",
|
|
417
425
|
"other side closed",
|
|
418
426
|
"fetch failed",
|
|
419
427
|
// node-fetch system errors, e.g. the Google ADC OAuth token refresh used by
|
|
420
428
|
// google-vertex. The reason is often empty (pi #10996).
|
|
421
429
|
"request to \\S+ failed, reason:",
|
|
422
430
|
"getaddrinfo",
|
|
431
|
+
// Bare Node socket error codes, bounded so they do not match inside a longer
|
|
432
|
+
// identifier (pi #12128; upstream since pi-ai 1.6.0).
|
|
433
|
+
"(?<![a-z0-9_])(?:ECONNRESET|ECONNABORTED|ECONNREFUSED|ETIMEDOUT|EPIPE)(?![a-z0-9_])",
|
|
434
|
+
"connection reset by peer",
|
|
423
435
|
"ENOTFOUND",
|
|
424
436
|
"EAI_AGAIN",
|
|
425
437
|
"upstream.?connect",
|
|
@@ -429,8 +441,9 @@ var RETRYABLE_PATTERNS = [
|
|
|
429
441
|
"timed? out",
|
|
430
442
|
"timeout",
|
|
431
443
|
"terminated",
|
|
432
|
-
//
|
|
433
|
-
//
|
|
444
|
+
// Unbounded raw Node transport codes retained from the pre-alignment
|
|
445
|
+
// classifier. Upstream 1.6.0 covers these in the bounded group above; the
|
|
446
|
+
// extras avoid narrowing the extension's existing matches.
|
|
434
447
|
"ETIMEDOUT",
|
|
435
448
|
"ECONNRESET",
|
|
436
449
|
"ECONNREFUSED",
|
|
@@ -446,6 +459,9 @@ var RETRYABLE_PATTERNS = [
|
|
|
446
459
|
// WebSocket transports can report close/error text instead of HTTP/fetch text.
|
|
447
460
|
"websocket.?closed",
|
|
448
461
|
"websocket.?error",
|
|
462
|
+
// Codex's 60-minute WebSocket lifetime limit; retrying opens a fresh
|
|
463
|
+
// connection (pi #12124; upstream since pi-ai 1.6.0).
|
|
464
|
+
"websocket.?connection.?limit.?reached",
|
|
449
465
|
// Premature stream endings from SDKs and transports (pi #4433, #3594).
|
|
450
466
|
"ended without",
|
|
451
467
|
"stream ended before message_stop",
|
|
@@ -592,16 +608,47 @@ function inferCurrentness(line) {
|
|
|
592
608
|
if (lower.includes("outdated") || lower.includes("old")) return "possibly outdated";
|
|
593
609
|
return "undated";
|
|
594
610
|
}
|
|
595
|
-
function
|
|
611
|
+
function matchTrailingSourcesSection(text) {
|
|
596
612
|
const trimmedEnd = text.replace(/[ \t]+$/g, "");
|
|
597
613
|
const match = trimmedEnd.match(
|
|
598
614
|
/\n[ \t]*(?:#{1,6}[ \t]*)?\*{0,2}Sources\*{0,2}[ \t]*:?[ \t]*\n[\s\S]*$/i
|
|
599
615
|
);
|
|
616
|
+
if (!match) return void 0;
|
|
617
|
+
if (!/https?:\/\/|\bwww\./.test(match[0])) return void 0;
|
|
618
|
+
return { start: match.index ?? 0, section: match[0] };
|
|
619
|
+
}
|
|
620
|
+
function stripTrailingSourcesSection(text) {
|
|
621
|
+
const match = matchTrailingSourcesSection(text);
|
|
600
622
|
if (!match) return text;
|
|
601
|
-
|
|
602
|
-
const cut = trimmedEnd.slice(0, match.index).replace(/\s+$/g, "");
|
|
623
|
+
const cut = text.slice(0, match.start).replace(/\s+$/g, "");
|
|
603
624
|
return cut + "\n";
|
|
604
625
|
}
|
|
626
|
+
function titleFromUrl(url) {
|
|
627
|
+
try {
|
|
628
|
+
const u = new URL(url);
|
|
629
|
+
const parts = u.pathname.split("/").filter(Boolean);
|
|
630
|
+
return parts.length > 0 ? parts[parts.length - 1].replace(/\.[^.]+$/, "") : u.hostname;
|
|
631
|
+
} catch {
|
|
632
|
+
return url;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
function hostOf(url) {
|
|
636
|
+
try {
|
|
637
|
+
return new URL(url).hostname;
|
|
638
|
+
} catch {
|
|
639
|
+
return void 0;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
function labelCandidateOk(label) {
|
|
643
|
+
return label.length > 0 && !/[\][\r\n\t]/.test(label) && !label.endsWith("\\") && label.trim().length > 0;
|
|
644
|
+
}
|
|
645
|
+
function safeLinkLabel(title, url) {
|
|
646
|
+
if (title !== void 0 && labelCandidateOk(title)) return title;
|
|
647
|
+
const derived = titleFromUrl(url);
|
|
648
|
+
if (labelCandidateOk(derived)) return derived;
|
|
649
|
+
const host = hostOf(url);
|
|
650
|
+
return host !== void 0 && labelCandidateOk(host) ? host : "source";
|
|
651
|
+
}
|
|
605
652
|
|
|
606
653
|
// src/core/llm.ts
|
|
607
654
|
async function runModelWithPolicy(attempt, request, logger, testing) {
|
|
@@ -765,6 +812,119 @@ help someone researching the current query.
|
|
|
765
812
|
Response format:
|
|
766
813
|
[{"index": 1, "relevance": "one-line note"}]`;
|
|
767
814
|
|
|
815
|
+
// src/core/citation-numbering.ts
|
|
816
|
+
function usedNumbers(text) {
|
|
817
|
+
const used = /* @__PURE__ */ new Set();
|
|
818
|
+
for (const m of text.matchAll(/\[(\d{1,3})\]/g)) used.add(Number(m[1]));
|
|
819
|
+
return used;
|
|
820
|
+
}
|
|
821
|
+
function bareMarkerNumbers(text) {
|
|
822
|
+
const used = /* @__PURE__ */ new Set();
|
|
823
|
+
for (const m of text.matchAll(/\[(\d{1,3})\](?![:(])/g)) used.add(Number(m[1]));
|
|
824
|
+
return used;
|
|
825
|
+
}
|
|
826
|
+
function hasBareMarkers(text) {
|
|
827
|
+
return /\[(\d{1,3})\](?![:(])/.test(text);
|
|
828
|
+
}
|
|
829
|
+
function numberedSectionBase(text) {
|
|
830
|
+
const match = matchTrailingSourcesSection(text);
|
|
831
|
+
if (!match) return void 0;
|
|
832
|
+
const parsed = [];
|
|
833
|
+
const blocked = /* @__PURE__ */ new Set();
|
|
834
|
+
const pattern = /^\s*(\d{1,3})[.)][ \t]*(?:\[([^\]]*)\]\((https?:\/\/(?:[^()\s]|\([^()\s]*\))+)\)|(https?:\/\/(?:[^()\s]|\([^()\s]*\))+))/gm;
|
|
835
|
+
for (const m of match.section.matchAll(pattern)) {
|
|
836
|
+
const number = Number(m[1]);
|
|
837
|
+
const url = m[3] ?? m[4].replace(/[.,;:!]+$/, "");
|
|
838
|
+
parsed.push({ number, url, ...m[2] ? { title: m[2] } : {} });
|
|
839
|
+
}
|
|
840
|
+
const counts = /* @__PURE__ */ new Map();
|
|
841
|
+
for (const e of parsed) counts.set(e.number, (counts.get(e.number) ?? 0) + 1);
|
|
842
|
+
const usable = parsed.filter((e) => e.number >= 1 && counts.get(e.number) === 1);
|
|
843
|
+
for (const [number, count] of counts) {
|
|
844
|
+
if (number < 1 || count > 1) blocked.add(number);
|
|
845
|
+
}
|
|
846
|
+
return { usable, blocked };
|
|
847
|
+
}
|
|
848
|
+
function numberSources(text, merged, citations, citationOrder, cap) {
|
|
849
|
+
const sectionMatch = matchTrailingSourcesSection(text);
|
|
850
|
+
const answerText = sectionMatch ? text.slice(0, sectionMatch.start) : text;
|
|
851
|
+
const used = usedNumbers(answerText);
|
|
852
|
+
const order = citationOrder && citationOrder.length > 0 ? citationOrder : citations;
|
|
853
|
+
let base;
|
|
854
|
+
let blocked = /* @__PURE__ */ new Set();
|
|
855
|
+
let numberingIncomplete = false;
|
|
856
|
+
if (order.length > 0) {
|
|
857
|
+
base = order.map((c, i) => ({
|
|
858
|
+
number: i + 1,
|
|
859
|
+
url: c.url,
|
|
860
|
+
...c.title ? { title: c.title } : {}
|
|
861
|
+
}));
|
|
862
|
+
} else if (hasBareMarkers(answerText)) {
|
|
863
|
+
const section = numberedSectionBase(text);
|
|
864
|
+
if (section) {
|
|
865
|
+
base = [...section.usable].sort((a, b) => a.number - b.number);
|
|
866
|
+
blocked = section.blocked;
|
|
867
|
+
if (base.length === 0) {
|
|
868
|
+
return {
|
|
869
|
+
entries: numberPositional(merged.slice(0, cap)),
|
|
870
|
+
unmatchedMarkers: 0,
|
|
871
|
+
numberingIncomplete: true
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
numberingIncomplete = blocked.size > 0;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
if (!base) {
|
|
878
|
+
return {
|
|
879
|
+
entries: numberPositional(merged.slice(0, cap)),
|
|
880
|
+
unmatchedMarkers: 0,
|
|
881
|
+
numberingIncomplete: hasBareMarkers(answerText)
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
const proseTitle = /* @__PURE__ */ new Map();
|
|
885
|
+
for (const m of merged) if (!proseTitle.has(m.url)) proseTitle.set(m.url, m.title);
|
|
886
|
+
const titleFor = (url, baseTitle) => {
|
|
887
|
+
if (baseTitle && baseTitle.length > 0) return baseTitle;
|
|
888
|
+
return proseTitle.get(url) ?? url;
|
|
889
|
+
};
|
|
890
|
+
const baseUrls = new Set(base.map((e) => e.url));
|
|
891
|
+
const firstNumberForUrl = /* @__PURE__ */ new Map();
|
|
892
|
+
const entries = [];
|
|
893
|
+
for (const e of base) {
|
|
894
|
+
if (e.number > cap && !used.has(e.number)) continue;
|
|
895
|
+
const repeats = firstNumberForUrl.get(e.url);
|
|
896
|
+
if (repeats === void 0) firstNumberForUrl.set(e.url, e.number);
|
|
897
|
+
entries.push({
|
|
898
|
+
number: e.number,
|
|
899
|
+
url: e.url,
|
|
900
|
+
title: titleFor(e.url, e.title),
|
|
901
|
+
...repeats !== void 0 ? { repeats } : {}
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
const baseSize = base[base.length - 1].number;
|
|
905
|
+
let next = baseSize + 1;
|
|
906
|
+
for (const m of merged) {
|
|
907
|
+
if (entries.length >= cap) break;
|
|
908
|
+
if (baseUrls.has(m.url)) continue;
|
|
909
|
+
while (used.has(next) || blocked.has(next)) next++;
|
|
910
|
+
entries.push({
|
|
911
|
+
number: next++,
|
|
912
|
+
url: m.url,
|
|
913
|
+
// The merged label (including inferred-from-text derivations) is what
|
|
914
|
+
// the historical display showed; keep it before falling back to the URL.
|
|
915
|
+
title: m.title || titleFor(m.url),
|
|
916
|
+
...m.inferred ? { inferred: true, originalReference: m.originalReference } : {}
|
|
917
|
+
});
|
|
918
|
+
baseUrls.add(m.url);
|
|
919
|
+
}
|
|
920
|
+
const present = new Set(entries.map((e) => e.number));
|
|
921
|
+
const unmatchedMarkers = [...bareMarkerNumbers(answerText)].filter((n) => !present.has(n)).length;
|
|
922
|
+
return { entries, unmatchedMarkers, numberingIncomplete };
|
|
923
|
+
}
|
|
924
|
+
function numberPositional(sources) {
|
|
925
|
+
return sources.map((s, i) => ({ ...s, number: i + 1 }));
|
|
926
|
+
}
|
|
927
|
+
|
|
768
928
|
// src/core/provenance.ts
|
|
769
929
|
function evidenceExtractions(extractions) {
|
|
770
930
|
const evidence = extractions.filter(
|
|
@@ -1448,7 +1608,7 @@ async function search(params, context) {
|
|
|
1448
1608
|
const searchQuery = appendDomainFilter(params.query, params.domains);
|
|
1449
1609
|
const payloadPatch = buildSearchPayloadPatch(settings, searchConfig.provider, params.domains);
|
|
1450
1610
|
try {
|
|
1451
|
-
const { text: responseText, citations } = await models.complete({
|
|
1611
|
+
const { text: responseText, citations, citationOrder } = await models.complete({
|
|
1452
1612
|
model: searchConfig,
|
|
1453
1613
|
systemPrompt: SEARCH_SYSTEM_PROMPT,
|
|
1454
1614
|
userMessage: searchQuery,
|
|
@@ -1459,10 +1619,15 @@ async function search(params, context) {
|
|
|
1459
1619
|
reasoning: payloadPatch ? settings.searchWebSearch.reasoning ?? "low" : void 0
|
|
1460
1620
|
});
|
|
1461
1621
|
throwIfAborted(signal);
|
|
1462
|
-
const
|
|
1463
|
-
|
|
1622
|
+
const merged = mergeCitations(extractSourceUrls(responseText), { citations });
|
|
1623
|
+
const numbering = numberSources(
|
|
1624
|
+
responseText,
|
|
1625
|
+
merged,
|
|
1626
|
+
citations,
|
|
1627
|
+
citationOrder,
|
|
1464
1628
|
Math.max(1, settings.defaultUrls)
|
|
1465
1629
|
);
|
|
1630
|
+
const sources = numbering.entries;
|
|
1466
1631
|
const result = {
|
|
1467
1632
|
summary: stripTrailingSourcesSection(responseText),
|
|
1468
1633
|
sources,
|
|
@@ -1470,7 +1635,7 @@ async function search(params, context) {
|
|
|
1470
1635
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1471
1636
|
};
|
|
1472
1637
|
return {
|
|
1473
|
-
text: formatSearchResult(result),
|
|
1638
|
+
text: formatSearchResult(result, numbering.unmatchedMarkers, numbering.numberingIncomplete),
|
|
1474
1639
|
outcome: "completed",
|
|
1475
1640
|
details: { sources, query: params.query }
|
|
1476
1641
|
};
|
|
@@ -1479,7 +1644,7 @@ async function search(params, context) {
|
|
|
1479
1644
|
throw new Error(`Search failed: ${err?.message ?? String(err)}`);
|
|
1480
1645
|
}
|
|
1481
1646
|
}
|
|
1482
|
-
function formatSearchResult(result) {
|
|
1647
|
+
function formatSearchResult(result, unmatchedMarkers = 0, numberingIncomplete = false) {
|
|
1483
1648
|
let output = `## Search results for: "${result.query}"
|
|
1484
1649
|
|
|
1485
1650
|
`;
|
|
@@ -1487,11 +1652,21 @@ function formatSearchResult(result) {
|
|
|
1487
1652
|
output += `### Sources (${result.sources.length})
|
|
1488
1653
|
|
|
1489
1654
|
`;
|
|
1490
|
-
for (const
|
|
1655
|
+
for (const source of result.sources) {
|
|
1491
1656
|
const inferred = source.inferred ? ` (inferred from text, not a citation${source.originalReference ? `; original token: ${source.originalReference}` : ""})` : "";
|
|
1492
|
-
|
|
1657
|
+
const repeats = source.repeats !== void 0 ? ` (same source as entry ${source.repeats})` : "";
|
|
1658
|
+
const label = source.title ? safeLinkLabel(source.title, source.url) : source.url;
|
|
1659
|
+
output += `${source.number}. [${label}](${source.url})${repeats}${inferred}
|
|
1493
1660
|
`;
|
|
1494
1661
|
}
|
|
1662
|
+
if (unmatchedMarkers > 0) {
|
|
1663
|
+
output += `
|
|
1664
|
+
> Note: ${unmatchedMarkers} cited number${unmatchedMarkers === 1 ? "" : "s"} in the answer ${unmatchedMarkers === 1 ? "has" : "have"} no entry in the list above.
|
|
1665
|
+
`;
|
|
1666
|
+
}
|
|
1667
|
+
if (numberingIncomplete) {
|
|
1668
|
+
output += "\n> Note: the answer's citation markers could not be matched to numbered sources, so they may not match the list.\n";
|
|
1669
|
+
}
|
|
1495
1670
|
return output;
|
|
1496
1671
|
}
|
|
1497
1672
|
|
|
@@ -4964,10 +5139,12 @@ function createOpenRouterClient(config, options) {
|
|
|
4964
5139
|
}
|
|
4965
5140
|
if (typeof content !== "string")
|
|
4966
5141
|
throw new Error("OpenRouter returned no text completion");
|
|
5142
|
+
const citationOccurrences = request.collectCitations ? parseCitations(raw) : [];
|
|
4967
5143
|
return {
|
|
4968
5144
|
value: {
|
|
4969
5145
|
text: content,
|
|
4970
|
-
citations:
|
|
5146
|
+
citations: dedupeCitations(citationOccurrences),
|
|
5147
|
+
...citationOccurrences.length > 0 ? { citationOrder: citationOccurrences } : {},
|
|
4971
5148
|
usage: usage(data.usage),
|
|
4972
5149
|
...typeof choice.finish_reason === "string" ? {
|
|
4973
5150
|
finishReason: choice.finish_reason === "length" || choice.finish_reason === "stop" ? choice.finish_reason : "other"
|
|
@@ -426,7 +426,7 @@ function defaultDocument(credential) {
|
|
|
426
426
|
}
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function defaultHostConfig(_host, workspace, paths) {
|
|
430
430
|
return parseConfig(defaultDocument(paths.credential), workspace);
|
|
431
431
|
}
|
|
432
432
|
function credentialText(source) {
|
|
@@ -547,7 +547,7 @@ export {
|
|
|
547
547
|
loadConfig,
|
|
548
548
|
StandaloneError,
|
|
549
549
|
hostPaths,
|
|
550
|
-
|
|
550
|
+
defaultHostConfig,
|
|
551
551
|
resolveCredential,
|
|
552
552
|
setupHost
|
|
553
553
|
};
|
package/dist/cli.js
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "./chunk-ZTHYRKI2.js";
|
|
5
5
|
import {
|
|
6
6
|
ConfigurationError,
|
|
7
|
-
|
|
7
|
+
defaultHostConfig,
|
|
8
8
|
hostPaths,
|
|
9
9
|
identity,
|
|
10
10
|
loadConfig,
|
|
11
11
|
resolveWorkspace,
|
|
12
12
|
setupHost
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GNQNWFYE.js";
|
|
14
14
|
|
|
15
15
|
// packages/mcp/src/cli.ts
|
|
16
16
|
import { parseArgs } from "node:util";
|
|
@@ -31,16 +31,17 @@ function cliOptions(argv, env = process.env) {
|
|
|
31
31
|
"check-config": { type: "boolean" }
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
if (values.host !== void 0 && values.host !== "codex")
|
|
34
|
+
if (values.host !== void 0 && values.host !== "codex" && values.host !== "dsh")
|
|
35
35
|
throw new Error("Unsupported host");
|
|
36
36
|
if (positionals.length > 1 || positionals.length === 1 && positionals[0] !== "setup")
|
|
37
37
|
throw new Error("Unsupported command");
|
|
38
38
|
const setup = positionals[0] === "setup";
|
|
39
|
+
const host = values.host === "codex" || values.host === "dsh";
|
|
39
40
|
return {
|
|
40
41
|
...values,
|
|
41
42
|
setup,
|
|
42
|
-
config: values.config ?? (setup ||
|
|
43
|
-
workspace: values.workspace ?? (setup ||
|
|
43
|
+
config: values.config ?? (setup || host ? void 0 : env.INTELLI_SEARCH_CONFIG),
|
|
44
|
+
workspace: values.workspace ?? (setup || host ? void 0 : env.INTELLI_SEARCH_WORKSPACE)
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
async function credentialInput() {
|
|
@@ -70,13 +71,15 @@ async function main() {
|
|
|
70
71
|
process.stdout.write(
|
|
71
72
|
`Usage: mcp-intelli-search setup
|
|
72
73
|
mcp-intelli-search --host codex [--config FILE] [--workspace ABSOLUTE_DIRECTORY]
|
|
74
|
+
mcp-intelli-search --host dsh [--config FILE] [--workspace ABSOLUTE_DIRECTORY]
|
|
73
75
|
mcp-intelli-search --config FILE --workspace ABSOLUTE_DIRECTORY
|
|
74
76
|
|
|
75
77
|
Commands:
|
|
76
78
|
setup Store an OpenRouter key read from standard input and create or connect per-user configuration; accepts no path selections
|
|
77
79
|
|
|
78
80
|
Options:
|
|
79
|
-
--host codex
|
|
81
|
+
--host codex Use the Codex working root and per-user defaults
|
|
82
|
+
--host dsh Use the DeepSeek Harness working directory and per-user defaults
|
|
80
83
|
--config FILE Explicit generic configuration (or INTELLI_SEARCH_CONFIG)
|
|
81
84
|
--workspace DIR Existing absolute generic workspace (or INTELLI_SEARCH_WORKSPACE)
|
|
82
85
|
--check-config Validate configuration without inference or serving
|
|
@@ -84,7 +87,7 @@ Options:
|
|
|
84
87
|
--version Show package version
|
|
85
88
|
|
|
86
89
|
Generic MCP serving requires explicit configuration and workspace paths.
|
|
87
|
-
Codex
|
|
90
|
+
Codex and DeepSeek Harness modes supply both from their launchers and work without path exports.
|
|
88
91
|
Standard output carries protocol messages only while serving.
|
|
89
92
|
`
|
|
90
93
|
);
|
|
@@ -116,36 +119,38 @@ Restart after changing loaded configuration.
|
|
|
116
119
|
);
|
|
117
120
|
return;
|
|
118
121
|
}
|
|
119
|
-
const
|
|
122
|
+
const host = args.host === "codex" || args.host === "dsh" ? args.host : void 0;
|
|
123
|
+
const paths = host ? hostPaths() : void 0;
|
|
120
124
|
const file = args.config ?? paths?.config;
|
|
121
|
-
const workspace = args.workspace ?? (
|
|
125
|
+
const workspace = args.workspace ?? (host ? process.cwd() : void 0);
|
|
122
126
|
if (!file || !workspace)
|
|
123
127
|
throw new Error(
|
|
124
128
|
"Explicit --config and --workspace are required (or their INTELLI_SEARCH_* environment equivalents)"
|
|
125
129
|
);
|
|
126
130
|
const canonicalWorkspace = await resolveWorkspace(workspace);
|
|
127
131
|
let workspaceDefect;
|
|
128
|
-
if (
|
|
132
|
+
if (host && !args.workspace) {
|
|
129
133
|
const home = await realpath(homedir()).catch(() => homedir());
|
|
130
134
|
if (canonicalWorkspace === parsePath(canonicalWorkspace).root || canonicalWorkspace === home)
|
|
131
|
-
workspaceDefect = "Codex working root must be a project directory, not the home or filesystem root; restart Codex from the project or with --cd <project>";
|
|
135
|
+
workspaceDefect = host === "codex" ? "Codex working root must be a project directory, not the home or filesystem root; restart Codex from the project or with --cd <project>" : "DeepSeek Harness working directory must be a project directory, not the home or filesystem root; start the harness from the project or set cwd on the bridge row";
|
|
132
136
|
}
|
|
133
137
|
if (args["check-config"]) {
|
|
134
138
|
if (workspaceDefect) throw new Error(workspaceDefect);
|
|
135
139
|
let builtInDefaults = false;
|
|
136
|
-
if (paths && !args.config) {
|
|
140
|
+
if (host && paths && !args.config) {
|
|
137
141
|
try {
|
|
138
142
|
await loadConfig(file, workspace);
|
|
139
143
|
} catch (error) {
|
|
140
144
|
if (!(error instanceof ConfigurationError) || error.reason !== "missing") throw error;
|
|
141
|
-
await
|
|
145
|
+
await defaultHostConfig(host, workspace, paths);
|
|
142
146
|
builtInDefaults = true;
|
|
143
147
|
}
|
|
144
148
|
} else {
|
|
145
149
|
await loadConfig(file, workspace);
|
|
146
150
|
}
|
|
147
151
|
process.stdout.write(
|
|
148
|
-
builtInDefaults ?
|
|
152
|
+
builtInDefaults ? `Configuration is valid (built-in ${host === "codex" ? "Codex" : "DeepSeek Harness"} defaults; no per-user file found).
|
|
153
|
+
` : "Configuration is valid.\n"
|
|
149
154
|
);
|
|
150
155
|
return;
|
|
151
156
|
}
|
|
@@ -162,8 +167,8 @@ Restart after changing loaded configuration.
|
|
|
162
167
|
config = await loadSelected();
|
|
163
168
|
} catch (error) {
|
|
164
169
|
if (!(error instanceof ConfigurationError)) throw error;
|
|
165
|
-
if (paths && !args.config && error.reason === "missing") {
|
|
166
|
-
config = await
|
|
170
|
+
if (host && paths && !args.config && error.reason === "missing") {
|
|
171
|
+
config = await defaultHostConfig(host, workspace, paths);
|
|
167
172
|
} else {
|
|
168
173
|
process.stderr.write(
|
|
169
174
|
`[mcp-intelli-search] ${error.message}. Serving anyway: each tool call reports this and rereads the file until it loads
|
package/dist/runtime.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-67MPZQF2.js";
|
|
4
4
|
import {
|
|
5
5
|
ConfigurationError,
|
|
6
6
|
StandaloneError,
|
|
7
7
|
identity,
|
|
8
8
|
loadConfig,
|
|
9
9
|
parseConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GNQNWFYE.js";
|
|
11
11
|
export {
|
|
12
12
|
ConfigurationError,
|
|
13
13
|
StandaloneError,
|
package/dist/server.js
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
extractSchema,
|
|
8
8
|
researchSchema,
|
|
9
9
|
searchSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-67MPZQF2.js";
|
|
11
11
|
import {
|
|
12
12
|
ConfigurationError,
|
|
13
13
|
StandaloneError,
|
|
14
14
|
identity
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GNQNWFYE.js";
|
|
16
16
|
|
|
17
17
|
// packages/mcp/src/server.ts
|
|
18
18
|
import { McpServer, fromJsonSchema } from "@modelcontextprotocol/server";
|
package/package.json
CHANGED