|
|
@@ -1331,7 +1331,7 @@ export namespace SessionPrompt {
|
|
|
}
|
|
|
if (command.agent) {
|
|
|
const cmdAgent = await Agent.get(command.agent)
|
|
|
- if (cmdAgent.model) {
|
|
|
+ if (cmdAgent?.model) {
|
|
|
return cmdAgent.model
|
|
|
}
|
|
|
}
|
|
|
@@ -1353,6 +1353,16 @@ export namespace SessionPrompt {
|
|
|
throw e
|
|
|
}
|
|
|
const agent = await Agent.get(agentName)
|
|
|
+ if (!agent) {
|
|
|
+ const available = await Agent.list().then((agents) => agents.filter((a) => !a.hidden).map((a) => a.name))
|
|
|
+ const hint = available.length ? ` Available agents: ${available.join(", ")}` : ""
|
|
|
+ const error = new NamedError.Unknown({ message: `Agent not found: "${agentName}".${hint}` })
|
|
|
+ Bus.publish(Session.Event.Error, {
|
|
|
+ sessionID: input.sessionID,
|
|
|
+ error: error.toObject(),
|
|
|
+ })
|
|
|
+ throw error
|
|
|
+ }
|
|
|
|
|
|
const parts =
|
|
|
(agent.mode === "subagent" && command.subtask !== false) || command.subtask === true
|