@vibecontrols/plugin-sdk 2026.509.1 → 2026.509.2

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.
@@ -38,10 +38,32 @@ interface StorageProvider {
38
38
  delete(namespace: string, key: string): Promise<boolean>;
39
39
  list?(namespace: string): Promise<string[]>;
40
40
  }
41
+ /**
42
+ * Minimal façade over the agent's ServiceRegistry. Mirrors the agent's
43
+ * actual signatures (vibecontrols-agent/src/core/service-registry.ts):
44
+ *
45
+ * - `registerProvider(type, provider, pluginName)` — register a
46
+ * provider implementation under a provider type ("session", "tunnel",
47
+ * "ai"). The agent multiplexes providers per type and resolves a
48
+ * default via `getProvider<T>(type)`.
49
+ * - `getProvider<T>(type)` — return the default-resolved provider for
50
+ * the given type.
51
+ * - `registerService(pluginName, serviceName, service)` /
52
+ * `getService(pluginName, serviceName)` — namespaced bag for plugin-
53
+ * to-plugin services that aren't provider implementations.
54
+ *
55
+ * Every member is optional so SDK consumers tolerate partial or alt
56
+ * hosts. The SDK's `ProviderRegistry` wrapper picks the right method.
57
+ */
41
58
  interface ServiceRegistry {
42
- registerService<T>(type: string, name: string, instance: T): void;
43
- getService<T>(type: string, name: string): T | undefined;
44
- listProvidersForType?(type: string): string[];
59
+ registerProvider?(type: string, provider: unknown, pluginName: string): void;
60
+ getProvider?<T>(type: string): T | undefined;
61
+ registerService?(pluginName: string, serviceName: string, service: unknown): void;
62
+ getService?<T>(pluginName: string, serviceName: string): T | undefined;
63
+ listProvidersForType?(type: string): string[] | Array<{
64
+ pluginName: string;
65
+ isDefault: boolean;
66
+ }>;
45
67
  }
