@pugi/runtime
v0.1.0-alpha.1
Published
Pugi plugin runtime API - hook surface for @pugi/plugin-* packages
Maintainers
Readme
@pugi/runtime
Plugin runtime API for the Pugi ecosystem.
Used by all @pugi/plugin-* packages to register hooks against the Pugi
session lifecycle.
Installation
npm install @pugi/runtimeUsage
import type { Plugin, PluginInput } from '@pugi/runtime';
const myPlugin: Plugin = async (input) => {
return {
'chat.params': async ({ model, message }, output) => {
// modify temperature, topP, maxOutputTokens, etc.
},
'experimental.chat.system.transform': async ({ userMessageText, sessionID }, output) => {
// inject system prompt fragments
},
'experimental.session.finish': async ({ sessionID, messageID, finish }, output) => {
// veto turn-finish on failed verification
output.veto = false;
},
};
};
export default myPlugin;Hook surface
chat.params- modify model parameters before requestchat.headers- inject request headerschat.message- observe inbound user messagespermission.ask- moderate tool/file permission promptscommand.execute.before- intercept slash command executiontool.execute.before/tool.execute.after- intercept tool callstool.definition- modify tool descriptions sent to the modelshell.env- inject environment variables for shell toolsprovider- register custom model providersauth- register custom auth methodsconfig- load-time config injectionexperimental.chat.system.transform- inject system prompt fragmentsexperimental.chat.messages.transform- rewrite message history before sendexperimental.session.finish- veto turn-finish based on verification checksexperimental.session.compacting- customize compaction promptsexperimental.compaction.autocontinue- control synthetic continue turnsexperimental.text.complete- rewrite final text segmentsexperimental.provider.small_model- override the small-model resolver
License
MIT. See NOTICE.md for attribution details.
