// @ts-nocheck

import { Codilore } from "@codilore/core"
import { ReadTool } from "@codilore/core/tools"

const Codilore = Codilore.make({})

Codilore.tool.add(ReadTool)

Codilore.tool.add({
  name: "bash",
  schema: {
    type: "object",
    properties: {
      command: {
        type: "string",
        description: "The command to run.",
      },
    },
    required: ["command"],
  },
  execute(input, ctx) {},
})

Codilore.auth.add({
  provider: "openai",
  type: "api",
  value: process.env.OPENAI_API_KEY,
})

Codilore.agent.add({
  name: "build",
  permissions: [],
  model: {
    id: "gpt-5-5",
    provider: "openai",
    variant: "xhigh",
  },
})

const sessionID = await Codilore.session.create({
  agent: "build",
})

Codilore.subscribe((event) => {
  console.log(event)
})

await Codilore.session.prompt({
  sessionID,
  text: "hey what is up",
})

await Codilore.session.prompt({
  sessionID,
  text: "what is up with this",
  files: [
    {
      mime: "image/png",
      uri: "data:image/png;base64,xxxx",
    },
  ],
})

await Codilore.session.wait()

console.log(await Codilore.session.messages(sessionID))
