@codeconductorai/harmony-mcp 1.0.19 → 1.0.21

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
@@ -27,12 +27,12 @@ Re-run `node -v` afterwards to confirm before continuing.
27
27
 
28
28
  ## Installation
29
29
 
30
- The server is published as `@codeconductorai/harmony-mcp` and run via `npx`, so no local build step is required. The commands below pin an exact version (`@1.0.19`) rather than a floating tag — this lets `npx` reuse its local cache instead of re-resolving the package from the registry on every agent startup, which otherwise makes MCP initialization noticeably slower (and occasionally hang). Bump the pinned version deliberately when you want to upgrade.
30
+ The server is published as `@codeconductorai/harmony-mcp` and run via `npx`, so no local build step is required. The commands below pin an exact version (`@1.0.21`) rather than a floating tag — this lets `npx` reuse its local cache instead of re-resolving the package from the registry on every agent startup, which otherwise makes MCP initialization noticeably slower (and occasionally hang). Bump the pinned version deliberately when you want to upgrade.
31
31
 
32
32
  ### Claude Code
33
33
 
34
34
  ```bash
35
- claude mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.19
35
+ claude mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.21
36
36
  ```
37
37
 
38
38
  ### Antigravity
@@ -47,7 +47,7 @@ Open **MCP Servers → Manage MCP Servers → View raw config** from the agent p
47
47
  "mcpServers": {
48
48
  "harmony": {
49
49
  "command": "npx",
50
- "args": ["-y", "@codeconductorai/harmony-mcp@1.0.19"]
50
+ "args": ["-y", "@codeconductorai/harmony-mcp@1.0.21"]
51
51
  }
52
52
  }
53
53
  }
@@ -58,7 +58,7 @@ Restart Antigravity (or reload MCP servers) after saving.
58
58
  ### Codex CLI
59
59
 
60
60
  ```bash
61
- codex mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.19
61
+ codex mcp add harmony -- npx -y @codeconductorai/harmony-mcp@1.0.21
62
62
  ```
63
63
 
64
64
  This writes the entry to `~/.codex/config.toml`. To add it by hand instead:
@@ -66,7 +66,7 @@ This writes the entry to `~/.codex/config.toml`. To add it by hand instead:
66
66
  ```toml
67
67
  [mcp_servers.harmony]
68
68
  command = "npx"
69
- args = ["-y", "@codeconductorai/harmony-mcp@1.0.19"]
69
+ args = ["-y", "@codeconductorai/harmony-mcp@1.0.21"]
70
70
  ```
71
71
 
72
72
  ### Aria
@@ -78,7 +78,7 @@ In the Aria Code panel, click the settings icon → **MCP Servers**, then scroll
78
78
  "mcpServers": {
79
79
  "harmony": {
80
80
  "command": "npx",
81
- "args": ["-y", "@codeconductorai/harmony-mcp@1.0.19"]
81
+ "args": ["-y", "@codeconductorai/harmony-mcp@1.0.21"]
82
82
  }
83
83
  }
84
84
  }
@@ -95,7 +95,7 @@ Any client that reads a `command`/`args` style config (e.g. Claude Desktop's `cl
95
95
  "mcpServers": {
96
96
  "harmony": {
97
97
  "command": "npx",
98
- "args": ["-y", "@codeconductorai/harmony-mcp@1.0.19"]
98
+ "args": ["-y", "@codeconductorai/harmony-mcp@1.0.21"]
99
99
  }
100
100
  }
101
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeconductorai/harmony-mcp",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -119,7 +119,7 @@ export async function setupWorkspace(workspaceId, language, buildTool) {
119
119
  }
120
120
 
121
121
  // POST /api/v1/index/zip — upload a zipped snapshot of the workspace for full indexing.
