mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-27 09:26:23 +02:00
everything is an agent
This commit is contained in:
parent
2d6a647c70
commit
80dae17fd1
24 changed files with 1261 additions and 1573 deletions
78
apps/cli/src/application/entities/run-events.ts
Normal file
78
apps/cli/src/application/entities/run-events.ts
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
import { z } from "zod";
|
||||
import { LlmStepStreamEvent } from "./llm-step-events.js";
|
||||
import { Message } from "./message.js";
|
||||
import { Agent } from "./agent.js";
|
||||
|
||||
const BaseRunEvent = z.object({
|
||||
ts: z.iso.datetime().optional(),
|
||||
});
|
||||
|
||||
export const RunStartEvent = BaseRunEvent.extend({
|
||||
type: z.literal("start"),
|
||||
runId: z.string(),
|
||||
agentId: z.string(),
|
||||
agent: Agent,
|
||||
interactive: z.boolean(),
|
||||
});
|
||||
|
||||
export const RunStepStartEvent = BaseRunEvent.extend({
|
||||
type: z.literal("step-start"),
|
||||
});
|
||||
|
||||
export const RunStreamEvent = BaseRunEvent.extend({
|
||||
type: z.literal("stream-event"),
|
||||
event: LlmStepStreamEvent,
|
||||
});
|
||||
|
||||
export const RunMessageEvent = BaseRunEvent.extend({
|
||||
type: z.literal("message"),
|
||||
message: Message,
|
||||
});
|
||||
|
||||
export const RunToolInvocationEvent = BaseRunEvent.extend({
|
||||
type: z.literal("tool-invocation"),
|
||||
toolName: z.string(),
|
||||
input: z.string(),
|
||||
});
|
||||
|
||||
export const RunToolResultEvent = BaseRunEvent.extend({
|
||||
type: z.literal("tool-result"),
|
||||
toolName: z.string(),
|
||||
result: z.any(),
|
||||
});
|
||||
|
||||
export const RunStepEndEvent = BaseRunEvent.extend({
|
||||
type: z.literal("step-end"),
|
||||
});
|
||||
|
||||
export const RunEndEvent = BaseRunEvent.extend({
|
||||
type: z.literal("end"),
|
||||
});
|
||||
|
||||
export const RunPauseEvent = BaseRunEvent.extend({
|
||||
type: z.literal("pause-for-human-input"),
|
||||
toolCallId: z.string(),
|
||||
});
|
||||
|
||||
export const RunResumeEvent = BaseRunEvent.extend({
|
||||
type: z.literal("resume"),
|
||||
});
|
||||
|
||||
export const RunErrorEvent = BaseRunEvent.extend({
|
||||
type: z.literal("error"),
|
||||
error: z.string(),
|
||||
});
|
||||
|
||||
export const RunEvent = z.union([
|
||||
RunStartEvent,
|
||||
RunStepStartEvent,
|
||||
RunStreamEvent,
|
||||
RunMessageEvent,
|
||||
RunToolInvocationEvent,
|
||||
RunToolResultEvent,
|
||||
RunStepEndEvent,
|
||||
RunEndEvent,
|
||||
RunPauseEvent,
|
||||
RunResumeEvent,
|
||||
RunErrorEvent,
|
||||
]);
|
||||
Loading…
Add table
Add a link
Reference in a new issue