@vibecontrols/plugin-sdk 2026.522.1 → 2026.528.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.
@@ -1,4 +1,6 @@
1
1
  import { HostServices } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * @vibecontrols/plugin-sdk/audit
@@ -1,4 +1,6 @@
1
1
  import { HostServices } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * @vibecontrols/plugin-sdk/broadcast
@@ -1,4 +1,6 @@
1
1
  import { HostServices, SdkLogger } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * @vibecontrols/plugin-sdk/config
@@ -1,4 +1,6 @@
1
1
  import { HostServices } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * @vibecontrols/plugin-sdk/context
@@ -8,11 +10,11 @@ import { HostServices } from '../contract/index.js';
8
10
  * in parallel, applies a per-provider timeout, and serves the merged result
9
11
  * over `/api/profiles/:profile/context*`.
10
12
  *
11
- * Registration is held in a module-scoped map so multiple plugins can register
12
- * distinct providers (the host's `ServiceRegistry.getProvider(type)` returns
13
- * only the default-resolved provider per type, so we can't use it for a
14
- * name-keyed lookup). All providers are still mirrored into the host registry
15
- * for discoverability via `listProvidersForType("context")`.
13
+ * Registration is held in a process-wide registry anchored on `globalThis`
14
+ * (see `getRegistry` below) so providers register once and stay visible to the
15
+ * agent's aggregator regardless of how many times the SDK is bundled. They are
16
+ * also mirrored into the host `ServiceRegistry` for discoverability via
17
+ * `listProvidersForType("context")`.
16
18
  *
17
19
  * Contract:
18
20
  * - One provider per `name`; re-registering replaces.
@@ -1,6 +1,14 @@
1
1
  // src/context/index.ts
2
2
  var CONTEXT_PROVIDER_TYPE = "context";
