- packages/sdk: new types-only @open-pets/plugin-sdk — OpenPetsContext + the ambient OpenPetsPlugin global, plus a mock-ctx contract test. Zero runtime deps; published for editor autocomplete (npm i -D @open-pets/plugin-sdk). - cli: `openpets plugin new <name>` scaffolds a plugin folder (manifest + entry + README) so step zero is npx, not copy-paste. - desktop: compile-time conformance guard tying the runtime plugin SDK (namespaces + JS permission set) to the published @open-pets/plugin-sdk contract, so the two can't drift. - release-npm: include packages/sdk in the publish order. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1.1 KiB
1.1 KiB
@open-pets/plugin-sdk
Type definitions for building OpenPets desktop pet plugins.
This package is types only. There is no runtime to import — the OpenPets
desktop app injects the OpenPetsPlugin global into your plugin's sandbox and
passes your start(ctx) handler the SDK. Installing this package gives your
editor autocomplete and type-checking; it never ships in your plugin.
Install
npm i -D @open-pets/plugin-sdk
Use
A plugin is a single browser-style JavaScript file. Reference the types for IntelliSense:
/// <reference types="@open-pets/plugin-sdk" />
OpenPetsPlugin.register({
async start(ctx) {
await ctx.pet.speak("Hello!")
await ctx.pet.react("waving")
},
})
Or, in TypeScript, import the contract directly:
import type { OpenPetsContext, OpenPetsPluginDefinition } from "@open-pets/plugin-sdk"
Docs
- SDK guide: https://openpets.dev/sdk
- Full reference: https://openpets.dev/docs/plugin-sdk
- Example plugins: https://github.com/alvinunreal/openpets/tree/main/plugins/official