mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-28 12:12:47 +00:00
* refactor(plugins): make lifecycle hook timing explicit Use one registration method and subject.operation.step names so plugin authors can read whether an operation waits. Preserve old registrations through a single SDK adapter and keep timing and payloads unchanged. * fix(plugins): align hook notes and example fixtures with release contracts Keep the changelog inside its versioned beta entry for app parsing. Run current plugin examples against the checkout version so their declared requirements remain valid. * docs(plugins): align translated hook dependency guidance * fix(plugins): align hook exports and release documentation * feat(plugins): use lifecycle positions and await worktree initialization * test(plugins): cover first-agent worktree initialization * test(plugins): verify rollback against workspace catalog entries
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import { writeFile } from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { z } from "zod";
|
|
import { defineAgentTool, type PluginServerContext } from "@getpaseo/plugin/server";
|
|
|
|
const appendWorkspaceNote = defineAgentTool({
|
|
name: "append_workspace_note",
|
|
description: "Append a note to AGENT_NOTES.md in this agent's working directory.",
|
|
input: z.object({ note: z.string().min(1).describe("Note to append") }),
|
|
async execute({ note }, { agent, signal }) {
|
|
const notePath = path.join(agent.cwd, "AGENT_NOTES.md");
|
|
await writeFile(notePath, `${note}\n`, { encoding: "utf8", flag: "a", signal });
|
|
return {
|
|
text: `Saved note to ${notePath}`,
|
|
structuredContent: { path: notePath },
|
|
};
|
|
},
|
|
});
|
|
|
|
export default function contribute(server: PluginServerContext) {
|
|
server.addHook("agent.open.before", async ({ request }) => {
|
|
if (request.labels["notes/enabled"] !== "true") return;
|
|
return { ...request, tools: [...request.tools, appendWorkspaceNote] };
|
|
});
|
|
return () => {};
|
|
}
|