@martinloop/mcp 0.5.7 → 0.5.8

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.
@@ -1 +1 @@
1
- export declare const MARTIN_MCP_PACKAGE_VERSION = "0.5.7";
1
+ export declare const MARTIN_MCP_PACKAGE_VERSION = "0.5.8";
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by build — do not edit by hand.
2
2
  // Source of truth: packages/mcp/package.json#version
3
- export const MARTIN_MCP_PACKAGE_VERSION = "0.5.7";
3
+ export const MARTIN_MCP_PACKAGE_VERSION = "0.5.8";
@@ -1,3 +1,4 @@
1
+ import { spawnSync } from "node:child_process";
1
2
  import { DEFAULT_AGENT_EXECUTION_INTENT, normalizeProviderExecutionTimeoutMs, appendLoopEvent, createLoopRecord } from "../contracts/index.js";
2
3
  import { classifyFailure, computeEvidenceVector, evaluatePatchDecision, evaluateCostGovernor, evaluateBudgetPreflight, inferExit, nextPolicyPhase, policyPhaseToLifecycleState, scorePatchDecision, selectRecoveryRecipe } from "./policy.js";
3
4
  import { evaluateChangeApprovalLeash, evaluateFilesystemLeash, evaluateSecretLeash, redactSecretsFromText, resolveExecutionProfile, evaluateVerificationLeash } from "./leash.js";
@@ -1135,7 +1136,7 @@ export async function runMartin(input) {
1135
1136
  // VERIFY: Run grounding scan on patch diff if available
1136
1137
  // Uses the task's repoRoot to build/load the grounding index, then scans any diff
1137
1138
  let groundingScanResult;
1138
- const patchDiff = buildPatchDiff(result, changedFiles);
1139
+ const patchDiff = buildPatchDiff(result, changedFiles, input.task.repoRoot);
1139
1140
  if (patchDiff && input.task.repoRoot) {
1140
1141
  try {
1141
1142
  const groundingIndex = await loadOrBuildRepoGroundingIndex(input.task.repoRoot);
@@ -1568,21 +1569,35 @@ function resolveChangedFiles(result, repoRoot, rollbackBoundary) {
1568
1569
  }
1569
1570
  return listAttemptChangedFilesSinceBoundary({ repoRoot, boundary: rollbackBoundary });
1570
1571
  }
1571
- function buildPatchDiff(result, changedFiles) {
1572
+ function buildPatchDiff(result, changedFiles, repoRoot) {
1572
1573
  // Use structured diff stats to build a minimal diff header if no raw diff is available
1573
- if (result.execution?.changedFiles?.length) {
1574
- // Build a synthetic diff header from changed file list
1575
- return result.execution.changedFiles
1576
- .map((file) => `--- a/${file}\n+++ b/${file}\n@@ -0,0 +1 @@\n+`)
1577
- .join("\n");
1578
- }
1579
- if (changedFiles.length > 0) {
1580
- return changedFiles
1581
- .map((file) => `--- a/${file}\n+++ b/${file}\n@@ -0,0 +1 @@\n+`)
1574
+ const files = result.execution?.changedFiles?.length ? result.execution.changedFiles : changedFiles;
1575
+ if (files.length > 0) {
1576
+ return files
1577
+ .map((file) => buildSyntheticDiffHeader(file, repoRoot))
1582
1578
  .join("\n");
1583
1579
  }
1584
1580
  return undefined;
1585
1581
  }
1582
+ function buildSyntheticDiffHeader(file, repoRoot) {
1583
+ const normalizedFile = file.replace(/\\/gu, "/");
1584
+ const isNewWorkspaceFile = repoRoot ? isUntrackedWorkspaceFile(repoRoot, normalizedFile) : false;
1585
+ const before = isNewWorkspaceFile ? "/dev/null" : `a/${normalizedFile}`;
1586
+ return `--- ${before}\n+++ b/${normalizedFile}\n@@ -0,0 +1 @@\n+`;
1587
+ }
1588
+ function isUntrackedWorkspaceFile(repoRoot, file) {
1589
+ const result = spawnSync("git", ["ls-files", "--others", "--exclude-standard", "--", file], {
1590
+ cwd: repoRoot,
1591
+ encoding: "utf8"
1592
+ });
1593
+ if (result.status !== 0 || typeof result.stdout !== "string") {
1594
+ return false;
1595
+ }
1596
+ return result.stdout
1597
+ .split(/\r?\n/u)
1598
+ .map((line) => line.trim().replace(/\\/gu, "/"))
1599
+ .includes(file);
1600
+ }
1586
1601
  function createBudgetSettlement(input) {
1587
1602
  const totalActualUsd = getUsageUsd(input.usage);
1588
1603
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@martinloop/mcp",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "mcpName": "io.github.Keesan12/martin-loop",
5
5
  "private": false,
6
6
  "type": "module",
@@ -41,6 +41,11 @@
41
41
  "martin-loop-mcp": "./dist/server.js"
42
42
  },
43
43
  "exports": {
44
+ ".": {
45
+ "types": "./dist/server.d.ts",
46
+ "import": "./dist/server.js",
47
+ "default": "./dist/server.js"
48
+ },
44
49
  "./server.json": "./server.json",
45
50
  "./package.json": "./package.json"
46
51
  },
@@ -74,12 +79,12 @@
74
79
  "mcpb:smoke": "node ./mcpb/smoke-mcpb.mjs"
75
80
  },
76
81
  "dependencies": {
77
- "@modelcontextprotocol/sdk": "^1.29.0",
82
+ "@modelcontextprotocol/sdk": "1.29.0",
78
83
  "@open-policy-agent/opa-wasm": "^1.10.0",
79
- "@opentelemetry/api-logs": "^0.214.0",
80
- "@opentelemetry/exporter-logs-otlp-http": "^0.214.0",
81
- "@opentelemetry/resources": "^2.6.1",
82
- "@opentelemetry/sdk-logs": "^0.214.0",
84
+ "@opentelemetry/api-logs": "^0.221.0",
85
+ "@opentelemetry/exporter-logs-otlp-http": "^0.221.0",
86
+ "@opentelemetry/resources": "^2.10.0",
87
+ "@opentelemetry/sdk-logs": "^0.221.0",
83
88
  "ts-morph": "^21.0.0"
84
89
  },
85
90
  "devDependencies": {
@@ -87,4 +92,4 @@
87
92
  "@martin/contracts": "workspace:*",
88
93
  "@martin/presentation": "workspace:*"
89
94
  }
90
- }
95
+ }
package/server.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "url": "https://github.com/Keesan12/martin-loop",
8
8
  "source": "github"
9
9
  },
10
- "version": "0.5.7",
10
+ "version": "0.5.8",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "@martinloop/mcp",
15
- "version": "0.5.7",
15
+ "version": "0.5.8",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  }