@narumitw/pi-plan-mode 0.1.31 → 0.1.33
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/plan-mode.ts +10 -11
package/package.json
CHANGED
package/src/plan-mode.ts
CHANGED
|
@@ -5,7 +5,6 @@ const STATUS_KEY = "plan-mode";
|
|
|
5
5
|
const PLAN_WIDGET_KEY = "plan-mode-plan";
|
|
6
6
|
const PLAN_CONTEXT_MESSAGE_TYPE = "plan-mode-context";
|
|
7
7
|
const PROPOSED_PLAN_MESSAGE_TYPE = "proposed-plan";
|
|
8
|
-
const PLAN_IMPLEMENTATION_MESSAGE_TYPE = "plan-mode-implementation";
|
|
9
8
|
const PLAN_CONTEXT_MARKER = "[CODEX-LIKE PLAN MODE ACTIVE]";
|
|
10
9
|
const SAFE_BUILTIN_PLAN_TOOLS = new Set(["read", "bash", "grep", "find", "ls"]);
|
|
11
10
|
const BLOCKED_BUILTIN_TOOLS = new Set(["edit", "write"]);
|
|
@@ -214,8 +213,7 @@ export default function planMode(pi: ExtensionAPI) {
|
|
|
214
213
|
if (!wasEnabled) {
|
|
215
214
|
ctx.ui.notify("Plan mode enabled. I will explore and plan, but not modify files.", "info");
|
|
216
215
|
}
|
|
217
|
-
|
|
218
|
-
else pi.sendUserMessage(prompt, { deliverAs: "followUp" });
|
|
216
|
+
sendPlanModeUserMessage(prompt, ctx);
|
|
219
217
|
}
|
|
220
218
|
|
|
221
219
|
function exitPlanMode(ctx: ExtensionContext) {
|
|
@@ -226,6 +224,11 @@ export default function planMode(pi: ExtensionAPI) {
|
|
|
226
224
|
updateUi(ctx);
|
|
227
225
|
}
|
|
228
226
|
|
|
227
|
+
function sendPlanModeUserMessage(message: string, ctx: ExtensionContext) {
|
|
228
|
+
if (ctx.isIdle()) pi.sendUserMessage(message);
|
|
229
|
+
else pi.sendUserMessage(message, { deliverAs: "followUp" });
|
|
230
|
+
}
|
|
231
|
+
|
|
229
232
|
function startImplementation(ctx: ExtensionContext) {
|
|
230
233
|
const plan = state.latestPlan?.trim();
|
|
231
234
|
exitPlanMode(ctx);
|
|
@@ -235,13 +238,9 @@ export default function planMode(pi: ExtensionAPI) {
|
|
|
235
238
|
return;
|
|
236
239
|
}
|
|
237
240
|
|
|
238
|
-
|
|
239
|
-
{
|
|
240
|
-
|
|
241
|
-
content: `Plan mode is now disabled. Full tool access is restored. Implement this proposed plan now:\n\n${plan}`,
|
|
242
|
-
display: true,
|
|
243
|
-
},
|
|
244
|
-
{ triggerTurn: true },
|
|
241
|
+
sendPlanModeUserMessage(
|
|
242
|
+
`Plan mode is now disabled. Full tool access is restored. Implement this proposed plan now:\n\n${plan}`,
|
|
243
|
+
ctx,
|
|
245
244
|
);
|
|
246
245
|
}
|
|
247
246
|
|
|
@@ -299,7 +298,7 @@ export default function planMode(pi: ExtensionAPI) {
|
|
|
299
298
|
}
|
|
300
299
|
if (choice === "Revise plan") {
|
|
301
300
|
const refinement = await ctx.ui.editor("Revise the plan", "");
|
|
302
|
-
if (refinement?.trim())
|
|
301
|
+
if (refinement?.trim()) sendPlanModeUserMessage(refinement.trim(), ctx);
|
|
303
302
|
return;
|
|
304
303
|
}
|
|
305
304
|
if (choice === "Exit Plan mode") {
|