e30e75b5d4
Code Quality / Oxlint + Oxfmt (push) Waiting to run
Code Quality / Template Sync (push) Waiting to run
Code Quality / Build Changed Packages (push) Waiting to run
Code Quality / Test Changed Packages (push) Waiting to run
Deploy Expo Example / Deploy Production (push) Waiting to run
Deploy Ink Example / Deploy Production (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.12) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.12) (push) Waiting to run
Deploy Shadcn Registry / Deploy Production (push) Waiting to run
Template Metrics / LOC + Bundle Size (push) Waiting to run
Changesets / Create Version PR (push) Has been cancelled
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import { WrenchIcon } from "lucide-react";
|
|
import type { FC } from "react";
|
|
|
|
type OpenCodeDataPartProps = {
|
|
name: string;
|
|
data: unknown;
|
|
};
|
|
|
|
const getSummary = (name: string, data: unknown) => {
|
|
if (
|
|
name === "opencode-unsupported-part" &&
|
|
typeof data === "object" &&
|
|
data !== null &&
|
|
"type" in data &&
|
|
typeof data.type === "string"
|
|
) {
|
|
return `Unsupported part: ${data.type}`;
|
|
}
|
|
|
|
if (name === "opencode-snapshot") return "Snapshot";
|
|
if (name === "opencode-retry") return "Retry";
|
|
if (name === "opencode-compaction") return "Compaction";
|
|
if (name === "opencode-agent") return "Agent event";
|
|
if (name === "opencode-subtask") return "Subtask";
|
|
|
|
return name.replace(/^opencode-/, "").replace(/-/g, " ");
|
|
};
|
|
|
|
export const OpenCodeDataPart: FC<OpenCodeDataPartProps> = ({ name, data }) => {
|
|
const shouldHide =
|
|
name === "opencode-step-start" ||
|
|
name === "opencode-step-finish" ||
|
|
name === "opencode-patch";
|
|
|
|
if (shouldHide) {
|
|
return null;
|
|
}
|
|
|
|
const summary = getSummary(name, data);
|
|
|
|
return (
|
|
<div className="bg-muted/30 text-muted-foreground my-3 flex w-min items-center gap-2 rounded-full border px-2 py-1 text-xs text-nowrap">
|
|
<WrenchIcon className="size-3" />
|
|
{summary}
|
|
</div>
|
|
);
|
|
};
|