@vibecontrols/plugin-sdk 2026.530.1 → 2026.530.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,6 +58,29 @@ interface MetaProviderRef {
58
58
  */
59
59
  defaultOn?: ReadonlyArray<SupportedOS>;
60
60
  }
61
+ /**
62
+ * Context passed to a plugin's `onNuke` hook. The agent calls `onNuke`
63
+ * during `vibe nuke` while the daemon is still running — so the plugin's
64
+ * in-memory state and registered provider instances are reachable — and
65
+ * BEFORE the plugin package is uninstalled.
66
+ */
67
+ interface PluginNukeContext {
68
+ /** Absolute per-agent data dir for the active profile, when known. */
69
+ agentDir?: string;
70
+ /** Report-only: enumerate what WOULD be reaped, change nothing. */
71
+ dryRun: boolean;
72
+ }
73
+ /**
74
+ * What a plugin reaped during `onNuke`, surfaced in the operator's nuke
75
+ * output. Both fields are optional — a plugin that cleans nothing silently
76
+ * may return nothing at all.
77
+ */
78
+ interface NukeResult {
79
+ /** Short labels of processes/resources the plugin reaped. */
80
+ reaped?: string[];
81
+ /** Non-fatal notes (e.g. "left binary installed — shared/user-owned"). */
82
+ notes?: string[];
83
+ }
61
84
  interface StorageProvider {
62
85
  get<T = unknown>(namespace: string, key: string): Promise<T | null>;
63
86
  set<T = unknown>(namespace: string, key: string, value: T): Promise<void>;
@@ -181,9 +204,11 @@ interface VibePlugin {
181
204
  * META plugins (session, tunnel, ai, storage, gitops) declare the provider
182
205
  * plugins they route to + per-platform defaults here. The thin agent reads
183
206
  * this to decide what to install at bootstrap, so it never hardcodes
184
- * provider package names or their prerequisites.
207
+ * provider package names or their prerequisites. Named `metaProviders` (not
208
+ * `providers`) to avoid colliding with the agent's runtime provider-
209
+ * registration descriptor of the same short name.
185
210
  */
186
- providers?: ReadonlyArray<MetaProviderRef>;
211
+ metaProviders?: ReadonlyArray<MetaProviderRef>;
187
212
  cliCommand?: string;
188
213
  apiPrefix?: string;
189
214
  createRoutes?: () => unknown;
@@ -195,8 +220,21 @@ interface VibePlugin {
195
220
  */
196
221
  onServerReady?: (app: unknown, hostServices: HostServices) => void | Promise<void>;
197
222
  onServerStop?: (hostServices: HostServices) => void | Promise<void>;
223
+ /**
224
+ * Nuke lifecycle. The agent invokes this on `vibe nuke` BEFORE the plugin
225
+ * package is uninstalled, while the daemon is still running, so the plugin
226
+ * reaps ITS OWN detached processes (a tunnel binary, a terminal server, …),
227
+ * clears ITS OWN persisted state, and releases any other resource it created.
228
+ *
229
+ * This keeps every provider-specific name (process names, ports, binaries)
230
+ * inside the plugin: the agent loops over installed plugins and calls this
231
+ * uniform hook without referencing any provider or its prerequisites. The
232
+ * agent isolates failures and continues, so a throw never aborts the nuke.
233
+ * Honour `ctx.dryRun` (report, change nothing).
234
+ */
235
+ onNuke?: (hostServices: HostServices, ctx: PluginNukeContext) => void | NukeResult | Promise<void | NukeResult>;
198
236
  onCliSetup?: (program: unknown, hostServices: HostServices) => void;
199
237
  }
200
238
  type VibePluginFactory = (ctx: ProfileContext) => VibePlugin;
201
239
 
202
- export { FULL_TRUST_CAPS, type HostServices, type MetaProviderRef, type PluginCapabilities, type PluginTag, type Prerequisite, type PrerequisiteKind, type ProfileContext, type SdkLogger, type ServiceRegistry, type StorageProvider, type SupportedOS, type VibePlugin, type VibePluginFactory };
240
+ export { FULL_TRUST_CAPS, type HostServices, type MetaProviderRef, type NukeResult, type PluginCapabilities, type PluginNukeContext, type PluginTag, type Prerequisite, type PrerequisiteKind, type ProfileContext, type SdkLogger, type ServiceRegistry, type StorageProvider, type SupportedOS, type VibePlugin, type VibePluginFactory };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { FULL_TRUST_CAPS, HostServices, MetaProviderRef, PluginCapabilities, PluginTag, Prerequisite, PrerequisiteKind, ProfileContext, SdkLogger, ServiceRegistry, StorageProvider, SupportedOS, VibePlugin, VibePluginFactory } from './contract/index.js';
1
+ export { FULL_TRUST_CAPS, HostServices, MetaProviderRef, NukeResult, PluginCapabilities, PluginNukeContext, PluginTag, Prerequisite, PrerequisiteKind, ProfileContext, SdkLogger, ServiceRegistry, StorageProvider, SupportedOS, VibePlugin, VibePluginFactory } from './contract/index.js';
2
2
  export { LifecycleHooks, LifecycleSpec, createLifecycleHooks } from './lifecycle/index.js';
3
3
  export { CliCommandBuilder, MultimodeOptions, OutputFlags, OutputMode, StatusCommandSpec, maybePrintJson, pickOutputMode, redact, runMultimode } from './cli/index.js';
4
4
  export { ApiKeyResolver, RoutesBuilder } from './routes/index.js';
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var FULL_TRUST_CAPS = {
18
18
 
19
19
  // src/lifecycle/index.ts
20
20
  function createLifecycleHooks(spec) {
21
- const { name, onInit, onShutdown, telemetryEventName, skipPlatforms } = spec;
21
+ const { name, onInit, onShutdown, onNuke, telemetryEventName, skipPlatforms } = spec;
22
22
  return {
23
23
  onServerStart: async (_app, hostServices) => {
24
24
  if (skipPlatforms && skipPlatforms.includes(process.platform)) {
@@ -39,6 +39,11 @@ function createLifecycleHooks(spec) {
39
39
  if (onShutdown) {
40
40
  await onShutdown(hostServices);
41
41
  }
42
+ },
43
+ onNuke: async (hostServices, ctx) => {
44
+ if (onNuke) {
45
+ return onNuke(hostServices, ctx);
46
+ }
42
47
  }
43
48
  };
44
49
  }
@@ -1,4 +1,4 @@
1
- import { HostServices } from '../contract/index.js';
1
+ import { HostServices, PluginNukeContext, NukeResult } from '../contract/index.js';
2
2
  import '../host/os.js';
3
3
  import '../host/paths.js';
4
4
 
@@ -19,6 +19,13 @@ interface LifecycleSpec {
19
19
  onInit?: (hostServices: HostServices) => void | Promise<void>;
20
20
  /** Optional shutdown handler — called with hostServices on onServerStop. */
21
21
  onShutdown?: (hostServices: HostServices) => void | Promise<void>;
22
+ /**
23
+ * Optional nuke handler — called with hostServices + ctx on `vibe nuke`,
24
+ * BEFORE the plugin is uninstalled and while the daemon is still up. Use it
25
+ * to reap the plugin's own detached processes, binaries, and persisted
26
+ * state. Honour `ctx.dryRun`.
27
+ */
28
+ onNuke?: (hostServices: HostServices, ctx: PluginNukeContext) => void | NukeResult | Promise<void | NukeResult>;
22
29
  /** Telemetry event name to auto-emit on init (after onInit returns). */
23
30
  telemetryEventName?: string;
24
31
  /** process.platform values the plugin does NOT support — early-return on match. */
@@ -27,6 +34,7 @@ interface LifecycleSpec {
27
34
  interface LifecycleHooks {
28
35
  onServerStart: (app: unknown, hostServices: HostServices) => Promise<void>;
29
36
  onServerStop: (hostServices: HostServices) => Promise<void>;
37
+ onNuke: (hostServices: HostServices, ctx: PluginNukeContext) => Promise<void | NukeResult>;
30
38
  }
31
39
  declare function createLifecycleHooks(spec: LifecycleSpec): LifecycleHooks;
32
40
 
@@ -1,6 +1,6 @@
1
1
  // src/lifecycle/index.ts
2
2
  function createLifecycleHooks(spec) {
3
- const { name, onInit, onShutdown, telemetryEventName, skipPlatforms } = spec;
3
+ const { name, onInit, onShutdown, onNuke, telemetryEventName, skipPlatforms } = spec;
4
4
  return {
5
5
  onServerStart: async (_app, hostServices) => {
6
6
  if (skipPlatforms && skipPlatforms.includes(process.platform)) {
@@ -21,6 +21,11 @@ function createLifecycleHooks(spec) {
21
21
  if (onShutdown) {
22
22
  await onShutdown(hostServices);
23
23
  }
24
+ },
25
+ onNuke: async (hostServices, ctx) => {
26
+ if (onNuke) {
27
+ return onNuke(hostServices, ctx);
28
+ }
24
29
  }
25
30
  };
26
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecontrols/plugin-sdk",
3
- "version": "2026.530.1",
3
+ "version": "2026.530.3",
4
4
  "type": "module",
5
5
  "description": "VibeControls Plugin SDK — shared contract, lifecycle, CLI, telemetry, storage helpers for all vibe-plugin-* packages.",
6
6
  "engines": {