@codazen/harmonica-mcp 3.9.3 → 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.
- package/dist/index.js +211 -170
- 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.
|
|
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
|
-
"
|
|
22554
|
-
"Enqueue a
|
|
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
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
|
|
22564
|
-
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
23956
|
-
targetId: external_exports.string().describe("The target entity ID \u2014 a beatId for
|
|
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,13 +26741,50 @@ 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(),
|
|
26744
26748
|
nextCursor: external_exports.string().optional()
|
|
26745
26749
|
}).passthrough();
|
|
26746
26750
|
var UnreadCountResponseSchema = external_exports.object({ count: external_exports.number() }).passthrough();
|
|
26751
|
+
var InboxItemStatusSchema = external_exports.enum([
|
|
26752
|
+
"new",
|
|
26753
|
+
"acknowledged",
|
|
26754
|
+
"needs_agent",
|
|
26755
|
+
"delegated",
|
|
26756
|
+
"answered",
|
|
26757
|
+
"resolved",
|
|
26758
|
+
"expired"
|
|
26759
|
+
]);
|
|
26760
|
+
var InboxItemPrioritySchema = external_exports.enum(["low", "normal", "high", "urgent"]);
|
|
26761
|
+
var InboxSourceChannelSchema = external_exports.enum(["harmonica", "slack", "teams", "email", "api"]);
|
|
26762
|
+
var InboxRequestedBySchema = external_exports.object({
|
|
26763
|
+
actorType: external_exports.enum(["agent", "user", "system"]),
|
|
26764
|
+
actorId: external_exports.string(),
|
|
26765
|
+
actorName: external_exports.string().optional()
|
|
26766
|
+
}).passthrough();
|
|
26767
|
+
var InboxItemSchema = external_exports.object({
|
|
26768
|
+
inboxItemId: external_exports.string(),
|
|
26769
|
+
systemId: external_exports.string(),
|
|
26770
|
+
assigneeId: external_exports.string(),
|
|
26771
|
+
threadId: external_exports.string(),
|
|
26772
|
+
body: external_exports.string(),
|
|
26773
|
+
status: InboxItemStatusSchema,
|
|
26774
|
+
priority: InboxItemPrioritySchema,
|
|
26775
|
+
sourceChannel: InboxSourceChannelSchema,
|
|
26776
|
+
dueAt: external_exports.string().optional(),
|
|
26777
|
+
delegatedSessionId: external_exports.string().optional(),
|
|
26778
|
+
requestedBy: InboxRequestedBySchema,
|
|
26779
|
+
answer: external_exports.string().optional(),
|
|
26780
|
+
createdAt: external_exports.string(),
|
|
26781
|
+
updatedAt: external_exports.string()
|
|
26782
|
+
}).passthrough();
|
|
26783
|
+
var InboxItemsResponseSchema = external_exports.object({
|
|
26784
|
+
items: external_exports.array(InboxItemSchema),
|
|
26785
|
+
hasMore: external_exports.boolean(),
|
|
26786
|
+
nextCursor: external_exports.string().optional()
|
|
26787
|
+
}).passthrough();
|
|
26747
26788
|
var TriageActionSchema = external_exports.preprocess(
|
|
26748
26789
|
normalizeSystemId,
|
|
26749
26790
|
external_exports.object({
|
|
@@ -28694,7 +28735,7 @@ var OnboardingNoteInputSchema = external_exports.object({
|
|
|
28694
28735
|
rationale: external_exports.string().optional(),
|
|
28695
28736
|
confidence: external_exports.number().min(0).max(1).optional()
|
|
28696
28737
|
});
|
|
28697
|
-
var
|
|
28738
|
+
var OnboardingSystemInputSchema = external_exports.object({
|
|
28698
28739
|
title: external_exports.string().min(1).max(300),
|
|
28699
28740
|
description: external_exports.string().max(2e3).optional(),
|
|
28700
28741
|
notes: external_exports.array(OnboardingNoteInputSchema).optional()
|
|
@@ -28804,7 +28845,7 @@ function registerOnboardingTools(server, ctx, client) {
|
|
|
28804
28845
|
].join(" "),
|
|
28805
28846
|
{
|
|
28806
28847
|
teamspaceName: external_exports.string().min(1).max(200).describe("Teamspace display name"),
|
|
28807
|
-
projects: external_exports.array(
|
|
28848
|
+
projects: external_exports.array(OnboardingSystemInputSchema).min(1).describe("Phase 1 systems to create, each linked to the Teamspace"),
|
|
28808
28849
|
teamspaceNotes: external_exports.array(OnboardingNoteInputSchema).describe("Constraints, assumptions, and context notes at the Teamspace/system level")
|
|
28809
28850
|
},
|
|
28810
28851
|
async ({
|
|
@@ -32801,12 +32842,12 @@ function createHttpClient(config2) {
|
|
|
32801
32842
|
return { error: String(err) };
|
|
32802
32843
|
}
|
|
32803
32844
|
},
|
|
32804
|
-
transferSystem: async (sourceOrgId,
|
|
32845
|
+
transferSystem: async (sourceOrgId, systemId, targetOrgId) => {
|
|
32805
32846
|
try {
|
|
32806
32847
|
const result = await request(
|
|
32807
32848
|
"POST",
|
|
32808
32849
|
`/api/organizations/${encodeURIComponent(sourceOrgId)}/transfer-project`,
|
|
32809
|
-
{ systemId
|
|
32850
|
+
{ systemId, targetOrgId }
|
|
32810
32851
|
);
|
|
32811
32852
|
const system = result?.system ? {
|
|
32812
32853
|
...result.system,
|
|
@@ -32825,8 +32866,8 @@ function createHttpClient(config2) {
|
|
|
32825
32866
|
const raw = await request("GET", `/api/organizations/${encodeURIComponent(orgId)}/systems/summaries`);
|
|
32826
32867
|
return (raw ?? []).map((p) => ({ ...p, systemId: p.id, projectId: p.id, title: p.name, orgId: p.organizationId }));
|
|
32827
32868
|
},
|
|
32828
|
-
getSystem: async (
|
|
32829
|
-
const raw = await request("GET", `/api/systems/${encodeURIComponent(
|
|
32869
|
+
getSystem: async (systemId) => {
|
|
32870
|
+
const raw = await request("GET", `/api/systems/${encodeURIComponent(systemId)}`);
|
|
32830
32871
|
if (!raw) return void 0;
|
|
32831
32872
|
return {
|
|
32832
32873
|
...raw,
|
|
@@ -32848,35 +32889,35 @@ function createHttpClient(config2) {
|
|
|
32848
32889
|
});
|
|
32849
32890
|
return { ...raw, systemId: raw?.id ?? raw?.systemId ?? raw?.projectId, title: raw?.name ?? raw?.title, orgId: raw?.organizationId ?? raw?.orgId };
|
|
32850
32891
|
},
|
|
32851
|
-
updateSystem: async (
|
|
32852
|
-
const raw = await request("PATCH", `/api/systems/${encodeURIComponent(
|
|
32892
|
+
updateSystem: async (systemId, updates) => {
|
|
32893
|
+
const raw = await request("PATCH", `/api/systems/${encodeURIComponent(systemId)}`, updates);
|
|
32853
32894
|
if (!raw) return void 0;
|
|
32854
32895
|
return { ...raw, systemId: raw.id ?? raw.systemId ?? raw.projectId, title: raw.name ?? raw.title, orgId: raw.organizationId ?? raw.orgId };
|
|
32855
32896
|
},
|
|
32856
|
-
archiveSystem: async (
|
|
32857
|
-
const raw = await request("PATCH", `/api/systems/${encodeURIComponent(
|
|
32897
|
+
archiveSystem: async (systemId) => {
|
|
32898
|
+
const raw = await request("PATCH", `/api/systems/${encodeURIComponent(systemId)}/archive`);
|
|
32858
32899
|
if (!raw) return void 0;
|
|
32859
32900
|
return { ...raw, systemId: raw.id ?? raw.systemId ?? raw.projectId, title: raw.name ?? raw.title, orgId: raw.organizationId ?? raw.orgId };
|
|
32860
32901
|
},
|
|
32861
|
-
getSystemFact: async (
|
|
32862
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
32902
|
+
getSystemFact: async (systemId) => {
|
|
32903
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/facts`);
|
|
32863
32904
|
return result?.data;
|
|
32864
32905
|
},
|
|
32865
32906
|
saveSystemFact: (input) => request("PUT", `/api/systems/${encodeURIComponent(String(input.projectId))}/facts`, input),
|
|
32866
|
-
transitionSystemLifecycleState: async (
|
|
32867
|
-
return request("POST", `/api/systems/${encodeURIComponent(
|
|
32907
|
+
transitionSystemLifecycleState: async (systemId, targetState, options) => {
|
|
32908
|
+
return request("POST", `/api/systems/${encodeURIComponent(systemId)}/lifecycle/transitions`, {
|
|
32868
32909
|
targetState,
|
|
32869
32910
|
reason: options.reason,
|
|
32870
32911
|
decisionNoteId: options.decisionNoteId
|
|
32871
32912
|
});
|
|
32872
32913
|
},
|
|
32873
32914
|
// Beats
|
|
32874
|
-
getNextBeatId: async (
|
|
32875
|
-
const result = await request("POST", `/api/systems/${encodeURIComponent(
|
|
32915
|
+
getNextBeatId: async (systemId) => {
|
|
32916
|
+
const result = await request("POST", `/api/systems/${encodeURIComponent(systemId)}/beats/next-id`);
|
|
32876
32917
|
return result.beatId;
|
|
32877
32918
|
},
|
|
32878
|
-
listSystemBeats: async (
|
|
32879
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
32919
|
+
listSystemBeats: async (systemId) => {
|
|
32920
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/beats`);
|
|
32880
32921
|
return (result?.beats ?? []).map((b) => ({
|
|
32881
32922
|
...b,
|
|
32882
32923
|
beatId: b.beatId ?? b.id,
|
|
@@ -32889,38 +32930,38 @@ function createHttpClient(config2) {
|
|
|
32889
32930
|
if (!raw) return void 0;
|
|
32890
32931
|
return { ...raw, beatId: raw.beatId ?? raw.id, projectId: raw.projectId ?? raw.systemId, status: raw.status ?? "open", beatStatus: coerceBeatStatusLocal(raw.beatStatus) };
|
|
32891
32932
|
},
|
|
32892
|
-
getBeatConvergence: async (
|
|
32933
|
+
getBeatConvergence: async (systemId, beatId) => {
|
|
32893
32934
|
const raw = await request(
|
|
32894
32935
|
"GET",
|
|
32895
|
-
`/api/systems/${encodeURIComponent(
|
|
32936
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/convergence`
|
|
32896
32937
|
);
|
|
32897
32938
|
return raw?.report;
|
|
32898
32939
|
},
|
|
32899
|
-
setDownbeat: async (
|
|
32940
|
+
setDownbeat: async (systemId, beatId) => {
|
|
32900
32941
|
const raw = await request(
|
|
32901
32942
|
"POST",
|
|
32902
|
-
`/api/systems/${encodeURIComponent(
|
|
32943
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/downbeat`
|
|
32903
32944
|
);
|
|
32904
32945
|
return raw?.downbeat;
|
|
32905
32946
|
},
|
|
32906
|
-
listIncrementsSinceDownbeat: async (
|
|
32947
|
+
listIncrementsSinceDownbeat: async (systemId, beatId) => {
|
|
32907
32948
|
const raw = await request(
|
|
32908
32949
|
"GET",
|
|
32909
|
-
`/api/systems/${encodeURIComponent(
|
|
32950
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/downbeat/increments`
|
|
32910
32951
|
);
|
|
32911
32952
|
return raw?.result;
|
|
32912
32953
|
},
|
|
32913
|
-
getCodaDrift: async (
|
|
32954
|
+
getCodaDrift: async (systemId, beatId) => {
|
|
32914
32955
|
const raw = await request(
|
|
32915
32956
|
"GET",
|
|
32916
|
-
`/api/systems/${encodeURIComponent(
|
|
32957
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/downbeat/drift`
|
|
32917
32958
|
);
|
|
32918
32959
|
return raw?.report;
|
|
32919
32960
|
},
|
|
32920
|
-
getRelationalDrift: async (
|
|
32961
|
+
getRelationalDrift: async (systemId, beatId) => {
|
|
32921
32962
|
const raw = await request(
|
|
32922
32963
|
"GET",
|
|
32923
|
-
`/api/systems/${encodeURIComponent(
|
|
32964
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/downbeat/relational-drift`
|
|
32924
32965
|
);
|
|
32925
32966
|
return raw?.report;
|
|
32926
32967
|
},
|
|
@@ -33000,8 +33041,8 @@ function createHttpClient(config2) {
|
|
|
33000
33041
|
const result = await request("POST", `/api/movements/${encodeURIComponent(movementId)}/notes`, input);
|
|
33001
33042
|
return result?.note ?? result;
|
|
33002
33043
|
},
|
|
33003
|
-
listSystemLayers: async (
|
|
33004
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33044
|
+
listSystemLayers: async (systemId) => {
|
|
33045
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/layers`);
|
|
33005
33046
|
return result?.layers ?? [];
|
|
33006
33047
|
},
|
|
33007
33048
|
getLayer: async (layerId) => {
|
|
@@ -33033,7 +33074,7 @@ function createHttpClient(config2) {
|
|
|
33033
33074
|
const result = await request("POST", `/api/layers/${encodeURIComponent(layerId)}/status`, { status, reason });
|
|
33034
33075
|
return result?.layer;
|
|
33035
33076
|
},
|
|
33036
|
-
listSystemNotes: async (
|
|
33077
|
+
listSystemNotes: async (systemId, filters) => {
|
|
33037
33078
|
const params = new URLSearchParams();
|
|
33038
33079
|
if (filters?.noteType) {
|
|
33039
33080
|
const types = Array.isArray(filters.noteType) ? filters.noteType : [filters.noteType];
|
|
@@ -33046,10 +33087,10 @@ function createHttpClient(config2) {
|
|
|
33046
33087
|
if (filters?.significance) params.set("significance", filters.significance);
|
|
33047
33088
|
if (filters?.limit !== void 0) params.set("limit", String(filters.limit));
|
|
33048
33089
|
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
33049
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33090
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes${qs}`);
|
|
33050
33091
|
return result?.notes ?? [];
|
|
33051
33092
|
},
|
|
33052
|
-
listAllSystemNotes: async (
|
|
33093
|
+
listAllSystemNotes: async (systemId, filters, limit, cursor) => {
|
|
33053
33094
|
const params = new URLSearchParams();
|
|
33054
33095
|
if (filters?.noteType) {
|
|
33055
33096
|
const types = Array.isArray(filters.noteType) ? filters.noteType : [filters.noteType];
|
|
@@ -33064,7 +33105,7 @@ function createHttpClient(config2) {
|
|
|
33064
33105
|
if (limit !== void 0) params.set("limit", String(limit));
|
|
33065
33106
|
if (cursor !== void 0) params.set("cursor", cursor);
|
|
33066
33107
|
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
33067
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33108
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes/all${qs}`);
|
|
33068
33109
|
return { notes: result?.notes ?? [], cursor: result?.cursor, hasMore: result?.hasMore ?? false };
|
|
33069
33110
|
},
|
|
33070
33111
|
listBeatNotes: async (beatId, filters) => {
|
|
@@ -33100,9 +33141,9 @@ function createHttpClient(config2) {
|
|
|
33100
33141
|
},
|
|
33101
33142
|
updateNote: async (noteId, input) => {
|
|
33102
33143
|
const existing = await request("GET", `/api/notes/${encodeURIComponent(noteId)}`);
|
|
33103
|
-
const
|
|
33104
|
-
if (
|
|
33105
|
-
const result2 = await request("PATCH", `/api/systems/${encodeURIComponent(
|
|
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);
|
|
33106
33147
|
return result2?.note ?? result2;
|
|
33107
33148
|
}
|
|
33108
33149
|
const orgId = existing?.organizationId ?? existing?.note?.organizationId;
|
|
@@ -33132,8 +33173,8 @@ function createHttpClient(config2) {
|
|
|
33132
33173
|
);
|
|
33133
33174
|
return result;
|
|
33134
33175
|
},
|
|
33135
|
-
getKeyAssumptions: async (
|
|
33136
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33176
|
+
getKeyAssumptions: async (systemId) => {
|
|
33177
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes/key-assumptions`);
|
|
33137
33178
|
return result?.assumptions ?? [];
|
|
33138
33179
|
},
|
|
33139
33180
|
getNextNoteId: async (projectCode) => {
|
|
@@ -33163,35 +33204,35 @@ function createHttpClient(config2) {
|
|
|
33163
33204
|
getSystemGaps: async () => [],
|
|
33164
33205
|
updateInformationGap: async () => false,
|
|
33165
33206
|
// Revisions
|
|
33166
|
-
createRevision: async (
|
|
33207
|
+
createRevision: async (systemId, beatId, input) => {
|
|
33167
33208
|
const result = await request(
|
|
33168
33209
|
"POST",
|
|
33169
|
-
`/api/systems/${encodeURIComponent(
|
|
33210
|
+
`/api/systems/${encodeURIComponent(systemId)}/revisions`,
|
|
33170
33211
|
{ beatId, ...input }
|
|
33171
33212
|
);
|
|
33172
33213
|
return { revision: result.revision, warnings: result.warnings ?? [] };
|
|
33173
33214
|
},
|
|
33174
33215
|
getRevision: (revisionId) => request("GET", `/api/revisions/${encodeURIComponent(revisionId)}`),
|
|
33175
|
-
listConceptRevisions: async (
|
|
33216
|
+
listConceptRevisions: async (systemId, options) => {
|
|
33176
33217
|
const qs = options?.includeArchived ? "?includeArchived=true" : "";
|
|
33177
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33218
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/revisions/pending${qs}`);
|
|
33178
33219
|
return result ?? [];
|
|
33179
33220
|
},
|
|
33180
|
-
listSystemRevisions: async (
|
|
33221
|
+
listSystemRevisions: async (systemId, options) => {
|
|
33181
33222
|
const params = new URLSearchParams();
|
|
33182
33223
|
if (options?.status) params.set("status", options.status);
|
|
33183
33224
|
if (options?.includeArchived) params.set("includeArchived", "true");
|
|
33184
33225
|
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
33185
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33226
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/revisions${qs}`);
|
|
33186
33227
|
return result ?? [];
|
|
33187
33228
|
},
|
|
33188
|
-
listBeatRevisions: async (
|
|
33229
|
+
listBeatRevisions: async (systemId, beatId, options) => {
|
|
33189
33230
|
const params = new URLSearchParams();
|
|
33190
33231
|
params.set("beatId", beatId);
|
|
33191
33232
|
if (options?.status) params.set("status", options.status);
|
|
33192
33233
|
if (options?.includeArchived) params.set("includeArchived", "true");
|
|
33193
33234
|
const qs = `?${params.toString()}`;
|
|
33194
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33235
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/revisions${qs}`);
|
|
33195
33236
|
return result ?? [];
|
|
33196
33237
|
},
|
|
33197
33238
|
updateRevision: async (revisionId, updates) => {
|
|
@@ -33357,11 +33398,11 @@ function createHttpClient(config2) {
|
|
|
33357
33398
|
return { success: false, error: { code: "REQUEST_CODE_REVIEW_FAILED", message: err instanceof Error ? err.message : String(err) } };
|
|
33358
33399
|
}
|
|
33359
33400
|
},
|
|
33360
|
-
claimRevision: async (
|
|
33401
|
+
claimRevision: async (systemId, revisionId) => {
|
|
33361
33402
|
try {
|
|
33362
33403
|
const result = await request(
|
|
33363
33404
|
"POST",
|
|
33364
|
-
`/api/systems/${encodeURIComponent(
|
|
33405
|
+
`/api/systems/${encodeURIComponent(systemId)}/revisions/${encodeURIComponent(revisionId)}/claims`
|
|
33365
33406
|
);
|
|
33366
33407
|
if (result === void 0) {
|
|
33367
33408
|
return { success: false, error: { code: "REVISION_NOT_FOUND", message: "Revision not found" } };
|
|
@@ -33375,11 +33416,11 @@ function createHttpClient(config2) {
|
|
|
33375
33416
|
return { success: false, error: { code: "CLAIM_FAILED", message: err instanceof Error ? err.message : String(err) } };
|
|
33376
33417
|
}
|
|
33377
33418
|
},
|
|
33378
|
-
releaseRevisionClaim: async (
|
|
33419
|
+
releaseRevisionClaim: async (systemId, revisionId, reason) => {
|
|
33379
33420
|
try {
|
|
33380
33421
|
const result = await request(
|
|
33381
33422
|
"POST",
|
|
33382
|
-
`/api/systems/${encodeURIComponent(
|
|
33423
|
+
`/api/systems/${encodeURIComponent(systemId)}/revisions/${encodeURIComponent(revisionId)}/claims/release`,
|
|
33383
33424
|
// Default to 'manual' to match direct-client and mcp.service (both `reason ?? 'manual'`).
|
|
33384
33425
|
// 'manual' is a valid value of the API's `reason` enum, so this stays schema-valid.
|
|
33385
33426
|
{ reason: reason ?? "manual" }
|
|
@@ -33593,12 +33634,12 @@ function createHttpClient(config2) {
|
|
|
33593
33634
|
getTask: async (taskId) => {
|
|
33594
33635
|
return request("GET", `/api/tasks/${encodeURIComponent(taskId)}`);
|
|
33595
33636
|
},
|
|
33596
|
-
listSystemTasks: async (
|
|
33637
|
+
listSystemTasks: async (systemId, options) => {
|
|
33597
33638
|
const params = new URLSearchParams();
|
|
33598
33639
|
if (options?.status) params.set("status", options.status);
|
|
33599
33640
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
33600
33641
|
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
33601
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33642
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/tasks${qs}`);
|
|
33602
33643
|
return result?.tasks ?? [];
|
|
33603
33644
|
},
|
|
33604
33645
|
listTaskEvents: async (taskId, options) => {
|
|
@@ -33609,27 +33650,27 @@ function createHttpClient(config2) {
|
|
|
33609
33650
|
return request("GET", `/api/tasks/${encodeURIComponent(taskId)}/events${qs}`);
|
|
33610
33651
|
},
|
|
33611
33652
|
// Document analysis
|
|
33612
|
-
analyzeDocument: async (
|
|
33613
|
-
return request("POST", `/api/systems/${encodeURIComponent(
|
|
33653
|
+
analyzeDocument: async (systemId, content, filename) => {
|
|
33654
|
+
return request("POST", `/api/systems/${encodeURIComponent(systemId)}/documents/analyze-text`, {
|
|
33614
33655
|
content,
|
|
33615
33656
|
filename,
|
|
33616
33657
|
sourceType: "document"
|
|
33617
33658
|
}, LONG_RUNNING_TIMEOUT_MS);
|
|
33618
33659
|
},
|
|
33619
|
-
analyzeBinaryDocument: async (
|
|
33620
|
-
return request("POST", `/api/systems/${encodeURIComponent(
|
|
33660
|
+
analyzeBinaryDocument: async (systemId, base64Content, filename) => {
|
|
33661
|
+
return request("POST", `/api/systems/${encodeURIComponent(systemId)}/documents/analyze-binary`, {
|
|
33621
33662
|
content: base64Content,
|
|
33622
33663
|
filename,
|
|
33623
33664
|
encoding: "base64"
|
|
33624
33665
|
}, LONG_RUNNING_TIMEOUT_MS);
|
|
33625
33666
|
},
|
|
33626
33667
|
// Activity — forward to API endpoint
|
|
33627
|
-
listSystemActivities: async (
|
|
33668
|
+
listSystemActivities: async (systemId, options) => {
|
|
33628
33669
|
const params = new URLSearchParams();
|
|
33629
33670
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
33630
33671
|
if (options?.minImportance) params.set("importance", options.minImportance);
|
|
33631
33672
|
const qs = params.toString();
|
|
33632
|
-
const path = `/api/systems/${encodeURIComponent(
|
|
33673
|
+
const path = `/api/systems/${encodeURIComponent(systemId)}/activities${qs ? `?${qs}` : ""}`;
|
|
33633
33674
|
const result = await request("GET", path);
|
|
33634
33675
|
return { entries: result.activities ?? [], hasMore: false };
|
|
33635
33676
|
},
|
|
@@ -33647,8 +33688,8 @@ function createHttpClient(config2) {
|
|
|
33647
33688
|
return result;
|
|
33648
33689
|
},
|
|
33649
33690
|
// Timeline
|
|
33650
|
-
getUnifiedBeatTimeline: async (
|
|
33651
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33691
|
+
getUnifiedBeatTimeline: async (systemId, beatId) => {
|
|
33692
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/history`);
|
|
33652
33693
|
return result?.timeline ?? [];
|
|
33653
33694
|
},
|
|
33654
33695
|
// Plan Beat Versions (agent decomposition of a Beat into waypoint BVs)
|
|
@@ -33693,17 +33734,17 @@ function createHttpClient(config2) {
|
|
|
33693
33734
|
);
|
|
33694
33735
|
return result.score;
|
|
33695
33736
|
},
|
|
33696
|
-
rankSystemBeatVersions: async (
|
|
33737
|
+
rankSystemBeatVersions: async (systemId, lens) => {
|
|
33697
33738
|
const result = await request(
|
|
33698
33739
|
"GET",
|
|
33699
|
-
`/api/systems/${encodeURIComponent(
|
|
33740
|
+
`/api/systems/${encodeURIComponent(systemId)}/beat-versions/ranked?lens=${encodeURIComponent(lens)}`
|
|
33700
33741
|
);
|
|
33701
33742
|
return result.ranked ?? [];
|
|
33702
33743
|
},
|
|
33703
|
-
rankSystemBeatVersionsWithLeverage: async (
|
|
33744
|
+
rankSystemBeatVersionsWithLeverage: async (systemId, lens) => {
|
|
33704
33745
|
const result = await request(
|
|
33705
33746
|
"GET",
|
|
33706
|
-
`/api/systems/${encodeURIComponent(
|
|
33747
|
+
`/api/systems/${encodeURIComponent(systemId)}/beat-versions/ranked?lens=${encodeURIComponent(lens)}&withLeverage=true`
|
|
33707
33748
|
);
|
|
33708
33749
|
return result.ranked ?? [];
|
|
33709
33750
|
},
|
|
@@ -33713,10 +33754,10 @@ function createHttpClient(config2) {
|
|
|
33713
33754
|
// "Cannot read properties of undefined (reading 'edge')" and discarded the
|
|
33714
33755
|
// message the API had already produced. requestOrThrow parses `{ error }`
|
|
33715
33756
|
// and throws ApiError with that text. See N-4E09-6343.
|
|
33716
|
-
proposeEnablementEdges: async (
|
|
33757
|
+
proposeEnablementEdges: async (systemId, actorId, beatId) => {
|
|
33717
33758
|
const result = await requestOrThrow(
|
|
33718
33759
|
"POST",
|
|
33719
|
-
`/api/systems/${encodeURIComponent(
|
|
33760
|
+
`/api/systems/${encodeURIComponent(systemId)}/enablement-edges/propose`,
|
|
33720
33761
|
{ actorId, ...beatId !== void 0 && { beatId } }
|
|
33721
33762
|
);
|
|
33722
33763
|
return result?.proposed ?? [];
|
|
@@ -33755,8 +33796,8 @@ function createHttpClient(config2) {
|
|
|
33755
33796
|
if (!result.beat) throw new Error(`confirmBeatW: no beat in response for ${beatId}`);
|
|
33756
33797
|
return result.beat;
|
|
33757
33798
|
},
|
|
33758
|
-
getStaleWBeatIds: async (
|
|
33759
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33799
|
+
getStaleWBeatIds: async (systemId) => {
|
|
33800
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/stale-w-beats`);
|
|
33760
33801
|
return result.staleWBeatIds ?? [];
|
|
33761
33802
|
},
|
|
33762
33803
|
// Beat Composer
|
|
@@ -33783,61 +33824,61 @@ function createHttpClient(config2) {
|
|
|
33783
33824
|
return result;
|
|
33784
33825
|
},
|
|
33785
33826
|
// Beat Quality Check (fire-and-forget — returns taskId immediately, no polling)
|
|
33786
|
-
checkBeatQuality: async (
|
|
33827
|
+
checkBeatQuality: async (systemId, beatId) => {
|
|
33787
33828
|
const enqueued = await request(
|
|
33788
33829
|
"POST",
|
|
33789
|
-
`/api/systems/${encodeURIComponent(
|
|
33830
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/quality-check`
|
|
33790
33831
|
);
|
|
33791
33832
|
if (!enqueued?.taskId) throw new Error("Quality check enqueue failed: no taskId returned");
|
|
33792
33833
|
return { taskId: enqueued.taskId, status: "pending" };
|
|
33793
33834
|
},
|
|
33794
33835
|
// Beat Reframe (async — enqueue + poll)
|
|
33795
|
-
reframeBeat: async (
|
|
33836
|
+
reframeBeat: async (systemId, beatId) => {
|
|
33796
33837
|
const enqueued = await request(
|
|
33797
33838
|
"POST",
|
|
33798
|
-
`/api/systems/${encodeURIComponent(
|
|
33839
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/reframe`
|
|
33799
33840
|
);
|
|
33800
33841
|
if (!enqueued?.taskId) throw new Error("Reframe enqueue failed: no taskId returned");
|
|
33801
33842
|
return pollTaskResult(enqueued.taskId);
|
|
33802
33843
|
},
|
|
33803
33844
|
// Beat Planning
|
|
33804
|
-
planRevision: async (revisionId,
|
|
33845
|
+
planRevision: async (revisionId, systemId, messages) => {
|
|
33805
33846
|
const enqueued = await request(
|
|
33806
33847
|
"POST",
|
|
33807
33848
|
`/api/revisions/${encodeURIComponent(revisionId)}/plan`,
|
|
33808
|
-
{
|
|
33849
|
+
{ systemId, messages }
|
|
33809
33850
|
);
|
|
33810
33851
|
if (!enqueued?.taskId) throw new Error("Planning enqueue failed: no taskId returned");
|
|
33811
33852
|
return pollTaskResult(enqueued.taskId);
|
|
33812
33853
|
},
|
|
33813
33854
|
// Agent sessions
|
|
33814
|
-
startSession: async (
|
|
33855
|
+
startSession: async (systemId, message, triggeredBy, options) => {
|
|
33815
33856
|
const trimmedRevisionId = options?.revisionId?.trim();
|
|
33816
33857
|
const result = await request(
|
|
33817
33858
|
"POST",
|
|
33818
33859
|
`/api/sessions`,
|
|
33819
|
-
{ systemId
|
|
33860
|
+
{ systemId, message, ...triggeredBy && { triggeredBy }, ...trimmedRevisionId && { revisionId: trimmedRevisionId } }
|
|
33820
33861
|
);
|
|
33821
33862
|
if (!result?.taskId) throw new Error("Start session enqueue failed: no taskId returned");
|
|
33822
|
-
return { taskId: result.taskId, taskType: "generic_session", status: result.status ?? "pending", systemId
|
|
33863
|
+
return { taskId: result.taskId, taskType: "generic_session", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33823
33864
|
},
|
|
33824
|
-
planRevisionBatch: async (
|
|
33865
|
+
planRevisionBatch: async (systemId, revisionIds) => {
|
|
33825
33866
|
const result = await request(
|
|
33826
33867
|
"POST",
|
|
33827
|
-
`/api/systems/${encodeURIComponent(
|
|
33868
|
+
`/api/systems/${encodeURIComponent(systemId)}/revisions/plan-batch`,
|
|
33828
33869
|
revisionIds ? { revisionIds } : {}
|
|
33829
33870
|
);
|
|
33830
33871
|
if (!result?.taskId) throw new Error("Plan revision batch enqueue failed: no taskId returned");
|
|
33831
|
-
return { taskId: result.taskId, taskType: "plan_revision_batch", status: result.status ?? "pending", systemId
|
|
33872
|
+
return { taskId: result.taskId, taskType: "plan_revision_batch", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33832
33873
|
},
|
|
33833
|
-
draftCoda: async (
|
|
33874
|
+
draftCoda: async (systemId, beatId) => {
|
|
33834
33875
|
const result = await request(
|
|
33835
33876
|
"POST",
|
|
33836
|
-
`/api/systems/${encodeURIComponent(
|
|
33877
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/draft-coda`,
|
|
33837
33878
|
{}
|
|
33838
33879
|
);
|
|
33839
33880
|
if (!result?.taskId) throw new Error("Draft coda enqueue failed: no taskId returned");
|
|
33840
|
-
return { taskId: result.taskId, taskType: "draft_coda", status: result.status ?? "pending", systemId
|
|
33881
|
+
return { taskId: result.taskId, taskType: "draft_coda", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33841
33882
|
},
|
|
33842
33883
|
composeRootCoda: async (orgId) => {
|
|
33843
33884
|
const result = await request(
|
|
@@ -33848,45 +33889,45 @@ function createHttpClient(config2) {
|
|
|
33848
33889
|
if (!result?.taskId) throw new Error("Compose root Coda enqueue failed: no taskId returned");
|
|
33849
33890
|
return { taskId: result.taskId, taskType: "compose_root_coda", status: result.status ?? "pending", systemId: orgId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33850
33891
|
},
|
|
33851
|
-
validateAssumptions: async (
|
|
33892
|
+
validateAssumptions: async (systemId, noteIds) => {
|
|
33852
33893
|
const result = await request(
|
|
33853
33894
|
"POST",
|
|
33854
|
-
`/api/systems/${encodeURIComponent(
|
|
33895
|
+
`/api/systems/${encodeURIComponent(systemId)}/assumptions/validate`,
|
|
33855
33896
|
noteIds ? { noteIds } : {}
|
|
33856
33897
|
);
|
|
33857
33898
|
if (!result?.taskId) throw new Error("Assumption validation enqueue failed: no taskId returned");
|
|
33858
|
-
return { taskId: result.taskId, taskType: "validate_assumptions", status: result.status ?? "pending", systemId
|
|
33899
|
+
return { taskId: result.taskId, taskType: "validate_assumptions", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33859
33900
|
},
|
|
33860
|
-
runTriage: async (
|
|
33901
|
+
runTriage: async (systemId) => {
|
|
33861
33902
|
const result = await request(
|
|
33862
33903
|
"POST",
|
|
33863
|
-
`/api/systems/${encodeURIComponent(
|
|
33904
|
+
`/api/systems/${encodeURIComponent(systemId)}/triage`,
|
|
33864
33905
|
{}
|
|
33865
33906
|
);
|
|
33866
33907
|
if (!result?.taskId) throw new Error("Triage enqueue failed: no taskId returned");
|
|
33867
|
-
return { taskId: result.taskId, taskType: "triage_loop", status: result.status ?? "pending", systemId
|
|
33908
|
+
return { taskId: result.taskId, taskType: "triage_loop", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33868
33909
|
},
|
|
33869
|
-
baselineSystem: async (
|
|
33910
|
+
baselineSystem: async (systemId, options) => {
|
|
33870
33911
|
const result = await request(
|
|
33871
33912
|
"POST",
|
|
33872
|
-
`/api/systems/${encodeURIComponent(
|
|
33913
|
+
`/api/systems/${encodeURIComponent(systemId)}/baseline`,
|
|
33873
33914
|
{ beatIds: options?.beatIds, runChecks: options?.runChecks ?? true, localPath: options?.localPath }
|
|
33874
33915
|
);
|
|
33875
33916
|
if (!result?.taskId) throw new Error("Baseline enqueue failed: no taskId returned");
|
|
33876
|
-
return { taskId: result.taskId, taskType: "baseline_system", status: result.status ?? "pending", systemId
|
|
33917
|
+
return { taskId: result.taskId, taskType: "baseline_system", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33877
33918
|
},
|
|
33878
|
-
runCheck: async (
|
|
33919
|
+
runCheck: async (systemId, checkType, targetId, options) => {
|
|
33879
33920
|
const result = await request(
|
|
33880
33921
|
"POST",
|
|
33881
|
-
`/api/systems/${encodeURIComponent(
|
|
33922
|
+
`/api/systems/${encodeURIComponent(systemId)}/checks/run`,
|
|
33882
33923
|
{ checkType, targetId, branch: options?.branch, localPath: options?.localPath }
|
|
33883
33924
|
);
|
|
33884
33925
|
if (!result?.taskId) throw new Error("Check enqueue failed: no taskId returned");
|
|
33885
|
-
return { taskId: result.taskId, taskType: "run_check", status: result.status ?? "pending", systemId
|
|
33926
|
+
return { taskId: result.taskId, taskType: "run_check", status: result.status ?? "pending", systemId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33886
33927
|
},
|
|
33887
33928
|
// Subscriptions
|
|
33888
|
-
subscribe: async (userId, entityType, entityId,
|
|
33889
|
-
return request("POST", `/api/systems/${encodeURIComponent(
|
|
33929
|
+
subscribe: async (userId, entityType, entityId, systemId, source) => {
|
|
33930
|
+
return request("POST", `/api/systems/${encodeURIComponent(systemId)}/subscriptions`, { userId, entityType, entityId, source });
|
|
33890
33931
|
},
|
|
33891
33932
|
unsubscribe: async (userId, entityType, entityId, durable) => {
|
|
33892
33933
|
await request("DELETE", `/api/subscriptions/${encodeURIComponent(entityType)}/${encodeURIComponent(entityId)}`, { userId, durable });
|
|
@@ -33899,8 +33940,8 @@ function createHttpClient(config2) {
|
|
|
33899
33940
|
return request("GET", `/api/subscriptions/entity/${encodeURIComponent(entityId)}`, void 0);
|
|
33900
33941
|
},
|
|
33901
33942
|
// Project Snapshot — export runs as a background task to avoid Lambda timeout
|
|
33902
|
-
exportSystemSnapshot: async (
|
|
33903
|
-
const pid = encodeURIComponent(
|
|
33943
|
+
exportSystemSnapshot: async (systemId) => {
|
|
33944
|
+
const pid = encodeURIComponent(systemId);
|
|
33904
33945
|
const enqueued = await request("POST", `/api/systems/${pid}/export`, {});
|
|
33905
33946
|
if (!enqueued?.taskId) throw new Error("Export enqueue failed: no taskId returned");
|
|
33906
33947
|
await pollTaskResult(enqueued.taskId);
|
|
@@ -33929,32 +33970,32 @@ function createHttpClient(config2) {
|
|
|
33929
33970
|
return importResult;
|
|
33930
33971
|
},
|
|
33931
33972
|
// Embedding similarity
|
|
33932
|
-
embedSystemEntities: (
|
|
33933
|
-
findSimilarNotes: async (noteId,
|
|
33973
|
+
embedSystemEntities: (systemId) => request("POST", `/api/systems/${encodeURIComponent(systemId)}/embeddings/generate`),
|
|
33974
|
+
findSimilarNotes: async (noteId, systemId, options) => {
|
|
33934
33975
|
const qs = buildSimilarityQS(options);
|
|
33935
|
-
const res = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33976
|
+
const res = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes/${encodeURIComponent(noteId)}/similar${qs}`);
|
|
33936
33977
|
return res?.results ?? [];
|
|
33937
33978
|
},
|
|
33938
|
-
findSimilarNotesMulti: async (noteIds,
|
|
33979
|
+
findSimilarNotesMulti: async (noteIds, systemId, options) => {
|
|
33939
33980
|
const qs = buildSimilarityQS(options);
|
|
33940
33981
|
return Promise.all(
|
|
33941
33982
|
noteIds.map(async (noteId) => {
|
|
33942
33983
|
const res = await request(
|
|
33943
33984
|
"GET",
|
|
33944
|
-
`/api/systems/${encodeURIComponent(
|
|
33985
|
+
`/api/systems/${encodeURIComponent(systemId)}/notes/${encodeURIComponent(noteId)}/similar${qs}`
|
|
33945
33986
|
);
|
|
33946
33987
|
return { sourceNoteId: noteId, results: res?.results ?? [] };
|
|
33947
33988
|
})
|
|
33948
33989
|
);
|
|
33949
33990
|
},
|
|
33950
|
-
findRelatedBeats: async (noteId,
|
|
33991
|
+
findRelatedBeats: async (noteId, systemId, options) => {
|
|
33951
33992
|
const qs = buildSimilarityQS(options);
|
|
33952
|
-
const res = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33993
|
+
const res = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/notes/${encodeURIComponent(noteId)}/related-beats${qs}`);
|
|
33953
33994
|
return res?.results ?? [];
|
|
33954
33995
|
},
|
|
33955
|
-
findSimilarBeats: async (beatId,
|
|
33996
|
+
findSimilarBeats: async (beatId, systemId, options) => {
|
|
33956
33997
|
const qs = buildSimilarityQS(options);
|
|
33957
|
-
const res = await request("GET", `/api/systems/${encodeURIComponent(
|
|
33998
|
+
const res = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/similar${qs}`);
|
|
33958
33999
|
return res?.results ?? [];
|
|
33959
34000
|
},
|
|
33960
34001
|
searchByText: async (scope, query, options) => {
|
|
@@ -33971,21 +34012,21 @@ function createHttpClient(config2) {
|
|
|
33971
34012
|
const res = await request("GET", `/api/search?${params.toString()}`);
|
|
33972
34013
|
return res?.results ?? [];
|
|
33973
34014
|
},
|
|
33974
|
-
discoverRelationships: (
|
|
33975
|
-
clusterNotes: async (
|
|
33976
|
-
const res = await request("POST", `/api/systems/${encodeURIComponent(
|
|
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 ?? {});
|
|
33977
34018
|
return res;
|
|
33978
34019
|
},
|
|
33979
|
-
consolidateNotes: async (
|
|
33980
|
-
const res = await request("POST", `/api/systems/${encodeURIComponent(
|
|
34020
|
+
consolidateNotes: async (systemId, options) => {
|
|
34021
|
+
const res = await request("POST", `/api/systems/${encodeURIComponent(systemId)}/notes/consolidate`, options ?? {});
|
|
33981
34022
|
return res;
|
|
33982
34023
|
},
|
|
33983
|
-
clusterEntities: async (
|
|
33984
|
-
const res = await request("POST", `/api/systems/${encodeURIComponent(
|
|
34024
|
+
clusterEntities: async (systemId, entityType, options) => {
|
|
34025
|
+
const res = await request("POST", `/api/systems/${encodeURIComponent(systemId)}/entities/cluster`, { entityType, ...options });
|
|
33985
34026
|
return res;
|
|
33986
34027
|
},
|
|
33987
|
-
runClusteredAnalysis: async (
|
|
33988
|
-
const res = await request("POST", `/api/systems/${encodeURIComponent(
|
|
34028
|
+
runClusteredAnalysis: async (systemId, analysisType, options) => {
|
|
34029
|
+
const res = await request("POST", `/api/systems/${encodeURIComponent(systemId)}/entities/clustered-analysis`, { analysisType, ...options });
|
|
33989
34030
|
return res;
|
|
33990
34031
|
},
|
|
33991
34032
|
// Check queries
|
|
@@ -33993,7 +34034,7 @@ function createHttpClient(config2) {
|
|
|
33993
34034
|
const res = await request("GET", `/api/checks/${encodeURIComponent(checkId)}`);
|
|
33994
34035
|
return res.check;
|
|
33995
34036
|
},
|
|
33996
|
-
listSystemChecks: async (
|
|
34037
|
+
listSystemChecks: async (systemId, checkType, options) => {
|
|
33997
34038
|
const params = new URLSearchParams();
|
|
33998
34039
|
if (checkType) params.set("type", checkType);
|
|
33999
34040
|
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
@@ -34001,38 +34042,38 @@ function createHttpClient(config2) {
|
|
|
34001
34042
|
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
34002
34043
|
const res = await request(
|
|
34003
34044
|
"GET",
|
|
34004
|
-
`/api/systems/${encodeURIComponent(
|
|
34045
|
+
`/api/systems/${encodeURIComponent(systemId)}/checks${qs}`
|
|
34005
34046
|
);
|
|
34006
34047
|
return { checks: res?.checks ?? [], nextCursor: res?.nextCursor };
|
|
34007
34048
|
},
|
|
34008
|
-
listLatestSystemChecks: async (
|
|
34049
|
+
listLatestSystemChecks: async (systemId) => {
|
|
34009
34050
|
const res = await request(
|
|
34010
34051
|
"GET",
|
|
34011
|
-
`/api/checks/latest?
|
|
34052
|
+
`/api/checks/latest?systemId=${encodeURIComponent(systemId)}`
|
|
34012
34053
|
);
|
|
34013
34054
|
return res?.checks ?? [];
|
|
34014
34055
|
},
|
|
34015
|
-
listBeatChecks: async (beatId,
|
|
34056
|
+
listBeatChecks: async (beatId, systemId, checkType) => {
|
|
34016
34057
|
const qs = checkType ? `?type=${encodeURIComponent(checkType)}` : "";
|
|
34017
34058
|
const res = await request(
|
|
34018
34059
|
"GET",
|
|
34019
|
-
`/api/systems/${encodeURIComponent(
|
|
34060
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/checks${qs}`
|
|
34020
34061
|
);
|
|
34021
34062
|
return res.checks;
|
|
34022
34063
|
},
|
|
34023
|
-
listRevisionChecks: async (revisionId,
|
|
34064
|
+
listRevisionChecks: async (revisionId, systemId, checkType) => {
|
|
34024
34065
|
const qs = checkType ? `?type=${encodeURIComponent(checkType)}` : "";
|
|
34025
34066
|
const res = await request(
|
|
34026
34067
|
"GET",
|
|
34027
|
-
`/api/systems/${encodeURIComponent(
|
|
34068
|
+
`/api/systems/${encodeURIComponent(systemId)}/revisions/${encodeURIComponent(revisionId)}/checks${qs}`
|
|
34028
34069
|
);
|
|
34029
34070
|
return res.checks;
|
|
34030
34071
|
},
|
|
34031
|
-
listBeatVersionChecks: async (beatVersionId,
|
|
34072
|
+
listBeatVersionChecks: async (beatVersionId, systemId, checkType) => {
|
|
34032
34073
|
const qs = checkType ? `?type=${encodeURIComponent(checkType)}` : "";
|
|
34033
34074
|
const res = await request(
|
|
34034
34075
|
"GET",
|
|
34035
|
-
`/api/systems/${encodeURIComponent(
|
|
34076
|
+
`/api/systems/${encodeURIComponent(systemId)}/beat-versions/${encodeURIComponent(beatVersionId)}/checks${qs}`
|
|
34036
34077
|
);
|
|
34037
34078
|
return res.checks;
|
|
34038
34079
|
},
|
|
@@ -34053,9 +34094,9 @@ function createHttpClient(config2) {
|
|
|
34053
34094
|
return res.check;
|
|
34054
34095
|
},
|
|
34055
34096
|
// Audit integrity
|
|
34056
|
-
verifyAuditIntegrity: async (
|
|
34097
|
+
verifyAuditIntegrity: async (systemId, options) => {
|
|
34057
34098
|
const qs = options?.limit ? `?limit=${options.limit}` : "";
|
|
34058
|
-
return request("POST", `/api/systems/${encodeURIComponent(
|
|
34099
|
+
return request("POST", `/api/systems/${encodeURIComponent(systemId)}/audit/verify${qs}`);
|
|
34059
34100
|
},
|
|
34060
34101
|
// Teamspaces
|
|
34061
34102
|
listOrgTeamspaces: async (orgId) => {
|
|
@@ -34077,9 +34118,9 @@ function createHttpClient(config2) {
|
|
|
34077
34118
|
if (res === void 0) throw new Error(`Teamspace ${teamspaceId} not found`);
|
|
34078
34119
|
return res.deliverableGroups;
|
|
34079
34120
|
},
|
|
34080
|
-
listSystemDeliverableGroups: async (
|
|
34081
|
-
const res = await request("GET", `/api/systems/${encodeURIComponent(
|
|
34082
|
-
if (res === void 0) throw new Error(`Project ${
|
|
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`);
|
|
34083
34124
|
return res.deliverableGroups;
|
|
34084
34125
|
},
|
|
34085
34126
|
listMovementDeliverableGroups: async (movementId) => {
|
|
@@ -34563,20 +34604,20 @@ function createHttpClient(config2) {
|
|
|
34563
34604
|
return request("POST", `/api/accounts/${encodeURIComponent(accountId)}/drops/proposal`, options?.lens ? { lens: options.lens } : {});
|
|
34564
34605
|
},
|
|
34565
34606
|
// Beat Versions (three-tier hierarchy: Beat → Beat Version → Revision)
|
|
34566
|
-
listBeatVersions: async (
|
|
34607
|
+
listBeatVersions: async (systemId, options) => {
|
|
34567
34608
|
const params = new URLSearchParams();
|
|
34568
34609
|
if (options?.beatId) params.set("beatId", options.beatId);
|
|
34569
34610
|
if (options?.status) params.set("status", options.status);
|
|
34570
34611
|
if (options?.includeTerminal) params.set("includeTerminal", "true");
|
|
34571
34612
|
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
34572
|
-
const res = await request("GET", `/api/systems/${encodeURIComponent(
|
|
34613
|
+
const res = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/beat-versions${qs}`);
|
|
34573
34614
|
return res ?? [];
|
|
34574
34615
|
},
|
|
34575
34616
|
getBeatVersion: async (beatVersionId) => {
|
|
34576
34617
|
return request("GET", `/api/beat-versions/${encodeURIComponent(beatVersionId)}`);
|
|
34577
34618
|
},
|
|
34578
|
-
createBeatVersion: async (
|
|
34579
|
-
return request("POST", `/api/systems/${encodeURIComponent(
|
|
34619
|
+
createBeatVersion: async (systemId, beatId, input) => {
|
|
34620
|
+
return request("POST", `/api/systems/${encodeURIComponent(systemId)}/beats/${encodeURIComponent(beatId)}/beat-versions`, input);
|
|
34580
34621
|
},
|
|
34581
34622
|
updateBeatVersion: async (beatVersionId, updates) => {
|
|
34582
34623
|
return request("PATCH", `/api/beat-versions/${encodeURIComponent(beatVersionId)}`, updates);
|
|
@@ -34630,17 +34671,17 @@ function createHttpClient(config2) {
|
|
|
34630
34671
|
return res.guidelines;
|
|
34631
34672
|
},
|
|
34632
34673
|
// Next Actions & Triage
|
|
34633
|
-
getNextActions: async (
|
|
34674
|
+
getNextActions: async (systemId, options) => {
|
|
34634
34675
|
const qs = options?.limit ? `?limit=${options.limit}` : "";
|
|
34635
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
34676
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/next-actions${qs}`);
|
|
34636
34677
|
return result?.actions ?? [];
|
|
34637
34678
|
},
|
|
34638
|
-
listTriageActions: async (
|
|
34639
|
-
const result = await request("GET", `/api/systems/${encodeURIComponent(
|
|
34679
|
+
listTriageActions: async (systemId) => {
|
|
34680
|
+
const result = await request("GET", `/api/systems/${encodeURIComponent(systemId)}/triage-actions`);
|
|
34640
34681
|
return result?.actions ?? [];
|
|
34641
34682
|
},
|
|
34642
|
-
dismissTriageAction: async (
|
|
34643
|
-
await request("POST", `/api/systems/${encodeURIComponent(
|
|
34683
|
+
dismissTriageAction: async (systemId, actionKey, _userId) => {
|
|
34684
|
+
await request("POST", `/api/systems/${encodeURIComponent(systemId)}/triage-actions/${encodeURIComponent(actionKey)}/dismiss`);
|
|
34644
34685
|
},
|
|
34645
34686
|
// Onboarding (LLM-heavy — delegate to API)
|
|
34646
34687
|
initiateOnboarding: async (orgId, input) => {
|
|
@@ -34652,17 +34693,17 @@ function createHttpClient(config2) {
|
|
|
34652
34693
|
if (!result) throw new Error(`Onboarding initiate failed: org ${orgId} not found`);
|
|
34653
34694
|
return result;
|
|
34654
34695
|
},
|
|
34655
|
-
draftOnboardingBeats: async (
|
|
34696
|
+
draftOnboardingBeats: async (systemId, input) => {
|
|
34656
34697
|
const result = await request(
|
|
34657
34698
|
"POST",
|
|
34658
|
-
`/api/systems/${encodeURIComponent(
|
|
34699
|
+
`/api/systems/${encodeURIComponent(systemId)}/beats/draft`,
|
|
34659
34700
|
input
|
|
34660
34701
|
);
|
|
34661
|
-
if (!result) throw new Error(`Beat draft failed: project ${
|
|
34702
|
+
if (!result) throw new Error(`Beat draft failed: project ${systemId} not found`);
|
|
34662
34703
|
return result;
|
|
34663
34704
|
},
|
|
34664
|
-
triggerSystemEmbedding: async (
|
|
34665
|
-
await request("POST", `/api/systems/${encodeURIComponent(
|
|
34705
|
+
triggerSystemEmbedding: async (systemId) => {
|
|
34706
|
+
await request("POST", `/api/systems/${encodeURIComponent(systemId)}/embedding`);
|
|
34666
34707
|
},
|
|
34667
34708
|
// Notebooks (B-271)
|
|
34668
34709
|
createNotebook: async (input) => {
|
|
@@ -34924,7 +34965,7 @@ function loadConfig() {
|
|
|
34924
34965
|
};
|
|
34925
34966
|
}
|
|
34926
34967
|
async function main() {
|
|
34927
|
-
console.error(`[harmonica-mcp] v${"
|
|
34968
|
+
console.error(`[harmonica-mcp] v${"4.0.0"} starting\u2026`);
|
|
34928
34969
|
const config2 = loadConfig();
|
|
34929
34970
|
const client = createHttpClient({
|
|
34930
34971
|
apiBaseUrl: config2.apiBaseUrl,
|