122
- export async function uploadWorkspace(zipPath, workspaceId, language, buildTool) {
122
+ export async function uploadWorkspace(zipPath, workspaceId, language, buildTool, phase = "HEURISTICGRAPH") {
123
123
  try {
124
124
  const form = new FormData();
125
125
 
@@ -132,6 +132,7 @@ export async function uploadWorkspace(zipPath, workspaceId, language, buildTool)
132
132
  form.append("buildIndex", "false"); // false so scip-ns is used
133
133
  form.append("language", language);
134
134
  if (buildTool) form.append("buildTool", buildTool);
135
+ form.append("phase", phase);
135
136
 
136
137
  // Field name must be "file" per @RequestPart("file")
137
138
  form.append("file", fs.createReadStream(zipPath), { filename: "workspace.zip", contentType: "application/zip" });
@@ -206,9 +207,11 @@ export async function ensureWorkspaceUploaded(language, buildTool) {
206
207
  }
207
208
 
208
209
  if (!marker.upload?.done || staleSnapshot) {
210
+ // First-ever upload is LEXICAL; HEURISTICGRAPH follows via advanceToHeuristicGraphPhase.
211
+ const phase = marker.upload?.done ? "HEURISTICGRAPH" : "LEXICAL";
209
212
  const zipFile = await zipWorkspace();
210
- const result = await uploadWorkspace(zipFile, workspaceId, lang, tool);
211
- marker.upload = { done: true, status: result.status, response: result.response };
213
+ const result = await uploadWorkspace(zipFile, workspaceId, lang, tool, phase);
214
+ marker.upload = { done: true, phase, status: result.status, response: result.response };
212
215
  marker.commitHash = currentCommit;
213
216
  writeMarker(marker);
214
217
  }
@@ -216,6 +219,21 @@ export async function ensureWorkspaceUploaded(language, buildTool) {
216
219
  return { resynced: staleSnapshot };
217
220
  }
218
221
 
222
+ // Second pass, sent once LEXICAL reaches a terminal status. Callers fire this without awaiting it
223
+ // so the initial request can complete as soon as LEXICAL is done — the phase flag flips
224
+ // synchronously (before any await below) so a concurrent call can't re-trigger it in the meantime.
225
+ export async function advanceToHeuristicGraphPhase(marker) {
226
+ marker.upload = { ...marker.upload, phase: "HEURISTICGRAPH" };
227
+ writeMarker(marker);
228
+
229
+ const { workspaceId, language, buildTool } = marker;
230
+ const zipFile = await zipWorkspace();
231
+ const result = await uploadWorkspace(zipFile, workspaceId, language, buildTool, "HEURISTICGRAPH");
232
+ marker.upload = { done: true, phase: "HEURISTICGRAPH", status: result.status, response: result.response };
233
+ writeMarker(marker);
234
+ return marker;
235
+ }
236
+
219
237
  // Statuses that won't change on their own without a new upload — safe to stop polling at.
220
238
  const TERMINAL_STATUSES = new Set([
221
239
  "TEXT_AND_SYMBOLS_COMPLETE",
@@ -241,6 +259,14 @@ async function fetchWorkspaceStatus(workspaceId) {
241
259
  return match ? match[1].trim() : null;
242
260
  }
243
261
 
262
+ export function isTerminalIndexStatus(status) {
263
+ return Boolean(status) && TERMINAL_STATUSES.has(status);
264
+ }
265
+
266
+ export function isFailedIndexStatus(status) {
267
+ return status === "CORRUPTED";
268
+ }
269
+
244
270
  // onTick(status, elapsedMs), if given, is called after every check — lets the caller (e.g. a
245
271
  // progress notification) report "still waiting" without pollWorkspaceStatus knowing about MCP.
246
272
  export async function pollWorkspaceStatus(workspaceId, { maxWaitMs = 120_000, intervalMs = 3000, onTick } = {}) {
@@ -360,6 +386,7 @@ export async function sendFileUpdate(filePath, workspaceId, language, buildTool)
360
386
  if (buildTool) {
361
387
  form.append("buildTool", buildTool);
362
388
  }
389
+ form.append("phase", "HEURISTICGRAPH");
363
390
 
364
391
  // Field names must match @RequestPart("files") and @RequestParam("paths")
365
392
  form.append("files", fs.createReadStream(filePath), { filename: path.basename(filePath) });
package/src/server.js CHANGED
@@ -22,6 +22,9 @@ import { readMarker, writeMarker } from "./workspaceMarker.js";
22
22
  import { startFileWatcher, isFileWatcherActive } from "./fileWatcher.js";
23
23
  import {
24
24
  ensureWorkspaceUploaded,
25
+ advanceToHeuristicGraphPhase,
26
+ isTerminalIndexStatus,
27
+ isFailedIndexStatus,
25
28
  pollWorkspaceStatus,
26
29
  callHarmonySearchEndpoint,
27
30
  fetchContextBundle,
@@ -180,6 +183,20 @@ function describeIndexOutcome(indexStatus, workspaceId) {
180
183
  };
181
184
  }
182
185
 
186
+ // Once LEXICAL reaches a terminal status, kick off HEURISTICGRAPH in the background — the current
187
+ // call returns on the LEXICAL result rather than waiting on it. Gated on marker.upload.phase, so
188
+ // this fires only once per workspace.
189
+ async function maybeAdvanceToHeuristicPhase(marker, indexStatus, { extra }) {
190
+ if (!marker || marker.upload?.phase !== "LEXICAL") return indexStatus;
191
+ if (!isTerminalIndexStatus(indexStatus) || isFailedIndexStatus(indexStatus)) return indexStatus;
192
+
193
+ await sendProgress(extra, `Lexical indexing complete for "${getProjectName()}" — heuristic graph indexing started in the background.`);
194
+ advanceToHeuristicGraphPhase(marker).catch((error) =>
195
+ log(`[setup_workspace] Heuristic graph phase failed: ${error.message}`)
196
+ );
197
+ return indexStatus;
198
+ }
199
+
183
200
  async function handleSetupWorkspace(args, extra) {
184
201
  const { language, buildTool } = args;
185
202
  const startedAt = Date.now();
@@ -198,10 +215,11 @@ async function handleSetupWorkspace(args, extra) {
198
215
  startFileWatcher();
199
216
  // Short bound: a marker already reporting "uploaded" should already have a terminal backend
200
217
  // status from a prior call — this just confirms it rather than waiting out the full window.
201
- const indexStatus = await pollWorkspaceStatus(existingMarker.workspaceId, {
218
+ let indexStatus = await pollWorkspaceStatus(existingMarker.workspaceId, {
202
219
  maxWaitMs: Math.min(15_000, remainingBudgetMs()),
203
220
  onTick: onPollTick,
204
221
  });
222
+ indexStatus = await maybeAdvanceToHeuristicPhase(existingMarker, indexStatus, { extra });
205
223
  persistIndexStatus(existingMarker, indexStatus);
206
224
  const outcome = describeIndexOutcome(indexStatus, existingMarker.workspaceId);
207
225
  return jsonContent({
@@ -238,10 +256,11 @@ async function handleSetupWorkspace(args, extra) {
238
256
  // repos) is what we spend waiting on the backend's real indexing status — "done" should mean the
239
257
  // backend actually agrees, not just that the upload HTTP call returned, but the call must still
240
258
  // return before an MCP host's own tool-call timeout fires.
241
- const indexStatus = await pollWorkspaceStatus(marker?.workspaceId, {
259
+ let indexStatus = await pollWorkspaceStatus(marker?.workspaceId, {
242
260
  maxWaitMs: remainingBudgetMs(),
243
261
  onTick: onPollTick,
244
262
  });
263
+ indexStatus = await maybeAdvanceToHeuristicPhase(marker, indexStatus, { extra });
245
264
  persistIndexStatus(marker, indexStatus);
246
265
  const outcome = describeIndexOutcome(indexStatus, marker?.workspaceId);
247
266