Skip to content

Commit 7d7ee95

Browse files
committed
refactor: simplify manual trigger return type
1 parent 7e436e1 commit 7d7ee95

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

lib/commands/manual.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,11 @@ export async function handleManualToggleCommand(
107107
logger.info("Manual mode toggled", { manualMode: state.manualMode })
108108
}
109109

110-
export interface ManualTriggerResult {
111-
prompt: string
112-
}
113-
114110
export async function handleManualTriggerCommand(
115111
ctx: ManualCommandContext,
116112
tool: "prune" | "distill" | "compress",
117113
userFocus?: string,
118-
): Promise<ManualTriggerResult | null> {
114+
): Promise<string | null> {
119115
const { client, state, config, logger, sessionId, messages } = ctx
120116

121117
if (tool === "prune" || tool === "distill") {
@@ -128,8 +124,8 @@ export async function handleManualTriggerCommand(
128124
return null
129125
}
130126

131-
return { prompt: getTriggerPrompt(tool, prunableToolsList, userFocus) }
127+
return getTriggerPrompt(tool, prunableToolsList, userFocus)
132128
}
133129

134-
return { prompt: getTriggerPrompt("compress", undefined, userFocus) }
130+
return getTriggerPrompt("compress", undefined, userFocus)
135131
}

lib/hooks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ export function createCommandExecuteHandler(
199199
config.tools[subcommand].permission !== "deny"
200200
) {
201201
const userFocus = subArgs.join(" ").trim()
202-
const result = await handleManualTriggerCommand(commandCtx, subcommand, userFocus)
203-
if (!result) {
202+
const prompt = await handleManualTriggerCommand(commandCtx, subcommand, userFocus)
203+
if (!prompt) {
204204
throw new Error("__DCP_MANUAL_TRIGGER_BLOCKED__")
205205
}
206206

207207
state.pendingManualTrigger = {
208208
sessionId: input.sessionID,
209-
prompt: result.prompt,
209+
prompt,
210210
}
211211
const rawArgs = (input.arguments || "").trim()
212212
output.parts.length = 0

0 commit comments

Comments
 (0)