This commit is contained in:
Dax Raad
2025-05-29 11:35:56 -04:00
parent 6f604bd0f9
commit a96c2ce65c
4 changed files with 81 additions and 67 deletions

View File

@@ -2,15 +2,6 @@ import z from "zod";
import { Bus } from "../bus";
export namespace Message {
export const Event = {
Updated: Bus.event(
"message.updated",
z.object({
sessionID: z.string(),
messageID: z.string(),
}),
),
};
export const ToolCall = z
.object({
state: z.literal("call"),
@@ -167,4 +158,13 @@ export namespace Message {
ref: "Message.Info",
});
export type Info = z.infer<typeof Info>;
export const Event = {
Updated: Bus.event(
"message.updated",
z.object({
info: Info,
}),
),
};
}

View File

@@ -35,7 +35,7 @@ export namespace Session {
Updated: Bus.event(
"session.updated",
z.object({
sessionID: z.string(),
info: Info,
}),
),
};
@@ -60,7 +60,7 @@ export namespace Session {
await Storage.writeJSON("session/info/" + result.id, result);
await share(result.id);
Bus.publish(Event.Updated, {
sessionID: result.id,
info: result,
});
return result;
}
@@ -94,7 +94,7 @@ export namespace Session {
sessions.set(id, session);
await Storage.writeJSON("session/info/" + id, session);
Bus.publish(Event.Updated, {
sessionID: id,
info: session,
});
return session;
}
@@ -147,8 +147,7 @@ export namespace Session {
msg,
);
Bus.publish(Message.Event.Updated, {
sessionID: input.sessionID,
messageID: msg.id,
info: msg,
});
}
const app = await App.use();