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