@vibecontrols/vibe-plugin-session-manager 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.
- package/dist/index.d.ts +6 -88
- package/dist/index.js +2 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,97 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
2
|
+
* @vibecontrols/vibe-plugin-session-manager
|
|
3
3
|
*
|
|
4
4
|
* Unified session manager plugin for VibeControls Agent.
|
|
5
5
|
* Provides capability discovery, feature negotiation, and provider routing
|
|
6
6
|
* across all registered session providers (tmux, wezterm, zellij, etc.).
|
|
7
|
+
*
|
|
8
|
+
* Migrated to consume @vibecontrols/plugin-sdk@2026.509.1 — inline contract
|
|
9
|
+
* stubs replaced with SDK imports; provider registry access goes through
|
|
10
|
+
* the SDK ProviderRegistry façade.
|
|
7
11
|
*/
|
|
8
|
-
|
|
9
|
-
registerService(pluginName: string, serviceName: string, service: unknown): void;
|
|
10
|
-
getProviderByName<T>(type: string, name: string): T | undefined;
|
|
11
|
-
listProvidersForType(type: string): Array<{
|
|
12
|
-
pluginName: string;
|
|
13
|
-
isDefault: boolean;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
16
|
-
interface CliContributorRegistryLike {
|
|
17
|
-
addStatusSection(section: {
|
|
18
|
-
source: string;
|
|
19
|
-
title: string;
|
|
20
|
-
render: (ctx: {
|
|
21
|
-
agentUrl: string;
|
|
22
|
-
}) => Promise<string | null>;
|
|
23
|
-
json?: (ctx: {
|
|
24
|
-
agentUrl: string;
|
|
25
|
-
}) => Promise<unknown>;
|
|
26
|
-
jsonKey?: string;
|
|
27
|
-
}): void;
|
|
28
|
-
addDoctorCheck(check: {
|
|
29
|
-
source: string;
|
|
30
|
-
run: () => Promise<Array<{
|
|
31
|
-
name: string;
|
|
32
|
-
ok: boolean;
|
|
33
|
-
grade?: "warn";
|
|
34
|
-
message: string;
|
|
35
|
-
hint?: string;
|
|
36
|
-
}>>;
|
|
37
|
-
}): void;
|
|
38
|
-
}
|
|
39
|
-
interface HostServices {
|
|
40
|
-
telemetry?: {
|
|
41
|
-
emit: (name: string, payload?: Record<string, unknown>) => void;
|
|
42
|
-
};
|
|
43
|
-
logger?: {
|
|
44
|
-
info(source: string, msg: string): void;
|
|
45
|
-
warn(source: string, msg: string): void;
|
|
46
|
-
error(source: string, msg: string): void;
|
|
47
|
-
debug(source: string, msg: string): void;
|
|
48
|
-
};
|
|
49
|
-
config?: Record<string, unknown>;
|
|
50
|
-
serviceRegistry?: ServiceRegistry;
|
|
51
|
-
cliContributors?: CliContributorRegistryLike;
|
|
52
|
-
}
|
|
53
|
-
interface PluginCapabilities {
|
|
54
|
-
storage?: "none" | "read" | "rw";
|
|
55
|
-
secrets?: "none" | "read" | "rw";
|
|
56
|
-
gateway?: boolean;
|
|
57
|
-
broadcast?: boolean;
|
|
58
|
-
subprocess?: boolean;
|
|
59
|
-
audit?: boolean;
|
|
60
|
-
telemetry?: boolean;
|
|
61
|
-
}
|
|
62
|
-
interface VibePlugin {
|
|
63
|
-
capabilities?: PluginCapabilities;
|
|
64
|
-
name: string;
|
|
65
|
-
version: string;
|
|
66
|
-
description: string;
|
|
67
|
-
tags?: Array<"backend" | "frontend" | "cli" | "provider" | "adapter" | "integration">;
|
|
68
|
-
cliCommand?: string;
|
|
69
|
-
apiPrefix?: string;
|
|
70
|
-
createRoutes?: () => any;
|
|
71
|
-
onCliSetup?: (program: unknown, hostServices?: HostServices) => void;
|
|
72
|
-
onServerStart?: (app: unknown, hostServices?: HostServices) => void;
|
|
73
|
-
onServerReady?: (app: unknown, hostServices?: HostServices) => void;
|
|
74
|
-
onServerStop?: () => void;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Minimal facade of the agent's ProfileContext. The plugin has no hard
|
|
78
|
-
* dependency on the agent package; it accepts whichever shape the agent
|
|
79
|
-
* passes that is structurally compatible with this interface.
|
|
80
|
-
*/
|
|
81
|
-
export interface ProfileContext {
|
|
82
|
-
name: string;
|
|
83
|
-
dataDir: string;
|
|
84
|
-
logger: {
|
|
85
|
-
info: (...args: unknown[]) => void;
|
|
86
|
-
warn: (...args: unknown[]) => void;
|
|
87
|
-
error: (...args: unknown[]) => void;
|
|
88
|
-
debug: (...args: unknown[]) => void;
|
|
89
|
-
};
|
|
90
|
-
audit?: {
|
|
91
|
-
emit: (event: string, payload?: unknown) => void;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
export type VibePluginFactory = (ctx: ProfileContext) => VibePlugin;
|
|
12
|
+
import type { HostServices, VibePlugin, VibePluginFactory } from "@vibecontrols/plugin-sdk/contract";
|
|
95
13
|
/**
|
|
96
14
|
* Plugin Contract v2 factory. Per-profile state (the SessionManager
|
|
97
15
|
* instance) lives in this closure so concurrent profiles cannot share
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Elysia,t}from"elysia";
|
|
2
|
+
import{Elysia,t}from"elysia";function createLifecycleHooks(spec){let{name,onInit,onShutdown,telemetryEventName,skipPlatforms}=spec;return{onServerStart:async(_app,hostServices)=>{if(skipPlatforms&&skipPlatforms.includes(process.platform)){process.stderr.write(`[${name}] skipping init on unsupported platform '${process.platform}'
|
|
3
|
+
`);return}if(onInit)await onInit(hostServices);if(telemetryEventName)hostServices.telemetry?.emit(telemetryEventName,{plugin:name})},onServerStop:async(hostServices)=>{if(onShutdown)await onShutdown(hostServices)}}}var BoundLogger=class{constructor(logger,source){this.logger=logger,this.source=source}logger;source;info(message,meta){this.logger?.info?.(this.source,message,meta)}warn(message,meta){this.logger?.warn?.(this.source,message,meta)}error(message,meta){this.logger?.error?.(this.source,message,meta)}debug(message,meta){this.logger?.debug?.(this.source,message,meta)}};var ProviderRegistry=class{constructor(hostServices){this.hostServices=hostServices}hostServices;getServiceRegistry(){return this.hostServices?.serviceRegistry}registerProvider(type,name,provider){this.hostServices?.serviceRegistry?.registerService(type,name,provider)}getProvider(type,name){return this.hostServices?.serviceRegistry?.getService(type,name)}listProviders(type){return this.hostServices?.serviceRegistry?.listProvidersForType?.(type)??[]}withCliContribution(contribution){let contributors=this.hostServices?.cliContributors;if(!contributors)return;for(let section of contribution.statusSections??[])contributors.addStatusSection?.(section);for(let check of contribution.doctorChecks??[])contributors.addDoctorCheck?.(check)}};var PLUGIN_NAME="session-manager",PLUGIN_VERSION="2026.509.2",FEATURE_KEYS=["mouse","resize","capture","webTerminal","splitPanes","tabs","scrollback","clipboard","search"];class SessionManager{registry;log=new BoundLogger(void 0,PLUGIN_NAME);init(hostServices){this.log=new BoundLogger(hostServices?.logger,PLUGIN_NAME),this.registry=new ProviderRegistry(hostServices),this.log.info("Session manager initialized")}listProviderNames(){if(!this.registry)return this.log.warn("No service registry available"),[];return this.registry.listProviders("session")}getProvider(pluginName){if(!this.registry)return;return this.registry.getProvider("session",pluginName)}getAllCapabilities(){let names=this.listProviderNames(),results=[];for(let name of names){let provider=this.getProvider(name);if(!provider)continue;if(provider.getCapabilities)results.push(provider.getCapabilities());else results.push({provider:provider.name,features:{mouse:!1,resize:!1,capture:!1,webTerminal:!1,splitPanes:!1,tabs:!1,scrollback:!1,clipboard:!1,search:!1},platform:[]})}return results}getCapabilitiesForProvider(providerName){return this.getAllCapabilities().find((c)=>c.provider===providerName)??null}negotiate(desiredFeatures){let all=this.getAllCapabilities();if(all.length===0)return{bestProvider:null,supported:[],unsupported:desiredFeatures,candidates:[]};let validFeatures=desiredFeatures.filter((f)=>FEATURE_KEYS.includes(f)),candidates=all.map((cap)=>{let supported=[],unsupported=[];for(let feature of validFeatures){let key=feature;if(cap.features[key])supported.push(feature);else unsupported.push(feature)}return{provider:cap.provider,score:supported.length,supported,unsupported}});candidates.sort((a,b)=>{if(b.score!==a.score)return b.score-a.score;return a.provider.localeCompare(b.provider)});let best=candidates[0];return{bestProvider:best?best.provider:null,supported:best?best.supported:[],unsupported:best?best.unsupported:[],candidates}}async listProviders(){let names=this.listProviderNames(),results=[];for(let name of names){let provider=this.getProvider(name),health=null,capabilities=null;if(provider){try{health=await provider.healthCheck()}catch(err){this.log.error("Health check failed for provider",{pluginName:name,error:String(err)})}if(provider.getCapabilities)capabilities=provider.getCapabilities()}results.push({pluginName:name,providerName:provider?.name??name,isDefault:!1,health,capabilities})}return results}}function createSessionManagerRoutes(manager){return new Elysia().get("/capabilities",()=>{let capabilities=manager.getAllCapabilities();return{providers:capabilities,count:capabilities.length}}).get("/capabilities/:provider",({params})=>{let capabilities=manager.getCapabilitiesForProvider(params.provider);if(!capabilities)return{error:`Provider "${params.provider}" not found or has no capabilities`};return capabilities},{params:t.Object({provider:t.String()})}).post("/negotiate",({body})=>{return manager.negotiate(body.desiredFeatures)},{body:t.Object({desiredFeatures:t.Array(t.String())})}).get("/providers",async()=>{let providers=await manager.listProviders();return{providers,count:providers.length}})}var createPlugin=(_ctx)=>{let manager=new SessionManager,lifecycle=createLifecycleHooks({name:PLUGIN_NAME,telemetryEventName:"session.meta.ready",onInit:async(hostServices)=>{manager.init(hostServices),registerStatusContributors(hostServices)}});return{capabilities:{storage:"rw",subprocess:!0,broadcast:!0,audit:!0,telemetry:!0},name:PLUGIN_NAME,version:PLUGIN_VERSION,description:"Unified session manager \u2014 capability discovery, feature negotiation, and provider routing across session providers",tags:["backend","integration"],apiPrefix:"/api/session-manager",createRoutes(){return createSessionManagerRoutes(manager)},onCliSetup(_program,hostServices){registerStatusContributors(hostServices)},onServerStart:lifecycle.onServerStart,onServerStop:lifecycle.onServerStop}};function registerStatusContributors(hostServices){let reg=hostServices?.cliContributors;if(!reg)return;reg.addStatusSection?.({source:PLUGIN_NAME,title:"Sessions",render:async({agentUrl})=>{try{let res=await fetch(`${agentUrl}/api/sessions`);if(!res.ok)return null;let list=await res.json();if(!Array.isArray(list))return"\x1B[2m(unable to fetch)\x1B[22m";if(list.length===0)return"\x1B[2m(none)\x1B[22m";return`\x1B[32m${list.length} active\x1B[39m`}catch{return null}},json:async({agentUrl})=>{try{let res=await fetch(`${agentUrl}/api/sessions`);if(!res.ok)return null;return await res.json()}catch{return null}},jsonKey:"sessions"}),reg.addDoctorCheck?.({source:PLUGIN_NAME,run:async()=>{try{let port=(process.env.AGENT_URL??"http://localhost:3005").replace(/\/+$/,""),res=await fetch(`${port}/api/sessions`);if(!res.ok)return[{name:"Session manager",ok:!1,grade:"warn",message:`/api/sessions returned ${res.status}`}];let list=await res.json();if(!Array.isArray(list))return[{name:"Session manager",ok:!1,grade:"warn",message:"/api/sessions did not return an array"}];return[{name:"Session manager",ok:!0,message:`${list.length} active session(s)`}]}catch{return[]}}})}var src_default=createPlugin;export{src_default as default,createPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibecontrols/vibe-plugin-session-manager",
|
|
3
|
-
"version": "2026.509.
|
|
3
|
+
"version": "2026.509.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"license": "SEE LICENSE IN LICENSE",
|
|
38
38
|
"description": "Unified session manager plugin for VibeControls Agent — capability discovery, feature negotiation, and provider routing across session providers",
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@vibecontrols/plugin-sdk": "2026.509.1",
|
|
40
41
|
"elysia": "^1.3.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|