@vibecontrols/plugin-sdk 2026.509.2 → 2026.522.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/boilerplate/bunfig.toml +2 -2
- package/dist/context/index.d.ts +63 -0
- package/dist/context/index.js +26 -0
- package/dist/contract/index.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +36 -1
- package/dist/providers/index.d.ts +10 -0
- package/dist/providers/index.js +35 -0
- package/package.json +6 -2
package/boilerplate/bunfig.toml
CHANGED
|
@@ -9,5 +9,5 @@ exact = true
|
|
|
9
9
|
shell = "bun"
|
|
10
10
|
|
|
11
11
|
[install.scopes]
|
|
12
|
-
burdenoff = {
|
|
13
|
-
vibecontrols = {
|
|
12
|
+
burdenoff = { token = "$NPM_TOKEN", url = "https://registry.npmjs.org/" }
|
|
13
|
+
vibecontrols = { token = "$NPM_TOKEN", url = "https://registry.npmjs.org/" }
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { HostServices } from '../contract/index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @vibecontrols/plugin-sdk/context
|
|
5
|
+
*
|
|
6
|
+
* Lets a plugin contribute a structured snapshot of its runtime state to the
|
|
7
|
+
* agent's combined context endpoint. The agent calls every registered provider
|
|
8
|
+
* in parallel, applies a per-provider timeout, and serves the merged result
|
|
9
|
+
* over `/api/profiles/:profile/context*`.
|
|
10
|
+
*
|
|
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")`.
|
|
16
|
+
*
|
|
17
|
+
* Contract:
|
|
18
|
+
* - One provider per `name`; re-registering replaces.
|
|
19
|
+
* - `getContext` must be safe to call concurrently and idempotent. It should
|
|
20
|
+
* respond within `timeoutMs` (defaults to 2000ms in the agent's aggregator).
|
|
21
|
+
* - The returned `data` is opaque to the agent — plugins decide shape.
|
|
22
|
+
* - Consumer plugins MUST redact credentials before returning. The aggregator
|
|
23
|
+
* does not sanitise contributions.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** Single context contribution returned by a plugin. */
|
|
27
|
+
interface ContextContribution {
|
|
28
|
+
/** Stable identifier of the contributing plugin. */
|
|
29
|
+
pluginName: string;
|
|
30
|
+
/** Free-form description so LLMs / humans understand the section. */
|
|
31
|
+
description?: string;
|
|
32
|
+
/** Optional ISO-8601 timestamp. Agent fills `generatedAt` if absent. */
|
|
33
|
+
generatedAt?: string;
|
|
34
|
+
/** Structured payload. Shape is plugin-defined. */
|
|
35
|
+
data: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/** Optional args passed by the agent to scope a contribution. */
|
|
38
|
+
interface ContextRequest {
|
|
39
|
+
/** Profile name the agent is serving. */
|
|
40
|
+
profile: string;
|
|
41
|
+
/** Vibe id, if the caller scoped the request. */
|
|
42
|
+
vibeId?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Provider plugins register one of these per provider name. */
|
|
45
|
+
interface ContextProvider {
|
|
46
|
+
/** Stable identifier — must be unique across the agent process. */
|
|
47
|
+
name: string;
|
|
48
|
+
/** Max time the aggregator waits before recording a timeout. Defaults to 2000ms in the agent. */
|
|
49
|
+
timeoutMs?: number;
|
|
50
|
+
getContext(req: ContextRequest): Promise<ContextContribution>;
|
|
51
|
+
}
|
|
52
|
+
/** Provider-type tag used in the shared host service registry. */
|
|
53
|
+
declare const CONTEXT_PROVIDER_TYPE = "context";
|
|
54
|
+
/** Register a context provider. Re-registering with the same name replaces. */
|
|
55
|
+
declare function registerContextProvider(provider: ContextProvider, hostServices?: HostServices): void;
|
|
56
|
+
/** Returns every registered context provider, in insertion order. */
|
|
57
|
+
declare function listContextProviders(): ContextProvider[];
|
|
58
|
+
/** Resolve a context provider by name, or `undefined` if not registered. */
|
|
59
|
+
declare function getContextProvider(name: string): ContextProvider | undefined;
|
|
60
|
+
/** Test helper — wipe the registry. Not exported from the SDK barrel. */
|
|
61
|
+
declare function __resetContextProvidersForTests(): void;
|
|
62
|
+
|
|
63
|
+
export { CONTEXT_PROVIDER_TYPE, type ContextContribution, type ContextProvider, type ContextRequest, __resetContextProvidersForTests, getContextProvider, listContextProviders, registerContextProvider };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/context/index.ts
|
|
2
|
+
var CONTEXT_PROVIDER_TYPE = "context";
|
|
3
|
+
var contextProviders = /* @__PURE__ */ new Map();
|
|
4
|
+
function registerContextProvider(provider, hostServices) {
|
|
5
|
+
if (!provider || typeof provider.name !== "string" || provider.name.length === 0) {
|
|
6
|
+
throw new Error("ContextProvider.name is required");
|
|
7
|
+
}
|
|
8
|
+
if (typeof provider.getContext !== "function") {
|
|
9
|
+
throw new Error("ContextProvider.getContext must be a function");
|
|
10
|
+
}
|
|
11
|
+
contextProviders.set(provider.name, provider);
|
|
12
|
+
hostServices?.serviceRegistry?.registerProvider?.(CONTEXT_PROVIDER_TYPE, provider, provider.name);
|
|
13
|
+
}
|
|
14
|
+
function listContextProviders() {
|
|
15
|
+
return Array.from(contextProviders.values());
|
|
16
|
+
}
|
|
17
|
+
function getContextProvider(name) {
|
|
18
|
+
return contextProviders.get(name);
|
|
19
|
+
}
|
|
20
|
+
function __resetContextProvidersForTests() {
|
|
21
|
+
contextProviders.clear();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { CONTEXT_PROVIDER_TYPE, __resetContextProvidersForTests, getContextProvider, listContextProviders, registerContextProvider };
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -132,6 +132,12 @@ interface VibePlugin {
|
|
|
132
132
|
apiPrefix?: string;
|
|
133
133
|
createRoutes?: () => unknown;
|
|
134
134
|
onServerStart?: (app: unknown, hostServices: HostServices) => void | Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Optional post-start hook — agent fires this AFTER `onServerStart` and
|
|
137
|
+
* after the Elysia app is listening, so plugins can schedule background
|
|
138
|
+
* work (queue processors, watchers) or register context providers.
|
|
139
|
+
*/
|
|
140
|
+
onServerReady?: (app: unknown, hostServices: HostServices) => void | Promise<void>;
|
|
135
141
|
onServerStop?: (hostServices: HostServices) => void | Promise<void>;
|
|
136
142
|
onCliSetup?: (program: unknown, hostServices: HostServices) => void;
|
|
137
143
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { ConfigManager } from './config/index.js';
|
|
|
9
9
|
export { findAvailablePort, gracefulKill, isProcessAlive, sleep } from './subprocess/index.js';
|
|
10
10
|
export { HttpClient, HttpClientOptions, RequestOptions } from './http/index.js';
|
|
11
11
|
export { CliContribution, ProviderRegistry } from './providers/index.js';
|
|
12
|
+
export { CONTEXT_PROVIDER_TYPE, ContextContribution, ContextProvider, ContextRequest, getContextProvider, listContextProviders, registerContextProvider } from './context/index.js';
|
|
12
13
|
export { AuditLogger } from './audit/index.js';
|
|
13
14
|
export { BroadcastEmitter } from './broadcast/index.js';
|
|
14
15
|
import 'commander';
|
package/dist/index.js
CHANGED
|
@@ -528,12 +528,47 @@ var HttpClient = class {
|
|
|
528
528
|
}
|
|
529
529
|
};
|
|
530
530
|
|
|
531
|
+
// src/context/index.ts
|
|
532
|
+
var CONTEXT_PROVIDER_TYPE = "context";
|
|
533
|
+
var contextProviders = /* @__PURE__ */ new Map();
|
|
534
|
+
function registerContextProvider(provider, hostServices) {
|
|
535
|
+
if (!provider || typeof provider.name !== "string" || provider.name.length === 0) {
|
|
536
|
+
throw new Error("ContextProvider.name is required");
|
|
537
|
+
}
|
|
538
|
+
if (typeof provider.getContext !== "function") {
|
|
539
|
+
throw new Error("ContextProvider.getContext must be a function");
|
|
540
|
+
}
|
|
541
|
+
contextProviders.set(provider.name, provider);
|
|
542
|
+
hostServices?.serviceRegistry?.registerProvider?.(CONTEXT_PROVIDER_TYPE, provider, provider.name);
|
|
543
|
+
}
|
|
544
|
+
function listContextProviders() {
|
|
545
|
+
return Array.from(contextProviders.values());
|
|
546
|
+
}
|
|
547
|
+
function getContextProvider(name) {
|
|
548
|
+
return contextProviders.get(name);
|
|
549
|
+
}
|
|
550
|
+
|
|
531
551
|
// src/providers/index.ts
|
|
532
552
|
var ProviderRegistry = class {
|
|
533
553
|
constructor(hostServices) {
|
|
534
554
|
this.hostServices = hostServices;
|
|
535
555
|
}
|
|
536
556
|
hostServices;
|
|
557
|
+
/**
|
|
558
|
+
* Register a context provider. Convenience wrapper for the standalone
|
|
559
|
+
* `registerContextProvider` helper exported from `@vibecontrols/plugin-sdk/context`.
|
|
560
|
+
*/
|
|
561
|
+
registerContextProvider(provider) {
|
|
562
|
+
registerContextProvider(provider, this.hostServices);
|
|
563
|
+
}
|
|
564
|
+
/** List every registered context provider. */
|
|
565
|
+
listContextProviders() {
|
|
566
|
+
return listContextProviders();
|
|
567
|
+
}
|
|
568
|
+
/** Resolve a context provider by name. */
|
|
569
|
+
getContextProvider(name) {
|
|
570
|
+
return getContextProvider(name);
|
|
571
|
+
}
|
|
537
572
|
getServiceRegistry() {
|
|
538
573
|
return this.hostServices?.serviceRegistry;
|
|
539
574
|
}
|
|
@@ -615,6 +650,6 @@ var BroadcastEmitter = class {
|
|
|
615
650
|
}
|
|
616
651
|
};
|
|
617
652
|
|
|
618
|
-
export { AuditLogger, BoundLogger, BroadcastEmitter, CliCommandBuilder, ConfigManager, FULL_TRUST_CAPS, HttpClient, NamespaceStore, ProviderRegistry, RoutesBuilder, TelemetryEmitter, TypedStore, createLifecycleHooks, findAvailablePort, gracefulKill, isProcessAlive, maybePrintJson, pickOutputMode, redact, runMultimode, sleep };
|
|
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 };
|
|
619
654
|
//# sourceMappingURL=index.js.map
|
|
620
655
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HostServices, ServiceRegistry } from '../contract/index.js';
|
|
2
|
+
import { ContextProvider } from '../context/index.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @vibecontrols/plugin-sdk/providers
|
|
@@ -15,6 +16,15 @@ interface CliContribution {
|
|
|
15
16
|
declare class ProviderRegistry {
|
|
16
17
|
private readonly hostServices?;
|
|
17
18
|
constructor(hostServices?: HostServices | undefined);
|
|
19
|
+
/**
|
|
20
|
+
* Register a context provider. Convenience wrapper for the standalone
|
|
21
|
+
* `registerContextProvider` helper exported from `@vibecontrols/plugin-sdk/context`.
|
|
22
|
+
*/
|
|
23
|
+
registerContextProvider(provider: ContextProvider): void;
|
|
24
|
+
/** List every registered context provider. */
|
|
25
|
+
listContextProviders(): ContextProvider[];
|
|
26
|
+
/** Resolve a context provider by name. */
|
|
27
|
+
getContextProvider(name: string): ContextProvider | undefined;
|
|
18
28
|
getServiceRegistry(): ServiceRegistry | undefined;
|
|
19
29
|
/**
|
|
20
30
|
* Register a provider implementation (session / tunnel / ai) on the
|
package/dist/providers/index.js
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
|
+
// src/context/index.ts
|
|
2
|
+
var CONTEXT_PROVIDER_TYPE = "context";
|
|
3
|
+
var contextProviders = /* @__PURE__ */ new Map();
|
|
4
|
+
function registerContextProvider(provider, hostServices) {
|
|
5
|
+
if (!provider || typeof provider.name !== "string" || provider.name.length === 0) {
|
|
6
|
+
throw new Error("ContextProvider.name is required");
|
|
7
|
+
}
|
|
8
|
+
if (typeof provider.getContext !== "function") {
|
|
9
|
+
throw new Error("ContextProvider.getContext must be a function");
|
|
10
|
+
}
|
|
11
|
+
contextProviders.set(provider.name, provider);
|
|
12
|
+
hostServices?.serviceRegistry?.registerProvider?.(CONTEXT_PROVIDER_TYPE, provider, provider.name);
|
|
13
|
+
}
|
|
14
|
+
function listContextProviders() {
|
|
15
|
+
return Array.from(contextProviders.values());
|
|
16
|
+
}
|
|
17
|
+
function getContextProvider(name) {
|
|
18
|
+
return contextProviders.get(name);
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
// src/providers/index.ts
|
|
2
22
|
var ProviderRegistry = class {
|
|
3
23
|
constructor(hostServices) {
|
|
4
24
|
this.hostServices = hostServices;
|
|
5
25
|
}
|
|
6
26
|
hostServices;
|
|
27
|
+
/**
|
|
28
|
+
* Register a context provider. Convenience wrapper for the standalone
|
|
29
|
+
* `registerContextProvider` helper exported from `@vibecontrols/plugin-sdk/context`.
|
|
30
|
+
*/
|
|
31
|
+
registerContextProvider(provider) {
|
|
32
|
+
registerContextProvider(provider, this.hostServices);
|
|
33
|
+
}
|
|
34
|
+
/** List every registered context provider. */
|
|
35
|
+
listContextProviders() {
|
|
36
|
+
return listContextProviders();
|
|
37
|
+
}
|
|
38
|
+
/** Resolve a context provider by name. */
|
|
39
|
+
getContextProvider(name) {
|
|
40
|
+
return getContextProvider(name);
|
|
41
|
+
}
|
|
7
42
|
getServiceRegistry() {
|
|
8
43
|
return this.hostServices?.serviceRegistry;
|
|
9
44
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibecontrols/plugin-sdk",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.522.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": {
|
|
7
|
-
"bun": ">=1.3.
|
|
7
|
+
"bun": ">=1.3.14"
|
|
8
8
|
},
|
|
9
9
|
"author": {
|
|
10
10
|
"name": "Vignesh T.V",
|
|
@@ -61,6 +61,10 @@
|
|
|
61
61
|
"import": "./dist/providers/index.js",
|
|
62
62
|
"types": "./dist/providers/index.d.ts"
|
|
63
63
|
},
|
|
64
|
+
"./context": {
|
|
65
|
+
"import": "./dist/context/index.js",
|
|
66
|
+
"types": "./dist/context/index.d.ts"
|
|
67
|
+
},
|
|
64
68
|
"./audit": {
|
|
65
69
|
"import": "./dist/audit/index.js",
|
|
66
70
|
"types": "./dist/audit/index.d.ts"
|