@vibecontrols/plugin-sdk 2026.1107.1 → 2026.1110.1
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/README.md +1 -1
- package/dist/audit/index.d.ts +7 -13
- package/dist/audit/index.js +13 -14
- package/dist/broadcast/index.d.ts +6 -12
- package/dist/broadcast/index.js +8 -9
- package/dist/cli/index.d.ts +7 -72
- package/dist/cli/index.js +1 -104
- package/dist/cli-CGyu31Cn.js +104 -0
- package/dist/config/index.d.ts +18 -24
- package/dist/config/index.js +56 -61
- package/dist/context/index.d.ts +26 -32
- package/dist/context/index.js +33 -21
- package/dist/contract/index.d.ts +2 -413
- package/dist/contract/index.js +11 -12
- package/dist/host/fs-safety.d.ts +13 -17
- package/dist/host/fs-safety.js +223 -217
- package/dist/host/os.d.ts +2 -68
- package/dist/host/os.js +15 -7
- package/dist/host/paths.d.ts +2 -36
- package/dist/host/paths.js +44 -44
- package/dist/host/request-security.d.ts +6 -7
- package/dist/host/request-security.js +26 -14
- package/dist/http/index.d.ts +23 -25
- package/dist/http/index.js +60 -65
- package/dist/index-BM4zNXSR.d.ts +25 -0
- package/dist/index-D946chPf.d.ts +410 -0
- package/dist/index-Q_hnxaN_.d.ts +60 -0
- package/dist/index.d.ts +44 -18
- package/dist/index.js +16 -749
- package/dist/install/index.d.ts +46 -50
- package/dist/install/index.js +269 -189
- package/dist/lifecycle/index.d.ts +24 -30
- package/dist/lifecycle/index.js +18 -30
- package/dist/log/index.d.ts +10 -15
- package/dist/log/index.js +19 -20
- package/dist/os-DoFa9kjr.d.ts +67 -0
- package/dist/paths-h28H4Xeb.d.ts +35 -0
- package/dist/providers/index.d.ts +50 -56
- package/dist/providers/index.js +101 -126
- package/dist/routes/index.d.ts +22 -28
- package/dist/routes/index.js +80 -72
- package/dist/storage/index.d.ts +2 -38
- package/dist/storage/index.js +1 -67
- package/dist/storage-DkNBaJHC.js +64 -0
- package/dist/subprocess/index.d.ts +5 -11
- package/dist/subprocess/index.js +85 -56
- package/dist/telemetry/index.d.ts +15 -21
- package/dist/telemetry/index.js +35 -36
- package/dist/testing/index.d.ts +6 -28
- package/dist/testing/index.js +87 -88
- package/package.json +10 -10
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { t as OsAdapter } from "./os-DoFa9kjr.js";
|
|
2
|
+
import { t as PathHelpers } from "./paths-h28H4Xeb.js";
|
|
3
|
+
interface PluginCapabilities {
|
|
4
|
+
storage?: "none" | "read" | "rw";
|
|
5
|
+
secrets?: "none" | "read" | "rw";
|
|
6
|
+
gateway?: boolean;
|
|
7
|
+
broadcast?: boolean;
|
|
8
|
+
subprocess?: boolean;
|
|
9
|
+
audit?: boolean;
|
|
10
|
+
telemetry?: boolean;
|
|
11
|
+
singletonOnly?: boolean;
|
|
12
|
+
requiresIsolation?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const FULL_TRUST_CAPS: Required<PluginCapabilities>;
|
|
15
|
+
type PluginTag = "backend" | "frontend" | "cli" | "provider" | "adapter" | "integration";
|
|
16
|
+
type PrerequisiteKind = "binary" | "npm" | "pip" | "cargo" | "manual";
|
|
17
|
+
type SupportedOS = "linux" | "darwin" | "win32";
|
|
18
|
+
/**
|
|
19
|
+
* Provider-registry type a META plugin's providers register under, mirroring
|
|
20
|
+
* the agent `ServiceRegistry`'s provider types. Declared on `MetaProviderRef`
|
|
21
|
+
* so a META can ELECT a platform default (not merely install it) without
|
|
22
|
+
* having to scan every registry type to discover which one a provider owns.
|
|
23
|
+
*
|
|
24
|
+
* Kept in lockstep with the agent `ServiceRegistry` provider types
|
|
25
|
+
* (vibecontrols-agent/src/core/service-registry.ts).
|
|
26
|
+
*/
|
|
27
|
+
type ProviderType = "tunnel" | "session" | "ai" | "plan" | "gitops" | "security";
|
|
28
|
+
interface Prerequisite {
|
|
29
|
+
name: string;
|
|
30
|
+
kind: PrerequisiteKind;
|
|
31
|
+
requiresSudo: boolean;
|
|
32
|
+
version?: string;
|
|
33
|
+
install?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Human-readable rationale shown in the first-run consent prompt. Lives on
|
|
36
|
+
* the plugin (the agent no longer keeps a hardcoded tool→reason table).
|
|
37
|
+
*/
|
|
38
|
+
reason?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A provider plugin a META plugin routes to. META plugins declare these so the
|
|
42
|
+
* agent never hardcodes provider package names: the agent installs the meta,
|
|
43
|
+
* reads its `providers`, then installs the platform-appropriate default(s).
|
|
44
|
+
*/
|
|
45
|
+
interface MetaProviderRef {
|
|
46
|
+
/** Provider package name, e.g. "@vibecontrols/vibe-plugin-session-wezterm". */
|
|
47
|
+
packageName: string;
|
|
48
|
+
/** Short provider name (matches the provider plugin manifest `name`). */
|
|
49
|
+
pluginName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Platforms on which this provider is the auto-installed DEFAULT for the
|
|
52
|
+
* meta. Empty/undefined = opt-in only (never auto-installed at bootstrap).
|
|
53
|
+
*/
|
|
54
|
+
defaultOn?: ReadonlyArray<SupportedOS>;
|
|
55
|
+
/**
|
|
56
|
+
* The agent `ServiceRegistry` provider type this entry registers under
|
|
57
|
+
* (e.g. "session" for tmux/wezterm/zellij). When set, the agent elects the
|
|
58
|
+
* `defaultOn`-matching provider of this type as the registry default for the
|
|
59
|
+
* current platform (win32 → wezterm, linux/darwin → tmux) instead of only
|
|
60
|
+
* installing it. Optional — when omitted the agent infers the type by
|
|
61
|
+
* scanning the registry, so older metas keep working.
|
|
62
|
+
*/
|
|
63
|
+
providerType?: ProviderType;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Context passed to a plugin's `onNuke` hook. The agent calls `onNuke`
|
|
67
|
+
* during `vibe nuke` while the daemon is still running — so the plugin's
|
|
68
|
+
* in-memory state and registered provider instances are reachable — and
|
|
69
|
+
* BEFORE the plugin package is uninstalled.
|
|
70
|
+
*/
|
|
71
|
+
interface PluginNukeContext {
|
|
72
|
+
/** Absolute per-agent data dir for the active profile, when known. */
|
|
73
|
+
agentDir?: string;
|
|
74
|
+
/** Report-only: enumerate what WOULD be reaped, change nothing. */
|
|
75
|
+
dryRun: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* What a plugin reaped during `onNuke`, surfaced in the operator's nuke
|
|
79
|
+
* output. Both fields are optional — a plugin that cleans nothing silently
|
|
80
|
+
* may return nothing at all.
|
|
81
|
+
*/
|
|
82
|
+
interface NukeResult {
|
|
83
|
+
/** Short labels of processes/resources the plugin reaped. */
|
|
84
|
+
reaped?: string[];
|
|
85
|
+
/** Non-fatal notes (e.g. "left binary installed — shared/user-owned"). */
|
|
86
|
+
notes?: string[];
|
|
87
|
+
}
|
|
88
|
+
interface StorageProvider {
|
|
89
|
+
get<T = unknown>(namespace: string, key: string): Promise<T | null>;
|
|
90
|
+
set<T = unknown>(namespace: string, key: string, value: T): Promise<void>;
|
|
91
|
+
delete(namespace: string, key: string): Promise<boolean>;
|
|
92
|
+
list?(namespace: string): Promise<string[]>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Minimal façade over the agent's ServiceRegistry. Mirrors the agent's
|
|
96
|
+
* actual signatures (vibecontrols-agent/src/core/service-registry.ts):
|
|
97
|
+
*
|
|
98
|
+
* - `registerProvider(type, provider, pluginName)` — register a
|
|
99
|
+
* provider implementation under a provider type ("session", "tunnel",
|
|
100
|
+
* "ai"). The agent multiplexes providers per type and resolves a
|
|
101
|
+
* default via `getProvider<T>(type)`.
|
|
102
|
+
* - `getProvider<T>(type)` — return the default-resolved provider for
|
|
103
|
+
* the given type.
|
|
104
|
+
* - `registerService(pluginName, serviceName, service)` /
|
|
105
|
+
* `getService(pluginName, serviceName)` — namespaced bag for plugin-
|
|
106
|
+
* to-plugin services that aren't provider implementations.
|
|
107
|
+
*
|
|
108
|
+
* Every member is optional so SDK consumers tolerate partial or alt
|
|
109
|
+
* hosts. The SDK's `ProviderRegistry` wrapper picks the right method.
|
|
110
|
+
*/
|
|
111
|
+
interface ServiceRegistry {
|
|
112
|
+
registerProvider?(type: string, provider: unknown, pluginName: string): void;
|
|
113
|
+
getProvider?<T>(type: string): T | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Resolve a *specific* provider by `(type, pluginName)`. Mirrors the
|
|
116
|
+
* agent's `serviceRegistry.getProviderByName<T>(type, pluginName)`
|
|
117
|
+
* (`vibecontrols-agent/src/core/service-registry.ts:168`). Lets
|
|
118
|
+
* `ProviderRegistry.getProvider(type, name)` actually return the
|
|
119
|
+
* named provider instead of silently falling back to the type's
|
|
120
|
+
* default — without this the session-manager's `/providers` route
|
|
121
|
+
* returns the same default-provider object for every plugin name it
|
|
122
|
+
* looks up.
|
|
123
|
+
*/
|
|
124
|
+
getProviderByName?<T>(type: string, pluginName: string): T | undefined;
|
|
125
|
+
registerService?(pluginName: string, serviceName: string, service: unknown): void;
|
|
126
|
+
getService?<T>(pluginName: string, serviceName: string): T | undefined;
|
|
127
|
+
listProvidersForType?(type: string): string[] | Array<{
|
|
128
|
+
pluginName: string;
|
|
129
|
+
isDefault: boolean;
|
|
130
|
+
}>;
|
|
131
|
+
}
|
|
132
|
+
interface SdkLogger {
|
|
133
|
+
debug?(source: string, message: string, metadata?: Record<string, unknown>): void;
|
|
134
|
+
info?(source: string, message: string, metadata?: Record<string, unknown>): void;
|
|
135
|
+
warn?(source: string, message: string, metadata?: Record<string, unknown>): void;
|
|
136
|
+
error?(source: string, message: string, metadata?: Record<string, unknown>): void;
|
|
137
|
+
setLevel?(level: string): void;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The provisioning façade the agent injects into a META plugin's
|
|
141
|
+
* `provisionProviders` / `bootstrapTunnel` hooks. It lets a META install,
|
|
142
|
+
* load, prereq-install and elect ITS OWN provider plugins WITHOUT the agent
|
|
143
|
+
* enumerating providers — the agent only knows metas; metas drive providers.
|
|
144
|
+
*
|
|
145
|
+
* The agent gates this surface behind the capability proxy: only trusted/core
|
|
146
|
+
* META plugins receive a populated `plugins`. Untrusted plugins see it absent,
|
|
147
|
+
* so every member is optional and a META must defensively optional-chain.
|
|
148
|
+
*/
|
|
149
|
+
interface HostPlugins {
|
|
150
|
+
/**
|
|
151
|
+
* Install a provider package (npm) into the active install scope. Idempotent
|
|
152
|
+
* — a no-op when already installed unless `refreshLatest` forces `@latest`.
|
|
153
|
+
*/
|
|
154
|
+
install?(packageName: string, opts?: {
|
|
155
|
+
refreshLatest?: boolean;
|
|
156
|
+
}): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Import + register + mount an already-installed provider, firing its
|
|
159
|
+
* `onServerStart` / `onServerReady`. After this resolves the provider's
|
|
160
|
+
* implementation is live in the agent `ServiceRegistry`.
|
|
161
|
+
*/
|
|
162
|
+
loadProvider?(packageName: string): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Drive a loaded plugin's `/prereqs/{status,install}` protocol so the
|
|
165
|
+
* provider installs its OWN binary/tool. `skipInstall` honours the
|
|
166
|
+
* operator's `--no-install-deps`. Returns whether prerequisites are satisfied.
|
|
167
|
+
*/
|
|
168
|
+
runPrereqs?(packageName: string, opts?: {
|
|
169
|
+
skipInstall?: boolean;
|
|
170
|
+
}): Promise<{
|
|
171
|
+
satisfied: boolean;
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* Elect `pluginName` as the registry default for `type`, respecting a prior
|
|
175
|
+
* user/operator override (never clobbers an explicit choice).
|
|
176
|
+
*/
|
|
177
|
+
electDefault?(type: ProviderType, pluginName: string): Promise<void>;
|
|
178
|
+
/** True if a provider of this `(type, pluginName)` is registered. */
|
|
179
|
+
isProviderRegistered?(type: ProviderType, pluginName: string): boolean;
|
|
180
|
+
/** True when the operator passed `--no-install-deps` (VIBE_SKIP_PREREQ_INSTALL=1). */
|
|
181
|
+
skipInstall?(): boolean;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The host surface a plugin can rely on. Every member is optional —
|
|
185
|
+
* downstream plugins must defensively use optional chaining or check
|
|
186
|
+
* presence before invoking. Mirrors agent's `HostServices` (plugin-system.ts:155-242)
|
|
187
|
+
* but type-loosened so SDK consumers don't need to depend on the agent.
|
|
188
|
+
*/
|
|
189
|
+
interface HostServices {
|
|
190
|
+
storage?: StorageProvider;
|
|
191
|
+
logger?: SdkLogger;
|
|
192
|
+
serviceRegistry?: ServiceRegistry;
|
|
193
|
+
getProvider?<T = unknown>(type: string): T | undefined;
|
|
194
|
+
getAgentBaseUrl?(): string;
|
|
195
|
+
getAgentVersion?(): string;
|
|
196
|
+
broadcast?(type: string, payload: unknown): void;
|
|
197
|
+
workspaceQuery?<T = Record<string, unknown>>(query: string, variables?: Record<string, unknown>): Promise<{
|
|
198
|
+
data?: T;
|
|
199
|
+
errors?: Array<{
|
|
200
|
+
message: string;
|
|
201
|
+
}>;
|
|
202
|
+
}>;
|
|
203
|
+
isGatewayConfigured?(): boolean;
|
|
204
|
+
getAgentRecordId?(): Promise<string | null>;
|
|
205
|
+
getWorkspaceId?(): Promise<string | null>;
|
|
206
|
+
getConfig?(key: string): Promise<string | undefined>;
|
|
207
|
+
getPluginRegistry?(): string;
|
|
208
|
+
getDataDir?(): string;
|
|
209
|
+
cliContributors?: {
|
|
210
|
+
addStatusSection?(section: unknown): void;
|
|
211
|
+
addDoctorCheck?(check: unknown): void;
|
|
212
|
+
};
|
|
213
|
+
audit?: {
|
|
214
|
+
emit(event: string, payload?: Record<string, unknown>): void;
|
|
215
|
+
};
|
|
216
|
+
telemetry?: {
|
|
217
|
+
emit(event: string, payload?: Record<string, unknown>): void;
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* OS adapter — the agent injects an instance of its own OsAdapter at
|
|
221
|
+
* boot (see vibecontrols-agent/src/core/os-adapter.ts). Plugins should
|
|
222
|
+
* import the `OsAdapter` type from `@vibecontrols/plugin-sdk/host/os`
|
|
223
|
+
* for type-only references and treat every field as optional.
|
|
224
|
+
*/
|
|
225
|
+
os?: OsAdapter;
|
|
226
|
+
/**
|
|
227
|
+
* Cross-platform path helpers. Defaults to the pure-functions impl
|
|
228
|
+
* exported from `@vibecontrols/plugin-sdk/host/paths` (`paths`); the
|
|
229
|
+
* agent overrides only if it needs to override scope behaviour.
|
|
230
|
+
*/
|
|
231
|
+
paths?: PathHelpers;
|
|
232
|
+
/**
|
|
233
|
+
* Iframe-bridge primitives. The agent injects implementations of the
|
|
234
|
+
* single-use signed iframe-ticket + scoped UI-cookie family that the
|
|
235
|
+
* `/ui/<plugin>` and other iframe-mount surfaces use. Meta plugins
|
|
236
|
+
* that mount their own auth-shim against an upstream proxy (e.g. the
|
|
237
|
+
* generic `/plan/<sid>/*` reverse proxy in `vibe-plugin-plan`) consume
|
|
238
|
+
* these instead of importing agent internals — keeps the agent
|
|
239
|
+
* provider-agnostic.
|
|
240
|
+
*
|
|
241
|
+
* Cookie-name convention: the host plants `vt_ui_<sid>` for the scoped
|
|
242
|
+
* UI cookie family. Meta plugins must NOT hardcode an upstream proxy's
|
|
243
|
+
* own cookie name; the upstream's 200/401 verdict is the authority.
|
|
244
|
+
*
|
|
245
|
+
* Optional — older agents may not provide this; plugins must check.
|
|
246
|
+
*/
|
|
247
|
+
iframeBridge?: IframeBridge;
|
|
248
|
+
/**
|
|
249
|
+
* Provisioning façade — META plugins drive their OWN providers through this
|
|
250
|
+
* (install → loadProvider → runPrereqs → electDefault) inside their
|
|
251
|
+
* `provisionProviders` / `bootstrapTunnel` hooks. The agent injects it only
|
|
252
|
+
* for trusted/core metas (capability-gated); absent on older agents and for
|
|
253
|
+
* untrusted plugins. Optional — metas must defensively optional-chain.
|
|
254
|
+
*/
|
|
255
|
+
plugins?: HostPlugins;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Iframe-bridge primitives exposed by the agent host. Mirror the
|
|
259
|
+
* helpers in vibecontrols-agent/src/core/iframe-tokens.ts +
|
|
260
|
+
* core/ui-server.ts + middleware/auth.ts.
|
|
261
|
+
*
|
|
262
|
+
* Used by meta plugins (e.g. plan) that mount their own auth-shim in
|
|
263
|
+
* front of a provider's reverse proxy: the meta plugin owns the
|
|
264
|
+
* generic `/plan/<sid>/*` bridge, the provider owns the proxy itself,
|
|
265
|
+
* and the agent stays provider-agnostic — its `/plan/*` route is a
|
|
266
|
+
* blind `pluginRoutesApp.handle(request)` delegator.
|
|
267
|
+
*/
|
|
268
|
+
interface IframeBridge {
|
|
269
|
+
/**
|
|
270
|
+
* The agent's current API key. Plugins inject this server-side into
|
|
271
|
+
* forwarded sub-requests so the upstream proxy authenticates them.
|
|
272
|
+
* MUST NOT be sent to the browser. Resolved lazily each call so key
|
|
273
|
+
* rotations are picked up without snapshotting.
|
|
274
|
+
*/
|
|
275
|
+
getAgentApiKey(): string;
|
|
276
|
+
/**
|
|
277
|
+
* Verify a single-use signed iframe ticket against an expected request
|
|
278
|
+
* path. Consumes the ticket's JTI on success — replays return false.
|
|
279
|
+
*/
|
|
280
|
+
verifyIframeToken(token: string, expectedPath: string): boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Verify a scoped UI-cookie token against an expected sid (the cookie
|
|
283
|
+
* is `vt_ui_<sid>`). NOT single-use — long-lived (≤ TTL) credential
|
|
284
|
+
* the browser sends with every sub-request after the bootstrap exchange.
|
|
285
|
+
*/
|
|
286
|
+
verifyUiCookieToken(token: string, sid: string): boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Mint a scoped UI-cookie token for `sid` with the given TTL (seconds).
|
|
289
|
+
* Returns the token (caller assembles the `Set-Cookie` header) plus the
|
|
290
|
+
* absolute expiry in epoch milliseconds.
|
|
291
|
+
*/
|
|
292
|
+
issueUiCookieToken(sid: string, ttlSeconds: number): {
|
|
293
|
+
token: string;
|
|
294
|
+
expiresAt: number;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Extract an iframe ticket from a Request — honours
|
|
298
|
+
* `x-vibe-iframe-token` header first, then `?vt=` query. Returns null
|
|
299
|
+
* if neither is present. `path` is reserved for future per-path
|
|
300
|
+
* source selection; pass the request's URL pathname.
|
|
301
|
+
*/
|
|
302
|
+
getIframeTokenFromRequest(req: Request, path: string): string | null;
|
|
303
|
+
/**
|
|
304
|
+
* Extract the `vt_ui_<sid>` cookie value from a Request, or null when
|
|
305
|
+
* absent. Cookie-name lookup, not signature verification — pair with
|
|
306
|
+
* `verifyUiCookieToken` to authenticate.
|
|
307
|
+
*/
|
|
308
|
+
getUiCookieFromRequest(req: Request, sid: string): string | null;
|
|
309
|
+
/**
|
|
310
|
+
* True when `sid` is safe to interpolate into a cookie name + Path
|
|
311
|
+
* attribute (charset gate matching the agent's UI-cookie family).
|
|
312
|
+
* Plugins should fall through to ticket-only flow when this returns
|
|
313
|
+
* false to avoid cookie-name / Path injection.
|
|
314
|
+
*/
|
|
315
|
+
isValidUiPluginName(sid: string): boolean;
|
|
316
|
+
/**
|
|
317
|
+
* The agent's canonical `Content-Security-Policy` `frame-ancestors`
|
|
318
|
+
* source list (incl. the `VIBE_UI_FRAME_ANCESTORS` override). Plugins
|
|
319
|
+
* that serve their own bootstrap HTML MUST reuse this — keeps the
|
|
320
|
+
* allowed embedders consistent with `/ui/<plugin>` and prevents
|
|
321
|
+
* drift-prone copies.
|
|
322
|
+
*/
|
|
323
|
+
frameAncestorsCsp(): string;
|
|
324
|
+
}
|
|
325
|
+
interface ProfileContext {
|
|
326
|
+
name: string;
|
|
327
|
+
dataDir: string;
|
|
328
|
+
logger?: SdkLogger;
|
|
329
|
+
audit?: {
|
|
330
|
+
emit(source: string, event: string, payload?: Record<string, unknown>): void;
|
|
331
|
+
};
|
|
332
|
+
telemetry?: {
|
|
333
|
+
emit(event: string, payload?: Record<string, unknown>): void;
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
interface VibePlugin {
|
|
337
|
+
name: string;
|
|
338
|
+
version: string;
|
|
339
|
+
description?: string;
|
|
340
|
+
tags?: PluginTag[];
|
|
341
|
+
capabilities?: PluginCapabilities;
|
|
342
|
+
prerequisites?: Prerequisite[];
|
|
343
|
+
/**
|
|
344
|
+
* META plugins (session, tunnel, ai, storage, gitops) declare the provider
|
|
345
|
+
* plugins they route to + per-platform defaults here. The thin agent reads
|
|
346
|
+
* this to decide what to install at bootstrap, so it never hardcodes
|
|
347
|
+
* provider package names or their prerequisites. Named `metaProviders` (not
|
|
348
|
+
* `providers`) to avoid colliding with the agent's runtime provider-
|
|
349
|
+
* registration descriptor of the same short name.
|
|
350
|
+
*/
|
|
351
|
+
metaProviders?: ReadonlyArray<MetaProviderRef>;
|
|
352
|
+
/**
|
|
353
|
+
* META plugins ONLY. The agent calls this AFTER the meta's own
|
|
354
|
+
* `onServerStart`, in the background once the daemon reaches `ready`. The
|
|
355
|
+
* meta installs, loads, runs-prereqs-for and elects ITS OWN providers via
|
|
356
|
+
* `hostServices.plugins` — typically by delegating to the shared
|
|
357
|
+
* `provisionMetaProviders(host, this.metaProviders)` helper from
|
|
358
|
+
* `@vibecontrols/plugin-sdk/providers`. The agent enumerates NO provider
|
|
359
|
+
* here; it just fires this hook on each loaded meta. Best-effort — a throw
|
|
360
|
+
* never aborts boot.
|
|
361
|
+
*/
|
|
362
|
+
provisionProviders?: (hostServices: HostServices) => void | Promise<void>;
|
|
363
|
+
/**
|
|
364
|
+
* Tunnel META ONLY. Open a MINIMAL pre-registration tunnel and return its
|
|
365
|
+
* public URL (or null). The agent calls this BEFORE it has backend auth so
|
|
366
|
+
* it can register — breaking the chicken-and-egg (need a URL to register →
|
|
367
|
+
* need auth for the encrypted DB → need the DB for the real provider → need
|
|
368
|
+
* the provider for a URL). The meta installs+loads its platform-default
|
|
369
|
+
* tunnel provider in bootstrap mode and asks it for a quick-tunnel URL; the
|
|
370
|
+
* provider keeps the process alive for later adoption/handover. The agent
|
|
371
|
+
* never names cloudflared — the provider owns its binary + manifest.
|
|
372
|
+
*/
|
|
373
|
+
bootstrapTunnel?: (port: number, hostServices: HostServices) => Promise<string | null>;
|
|
374
|
+
/**
|
|
375
|
+
* Tunnel PROVIDER plugins only: the public DNS suffix(es) the tunnels this
|
|
376
|
+
* provider opens live under, e.g. `[".trycloudflare.com"]`. The agent adds
|
|
377
|
+
* these to its allow-list of advertise-able / reachable tunnel URLs at
|
|
378
|
+
* provider registration, so the thin agent never hardcodes a provider's
|
|
379
|
+
* domain in its URL-security layer. Each entry SHOULD start with a dot and
|
|
380
|
+
* be a registrable suffix (matched with `host.endsWith(suffix)`).
|
|
381
|
+
*/
|
|
382
|
+
tunnelDomainSuffixes?: ReadonlyArray<string>;
|
|
383
|
+
cliCommand?: string;
|
|
384
|
+
apiPrefix?: string;
|
|
385
|
+
createRoutes?: () => unknown;
|
|
386
|
+
onServerStart?: (app: unknown, hostServices: HostServices) => void | Promise<void>;
|
|
387
|
+
/**
|
|
388
|
+
* Optional post-start hook — agent fires this AFTER `onServerStart` and
|
|
389
|
+
* after the Elysia app is listening, so plugins can schedule background
|
|
390
|
+
* work (queue processors, watchers) or register context providers.
|
|
391
|
+
*/
|
|
392
|
+
onServerReady?: (app: unknown, hostServices: HostServices) => void | Promise<void>;
|
|
393
|
+
onServerStop?: (hostServices: HostServices) => void | Promise<void>;
|
|
394
|
+
/**
|
|
395
|
+
* Nuke lifecycle. The agent invokes this on `vibe nuke` BEFORE the plugin
|
|
396
|
+
* package is uninstalled, while the daemon is still running, so the plugin
|
|
397
|
+
* reaps ITS OWN detached processes (a tunnel binary, a terminal server, …),
|
|
398
|
+
* clears ITS OWN persisted state, and releases any other resource it created.
|
|
399
|
+
*
|
|
400
|
+
* This keeps every provider-specific name (process names, ports, binaries)
|
|
401
|
+
* inside the plugin: the agent loops over installed plugins and calls this
|
|
402
|
+
* uniform hook without referencing any provider or its prerequisites. The
|
|
403
|
+
* agent isolates failures and continues, so a throw never aborts the nuke.
|
|
404
|
+
* Honour `ctx.dryRun` (report, change nothing).
|
|
405
|
+
*/
|
|
406
|
+
onNuke?: (hostServices: HostServices, ctx: PluginNukeContext) => void | NukeResult | Promise<void | NukeResult>;
|
|
407
|
+
onCliSetup?: (program: unknown, hostServices: HostServices) => void;
|
|
408
|
+
}
|
|
409
|
+
type VibePluginFactory = (ctx: ProfileContext) => VibePlugin;
|
|
410
|
+
export { SupportedOS as _, MetaProviderRef as a, PluginNukeContext as c, PrerequisiteKind as d, ProfileContext as f, StorageProvider as g, ServiceRegistry as h, IframeBridge as i, PluginTag as l, SdkLogger as m, HostPlugins as n, NukeResult as o, ProviderType as p, HostServices as r, PluginCapabilities as s, FULL_TRUST_CAPS as t, Prerequisite as u, VibePlugin as v, VibePluginFactory as y };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Multi-mode output dispatcher.
|
|
4
|
+
*
|
|
5
|
+
* Lifted from vibecontrols-agent/src/cli/utils/multimode.ts but trimmed:
|
|
6
|
+
* the SDK doesn't ship the agent's `isInteractive()` helper since plugins
|
|
7
|
+
* can't depend on opentui from the SDK. Instead we use a stdout-isTTY +
|
|
8
|
+
* env CI/NO_COLOR check inline.
|
|
9
|
+
*/
|
|
10
|
+
type OutputMode = "auto" | "interactive" | "plain" | "json";
|
|
11
|
+
interface OutputFlags {
|
|
12
|
+
json?: boolean;
|
|
13
|
+
plain?: boolean;
|
|
14
|
+
interactive?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface MultimodeOptions<T> {
|
|
17
|
+
fetchData: () => Promise<T> | T;
|
|
18
|
+
plain: (data: T) => void | Promise<void>;
|
|
19
|
+
interactive?: (data: T) => Promise<void>;
|
|
20
|
+
json?: (data: T) => unknown;
|
|
21
|
+
mode?: OutputMode;
|
|
22
|
+
}
|
|
23
|
+
/** Resolve user-supplied CLI flags into an OutputMode. */
|
|
24
|
+
declare function pickOutputMode(flags: OutputFlags): OutputMode;
|
|
25
|
+
declare function runMultimode<T>(opts: MultimodeOptions<T>): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Convenience: emit `data` as JSON if `--json` is set; return `true` when
|
|
28
|
+
* something was printed. Mutating commands (start/stop/install/...) reach
|
|
29
|
+
* for this when they want a scriptable JSON opt-in.
|
|
30
|
+
*/
|
|
31
|
+
declare function maybePrintJson(flags: OutputFlags, data: unknown): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Recursive sensitive-field stripper. Replaces values for keys matching the
|
|
34
|
+
* sensitive regex with the literal string "[redacted]". Walks arrays, plain
|
|
35
|
+
* objects, and leaves primitives / null / undefined untouched.
|
|
36
|
+
*/
|
|
37
|
+
declare function redact<T>(value: T): T;
|
|
38
|
+
interface StatusCommandSpec<T> {
|
|
39
|
+
description: string;
|
|
40
|
+
fetchData: () => Promise<T> | T;
|
|
41
|
+
/** Plain renderer override. Defaults to `JSON.stringify` if absent. */
|
|
42
|
+
format?: (data: T) => void | Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Apply redaction before any renderer. Strips sensitive keys recursively
|
|
45
|
+
* (see ./redaction.ts).
|
|
46
|
+
*/
|
|
47
|
+
redact?: boolean;
|
|
48
|
+
}
|
|
49
|
+
declare class CliCommandBuilder {
|
|
50
|
+
private readonly program;
|
|
51
|
+
constructor(program: Command);
|
|
52
|
+
/**
|
|
53
|
+
* Register a `<name>` sub-command that fetches once and renders via
|
|
54
|
+
* `--json` / `--plain` / interactive (when stdout is a TTY).
|
|
55
|
+
*/
|
|
56
|
+
addStatusCommand<T>(name: string, spec: StatusCommandSpec<T>): this;
|
|
57
|
+
/** Escape hatch: hand back the underlying commander Command. */
|
|
58
|
+
command(): Command;
|
|
59
|
+
}
|
|
60
|
+
export { OutputFlags as a, pickOutputMode as c, MultimodeOptions as i, runMultimode as l, StatusCommandSpec as n, OutputMode as o, redact as r, maybePrintJson as s, CliCommandBuilder as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @vibecontrols/plugin-sdk — root barrel.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the most commonly-used helpers so a downstream plugin can:
|
|
5
|
+
*
|
|
6
|
+
* import {
|
|
7
|
+
* createLifecycleHooks,
|
|
8
|
+
* TelemetryEmitter,
|
|
9
|
+
* BoundLogger,
|
|
10
|
+
* TypedStore,
|
|
11
|
+
* ConfigManager,
|
|
12
|
+
* gracefulKill,
|
|
13
|
+
* ProviderRegistry,
|
|
14
|
+
* AuditLogger,
|
|
15
|
+
* BroadcastEmitter,
|
|
16
|
+
* RoutesBuilder,
|
|
17
|
+
* redact,
|
|
18
|
+
* pickOutputMode,
|
|
19
|
+
* CliCommandBuilder,
|
|
20
|
+
* HttpClient,
|
|
21
|
+
* type VibePlugin,
|
|
22
|
+
* type HostServices,
|
|
23
|
+
* } from "@vibecontrols/plugin-sdk";
|
|
24
|
+
*
|
|
25
|
+
* Subpath imports (`@vibecontrols/plugin-sdk/cli`, etc.) remain available
|
|
26
|
+
* for tighter tree-shaking on big plugins.
|
|
27
|
+
*/
|
|
28
|
+
import { _ as SupportedOS, a as MetaProviderRef, c as PluginNukeContext, d as PrerequisiteKind, f as ProfileContext, g as StorageProvider, h as ServiceRegistry, l as PluginTag, m as SdkLogger, n as HostPlugins, o as NukeResult, p as ProviderType, r as HostServices, s as PluginCapabilities, t as FULL_TRUST_CAPS, u as Prerequisite, v as VibePlugin, y as VibePluginFactory } from "./index-D946chPf.js";
|
|
29
|
+
import { LifecycleHooks, LifecycleSpec, createLifecycleHooks } from "./lifecycle/index.js";
|
|
30
|
+
import { a as OutputFlags, c as pickOutputMode, i as MultimodeOptions, l as runMultimode, n as StatusCommandSpec, o as OutputMode, r as redact, s as maybePrintJson, t as CliCommandBuilder } from "./index-Q_hnxaN_.js";
|
|
31
|
+
import { ApiKeyResolver, RoutesBuilder } from "./routes/index.js";
|
|
32
|
+
import { TelemetryEmitter } from "./telemetry/index.js";
|
|
33
|
+
import { BoundLogger } from "./log/index.js";
|
|
34
|
+
import { n as TypedStore, t as NamespaceStore } from "./index-BM4zNXSR.js";
|
|
35
|
+
import { ConfigManager } from "./config/index.js";
|
|
36
|
+
import { findAvailablePort, gracefulKill, isProcessAlive, sleep } from "./subprocess/index.js";
|
|
37
|
+
import { HttpClient, HttpClientOptions, RequestOptions } from "./http/index.js";
|
|
38
|
+
import { CliContribution, ProviderRegistry, currentSupportedOS, provisionMetaProviders } from "./providers/index.js";
|
|
39
|
+
import { CONTEXT_PROVIDER_TYPE, ContextContribution, ContextProvider, ContextRequest, getContextProvider, listContextProviders, registerContextProvider } from "./context/index.js";
|
|
40
|
+
import { AuditLogger } from "./audit/index.js";
|
|
41
|
+
import { BroadcastEmitter } from "./broadcast/index.js";
|
|
42
|
+
import { a as platformLabel, i as manualInstallHint, n as PlatformLabel, r as SupportedPlatform, t as OsAdapter } from "./os-DoFa9kjr.js";
|
|
43
|
+
import { n as paths, t as PathHelpers } from "./paths-h28H4Xeb.js";
|
|
44
|
+
export { type ApiKeyResolver, AuditLogger, BoundLogger, BroadcastEmitter, CONTEXT_PROVIDER_TYPE, CliCommandBuilder, type CliContribution, ConfigManager, type ContextContribution, type ContextProvider, type ContextRequest, FULL_TRUST_CAPS, type HostPlugins, type HostServices, HttpClient, type HttpClientOptions, type LifecycleHooks, type LifecycleSpec, type MetaProviderRef, type MultimodeOptions, NamespaceStore, type NukeResult, type OsAdapter, type OutputFlags, type OutputMode, type PathHelpers, type PlatformLabel, type PluginCapabilities, type PluginNukeContext, type PluginTag, type Prerequisite, type PrerequisiteKind, type ProfileContext, ProviderRegistry, type ProviderType, type RequestOptions, RoutesBuilder, type SdkLogger, type ServiceRegistry, type StatusCommandSpec, type StorageProvider, type SupportedOS, type SupportedPlatform, TelemetryEmitter, TypedStore, type VibePlugin, type VibePluginFactory, createLifecycleHooks, currentSupportedOS, findAvailablePort, getContextProvider, gracefulKill, isProcessAlive, listContextProviders, manualInstallHint, maybePrintJson, paths, pickOutputMode, platformLabel, provisionMetaProviders, redact, registerContextProvider, runMultimode, sleep };
|