cursor-delegate-mcp 1.11.0 → 1.11.1
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/package.json +1 -1
- package/src/delegate.js +32 -17
- package/src/server.js +7 -5
package/package.json
CHANGED
package/src/delegate.js
CHANGED
|
@@ -570,15 +570,34 @@ export async function runDelegate({
|
|
|
570
570
|
? (sawToolCall ? "post-tool" : "tool-free-stream")
|
|
571
571
|
: "none";
|
|
572
572
|
const protocolWarnings = [];
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
573
|
+
// plan.detail is the model restating — into chat's sibling channel — a plan it also filed via
|
|
574
|
+
// create_plan; cursor-agent narrates across the IDE's two surfaces and here they flatten into
|
|
575
|
+
// one ACP payload. The detail is never load-bearing: the plan lives in the agent's own session
|
|
576
|
+
// (which is what a resume-to-implement reads, not this field) and the orchestrator approves
|
|
577
|
+
// from result + plan.entries. So in plan/ask keep the plan in one prose channel — drop the
|
|
578
|
+
// detail as a duplicate when result already is a real plan message, fold it into result when
|
|
579
|
+
// the message is too terse (or a fallback preamble) to be the plan itself. In agent mode the
|
|
580
|
+
// plan was accepted and result is the implementation report, a separate artifact — both stay.
|
|
581
|
+
const PLAN_TERSE_FLOOR = 200;
|
|
582
|
+
let dropPlanDetail = false;
|
|
583
|
+
if (typeof planDetail === "string" && (mode === "plan" || mode === "ask")) {
|
|
584
|
+
dropPlanDetail = true;
|
|
585
|
+
if (!(finalMessageAvailable && result.length >= PLAN_TERSE_FLOOR)) {
|
|
586
|
+
result = planDetail;
|
|
587
|
+
resultSource = "plan-detail";
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
if (resultSource !== "plan-detail") {
|
|
591
|
+
if (!finalMessageAvailable && discardedResult) {
|
|
592
|
+
result = discardedResult;
|
|
593
|
+
resultSource = "pre-tool-fallback";
|
|
594
|
+
protocolWarnings.push(
|
|
595
|
+
"the agent ran a tool after its last message and never spoke again, so no final message closed the turn."
|
|
596
|
+
+ " result carries the last message before that tool call — it may be a preamble rather than the answer."
|
|
597
|
+
);
|
|
598
|
+
} else if (!finalMessageAvailable) {
|
|
599
|
+
protocolWarnings.push("the agent ended the turn without emitting any message; result is empty.");
|
|
600
|
+
}
|
|
582
601
|
}
|
|
583
602
|
// A runaway reply comes back whole and can blow the caller's context (104K chars in one
|
|
584
603
|
// test). When the caller sets a ceiling, cut the result to it and say so, so the truncation
|
|
@@ -620,14 +639,10 @@ export async function runDelegate({
|
|
|
620
639
|
protocolWarnings.push(...contextWarnings);
|
|
621
640
|
if (planEntries.length > 0 || planOverview !== undefined || planDetail !== undefined) {
|
|
622
641
|
out.plan = sanitizePlan(protocolWarnings);
|
|
623
|
-
// plan
|
|
624
|
-
//
|
|
625
|
-
//
|
|
626
|
-
|
|
627
|
-
// are structured and unique, and always stay.
|
|
628
|
-
if (typeof out.plan.detail === "string" && result.length >= out.plan.detail.length) {
|
|
629
|
-
delete out.plan.detail;
|
|
630
|
-
}
|
|
642
|
+
// In plan/ask the plan is already carried by result (a real message, or folded in per the
|
|
643
|
+
// one-plan contract above), so the detail here is a duplicate — drop it. entries and
|
|
644
|
+
// overview are structured and unique, and always stay.
|
|
645
|
+
if (dropPlanDetail) delete out.plan.detail;
|
|
631
646
|
}
|
|
632
647
|
// Most successful turns emit no todos at all, so an empty list would read as "nothing
|
|
633
648
|
// done" rather than "not tracked". Report only what the agent actually sent.
|
package/src/server.js
CHANGED
|
@@ -40,8 +40,8 @@ const planEntrySchema = z.object({
|
|
|
40
40
|
|
|
41
41
|
const delegateOutputSchema = z.object({
|
|
42
42
|
result: z.string(),
|
|
43
|
-
resultSource: z.enum(["tool-free-stream", "post-tool", "pre-tool-fallback", "none"]).optional().describe(
|
|
44
|
-
"Where result came from. pre-tool-fallback means no final message closed the turn and result is the last message before the agent's final tool call — read protocolWarnings before trusting it as the answer."
|
|
43
|
+
resultSource: z.enum(["tool-free-stream", "post-tool", "pre-tool-fallback", "plan-detail", "none"]).optional().describe(
|
|
44
|
+
"Where result came from. pre-tool-fallback means no final message closed the turn and result is the last message before the agent's final tool call — read protocolWarnings before trusting it as the answer. plan-detail (plan/ask only) means the agent's chat message was too terse to be the plan, so result carries the plan it filed via create_plan."
|
|
45
45
|
),
|
|
46
46
|
finalMessageAvailable: z.boolean().optional(),
|
|
47
47
|
stopReason: z.string().optional().describe(
|
|
@@ -68,7 +68,9 @@ const delegateOutputSchema = z.object({
|
|
|
68
68
|
entries: z.array(planEntrySchema),
|
|
69
69
|
overview: z.string().optional(),
|
|
70
70
|
detail: z.string().optional(),
|
|
71
|
-
}).optional()
|
|
71
|
+
}).optional().describe(
|
|
72
|
+
"The agent's plan. entries and overview are the structured plan and always present when a plan exists. detail (a prose rendition the agent also filed) is kept only in agent mode; in plan/ask it is dropped because result already carries the plan — as the agent's own message, or folded in (resultSource plan-detail) when that message was too terse. To act on a plan, resume the sessionId rather than forwarding detail: the plan lives in the agent's session."
|
|
73
|
+
),
|
|
72
74
|
todos: z.array(z.object({
|
|
73
75
|
id: z.string(),
|
|
74
76
|
content: z.string(),
|
|
@@ -80,7 +82,7 @@ const delegateOutputSchema = z.object({
|
|
|
80
82
|
"Set when the agent switched itself out of the requested mode mid-session. Absence does not mean the mode was honored — an agent can write while staying in plan."
|
|
81
83
|
),
|
|
82
84
|
writeCapableActivity: z.array(z.object({ kind: z.string(), detail: z.string(), path: z.string().optional() })).optional().describe(
|
|
83
|
-
"Write-capable tool calls (edit/delete/move/execute) the agent ran during a plan or ask turn, which are expected to change nothing. Records what ran, not what changed —
|
|
85
|
+
"Write-capable tool calls (edit/delete/move/execute) the agent ran during a plan or ask turn, which are expected to change nothing. Records what ran, not what changed — kind is what the tool could do, not proof it wrote: an execute entry may be a read-only command like `ls -la`. Read detail for the evidence and the git diff for the truth. Only populated for mode plan and ask."
|
|
84
86
|
),
|
|
85
87
|
todoProgress: z.object({
|
|
86
88
|
total: z.number(),
|
|
@@ -111,7 +113,7 @@ const doctorOutputSchema = z.object({
|
|
|
111
113
|
|
|
112
114
|
export const delegateInputSchema = z.object({
|
|
113
115
|
spec: z.string().trim().min(1, "spec must not be blank").describe("Inline task brief (default): goal, scope, decisions already made (constraints and fixed choices — quote the user's exact values verbatim), acceptance criteria. Point at files to read or mimic rather than pasting code. Optional file path if the user wants a persisted spec."),
|
|
114
|
-
mode: z.enum(["agent", "plan", "ask"]).default("agent").describe("Requested agent mode. plan and ask are passed to the agent as instructions, not enforced by the bridge — the agent may write in any of them; modeChanged reports it if it switched."),
|
|
116
|
+
mode: z.enum(["agent", "plan", "ask"]).default("agent").describe("Requested agent mode. plan and ask are passed to the agent as instructions, not enforced by the bridge — the agent may write in any of them; modeChanged reports it if it switched. ask held on every model tested while plan compliance varies by model, so prefer ask when you need the stricter read-only instruction."),
|
|
115
117
|
resumeSessionId: z.string().optional().describe("Resume an existing ACP session instead of a new one"),
|
|
116
118
|
workspace: z.string().optional().describe("Working directory for the agent (defaults to cwd). Must be an existing directory; the call fails rather than creating it."),
|
|
117
119
|
model: z.string().trim().min(1, "model must be a non-empty string").default(DEFAULT_MODEL),
|