Ассистент: llmtest- только для тестовых проектов (agent.testJobIds), POST /chat/apply для разового поручения агенту
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,8 @@ export interface ChatApi {
|
||||
simulate(opts: { managerId?: string; text: string; files?: string[]; publish?: boolean }): Promise<unknown>;
|
||||
/** Системное событие ассистента (напоминания 12:00/13:00/16:00 и т.п.) всем менеджерам режима. */
|
||||
event(kind: string): Promise<unknown>;
|
||||
/** Разовое поручение агенту менеджера от ИТ/владельца (например, применить подтверждённые изменения); ответ уходит в чат менеджера, если publish. */
|
||||
apply(opts: { managerId: string; text: string; publish?: boolean }): Promise<unknown>;
|
||||
}
|
||||
|
||||
export interface PrepApiDeps {
|
||||
@@ -84,6 +86,12 @@ export function buildApi(deps: PrepApiDeps): FastifyInstance {
|
||||
if (!kind) return reply.code(400).send({ error: "нужен kind" });
|
||||
return reply.code(202).send({ chatRunId: startChat(() => deps.chat!.event(kind)) });
|
||||
});
|
||||
app.post<{ Body: { managerId?: string; text?: string; publish?: boolean } }>("/chat/apply", async (req, reply) => {
|
||||
if (!deps.chat) return reply.code(501).send({ error: "chat не настроен" });
|
||||
const b = req.body ?? {};
|
||||
if (!b.managerId || !b.text) return reply.code(400).send({ error: "нужны managerId и text" });
|
||||
return reply.code(202).send({ chatRunId: startChat(() => deps.chat!.apply({ managerId: b.managerId!, text: b.text!, publish: b.publish })) });
|
||||
});
|
||||
app.get<{ Params: { id: string } }>("/chat/runs/:id", async (req, reply) => chatRuns.get(req.params.id) ?? reply.code(404).send({ error: "not found" }));
|
||||
app.get("/agent/runs", async () => (await deps.pool.query("select id, manager_person_id, step, attempt, resumed, status, started_at, duration_ms, cost_usd, error, changes from agent_run order by started_at desc limit 20")).rows);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user