46
68
  interface SdkLogger {
47
69
  debug?(source: string, message: string, metadata?: Record<string, unknown>): void;
package/dist/index.js CHANGED
@@ -537,15 +537,40 @@ var ProviderRegistry = class {
537
537
  getServiceRegistry() {
538
538
  return this.hostServices?.serviceRegistry;
539
539
  }
540
+ /**
541
+ * Register a provider implementation (session / tunnel / ai) on the
542
+ * agent's per-type provider registry. Maps onto the agent's
543
+ * `registerProvider(type, provider, pluginName)` shape.
544
+ */
540
545
  registerProvider(type, name, provider) {
541
- this.hostServices?.serviceRegistry?.registerService(type, name, provider);
546
+ this.hostServices?.serviceRegistry?.registerProvider?.(type, provider, name);
542
547
  }
548
+ /**
549
+ * Resolve a provider for a given type. With one argument, returns the
550
+ * default-resolved provider (matching the agent's
551
+ * `serviceRegistry.getProvider<T>(type)` shape). With two arguments,
552
+ * resolves a *specific* provider by name — the agent's registry only
553
+ * exposes a default-resolved getter, so we list per-type entries and
554
+ * verify the name is present. The two-argument form preserves the
555
+ * original SDK signature so consumer plugins (e.g. session-manager)
556
+ * keep compiling.
557
+ */
543
558
  getProvider(type, name) {
544
- return this.hostServices?.serviceRegistry?.getService(type, name);
559
+ const reg = this.hostServices?.serviceRegistry;
560
+ if (!reg) return void 0;
561
+ if (name === void 0) return reg.getProvider?.(type);
562
+ if (!reg.listProvidersForType) return void 0;
563
+ const entries = reg.listProvidersForType(type) ?? [];
564
+ const present = entries.some(
565
+ (entry) => typeof entry === "string" ? entry === name : entry.pluginName === name
566
+ );
567
+ if (!present) return void 0;
568
+ return reg.getProvider?.(type);
545
569
  }
546
570
  listProviders(type) {
547
571
  const reg = this.hostServices?.serviceRegistry;
548
- return reg?.listProvidersForType?.(type) ?? [];
572
+ const entries = reg?.listProvidersForType?.(type) ?? [];
573
+ return entries.map((entry) => typeof entry === "string" ? entry : entry.pluginName);
549
574
  }
550
575
  /**
551
576
  * Register a CLI contribution bundle (status sections + doctor checks).
@@ -16,8 +16,23 @@ declare class ProviderRegistry {
16
16
  private readonly hostServices?;
17
17
  constructor(hostServices?: HostServices | undefined);
18
18
  getServiceRegistry(): ServiceRegistry | undefined;
19
+ /**
20
+ * Register a provider implementation (session / tunnel / ai) on the
21
+ * agent's per-type provider registry. Maps onto the agent's
22
+ * `registerProvider(type, provider, pluginName)` shape.
23
+ */
19
24
  registerProvider<T>(type: string, name: string, provider: T): void;
20
- getProvider<T>(type: string, name: string): T | undefined;
25
+ /**
26
+ * Resolve a provider for a given type. With one argument, returns the
27
+ * default-resolved provider (matching the agent's
28
+ * `serviceRegistry.getProvider<T>(type)` shape). With two arguments,
29
+ * resolves a *specific* provider by name — the agent's registry only
30
+ * exposes a default-resolved getter, so we list per-type entries and
31
+ * verify the name is present. The two-argument form preserves the
32
+ * original SDK signature so consumer plugins (e.g. session-manager)
33
+ * keep compiling.
34
+ */
35
+ getProvider<T>(type: string, name?: string): T | undefined;
21
36
  listProviders(type: string): string[];
22
37
  /**
23
38
  * Register a CLI contribution bundle (status sections + doctor checks).
@@ -7,15 +7,40 @@ var ProviderRegistry = class {
7
7
  getServiceRegistry() {
8
8
  return this.hostServices?.serviceRegistry;
9
9
  }
10
+ /**
11
+ * Register a provider implementation (session / tunnel / ai) on the
12
+ * agent's per-type provider registry. Maps onto the agent's
13
+ * `registerProvider(type, provider, pluginName)` shape.
14
+ */
10
15
  registerProvider(type, name, provider) {
11
- this.hostServices?.serviceRegistry?.registerService(type, name, provider);
16
+ this.hostServices?.serviceRegistry?.registerProvider?.(type, provider, name);
12
17
  }
18
+ /**
19
+ * Resolve a provider for a given type. With one argument, returns the
20
+ * default-resolved provider (matching the agent's
21
+ * `serviceRegistry.getProvider<T>(type)` shape). With two arguments,
22
+ * resolves a *specific* provider by name — the agent's registry only
23
+ * exposes a default-resolved getter, so we list per-type entries and
24
+ * verify the name is present. The two-argument form preserves the
25
+ * original SDK signature so consumer plugins (e.g. session-manager)
26
+ * keep compiling.
27
+ */
13
28
  getProvider(type, name) {
14
- return this.hostServices?.serviceRegistry?.getService(type, name);
29
+ const reg = this.hostServices?.serviceRegistry;
30
+ if (!reg) return void 0;
31
+ if (name === void 0) return reg.getProvider?.(type);
32
+ if (!reg.listProvidersForType) return void 0;
33
+ const entries = reg.listProvidersForType(type) ?? [];
34
+ const present = entries.some(
35
+ (entry) => typeof entry === "string" ? entry === name : entry.pluginName === name
36
+ );
37
+ if (!present) return void 0;
38
+ return reg.getProvider?.(type);
15
39
  }
16
40
  listProviders(type) {
17
41
  const reg = this.hostServices?.serviceRegistry;
18
- return reg?.listProvidersForType?.(type) ?? [];
42
+ const entries = reg?.listProvidersForType?.(type) ?? [];
43
+ return entries.map((entry) => typeof entry === "string" ? entry : entry.pluginName);
19
44
  }
20
45
  /**
21
46
  * Register a CLI contribution bundle (status sections + doctor checks).
@@ -9,6 +9,8 @@ function createMockHostServices(overrides = {}) {
9
9
  list: mock(async () => [])
10
10
  };
11
11
  const serviceRegistry = {
12
+ registerProvider: mock(() => void 0),
13
+ getProvider: mock(() => void 0),
12
14
  registerService: mock(() => void 0),
13
15
  getService: mock(() => void 0),
14
16
  listProvidersForType: mock(() => [])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecontrols/plugin-sdk",
3
- "version": "2026.509.1",
3
+ "version": "2026.509.2",
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": {