/** * Public types for @nullplatform/plugin * * The plugin SDK is ONLY the gRPC transport layer. * No workflow, no progress, no events — those are separate concerns. */ export interface PluginHandler { execute(req: ExecuteRequest): Promise; } export interface Plugin { start(): void; } export interface ExecuteRequest { messageId: string; commandType: string; payload: Buffer; supportsPartial: boolean; canCancel: boolean; replyTo: string; actionType: string; /** Emit an output event during execution. Writes to the gRPC stream. */ emit(output: ExecuteOutput): void; } export interface ExecuteOutput { stdout?: string; stderr?: string; data?: Record; } export interface ExecuteResult { success: boolean; data?: unknown; error?: string; errorCode?: string; exitCode?: number; } export interface PluginManifest { name: string; version: string; command_types: string[]; /** * Channel routing the package declares (applied by `np package publish`): * selector tags, worker entrypoint, and the notification sources its channel * subscribes to. defineScope/defineService resolve this automatically; raw * createPlugin manifests may declare it here. */ agent?: { selector?: Record; entrypoint?: string; sources?: string[]; /** Bind the channel to each published version (see ScopeAgentConfig.pinVersion). */ pinVersion?: boolean; /** false: publish never touches the channel — you manage routing yourself. */ manageChannel?: boolean; }; }