@vibecontrols/plugin-sdk 2026.530.6 → 2026.531.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.
@@ -197,6 +197,90 @@ interface HostServices {
197
197
  * agent overrides only if it needs to override scope behaviour.
198
198
  */
199
199
  paths?: PathHelpers;
200
+ /**
201
+ * Iframe-bridge primitives. The agent injects implementations of the
202
+ * single-use signed iframe-ticket + scoped UI-cookie family that the
203
+ * `/ui/<plugin>` and other iframe-mount surfaces use. Meta plugins
204
+ * that mount their own auth-shim against an upstream proxy (e.g. the
205
+ * generic `/plan/<sid>/*` reverse proxy in `vibe-plugin-plan`) consume
206
+ * these instead of importing agent internals — keeps the agent
207
+ * provider-agnostic.
208
+ *
209
+ * Cookie-name convention: the host plants `vt_ui_<sid>` for the scoped
210
+ * UI cookie family. Meta plugins must NOT hardcode an upstream proxy's
211
+ * own cookie name; the upstream's 200/401 verdict is the authority.
212
+ *
213
+ * Optional — older agents may not provide this; plugins must check.
214
+ */
215
+ iframeBridge?: IframeBridge;
216
+ }
217
+ /**
218
+ * Iframe-bridge primitives exposed by the agent host. Mirror the
219
+ * helpers in vibecontrols-agent/src/core/iframe-tokens.ts +
220
+ * core/ui-server.ts + middleware/auth.ts.
221
+ *
222
+ * Used by meta plugins (e.g. plan) that mount their own auth-shim in
223
+ * front of a provider's reverse proxy: the meta plugin owns the
224
+ * generic `/plan/<sid>/*` bridge, the provider owns the proxy itself,
225
+ * and the agent stays provider-agnostic — its `/plan/*` route is a
226
+ * blind `pluginRoutesApp.handle(request)` delegator.
227
+ */
228
+ interface IframeBridge {
229
+ /**
230
+ * The agent's current API key. Plugins inject this server-side into
231
+ * forwarded sub-requests so the upstream proxy authenticates them.
232
+ * MUST NOT be sent to the browser. Resolved lazily each call so key
233
+ * rotations are picked up without snapshotting.
234
+ */
235
+ getAgentApiKey(): string;
236
+ /**
237
+ * Verify a single-use signed iframe ticket against an expected request
238
+ * path. Consumes the ticket's JTI on success — replays return false.
239
+ */
240
+ verifyIframeToken(token: string, expectedPath: string): boolean;
241
+ /**
242
+ * Verify a scoped UI-cookie token against an expected sid (the cookie
243
+ * is `vt_ui_<sid>`). NOT single-use — long-lived (≤ TTL) credential
244
+ * the browser sends with every sub-request after the bootstrap exchange.
245
+ */
246
+ verifyUiCookieToken(token: string, sid: string): boolean;
247
+ /**
248
+ * Mint a scoped UI-cookie token for `sid` with the given TTL (seconds).
249
+ * Returns the token (caller assembles the `Set-Cookie` header) plus the
250
+ * absolute expiry in epoch milliseconds.
251
+ */
252
+ issueUiCookieToken(sid: string, ttlSeconds: number): {
253
+ token: string;
254
+ expiresAt: number;
255
+ };
256
+ /**
257
+ * Extract an iframe ticket from a Request — honours
258
+ * `x-vibe-iframe-token` header first, then `?vt=` query. Returns null
259
+ * if neither is present. `path` is reserved for future per-path
260
+ * source selection; pass the request's URL pathname.
261
+ */
262
+ getIframeTokenFromRequest(req: Request, path: string): string | null;
263
+ /**
264
+ * Extract the `vt_ui_<sid>` cookie value from a Request, or null when
265
+ * absent. Cookie-name lookup, not signature verification — pair with
266
+ * `verifyUiCookieToken` to authenticate.
267
+ */
268
+ getUiCookieFromRequest(req: Request, sid: string): string | null;
269
+ /**
270
+ * True when `sid` is safe to interpolate into a cookie name + Path
271
+ * attribute (charset gate matching the agent's UI-cookie family).
272
+ * Plugins should fall through to ticket-only flow when this returns
273
+ * false to avoid cookie-name / Path injection.
274
+ */
275
+ isValidUiPluginName(sid: string): boolean;
276
+ /**
277
+ * The agent's canonical `Content-Security-Policy` `frame-ancestors`
278
+ * source list (incl. the `VIBE_UI_FRAME_ANCESTORS` override). Plugins
279
+ * that serve their own bootstrap HTML MUST reuse this — keeps the
280
+ * allowed embedders consistent with `/ui/<plugin>` and prevents
281
+ * drift-prone copies.
282
+ */
283
+ frameAncestorsCsp(): string;
200
284
  }
201
285
  interface ProfileContext {
202
286
  name: string;
@@ -262,4 +346,4 @@ interface VibePlugin {
262
346
  }
263
347
  type VibePluginFactory = (ctx: ProfileContext) => VibePlugin;
264
348
 
265
- export { FULL_TRUST_CAPS, type HostServices, 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 };
349
+ export { FULL_TRUST_CAPS, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecontrols/plugin-sdk",
3
- "version": "2026.530.6",
3
+ "version": "2026.531.1",
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": {