2026-10-24 07:02:48 +02:00
|
|
|
#include "cli/cli.h"
|
2026-10-24 07:08:50 +02:00
|
|
|
#include "agent/agent.h"
|
|
|
|
|
#include "agent/exec.h"
|
|
|
|
|
#include "agent/loop.h"
|
|
|
|
|
#include "llm/llm.h"
|
2026-10-24 07:02:48 +02:00
|
|
|
#include "version.hpp"
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
#include <string>
|
|
|
|
|
int main(int argc, char** argv){
|
|
|
|
|
detz::cli::Parser p; auto cmd = p.parse(argc, argv);
|
2026-10-24 07:37:20 +02:00
|
|
|
if(cmd.opts.version){ std::puts(("tai " + std::string(detz::kVersion)).c_str()); return 0; }
|
2026-10-24 07:02:48 +02:00
|
|
|
if(cmd.opts.cap_manifest){ std::fputs("# tai CAP agent manifest\n", stdout); return 0; }
|
2026-10-24 07:08:50 +02:00
|
|
|
if(cmd.name=="run" && !cmd.args.empty()){
|
|
|
|
|
detz::agent::ToolRegistry reg; detz::agent::RegisterAll(reg, ".");
|
|
|
|
|
std::string prompt; for(auto& a: cmd.args) prompt += a + " ";
|
|
|
|
|
auto r = detz::agent::RunTurn(reg, prompt);
|
|
|
|
|
std::fputs(r.output.c_str(), stdout);
|
|
|
|
|
return r.ok?0:1;
|
|
|
|
|
}
|
2026-10-24 07:02:48 +02:00
|
|
|
return cmd.run();
|
|
|
|
|
}
|