import {
ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER,
defineAction,
} from "@agent-native/core";
import { z } from "zod";
export const TASK_LIST_INLINE_CONTENT = `
`;
export default defineAction({
description:
"Render the current task list as an interactive widget inline in chat without navigating away from the current page. Use when the user asks to see, review, or manage tasks while they are not on /tasks.",
schema: z.object({
includeDone: z
.boolean()
.default(false)
.describe("When true, show completed tasks in the widget."),
}),
http: false,
readOnly: true,
chatUI: {
renderer: ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER,
title: "Task list",
description: "Render the task list inline in the conversation.",
},
run: async (args) => ({
ok: true,
inlineExtension: {
mode: "transient" as const,
id: `tasks-inline-${Date.now().toString(36)}-${Math.random()
.toString(36)
.slice(2, 8)}`,
name: "Task list",
description: args.includeDone ? "Open and completed tasks" : "Open tasks",
content: TASK_LIST_INLINE_CONTENT,
context: { includeDone: args.includeDone },
initialHeight: 360,
},
}),
});