v2.0.0 — Breaking: definePlugin required
⚠️ Breaking Change
ensureContracts() has been removed. All plugins must now use definePlugin() to declare their tools. The old-style createEntry()/register() pattern without contracts.tools will fail at both build time and load time.
If you see this error after upgrading:
Plugin "my-plugin" is missing contracts.tools.
Migrate to definePlugin() from carapace-plugin-sdk
You need to migrate your plugin to use definePlugin(). See the migration example below.
What changed
- Removed
ensureContracts()function and its backward-compat fallback createAdapter()now throws ifcontracts.toolsis missingcarapace-generate-clivalidatescontracts.toolsbefore generating artifacts- Updated ARCHITECTURE.md to reflect v2 behavior
Migration
Replace your manual createEntry() with definePlugin():
// Before (v1.x) — no longer works
function createEntry() {
return {
id: "my-plugin",
register(api) {
api.registerTool({ name: "my_tool", ... });
},
};
}
export { createEntry };
// After (v2.0) — required
import { definePlugin } from "carapace-plugin-sdk";
import { Type } from "@sinclair/typebox";
export const createEntry = definePlugin({
id: "my-plugin",
name: "My Plugin",
tools: (tool) => [
tool({
name: "my_tool",
description: "Does the thing.",
parameters: Type.Object({ input: Type.String() }),
execute: async ({ input }, config) => ({ result: input }),
}),
],
});Installation
npm install carapace-plugin-sdk@latest