@aletheia-works/vivarium-mcp 0.1.0 → 0.1.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/README.md +11 -55
- package/dist/bundled/recipes.json +18 -0
- package/dist/catalogue.d.ts.map +1 -1
- package/dist/catalogue.js +4 -14
- package/dist/catalogue.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +25 -27
- package/dist/server.js.map +1 -1
- package/dist/tools/match_error.d.ts +1 -1
- package/dist/tools/match_error.d.ts.map +1 -1
- package/dist/tools/match_error.js +13 -48
- package/dist/tools/match_error.js.map +1 -1
- package/dist/tools/prepare_fix_candidate.d.ts +80 -0
- package/dist/tools/prepare_fix_candidate.d.ts.map +1 -0
- package/dist/tools/prepare_fix_candidate.js +195 -0
- package/dist/tools/prepare_fix_candidate.js.map +1 -0
- package/dist/tools/prepare_new_recipe.d.ts +4 -2
- package/dist/tools/prepare_new_recipe.d.ts.map +1 -1
- package/dist/tools/prepare_new_recipe.js +30 -26
- package/dist/tools/prepare_new_recipe.js.map +1 -1
- package/dist/tools/search_upstream_issues.d.ts +100 -0
- package/dist/tools/search_upstream_issues.d.ts.map +1 -0
- package/dist/tools/search_upstream_issues.js +239 -0
- package/dist/tools/search_upstream_issues.js.map +1 -0
- package/dist/tools/verify_and_report_fix.d.ts +63 -0
- package/dist/tools/verify_and_report_fix.d.ts.map +1 -0
- package/dist/tools/verify_and_report_fix.js +216 -0
- package/dist/tools/verify_and_report_fix.js.map +1 -0
- package/dist/tools/verify_branch_fix.d.ts.map +1 -1
- package/dist/tools/verify_branch_fix.js +9 -25
- package/dist/tools/verify_branch_fix.js.map +1 -1
- package/dist/types.d.ts +30 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -9
- package/dist/types.js.map +1 -1
- package/package.json +6 -5
- package/src/bundled/recipes.json +18 -0
package/README.md
CHANGED
|
@@ -19,49 +19,18 @@ deployed verdict snapshots, without scraping the docs site.
|
|
|
19
19
|
| `list_recipes(layer?, project?, q?)` | Filtered list of catalogue entries. | All layers (1, 2, 3). |
|
|
20
20
|
| `get_recipe(slug)` | Full metadata for one recipe (title, project, issue, page URL, verdict snapshot URL, GitHub source URL). | All layers. |
|
|
21
21
|
| `lookup_verdict(slug)` | Layer 1 → `kind: "live"` + page URL (verdicts run in the browser). Layer 2/3 → `kind: "snapshot"` with the deployed `verdict.json` contents (verdict, exit code, image digest, stdout, stderr tail). | All layers (Layer 1 returns a stub). |
|
|
22
|
-
| `match_error(text, limit?)` | Mechanical token-overlap ranking of recipes against a pasted error message or stack trace. Synonym table + bounded fuzzy match + multi-language stopwords
|
|
22
|
+
| `match_error(text, limit?)` | Mechanical token-overlap ranking of recipes against a pasted error message or stack trace. Synonym table + bounded fuzzy match + multi-language stopwords. | All layers. |
|
|
23
23
|
| `verify_branch_fix(slug, fix_url? \| fix_source?)` | Scaffolding helper for the AI-slop verification loop. Layer 1 → Path A: a recipe-page `compare_url` with the fix pre-loaded. Layer 2/3 → Path B: a `/repro/compare` deep-link plus the `gh workflow run branch-fix-verdict.yml` command. NOT an execution engine — actual reproduction runs in the visitor's browser (Path A) or in GitHub Actions (Path B). | All layers. |
|
|
24
|
-
| `prepare_new_recipe(project, issue, title, base_image?, repo_owner?, layer?)` | Scaffolding helper that bundles every artefact an agent needs to author a new recipe: validated slug, the exact `mise run recipes:new` and `mise run recipes:verify` commands, placeholder rows for `docs/
|
|
24
|
+
| `prepare_new_recipe(project, issue, title, base_image?, repo_owner?, layer?)` | Scaffolding helper that bundles every artefact an agent needs to author a new recipe: validated slug, the exact `mise run recipes:new` and `mise run recipes:verify` commands, placeholder rows for `docs/site/_data/recipe-facets.json` and (if the project is new) `docs/site/_data/projects.json`, a commit-subject template, and a sequenced next-steps checklist. NOT an execution engine — the agent's shell tool runs the returned commands. | Layer 2 has the canonical scaffolder; Layer 1/3 fall back to copying from an existing recipe. |
|
|
25
|
+
| `prepare_fix_candidate(slug, fork_url, branch, upstream_pr?, package?, purpose?)` | Scaffolding helper that registers a fix-candidate spec on an existing Layer 1 recipe so the page runs the fork branch's wheel side-by-side with the released build (per ADR-0040). Returns the `fix-candidate.json` content, the recommended commit subject + PR title, a ready-to-paste PR body (with AI-authorship disclosure tucked inside a `<details>` block), and the exact `gh` / `git` commands to fork-and-clone aletheia-works/vivarium, branch off main, drop the spec in, commit, push, and open the cross-repo PR. NOT an execution engine — the agent's shell tool runs the returned commands. | Layer 1 only (Layers 2/3 use `verify_branch_fix`). |
|
|
25
26
|
|
|
26
27
|
## Install
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
> use the local-clone path. The
|
|
32
|
-
> [`publish-mcp.yml`](https://github.com/aletheia-works/vivarium/blob/main/.github/workflows/publish-mcp.yml)
|
|
33
|
-
> workflow handles dual JSR + npm release on tag push; the snippets
|
|
34
|
-
> in the next two subsections will work once that runs for the first
|
|
35
|
-
> time.
|
|
29
|
+
The exact MCP-config file location varies by client (Claude Code:
|
|
30
|
+
`~/.claude/mcp.json`; Cline: its VS Code settings; Cursor:
|
|
31
|
+
`~/.cursor/mcp.json`).
|
|
36
32
|
|
|
37
|
-
###
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
git clone https://github.com/aletheia-works/vivarium.git
|
|
41
|
-
cd vivarium/packages/mcp-server
|
|
42
|
-
bun install
|
|
43
|
-
bun run build
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Then point your MCP client at the built entry point:
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"mcpServers": {
|
|
51
|
-
"vivarium": {
|
|
52
|
-
"command": "node",
|
|
53
|
-
"args": ["/absolute/path/to/vivarium/packages/mcp-server/dist/index.js"]
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### npm (post-publish; default for `npx`-based MCP launchers)
|
|
60
|
-
|
|
61
|
-
Once the server has been published, the configuration becomes a
|
|
62
|
-
single-line `npx` invocation. The exact MCP-config file location
|
|
63
|
-
varies by client (Claude Code: `~/.claude/mcp.json`; Cline: its VS
|
|
64
|
-
Code settings; Cursor: `~/.cursor/mcp.json`). Snippet:
|
|
33
|
+
### npm (default for `npx`-based MCP launchers)
|
|
65
34
|
|
|
66
35
|
```json
|
|
67
36
|
{
|
|
@@ -74,9 +43,7 @@ Code settings; Cursor: `~/.cursor/mcp.json`). Snippet:
|
|
|
74
43
|
}
|
|
75
44
|
```
|
|
76
45
|
|
|
77
|
-
### JSR (
|
|
78
|
-
|
|
79
|
-
For clients with native JSR support (Bun ≥ 1.1, Deno):
|
|
46
|
+
### JSR (Bun / Deno native install)
|
|
80
47
|
|
|
81
48
|
```bash
|
|
82
49
|
bunx jsr:@aletheia-works/vivarium-mcp
|
|
@@ -84,17 +51,6 @@ bunx jsr:@aletheia-works/vivarium-mcp
|
|
|
84
51
|
deno run --allow-net --allow-read jsr:@aletheia-works/vivarium-mcp
|
|
85
52
|
```
|
|
86
53
|
|
|
87
|
-
## Why dual-channel distribution
|
|
88
|
-
|
|
89
|
-
Per [ADR-0019](https://github.com/aletheia-works/vivarium) (private
|
|
90
|
-
memo), this package publishes to both registries with **JSR canonical
|
|
91
|
-
and npm fallback**. JSR contributes structural supply-chain defences
|
|
92
|
-
(no postinstall scripts, OIDC-only publish via Sigstore provenance,
|
|
93
|
-
GitHub-org-bound scope ownership, source-only publish); npm carries
|
|
94
|
-
the `npx` ergonomics most MCP launchers expect today. Both registries
|
|
95
|
-
ship with build provenance — verifiable via the public Sigstore Rekor
|
|
96
|
-
transparency log.
|
|
97
|
-
|
|
98
54
|
## Configuration
|
|
99
55
|
|
|
100
56
|
The server reads no environment variables and accepts no command-line
|
|
@@ -105,9 +61,9 @@ when the network is unavailable.
|
|
|
105
61
|
|
|
106
62
|
## Versioning
|
|
107
63
|
|
|
108
|
-
The MCP server's surface (the
|
|
109
|
-
schemas) is locked at v1
|
|
110
|
-
|
|
64
|
+
The MCP server's tool surface (the tools listed above and their input
|
|
65
|
+
schemas) is locked at v1. Optional additive changes ship as minor
|
|
66
|
+
revisions; breaking changes require a v2 release.
|
|
111
67
|
|
|
112
68
|
The recipes index format consumed by this server is locked separately
|
|
113
69
|
at `index = "v1"` — see
|
|
@@ -20,6 +20,24 @@
|
|
|
20
20
|
"symptom": "fk-pragma-silently-dropped",
|
|
21
21
|
"severity": "spec-violation"
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
"slug": "mpmath-983",
|
|
25
|
+
"layer": 1,
|
|
26
|
+
"project": "mpmath",
|
|
27
|
+
"issue": 983,
|
|
28
|
+
"title": "mpmath/mpmath#983",
|
|
29
|
+
"page_url": "https://aletheia-works.github.io/vivarium/repro/mpmath/983/",
|
|
30
|
+
"source_url": "https://github.com/aletheia-works/vivarium/tree/main/src/layer1_wasm/mpmath-983",
|
|
31
|
+
"language": "python",
|
|
32
|
+
"tags": [
|
|
33
|
+
"numerical-linear-algebra",
|
|
34
|
+
"qr-solve",
|
|
35
|
+
"householder",
|
|
36
|
+
"arbitrary-precision"
|
|
37
|
+
],
|
|
38
|
+
"symptom": "solver-asymmetry-on-nonsingular-matrix",
|
|
39
|
+
"severity": "bug"
|
|
40
|
+
},
|
|
23
41
|
{
|
|
24
42
|
"slug": "numpy-28287",
|
|
25
43
|
"layer": 1,
|
package/dist/catalogue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../src/catalogue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../src/catalogue.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGhE,eAAO,MAAM,SAAS,+DACwC,CAAC;AAW/D,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,CAsB1D;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAYjC"}
|
package/dist/catalogue.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
// Catalogue fetcher
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// 1. Runtime fetch from the canonical Pages endpoint with a TTL cache
|
|
6
|
-
// so the agent always sees a catalogue recent enough to reflect a
|
|
7
|
-
// same-day recipe addition.
|
|
8
|
-
// 2. Bundled snapshot fallback for offline use, network failure, or
|
|
9
|
-
// cold start before the first successful fetch.
|
|
10
|
-
//
|
|
11
|
-
// The bundled snapshot is shipped in src/bundled/recipes.json — it is
|
|
12
|
-
// refreshed at publish time by the GHA workflow that copies the latest
|
|
13
|
-
// docs/public/api/recipes.json into the package before publish.
|
|
1
|
+
// Catalogue fetcher: 5-minute in-process TTL with a build-time bundled
|
|
2
|
+
// fallback for offline / network-failure / cold-start. The bundled
|
|
3
|
+
// snapshot is refreshed at publish time by the GHA workflow that
|
|
4
|
+
// copies docs/site/public/api/recipes.json into src/bundled/.
|
|
14
5
|
import bundledIndex from './bundled/recipes.json' with { type: 'json' };
|
|
15
6
|
export const INDEX_URL = 'https://aletheia-works.github.io/vivarium/api/recipes.json';
|
|
16
7
|
const TTL_MS = 5 * 60 * 1000;
|
|
17
8
|
let cache = null;
|
|
18
|
-
// Reset cache; only used by tests.
|
|
19
9
|
export function _resetCacheForTesting() {
|
|
20
10
|
cache = null;
|
|
21
11
|
}
|
package/dist/catalogue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogue.js","sourceRoot":"","sources":["../src/catalogue.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"catalogue.js","sourceRoot":"","sources":["../src/catalogue.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AAC3B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,UAAkB;IAElB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE;YAClC,OAAO,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE;SAC1C,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QACzB,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAoB,CAAC;QACnD,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AA0DnE,wBAAgB,YAAY,IAAI,MAAM,CAkGrC;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAI/C"}
|
package/dist/server.js
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
// MCP server wiring — registers the v1 tools and connects a stdio
|
|
2
|
-
// transport.
|
|
3
|
-
//
|
|
4
|
-
// Tool surface:
|
|
5
|
-
// list_recipes / get_recipe / lookup_verdict — ADR-0019 §3 (X.1, v0.1).
|
|
6
|
-
// match_error — Phase 6 X.2, mirrors the
|
|
7
|
-
// docs S.2 matcher
|
|
8
|
-
// (ADR-0025 §Neutral).
|
|
9
|
-
// verify_branch_fix — Phase 7 B3, deep-link
|
|
10
|
-
// helper for the AI-slop
|
|
11
|
-
// verification loop
|
|
12
|
-
// (ADR-0030).
|
|
13
|
-
// prepare_new_recipe — Tier 2, returns the full
|
|
14
|
-
// authoring command bundle
|
|
15
|
-
// (scaffold + verify +
|
|
16
|
-
// facets/projects rows)
|
|
17
|
-
// for a new upstream
|
|
18
|
-
// issue.
|
|
19
|
-
//
|
|
20
|
-
// See ADR-0019 §1 for the stdio-transport choice.
|
|
2
|
+
// transport. The tool surface is documented in README.md; each tool
|
|
3
|
+
// module owns its own description literal.
|
|
21
4
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
22
5
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
23
6
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -25,17 +8,20 @@ import { GET_RECIPE_TOOL, getRecipe } from './tools/get_recipe.js';
|
|
|
25
8
|
import { LIST_RECIPES_TOOL, listRecipes, } from './tools/list_recipes.js';
|
|
26
9
|
import { LOOKUP_VERDICT_TOOL, lookupVerdict, } from './tools/lookup_verdict.js';
|
|
27
10
|
import { MATCH_ERROR_TOOL, matchError, } from './tools/match_error.js';
|
|
11
|
+
import { PREPARE_FIX_CANDIDATE_TOOL, prepareFixCandidate, } from './tools/prepare_fix_candidate.js';
|
|
28
12
|
import { PREPARE_NEW_RECIPE_TOOL, prepareNewRecipe, } from './tools/prepare_new_recipe.js';
|
|
13
|
+
import { SEARCH_UPSTREAM_ISSUES_TOOL, searchUpstreamIssues, } from './tools/search_upstream_issues.js';
|
|
14
|
+
import { VERIFY_AND_REPORT_FIX_TOOL, verifyAndReportFix, } from './tools/verify_and_report_fix.js';
|
|
29
15
|
import { VERIFY_BRANCH_FIX_TOOL, verifyBranchFix, } from './tools/verify_branch_fix.js';
|
|
30
16
|
const SERVER_NAME = 'vivarium-mcp';
|
|
31
|
-
// Keep in sync with package.json + jsr.json.
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
const SERVER_VERSION = '0.1.
|
|
17
|
+
// Keep in sync with package.json + jsr.json. The MCP `initialize`
|
|
18
|
+
// handshake exposes this string to clients, so unsynced values across
|
|
19
|
+
// these three files produce a confusing client experience. Bump the
|
|
20
|
+
// patch component for additive changes within v0.x (additional tools,
|
|
21
|
+
// description / surface refinements) — the project is still pre-1.0
|
|
22
|
+
// and `prepare_fix_candidate` is meaningful but fully opt-in, so a minor
|
|
23
|
+
// bump would overstate the impact.
|
|
24
|
+
const SERVER_VERSION = '0.1.4';
|
|
39
25
|
export function createServer() {
|
|
40
26
|
const server = new Server({ name: SERVER_NAME, version: SERVER_VERSION }, { capabilities: { tools: {} } });
|
|
41
27
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
@@ -44,8 +30,11 @@ export function createServer() {
|
|
|
44
30
|
GET_RECIPE_TOOL,
|
|
45
31
|
LOOKUP_VERDICT_TOOL,
|
|
46
32
|
MATCH_ERROR_TOOL,
|
|
33
|
+
SEARCH_UPSTREAM_ISSUES_TOOL,
|
|
47
34
|
VERIFY_BRANCH_FIX_TOOL,
|
|
35
|
+
VERIFY_AND_REPORT_FIX_TOOL,
|
|
48
36
|
PREPARE_NEW_RECIPE_TOOL,
|
|
37
|
+
PREPARE_FIX_CANDIDATE_TOOL,
|
|
49
38
|
],
|
|
50
39
|
}));
|
|
51
40
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
@@ -66,12 +55,21 @@ export function createServer() {
|
|
|
66
55
|
case 'match_error':
|
|
67
56
|
payload = await matchError(args);
|
|
68
57
|
break;
|
|
58
|
+
case 'search_upstream_issues':
|
|
59
|
+
payload = await searchUpstreamIssues(args);
|
|
60
|
+
break;
|
|
69
61
|
case 'verify_branch_fix':
|
|
70
62
|
payload = await verifyBranchFix(args);
|
|
71
63
|
break;
|
|
64
|
+
case 'verify_and_report_fix':
|
|
65
|
+
payload = await verifyAndReportFix(args);
|
|
66
|
+
break;
|
|
72
67
|
case 'prepare_new_recipe':
|
|
73
68
|
payload = await prepareNewRecipe(args);
|
|
74
69
|
break;
|
|
70
|
+
case 'prepare_fix_candidate':
|
|
71
|
+
payload = await prepareFixCandidate(args);
|
|
72
|
+
break;
|
|
75
73
|
default:
|
|
76
74
|
return {
|
|
77
75
|
isError: true,
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,oEAAoE;AACpE,2CAA2C;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACL,iBAAiB,EACjB,WAAW,GAEZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EACnB,aAAa,GACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,UAAU,GAEX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,GAEpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,gBAAgB,GAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,GAErB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,sBAAsB,EACtB,eAAe,GAEhB,MAAM,8BAA8B,CAAC;AAE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C7B,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -39,7 +39,7 @@ export declare function matchError(args: MatchErrorArgs): Promise<MatchErrorResu
|
|
|
39
39
|
}>;
|
|
40
40
|
export declare const MATCH_ERROR_TOOL: {
|
|
41
41
|
readonly name: "match_error";
|
|
42
|
-
readonly description: "Find Vivarium recipes that match a pasted error message or stack trace by mechanical token overlap (no LLM). The text is tokenised, lowercase-compared against each recipe's symptom (weight 5 per segment), tags (3), project (2), and slug (2).
|
|
42
|
+
readonly description: "Find Vivarium recipes that match a pasted error message or stack trace by mechanical token overlap (no LLM). The text is tokenised, lowercase-compared against each recipe's symptom (weight 5 per segment), tags (3), project (2), and slug (2). Matching includes adjacent-pair tokens (so 'data type' can hit `dtype`), a small synonym table (e.g. dtype⇄datatype, segfault⇄sigsegv), and bounded Levenshtein-1 fuzzy matching for tokens of length >= 6. Stopword set covers English, Japanese, German, Spanish, French, Chinese, and Korean noise tokens. Recipes with score > 0 are returned in descending score order; ties broken by (layer asc, slug asc). Each matched token reports its `via` (`synonym` or `fuzzy` when non-exact) and the original `input` that triggered it, so agents can render the provenance. Pair with `get_recipe` to drill into a specific result, or `list_recipes` for unfiltered browsing.";
|
|
43
43
|
readonly inputSchema: {
|
|
44
44
|
readonly type: "object";
|
|
45
45
|
readonly properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match_error.d.ts","sourceRoot":"","sources":["../../src/tools/match_error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"match_error.d.ts","sourceRoot":"","sources":["../../src/tools/match_error.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IAChD,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,IAAI,CAAC;IACT,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAoND,wBAAsB,UAAU,CAC9B,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,gBAAgB,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA8B1D;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;CAuBnB,CAAC"}
|
|
@@ -1,43 +1,18 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Server-side mirror of the docs-site error → recipe matcher.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// Phase 7 A5 (ADR-0028) extends v1 with three accuracy improvements,
|
|
12
|
-
// none of which change the weights above:
|
|
13
|
-
// 1. Adjacent-pair token expansion — "data type" also tries `datatype`,
|
|
14
|
-
// so multi-word user input can hit single-word catalogue terms.
|
|
15
|
-
// 2. Synonym groups — variants of the same concept (e.g. `dtype` ⇄
|
|
16
|
-
// `datatype`) all expand to the whole group.
|
|
17
|
-
// 3. Bounded fuzzy match — tokens of length ≥ 6 within Levenshtein
|
|
18
|
-
// distance 1 score the same as exact, so "missmatch" still hits
|
|
19
|
-
// `mismatch`.
|
|
20
|
-
// 4. Multi-language stopwords — German, Spanish, French, Chinese,
|
|
21
|
-
// Korean noise tokens drop alongside the existing English+Japanese.
|
|
22
|
-
//
|
|
23
|
-
// **CRITICAL: keep in sync with `docs/components/ErrorRecipeMatcher.tsx`.**
|
|
24
|
-
// ADR-0025 §Neutral made the docs surface the canonical implementation;
|
|
25
|
-
// X.2 lifted it server-side bit-identical, and A5 keeps both copies
|
|
26
|
-
// updated atomically. Diverging the scoring between MCP and the docs
|
|
27
|
-
// matcher would surface as agent-vs-UI disagreement on identical input.
|
|
28
|
-
//
|
|
29
|
-
// The matcher remains mechanical — no LLM, no semantic embeddings.
|
|
30
|
-
// AGENTS.md §3.3's mechanical-over-judgement rule carries through.
|
|
3
|
+
// **Keep bit-identical with `docs/site/_components/ErrorRecipeMatcher.tsx`.**
|
|
4
|
+
// Diverging scoring between MCP and the docs matcher would surface as
|
|
5
|
+
// agent-vs-UI disagreement on identical input. The scoring is
|
|
6
|
+
// mechanical (no LLM / embeddings):
|
|
7
|
+
// symptom +5, tags +3, project/slug +2; ties → (layer asc, slug asc).
|
|
8
|
+
// On top of exact match the matcher does adjacent-pair token
|
|
9
|
+
// expansion, synonym-group lookup, and bounded (len≥6, distance≤1)
|
|
10
|
+
// fuzzy match.
|
|
31
11
|
import { getCatalogue } from '../catalogue.js';
|
|
32
12
|
const MAX_INPUT_BYTES = 16 * 1024;
|
|
33
13
|
const DEFAULT_LIMIT = 10;
|
|
34
14
|
const MAX_LIMIT = 50;
|
|
35
|
-
//
|
|
36
|
-
// lexical coverage of any single language — it's dropping the
|
|
37
|
-
// frequent noise tokens that would never sit in a recipe overlay.
|
|
38
|
-
// Anything that sneaks through scores 0 against the catalogue
|
|
39
|
-
// anyway; the worst case is wasted comparison cycles, not wrong
|
|
40
|
-
// matches.
|
|
15
|
+
// Drop frequent noise tokens; anything unknown still scores 0 against the catalogue.
|
|
41
16
|
const STOPWORDS = new Set([
|
|
42
17
|
// English
|
|
43
18
|
'the', 'and', 'for', 'with', 'from', 'that', 'this', 'have',
|
|
@@ -61,14 +36,7 @@ const STOPWORDS = new Set([
|
|
|
61
36
|
// Korean (common particles + error words)
|
|
62
37
|
'오류', '예외', '실패', '스택',
|
|
63
38
|
]);
|
|
64
|
-
//
|
|
65
|
-
// user's input expands the input set to include all members.
|
|
66
|
-
// Variants are stored hyphen-stripped (lowercase, alphanumeric)
|
|
67
|
-
// to match the kebab-segmented catalogue tokens.
|
|
68
|
-
//
|
|
69
|
-
// Conservative on purpose — false-positive pressure rises with
|
|
70
|
-
// table size. Add a group only when there's an unambiguous mapping
|
|
71
|
-
// between a user-input shape and a catalogue overlay token.
|
|
39
|
+
// Variants are stored hyphen-stripped to match the kebab-segmented catalogue tokens.
|
|
72
40
|
const SYNONYM_GROUPS = [
|
|
73
41
|
['dtype', 'datatype'],
|
|
74
42
|
['nullptr', 'nullpointer', 'nilptr', 'nullpointerexception'],
|
|
@@ -90,10 +58,7 @@ const SYNONYM_MAP = (() => {
|
|
|
90
58
|
}
|
|
91
59
|
return m;
|
|
92
60
|
})();
|
|
93
|
-
//
|
|
94
|
-
// ≥ FUZZY_MIN_LEN; only Levenshtein distance ≤ 1 is accepted (single
|
|
95
|
-
// insert / delete / substitute). Same weight as exact, but the
|
|
96
|
-
// MatchedToken records `via: 'fuzzy'` for client-side rendering.
|
|
61
|
+
// Only Levenshtein distance <= 1 is accepted, and only for longer tokens.
|
|
97
62
|
const FUZZY_MIN_LEN = 6;
|
|
98
63
|
function withinDistance1(a, b) {
|
|
99
64
|
if (a === b)
|
|
@@ -260,7 +225,7 @@ export async function matchError(args) {
|
|
|
260
225
|
}
|
|
261
226
|
export const MATCH_ERROR_TOOL = {
|
|
262
227
|
name: 'match_error',
|
|
263
|
-
description: "Find Vivarium recipes that match a pasted error message or stack trace by mechanical token overlap (no LLM). The text is tokenised, lowercase-compared against each recipe's symptom (weight 5 per segment), tags (3), project (2), and slug (2).
|
|
228
|
+
description: "Find Vivarium recipes that match a pasted error message or stack trace by mechanical token overlap (no LLM). The text is tokenised, lowercase-compared against each recipe's symptom (weight 5 per segment), tags (3), project (2), and slug (2). Matching includes adjacent-pair tokens (so 'data type' can hit `dtype`), a small synonym table (e.g. dtype⇄datatype, segfault⇄sigsegv), and bounded Levenshtein-1 fuzzy matching for tokens of length >= 6. Stopword set covers English, Japanese, German, Spanish, French, Chinese, and Korean noise tokens. Recipes with score > 0 are returned in descending score order; ties broken by (layer asc, slug asc). Each matched token reports its `via` (`synonym` or `fuzzy` when non-exact) and the original `input` that triggered it, so agents can render the provenance. Pair with `get_recipe` to drill into a specific result, or `list_recipes` for unfiltered browsing.",
|
|
264
229
|
inputSchema: {
|
|
265
230
|
type: 'object',
|
|
266
231
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match_error.js","sourceRoot":"","sources":["../../src/tools/match_error.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"match_error.js","sourceRoot":"","sources":["../../src/tools/match_error.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,8EAA8E;AAC9E,sEAAsE;AACtE,8DAA8D;AAC9D,oCAAoC;AACpC,wEAAwE;AACxE,6DAA6D;AAC7D,mEAAmE;AACnE,eAAe;AAEf,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAyC/C,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC;AAClC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,qFAAqF;AACrF,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAC;IAC7C,UAAU;IACV,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAA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AAI,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,EAAE,EAAE,IAAI;QACR,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;QACrC,aAAa,EAAE,OAAO,CAAC,MAAM;QAC7B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;KAChC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,q4BAAq4B;IACv4B,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAiB;gBACvB,WAAW,EACT,8QAA8Q;aACjR;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,SAAkB;gBACxB,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,EAAE;gBACX,WAAW,EACT,oEAAoE;aACvE;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;CACO,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export interface PrepareFixCandidateArgs {
|
|
2
|
+
slug?: string;
|
|
3
|
+
fork_url?: string;
|
|
4
|
+
branch?: string;
|
|
5
|
+
upstream_pr?: string;
|
|
6
|
+
package?: string;
|
|
7
|
+
purpose?: string;
|
|
8
|
+
}
|
|
9
|
+
interface FixCandidateJson {
|
|
10
|
+
schema_version: 1;
|
|
11
|
+
package: string;
|
|
12
|
+
purpose: string;
|
|
13
|
+
source: {
|
|
14
|
+
type: 'git';
|
|
15
|
+
url: string;
|
|
16
|
+
ref: string;
|
|
17
|
+
};
|
|
18
|
+
upstream_pr?: string;
|
|
19
|
+
}
|
|
20
|
+
interface PrepareFixCandidateOk {
|
|
21
|
+
ok: true;
|
|
22
|
+
slug: string;
|
|
23
|
+
layer: 1;
|
|
24
|
+
recipe_url: string;
|
|
25
|
+
fix_candidate_path: string;
|
|
26
|
+
fix_candidate_json: FixCandidateJson;
|
|
27
|
+
branch_name: string;
|
|
28
|
+
commit_subject: string;
|
|
29
|
+
pr_title: string;
|
|
30
|
+
pr_body: string;
|
|
31
|
+
commands: string[];
|
|
32
|
+
next_steps: string[];
|
|
33
|
+
references: {
|
|
34
|
+
rules: string;
|
|
35
|
+
builder_script: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface PrepareFixCandidateError {
|
|
39
|
+
ok: false;
|
|
40
|
+
error: string;
|
|
41
|
+
}
|
|
42
|
+
export type PrepareFixCandidateResult = PrepareFixCandidateOk | PrepareFixCandidateError;
|
|
43
|
+
export declare function prepareFixCandidate(args: PrepareFixCandidateArgs): Promise<PrepareFixCandidateResult>;
|
|
44
|
+
export declare const PREPARE_FIX_CANDIDATE_TOOL: {
|
|
45
|
+
readonly name: "prepare_fix_candidate";
|
|
46
|
+
readonly description: "Register a fix-candidate spec on an existing Layer 1 (WASM/Pyodide) Vivarium recipe so the recipe page runs the fix branch's wheel side-by-side with the released build. SCAFFOLDING HELPER, not an execution engine — same pattern as prepare_new_recipe and verify_branch_fix. Given a recipe slug + fork repo URL + branch name, returns: the `fix-candidate.json` content the agent should write, the recommended commit subject + PR title, a ready-to-paste PR body (with the AI-authorship and fix-candidate spec details tucked inside a `<details>` block), and the exact `gh` / `git` commands to fork-and-clone aletheia-works/vivarium, branch off main, drop the spec in, commit, push, and open the cross-repo PR. Use this immediately after opening an upstream fix branch (e.g. on a fork of mpmath/mpmath) when you want Vivarium to verify the fix live in-browser without waiting for upstream merge + a PyPI release. Validates the slug against the bundled catalogue and rejects non-Layer-1 recipes (Layers 2/3 use a different verification path — see verify_branch_fix).";
|
|
47
|
+
readonly inputSchema: {
|
|
48
|
+
readonly type: "object";
|
|
49
|
+
readonly properties: {
|
|
50
|
+
readonly slug: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly description: "Existing Layer 1 recipe slug to register the fix candidate on (e.g. 'mpmath-983'). Must resolve to a Layer 1 entry in the bundled catalogue — call list_recipes if you need to discover it.";
|
|
53
|
+
};
|
|
54
|
+
readonly fork_url: {
|
|
55
|
+
readonly type: "string";
|
|
56
|
+
readonly pattern: "^https?://github\\.com/[^/]+/[^/]+/?$";
|
|
57
|
+
readonly description: "Bare GitHub repo URL of the fork that hosts the fix branch (e.g. 'https://github.com/JamBalaya56562/mpmath'). Tree / blob / pull URLs are rejected; pass the canonical clone URL.";
|
|
58
|
+
};
|
|
59
|
+
readonly branch: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
readonly description: "Branch name on the fork that contains the fix (e.g. 'claude/fix-mpmath-983-aBcDe').";
|
|
62
|
+
};
|
|
63
|
+
readonly upstream_pr: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
readonly description: "Optional URL of the PR you opened from this fork branch (e.g. 'https://github.com/mpmath/mpmath/pull/<n>' or the fork-side draft PR URL while the upstream PR is still in progress). Embedded in the generated fix-candidate.json and surfaced in the page UI.";
|
|
66
|
+
};
|
|
67
|
+
readonly package: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly description: "Optional pip distribution name override. Defaults to the recipe's project name (e.g. 'mpmath' for the mpmath-983 recipe). Override only when the project name and the pip distribution name diverge.";
|
|
70
|
+
};
|
|
71
|
+
readonly purpose: {
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
readonly description: "Optional purpose / one-liner. Defaults to 'fix-candidate verification for <project>/<project>#<issue>'.";
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
readonly required: readonly ["slug", "fork_url", "branch"];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export {};
|
|
80
|
+
//# sourceMappingURL=prepare_fix_candidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare_fix_candidate.d.ts","sourceRoot":"","sources":["../../src/tools/prepare_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