Export template source from 2c1f7777c2f1c0185ad483413bd92aa68721fdc9:quixos-instance/packages/agent-presentation

This commit is contained in:
Quixos Template Publisher
2000-01-01 00:00:00 +00:00
commit 0c8580d363
17 changed files with 1816 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import { useEffect, useMemo } from "react";
import { AgentWidget } from "./widget.js";
import type { Modules } from "./gen/client.js";
import { ThreadView } from "./shared.js";
import { HttpThreadController } from "./http.js";
import type { Thread as ThreadData } from "./protocol.js";
import "./thread.css";
export const Thread: Modules["Thread"] = ({ subject, input }) => {
const controller = useMemo(
() =>
new HttpThreadController(
subject.object,
JSON.parse(
JSON.stringify(input.body.root, (_key, value) => (typeof value === "bigint" ? value.toString() : value)),
) as ThreadData,
),
[subject.object],
);
useEffect(() => () => controller.close(), [controller]);
return (
<ThreadView thread={subject.object} controller={controller} renderWidget={(item) => <AgentWidget item={item} />} />
);
};