this should fail on spike

This commit is contained in:
Corey Johnson 2025-06-19 16:47:54 -07:00
parent 84ae1cecf5
commit c155afa797
3 changed files with 8 additions and 5 deletions

View File

@ -12,6 +12,6 @@
"http": "bun run --filter=@workshop/http start",
"bot:cli": "bun run --filter=@workshop/spike bot:cli",
"bot:discord": "bun run --filter=@workshop/spike bot:discord",
"start": "bun run main.ts"
"start": "bun run bot:discord"
}
}

View File

@ -91,14 +91,17 @@ const reactionAgent = new Agent({
const reactionGuardrail: InputGuardrail = {
name: "Reaction Guardrail",
execute: async ({ input, context }) => {
const result = await run(reactionAgent, input.slice(-1), { context })
const emoji = result.finalOutput?.trim()
// const result = await run(reactionAgent, input.slice(-1), { context })
const emoji = " %F0%9F%91%8D " //result.finalOutput?.trim()
if (emoji && emoji !== "0") {
console.log(`😐 Spike reacted with ${emoji}`)
const msg = (context.context as UserContext).msg
const history = (historyForChannel[msg.channel.id] ||= [])
history.push(system(`Spike reacted with ${emoji}`))
msg.react(emoji)
}
// Always return false, we aren't really using this for a guardrail
return { outputInfo: emoji, tripwireTriggered: false }
},
}

View File

@ -18,11 +18,11 @@ await client.login(process.env.DISCORD_TOKEN)
listenForEvents(client)
process.on("unhandledRejection", (error) => {
console.error("Unhandled promise rejection:", error)
console.error("💥 Unhandled promise rejection:", error)
})
process.on("uncaughtException", (error) => {
console.error("Uncaught exception:", error)
console.error("💥 Uncaught exception:", error)
})
runCronJobs(client)