3
- var contextProviders = /* @__PURE__ */ new Map();
3
+ var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("@vibecontrols/plugin-sdk:contextProviders@1");
4
+ 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;
11
+ }
4
12
  function registerContextProvider(provider, hostServices) {
5
13
  if (!provider || typeof provider.name !== "string" || provider.name.length === 0) {
6
14
  throw new Error("ContextProvider.name is required");
@@ -8,17 +16,17 @@ function registerContextProvider(provider, hostServices) {
8
16
  if (typeof provider.getContext !== "function") {
9
17
  throw new Error("ContextProvider.getContext must be a function");
10
18
  }
11
- contextProviders.set(provider.name, provider);
19
+ getRegistry().set(provider.name, provider);
12
20
  hostServices?.serviceRegistry?.registerProvider?.(CONTEXT_PROVIDER_TYPE, provider, provider.name);
13
21
  }
14
22
  function listContextProviders() {
15
- return Array.from(contextProviders.values());
23
+ return Array.from(getRegistry().values());
16
24
  }
17
25
  function getContextProvider(name) {
18
- return contextProviders.get(name);
26
+ return getRegistry().get(name);
19
27
  }
20
28
  function __resetContextProvidersForTests() {
21
- contextProviders.clear();
29
+ getRegistry().clear();
22
30
  }
23
31
 
24
32
  export { CONTEXT_PROVIDER_TYPE, __resetContextProvidersForTests, getContextProvider, listContextProviders, registerContextProvider };
@@ -1,3 +1,6 @@
1
+ import { OsAdapter } from '../host/os.js';
2
+ import { PathHelpers } from '../host/paths.js';
3
+
1
4
  /**
2
5
  * @vibecontrols/plugin-sdk/contract
3
6
  *
@@ -11,6 +14,7 @@
11
14
  * vibecontrols-agent/src/core/profile-context.ts:62-151,
12
15
  * vibecontrols-agent/src/core/plugin-capabilities.ts.
13
16
  */
17
+
14
18
  interface PluginCapabilities {
15
19
  storage?: "none" | "read" | "rw";
16
20
  secrets?: "none" | "read" | "rw";
@@ -58,6 +62,17 @@ interface StorageProvider {
58
62
  interface ServiceRegistry {
59
63
  registerProvider?(type: string, provider: unknown, pluginName: string): void;
60
64
  getProvider?<T>(type: string): T | undefined;
65
+ /**
66
+ * Resolve a *specific* provider by `(type, pluginName)`. Mirrors the
67
+ * agent's `serviceRegistry.getProviderByName<T>(type, pluginName)`
68
+ * (`vibecontrols-agent/src/core/service-registry.ts:168`). Lets
69
+ * `ProviderRegistry.getProvider(type, name)` actually return the
70
+ * named provider instead of silently falling back to the type's
71
+ * default — without this the session-manager's `/providers` route
72
+ * returns the same default-provider object for every plugin name it
73
+ * looks up. [BOFF-2620]
74
+ */
75
+ getProviderByName?<T>(type: string, pluginName: string): T | undefined;
61
76
  registerService?(pluginName: string, serviceName: string, service: unknown): void;
62
77
  getService?<T>(pluginName: string, serviceName: string): T | undefined;
63
78
  listProvidersForType?(type: string): string[] | Array<{
@@ -108,7 +123,19 @@ interface HostServices {
108
123
  telemetry?: {
109
124
  emit(event: string, payload?: Record<string, unknown>): void;
110
125
  };
111
- os?: unknown;
126
+ /**
127
+ * OS adapter — the agent injects an instance of its own OsAdapter at
128
+ * boot (see vibecontrols-agent/src/core/os-adapter.ts). Plugins should
129
+ * import the `OsAdapter` type from `@vibecontrols/plugin-sdk/host/os`
130
+ * for type-only references and treat every field as optional.
131
+ */
132
+ os?: OsAdapter;
133
+ /**
134
+ * Cross-platform path helpers. Defaults to the pure-functions impl
135
+ * exported from `@vibecontrols/plugin-sdk/host/paths` (`paths`); the
136
+ * agent overrides only if it needs to override scope behaviour.
137
+ */
138
+ paths?: PathHelpers;
112
139
  }
113
140
  interface ProfileContext {
114
141
  name: string;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @vibecontrols/plugin-sdk/host/os
3
+ *
4
+ * OS adapter contract — the minimum surface a plugin can rely on for
5
+ * platform-specific operations. The agent supplies a richer implementation
6
+ * (vibecontrols-agent/src/core/os-adapter.ts); this SDK type is intentionally
7
+ * narrow so plugins type-check against the publicly committed contract and
8
+ * the agent stays free to add private members.
9
+ *
10
+ * Every method is optional so plugins must defensively use optional chaining
11
+ * or check presence before invoking — same defensive pattern the rest of
12
+ * HostServices follows.
13
+ */
14
+ type SupportedPlatform = "linux" | "darwin" | "win32";
15
+ interface OsAdapter {
16
+ readonly platform?: SupportedPlatform;
17
+ readonly isWSL?: boolean;
18
+ readonly homeDir?: string;
19
+ readonly tmpDir?: string;
20
+ readonly pathSep?: string;
21
+ readonly eol?: string;
22
+ /** Executable suffix ("" on POSIX, ".exe" on Windows). */
23
+ readonly executableSuffix?: string;
24
+ /** Returns the absolute path to a command on PATH, or null when missing. */
25
+ which?(cmd: string): string | null;
26
+ isProcessAlive?(pid: number): boolean;
27
+ killProcessTree?(pid: number, signal: NodeJS.Signals): boolean;
28
+ listChildPids?(parentPid: number): number[];
29
+ npmGlobalBin?(): string | null;
30
+ bunGlobalBin?(): string | null;
31
+ /** Quote a string for inclusion in a shell command on this OS. */
32
+ shellQuote?(value: string): string;
33
+ shellInvocation?(): {
34
+ cmd: string;
35
+ flag: string;
36
+ };
37
+ /** Build a Bun.spawn argv that runs a shell pipeline through the native shell. */
38
+ shellArgv?(script: string): string[];
39
+ processGroupSpawnOpts?(): Record<string, unknown>;
40
+ }
41
+
42
+ export type { OsAdapter, SupportedPlatform };
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=os.js.map
3
+ //# sourceMappingURL=os.js.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @vibecontrols/plugin-sdk/host/paths
3
+ *
4
+ * Cross-platform path helpers. Plugins that need an XDG-style directory or
5
+ * a platform-correct executable name should import from here rather than
6
+ * hand-rolling `process.platform === "win32" ? "...exe" : "..."` ternaries
7
+ * or `process.env.HOME ?? "."` fallbacks (the latter is broken on Windows,
8
+ * where USERPROFILE is the canonical variable).
9
+ *
10
+ * The exports are pure functions backed by `node:os` + `node:path`, so they
11
+ * work without any host wiring. The agent supplies HostServices.paths as a
12
+ * field for forward-compat, but plugins can also import the default `paths`
13
+ * const directly when the host hasn't injected one.
14
+ */
15
+ interface PathHelpers {
16
+ /** OS-correct user home (`HOME` on POSIX, `USERPROFILE` on Windows). */
17
+ homeDir(): string;
18
+ /**
19
+ * OS-correct per-app config directory:
20
+ * linux: `$XDG_CONFIG_HOME/<scope>` or `~/.config/<scope>`
21
+ * darwin: `~/Library/Application Support/<scope>`
22
+ * win32: `%APPDATA%\<scope>`
23
+ */
24
+ configDir(scope: string): string;
25
+ /** Same shape as configDir but for cache (`~/.cache`, `~/Library/Caches`, `%LOCALAPPDATA%\<scope>\Cache`). */
26
+ cacheDir(scope: string): string;
27
+ /** Same shape as configDir but for state/data (`~/.local/share`, `~/Library/Application Support`, `%LOCALAPPDATA%\<scope>`). */
28
+ dataDir(scope: string): string;
29
+ /** OS-correct temp dir (`/tmp`, `%TEMP%` on Windows). */
30
+ tmpDir(): string;
31
+ /** Returns the executable name with `.exe` appended on Windows, unchanged elsewhere. */
32
+ exeName(base: string): string;
33
+ }
34
+ declare const paths: PathHelpers;
35
+
36
+ export { type PathHelpers, paths };
@@ -0,0 +1,48 @@
1
+ import { homedir, platform, tmpdir } from 'os';
2
+ import { join } from 'path';
3
+
4
+ // src/host/paths.ts
5
+ var HOME = () => homedir();
6
+ var paths = {
7
+ homeDir: HOME,
8
+ configDir(scope) {
9
+ const p = platform();
10
+ if (p === "win32") {
11
+ return join(process.env.APPDATA ?? join(HOME(), "AppData", "Roaming"), scope);
12
+ }
13
+ if (p === "darwin") {
14
+ return join(HOME(), "Library", "Application Support", scope);
15
+ }
16
+ return join(process.env.XDG_CONFIG_HOME ?? join(HOME(), ".config"), scope);
17
+ },
18
+ cacheDir(scope) {
19
+ const p = platform();
20
+ if (p === "win32") {
21
+ return join(process.env.LOCALAPPDATA ?? join(HOME(), "AppData", "Local"), scope, "Cache");
22
+ }
23
+ if (p === "darwin") {
24
+ return join(HOME(), "Library", "Caches", scope);
25
+ }
26
+ return join(process.env.XDG_CACHE_HOME ?? join(HOME(), ".cache"), scope);
27
+ },
28
+ dataDir(scope) {
29
+ const p = platform();
30
+ if (p === "win32") {
31
+ return join(process.env.LOCALAPPDATA ?? join(HOME(), "AppData", "Local"), scope);
32
+ }
33
+ if (p === "darwin") {
34
+ return join(HOME(), "Library", "Application Support", scope);
35
+ }
36
+ return join(process.env.XDG_DATA_HOME ?? join(HOME(), ".local", "share"), scope);
37
+ },
38
+ tmpDir() {
39
+ return tmpdir();
40
+ },
41
+ exeName(base) {
42
+ return platform() === "win32" ? `${base}.exe` : base;
43
+ }
44
+ };
45
+
46
+ export { paths };
47
+ //# sourceMappingURL=paths.js.map
48
+ //# sourceMappingURL=paths.js.map
package/dist/index.d.ts CHANGED
@@ -12,5 +12,7 @@ export { CliContribution, ProviderRegistry } from './providers/index.js';
12
12
  export { CONTEXT_PROVIDER_TYPE, ContextContribution, ContextProvider, ContextRequest, getContextProvider, listContextProviders, registerContextProvider } from './context/index.js';
13
13
  export { AuditLogger } from './audit/index.js';
14
14
  export { BroadcastEmitter } from './broadcast/index.js';
15
+ export { OsAdapter, SupportedPlatform } from './host/os.js';
16
+ export { PathHelpers, paths } from './host/paths.js';
15
17
  import 'commander';
16
18
  import 'elysia';
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import { createServer } from 'net';
3
+ import { homedir, platform, tmpdir } from 'os';
4
+ import { join } from 'path';
3
5
 
4
6
  // src/contract/index.ts
5
7
  var FULL_TRUST_CAPS = {
@@ -530,7 +532,15 @@ var HttpClient = class {
530
532
 
531
533
  // src/context/index.ts
532
534
  var CONTEXT_PROVIDER_TYPE = "context";
533
- var contextProviders = /* @__PURE__ */ new Map();
535
+ var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("@vibecontrols/plugin-sdk:contextProviders@1");
536
+ function getRegistry() {
537
+ const slots = globalThis;
538
+ const existing = slots[REGISTRY_KEY];
539
+ if (existing) return existing;
540
+ const created = /* @__PURE__ */ new Map();
541
+ slots[REGISTRY_KEY] = created;
542
+ return created;
543
+ }
534
544
  function registerContextProvider(provider, hostServices) {
535
545
  if (!provider || typeof provider.name !== "string" || provider.name.length === 0) {
536
546
  throw new Error("ContextProvider.name is required");
@@ -538,14 +548,14 @@ function registerContextProvider(provider, hostServices) {
538
548
  if (typeof provider.getContext !== "function") {
539
549
  throw new Error("ContextProvider.getContext must be a function");
540
550
  }
541
- contextProviders.set(provider.name, provider);
551
+ getRegistry().set(provider.name, provider);
542
552
  hostServices?.serviceRegistry?.registerProvider?.(CONTEXT_PROVIDER_TYPE, provider, provider.name);
543
553
  }
544
554
  function listContextProviders() {
545
- return Array.from(contextProviders.values());
555
+ return Array.from(getRegistry().values());
546
556
  }
547
557
  function getContextProvider(name) {
548
- return contextProviders.get(name);
558
+ return getRegistry().get(name);
549
559
  }
550
560
 
551
561
  // src/providers/index.ts
@@ -584,16 +594,23 @@ var ProviderRegistry = class {
584
594
  * Resolve a provider for a given type. With one argument, returns the
585
595
  * default-resolved provider (matching the agent's
586
596
  * `serviceRegistry.getProvider<T>(type)` shape). With two arguments,
587
- * resolves a *specific* provider by name — the agent's registry only
588
- * exposes a default-resolved getter, so we list per-type entries and
589
- * verify the name is present. The two-argument form preserves the
590
- * original SDK signature so consumer plugins (e.g. session-manager)
591
- * keep compiling.
597
+ * resolves a *specific* provider by `(type, name)` via the agent's
598
+ * `getProviderByName` — which is what consumers like session-manager
599
+ * actually want when iterating registered providers.
600
+ *
601
+ * Previously the two-argument form bug-existed (BOFF-2620): it
602
+ * verified the name was present in `listProvidersForType` but then
603
+ * returned the type's *default* provider regardless, so every
604
+ * per-name lookup yielded the same object. We now call
605
+ * `getProviderByName` when the host exposes it, and only fall back
606
+ * to the default-resolved getter for hosts that pre-date that
607
+ * method.
592
608
  */
593
609
  getProvider(type, name) {
594
610
  const reg = this.hostServices?.serviceRegistry;
595
611
  if (!reg) return void 0;
596
612
  if (name === void 0) return reg.getProvider?.(type);
613
+ if (reg.getProviderByName) return reg.getProviderByName(type, name);
597
614
  if (!reg.listProvidersForType) return void 0;
598
615
  const entries = reg.listProvidersForType(type) ?? [];
599
616
  const present = entries.some(
@@ -649,7 +666,47 @@ var BroadcastEmitter = class {
649
666
  this.hostServices?.broadcast?.(type, payload);
650
667
  }
651
668
  };
669
+ var HOME = () => homedir();
670
+ var paths = {
671
+ homeDir: HOME,
672
+ configDir(scope) {
673
+ const p = platform();
674
+ if (p === "win32") {
675
+ return join(process.env.APPDATA ?? join(HOME(), "AppData", "Roaming"), scope);
676
+ }
677
+ if (p === "darwin") {
678
+ return join(HOME(), "Library", "Application Support", scope);
679
+ }
680
+ return join(process.env.XDG_CONFIG_HOME ?? join(HOME(), ".config"), scope);
681
+ },
682
+ cacheDir(scope) {
683
+ const p = platform();
684
+ if (p === "win32") {
685
+ return join(process.env.LOCALAPPDATA ?? join(HOME(), "AppData", "Local"), scope, "Cache");
686
+ }
687
+ if (p === "darwin") {
688
+ return join(HOME(), "Library", "Caches", scope);
689
+ }
690
+ return join(process.env.XDG_CACHE_HOME ?? join(HOME(), ".cache"), scope);
691
+ },
692
+ dataDir(scope) {
693
+ const p = platform();
694
+ if (p === "win32") {
695
+ return join(process.env.LOCALAPPDATA ?? join(HOME(), "AppData", "Local"), scope);
696
+ }
697
+ if (p === "darwin") {
698
+ return join(HOME(), "Library", "Application Support", scope);
699
+ }
700
+ return join(process.env.XDG_DATA_HOME ?? join(HOME(), ".local", "share"), scope);
701
+ },
702
+ tmpDir() {
703
+ return tmpdir();
704
+ },
705
+ exeName(base) {
706
+ return platform() === "win32" ? `${base}.exe` : base;
707
+ }
708
+ };
652
709
 
653
- export { AuditLogger, BoundLogger, BroadcastEmitter, CONTEXT_PROVIDER_TYPE, CliCommandBuilder, ConfigManager, FULL_TRUST_CAPS, HttpClient, NamespaceStore, ProviderRegistry, RoutesBuilder, TelemetryEmitter, TypedStore, createLifecycleHooks, findAvailablePort, getContextProvider, gracefulKill, isProcessAlive, listContextProviders, maybePrintJson, pickOutputMode, redact, registerContextProvider, runMultimode, sleep };
710
+ export { AuditLogger, BoundLogger, BroadcastEmitter, CONTEXT_PROVIDER_TYPE, CliCommandBuilder, ConfigManager, FULL_TRUST_CAPS, HttpClient, NamespaceStore, ProviderRegistry, RoutesBuilder, TelemetryEmitter, TypedStore, createLifecycleHooks, findAvailablePort, getContextProvider, gracefulKill, isProcessAlive, listContextProviders, maybePrintJson, paths, pickOutputMode, redact, registerContextProvider, runMultimode, sleep };
654
711
  //# sourceMappingURL=index.js.map
655
712
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,6 @@
1
1
  import { HostServices } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * @vibecontrols/plugin-sdk/lifecycle
@@ -1,4 +1,6 @@
1
1
  import { SdkLogger } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * @vibecontrols/plugin-sdk/log
@@ -1,5 +1,7 @@
1
1
  import { HostServices, ServiceRegistry } from '../contract/index.js';
2
2
  import { ContextProvider } from '../context/index.js';
3
+ import '../host/os.js';
4
+ import '../host/paths.js';
3
5
 
4
6
  /**
5
7
  * @vibecontrols/plugin-sdk/providers
@@ -36,11 +38,17 @@ declare class ProviderRegistry {
36
38
  * Resolve a provider for a given type. With one argument, returns the
37
39
  * default-resolved provider (matching the agent's
38
40
  * `serviceRegistry.getProvider<T>(type)` shape). With two arguments,
39
- * resolves a *specific* provider by name — the agent's registry only
40
- * exposes a default-resolved getter, so we list per-type entries and
41
- * verify the name is present. The two-argument form preserves the
42
- * original SDK signature so consumer plugins (e.g. session-manager)
43
- * keep compiling.
41
+ * resolves a *specific* provider by `(type, name)` via the agent's
42
+ * `getProviderByName` — which is what consumers like session-manager
43
+ * actually want when iterating registered providers.
44
+ *
45
+ * Previously the two-argument form bug-existed (BOFF-2620): it
46
+ * verified the name was present in `listProvidersForType` but then
47
+ * returned the type's *default* provider regardless, so every
48
+ * per-name lookup yielded the same object. We now call
49
+ * `getProviderByName` when the host exposes it, and only fall back
50
+ * to the default-resolved getter for hosts that pre-date that
51
+ * method.
44
52
  */
45
53
  getProvider<T>(type: string, name?: string): T | undefined;
46
54
  listProviders(type: string): string[];
@@ -1,6 +1,14 @@
1
1
  // src/context/index.ts
2
2
  var CONTEXT_PROVIDER_TYPE = "context";
3
- var contextProviders = /* @__PURE__ */ new Map();
3
+ var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("@vibecontrols/plugin-sdk:contextProviders@1");
4
+ 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;
11
+ }
4
12
  function registerContextProvider(provider, hostServices) {
5
13
  if (!provider || typeof provider.name !== "string" || provider.name.length === 0) {
6
14
  throw new Error("ContextProvider.name is required");
@@ -8,14 +16,14 @@ function registerContextProvider(provider, hostServices) {
8
16
  if (typeof provider.getContext !== "function") {
9
17
  throw new Error("ContextProvider.getContext must be a function");
10
18
  }
11
- contextProviders.set(provider.name, provider);
19
+ getRegistry().set(provider.name, provider);
12
20
  hostServices?.serviceRegistry?.registerProvider?.(CONTEXT_PROVIDER_TYPE, provider, provider.name);
13
21
  }
14
22
  function listContextProviders() {
15
- return Array.from(contextProviders.values());
23
+ return Array.from(getRegistry().values());
16
24
  }
17
25
  function getContextProvider(name) {
18
- return contextProviders.get(name);
26
+ return getRegistry().get(name);
19
27
  }
20
28
 
21
29
  // src/providers/index.ts
@@ -54,16 +62,23 @@ var ProviderRegistry = class {
54
62
  * Resolve a provider for a given type. With one argument, returns the
55
63
  * default-resolved provider (matching the agent's
56
64
  * `serviceRegistry.getProvider<T>(type)` shape). With two arguments,
57
- * resolves a *specific* provider by name — the agent's registry only
58
- * exposes a default-resolved getter, so we list per-type entries and
59
- * verify the name is present. The two-argument form preserves the
60
- * original SDK signature so consumer plugins (e.g. session-manager)
61
- * keep compiling.
65
+ * resolves a *specific* provider by `(type, name)` via the agent's
66
+ * `getProviderByName` — which is what consumers like session-manager
67
+ * actually want when iterating registered providers.
68
+ *
69
+ * Previously the two-argument form bug-existed (BOFF-2620): it
70
+ * verified the name was present in `listProvidersForType` but then
71
+ * returned the type's *default* provider regardless, so every
72
+ * per-name lookup yielded the same object. We now call
73
+ * `getProviderByName` when the host exposes it, and only fall back
74
+ * to the default-resolved getter for hosts that pre-date that
75
+ * method.
62
76
  */
63
77
  getProvider(type, name) {
64
78
  const reg = this.hostServices?.serviceRegistry;
65
79
  if (!reg) return void 0;
66
80
  if (name === void 0) return reg.getProvider?.(type);
81
+ if (reg.getProviderByName) return reg.getProviderByName(type, name);
67
82
  if (!reg.listProvidersForType) return void 0;
68
83
  const entries = reg.listProvidersForType(type) ?? [];
69
84
  const present = entries.some(
@@ -1,5 +1,7 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import { HostServices } from '../contract/index.js';
3
+ import '../host/os.js';
4
+ import '../host/paths.js';
3
5
 
4
6
  /**
5
7
  * @vibecontrols/plugin-sdk/routes
@@ -1,4 +1,6 @@
1
1
  import { StorageProvider, SdkLogger } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * Typed wrappers over a `StorageProvider`.
@@ -1,4 +1,6 @@
1
1
  import { SdkLogger } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * @vibecontrols/plugin-sdk/subprocess
@@ -1,4 +1,6 @@
1
1
  import { HostServices } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * @vibecontrols/plugin-sdk/telemetry
@@ -1,4 +1,6 @@
1
1
  import { HostServices, ProfileContext, VibePluginFactory } from '../contract/index.js';
2
+ import '../host/os.js';
3
+ import '../host/paths.js';
2
4
 
3
5
  /**
4
6
  * Mock factories for unit-testing plugins built on the SDK.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecontrols/plugin-sdk",
3
- "version": "2026.522.1",
3
+ "version": "2026.528.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": {
@@ -76,6 +76,14 @@
76
76
  "./testing": {
77
77
  "import": "./dist/testing/index.js",
78
78
  "types": "./dist/testing/index.d.ts"
79
+ },
80
+ "./host/os": {
81
+ "import": "./dist/host/os.js",
82
+ "types": "./dist/host/os.d.ts"
83
+ },
84
+ "./host/paths": {
85
+ "import": "./dist/host/paths.js",
86
+ "types": "./dist/host/paths.d.ts"
79
87
  }
80
88
  },
81
89
  "scripts": {