@aletheia-works/vivarium-mcp 0.1.1 → 0.2.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.
- package/README.md +1 -1
- package/dist/bundled/recipes.json +0 -18
- package/dist/catalogue.js +1 -1
- package/dist/catalogue.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +18 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/create_fork_pr.d.ts +68 -0
- package/dist/tools/create_fork_pr.d.ts.map +1 -0
- package/dist/tools/create_fork_pr.js +261 -0
- package/dist/tools/create_fork_pr.js.map +1 -0
- 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 +5 -20
- package/dist/tools/match_error.js.map +1 -1
- package/dist/tools/prepare_fix_candidate.d.ts +6 -7
- package/dist/tools/prepare_fix_candidate.d.ts.map +1 -1
- package/dist/tools/prepare_fix_candidate.js +15 -14
- package/dist/tools/prepare_fix_candidate.js.map +1 -1
- 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 +25 -8
- package/dist/tools/prepare_new_recipe.js.map +1 -1
- package/dist/tools/run_layer1_verdict.d.ts +37 -0
- package/dist/tools/run_layer1_verdict.d.ts.map +1 -0
- package/dist/tools/run_layer1_verdict.js +134 -0
- package/dist/tools/run_layer1_verdict.js.map +1 -0
- package/dist/tools/run_layer23_verdict.d.ts +40 -0
- package/dist/tools/run_layer23_verdict.d.ts.map +1 -0
- package/dist/tools/run_layer23_verdict.js +348 -0
- package/dist/tools/run_layer23_verdict.js.map +1 -0
- 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 +95 -0
- package/dist/tools/verify_and_report_fix.d.ts.map +1 -0
- package/dist/tools/verify_and_report_fix.js +386 -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 +3 -9
- 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 -2
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/src/bundled/recipes.json +0 -18
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ deployed verdict snapshots, without scraping the docs site.
|
|
|
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
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
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`). |
|
|
26
26
|
|
|
27
27
|
## Install
|
|
@@ -2,24 +2,6 @@
|
|
|
2
2
|
"index": "v1",
|
|
3
3
|
"contract": "v1",
|
|
4
4
|
"recipes": [
|
|
5
|
-
{
|
|
6
|
-
"slug": "astroid-2993",
|
|
7
|
-
"layer": 1,
|
|
8
|
-
"project": "astroid",
|
|
9
|
-
"issue": 2993,
|
|
10
|
-
"title": "pylint-dev/astroid#2993",
|
|
11
|
-
"page_url": "https://aletheia-works.github.io/vivarium/repro/astroid/2993/",
|
|
12
|
-
"source_url": "https://github.com/aletheia-works/vivarium/tree/main/src/layer1_wasm/astroid-2993",
|
|
13
|
-
"language": "python",
|
|
14
|
-
"tags": [
|
|
15
|
-
"ast",
|
|
16
|
-
"type-comment",
|
|
17
|
-
"fuzzing",
|
|
18
|
-
"oss-fuzz"
|
|
19
|
-
],
|
|
20
|
-
"symptom": "memory-error-on-fuzzed-input",
|
|
21
|
-
"severity": "crash"
|
|
22
|
-
},
|
|
23
5
|
{
|
|
24
6
|
"slug": "cpython-137205",
|
|
25
7
|
"layer": 1,
|
package/dist/catalogue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Catalogue fetcher: 5-minute in-process TTL with a build-time bundled
|
|
2
2
|
// fallback for offline / network-failure / cold-start. The bundled
|
|
3
3
|
// snapshot is refreshed at publish time by the GHA workflow that
|
|
4
|
-
// copies docs/public/api/recipes.json into src/bundled/.
|
|
4
|
+
// copies docs/site/public/api/recipes.json into src/bundled/.
|
|
5
5
|
import bundledIndex from './bundled/recipes.json' with { type: 'json' };
|
|
6
6
|
export const INDEX_URL = 'https://aletheia-works.github.io/vivarium/api/recipes.json';
|
|
7
7
|
const TTL_MS = 5 * 60 * 1000;
|
package/dist/catalogue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogue.js","sourceRoot":"","sources":["../src/catalogue.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,mEAAmE;AACnE,iEAAiE;AACjE,
|
|
1
|
+
{"version":3,"file":"catalogue.js","sourceRoot":"","sources":["../src/catalogue.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,mEAAmE;AACnE,iEAAiE;AACjE,8DAA8D;AAG9D,OAAO,YAAY,MAAM,wBAAwB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAExE,MAAM,CAAC,MAAM,SAAS,GACpB,4DAA4D,CAAC;AAE/D,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAO7B,IAAI,KAAK,GAAsB,IAAI,CAAC;AAEpC,MAAM,UAAU,qBAAqB;IACnC,KAAK,GAAG,IAAI,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,YAAuC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,IAAI,KAAK,IAAI,GAAG,GAAG,KAAK,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE;YACjC,OAAO,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE;SAC1C,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;YACX,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAiB,CAAC;YAChD,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/D,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;gBACxC,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sDAAsD;IACxD,CAAC;IAED,OAAO,eAAe,EAAE,CAAC;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":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AA+DnE,wBAAgB,YAAY,IAAI,MAAM,CAsGrC;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAI/C"}
|
package/dist/server.js
CHANGED
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
5
5
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
6
6
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import { CREATE_FORK_PR_TOOL, createForkPr, } from './tools/create_fork_pr.js';
|
|
7
8
|
import { GET_RECIPE_TOOL, getRecipe } from './tools/get_recipe.js';
|
|
8
9
|
import { LIST_RECIPES_TOOL, listRecipes, } from './tools/list_recipes.js';
|
|
9
10
|
import { LOOKUP_VERDICT_TOOL, lookupVerdict, } from './tools/lookup_verdict.js';
|
|
10
11
|
import { MATCH_ERROR_TOOL, matchError, } from './tools/match_error.js';
|
|
11
12
|
import { PREPARE_FIX_CANDIDATE_TOOL, prepareFixCandidate, } from './tools/prepare_fix_candidate.js';
|
|
12
13
|
import { PREPARE_NEW_RECIPE_TOOL, prepareNewRecipe, } from './tools/prepare_new_recipe.js';
|
|
14
|
+
import { SEARCH_UPSTREAM_ISSUES_TOOL, searchUpstreamIssues, } from './tools/search_upstream_issues.js';
|
|
15
|
+
import { VERIFY_AND_REPORT_FIX_TOOL, verifyAndReportFix, } from './tools/verify_and_report_fix.js';
|
|
13
16
|
import { VERIFY_BRANCH_FIX_TOOL, verifyBranchFix, } from './tools/verify_branch_fix.js';
|
|
14
17
|
const SERVER_NAME = 'vivarium-mcp';
|
|
15
18
|
// Keep in sync with package.json + jsr.json. The MCP `initialize`
|
|
@@ -17,9 +20,9 @@ const SERVER_NAME = 'vivarium-mcp';
|
|
|
17
20
|
// these three files produce a confusing client experience. Bump the
|
|
18
21
|
// patch component for additive changes within v0.x (additional tools,
|
|
19
22
|
// description / surface refinements) — the project is still pre-1.0
|
|
20
|
-
// and `prepare_fix_candidate`
|
|
21
|
-
//
|
|
22
|
-
const SERVER_VERSION = '0.
|
|
23
|
+
// and `prepare_fix_candidate` is meaningful but fully opt-in, so a minor
|
|
24
|
+
// bump would overstate the impact.
|
|
25
|
+
const SERVER_VERSION = '0.2.1';
|
|
23
26
|
export function createServer() {
|
|
24
27
|
const server = new Server({ name: SERVER_NAME, version: SERVER_VERSION }, { capabilities: { tools: {} } });
|
|
25
28
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
@@ -28,9 +31,12 @@ export function createServer() {
|
|
|
28
31
|
GET_RECIPE_TOOL,
|
|
29
32
|
LOOKUP_VERDICT_TOOL,
|
|
30
33
|
MATCH_ERROR_TOOL,
|
|
34
|
+
SEARCH_UPSTREAM_ISSUES_TOOL,
|
|
31
35
|
VERIFY_BRANCH_FIX_TOOL,
|
|
36
|
+
VERIFY_AND_REPORT_FIX_TOOL,
|
|
32
37
|
PREPARE_NEW_RECIPE_TOOL,
|
|
33
38
|
PREPARE_FIX_CANDIDATE_TOOL,
|
|
39
|
+
CREATE_FORK_PR_TOOL,
|
|
34
40
|
],
|
|
35
41
|
}));
|
|
36
42
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
@@ -51,15 +57,24 @@ export function createServer() {
|
|
|
51
57
|
case 'match_error':
|
|
52
58
|
payload = await matchError(args);
|
|
53
59
|
break;
|
|
60
|
+
case 'search_upstream_issues':
|
|
61
|
+
payload = await searchUpstreamIssues(args);
|
|
62
|
+
break;
|
|
54
63
|
case 'verify_branch_fix':
|
|
55
64
|
payload = await verifyBranchFix(args);
|
|
56
65
|
break;
|
|
66
|
+
case 'verify_and_report_fix':
|
|
67
|
+
payload = await verifyAndReportFix(args);
|
|
68
|
+
break;
|
|
57
69
|
case 'prepare_new_recipe':
|
|
58
70
|
payload = await prepareNewRecipe(args);
|
|
59
71
|
break;
|
|
60
72
|
case 'prepare_fix_candidate':
|
|
61
73
|
payload = await prepareFixCandidate(args);
|
|
62
74
|
break;
|
|
75
|
+
case 'create_fork_pr':
|
|
76
|
+
payload = await createForkPr(args);
|
|
77
|
+
break;
|
|
63
78
|
default:
|
|
64
79
|
return {
|
|
65
80
|
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,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,sBAAsB,EACtB,eAAe,GAEhB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,WAAW,GAAG,cAAc,CAAC;AACnC,kEAAkE;AAClE,sEAAsE;AACtE,oEAAoE;AACpE,sEAAsE;AACtE,oEAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,o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|
|
4
|
+
current_state: Partial<RoundtripState>;
|
|
5
|
+
pr_title: string;
|
|
6
|
+
pr_body?: string;
|
|
7
|
+
dry_run?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateForkPrOk {
|
|
10
|
+
ok: true;
|
|
11
|
+
slug: string;
|
|
12
|
+
upstream_repo: string;
|
|
13
|
+
head: string;
|
|
14
|
+
title: string;
|
|
15
|
+
body: string;
|
|
16
|
+
draft: true;
|
|
17
|
+
dry_run: boolean;
|
|
18
|
+
command: string;
|
|
19
|
+
pr_url?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateForkPrError {
|
|
22
|
+
ok: false;
|
|
23
|
+
error: string;
|
|
24
|
+
}
|
|
25
|
+
export type CreateForkPrResult = CreateForkPrOk | CreateForkPrError;
|
|
26
|
+
export interface GhRunResult {
|
|
27
|
+
status: number | null;
|
|
28
|
+
stdout: string;
|
|
29
|
+
stderr: string;
|
|
30
|
+
}
|
|
31
|
+
export type GhRunner = (args: string[]) => GhRunResult;
|
|
32
|
+
export declare function _setGhRunnerForTesting(runner: GhRunner | null): void;
|
|
33
|
+
export declare function createForkPr(args: CreateForkPrArgs): Promise<CreateForkPrResult>;
|
|
34
|
+
export declare const CREATE_FORK_PR_TOOL: {
|
|
35
|
+
readonly name: "create_fork_pr";
|
|
36
|
+
readonly description: "Open a draft PR on the upstream repository from the contributor's already-pushed fork branch. The output side of the round-trip loop. Conservative by design: `dry_run` defaults to true (returns the gh command without executing); `--draft` is mandatory (caller cannot opt out); AI authorship is disclosed via a boilerplate footer appended to the PR body (the `ai: generated` LABEL from AGENTS.md §4.6 is Vivarium-internal and is intentionally NOT applied — upstream repos rarely carry it and contributors usually lack permission to create it). The tool refuses to run unless `computeNextAction(current_state) === 'open_fork_pr'` — that single check enforces all the round-trip preconditions in one place (verdicts captured with the expected polarity, the Vivarium-side PR already opened, no existing upstream PR, status not blocked/merged). The fork branch must already exist on GitHub — this tool does NOT clone, commit, or push on the caller's behalf, and does NOT create the fork (use `gh repo fork` manually first). Pair with `verify_and_report_fix` upstream of this call and with `prepare_fix_candidate` (Layer 1) when registering a fix-candidate spec.";
|
|
37
|
+
readonly inputSchema: {
|
|
38
|
+
readonly type: "object";
|
|
39
|
+
readonly properties: {
|
|
40
|
+
readonly slug: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
readonly pattern: "^[a-z0-9]+(-[a-z0-9]+)*$";
|
|
43
|
+
readonly description: "Kebab-case recipe slug (e.g. 'mpmath-983', 'bash-local-shadows-exit'). Must exist in the catalogue.";
|
|
44
|
+
};
|
|
45
|
+
readonly current_state: {
|
|
46
|
+
readonly type: "object";
|
|
47
|
+
readonly description: "Parsed roundtrip.json contents. Must contain `upstream_issue`, `fork` (owner/repo/branch), and `verdicts` with both `unfixed.verdict='reproduced'` and `fixed.verdict='unreproduced'`. The tool refuses to run otherwise.";
|
|
48
|
+
readonly additionalProperties: true;
|
|
49
|
+
};
|
|
50
|
+
readonly pr_title: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly minLength: 1;
|
|
53
|
+
readonly description: "PR title. Caller is responsible for following the upstream project's commit / PR title conventions (Conventional Commits, etc.).";
|
|
54
|
+
};
|
|
55
|
+
readonly pr_body: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly description: "PR body (Markdown). Defaults to empty. Include a link back to the Vivarium recipe and the upstream issue, and disclose AI authorship per AGENTS.md §4.6 (the `ai: generated` label is applied automatically; surfacing the disclosure in the body is good practice).";
|
|
58
|
+
};
|
|
59
|
+
readonly dry_run: {
|
|
60
|
+
readonly type: "boolean";
|
|
61
|
+
readonly default: true;
|
|
62
|
+
readonly description: "When true (the default), the tool returns the exact `gh pr create` command + a structured summary WITHOUT calling gh. Set to false to actually open the PR. The MCP server never opens an upstream PR by accident.";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly required: readonly ["slug", "current_state", "pr_title"];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
//# source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ACrB,OAAO,CAAC,kBAAkB,CAAC,CAkL7B;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCtB,CAAC"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// MCP tool that opens a draft PR on the upstream repository from the
|
|
2
|
+
// contributor's already-pushed fork branch. The output side of the
|
|
3
|
+
// round-trip loop — the first step that crosses the boundary from
|
|
4
|
+
// "internal verification" to "publicly visible state change".
|
|
5
|
+
//
|
|
6
|
+
// Phase 4 of the round-trip automation. Conservative by design:
|
|
7
|
+
// - dry_run defaults to true; explicit opt-in needed to actually
|
|
8
|
+
// create the PR.
|
|
9
|
+
// - The PR is always opened with --draft. Merging out of draft
|
|
10
|
+
// stays a human action.
|
|
11
|
+
// - AI authorship is disclosed in the PR body (boilerplate footer
|
|
12
|
+
// appended automatically). Label-based disclosure is NOT
|
|
13
|
+
// attempted: AGENTS.md §4.6's `ai: generated` label is a
|
|
14
|
+
// Vivarium-internal contract — the upstream repo may not have
|
|
15
|
+
// that label and contributors typically lack write permission
|
|
16
|
+
// to create it.
|
|
17
|
+
// - The tool refuses to run unless the recipe's full round-trip
|
|
18
|
+
// state machine selects `open_fork_pr` next — that is, the
|
|
19
|
+
// status is not blocked/merged, an upstream PR is not already
|
|
20
|
+
// open, the unfixed+fixed verdicts are both captured with the
|
|
21
|
+
// expected polarity, and the Vivarium-side PR has already been
|
|
22
|
+
// opened. Each of those conditions is enforced upstream by
|
|
23
|
+
// `computeNextAction` so this tool stays consistent with it.
|
|
24
|
+
// - Local clone, commit, and push are caller responsibilities —
|
|
25
|
+
// this tool does NOT mutate the working tree. The fork branch
|
|
26
|
+
// must already exist on GitHub before calling.
|
|
27
|
+
import { spawnSync } from 'node:child_process';
|
|
28
|
+
import { getCatalogue } from '../catalogue.js';
|
|
29
|
+
import { computeNextAction, parseUpstreamIssue, } from './verify_and_report_fix.js';
|
|
30
|
+
const defaultGhRunner = (args) => {
|
|
31
|
+
const r = spawnSync('gh', args, {
|
|
32
|
+
encoding: 'utf-8',
|
|
33
|
+
timeout: 60_000,
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
status: r.status,
|
|
37
|
+
stdout: r.stdout ?? '',
|
|
38
|
+
stderr: r.stderr ?? '',
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
let ghRunner = defaultGhRunner;
|
|
42
|
+
export function _setGhRunnerForTesting(runner) {
|
|
43
|
+
ghRunner = runner ?? defaultGhRunner;
|
|
44
|
+
}
|
|
45
|
+
// Boilerplate appended to every upstream PR body so the AI authorship
|
|
46
|
+
// disclosure is visible to upstream maintainers. The `ai: generated`
|
|
47
|
+
// LABEL from AGENTS.md §4.6 is a Vivarium-internal contract; upstream
|
|
48
|
+
// repos may not carry that label, and contributors typically lack the
|
|
49
|
+
// write permission needed to create it. Disclose in prose instead.
|
|
50
|
+
const AI_AUTHORSHIP_FOOTER = '\n\n---\n\n*This pull request was generated by an AI agent via the Vivarium round-trip automation. The candidate fix was verified against an in-Vivarium reproduction (`verdicts.unfixed = "reproduced"` → `verdicts.fixed = "unreproduced"`). Please review carefully before merging.*\n';
|
|
51
|
+
function appendAuthorshipFooter(body) {
|
|
52
|
+
// Idempotent: a caller that already pasted the footer (or part of
|
|
53
|
+
// it) shouldn't see it duplicated.
|
|
54
|
+
if (body.includes('Vivarium round-trip automation'))
|
|
55
|
+
return body;
|
|
56
|
+
return body.length === 0
|
|
57
|
+
? AI_AUTHORSHIP_FOOTER.trimStart()
|
|
58
|
+
: body + AI_AUTHORSHIP_FOOTER;
|
|
59
|
+
}
|
|
60
|
+
function quoteShell(value) {
|
|
61
|
+
// Single-quote and escape any embedded single quote — produces
|
|
62
|
+
// a shell-safe representation for the returned `command` string.
|
|
63
|
+
// Real execution goes through spawn with argv arrays, so this
|
|
64
|
+
// affects only what the caller sees as a paste-ready line.
|
|
65
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
66
|
+
}
|
|
67
|
+
export async function createForkPr(args) {
|
|
68
|
+
const slug = args.slug?.trim();
|
|
69
|
+
if (!slug) {
|
|
70
|
+
return { ok: false, error: 'missing required argument: slug' };
|
|
71
|
+
}
|
|
72
|
+
const title = args.pr_title?.trim();
|
|
73
|
+
if (!title) {
|
|
74
|
+
return { ok: false, error: 'pr_title is required' };
|
|
75
|
+
}
|
|
76
|
+
const { recipes } = await getCatalogue();
|
|
77
|
+
const recipe = recipes.find((r) => r.slug === slug);
|
|
78
|
+
if (!recipe) {
|
|
79
|
+
return { ok: false, error: `recipe not found: ${slug}` };
|
|
80
|
+
}
|
|
81
|
+
const state = args.current_state;
|
|
82
|
+
if (!state || typeof state !== 'object') {
|
|
83
|
+
return { ok: false, error: 'current_state is required' };
|
|
84
|
+
}
|
|
85
|
+
// State-machine integrity: the upstream PR is only the next legal
|
|
86
|
+
// action when `computeNextAction(state) === 'open_fork_pr'`. That
|
|
87
|
+
// single check enforces all the round-trip preconditions in one
|
|
88
|
+
// place — `status` is not blocked/merged, an upstream_pr is not
|
|
89
|
+
// already recorded, the verdicts are both captured with the
|
|
90
|
+
// expected polarity (unfixed=reproduced + fixed=unreproduced),
|
|
91
|
+
// and a Vivarium-side `vivarium_pr` has already been opened.
|
|
92
|
+
// Using the same function the rest of the tooling uses avoids
|
|
93
|
+
// drift between this tool and `verify_and_report_fix`.
|
|
94
|
+
const nextAction = computeNextAction(state);
|
|
95
|
+
if (nextAction !== 'open_fork_pr') {
|
|
96
|
+
return {
|
|
97
|
+
ok: false,
|
|
98
|
+
error: `state machine expected next_action 'open_fork_pr' but computeNextAction(current_state) returned '${nextAction}'. Resolve the round-trip state first (capture verdicts, open the Vivarium-side PR, or clear status: blocked) before opening the upstream PR.`,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// Upstream owner/repo from upstream_issue URL.
|
|
102
|
+
const upstream = parseUpstreamIssue(state.upstream_issue);
|
|
103
|
+
if (!upstream) {
|
|
104
|
+
return {
|
|
105
|
+
ok: false,
|
|
106
|
+
error: `cannot derive upstream owner/repo from current_state.upstream_issue (got "${state.upstream_issue ?? 'missing'}"). Expected form: https://github.com/<owner>/<repo>/issues/<n>.`,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// Fork coordinates.
|
|
110
|
+
const fork = state.fork;
|
|
111
|
+
if (!fork ||
|
|
112
|
+
!fork.owner?.trim() ||
|
|
113
|
+
!fork.repo?.trim() ||
|
|
114
|
+
!fork.branch?.trim()) {
|
|
115
|
+
return {
|
|
116
|
+
ok: false,
|
|
117
|
+
error: 'current_state.fork must have owner, repo, and branch (the contributor fork the candidate fix lives on)',
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const upstreamRepo = `${upstream.owner}/${upstream.repo}`;
|
|
121
|
+
const head = `${fork.owner}:${fork.branch}`;
|
|
122
|
+
const body = appendAuthorshipFooter(args.pr_body ?? '');
|
|
123
|
+
const dryRun = args.dry_run !== false; // default true
|
|
124
|
+
// Build a paste-ready command string. spawn execution below uses an
|
|
125
|
+
// argv array, not this string — they share the same arguments.
|
|
126
|
+
// No `--label` here: upstream repos may not carry the label and
|
|
127
|
+
// contributors usually can't create one. AI authorship is surfaced
|
|
128
|
+
// via the body footer instead.
|
|
129
|
+
const command = [
|
|
130
|
+
'gh',
|
|
131
|
+
'pr',
|
|
132
|
+
'create',
|
|
133
|
+
'--repo',
|
|
134
|
+
upstreamRepo,
|
|
135
|
+
'--head',
|
|
136
|
+
head,
|
|
137
|
+
'--draft',
|
|
138
|
+
'--title',
|
|
139
|
+
quoteShell(title),
|
|
140
|
+
'--body',
|
|
141
|
+
quoteShell(body),
|
|
142
|
+
].join(' ');
|
|
143
|
+
if (dryRun) {
|
|
144
|
+
return {
|
|
145
|
+
ok: true,
|
|
146
|
+
slug,
|
|
147
|
+
upstream_repo: upstreamRepo,
|
|
148
|
+
head,
|
|
149
|
+
title,
|
|
150
|
+
body,
|
|
151
|
+
draft: true,
|
|
152
|
+
dry_run: true,
|
|
153
|
+
command,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
// dry_run=false → execute. Pre-flight checks first so a partial
|
|
157
|
+
// failure doesn't leave the PR half-opened.
|
|
158
|
+
// Guardrail 2: gh auth must be set up.
|
|
159
|
+
const authCheck = ghRunner(['auth', 'status']);
|
|
160
|
+
if (authCheck.status !== 0) {
|
|
161
|
+
return {
|
|
162
|
+
ok: false,
|
|
163
|
+
error: `gh auth check failed: ${authCheck.stderr.trim() || '<no stderr>'}. Run 'gh auth login' first.`,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
// Fork must exist and be reachable by the active gh auth.
|
|
167
|
+
const forkCheck = ghRunner([
|
|
168
|
+
'repo',
|
|
169
|
+
'view',
|
|
170
|
+
`${fork.owner}/${fork.repo}`,
|
|
171
|
+
'--json',
|
|
172
|
+
'name',
|
|
173
|
+
]);
|
|
174
|
+
if (forkCheck.status !== 0) {
|
|
175
|
+
return {
|
|
176
|
+
ok: false,
|
|
177
|
+
error: `fork ${fork.owner}/${fork.repo} not found or inaccessible. Create it manually with 'gh repo fork ${upstreamRepo}' first — this tool does not fork on the caller's behalf.`,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
// The named branch must already be pushed to the fork.
|
|
181
|
+
const branchCheck = ghRunner([
|
|
182
|
+
'api',
|
|
183
|
+
`repos/${fork.owner}/${fork.repo}/branches/${fork.branch}`,
|
|
184
|
+
]);
|
|
185
|
+
if (branchCheck.status !== 0) {
|
|
186
|
+
return {
|
|
187
|
+
ok: false,
|
|
188
|
+
error: `branch ${fork.branch} not found on fork ${fork.owner}/${fork.repo}. Push the fix branch to the fork before calling this tool.`,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
// Open the PR. --draft is hard-coded; caller cannot opt out.
|
|
192
|
+
// No --label here (see the comment near the command builder above).
|
|
193
|
+
const create = ghRunner([
|
|
194
|
+
'pr',
|
|
195
|
+
'create',
|
|
196
|
+
'--repo',
|
|
197
|
+
upstreamRepo,
|
|
198
|
+
'--head',
|
|
199
|
+
head,
|
|
200
|
+
'--draft',
|
|
201
|
+
'--title',
|
|
202
|
+
title,
|
|
203
|
+
'--body',
|
|
204
|
+
body,
|
|
205
|
+
]);
|
|
206
|
+
if (create.status !== 0) {
|
|
207
|
+
return {
|
|
208
|
+
ok: false,
|
|
209
|
+
error: `gh pr create failed: ${create.stderr.trim() || '<no stderr>'}`,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
// gh pr create prints the PR URL to stdout on success.
|
|
213
|
+
const prUrl = create.stdout.trim().split('\n').pop() ?? '';
|
|
214
|
+
return {
|
|
215
|
+
ok: true,
|
|
216
|
+
slug,
|
|
217
|
+
upstream_repo: upstreamRepo,
|
|
218
|
+
head,
|
|
219
|
+
title,
|
|
220
|
+
body,
|
|
221
|
+
draft: true,
|
|
222
|
+
dry_run: false,
|
|
223
|
+
command,
|
|
224
|
+
pr_url: prUrl,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
export const CREATE_FORK_PR_TOOL = {
|
|
228
|
+
name: 'create_fork_pr',
|
|
229
|
+
description: "Open a draft PR on the upstream repository from the contributor's already-pushed fork branch. The output side of the round-trip loop. Conservative by design: `dry_run` defaults to true (returns the gh command without executing); `--draft` is mandatory (caller cannot opt out); AI authorship is disclosed via a boilerplate footer appended to the PR body (the `ai: generated` LABEL from AGENTS.md §4.6 is Vivarium-internal and is intentionally NOT applied — upstream repos rarely carry it and contributors usually lack permission to create it). The tool refuses to run unless `computeNextAction(current_state) === 'open_fork_pr'` — that single check enforces all the round-trip preconditions in one place (verdicts captured with the expected polarity, the Vivarium-side PR already opened, no existing upstream PR, status not blocked/merged). The fork branch must already exist on GitHub — this tool does NOT clone, commit, or push on the caller's behalf, and does NOT create the fork (use `gh repo fork` manually first). Pair with `verify_and_report_fix` upstream of this call and with `prepare_fix_candidate` (Layer 1) when registering a fix-candidate spec.",
|
|
230
|
+
inputSchema: {
|
|
231
|
+
type: 'object',
|
|
232
|
+
properties: {
|
|
233
|
+
slug: {
|
|
234
|
+
type: 'string',
|
|
235
|
+
pattern: '^[a-z0-9]+(-[a-z0-9]+)*$',
|
|
236
|
+
description: "Kebab-case recipe slug (e.g. 'mpmath-983', 'bash-local-shadows-exit'). Must exist in the catalogue.",
|
|
237
|
+
},
|
|
238
|
+
current_state: {
|
|
239
|
+
type: 'object',
|
|
240
|
+
description: "Parsed roundtrip.json contents. Must contain `upstream_issue`, `fork` (owner/repo/branch), and `verdicts` with both `unfixed.verdict='reproduced'` and `fixed.verdict='unreproduced'`. The tool refuses to run otherwise.",
|
|
241
|
+
additionalProperties: true,
|
|
242
|
+
},
|
|
243
|
+
pr_title: {
|
|
244
|
+
type: 'string',
|
|
245
|
+
minLength: 1,
|
|
246
|
+
description: "PR title. Caller is responsible for following the upstream project's commit / PR title conventions (Conventional Commits, etc.).",
|
|
247
|
+
},
|
|
248
|
+
pr_body: {
|
|
249
|
+
type: 'string',
|
|
250
|
+
description: "PR body (Markdown). Defaults to empty. Include a link back to the Vivarium recipe and the upstream issue, and disclose AI authorship per AGENTS.md §4.6 (the `ai: generated` label is applied automatically; surfacing the disclosure in the body is good practice).",
|
|
251
|
+
},
|
|
252
|
+
dry_run: {
|
|
253
|
+
type: 'boolean',
|
|
254
|
+
default: true,
|
|
255
|
+
description: 'When true (the default), the tool returns the exact `gh pr create` command + a structured summary WITHOUT calling gh. Set to false to actually open the PR. The MCP server never opens an upstream PR by accident.',
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
required: ['slug', 'current_state', 'pr_title'],
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
//# sourceMappingURL=create_fork_pr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_fork_pr.js","sourceRoot":"","sources":["../../src/tools/create_fork_pr.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,mEAAmE;AACnE,kEAAkE;AAClE,8DAA8D;AAC9D,EAAE;AACF,gEAAgE;AACh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AW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAiB;gBACvB,OAAO,EAAE,0BAA0B;gBACnC,WAAW,EACT,qGAAqG;aACxG;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,QAAiB;gBACvB,WAAW,EACT,2NAA2N;gBAC7N,oBAAoB,EAAE,IAAI;aAC3B;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAiB;gBACvB,SAAS,EAAE,CAAC;gBACZ,WAAW,EACT,kIAAkI;aACrI;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAiB;gBACvB,WAAW,EACT,sQAAsQ;aACzQ;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,SAAkB;gBACxB,OAAO,EAAE,IAAI;gBACb,WAAW,EACT,oNAAoN;aACvN;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,UAAU,CAAC;KAChD;CACO,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":"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;
|
|
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,6 +1,6 @@
|
|
|
1
1
|
// Server-side mirror of the docs-site error → recipe matcher.
|
|
2
2
|
//
|
|
3
|
-
// **Keep bit-identical with `docs/
|
|
3
|
+
// **Keep bit-identical with `docs/site/_components/ErrorRecipeMatcher.tsx`.**
|
|
4
4
|
// Diverging scoring between MCP and the docs matcher would surface as
|
|
5
5
|
// agent-vs-UI disagreement on identical input. The scoring is
|
|
6
6
|
// mechanical (no LLM / embeddings):
|
|
@@ -12,12 +12,7 @@ import { getCatalogue } from '../catalogue.js';
|
|
|
12
12
|
const MAX_INPUT_BYTES = 16 * 1024;
|
|
13
13
|
const DEFAULT_LIMIT = 10;
|
|
14
14
|
const MAX_LIMIT = 50;
|
|
15
|
-
//
|
|
16
|
-
// lexical coverage of any single language — it's dropping the
|
|
17
|
-
// frequent noise tokens that would never sit in a recipe overlay.
|
|
18
|
-
// Anything that sneaks through scores 0 against the catalogue
|
|
19
|
-
// anyway; the worst case is wasted comparison cycles, not wrong
|
|
20
|
-
// matches.
|
|
15
|
+
// Drop frequent noise tokens; anything unknown still scores 0 against the catalogue.
|
|
21
16
|
const STOPWORDS = new Set([
|
|
22
17
|
// English
|
|
23
18
|
'the', 'and', 'for', 'with', 'from', 'that', 'this', 'have',
|
|
@@ -41,14 +36,7 @@ const STOPWORDS = new Set([
|
|
|
41
36
|
// Korean (common particles + error words)
|
|
42
37
|
'오류', '예외', '실패', '스택',
|
|
43
38
|
]);
|
|
44
|
-
//
|
|
45
|
-
// user's input expands the input set to include all members.
|
|
46
|
-
// Variants are stored hyphen-stripped (lowercase, alphanumeric)
|
|
47
|
-
// to match the kebab-segmented catalogue tokens.
|
|
48
|
-
//
|
|
49
|
-
// Conservative on purpose — false-positive pressure rises with
|
|
50
|
-
// table size. Add a group only when there's an unambiguous mapping
|
|
51
|
-
// between a user-input shape and a catalogue overlay token.
|
|
39
|
+
// Variants are stored hyphen-stripped to match the kebab-segmented catalogue tokens.
|
|
52
40
|
const SYNONYM_GROUPS = [
|
|
53
41
|
['dtype', 'datatype'],
|
|
54
42
|
['nullptr', 'nullpointer', 'nilptr', 'nullpointerexception'],
|
|
@@ -70,10 +58,7 @@ const SYNONYM_MAP = (() => {
|
|
|
70
58
|
}
|
|
71
59
|
return m;
|
|
72
60
|
})();
|
|
73
|
-
//
|
|
74
|
-
// ≥ FUZZY_MIN_LEN; only Levenshtein distance ≤ 1 is accepted (single
|
|
75
|
-
// insert / delete / substitute). Same weight as exact, but the
|
|
76
|
-
// MatchedToken records `via: 'fuzzy'` for client-side rendering.
|
|
61
|
+
// Only Levenshtein distance <= 1 is accepted, and only for longer tokens.
|
|
77
62
|
const FUZZY_MIN_LEN = 6;
|
|
78
63
|
function withinDistance1(a, b) {
|
|
79
64
|
if (a === b)
|
|
@@ -240,7 +225,7 @@ export async function matchError(args) {
|
|
|
240
225
|
}
|
|
241
226
|
export const MATCH_ERROR_TOOL = {
|
|
242
227
|
name: 'match_error',
|
|
243
|
-
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.",
|
|
244
229
|
inputSchema: {
|
|
245
230
|
type: 'object',
|
|
246
231
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match_error.js","sourceRoot":"","sources":["../../src/tools/match_error.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,
|
|
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;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