Selaa lähdekoodia

handle undefined command in session prompt

Kit Langton 1 kuukausi sitten
vanhempi
sitoutus
df260fee45
1 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  1. 3 0
      packages/opencode/src/session/prompt.ts

+ 3 - 0
packages/opencode/src/session/prompt.ts

@@ -1782,6 +1782,9 @@ NOTE: At any point in time through this workflow you should feel free to ask the
   export async function command(input: CommandInput) {
     log.info("command", input)
     const command = await Command.get(input.command)
+    if (!command) {
+      throw new NamedError.Unknown({ message: `Command not found: "${input.command}"` })
+    }
     const agentName = command.agent ?? input.agent ?? (await Agent.defaultAgent())
 
     const raw = input.arguments.match(argsRegex) ?? []