@triedotdev/mcp 1.0.144 → 1.0.146
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.
|
@@ -5520,7 +5520,7 @@ import { join as join2 } from "path";
|
|
|
5520
5520
|
import { execSync } from "child_process";
|
|
5521
5521
|
|
|
5522
5522
|
// src/integrations/cursor-cloud-agent.ts
|
|
5523
|
-
var BASE_URL = "https://api.cursor.com/
|
|
5523
|
+
var BASE_URL = "https://api.cursor.com/v0";
|
|
5524
5524
|
var CursorCloudAgentClient = class {
|
|
5525
5525
|
apiKey;
|
|
5526
5526
|
constructor(apiKey) {
|
|
@@ -5528,34 +5528,31 @@ var CursorCloudAgentClient = class {
|
|
|
5528
5528
|
}
|
|
5529
5529
|
/**
|
|
5530
5530
|
* Dispatch an issue to a cloud agent for fixing.
|
|
5531
|
+
* Uses Cursor Background Agent API: POST /agents
|
|
5531
5532
|
*/
|
|
5532
5533
|
async dispatch(issue, triageResult, repoUrl, branch) {
|
|
5533
|
-
const
|
|
5534
|
+
const promptText = this.buildPrompt(issue, triageResult);
|
|
5534
5535
|
const body = {
|
|
5535
|
-
prompt,
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
issueId: issue.id,
|
|
5540
|
-
file: issue.file,
|
|
5541
|
-
line: issue.line,
|
|
5542
|
-
severity: issue.severity,
|
|
5543
|
-
agent: issue.agent
|
|
5536
|
+
prompt: { text: promptText },
|
|
5537
|
+
source: {
|
|
5538
|
+
repository: repoUrl,
|
|
5539
|
+
ref: branch
|
|
5544
5540
|
}
|
|
5545
5541
|
};
|
|
5546
|
-
const res = await this.request("POST", "/agents
|
|
5542
|
+
const res = await this.request("POST", "/agents", body);
|
|
5547
5543
|
return {
|
|
5548
5544
|
jobId: res.id ?? res.taskId ?? res.jobId,
|
|
5549
5545
|
status: "dispatched",
|
|
5550
5546
|
artifactUrls: [],
|
|
5551
|
-
dispatchedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5547
|
+
dispatchedAt: res.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
5552
5548
|
};
|
|
5553
5549
|
}
|
|
5554
5550
|
/**
|
|
5555
5551
|
* Poll job status.
|
|
5552
|
+
* Uses Cursor Background Agent API: GET /agents/:id
|
|
5556
5553
|
*/
|
|
5557
5554
|
async poll(jobId) {
|
|
5558
|
-
const res = await this.request("GET", `/agents
|
|
5555
|
+
const res = await this.request("GET", `/agents/${jobId}`);
|
|
5559
5556
|
const status = mapStatus(res.status);
|
|
5560
5557
|
const prUrl = extractPrUrl(res);
|
|
5561
5558
|
const artifactUrls = this.extractArtifacts(res);
|
|
@@ -5565,14 +5562,15 @@ var CursorCloudAgentClient = class {
|
|
|
5565
5562
|
* Get artifact URLs for a completed job.
|
|
5566
5563
|
*/
|
|
5567
5564
|
async getArtifacts(jobId) {
|
|
5568
|
-
const res = await this.request("GET", `/agents
|
|
5565
|
+
const res = await this.request("GET", `/agents/${jobId}`);
|
|
5569
5566
|
return this.extractArtifacts(res);
|
|
5570
5567
|
}
|
|
5571
5568
|
/**
|
|
5572
5569
|
* Cancel a running job.
|
|
5570
|
+
* Uses Cursor Background Agent API: DELETE /agents/:id
|
|
5573
5571
|
*/
|
|
5574
5572
|
async cancelJob(jobId) {
|
|
5575
|
-
await this.request("DELETE", `/agents
|
|
5573
|
+
await this.request("DELETE", `/agents/${jobId}`);
|
|
5576
5574
|
}
|
|
5577
5575
|
// --------------------------------------------------------------------------
|
|
5578
5576
|
// Internal
|
|
@@ -5616,7 +5614,10 @@ var CursorCloudAgentClient = class {
|
|
|
5616
5614
|
);
|
|
5617
5615
|
}
|
|
5618
5616
|
if (res.status === 404) {
|
|
5619
|
-
|
|
5617
|
+
const isLaunch = path2 === "/agents" && method === "POST";
|
|
5618
|
+
throw new Error(
|
|
5619
|
+
isLaunch ? "Cursor Background Agent API endpoint not found. Ensure your Cursor API key has Background Agent access (cursor.com/dashboard \u2192 Integrations)." : `Job not found: ${path2}`
|
|
5620
|
+
);
|
|
5620
5621
|
}
|
|
5621
5622
|
if (res.status >= 500) {
|
|
5622
5623
|
throw new Error(
|
|
@@ -5648,16 +5649,17 @@ var CursorCloudAgentClient = class {
|
|
|
5648
5649
|
}
|
|
5649
5650
|
};
|
|
5650
5651
|
function mapStatus(raw) {
|
|
5651
|
-
switch (raw) {
|
|
5652
|
-
case "
|
|
5653
|
-
case "
|
|
5652
|
+
switch (raw?.toUpperCase()) {
|
|
5653
|
+
case "PENDING":
|
|
5654
|
+
case "QUEUED":
|
|
5655
|
+
case "CREATING":
|
|
5654
5656
|
return "pending";
|
|
5655
|
-
case "
|
|
5656
|
-
case "
|
|
5657
|
+
case "RUNNING":
|
|
5658
|
+
case "IN_PROGRESS":
|
|
5657
5659
|
return "running";
|
|
5658
|
-
case "
|
|
5659
|
-
case "
|
|
5660
|
-
case "
|
|
5660
|
+
case "COMPLETED":
|
|
5661
|
+
case "SUCCEEDED":
|
|
5662
|
+
case "VERIFIED":
|
|
5661
5663
|
return "completed";
|
|
5662
5664
|
default:
|
|
5663
5665
|
return "failed";
|
|
@@ -9658,4 +9660,4 @@ export {
|
|
|
9658
9660
|
GitHubBranchesTool,
|
|
9659
9661
|
InteractiveDashboard
|
|
9660
9662
|
};
|
|
9661
|
-
//# sourceMappingURL=chunk-
|
|
9663
|
+
//# sourceMappingURL=chunk-US4P265N.js.map
|