@codazen/harmonica-mcp 3.9.4 → 4.0.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.
Files changed (2) hide show
  1. package/dist/index.js +172 -168
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22459,8 +22459,9 @@ function registerBeatPlanningTools(server, ctx, client) {
22459
22459
 
22460
22460
  // ../../libs/harmonica-services/src/mcp/check.constants.ts
22461
22461
  var CHECK_MAX_SCORES = {
22462
+ coda_quality: 5,
22463
+ // Legacy names for coda_quality — kept until every caller passes the new name (N-4E09-6779).
22462
22464
  beat_coda_quality: 5,
22463
- // Legacy name for beat_coda_quality — kept until every caller passes the new name (N-4E09-6779).
22464
22465
  beat_quality: 5,
22465
22466
  beat_version_quality: 5,
22466
22467
  // Legacy name for beat_version_quality — kept until every caller passes the new name.
@@ -22514,7 +22515,7 @@ ${d.rationale}${d.suggestions?.length ? `
22514
22515
  ).join("\n\n");
22515
22516
  return [
22516
22517
  `## Beat Coda Quality Check \u2014 ${check2.targetId}`,
22517
- `**Overall Score:** ${check2.overallScore}/${CHECK_MAX_SCORES.beat_coda_quality}`,
22518
+ `**Overall Score:** ${check2.overallScore}/${CHECK_MAX_SCORES.coda_quality}`,
22518
22519
  `**Summary:** ${check2.summary}`,
22519
22520
  check2.topSuggestion ? `**Top Suggestion:** ${check2.topSuggestion}` : "",
22520
22521
  "",
@@ -22550,20 +22551,22 @@ Use get_job_status with jobId="${taskId}" to poll for results, or list_checks to
22550
22551
  }
22551
22552
  };
22552
22553
  server.tool(
22553
- "check_beat_coda_quality",
22554
- "Enqueue a Beat definition quality check across 7 dimensions (Distinctive, Harmonious, Substantial, Durable, Clear, Strategically Aligned, Outcome-Oriented) \u2014 grades the Beat's Coda and directing context, persisted as beat_coda_quality. By default returns a jobId immediately (fire-and-forget) \u2014 use get_job_status or list_checks to retrieve results. Set wait=true to block until the check completes and receive the scorecard inline. WARNING: wait=true holds the MCP session open for 30\u201360s per check \u2014 for bulk operations (more than one Beat), omit wait and poll get_job_status separately to avoid session exhaustion.",
22554
+ "check_coda_quality",
22555
+ "Enqueue a Coda quality check across 7 dimensions (Distinctive, Harmonious, Substantial, Durable, Clear, Strategically Aligned, Outcome-Oriented) \u2014 grades the Beat's Coda and directing context, persisted as coda_quality. By default returns a jobId immediately (fire-and-forget) \u2014 use get_job_status or list_checks to retrieve results. Set wait=true to block until the check completes and receive the scorecard inline. WARNING: wait=true holds the MCP session open for 30\u201360s per check \u2014 for bulk operations (more than one Beat), omit wait and poll get_job_status separately to avoid session exhaustion.",
22555
22556
  schema,
22556
22557
  handler
22557
22558
  );
22558
- server.tool(
22559
- "check_beat_quality",
22560
- "DEPRECATED \u2014 renamed to check_beat_coda_quality (the check grades the Beat's definition: its Coda and directing context). This alias runs the same check and persists it as beat_coda_quality. Prefer check_beat_coda_quality.",
22561
- schema,
22562
- async (args) => {
22563
- console.warn("[deprecated-tool] check_beat_quality invoked \u2014 use check_beat_coda_quality (N-4E09-6779)");
22564
- return handler(args);
22565
- }
22566
- );
22559
+ for (const legacyName of ["check_beat_coda_quality", "check_beat_quality"]) {
22560
+ server.tool(
22561
+ legacyName,
22562
+ `DEPRECATED \u2014 renamed to check_coda_quality (one instrument scores any Coda that has a parent, so the name no longer states an altitude). This alias runs the same check and persists it as coda_quality. Prefer check_coda_quality.`,
22563
+ schema,
22564
+ async (args) => {
22565
+ console.warn(`[deprecated-tool] ${legacyName} invoked \u2014 use check_coda_quality (N-4E09-6779)`);
22566
+ return handler(args);
22567
+ }
22568
+ );
22569
+ }
22567
22570
  }
22568
22571
 
22569
22572
  // ../../libs/harmonica-services/src/mcp/tools/beat-reframe-tools.ts
@@ -23562,9 +23565,9 @@ function registerBeatVersionTools(server, ctx, client) {
23562
23565
  );
