@vibecontrols/plugin-sdk 2026.530.2 → 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.
- package/dist/contract/index.d.ts +37 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -1
- package/dist/lifecycle/index.d.ts +9 -1
- package/dist/lifecycle/index.js +6 -1
- package/package.json +1 -1
package/dist/contract/index.d.ts
CHANGED
|
@@ -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>;
|
|
@@ -197,8 +220,21 @@ interface VibePlugin {
|
|
|
197
220
|
*/
|
|
198
221
|
onServerReady?: (app: unknown, hostServices: HostServices) => void | Promise<void>;
|
|
199
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>;
|
|
200
236
|
onCliSetup?: (program: unknown, hostServices: HostServices) => void;
|
|
201
237
|
}
|
|
202
238
|
type VibePluginFactory = (ctx: ProfileContext) => VibePlugin;
|
|
203
239
|
|
|
204
|
-
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
|
|
package/dist/lifecycle/index.js
CHANGED
|
@@ -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