planpong 0.4.2 → 0.5.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/src/config/defaults.js +1 -0
- package/dist/src/config/defaults.js.map +1 -1
- package/dist/src/config/loader.d.ts +1 -0
- package/dist/src/config/loader.js +3 -0
- package/dist/src/config/loader.js.map +1 -1
- package/dist/src/core/apply-edits.d.ts +40 -0
- package/dist/src/core/apply-edits.js +220 -0
- package/dist/src/core/apply-edits.js.map +1 -0
- package/dist/src/core/convergence.d.ts +18 -2
- package/dist/src/core/convergence.js +21 -9
- package/dist/src/core/convergence.js.map +1 -1
- package/dist/src/core/operations.d.ts +14 -1
- package/dist/src/core/operations.js +551 -62
- package/dist/src/core/operations.js.map +1 -1
- package/dist/src/core/plan-diff.d.ts +23 -0
- package/dist/src/core/plan-diff.js +135 -0
- package/dist/src/core/plan-diff.js.map +1 -0
- package/dist/src/core/session.d.ts +11 -0
- package/dist/src/core/session.js +51 -1
- package/dist/src/core/session.js.map +1 -1
- package/dist/src/mcp/tools/get-feedback.d.ts +16 -0
- package/dist/src/mcp/tools/get-feedback.js +118 -114
- package/dist/src/mcp/tools/get-feedback.js.map +1 -1
- package/dist/src/mcp/tools/revise.d.ts +16 -0
- package/dist/src/mcp/tools/revise.js +76 -61
- package/dist/src/mcp/tools/revise.js.map +1 -1
- package/dist/src/mcp/tools/status.js +15 -1
- package/dist/src/mcp/tools/status.js.map +1 -1
- package/dist/src/prompts/planner.d.ts +34 -1
- package/dist/src/prompts/planner.js +239 -4
- package/dist/src/prompts/planner.js.map +1 -1
- package/dist/src/prompts/reviewer.d.ts +13 -0
- package/dist/src/prompts/reviewer.js +65 -0
- package/dist/src/prompts/reviewer.js.map +1 -1
- package/dist/src/providers/claude.js +19 -3
- package/dist/src/providers/claude.js.map +1 -1
- package/dist/src/providers/codex.js +50 -3
- package/dist/src/providers/codex.js.map +1 -1
- package/dist/src/providers/types.d.ts +20 -0
- package/dist/src/schemas/config.d.ts +3 -0
- package/dist/src/schemas/config.js +6 -0
- package/dist/src/schemas/config.js.map +1 -1
- package/dist/src/schemas/json-schema.d.ts +12 -0
- package/dist/src/schemas/json-schema.js +20 -1
- package/dist/src/schemas/json-schema.js.map +1 -1
- package/dist/src/schemas/metrics.d.ts +171 -0
- package/dist/src/schemas/metrics.js +49 -0
- package/dist/src/schemas/metrics.js.map +1 -0
- package/dist/src/schemas/revision.d.ts +166 -2
- package/dist/src/schemas/revision.js +35 -2
- package/dist/src/schemas/revision.js.map +1 -1
- package/dist/src/schemas/session.d.ts +6 -0
- package/dist/src/schemas/session.js +10 -0
- package/dist/src/schemas/session.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,130 +13,134 @@ const inputSchema = {
|
|
|
13
13
|
.optional()
|
|
14
14
|
.describe("Working directory (defaults to process.cwd())"),
|
|
15
15
|
};
|
|
16
|
-
export function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
isError: true,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
if (session.status !== "in_review") {
|
|
34
|
-
return {
|
|
35
|
-
content: [
|
|
36
|
-
{
|
|
37
|
-
type: "text",
|
|
38
|
-
text: JSON.stringify({
|
|
39
|
-
error: `Session status is '${session.status}', expected 'in_review'`,
|
|
40
|
-
}),
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
isError: true,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
// Advance round
|
|
47
|
-
session.currentRound++;
|
|
48
|
-
writeSessionState(cwd, session);
|
|
49
|
-
const config = loadConfig({ cwd });
|
|
50
|
-
// Use session-stored provider config
|
|
51
|
-
const reviewerProvider = getProvider(session.reviewer.provider);
|
|
52
|
-
if (!reviewerProvider) {
|
|
53
|
-
return {
|
|
54
|
-
content: [
|
|
55
|
-
{
|
|
56
|
-
type: "text",
|
|
57
|
-
text: JSON.stringify({
|
|
58
|
-
error: `Reviewer provider not found: ${session.reviewer.provider}`,
|
|
59
|
-
}),
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
isError: true,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
// Build config with session overrides
|
|
66
|
-
const sessionConfig = {
|
|
67
|
-
...config,
|
|
68
|
-
reviewer: session.reviewer,
|
|
69
|
-
planner: session.planner,
|
|
70
|
-
};
|
|
71
|
-
const result = await runReviewRound(session, cwd, sessionConfig, reviewerProvider);
|
|
72
|
-
// Update status line with review results
|
|
73
|
-
const suffix = result.converged
|
|
74
|
-
? result.feedback.verdict === "blocked"
|
|
75
|
-
? `BLOCKED in ${getReviewPhase(result.round)} phase`
|
|
76
|
-
: `Approved after ${result.round} rounds`
|
|
77
|
-
: `Reviewed — ${result.feedback.issues.length} issues`;
|
|
78
|
-
const statusLine = writeStatusLineToPlan(session, cwd, sessionConfig, suffix);
|
|
79
|
-
const phase = getReviewPhase(result.round);
|
|
80
|
-
const response = {
|
|
81
|
-
round: result.round,
|
|
82
|
-
phase,
|
|
83
|
-
verdict: result.feedback.verdict,
|
|
84
|
-
summary: result.feedback.summary,
|
|
85
|
-
issues: result.feedback.issues,
|
|
86
|
-
severity_counts: result.severity,
|
|
87
|
-
is_converged: result.converged,
|
|
88
|
-
status_line: statusLine,
|
|
16
|
+
export async function getFeedbackHandler(input) {
|
|
17
|
+
const cwd = input.cwd ?? process.cwd();
|
|
18
|
+
const session = readSessionState(cwd, input.session_id);
|
|
19
|
+
if (!session) {
|
|
20
|
+
return {
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: "text",
|
|
24
|
+
text: JSON.stringify({
|
|
25
|
+
error: `Session not found: ${input.session_id}`,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
isError: true,
|
|
89
30
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
response.is_blocked = true;
|
|
93
|
-
}
|
|
94
|
-
if (phase === "direction" && result.phaseExtras.confidence) {
|
|
95
|
-
response.confidence = result.phaseExtras.confidence;
|
|
96
|
-
}
|
|
97
|
-
if (phase === "risk") {
|
|
98
|
-
if (result.phaseExtras.risk_level) {
|
|
99
|
-
response.risk_level = result.phaseExtras.risk_level;
|
|
100
|
-
}
|
|
101
|
-
if (result.phaseExtras.risk_count !== undefined) {
|
|
102
|
-
response.risk_count = result.phaseExtras.risk_count;
|
|
103
|
-
}
|
|
104
|
-
if (result.phaseExtras.risks_promoted !== undefined) {
|
|
105
|
-
response.risks_promoted = result.phaseExtras.risks_promoted;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (result.converged) {
|
|
109
|
-
if (result.feedback.verdict === "blocked") {
|
|
110
|
-
session.status = "blocked";
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
session.status = "approved";
|
|
114
|
-
const planPath = resolve(cwd, session.planPath);
|
|
115
|
-
let planContent = readFileSync(planPath, "utf-8");
|
|
116
|
-
planContent = planContent.replace(/\*\*Status:\*\* .*/, "**Status:** Approved");
|
|
117
|
-
writeFileSync(planPath, planContent);
|
|
118
|
-
}
|
|
119
|
-
writeSessionState(cwd, session);
|
|
120
|
-
// Include initial plan for change summary
|
|
121
|
-
const initialPlan = readInitialPlan(cwd, session.id);
|
|
122
|
-
if (initialPlan) {
|
|
123
|
-
response.initial_plan = initialPlan;
|
|
124
|
-
const planPath = resolve(cwd, session.planPath);
|
|
125
|
-
response.final_plan = readFileSync(planPath, "utf-8");
|
|
126
|
-
}
|
|
127
|
-
}
|
|
31
|
+
}
|
|
32
|
+
if (session.status !== "in_review") {
|
|
128
33
|
return {
|
|
129
34
|
content: [
|
|
130
35
|
{
|
|
131
36
|
type: "text",
|
|
132
|
-
text:
|
|
37
|
+
text: JSON.stringify({
|
|
38
|
+
error: `Session status is '${session.status}', expected 'in_review'`,
|
|
39
|
+
}),
|
|
133
40
|
},
|
|
41
|
+
],
|
|
42
|
+
isError: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// Advance round
|
|
46
|
+
session.currentRound++;
|
|
47
|
+
writeSessionState(cwd, session);
|
|
48
|
+
const config = loadConfig({ cwd });
|
|
49
|
+
// Use session-stored provider config
|
|
50
|
+
const reviewerProvider = getProvider(session.reviewer.provider);
|
|
51
|
+
if (!reviewerProvider) {
|
|
52
|
+
return {
|
|
53
|
+
content: [
|
|
134
54
|
{
|
|
135
55
|
type: "text",
|
|
136
|
-
text: JSON.stringify(
|
|
56
|
+
text: JSON.stringify({
|
|
57
|
+
error: `Reviewer provider not found: ${session.reviewer.provider}`,
|
|
58
|
+
}),
|
|
137
59
|
},
|
|
138
60
|
],
|
|
61
|
+
isError: true,
|
|
139
62
|
};
|
|
140
|
-
}
|
|
63
|
+
}
|
|
64
|
+
// Build config with session overrides
|
|
65
|
+
const sessionConfig = {
|
|
66
|
+
...config,
|
|
67
|
+
reviewer: session.reviewer,
|
|
68
|
+
planner: session.planner,
|
|
69
|
+
};
|
|
70
|
+
const result = await runReviewRound(session, cwd, sessionConfig, reviewerProvider);
|
|
71
|
+
// Update status line with review results
|
|
72
|
+
const suffix = result.converged
|
|
73
|
+
? result.feedback.verdict === "blocked"
|
|
74
|
+
? `BLOCKED in ${getReviewPhase(result.round)} phase`
|
|
75
|
+
: `Approved after ${result.round} rounds`
|
|
76
|
+
: `Reviewed — ${result.feedback.issues.length} issues`;
|
|
77
|
+
const statusLine = writeStatusLineToPlan(session, cwd, sessionConfig, suffix);
|
|
78
|
+
const phase = getReviewPhase(result.round);
|
|
79
|
+
const response = {
|
|
80
|
+
round: result.round,
|
|
81
|
+
phase,
|
|
82
|
+
verdict: result.feedback.verdict,
|
|
83
|
+
summary: result.feedback.summary,
|
|
84
|
+
issues: result.feedback.issues,
|
|
85
|
+
severity_counts: result.severity,
|
|
86
|
+
is_converged: result.converged,
|
|
87
|
+
status_line: statusLine,
|
|
88
|
+
};
|
|
89
|
+
if (result.timing) {
|
|
90
|
+
response.timing = result.timing;
|
|
91
|
+
}
|
|
92
|
+
// Phase-specific lean fields for status line consumption
|
|
93
|
+
if (result.phaseExtras.is_blocked) {
|
|
94
|
+
response.is_blocked = true;
|
|
95
|
+
}
|
|
96
|
+
if (phase === "direction" && result.phaseExtras.confidence) {
|
|
97
|
+
response.confidence = result.phaseExtras.confidence;
|
|
98
|
+
}
|
|
99
|
+
if (phase === "risk") {
|
|
100
|
+
if (result.phaseExtras.risk_level) {
|
|
101
|
+
response.risk_level = result.phaseExtras.risk_level;
|
|
102
|
+
}
|
|
103
|
+
if (result.phaseExtras.risk_count !== undefined) {
|
|
104
|
+
response.risk_count = result.phaseExtras.risk_count;
|
|
105
|
+
}
|
|
106
|
+
if (result.phaseExtras.risks_promoted !== undefined) {
|
|
107
|
+
response.risks_promoted = result.phaseExtras.risks_promoted;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (result.converged) {
|
|
111
|
+
if (result.feedback.verdict === "blocked") {
|
|
112
|
+
session.status = "blocked";
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
session.status = "approved";
|
|
116
|
+
const planPath = resolve(cwd, session.planPath);
|
|
117
|
+
let planContent = readFileSync(planPath, "utf-8");
|
|
118
|
+
planContent = planContent.replace(/\*\*Status:\*\* .*/, "**Status:** Approved");
|
|
119
|
+
writeFileSync(planPath, planContent);
|
|
120
|
+
}
|
|
121
|
+
writeSessionState(cwd, session);
|
|
122
|
+
// Include initial plan for change summary
|
|
123
|
+
const initialPlan = readInitialPlan(cwd, session.id);
|
|
124
|
+
if (initialPlan) {
|
|
125
|
+
response.initial_plan = initialPlan;
|
|
126
|
+
const planPath = resolve(cwd, session.planPath);
|
|
127
|
+
response.final_plan = readFileSync(planPath, "utf-8");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
content: [
|
|
132
|
+
{
|
|
133
|
+
type: "text",
|
|
134
|
+
text: statusLine,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
type: "text",
|
|
138
|
+
text: JSON.stringify(response),
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export function registerGetFeedback(server) {
|
|
144
|
+
server.tool("planpong_get_feedback", "Send the current plan to the reviewer model for critique. Returns structured feedback with issues, severity counts, and convergence status.", inputSchema, getFeedbackHandler);
|
|
141
145
|
}
|
|
142
146
|
//# sourceMappingURL=get-feedback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-feedback.js","sourceRoot":"","sources":["../../../../src/mcp/tools/get-feedback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EAEd,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IACxE,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+CAA+C,CAAC;CAC7D,CAAC;AAEF,MAAM,
|
|
1
|
+
{"version":3,"file":"get-feedback.js","sourceRoot":"","sources":["../../../../src/mcp/tools/get-feedback.ts"],"names":[],"mappings":"AAAA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AC/B;SACF;KACF,CAAC;AACR,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB,6IAA6I,EAC7I,WAAW,EACX,kBAAkB,CACnB,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,18 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
export declare function reviseHandler(input: {
|
|
3
|
+
session_id: string;
|
|
4
|
+
cwd?: string;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
content: {
|
|
7
|
+
type: "text";
|
|
8
|
+
text: string;
|
|
9
|
+
}[];
|
|
10
|
+
isError: boolean;
|
|
11
|
+
} | {
|
|
12
|
+
content: {
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
}[];
|
|
16
|
+
isError?: undefined;
|
|
17
|
+
}>;
|
|
2
18
|
export declare function registerRevise(server: McpServer): void;
|
|
@@ -10,79 +10,94 @@ const inputSchema = {
|
|
|
10
10
|
.optional()
|
|
11
11
|
.describe("Working directory (defaults to process.cwd())"),
|
|
12
12
|
};
|
|
13
|
-
export function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
isError: true,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
if (session.status !== "in_review") {
|
|
31
|
-
return {
|
|
32
|
-
content: [
|
|
33
|
-
{
|
|
34
|
-
type: "text",
|
|
35
|
-
text: JSON.stringify({
|
|
36
|
-
error: `Session status is '${session.status}', expected 'in_review'`,
|
|
37
|
-
}),
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
isError: true,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const config = loadConfig({ cwd });
|
|
44
|
-
const plannerProvider = getProvider(session.planner.provider);
|
|
45
|
-
if (!plannerProvider) {
|
|
46
|
-
return {
|
|
47
|
-
content: [
|
|
48
|
-
{
|
|
49
|
-
type: "text",
|
|
50
|
-
text: JSON.stringify({
|
|
51
|
-
error: `Planner provider not found: ${session.planner.provider}`,
|
|
52
|
-
}),
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
isError: true,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const sessionConfig = {
|
|
59
|
-
...config,
|
|
60
|
-
planner: session.planner,
|
|
61
|
-
reviewer: session.reviewer,
|
|
13
|
+
export async function reviseHandler(input) {
|
|
14
|
+
const cwd = input.cwd ?? process.cwd();
|
|
15
|
+
const session = readSessionState(cwd, input.session_id);
|
|
16
|
+
if (!session) {
|
|
17
|
+
return {
|
|
18
|
+
content: [
|
|
19
|
+
{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: JSON.stringify({
|
|
22
|
+
error: `Session not found: ${input.session_id}`,
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
isError: true,
|
|
62
27
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const statusLine = writeStatusLineToPlan(session, cwd, sessionConfig, "Revision submitted");
|
|
28
|
+
}
|
|
29
|
+
if (session.status !== "in_review") {
|
|
66
30
|
return {
|
|
67
31
|
content: [
|
|
68
32
|
{
|
|
69
33
|
type: "text",
|
|
70
|
-
text:
|
|
34
|
+
text: JSON.stringify({
|
|
35
|
+
error: `Session status is '${session.status}', expected 'in_review'`,
|
|
36
|
+
}),
|
|
71
37
|
},
|
|
38
|
+
],
|
|
39
|
+
isError: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const config = loadConfig({ cwd });
|
|
43
|
+
const plannerProvider = getProvider(session.planner.provider);
|
|
44
|
+
if (!plannerProvider) {
|
|
45
|
+
return {
|
|
46
|
+
content: [
|
|
72
47
|
{
|
|
73
48
|
type: "text",
|
|
74
49
|
text: JSON.stringify({
|
|
75
|
-
|
|
76
|
-
responses: result.revision.responses,
|
|
77
|
-
accepted: result.accepted,
|
|
78
|
-
rejected: result.rejected,
|
|
79
|
-
deferred: result.deferred,
|
|
80
|
-
plan_updated: result.planUpdated,
|
|
81
|
-
status_line: statusLine,
|
|
50
|
+
error: `Planner provider not found: ${session.planner.provider}`,
|
|
82
51
|
}),
|
|
83
52
|
},
|
|
84
53
|
],
|
|
54
|
+
isError: true,
|
|
85
55
|
};
|
|
86
|
-
}
|
|
56
|
+
}
|
|
57
|
+
const sessionConfig = {
|
|
58
|
+
...config,
|
|
59
|
+
planner: session.planner,
|
|
60
|
+
reviewer: session.reviewer,
|
|
61
|
+
};
|
|
62
|
+
const result = await runRevisionRound(session, cwd, sessionConfig, plannerProvider);
|
|
63
|
+
// Update status line in plan file (planner may have mangled it)
|
|
64
|
+
const statusLine = writeStatusLineToPlan(session, cwd, sessionConfig, "Revision submitted");
|
|
65
|
+
const payload = {
|
|
66
|
+
round: result.round,
|
|
67
|
+
responses: result.revision.responses,
|
|
68
|
+
accepted: result.accepted,
|
|
69
|
+
rejected: result.rejected,
|
|
70
|
+
deferred: result.deferred,
|
|
71
|
+
plan_updated: result.planUpdated,
|
|
72
|
+
status_line: statusLine,
|
|
73
|
+
};
|
|
74
|
+
if (result.timing) {
|
|
75
|
+
payload.timing = result.timing;
|
|
76
|
+
}
|
|
77
|
+
if (result.edits) {
|
|
78
|
+
payload.revision_mode = result.edits.revision_mode;
|
|
79
|
+
if (result.edits.revision_mode === "edits") {
|
|
80
|
+
payload.edits_attempted = result.edits.edits_attempted;
|
|
81
|
+
payload.edits_applied = result.edits.edits_applied;
|
|
82
|
+
payload.edits_failed = result.edits.edits_failed;
|
|
83
|
+
payload.edits_recovered = result.edits.edits_recovered;
|
|
84
|
+
payload.retry_invoked = result.edits.retry_invoked;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: "text",
|
|
91
|
+
text: statusLine,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: "text",
|
|
95
|
+
text: JSON.stringify(payload),
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export function registerRevise(server) {
|
|
101
|
+
server.tool("planpong_revise", "Send plan + latest feedback to the planner model for revision. Writes the updated plan to disk. Call after planpong_get_feedback returns is_converged: false.", inputSchema, reviseHandler);
|
|
87
102
|
}
|
|
88
103
|
//# sourceMappingURL=revise.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revise.js","sourceRoot":"","sources":["../../../../src/mcp/tools/revise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IACxE,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+CAA+C,CAAC;CAC7D,CAAC;AAEF,MAAM,
|
|
1
|
+
{"version":3,"file":"revise.js","sourceRoot":"","sources":["../../../../src/mcp/tools/revise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;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AAa,CAAC;YACnD,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC;YACjD,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC;YACvD,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;QACrD,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,UAAU;aACjB;YACD;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aAC9B;SACF;KACF,CAAC;AACR,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAiB;IAC9C,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,+JAA+J,EAC/J,WAAW,EACX,aAAa,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { readSessionState, readRoundFeedback, readRoundResponse, } from "../../core/session.js";
|
|
2
|
+
import { readSessionState, readRoundFeedback, readRoundResponse, readRoundMetrics, } from "../../core/session.js";
|
|
3
3
|
import { formatTrajectory, severityFromFeedback, } from "../../core/operations.js";
|
|
4
4
|
const inputSchema = {
|
|
5
5
|
session_id: z.string().describe("Session ID to check"),
|
|
@@ -53,6 +53,20 @@ export function registerStatus(server) {
|
|
|
53
53
|
roundInfo.rejected = rejected;
|
|
54
54
|
roundInfo.deferred = deferred;
|
|
55
55
|
}
|
|
56
|
+
const revMetrics = readRoundMetrics(cwd, session.id, r, "revision");
|
|
57
|
+
if (revMetrics?.revision_mode) {
|
|
58
|
+
roundInfo.revision_mode = revMetrics.revision_mode;
|
|
59
|
+
if (revMetrics.revision_mode === "edits") {
|
|
60
|
+
if (revMetrics.edits_applied != null)
|
|
61
|
+
roundInfo.edits_applied = revMetrics.edits_applied;
|
|
62
|
+
if (revMetrics.edits_failed != null)
|
|
63
|
+
roundInfo.edits_failed = revMetrics.edits_failed;
|
|
64
|
+
if (revMetrics.edits_recovered != null)
|
|
65
|
+
roundInfo.edits_recovered = revMetrics.edits_recovered;
|
|
66
|
+
if (revMetrics.retry_invoked != null)
|
|
67
|
+
roundInfo.retry_invoked = revMetrics.retry_invoked;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
56
70
|
rounds.push(roundInfo);
|
|
57
71
|
}
|
|
58
72
|
const trajectory = severities.length > 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/mcp/tools/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/mcp/tools/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACtD,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+CAA+C,CAAC;CAC7D,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,MAAiB;IAC9C,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,sEAAsE,EACtE,WAAW,EACX,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACvC,M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GACd,UAAU,CAAC,MAAM,GAAG,CAAC;YACnB,CAAC,CAAC,gBAAgB,CAAC,UAAU,CAAC;YAC9B,CAAC,CAAC,qBAAqB,CAAC;QAE5B,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE;4BACP,EAAE,EAAE,OAAO,CAAC,EAAE;4BACd,SAAS,EAAE,OAAO,CAAC,QAAQ;4BAC3B,MAAM,EAAE,OAAO,CAAC,MAAM;4BACtB,aAAa,EAAE,OAAO,CAAC,YAAY;4BACnC,UAAU,EAAE,OAAO,CAAC,SAAS;4BAC7B,OAAO,EAAE,OAAO,CAAC,OAAO;4BACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;yBAC3B;wBACD,MAAM;wBACN,UAAU;qBACX,CAAC;iBACH;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
import type { ReviewFeedback } from "../schemas/feedback.js";
|
|
2
2
|
import type { ReviewPhase } from "./reviewer.js";
|
|
3
3
|
export declare function buildInitialPlanPrompt(requirements: string, plansDir: string): string;
|
|
4
|
-
export declare function buildRevisionPrompt(currentPlan: string, feedback: ReviewFeedback, keyDecisions: string | null, priorContext: string | null, phase?: ReviewPhase, structuredOutput?: boolean): string;
|
|
4
|
+
export declare function buildRevisionPrompt(currentPlan: string, feedback: ReviewFeedback, keyDecisions: string | null, priorContext: string | null, phase?: ReviewPhase, structuredOutput?: boolean, revisionMode?: "edits" | "full"): string;
|
|
5
|
+
/**
|
|
6
|
+
* Build a minimal revision prompt for resumed planner sessions.
|
|
7
|
+
*
|
|
8
|
+
* The planner is already in a persistent CLI conversation that has the
|
|
9
|
+
* plan, the prior reviewer feedback, and the planner's own prior rationales
|
|
10
|
+
* in context. We do NOT re-send "Current Plan", "Prior Decisions", or
|
|
11
|
+
* "Key Decisions" — the model has all of that. Only the new feedback +
|
|
12
|
+
* minimal phase reminder + output schema instructions.
|
|
13
|
+
*
|
|
14
|
+
* The output schema and surgical constraints stay because they're per-call
|
|
15
|
+
* directives, not stable context. (We don't trust that the model won't
|
|
16
|
+
* drift in format across many turns of a long session.)
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildIncrementalRevisionPrompt(feedback: ReviewFeedback, phase: ReviewPhase, structuredOutput: boolean, revisionMode?: "edits" | "full"): string;
|
|
19
|
+
/**
|
|
20
|
+
* Build a targeted retry prompt for failed edits in edits-mode revisions.
|
|
21
|
+
* Given the partially-edited plan and the list of edits that failed first
|
|
22
|
+
* pass, asks the planner to re-express each failed edit with corrected
|
|
23
|
+
* `section` and `before` values.
|
|
24
|
+
*
|
|
25
|
+
* The retry prompt is small — it does not re-include the full feedback or
|
|
26
|
+
* key decisions, only the failed edits and the current state of the plan.
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildEditsRetryPrompt(currentPlan: string, failures: Array<{
|
|
29
|
+
edit: {
|
|
30
|
+
section: string;
|
|
31
|
+
before: string;
|
|
32
|
+
after: string;
|
|
33
|
+
};
|
|
34
|
+
reason: string;
|
|
35
|
+
section_searched: string | null;
|
|
36
|
+
diagnostic?: string;
|
|
37
|
+
}>, structuredOutput: boolean): string;
|