23563
23566
  server.tool(
23564
23567
  "plan_beat_versions",
23565
- "Agent-decompose a composed Beat into 2-5 planning-state Beat Versions on the path to the Coda. Uses the Beat's Coda, project strategy, sibling Beats, Notes, and codebase grep as context. Requires a recent passing beat_coda_quality check (run check_beat_coda_quality first if needed). Idempotent: refuses when planned BVs already exist on the Beat unless force=true is set.",
23568
+ "Agent-decompose a composed Beat into 2-5 planning-state Beat Versions on the path to the Coda. Uses the Beat's Coda, project strategy, sibling Beats, Notes, and codebase grep as context. Requires a recent passing coda_quality check (run check_coda_quality first if needed). Idempotent: refuses when planned BVs already exist on the Beat unless force=true is set.",
23566
23569
  {
23567
- beatId: external_exports.string().describe("The Beat ID to decompose (must have a Coda and a passing beat_coda_quality check)"),
23570
+ beatId: external_exports.string().describe("The Beat ID to decompose (must have a Coda and a passing coda_quality check)"),
23568
23571
  force: external_exports.boolean().optional().describe("Bypass the idempotency guard and plan additional Beat Versions even when prior planned BVs are still active")
23569
23572
  },
23570
23573
  async ({ beatId, force }) => {
@@ -23823,7 +23826,7 @@ function registerCheckTools(server, ctx, client) {
23823
23826
  beatId: external_exports.string().optional().describe("List checks for this specific beat"),
23824
23827
  beatVersionId: external_exports.string().optional().describe("List checks for this specific beat version"),
23825
23828
  revisionId: external_exports.string().optional().describe("List checks for this specific revision"),
23826
- checkType: external_exports.enum(["beat_coda_quality", "beat_quality", "beat_version_quality", "plan_quality", "build_quality", "pii_scan", "portfolio_coherence"]).optional().describe("Filter by check type. beat_quality is the DEPRECATED alias of beat_coda_quality. plan_quality is the DEPRECATED alias of beat_version_quality. pii_scan is RETIRED from the taxonomy (PII detection moved to the Scan family, N-4E09-6809) \u2014 it is still accepted here so historical records stay readable, but no new pii_scan checks are written.")
23829
+ checkType: external_exports.enum(["coda_quality", "beat_coda_quality", "beat_quality", "beat_version_quality", "plan_quality", "build_quality", "pii_scan", "portfolio_coherence"]).optional().describe("Filter by check type. beat_coda_quality and beat_quality are DEPRECATED aliases of coda_quality. plan_quality is the DEPRECATED alias of beat_version_quality. pii_scan is RETIRED from the taxonomy (PII detection moved to the Scan family, N-4E09-6809) \u2014 it is still accepted here so historical records stay readable, but no new pii_scan checks are written.")
23827
23830
  },
23828
23831
  async ({ systemId, beatId, beatVersionId, revisionId, checkType }) => {
23829
23832
  try {
@@ -23950,10 +23953,10 @@ function registerCheckTools(server, ctx, client) {
23950
23953
  );
23951
23954
  server.tool(
23952
23955
  "run_check",
23953
- "Run a check on a Beat or Beat Version. beat_coda_quality: 7-dimension Beat definition quality (1-5) \u2014 grades the Coda and directing context, target a beatId (beat_quality is its DEPRECATED alias and persists under the new name). beat_version_quality: 7-dimension plan quality (1-5) including completeness, target a Beat Version (bv-*) \u2014 plan_quality is its DEPRECATED alias. build_quality: 9-dimension engineering assessment (1-5), target a Beat Version (bv-*) \u2014 build_quality moved from the Revision to the Beat Version, so it grades the planned capability against the codebase and runs even when the Beat Version has no Revisions yet.",
23956
+ "Run a check on a Beat or Beat Version. coda_quality: 7-dimension Coda quality (1-5) \u2014 grades the Coda and directing context, target a beatId (beat_coda_quality and beat_quality are DEPRECATED aliases and persist under the new name). beat_version_quality: 7-dimension plan quality (1-5) including completeness, target a Beat Version (bv-*) \u2014 plan_quality is its DEPRECATED alias. build_quality: 9-dimension engineering assessment (1-5), target a Beat Version (bv-*) \u2014 build_quality moved from the Revision to the Beat Version, so it grades the planned capability against the codebase and runs even when the Beat Version has no Revisions yet.",
23954
23957
  {
23955
- checkType: external_exports.enum(["beat_coda_quality", "beat_quality", "beat_version_quality", "plan_quality", "build_quality"]).describe("Type of check to run. beat_quality is the deprecated alias of beat_coda_quality. plan_quality is the deprecated alias of beat_version_quality."),
23956
- targetId: external_exports.string().describe("The target entity ID \u2014 a beatId for beat_coda_quality, or a Beat Version ID (bv-*) for beat_version_quality and build_quality"),
23958
+ checkType: external_exports.enum(["coda_quality", "beat_coda_quality", "beat_quality", "beat_version_quality", "plan_quality", "build_quality"]).describe("Type of check to run. beat_coda_quality and beat_quality are deprecated aliases of coda_quality. plan_quality is the deprecated alias of beat_version_quality."),
23959
+ targetId: external_exports.string().describe("The target entity ID \u2014 a beatId for coda_quality, or a Beat Version ID (bv-*) for beat_version_quality and build_quality"),
23957
23960
  systemId: external_exports.string().describe("The system ID"),
23958
23961
  branch: external_exports.string().optional().describe("Override the git branch for code checks (default: system default branch)"),
23959
23962
  localPath: external_exports.string().optional().describe("Absolute path to an already-cloned local copy of the repo \u2014 skips git clone entirely (useful for large repos or offline use)")
@@ -23984,6 +23987,7 @@ function registerCheckTools(server, ctx, client) {
23984
23987
  );
23985
23988
  }
23986
23989
  var CHECK_TYPE_DISPLAY = {
23990
+ coda_quality: "Coda Quality",
23987
23991
  beat_coda_quality: "Coda Quality",
23988
23992
  beat_quality: "Coda Quality",
23989
23993
  beat_version_quality: "Beat Version Quality",
@@ -26722,7 +26726,7 @@ var ActivitiesResponseSchema = external_exports.object({
26722
26726
  hasMore: external_exports.boolean(),
26723
26727
  nextCursor: external_exports.string().optional()
26724
26728
  }).passthrough();
26725
- var NotificationSchema2 = external_exports.object({
26729
+ var NotificationSchema2 = external_exports.preprocess(normalizeSystemId, external_exports.object({
26726
26730
  notificationId: external_exports.string(),
26727
26731
  action: external_exports.string(),
26728
26732
  title: external_exports.string(),
@@ -26737,7 +26741,7 @@ var NotificationSchema2 = external_exports.object({
26737
26741
  actorType: external_exports.enum(["user", "system"]),
26738
26742
  actorId: external_exports.string().optional(),
26739
26743
  actorName: external_exports.string().optional()
26740
- }).passthrough();
26744
+ }).passthrough());
26741
26745
  var NotificationsResponseSchema = external_exports.object({
26742
26746
  notifications: external_exports.array(NotificationSchema2),
26743
26747
  hasMore: external_exports.boolean().optional(),
@@ -32838,12 +32842,12 @@ function createHttpClient(config2) {
32838
32842
  return { error: String(err) };
32839
32843
  }
32840
32844
  },
32841
- transferSystem: async (sourceOrgId, projectId, targetOrgId) => {
32845
+ transferSystem: async (sourceOrgId, systemId, targetOrgId) => {
32842
32846
  try {
32843
32847
  const result = await request(
32844
32848
  "POST",
32845
32849
  `/api/organizations/${encodeURIComponent(sourceOrgId)}/transfer-project`,
32846
- { systemId: projectId, targetOrgId }
32850
+ { systemId, targetOrgId }
32847
32851
  );
32848
32852
  const system = result?.system ? {
32849
32853
  ...result.system,
@@ -32862,8 +32866,8 @@ function createHttpClient(config2) {
32862
32866
  const raw = await request("GET", `/api/organizations/${encodeURIComponent(orgId)}/systems/summaries`);
32863
32867
  return (raw ?? []).map((p) => ({ ...p, systemId: p.id, projectId: p.id, title: p.name, orgId: p.organizationId }));
32864
32868
  },
32865
- getSystem: async (projectId) => {
32866
- const raw = await request("GET", `/api/systems/${encodeURIComponent(projectId)}`);
32869
+ getSystem: async (systemId) => {
32870
+ const raw = await request("GET", `/api/systems/${encodeURIComponent(systemId)}`);
32867
32871
  if (!raw) return void 0;
32868
32872
  return {
32869
32873
  ...raw,
@@ -32885,35 +32889,35 @@ function createHttpClient(config2) {
32885
32889
  });
32886
32890
  return { ...raw, systemId: raw?.id ?? raw?.systemId ?? raw?.projectId, title: raw?.name ?? raw?.title, orgId: raw?.organizationId ?? raw?.orgId };
32887
32891
  },
32888
- updateSystem: async (projectId, updates) => {
32889
- const raw = await request("PATCH", `/api/systems/${encodeURIComponent(projectId)}`, updates);
32892
+ updateSystem: async (systemId, updates) => {
32893
+ const raw = await request("PATCH", `/api/systems/${encodeURIComponent(systemId)}`, updates);
32890
32894
  if (!raw) return void 0;
32891
32895
  return { ...raw, systemId: raw.id ?? raw.systemId ?? raw.projectId, title: raw.name ?? raw.title, orgId: raw.organizationId ?? raw.orgId };
32892
32896
  },
32893
- archiveSystem: async (projectId) => {
32894
- const raw = await request("PATCH", `/api/systems/${encodeURIComponent(projectId)}/archive`);
32897
+ archiveSystem: async (systemId) => {
32898
+ const raw = await request("PATCH", `/api/systems/${encodeURIComponent(systemId)}/archive`);
32895
32899
  if (!raw) return void 0;
32896
32900
  return { ...raw, systemId: raw.id ?? raw.systemId ?? raw.projectId, title: raw.name ?? raw.title, orgId: raw.organizationId ?? raw.orgId };
32897
32901
  },
32898
- getSystemFact: async (projectId) => {
32899
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/facts`);
32902
+ getSystemFact: async (systemId) => {
32903
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/facts`);
32900
32904
  return result?.data;
32901
32905
  },
32902
32906
  saveSystemFact: (input) => request("PUT", `/api/systems/${encodeURIComponent(String(input.projectId))}/facts`, input),
32903
- transitionSystemLifecycleState: async (projectId, targetState, options) => {
32904
- return request("POST", `/api/systems/${encodeURIComponent(projectId)}/lifecycle/transitions`, {
32907
+ transitionSystemLifecycleState: async (systemId, targetState, options) => {
32908
+ return request("POST", `/api/systems/${encodeURIComponent(systemId)}/lifecycle/transitions`, {
32905
32909
  targetState,
32906
32910
  reason: options.reason,
32907
32911
  decisionNoteId: options.decisionNoteId
32908
32912
  });
32909
32913
  },
32910
32914
  // Beats
32911
- getNextBeatId: async (projectId) => {
32912
- const result = await request("POST", `/api/systems/${encodeURIComponent(projectId)}/beats/next-id`);
32915
+ getNextBeatId: async (systemId) => {
32916
+ const result = await request("POST", `/api/systems/${encodeURIComponent(systemId)}/beats/next-id`);
32913
32917
  return result.beatId;
32914
32918
  },
32915
- listSystemBeats: async (projectId) => {
32916
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/beats`);
32919
+ listSystemBeats: async (systemId) => {
32920
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/beats`);
32917
32921
  return (result?.beats ?? []).map((b) => ({
32918
32922
  ...b,
32919
32923
  beatId: b.beatId ?? b.id,
@@ -32926,38 +32930,38 @@ function createHttpClient(config2) {
32926
32930
  if (!raw) return void 0;
32927
32931
  return { ...raw, beatId: raw.beatId ?? raw.id, projectId: raw.projectId ?? raw.systemId, status: raw.status ?? "open", beatStatus: coerceBeatStatusLocal(raw.beatStatus) };
32928
32932
  },
32929
- getBeatConvergence: async (projectId, beatId) => {
32933
+ getBeatConvergence: async (systemId, beatId) => {
32930
32934
  const raw = await request(
32931
32935
  "GET",
32932
- `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/convergence`
32936
+ `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/convergence`
32933
32937
  );
32934
32938
  return raw?.report;
32935
32939
  },
32936
- setDownbeat: async (projectId, beatId) => {
32940
+ setDownbeat: async (systemId, beatId) => {
32937
32941
  const raw = await request(
32938
32942
  "POST",
32939
- `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/downbeat`
32943
+ `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/downbeat`
32940
32944
  );
32941
32945
  return raw?.downbeat;
32942
32946
  },
32943
- listIncrementsSinceDownbeat: async (projectId, beatId) => {
32947
+ listIncrementsSinceDownbeat: async (systemId, beatId) => {
32944
32948
  const raw = await request(
32945
32949
  "GET",
32946
- `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/downbeat/increments`
32950
+ `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/downbeat/increments`
32947
32951
  );
32948
32952
  return raw?.result;
32949
32953
  },
32950
- getCodaDrift: async (projectId, beatId) => {
32954
+ getCodaDrift: async (systemId, beatId) => {
32951
32955
  const raw = await request(
32952
32956
  "GET",
32953
- `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/downbeat/drift`
32957
+ `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/downbeat/drift`
32954
32958
  );
32955
32959
  return raw?.report;
32956
32960
  },
32957
- getRelationalDrift: async (projectId, beatId) => {
32961
+ getRelationalDrift: async (systemId, beatId) => {
32958
32962
  const raw = await request(
32959
32963
  "GET",
32960
- `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/downbeat/relational-drift`
32964
+ `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/downbeat/relational-drift`
32961
32965
  );
32962
32966
  return raw?.report;
32963
32967
  },
@@ -33037,8 +33041,8 @@ function createHttpClient(config2) {
33037
33041
  const result = await request("POST", `/api/movements/${encodeURIComponent(movementId)}/notes`, input);
33038
33042
  return result?.note ?? result;
33039
33043
  },
33040
- listSystemLayers: async (projectId) => {
33041
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/layers`);
33044
+ listSystemLayers: async (systemId) => {
33045
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/layers`);
33042
33046
  return result?.layers ?? [];
33043
33047
  },
33044
33048
  getLayer: async (layerId) => {
@@ -33070,7 +33074,7 @@ function createHttpClient(config2) {
33070
33074
  const result = await request("POST", `/api/layers/${encodeURIComponent(layerId)}/status`, { status, reason });
33071
33075
  return result?.layer;
33072
33076
  },
33073
- listSystemNotes: async (projectId, filters) => {
33077
+ listSystemNotes: async (systemId, filters) => {
33074
33078
  const params = new URLSearchParams();
33075
33079
  if (filters?.noteType) {
33076
33080
  const types = Array.isArray(filters.noteType) ? filters.noteType : [filters.noteType];
@@ -33083,10 +33087,10 @@ function createHttpClient(config2) {
33083
33087
  if (filters?.significance) params.set("significance", filters.significance);
33084
33088
  if (filters?.limit !== void 0) params.set("limit", String(filters.limit));
33085
33089
  const qs = params.toString() ? `?${params.toString()}` : "";
33086
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/notes${qs}`);
33090
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes${qs}`);
33087
33091
  return result?.notes ?? [];
33088
33092
  },
33089
- listAllSystemNotes: async (projectId, filters, limit, cursor) => {
33093
+ listAllSystemNotes: async (systemId, filters, limit, cursor) => {
33090
33094
  const params = new URLSearchParams();
33091
33095
  if (filters?.noteType) {
33092
33096
  const types = Array.isArray(filters.noteType) ? filters.noteType : [filters.noteType];
@@ -33101,7 +33105,7 @@ function createHttpClient(config2) {
33101
33105
  if (limit !== void 0) params.set("limit", String(limit));
33102
33106
  if (cursor !== void 0) params.set("cursor", cursor);
33103
33107
  const qs = params.toString() ? `?${params.toString()}` : "";
33104
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/notes/all${qs}`);
33108
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes/all${qs}`);
33105
33109
  return { notes: result?.notes ?? [], cursor: result?.cursor, hasMore: result?.hasMore ?? false };
33106
33110
  },
33107
33111
  listBeatNotes: async (beatId, filters) => {
@@ -33137,9 +33141,9 @@ function createHttpClient(config2) {
33137
33141
  },
33138
33142
  updateNote: async (noteId, input) => {
33139
33143
  const existing = await request("GET", `/api/notes/${encodeURIComponent(noteId)}`);
33140
- const projectId = existing?.projectId ?? existing?.note?.projectId;
33141
- if (projectId) {
33142
- const result2 = await request("PATCH", `/api/systems/${encodeURIComponent(projectId)}/notes/${encodeURIComponent(noteId)}`, input);
33144
+ const systemId = existing?.projectId ?? existing?.note?.projectId;
33145
+ if (systemId) {
33146
+ const result2 = await request("PATCH", `/api/systems/${encodeURIComponent(systemId)}/notes/${encodeURIComponent(noteId)}`, input);
33143
33147
  return result2?.note ?? result2;
33144
33148
  }
33145
33149
  const orgId = existing?.organizationId ?? existing?.note?.organizationId;
@@ -33169,8 +33173,8 @@ function createHttpClient(config2) {
33169
33173
  );
33170
33174
  return result;
33171
33175
  },
33172
- getKeyAssumptions: async (projectId) => {
33173
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/notes/key-assumptions`);
33176
+ getKeyAssumptions: async (systemId) => {
33177
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes/key-assumptions`);
33174
33178
  return result?.assumptions ?? [];
33175
33179
  },
33176
33180
  getNextNoteId: async (projectCode) => {
@@ -33200,35 +33204,35 @@ function createHttpClient(config2) {
33200
33204
  getSystemGaps: async () => [],
33201
33205
  updateInformationGap: async () => false,
33202
33206
  // Revisions
33203
- createRevision: async (projectId, beatId, input) => {
33207
+ createRevision: async (systemId, beatId, input) => {
33204
33208
  const result = await request(
33205
33209
  "POST",
33206
- `/api/systems/${encodeURIComponent(projectId)}/revisions`,
33210
+ `/api/systems/${encodeURIComponent(systemId)}/revisions`,
33207
33211
  { beatId, ...input }
33208
33212
  );
33209
33213
  return { revision: result.revision, warnings: result.warnings ?? [] };
33210
33214
  },
33211
33215
  getRevision: (revisionId) => request("GET", `/api/revisions/${encodeURIComponent(revisionId)}`),
33212
- listConceptRevisions: async (projectId, options) => {
33216
+ listConceptRevisions: async (systemId, options) => {
33213
33217
  const qs = options?.includeArchived ? "?includeArchived=true" : "";
33214
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/revisions/pending${qs}`);
33218
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/revisions/pending${qs}`);
33215
33219
  return result ?? [];
33216
33220
  },
33217
- listSystemRevisions: async (projectId, options) => {
33221
+ listSystemRevisions: async (systemId, options) => {
33218
33222
  const params = new URLSearchParams();
33219
33223
  if (options?.status) params.set("status", options.status);
33220
33224
  if (options?.includeArchived) params.set("includeArchived", "true");
33221
33225
  const qs = params.toString() ? `?${params.toString()}` : "";
33222
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/revisions${qs}`);
33226
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/revisions${qs}`);
33223
33227
  return result ?? [];
33224
33228
  },
33225
- listBeatRevisions: async (projectId, beatId, options) => {
33229
+ listBeatRevisions: async (systemId, beatId, options) => {
33226
33230
  const params = new URLSearchParams();
33227
33231
  params.set("beatId", beatId);
33228
33232
  if (options?.status) params.set("status", options.status);
33229
33233
  if (options?.includeArchived) params.set("includeArchived", "true");
33230
33234
  const qs = `?${params.toString()}`;
33231
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/revisions${qs}`);
33235
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/revisions${qs}`);
33232
33236
  return result ?? [];
33233
33237
  },
33234
33238
  updateRevision: async (revisionId, updates) => {
@@ -33394,11 +33398,11 @@ function createHttpClient(config2) {
33394
33398
  return { success: false, error: { code: "REQUEST_CODE_REVIEW_FAILED", message: err instanceof Error ? err.message : String(err) } };
33395
33399
  }
33396
33400
  },
33397
- claimRevision: async (projectId, revisionId) => {
33401
+ claimRevision: async (systemId, revisionId) => {
33398
33402
  try {
33399
33403
  const result = await request(
33400
33404
  "POST",
33401
- `/api/systems/${encodeURIComponent(projectId)}/revisions/${encodeURIComponent(revisionId)}/claims`
33405
+ `/api/systems/${encodeURIComponent(systemId)}/revisions/${encodeURIComponent(revisionId)}/claims`
33402
33406
  );
33403
33407
  if (result === void 0) {
33404
33408
  return { success: false, error: { code: "REVISION_NOT_FOUND", message: "Revision not found" } };
@@ -33412,11 +33416,11 @@ function createHttpClient(config2) {
33412
33416
  return { success: false, error: { code: "CLAIM_FAILED", message: err instanceof Error ? err.message : String(err) } };
33413
33417
  }
33414
33418
  },
33415
- releaseRevisionClaim: async (projectId, revisionId, reason) => {
33419
+ releaseRevisionClaim: async (systemId, revisionId, reason) => {
33416
33420
  try {
33417
33421
  const result = await request(
33418
33422
  "POST",
33419
- `/api/systems/${encodeURIComponent(projectId)}/revisions/${encodeURIComponent(revisionId)}/claims/release`,
33423
+ `/api/systems/${encodeURIComponent(systemId)}/revisions/${encodeURIComponent(revisionId)}/claims/release`,
33420
33424
  // Default to 'manual' to match direct-client and mcp.service (both `reason ?? 'manual'`).
33421
33425
  // 'manual' is a valid value of the API's `reason` enum, so this stays schema-valid.
33422
33426
  { reason: reason ?? "manual" }
@@ -33630,12 +33634,12 @@ function createHttpClient(config2) {
33630
33634
  getTask: async (taskId) => {
33631
33635
  return request("GET", `/api/tasks/${encodeURIComponent(taskId)}`);
33632
33636
  },
33633
- listSystemTasks: async (projectId, options) => {
33637
+ listSystemTasks: async (systemId, options) => {
33634
33638
  const params = new URLSearchParams();
33635
33639
  if (options?.status) params.set("status", options.status);
33636
33640
  if (options?.limit) params.set("limit", String(options.limit));
33637
33641
  const qs = params.toString() ? `?${params.toString()}` : "";
33638
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/tasks${qs}`);
33642
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/tasks${qs}`);
33639
33643
  return result?.tasks ?? [];
33640
33644
  },
33641
33645
  listTaskEvents: async (taskId, options) => {
@@ -33646,27 +33650,27 @@ function createHttpClient(config2) {
33646
33650
  return request("GET", `/api/tasks/${encodeURIComponent(taskId)}/events${qs}`);
33647
33651
  },
33648
33652
  // Document analysis
33649
- analyzeDocument: async (projectId, content, filename) => {
33650
- return request("POST", `/api/systems/${encodeURIComponent(projectId)}/documents/analyze-text`, {
33653
+ analyzeDocument: async (systemId, content, filename) => {
33654
+ return request("POST", `/api/systems/${encodeURIComponent(systemId)}/documents/analyze-text`, {
33651
33655
  content,
33652
33656
  filename,
33653
33657
  sourceType: "document"
33654
33658
  }, LONG_RUNNING_TIMEOUT_MS);
33655
33659
  },
33656
- analyzeBinaryDocument: async (projectId, base64Content, filename) => {
33657
- return request("POST", `/api/systems/${encodeURIComponent(projectId)}/documents/analyze-binary`, {
33660
+ analyzeBinaryDocument: async (systemId, base64Content, filename) => {
33661
+ return request("POST", `/api/systems/${encodeURIComponent(systemId)}/documents/analyze-binary`, {
33658
33662
  content: base64Content,
33659
33663
  filename,
33660
33664
  encoding: "base64"
33661
33665
  }, LONG_RUNNING_TIMEOUT_MS);
33662
33666
  },
33663
33667
  // Activity — forward to API endpoint
33664
- listSystemActivities: async (projectId, options) => {
33668
+ listSystemActivities: async (systemId, options) => {
33665
33669
  const params = new URLSearchParams();
33666
33670
  if (options?.limit) params.set("limit", String(options.limit));
33667
33671
  if (options?.minImportance) params.set("importance", options.minImportance);
33668
33672
  const qs = params.toString();
33669
- const path = `/api/systems/${encodeURIComponent(projectId)}/activities${qs ? `?${qs}` : ""}`;
33673
+ const path = `/api/systems/${encodeURIComponent(systemId)}/activities${qs ? `?${qs}` : ""}`;
33670
33674
  const result = await request("GET", path);
33671
33675
  return { entries: result.activities ?? [], hasMore: false };
33672
33676
  },
@@ -33684,8 +33688,8 @@ function createHttpClient(config2) {
33684
33688
  return result;
33685
33689
  },
33686
33690
  // Timeline
33687
- getUnifiedBeatTimeline: async (projectId, beatId) => {
33688
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/history`);
33691
+ getUnifiedBeatTimeline: async (systemId, beatId) => {
33692
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/history`);
33689
33693
  return result?.timeline ?? [];
33690
33694
  },
33691
33695
  // Plan Beat Versions (agent decomposition of a Beat into waypoint BVs)
@@ -33730,17 +33734,17 @@ function createHttpClient(config2) {
33730
33734
  );
33731
33735
  return result.score;
33732
33736
  },
33733
- rankSystemBeatVersions: async (projectId, lens) => {
33737
+ rankSystemBeatVersions: async (systemId, lens) => {
33734
33738
  const result = await request(
33735
33739
  "GET",
33736
- `/api/systems/${encodeURIComponent(projectId)}/beat-versions/ranked?lens=${encodeURIComponent(lens)}`
33740
+ `/api/systems/${encodeURIComponent(systemId)}/beat-versions/ranked?lens=${encodeURIComponent(lens)}`
33737
33741
  );
33738
33742
  return result.ranked ?? [];
33739
33743
  },
33740
- rankSystemBeatVersionsWithLeverage: async (projectId, lens) => {
33744
+ rankSystemBeatVersionsWithLeverage: async (systemId, lens) => {
33741
33745
  const result = await request(
33742
33746
  "GET",
33743
- `/api/systems/${encodeURIComponent(projectId)}/beat-versions/ranked?lens=${encodeURIComponent(lens)}&withLeverage=true`
33747
+ `/api/systems/${encodeURIComponent(systemId)}/beat-versions/ranked?lens=${encodeURIComponent(lens)}&withLeverage=true`
33744
33748
  );
33745
33749
  return result.ranked ?? [];
33746
33750
  },
@@ -33750,10 +33754,10 @@ function createHttpClient(config2) {
33750
33754
  // "Cannot read properties of undefined (reading 'edge')" and discarded the
33751
33755
  // message the API had already produced. requestOrThrow parses `{ error }`
33752
33756
  // and throws ApiError with that text. See N-4E09-6343.
33753
- proposeEnablementEdges: async (projectId, actorId, beatId) => {
33757
+ proposeEnablementEdges: async (systemId, actorId, beatId) => {
33754
33758
  const result = await requestOrThrow(
33755
33759
  "POST",
33756
- `/api/systems/${encodeURIComponent(projectId)}/enablement-edges/propose`,
33760
+ `/api/systems/${encodeURIComponent(systemId)}/enablement-edges/propose`,
33757
33761
  { actorId, ...beatId !== void 0 && { beatId } }
33758
33762
  );
33759
33763
  return result?.proposed ?? [];
@@ -33792,8 +33796,8 @@ function createHttpClient(config2) {
33792
33796
  if (!result.beat) throw new Error(`confirmBeatW: no beat in response for ${beatId}`);
33793
33797
  return result.beat;
33794
33798
  },
33795
- getStaleWBeatIds: async (projectId) => {
33796
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/stale-w-beats`);
33799
+ getStaleWBeatIds: async (systemId) => {
33800
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/stale-w-beats`);
33797
33801
  return result.staleWBeatIds ?? [];
33798
33802
  },
33799
33803
  // Beat Composer
@@ -33820,61 +33824,61 @@ function createHttpClient(config2) {
33820
33824
  return result;
33821
33825
  },
33822
33826
  // Beat Quality Check (fire-and-forget — returns taskId immediately, no polling)
33823
- checkBeatQuality: async (projectId, beatId) => {
33827
+ checkBeatQuality: async (systemId, beatId) => {
33824
33828
  const enqueued = await request(
33825
33829
  "POST",
33826
- `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/quality-check`
33830
+ `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/quality-check`
33827
33831
  );
33828
33832
  if (!enqueued?.taskId) throw new Error("Quality check enqueue failed: no taskId returned");
33829
33833
  return { taskId: enqueued.taskId, status: "pending" };
33830
33834
  },
33831
33835
  // Beat Reframe (async — enqueue + poll)
33832
- reframeBeat: async (projectId, beatId) => {
33836
+ reframeBeat: async (systemId, beatId) => {
33833
33837
  const enqueued = await request(
33834
33838
  "POST",
33835
- `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/reframe`
33839
+ `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/reframe`
33836
33840
  );
33837
33841
  if (!enqueued?.taskId) throw new Error("Reframe enqueue failed: no taskId returned");
33838
33842
  return pollTaskResult(enqueued.taskId);
33839
33843
  },
33840
33844
  // Beat Planning
33841
- planRevision: async (revisionId, projectId, messages) => {
33845
+ planRevision: async (revisionId, systemId, messages) => {
33842
33846
  const enqueued = await request(
33843
33847
  "POST",
33844
33848
  `/api/revisions/${encodeURIComponent(revisionId)}/plan`,
33845
- { projectId, messages }
33849
+ { systemId, messages }
33846
33850
  );
33847
33851
  if (!enqueued?.taskId) throw new Error("Planning enqueue failed: no taskId returned");
33848
33852
  return pollTaskResult(enqueued.taskId);
33849
33853
  },
33850
33854
  // Agent sessions
33851
- startSession: async (projectId, message, triggeredBy, options) => {
33855
+ startSession: async (systemId, message, triggeredBy, options) => {
33852
33856
  const trimmedRevisionId = options?.revisionId?.trim();
33853
33857
  const result = await request(
33854
33858
  "POST",
33855
33859
  `/api/sessions`,
33856
- { systemId: projectId, message, ...triggeredBy && { triggeredBy }, ...trimmedRevisionId && { revisionId: trimmedRevisionId } }
33860
+ { systemId, message, ...triggeredBy && { triggeredBy }, ...trimmedRevisionId && { revisionId: trimmedRevisionId } }
33857
33861
  );
33858
33862
  if (!result?.taskId) throw new Error("Start session enqueue failed: no taskId returned");
33859
- return { taskId: result.taskId, taskType: "generic_session", status: result.status ?? "pending", systemId: projectId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33863
+ return { taskId: result.taskId, taskType: "generic_session", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33860
33864
  },
33861
- planRevisionBatch: async (projectId, revisionIds) => {
33865
+ planRevisionBatch: async (systemId, revisionIds) => {
33862
33866
  const result = await request(
33863
33867
  "POST",
33864
- `/api/systems/${encodeURIComponent(projectId)}/revisions/plan-batch`,
33868
+ `/api/systems/${encodeURIComponent(systemId)}/revisions/plan-batch`,
33865
33869
  revisionIds ? { revisionIds } : {}
33866
33870
  );
33867
33871
  if (!result?.taskId) throw new Error("Plan revision batch enqueue failed: no taskId returned");
33868
- return { taskId: result.taskId, taskType: "plan_revision_batch", status: result.status ?? "pending", systemId: projectId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33872
+ return { taskId: result.taskId, taskType: "plan_revision_batch", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33869
33873
  },
33870
- draftCoda: async (projectId, beatId) => {
33874
+ draftCoda: async (systemId, beatId) => {
33871
33875
  const result = await request(
33872
33876
  "POST",
33873
- `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/draft-coda`,
33877
+ `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/draft-coda`,
33874
33878
  {}
33875
33879
  );
33876
33880
  if (!result?.taskId) throw new Error("Draft coda enqueue failed: no taskId returned");
33877
- return { taskId: result.taskId, taskType: "draft_coda", status: result.status ?? "pending", systemId: projectId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33881
+ return { taskId: result.taskId, taskType: "draft_coda", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33878
33882
  },
33879
33883
  composeRootCoda: async (orgId) => {
33880
33884
  const result = await request(
@@ -33885,45 +33889,45 @@ function createHttpClient(config2) {
33885
33889
  if (!result?.taskId) throw new Error("Compose root Coda enqueue failed: no taskId returned");
33886
33890
  return { taskId: result.taskId, taskType: "compose_root_coda", status: result.status ?? "pending", systemId: orgId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33887
33891
  },
33888
- validateAssumptions: async (projectId, noteIds) => {
33892
+ validateAssumptions: async (systemId, noteIds) => {
33889
33893
  const result = await request(
33890
33894
  "POST",
33891
- `/api/systems/${encodeURIComponent(projectId)}/assumptions/validate`,
33895
+ `/api/systems/${encodeURIComponent(systemId)}/assumptions/validate`,
33892
33896
  noteIds ? { noteIds } : {}
33893
33897
  );
33894
33898
  if (!result?.taskId) throw new Error("Assumption validation enqueue failed: no taskId returned");
33895
- return { taskId: result.taskId, taskType: "validate_assumptions", status: result.status ?? "pending", systemId: projectId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33899
+ return { taskId: result.taskId, taskType: "validate_assumptions", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33896
33900
  },
33897
- runTriage: async (projectId) => {
33901
+ runTriage: async (systemId) => {
33898
33902
  const result = await request(
33899
33903
  "POST",
33900
- `/api/systems/${encodeURIComponent(projectId)}/triage`,
33904
+ `/api/systems/${encodeURIComponent(systemId)}/triage`,
33901
33905
  {}
33902
33906
  );
33903
33907
  if (!result?.taskId) throw new Error("Triage enqueue failed: no taskId returned");
33904
- return { taskId: result.taskId, taskType: "triage_loop", status: result.status ?? "pending", systemId: projectId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33908
+ return { taskId: result.taskId, taskType: "triage_loop", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33905
33909
  },
33906
- baselineSystem: async (projectId, options) => {
33910
+ baselineSystem: async (systemId, options) => {
33907
33911
  const result = await request(
33908
33912
  "POST",
33909
- `/api/systems/${encodeURIComponent(projectId)}/baseline`,
33913
+ `/api/systems/${encodeURIComponent(systemId)}/baseline`,
33910
33914
  { beatIds: options?.beatIds, runChecks: options?.runChecks ?? true, localPath: options?.localPath }
33911
33915
  );
33912
33916
  if (!result?.taskId) throw new Error("Baseline enqueue failed: no taskId returned");
33913
- return { taskId: result.taskId, taskType: "baseline_system", status: result.status ?? "pending", systemId: projectId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33917
+ return { taskId: result.taskId, taskType: "baseline_system", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33914
33918
  },
33915
- runCheck: async (projectId, checkType, targetId, options) => {
33919
+ runCheck: async (systemId, checkType, targetId, options) => {
33916
33920
  const result = await request(
33917
33921
  "POST",
33918
- `/api/systems/${encodeURIComponent(projectId)}/checks/run`,
33922
+ `/api/systems/${encodeURIComponent(systemId)}/checks/run`,
33919
33923
  { checkType, targetId, branch: options?.branch, localPath: options?.localPath }
33920
33924
  );
33921
33925
  if (!result?.taskId) throw new Error("Check enqueue failed: no taskId returned");
33922
- return { taskId: result.taskId, taskType: "run_check", status: result.status ?? "pending", systemId: projectId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33926
+ return { taskId: result.taskId, taskType: "run_check", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
33923
33927
  },
33924
33928
  // Subscriptions
33925
- subscribe: async (userId, entityType, entityId, projectId, source) => {
33926
- return request("POST", `/api/systems/${encodeURIComponent(projectId)}/subscriptions`, { userId, entityType, entityId, source });
33929
+ subscribe: async (userId, entityType, entityId, systemId, source) => {
33930
+ return request("POST", `/api/systems/${encodeURIComponent(systemId)}/subscriptions`, { userId, entityType, entityId, source });
33927
33931
  },
33928
33932
  unsubscribe: async (userId, entityType, entityId, durable) => {
33929
33933
  await request("DELETE", `/api/subscriptions/${encodeURIComponent(entityType)}/${encodeURIComponent(entityId)}`, { userId, durable });
@@ -33936,8 +33940,8 @@ function createHttpClient(config2) {
33936
33940
  return request("GET", `/api/subscriptions/entity/${encodeURIComponent(entityId)}`, void 0);
33937
33941
  },
33938
33942
  // Project Snapshot — export runs as a background task to avoid Lambda timeout
33939
- exportSystemSnapshot: async (projectId) => {
33940
- const pid = encodeURIComponent(projectId);
33943
+ exportSystemSnapshot: async (systemId) => {
33944
+ const pid = encodeURIComponent(systemId);
33941
33945
  const enqueued = await request("POST", `/api/systems/${pid}/export`, {});
33942
33946
  if (!enqueued?.taskId) throw new Error("Export enqueue failed: no taskId returned");
33943
33947
  await pollTaskResult(enqueued.taskId);
@@ -33966,32 +33970,32 @@ function createHttpClient(config2) {
33966
33970
  return importResult;
33967
33971
  },
33968
33972
  // Embedding similarity
33969
- embedSystemEntities: (projectId) => request("POST", `/api/systems/${encodeURIComponent(projectId)}/embeddings/generate`),
33970
- findSimilarNotes: async (noteId, projectId, options) => {
33973
+ embedSystemEntities: (systemId) => request("POST", `/api/systems/${encodeURIComponent(systemId)}/embeddings/generate`),
33974
+ findSimilarNotes: async (noteId, systemId, options) => {
33971
33975
  const qs = buildSimilarityQS(options);
33972
- const res = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/notes/${encodeURIComponent(noteId)}/similar${qs}`);
33976
+ const res = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes/${encodeURIComponent(noteId)}/similar${qs}`);
33973
33977
  return res?.results ?? [];
33974
33978
  },
33975
- findSimilarNotesMulti: async (noteIds, projectId, options) => {
33979
+ findSimilarNotesMulti: async (noteIds, systemId, options) => {
33976
33980
  const qs = buildSimilarityQS(options);
33977
33981
  return Promise.all(
33978
33982
  noteIds.map(async (noteId) => {
33979
33983
  const res = await request(
33980
33984
  "GET",
33981
- `/api/systems/${encodeURIComponent(projectId)}/notes/${encodeURIComponent(noteId)}/similar${qs}`
33985
+ `/api/systems/${encodeURIComponent(systemId)}/notes/${encodeURIComponent(noteId)}/similar${qs}`
33982
33986
  );
33983
33987
  return { sourceNoteId: noteId, results: res?.results ?? [] };
33984
33988
  })
33985
33989
  );
33986
33990
  },
33987
- findRelatedBeats: async (noteId, projectId, options) => {
33991
+ findRelatedBeats: async (noteId, systemId, options) => {
33988
33992
  const qs = buildSimilarityQS(options);
33989
- const res = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/notes/${encodeURIComponent(noteId)}/related-beats${qs}`);
33993
+ const res = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes/${encodeURIComponent(noteId)}/related-beats${qs}`);
33990
33994
  return res?.results ?? [];
33991
33995
  },
33992
- findSimilarBeats: async (beatId, projectId, options) => {
33996
+ findSimilarBeats: async (beatId, systemId, options) => {
33993
33997
  const qs = buildSimilarityQS(options);
33994
- const res = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/similar${qs}`);
33998
+ const res = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/similar${qs}`);
33995
33999
  return res?.results ?? [];
33996
34000
  },
33997
34001
  searchByText: async (scope, query, options) => {
@@ -34008,21 +34012,21 @@ function createHttpClient(config2) {
34008
34012
  const res = await request("GET", `/api/search?${params.toString()}`);
34009
34013
  return res?.results ?? [];
34010
34014
  },
34011
- discoverRelationships: (projectId) => request("GET", `/api/systems/${encodeURIComponent(projectId)}/relationships/discover`),
34012
- clusterNotes: async (projectId, options) => {
34013
- const res = await request("POST", `/api/systems/${encodeURIComponent(projectId)}/notes/cluster`, options ?? {});
34015
+ discoverRelationships: (systemId) => request("GET", `/api/systems/${encodeURIComponent(systemId)}/relationships/discover`),
34016
+ clusterNotes: async (systemId, options) => {
34017
+ const res = await request("POST", `/api/systems/${encodeURIComponent(systemId)}/notes/cluster`, options ?? {});
34014
34018
  return res;
34015
34019
  },
34016
- consolidateNotes: async (projectId, options) => {
34017
- const res = await request("POST", `/api/systems/${encodeURIComponent(projectId)}/notes/consolidate`, options ?? {});
34020
+ consolidateNotes: async (systemId, options) => {
34021
+ const res = await request("POST", `/api/systems/${encodeURIComponent(systemId)}/notes/consolidate`, options ?? {});
34018
34022
  return res;
34019
34023
  },
34020
- clusterEntities: async (projectId, entityType, options) => {
34021
- const res = await request("POST", `/api/systems/${encodeURIComponent(projectId)}/entities/cluster`, { entityType, ...options });
34024
+ clusterEntities: async (systemId, entityType, options) => {
34025
+ const res = await request("POST", `/api/systems/${encodeURIComponent(systemId)}/entities/cluster`, { entityType, ...options });
34022
34026
  return res;
34023
34027
  },
34024
- runClusteredAnalysis: async (projectId, analysisType, options) => {
34025
- const res = await request("POST", `/api/systems/${encodeURIComponent(projectId)}/entities/clustered-analysis`, { analysisType, ...options });
34028
+ runClusteredAnalysis: async (systemId, analysisType, options) => {
34029
+ const res = await request("POST", `/api/systems/${encodeURIComponent(systemId)}/entities/clustered-analysis`, { analysisType, ...options });
34026
34030
  return res;
34027
34031
  },
34028
34032
  // Check queries
@@ -34030,7 +34034,7 @@ function createHttpClient(config2) {
34030
34034
  const res = await request("GET", `/api/checks/${encodeURIComponent(checkId)}`);
34031
34035
  return res.check;
34032
34036
  },
34033
- listSystemChecks: async (projectId, checkType, options) => {
34037
+ listSystemChecks: async (systemId, checkType, options) => {
34034
34038
  const params = new URLSearchParams();
34035
34039
  if (checkType) params.set("type", checkType);
34036
34040
  if (options?.limit !== void 0) params.set("limit", String(options.limit));
@@ -34038,38 +34042,38 @@ function createHttpClient(config2) {
34038
34042
  const qs = params.toString() ? `?${params.toString()}` : "";
34039
34043
  const res = await request(
34040
34044
  "GET",
34041
- `/api/systems/${encodeURIComponent(projectId)}/checks${qs}`
34045
+ `/api/systems/${encodeURIComponent(systemId)}/checks${qs}`
34042
34046
  );
34043
34047
  return { checks: res?.checks ?? [], nextCursor: res?.nextCursor };
34044
34048
  },
34045
- listLatestSystemChecks: async (projectId) => {
34049
+ listLatestSystemChecks: async (systemId) => {
34046
34050
  const res = await request(
34047
34051
  "GET",
34048
- `/api/checks/latest?projectId=${encodeURIComponent(projectId)}`
34052
+ `/api/checks/latest?systemId=${encodeURIComponent(systemId)}`
34049
34053
  );
34050
34054
  return res?.checks ?? [];
34051
34055
  },
34052
- listBeatChecks: async (beatId, projectId, checkType) => {
34056
+ listBeatChecks: async (beatId, systemId, checkType) => {
34053
34057
  const qs = checkType ? `?type=${encodeURIComponent(checkType)}` : "";
34054
34058
  const res = await request(
34055
34059
  "GET",
34056
- `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/checks${qs}`
34060
+ `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/checks${qs}`
34057
34061
  );
34058
34062
  return res.checks;
34059
34063
  },
34060
- listRevisionChecks: async (revisionId, projectId, checkType) => {
34064
+ listRevisionChecks: async (revisionId, systemId, checkType) => {
34061
34065
  const qs = checkType ? `?type=${encodeURIComponent(checkType)}` : "";
34062
34066
  const res = await request(
34063
34067
  "GET",
34064
- `/api/systems/${encodeURIComponent(projectId)}/revisions/${encodeURIComponent(revisionId)}/checks${qs}`
34068
+ `/api/systems/${encodeURIComponent(systemId)}/revisions/${encodeURIComponent(revisionId)}/checks${qs}`
34065
34069
  );
34066
34070
  return res.checks;
34067
34071
  },
34068
- listBeatVersionChecks: async (beatVersionId, projectId, checkType) => {
34072
+ listBeatVersionChecks: async (beatVersionId, systemId, checkType) => {
34069
34073
  const qs = checkType ? `?type=${encodeURIComponent(checkType)}` : "";
34070
34074
  const res = await request(
34071
34075
  "GET",
34072
- `/api/systems/${encodeURIComponent(projectId)}/beat-versions/${encodeURIComponent(beatVersionId)}/checks${qs}`
34076
+ `/api/systems/${encodeURIComponent(systemId)}/beat-versions/${encodeURIComponent(beatVersionId)}/checks${qs}`
34073
34077
  );
34074
34078
  return res.checks;
34075
34079
  },
@@ -34090,9 +34094,9 @@ function createHttpClient(config2) {
34090
34094
  return res.check;
34091
34095
  },
34092
34096
  // Audit integrity
34093
- verifyAuditIntegrity: async (projectId, options) => {
34097
+ verifyAuditIntegrity: async (systemId, options) => {
34094
34098
  const qs = options?.limit ? `?limit=${options.limit}` : "";
34095
- return request("POST", `/api/systems/${encodeURIComponent(projectId)}/audit/verify${qs}`);
34099
+ return request("POST", `/api/systems/${encodeURIComponent(systemId)}/audit/verify${qs}`);
34096
34100
  },
34097
34101
  // Teamspaces
34098
34102
  listOrgTeamspaces: async (orgId) => {
@@ -34114,9 +34118,9 @@ function createHttpClient(config2) {
34114
34118
  if (res === void 0) throw new Error(`Teamspace ${teamspaceId} not found`);
34115
34119
  return res.deliverableGroups;
34116
34120
  },
34117
- listSystemDeliverableGroups: async (projectId) => {
34118
- const res = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/deliverable-groups`);
34119
- if (res === void 0) throw new Error(`Project ${projectId} not found`);
34121
+ listSystemDeliverableGroups: async (systemId) => {
34122
+ const res = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/deliverable-groups`);
34123
+ if (res === void 0) throw new Error(`Project ${systemId} not found`);
34120
34124
  return res.deliverableGroups;
34121
34125
  },
34122
34126
  listMovementDeliverableGroups: async (movementId) => {
@@ -34600,20 +34604,20 @@ function createHttpClient(config2) {
34600
34604
  return request("POST", `/api/accounts/${encodeURIComponent(accountId)}/drops/proposal`, options?.lens ? { lens: options.lens } : {});
34601
34605
  },
34602
34606
  // Beat Versions (three-tier hierarchy: Beat → Beat Version → Revision)
34603
- listBeatVersions: async (projectId, options) => {
34607
+ listBeatVersions: async (systemId, options) => {
34604
34608
  const params = new URLSearchParams();
34605
34609
  if (options?.beatId) params.set("beatId", options.beatId);
34606
34610
  if (options?.status) params.set("status", options.status);
34607
34611
  if (options?.includeTerminal) params.set("includeTerminal", "true");
34608
34612
  const qs = params.toString() ? `?${params.toString()}` : "";
34609
- const res = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/beat-versions${qs}`);
34613
+ const res = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/beat-versions${qs}`);
34610
34614
  return res ?? [];
34611
34615
  },
34612
34616
  getBeatVersion: async (beatVersionId) => {
34613
34617
  return request("GET", `/api/beat-versions/${encodeURIComponent(beatVersionId)}`);
34614
34618
  },
34615
- createBeatVersion: async (projectId, beatId, input) => {
34616
- return request("POST", `/api/systems/${encodeURIComponent(projectId)}/beats/${encodeURIComponent(beatId)}/beat-versions`, input);
34619
+ createBeatVersion: async (systemId, beatId, input) => {
34620
+ return request("POST", `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/beat-versions`, input);
34617
34621
  },
34618
34622
  updateBeatVersion: async (beatVersionId, updates) => {
34619
34623
  return request("PATCH", `/api/beat-versions/${encodeURIComponent(beatVersionId)}`, updates);
@@ -34667,17 +34671,17 @@ function createHttpClient(config2) {
34667
34671
  return res.guidelines;
34668
34672
  },
34669
34673
  // Next Actions & Triage
34670
- getNextActions: async (projectId, options) => {
34674
+ getNextActions: async (systemId, options) => {
34671
34675
  const qs = options?.limit ? `?limit=${options.limit}` : "";
34672
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/next-actions${qs}`);
34676
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/next-actions${qs}`);
34673
34677
  return result?.actions ?? [];
34674
34678
  },
34675
- listTriageActions: async (projectId) => {
34676
- const result = await request("GET", `/api/systems/${encodeURIComponent(projectId)}/triage-actions`);
34679
+ listTriageActions: async (systemId) => {
34680
+ const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/triage-actions`);
34677
34681
  return result?.actions ?? [];
34678
34682
  },
34679
- dismissTriageAction: async (projectId, actionKey, _userId) => {
34680
- await request("POST", `/api/systems/${encodeURIComponent(projectId)}/triage-actions/${encodeURIComponent(actionKey)}/dismiss`);
34683
+ dismissTriageAction: async (systemId, actionKey, _userId) => {
34684
+ await request("POST", `/api/systems/${encodeURIComponent(systemId)}/triage-actions/${encodeURIComponent(actionKey)}/dismiss`);
34681
34685
  },
34682
34686
  // Onboarding (LLM-heavy — delegate to API)
34683
34687
  initiateOnboarding: async (orgId, input) => {
@@ -34689,17 +34693,17 @@ function createHttpClient(config2) {
34689
34693
  if (!result) throw new Error(`Onboarding initiate failed: org ${orgId} not found`);
34690
34694
  return result;
34691
34695
  },
34692
- draftOnboardingBeats: async (projectId, input) => {
34696
+ draftOnboardingBeats: async (systemId, input) => {
34693
34697
  const result = await request(
34694
34698
  "POST",
34695
- `/api/systems/${encodeURIComponent(projectId)}/beats/draft`,
34699
+ `/api/systems/${encodeURIComponent(systemId)}/beats/draft`,
34696
34700
  input
34697
34701
  );
34698
- if (!result) throw new Error(`Beat draft failed: project ${projectId} not found`);
34702
+ if (!result) throw new Error(`Beat draft failed: project ${systemId} not found`);
34699
34703
  return result;
34700
34704
  },
34701
- triggerSystemEmbedding: async (projectId) => {
34702
- await request("POST", `/api/systems/${encodeURIComponent(projectId)}/embedding`);
34705
+ triggerSystemEmbedding: async (systemId) => {
34706
+ await request("POST", `/api/systems/${encodeURIComponent(systemId)}/embedding`);
34703
34707
  },
34704
34708
  // Notebooks (B-271)
34705
34709
  createNotebook: async (input) => {
@@ -34961,7 +34965,7 @@ function loadConfig() {
34961
34965
  };
34962
34966
  }
34963
34967
  async function main() {
34964
- console.error(`[harmonica-mcp] v${"3.9.4"} starting\u2026`);
34968
+ console.error(`[harmonica-mcp] v${"4.0.0"} starting\u2026`);
34965
34969
  const config2 = loadConfig();
34966
34970
  const client = createHttpClient({
34967
34971
  apiBaseUrl: config2.apiBaseUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codazen/harmonica-mcp",
3
- "version": "3.9.4",
3
+ "version": "4.0.0",
4
4
  "description": "MCP server for Harmonica — connect any MCP-compatible AI assistant to Harmonica",
5
5
  "license": "MIT",
6
6
  "bin": {