mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 18:01:22 +00:00
fix: remove inline imports and debug logging
- Convert all inline import() types to top-level imports - Remove debug console.error statements from plan-mode hook
This commit is contained in:
parent
a169029a16
commit
277d7bd83b
4 changed files with 14 additions and 25 deletions
|
|
@ -322,7 +322,6 @@ export default function planModeHook(pi: HookAPI) {
|
|||
const nextStep = todoItems.find((t) => !t.completed);
|
||||
if (nextStep) {
|
||||
nextStep.completed = true;
|
||||
console.error(`[plan-mode] Marked step ${nextStep.step} complete (tool): ${nextStep.text}`);
|
||||
updateStatus(ctx);
|
||||
}
|
||||
});
|
||||
|
|
@ -330,11 +329,9 @@ export default function planModeHook(pi: HookAPI) {
|
|||
// Filter out stale plan mode context messages from LLM context
|
||||
// This ensures the agent only sees the CURRENT state (plan mode on/off)
|
||||
pi.on("context", async (event) => {
|
||||
console.error(`[plan-mode] context event: planModeEnabled=${planModeEnabled}, executionMode=${executionMode}, msgs=${event.messages.length}`);
|
||||
|
||||
// Only filter when NOT in plan mode (i.e., when executing)
|
||||
if (planModeEnabled) {
|
||||
console.error("[plan-mode] skipping filter - plan mode enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -346,26 +343,21 @@ export default function planModeHook(pi: HookAPI) {
|
|||
(c) => c.type === "text" && c.text.includes("[PLAN MODE ACTIVE]"),
|
||||
);
|
||||
if (hasOldContext) {
|
||||
console.error("[plan-mode] FILTERING OUT message with [PLAN MODE ACTIVE]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
console.error(`[plan-mode] filtered ${beforeCount} -> ${filtered.length} messages`);
|
||||
return { messages: filtered };
|
||||
});
|
||||
|
||||
// Inject plan mode context
|
||||
pi.on("before_agent_start", async () => {
|
||||
console.error(`[plan-mode] before_agent_start: planModeEnabled=${planModeEnabled}, executionMode=${executionMode}`);
|
||||
if (!planModeEnabled && !executionMode) {
|
||||
console.error("[plan-mode] before_agent_start: no injection needed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (planModeEnabled) {
|
||||
console.error("[plan-mode] before_agent_start: injecting PLAN MODE ACTIVE");
|
||||
return {
|
||||
message: {
|
||||
customType: "plan-mode-context",
|
||||
|
|
@ -390,7 +382,6 @@ Do NOT attempt to make changes - just describe what you would do.`,
|
|||
}
|
||||
|
||||
if (executionMode && todoItems.length > 0) {
|
||||
console.error("[plan-mode] before_agent_start: injecting EXECUTING PLAN context");
|
||||
const remaining = todoItems.filter((t) => !t.completed);
|
||||
const todoList = remaining.map((t) => `${t.step}. ${t.text}`).join("\n");
|
||||
return {
|
||||
|
|
@ -406,7 +397,6 @@ Execute each step in order.`,
|
|||
},
|
||||
};
|
||||
}
|
||||
console.error("[plan-mode] before_agent_start: no context injected (shouldn't reach here)");
|
||||
});
|
||||
|
||||
// After agent finishes
|
||||
|
|
@ -478,8 +468,6 @@ Execute each step in order.`,
|
|||
if (choice?.startsWith("Execute")) {
|
||||
planModeEnabled = false;
|
||||
executionMode = hasTodos;
|
||||
console.error(`[plan-mode] EXECUTING: planModeEnabled=${planModeEnabled}, executionMode=${executionMode}`);
|
||||
console.error(`[plan-mode] Setting tools to: ${NORMAL_MODE_TOOLS.join(", ")}`);
|
||||
pi.setActiveTools(NORMAL_MODE_TOOLS);
|
||||
updateStatus(ctx);
|
||||
|
||||
|
|
@ -554,7 +542,6 @@ Execute each step in order.`,
|
|||
const nextStep = todoItems.find((t) => !t.completed);
|
||||
if (nextStep) {
|
||||
nextStep.completed = true;
|
||||
console.error(`[plan-mode] Marked step ${nextStep.step} complete (no-tool turn): ${nextStep.text}`);
|
||||
updateStatus(ctx);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue