mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-22 01:02:41 +00:00
* feat(plugins): add timeline item contributions Keep canonical daemon history unchanged while plugins project and render custom timeline items in clients. Live matches refresh authoritative projected history before replacement so lifecycle deltas stay collapsed. * fix(nix): update npm dependency hash The plugin SDK lockfile change invalidated the fixed-output npm dependency derivation. Use the hash calculated by the macOS Nix build for the current lockfile.
80 lines
2.2 KiB
TypeScript
80 lines
2.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { transformPiTodoToolCall } from "./pi-tasks";
|
|
|
|
function completedTodo(output: unknown) {
|
|
return {
|
|
type: "tool_call" as const,
|
|
callId: "todo-1",
|
|
name: "todo",
|
|
status: "completed" as const,
|
|
error: null,
|
|
detail: { type: "unknown" as const, input: {}, output },
|
|
};
|
|
}
|
|
|
|
describe("Pi task timeline example", () => {
|
|
it("maps @juicesharp/rpiv-todo and drops deleted tasks", () => {
|
|
const result = transformPiTodoToolCall({
|
|
item: completedTodo({
|
|
content: [{ type: "text", text: "Created #2" }],
|
|
details: {
|
|
tasks: [
|
|
{ id: 1, subject: "alpha task", status: "completed", owner: "agent" },
|
|
{ id: 2, subject: "beta task", status: "in_progress" },
|
|
{ id: 3, subject: "gamma task", status: "pending" },
|
|
{ id: 4, subject: "deleted task", status: "deleted" },
|
|
],
|
|
},
|
|
}),
|
|
});
|
|
|
|
expect(result).toEqual({
|
|
items: [
|
|
{
|
|
type: "plugin",
|
|
kind: "pi-task-list",
|
|
version: 1,
|
|
data: {
|
|
tasks: [
|
|
{ text: "alpha task", status: "completed" },
|
|
{ text: "beta task", status: "in_progress" },
|
|
{ text: "gamma task", status: "pending" },
|
|
],
|
|
},
|
|
},
|
|
],
|
|
});
|
|
});
|
|
|
|
it("maps Pi's example todo extension", () => {
|
|
const result = transformPiTodoToolCall({
|
|
item: completedTodo({
|
|
details: {
|
|
todos: [
|
|
{ id: 1, text: "alpha task", done: true },
|
|
{ id: 2, text: "beta task", done: false },
|
|
],
|
|
},
|
|
}),
|
|
});
|
|
|
|
expect(result?.items[0]?.data).toEqual({
|
|
tasks: [
|
|
{ text: "alpha task", status: "completed" },
|
|
{ text: "beta task", status: "pending" },
|
|
],
|
|
});
|
|
});
|
|
|
|
it("keeps unrelated and malformed tool calls unchanged", () => {
|
|
expect(
|
|
transformPiTodoToolCall({
|
|
item: { ...completedTodo({ details: { todos: [] } }), name: "write" },
|
|
}),
|
|
).toBeUndefined();
|
|
expect(
|
|
transformPiTodoToolCall({ item: completedTodo({ details: { phases: [] } }) }),
|
|
).toBeUndefined();
|
|
});
|
|
});
|