@codetelemetry/mcp 0.5.0 → 0.6.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 CHANGED
@@ -31,7 +31,7 @@ deterministic (see [Releases & discovery](#releases--discovery)):
31
31
  ```json
32
32
  {
33
33
  "mcpServers": {
34
- "codetelemetry": { "command": "npx", "args": ["-y", "--package=@codetelemetry/mcp@0.5.0", "codetelemetry-mcp"] }
34
+ "codetelemetry": { "command": "npx", "args": ["-y", "--package=@codetelemetry/mcp@0.6.0", "codetelemetry-mcp"] }
35
35
  }
36
36
  }
37
37
  ```
@@ -45,7 +45,7 @@ sessions without local setup, or **Connect my coding tool** to record your own w
45
45
  Run the project connection command from the repository you choose:
46
46
 
47
47
  ```sh
48
- npx -y @codetelemetry/connect@0.3.0 join --organization-id tm_example --client codex --project .
48
+ npx -y @codetelemetry/connect@0.3.1 join --organization-id tm_example --client codex --project .
49
49
  # For Claude Code, use --client claude.
50
50
  ```
51
51
 
@@ -67,9 +67,9 @@ verification. **My sessions** is scoped to your authenticated ingest ownership;
67
67
  Optional history import uses the saved project and credentials, without a key argument:
68
68
 
69
69
  ```sh
70
- npx -y @codetelemetry/connect@0.3.0 import --workspace <name> --preview
70
+ npx -y @codetelemetry/connect@0.3.1 import --workspace <name> --preview
71
71
  # Choose numbers from that preview; no session content uploads until confirmation:
72
- npx -y @codetelemetry/connect@0.3.0 import --workspace <name> --select 1,2 --confirm
72
+ npx -y @codetelemetry/connect@0.3.1 import --workspace <name> --select 1,2 --confirm
73
73
  ```
74
74
 
75
75
  Preview is local-only and defaults to the last 30 days. It keeps at most 100 session
@@ -204,6 +204,10 @@ contexts use the established scope-v1 device flow.
204
204
  | `seed_grader_config` | Inspect local agent instructions, selected skills, and project task files; return source text and command-check candidates for the user's requested grading focus. Reads files without running commands or uploading them. |
205
205
  | `publish_grader_config` | Publish the reviewed draft as a new policy version using its exact revision. Completes setup through MCP; historical scores remain unchanged. |
206
206
  | `write_grader_config_artifact` | Write selected checks as Terraform JSON or a standalone Pulumi YAML program, choosing the format from repository context. Refuses overwrites; runs no commands. |
207
+ | `discover_grader_checks` | Discover common checks from recorded repository history; returns an asynchronous run ID. |
208
+ | `backtest_grader_checks` | Backtest candidate IDs or saved draft checks using pinned evidence and the live evaluator. |
209
+ | `get_grader_run` | Read progress, coverage, candidates and paged results, plus the current draft revision. |
210
+ | `save_grader_draft` | Save selected backtested candidates with revision protection; preserves unrelated checks and does not publish. |
207
211
  | `get_grader_config` | Read a page of the workspace's Grader draft, its revision, and published version. |
208
212
  | `update_grader_config` | Add, update, or remove selected draft checks while preserving others. Records the user's requested instruction features and rejects stale revisions. Use publish_grader_config with the returned revision to apply it to future scoring. |
209
213
  | `get_github_pr_gate` | Read the workspace's GitHub PR gate as its settings page shows it: the policy, trusted repositories, the GitHub Actions workflow file to commit, the check to require, outstanding steps, and recent decisions. |
@@ -219,6 +223,27 @@ the user merges) → once it has run, the user requires
219
223
  `codetelemetry/validation` from GitHub Actions on the default branch (`howTo`
220
224
  gives the `gh api` ruleset command to run with their permission).
221
225
 
226
+ ## Discover and backtest the Grader
227
+
228
+ For history-based setup, call `discover_grader_checks` with the recorded
229
+ `repository` label and requested `features`. The service defaults to 30 days of
230
+ PR-producing sessions; `cohort: "substantive"` includes all observed work.
231
+ Poll `get_grader_run`, follow `nextCursor`, and review candidate IDs, package
232
+ scope, ambiguities and coverage. Call `backtest_grader_checks` with the discovery
233
+ ID and selected candidate IDs, then poll the new run. Completion and final
234
+ edit-to-push timing are separate verdicts. Unknown and partial evidence remain
235
+ explicit. To backtest existing configuration, follow `draftChecksCursor` from
236
+ `get_grader_run` for saved check IDs/names and the current `draftRevision`, then
237
+ pass that revision, selected `checkIds` and `repository` to `backtest_grader_checks`.
238
+
239
+ Save selected candidates with `save_grader_draft`, passing the backtest ID and
240
+ current `draftRevision` from `get_grader_run` as `expectedRevision`. Saving
241
+ preserves unrelated checks and does not publish or change enforcement. Runs
242
+ expire after 24 hours. Scans, normalization and evaluation run on the service;
243
+ this workflow needs no checkout, shell, custom scripts or client matcher JSON.
244
+ The backend must support the Grader history routes before these tools can run.
245
+ Existing local seeding and direct configuration remain available below.
246
+
222
247
  ## Seed and update the Grader
223
248
 
224
249
  Ask, for example: **"Use AGENTS.md and our security-review skill to grade unit
@@ -463,7 +463,7 @@ export async function run(argv) {
463
463
  result.previewSessions.forEach((session, i) => out(`${i + 1}. ${session.source} ${session.sessionId} · ${new Date(session.endMs).toISOString()} · ${session.events} events`));
464
464
  if (result.remaining)
465
465
  out(`${result.remaining} additional sessions remain; narrow --since for another preview.`);
466
- out(`Import selected numbers: npx -y @codetelemetry/connect@0.3.0 import --workspace ${flags.workspace} --select 1,2 --confirm`);
466
+ out(`Import selected numbers: npx -y @codetelemetry/connect@0.3.1 import --workspace ${flags.workspace} --select 1,2 --confirm`);
467
467
  }
468
468
  else
469
469
  out(`Imported ${result.totals.sessions} sessions; ${result.remaining} remain. ${result.errors.slice(0, 3).join(" ")}`);
@@ -1,5 +1,5 @@
1
1
  import type { KeyScope } from "./connectivity.ts";
2
- export declare const WORKSPACE_MCP_PACKAGE = "@codetelemetry/mcp@0.5.0";
2
+ export declare const WORKSPACE_MCP_PACKAGE = "@codetelemetry/mcp@0.6.0";
3
3
  export declare const MAX_WORKSPACE_BYTES: number;
4
4
  export declare const MAX_WORKSPACES = 64;
5
5
  export type WorkspaceBinding = {
@@ -3,16 +3,19 @@ import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { createHash, randomBytes } from "node:crypto";
5
5
  import { buildOtelSection } from "./codexConfig.js";
6
- import { repositoryHookSource, quotedCommand, REPOSITORY_HOOK_FILE } from "./repositoryHook.js";
6
+ import { repositoryHookSource, quotedCommand, REPOSITORY_HOOK_FILE, REPOSITORY_HOOK_STATE_FILE } from "./repositoryHook.js";
7
7
  import { looksLikeKey } from "./keys.js";
8
- export const WORKSPACE_MCP_PACKAGE = "@codetelemetry/mcp@0.5.0";
8
+ export const WORKSPACE_MCP_PACKAGE = "@codetelemetry/mcp@0.6.0";
9
9
  export const MAX_WORKSPACE_BYTES = 64 * 1024;
10
10
  export const MAX_WORKSPACES = 64;
11
+ const isContextFile = (name) => /^[a-z][a-z0-9_-]{0,63}\.json$/.test(name) && name !== REPOSITORY_HOOK_STATE_FILE;
11
12
  export function workspaceName(value) {
12
13
  if (typeof value !== "string" ||
13
14
  looksLikeKey(value) ||
14
15
  !/^[a-z][a-z0-9_-]{0,63}$/.test(value))
15
16
  throw new Error("Workspace name must be 1–64 lowercase letters, digits, underscores or hyphens, starting with a letter.");
17
+ if (`${value}.json` === REPOSITORY_HOOK_STATE_FILE)
18
+ throw new Error("Workspace name is reserved for repository-hook state.");
16
19
  return value;
17
20
  }
18
21
  export function workspaceOrigin(value) {
@@ -334,7 +337,7 @@ export function saveWorkspace(context) {
334
337
  fs.mkdirSync(workspaceHome(), { recursive: true, mode: 0o700 });
335
338
  noLinks(workspaceHome());
336
339
  if (!fs.existsSync(file) &&
337
- workspaceEntries().filter((n) => /^[a-z][a-z0-9_-]{0,63}\.json$/.test(n))
340
+ workspaceEntries().filter(isContextFile)
338
341
  .length >= MAX_WORKSPACES)
339
342
  throw new Error("Workspace store is full; remove unused contexts before continuing.");
340
343
  writeWorkspaceFile(file, checked);
@@ -350,7 +353,7 @@ export function listWorkspaces() {
350
353
  const names = workspaceEntries();
351
354
  if (names.length > MAX_WORKSPACES * 3)
352
355
  throw new Error("Workspace store exceeds its entry bound.");
353
- const files = names.filter((n) => /^[a-z][a-z0-9_-]{0,63}\.json$/.test(n));
356
+ const files = names.filter(isContextFile);
354
357
  if (files.length > MAX_WORKSPACES)
355
358
  throw new Error("Workspace store exceeds 64 contexts.");
356
359
  return files
@@ -30,7 +30,7 @@ export function buildServer(ctx) {
30
30
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: manifestEntries(TOOLS) }));
31
31
  server.setRequestHandler(CallToolRequestSchema, async (req) => {
32
32
  const result = await callTool(req.params.name, (req.params.arguments ?? {}), ctx);
33
- if (["workspace_context", "bootstrap_workspace", "interpret_session", "read_session_events", "compare_sessions", "plan_next_session", "seed_grader_config", "get_grader_config", "update_grader_config", "publish_grader_config", "write_grader_config_artifact"].includes(req.params.name))
33
+ if (["workspace_context", "bootstrap_workspace", "interpret_session", "read_session_events", "compare_sessions", "plan_next_session", "discover_grader_checks", "backtest_grader_checks", "get_grader_run", "save_grader_draft", "seed_grader_config", "get_grader_config", "update_grader_config", "publish_grader_config", "write_grader_config_artifact"].includes(req.params.name))
34
34
  return boundedToolResponse(result);
35
35
  return {
36
36
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
package/dist/src/tools.js CHANGED
@@ -421,19 +421,21 @@ const GRADER_CHECK_PROP = obj({
421
421
  evidenceRequirement: { type: "string", enum: ["coverage_increase"] },
422
422
  createdFromActivityId: { type: "string", maxLength: 512 },
423
423
  components: { type: "array", minItems: 1, maxItems: 8, items: obj({ name: { type: "string", minLength: 1, maxLength: 120 }, matcherRule: GRADER_MATCHER_PROP, requireSuccess: { type: "boolean" } }, ["name", "matcherRule", "requireSuccess"]) },
424
- linkage: { type: "string", enum: ["signadot"], description: "Links a three-component composite's steps to one Signadot sandbox: the sandbox it was ready in, a request or test routed to it, and that run's result. Never before push. Keep it when re-saving a check read from get_grader_config; dropping it leaves an unlinked composite that any sandbox step and any request satisfy." },
424
+ linkage: { type: "string", enum: ["signadot"], description: "Links a three-component composite to recorded sandbox readiness, an exact routing key and declared endpoint, and a positive validation result. May be required before push after the final edit. Keep it when re-saving a check read from get_grader_config; dropping it leaves an unlinked composite." },
425
425
  }, ["id", "name", "category", "weight", "satisfactionMode", "minimumOccurrences", "aggregationMode", "enabled"]);
426
426
  function graderSchemaValid(value, schema) {
427
427
  if (schema.enum && !schema.enum.includes(value))
428
428
  return false;
429
429
  if (schema.type === "string")
430
430
  return typeof value === "string" && value.length >= (schema.minLength ?? 0) && value.length <= (schema.maxLength ?? Infinity) && (!schema.pattern || new RegExp(schema.pattern).test(value));
431
+ if (schema.type === "integer")
432
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= (schema.minimum ?? -Infinity) && value <= (schema.maximum ?? Infinity);
431
433
  if (schema.type === "number")
432
434
  return typeof value === "number" && Number.isFinite(value) && value >= (schema.minimum ?? -Infinity) && value <= (schema.maximum ?? Infinity);
433
435
  if (schema.type === "boolean")
434
436
  return typeof value === "boolean";
435
437
  if (schema.type === "array")
436
- return Array.isArray(value) && value.length >= (schema.minItems ?? 0) && value.length <= (schema.maxItems ?? Infinity) && value.every(item => graderSchemaValid(item, schema.items));
438
+ return Array.isArray(value) && value.length >= (schema.minItems ?? 0) && value.length <= (schema.maxItems ?? Infinity) && (!schema.uniqueItems || new Set(value).size === value.length) && value.every(item => graderSchemaValid(item, schema.items));
437
439
  if (schema.type === "object") {
438
440
  if (!value || typeof value !== "object" || Array.isArray(value))
439
441
  return false;
@@ -458,7 +460,7 @@ function graderMatcherValid(value) {
458
460
  return Object.keys(node).length === 1 && visit(node.not, depth + 1);
459
461
  if (++conditions > 64 || Object.keys(node).some(key => !["field", "operator", "value"].includes(key)))
460
462
  return false;
461
- if (!["source", "toolNamespace", "toolName", "operation", "executable", "packageScript", "packageScriptFamily", "normalizedArguments", "workingDirectory", "outcome", "exactFingerprint", "familyFingerprint"].includes(node.field) || !["equals", "in", "contains", "startsWith", "exists"].includes(node.operator))
463
+ if (!["source", "toolNamespace", "toolName", "operation", "executable", "packageScript", "packageScriptFamily", "normalizedArguments", "workingDirectory", "repositoryRelativeWorkingDirectory", "outcome", "exactFingerprint", "familyFingerprint"].includes(node.field) || !["equals", "in", "contains", "startsWith", "exists"].includes(node.operator))
462
464
  return false;
463
465
  if (node.operator === "exists")
464
466
  return node.value === undefined;
@@ -474,7 +476,7 @@ function graderCheckValid(value) {
474
476
  return false;
475
477
  if (value.components?.some((part) => !part.matcherRule?.include || !graderMatcherValid(part.matcherRule)))
476
478
  return false;
477
- if (value.linkage !== undefined && (value.satisfactionMode !== "composite" || value.components?.length !== 3 || value.beforePush))
479
+ if (value.linkage !== undefined && (value.satisfactionMode !== "composite" || value.components?.length !== 3))
478
480
  return false;
479
481
  return value.satisfactionMode === "composite" ? Boolean(value.components?.length) : Boolean(value.matcherRule?.include || value.detectorRule?.include);
480
482
  }
@@ -517,7 +519,48 @@ async function requestGrader(ctx, operation, body) {
517
519
  note: update ? "Saved the Grader draft. Use publish_grader_config with this revision to apply it to future scoring when the user wants publication. Existing published versions and scores are unchanged."
518
520
  : "Read every page needed before changing or publishing existing checks. Use revision as expectedRevision when saving or publishing. Draft checks affect scoring after publish_grader_config." };
519
521
  }
522
+ const GRADER_RUN_SELECTION = {
523
+ repository: { type: "string", minLength: 1, maxLength: 512, description: "Recorded repository label, as returned by search_sessions." },
524
+ features: { type: "string", minLength: 1, maxLength: 4000, description: "Grading focus, for example common tests and static analysis before pushing." },
525
+ days: { type: "integer", minimum: 1, maximum: 30, description: "History window; defaults to 30 days." },
526
+ cohort: { type: "string", enum: ["pull_requests", "substantive"], description: "Defaults to PR-producing sessions. substantive includes all sessions with observed work." },
527
+ };
528
+ const GRADER_RUN_ID = { type: "string", pattern: "^[a-f0-9-]{36}$" };
529
+ const GRADER_RUN_IDS = { type: "array", minItems: 1, maxItems: 30, uniqueItems: true, items: { type: "string", minLength: 1, maxLength: 128 } };
530
+ const GRADER_RUN_TOOLS = [
531
+ { name: "discover_grader_checks", title: "Discover Grader checks from history", route: "discover", required: ["repository", "features"], properties: GRADER_RUN_SELECTION,
532
+ description: "Discover common validation checks for a recorded repository and grading focus. The service selects PR-producing sessions (default), scans bounded canonical history asynchronously and ranks exact normalized commands by distinct sessions. Returns a runId; poll get_grader_run for candidates, package scope, provenance, ambiguities and coverage. No local files or scripts. Partial evidence never proves an absence. Does not change the Grader." },
533
+ { name: "backtest_grader_checks", title: "Backtest Grader checks", route: "backtest", required: [], properties: { ...GRADER_RUN_SELECTION, discoveryId: GRADER_RUN_ID, candidateIds: GRADER_RUN_IDS, draftRevision: { type: "string", pattern: "^[a-f0-9]{64}$" }, checkIds: GRADER_RUN_IDS },
534
+ description: "Start an asynchronous backtest using discoveryId plus candidateIds, or draftRevision plus checkIds and repository (optional days/cohort/features). Uses pinned recorded evidence and the live Grader evaluator. Poll get_grader_run for completion and after-last-edit/before-push timing separately, per-session evidence, unknown outcomes and coverage limits. Does not publish or rewrite historical scores." },
535
+ { name: "get_grader_run", title: "Read Grader discovery or backtest progress", route: "runs", required: ["runId"], properties: { runId: GRADER_RUN_ID, cursor: { type: "string", minLength: 1, maxLength: 32 } },
536
+ description: "Poll a Grader run and follow returned cursors for bounded result pages. Returns progress, pinned window/cohort/evaluator, ranked candidates or check summaries and per-session evidence. Follow summaryCursor for remaining check summaries, or draftChecksCursor to discover saved check IDs/names for backtesting with the returned draftRevision. Runs expire after 24 hours. Report partial, unknown and stale evidence explicitly; do not treat missing telemetry as a failed check. Access is checked on every call." },
537
+ { name: "save_grader_draft", title: "Save selected backtested Grader checks", route: "save-draft", required: ["backtestId", "candidateIds", "expectedRevision"], properties: { backtestId: GRADER_RUN_ID, candidateIds: GRADER_RUN_IDS, expectedRevision: { type: "string", pattern: "^[a-f0-9]{64}$" } },
538
+ description: "Save selected candidates from a completed backtest into the Grader draft, preserving unrelated checks. Use current draftRevision from get_grader_run, or read get_grader_config, for expectedRevision. Refuses changed revisions and unresolved package or operand ambiguities. Returns saved check IDs and a new draft revision. Requires Grader write permission. Does not publish, change enforcement or rewrite stored scores. Never automatically retry an uncertain save; read the draft first." },
539
+ ];
540
+ async function requestGraderRun(ctx, route, args) {
541
+ if (!ctx.session.hasKey())
542
+ return NO_KEY;
543
+ try {
544
+ const result = await graderConfigRequest({ key: ctx.session.useKey(), url: `${endpointsFor(ctx).agentGraderUrl}/${route}`, body: args, fetchImpl: ctx.fetchImpl });
545
+ if (result.ok)
546
+ return { ...result.config, ok: true };
547
+ const uncertain = route === "save-draft" && (result.httpStatus >= 500 || result.httpStatus < 300);
548
+ return { ok: false, error: uncertain ? "save_uncertain" : result.error ?? (result.httpStatus === 404 ? "not_supported" : "grader_unavailable"), message: uncertain ? "Read get_grader_config before retrying; the draft save may have completed." : result.message ?? "The Grader run request failed." };
549
+ }
550
+ catch {
551
+ return { ok: false, error: route === "save-draft" ? "save_uncertain" : route === "runs" ? "grader_unavailable" : "start_uncertain", message: route === "save-draft" ? "Read get_grader_config before retrying; the draft save may have completed." : "The Grader request could not be confirmed. Do not automatically repeat a start request." };
552
+ }
553
+ }
520
554
  export const TOOLS = [
555
+ ...GRADER_RUN_TOOLS.map(tool => ({
556
+ name: tool.name, title: tool.title, description: tool.description,
557
+ inputSchema: obj(tool.properties, [...tool.required]),
558
+ async handler(args, ctx) {
559
+ if (!graderSchemaValid(args, obj(tool.properties, [...tool.required])))
560
+ return { ok: false, error: "bad_input", message: "Pass only the fields in this Grader tool's schema." };
561
+ return requestGraderRun(ctx, tool.route, args);
562
+ },
563
+ })),
521
564
  ...workspaceTools,
522
565
  {
523
566
  name: "authenticate",
@@ -1,2 +1,2 @@
1
1
  export declare const MCP_SERVER_NAME = "codetelemetry";
2
- export declare const MCP_SERVER_VERSION = "0.5.0";
2
+ export declare const MCP_SERVER_VERSION = "0.6.0";
@@ -1,2 +1,2 @@
1
1
  export const MCP_SERVER_NAME = "codetelemetry";
2
- export const MCP_SERVER_VERSION = "0.5.0";
2
+ export const MCP_SERVER_VERSION = "0.6.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codetelemetry/mcp",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "CodeTelemetry MCP server \u2014 lets a coding agent onboard a user end to end: authenticate (device code), obtain an ingest key, write the Claude Code OTEL config, send a test event, and confirm telemetry landed \u2014 then search, read, interpret and compare the user's own coding sessions, plan the next one, and size tasks, plans and Linear issues from that history. The plaintext key never enters the model's context.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,9 +1,175 @@
1
1
  {
2
2
  "serverName": "codetelemetry",
3
- "serverVersion": "0.5.0",
4
- "registryHash": "02a9df0bc3beeaca326034cb7ed4584556d52b76746506ad0ecc3ee2193554ab",
5
- "toolCount": 30,
3
+ "serverVersion": "0.6.0",
4
+ "registryHash": "491c37a8f144fa1418e3e3ae091e6aac3ace57ef09a675169920d229dda83c7a",
5
+ "toolCount": 34,
6
6
  "tools": [
7
+ {
8
+ "name": "discover_grader_checks",
9
+ "title": "Discover Grader checks from history",
10
+ "description": "Discover common validation checks for a recorded repository and grading focus. The service selects PR-producing sessions (default), scans bounded canonical history asynchronously and ranks exact normalized commands by distinct sessions. Returns a runId; poll get_grader_run for candidates, package scope, provenance, ambiguities and coverage. No local files or scripts. Partial evidence never proves an absence. Does not change the Grader.",
11
+ "inputSchema": {
12
+ "type": "object",
13
+ "properties": {
14
+ "repository": {
15
+ "type": "string",
16
+ "minLength": 1,
17
+ "maxLength": 512,
18
+ "description": "Recorded repository label, as returned by search_sessions."
19
+ },
20
+ "features": {
21
+ "type": "string",
22
+ "minLength": 1,
23
+ "maxLength": 4000,
24
+ "description": "Grading focus, for example common tests and static analysis before pushing."
25
+ },
26
+ "days": {
27
+ "type": "integer",
28
+ "minimum": 1,
29
+ "maximum": 30,
30
+ "description": "History window; defaults to 30 days."
31
+ },
32
+ "cohort": {
33
+ "type": "string",
34
+ "enum": [
35
+ "pull_requests",
36
+ "substantive"
37
+ ],
38
+ "description": "Defaults to PR-producing sessions. substantive includes all sessions with observed work."
39
+ }
40
+ },
41
+ "required": [
42
+ "repository",
43
+ "features"
44
+ ],
45
+ "additionalProperties": false
46
+ }
47
+ },
48
+ {
49
+ "name": "backtest_grader_checks",
50
+ "title": "Backtest Grader checks",
51
+ "description": "Start an asynchronous backtest using discoveryId plus candidateIds, or draftRevision plus checkIds and repository (optional days/cohort/features). Uses pinned recorded evidence and the live Grader evaluator. Poll get_grader_run for completion and after-last-edit/before-push timing separately, per-session evidence, unknown outcomes and coverage limits. Does not publish or rewrite historical scores.",
52
+ "inputSchema": {
53
+ "type": "object",
54
+ "properties": {
55
+ "repository": {
56
+ "type": "string",
57
+ "minLength": 1,
58
+ "maxLength": 512,
59
+ "description": "Recorded repository label, as returned by search_sessions."
60
+ },
61
+ "features": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "maxLength": 4000,
65
+ "description": "Grading focus, for example common tests and static analysis before pushing."
66
+ },
67
+ "days": {
68
+ "type": "integer",
69
+ "minimum": 1,
70
+ "maximum": 30,
71
+ "description": "History window; defaults to 30 days."
72
+ },
73
+ "cohort": {
74
+ "type": "string",
75
+ "enum": [
76
+ "pull_requests",
77
+ "substantive"
78
+ ],
79
+ "description": "Defaults to PR-producing sessions. substantive includes all sessions with observed work."
80
+ },
81
+ "discoveryId": {
82
+ "type": "string",
83
+ "pattern": "^[a-f0-9-]{36}$"
84
+ },
85
+ "candidateIds": {
86
+ "type": "array",
87
+ "minItems": 1,
88
+ "maxItems": 30,
89
+ "uniqueItems": true,
90
+ "items": {
91
+ "type": "string",
92
+ "minLength": 1,
93
+ "maxLength": 128
94
+ }
95
+ },
96
+ "draftRevision": {
97
+ "type": "string",
98
+ "pattern": "^[a-f0-9]{64}$"
99
+ },
100
+ "checkIds": {
101
+ "type": "array",
102
+ "minItems": 1,
103
+ "maxItems": 30,
104
+ "uniqueItems": true,
105
+ "items": {
106
+ "type": "string",
107
+ "minLength": 1,
108
+ "maxLength": 128
109
+ }
110
+ }
111
+ },
112
+ "additionalProperties": false
113
+ }
114
+ },
115
+ {
116
+ "name": "get_grader_run",
117
+ "title": "Read Grader discovery or backtest progress",
118
+ "description": "Poll a Grader run and follow returned cursors for bounded result pages. Returns progress, pinned window/cohort/evaluator, ranked candidates or check summaries and per-session evidence. Follow summaryCursor for remaining check summaries, or draftChecksCursor to discover saved check IDs/names for backtesting with the returned draftRevision. Runs expire after 24 hours. Report partial, unknown and stale evidence explicitly; do not treat missing telemetry as a failed check. Access is checked on every call.",
119
+ "inputSchema": {
120
+ "type": "object",
121
+ "properties": {
122
+ "runId": {
123
+ "type": "string",
124
+ "pattern": "^[a-f0-9-]{36}$"
125
+ },
126
+ "cursor": {
127
+ "type": "string",
128
+ "minLength": 1,
129
+ "maxLength": 32
130
+ }
131
+ },
132
+ "required": [
133
+ "runId"
134
+ ],
135
+ "additionalProperties": false
136
+ }
137
+ },
138
+ {
139
+ "name": "save_grader_draft",
140
+ "title": "Save selected backtested Grader checks",
141
+ "description": "Save selected candidates from a completed backtest into the Grader draft, preserving unrelated checks. Use current draftRevision from get_grader_run, or read get_grader_config, for expectedRevision. Refuses changed revisions and unresolved package or operand ambiguities. Returns saved check IDs and a new draft revision. Requires Grader write permission. Does not publish, change enforcement or rewrite stored scores. Never automatically retry an uncertain save; read the draft first.",
142
+ "inputSchema": {
143
+ "type": "object",
144
+ "properties": {
145
+ "backtestId": {
146
+ "type": "string",
147
+ "pattern": "^[a-f0-9-]{36}$"
148
+ },
149
+ "candidateIds": {
150
+ "type": "array",
151
+ "minItems": 1,
152
+ "maxItems": 30,
153
+ "uniqueItems": true,
154
+ "items": {
155
+ "type": "string",
156
+ "minLength": 1,
157
+ "maxLength": 128
158
+ }
159
+ },
160
+ "expectedRevision": {
161
+ "type": "string",
162
+ "pattern": "^[a-f0-9]{64}$"
163
+ }
164
+ },
165
+ "required": [
166
+ "backtestId",
167
+ "candidateIds",
168
+ "expectedRevision"
169
+ ],
170
+ "additionalProperties": false
171
+ }
172
+ },
7
173
  {
8
174
  "name": "bootstrap_workspace",
9
175
  "title": "Create or resume a workspace setup",
@@ -1319,7 +1485,7 @@
1319
1485
  "enum": [
1320
1486
  "signadot"
1321
1487
  ],
1322
- "description": "Links a three-component composite's steps to one Signadot sandbox: the sandbox it was ready in, a request or test routed to it, and that run's result. Never before push. Keep it when re-saving a check read from get_grader_config; dropping it leaves an unlinked composite that any sandbox step and any request satisfy."
1488
+ "description": "Links a three-component composite to recorded sandbox readiness, an exact routing key and declared endpoint, and a positive validation result. May be required before push after the final edit. Keep it when re-saving a check read from get_grader_config; dropping it leaves an unlinked composite."
1323
1489
  }
1324
1490
  },
1325
1491
  "required": [
@@ -1581,7 +1747,7 @@
1581
1747
  "enum": [
1582
1748
  "signadot"
1583
1749
  ],
1584
- "description": "Links a three-component composite's steps to one Signadot sandbox: the sandbox it was ready in, a request or test routed to it, and that run's result. Never before push. Keep it when re-saving a check read from get_grader_config; dropping it leaves an unlinked composite that any sandbox step and any request satisfy."
1750
+ "description": "Links a three-component composite to recorded sandbox readiness, an exact routing key and declared endpoint, and a positive validation result. May be required before push after the final edit. Keep it when re-saving a check read from get_grader_config; dropping it leaves an unlinked composite."
1585
1751
  }
1586
1752
  },
1587
1753
  "required": [