@agenthippo-ai/agenthippo 1.110.34 → 1.110.36

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.
@@ -3,6 +3,6 @@
3
3
  `)}buildWindowsLiteLLMStopCommands(t,e){return t?[`& ${e(t)} -Stop`]:['Write-Host "[WARN] LiteLLM launcher script not found. Skipping LiteLLM stop." -ForegroundColor Yellow']}buildWindowsLiteLLMStartCommands(t,e){if(!t.litellmScript)return['Write-Host "[WARN] LiteLLM launcher script not found. Skipping LiteLLM start." -ForegroundColor Yellow'];const i=(0,windowsCommandLine_1.buildWindowsArgumentLine)(["-NoProfile","-NoLogo","-ExecutionPolicy","Bypass","-File",t.litellmScript,"-ConfigPath",t.configPath]);return['Write-Host "Starting LiteLLM proxy..."',`if (-not (Test-Path ${e(t.configPath)})) {`,` Write-Host ${e(`[INFO] LiteLLM config missing: ${t.configPath} \u2014 launcher will re-create it from the bundled template.`)}`,"}",`$env:LITELLM_CONFIG_PATH = ${e(t.configPath)}`,"try {",` $proc = Start-Process -FilePath ${e(getWindowsPwshOrPowerShell())} -WindowStyle Hidden -WorkingDirectory ${e(path.dirname(t.litellmScript))} -ArgumentList ${e(i)} -RedirectStandardOutput ${e(t.stdoutPath)} -RedirectStandardError ${e(t.stderrPath)} -PassThru -ErrorAction Stop`,' Write-Host "[OK] LiteLLM launcher started (PID: $($proc.Id))"',` Write-Host ${e(` Logs: ${t.stdoutPath}`)}`,` Write-Host ${e(` Errors: ${t.stderrPath}`)}`,"} catch {",' Write-Host "[ERROR] Failed to start LiteLLM launcher." -ForegroundColor Red'," Write-Host $_.Exception.Message -ForegroundColor Red","}"]}buildUnixSpotlightLifecycleCommand(t){const e=s=>this.quoteBash(s),i=["set +e",`export AGENT_HOME_DIR=${e(t.agentHomeDir)}`,`mkdir -p ${e(path.dirname(t.stdoutPath))}`,`echo ${e(this.getLifecycleTerminalIntro(t.action))}`];return(t.action==="stop"||t.action==="restart")&&i.push('echo ""','echo "Stopping LiteLLM proxy..."',...this.buildUnixLiteLLMStopCommands(t.litellmScript,e)),t.action==="stop"?i.push('echo ""','echo "Stopping OTEL Collector..."',`${e(t.startScript)} --stop`):t.action==="restart"?i.push('echo ""','echo "Restarting OTEL Collector..."',`${e(t.startScript)} --stop`,"sleep 1",`${e(t.startScript)} --force-daemon`):i.push('echo ""','echo "Starting OTEL Collector..."',`${e(t.startScript)} --force-daemon`),(t.action==="start"||t.action==="restart")&&i.push('echo ""',...this.buildUnixLiteLLMStartCommands(t,e)),i.push('echo ""','echo "Press any key to close..."',"read -n 1"),i.join(`
4
4
  `)}buildUnixLiteLLMStopCommands(t,e){return t?[`${e(t)} --stop`]:['echo "[WARN] LiteLLM launcher script not found. Skipping LiteLLM stop." >&2']}buildUnixLiteLLMStartCommands(t,e){return t.litellmScript?['echo "Starting LiteLLM proxy..."',`if [ ! -f ${e(t.configPath)} ]; then`,` echo ${e(`[INFO] LiteLLM config missing: ${t.configPath} \u2014 launcher will re-create it from the bundled template.`)}`,"fi",`export LITELLM_CONFIG_PATH=${e(t.configPath)}`,`nohup ${e(t.litellmScript)} --config ${e(t.configPath)} >> ${e(t.stdoutPath)} 2>> ${e(t.stderrPath)} &`,'echo "[OK] LiteLLM launcher started (PID: $!)"',`echo ${e(` Logs: ${t.stdoutPath}`)}`,`echo ${e(` Errors: ${t.stderrPath}`)}`]:['echo "[WARN] LiteLLM launcher script not found. Skipping LiteLLM start." >&2']}getLifecycleTerminalIntro(t){switch(t){case"start":return"Starting Spotlight (OTEL Collector + LiteLLM)...";case"stop":return"Stopping Spotlight (LiteLLM + OTEL Collector)...";case"restart":return"Restarting Spotlight (LiteLLM + OTEL Collector)..."}}quoteBash(t){return`'${t.replace(/'/g,"'\\''")}'`}async stopLiteLLMDirectly(){const e=process.platform==="win32"?["-Stop"]:["--stop"];return this.runLauncher(e,{detached:!1})}async startLiteLLMDirectly(){const t=path.join((0,index_1.getAgentideHome)(),"litellm-otel.yaml"),i=process.platform==="win32"?["-ConfigPath",t]:["--config",t];return this.runLauncher(i,{detached:!0,configPath:t})}async runLauncher(t,e){const i=await this.findLiteLLMScript();if(!i)return!1;const s=process.platform==="win32",a=s?getWindowsPwshOrPowerShell():"/bin/bash",r=s?["-NoProfile","-ExecutionPolicy","Bypass","-File",i,...t]:[i,...t],o={...process.env,AGENT_HOME_DIR:(0,index_1.getAgentideHome)()};if(o.AGENTHIPPO_EVIDENCE_CONTENT_CAPTURE||(o.AGENTHIPPO_EVIDENCE_CONTENT_CAPTURE="1"),e.configPath&&(o.LITELLM_CONFIG_PATH=e.configPath),s&&e.detached)return this.startLiteLLMViaHiddenWindowsProcess(i,t,o);if(e.detached){const n=path.join((0,index_1.getAgentideHome)(),"analytics");fsSync.mkdirSync(n,{recursive:!0});const c=fsSync.openSync(path.join(n,"litellm.log"),"a"),h=fsSync.openSync(path.join(n,"litellm.error.log"),"a");try{const d=(0,child_process_1.spawn)(a,r,{detached:!0,stdio:["ignore",c,h],windowsHide:!0,env:o,cwd:path.dirname(i)});return d.unref(),this.log(`LiteLLM launcher started (PID: ${d.pid})`),!0}catch(d){return this.log(`Failed to start LiteLLM: ${d}`),!1}finally{fsSync.closeSync(c),fsSync.closeSync(h)}}return new Promise(n=>{const c=(0,child_process_1.spawn)(a,r,{windowsHide:!0,env:o,cwd:path.dirname(i)});c.once("error",h=>{this.log(`LiteLLM launcher failed to spawn: ${h}`),n(!1)}),c.once("exit",h=>n(h===0))})}async startLiteLLMViaHiddenWindowsProcess(t,e,i){const s=path.join((0,index_1.getAgentideHome)(),"analytics");fsSync.mkdirSync(s,{recursive:!0});const a=path.join(s,"litellm.log"),r=path.join(s,"litellm.error.log"),o=(0,windowsCommandLine_1.buildWindowsArgumentLine)(["-NoProfile","-NoLogo","-ExecutionPolicy","Bypass","-File",t,...e]),n=[`$env:AGENT_HOME_DIR = '${this.escapePowerShellSingleQuotedString(i.AGENT_HOME_DIR??(0,index_1.getAgentideHome)())}'`,i.LITELLM_CONFIG_PATH?`$env:LITELLM_CONFIG_PATH = '${this.escapePowerShellSingleQuotedString(i.LITELLM_CONFIG_PATH)}'`:"",`$proc = Start-Process -FilePath '${this.escapePowerShellSingleQuotedString(getWindowsPwshOrPowerShell())}' -WindowStyle Hidden -WorkingDirectory '${this.escapePowerShellSingleQuotedString(path.dirname(t))}' -ArgumentList '${this.escapePowerShellSingleQuotedString(o)}' -RedirectStandardOutput '${this.escapePowerShellSingleQuotedString(a)}' -RedirectStandardError '${this.escapePowerShellSingleQuotedString(r)}' -PassThru`,"Write-Output $proc.Id"].filter(Boolean).join("; ");return new Promise(c=>{let h="",d="";const g=(0,child_process_1.spawn)(getWindowsPwshOrPowerShell(),["-NoProfile","-ExecutionPolicy","Bypass","-Command",n],{windowsHide:!0,env:i,cwd:path.dirname(t)});g.stdout.on("data",u=>{h+=u.toString()}),g.stderr.on("data",u=>{d+=u.toString()}),g.once("error",u=>{this.log(`LiteLLM launcher failed to spawn hidden Windows process: ${u}`),c(!1)}),g.once("exit",u=>{if(u!==0){const m=d.trim()||h.trim();this.log(`LiteLLM hidden Windows launcher exited with code ${u}${m?`: ${m}`:""}`),c(!1);return}const p=parseInt(h.trim(),10);Number.isNaN(p)||this.log(`LiteLLM hidden Windows process started (PID: ${p})`),c(!0)})})}escapePowerShellSingleQuotedString(t){return t.replace(/'/g,"''")}async findLiteLLMScript(){const t=this.extensionContext.extensionPath,i=process.platform==="win32"?"agentide-litellm.ps1":"agentide-litellm.sh",s=[path.join(t,"out","scripts",i),path.join(t,"scripts",i),path.join(t,"..","..","scripts",i)];for(const a of s)try{return await fs_1.promises.access(a),a}catch{}return null}async triggerIndexing(){if(!this.indexingService){vscode.window.showWarningMessage(`${branding_1.AGENTIDE_BRAND_NAME}: Indexing service is not available.`);return}if(this.indexingService.isIndexing()){vscode.window.showInformationMessage(`${branding_1.AGENTIDE_BRAND_NAME}: Indexing is already in progress.`);return}this.indexingService.scheduleIndexing(!0),vscode.window.showInformationMessage(`${branding_1.AGENTIDE_BRAND_NAME}: Triggered indexing.`)}async showStatus(){const t=await this.getStackStatus(),e=vscode.workspace.getConfiguration("agentide.providers.litellm").get("baseUrl")?.trim(),i=t.otelRunning?"\u{1F7E2} 127.0.0.1:4318":"\u26AB Not running";let s;t.litellmRunning&&e?s=`\u{1F7E2} ${e}`:t.litellmRunning?s="\u{1F7E2} Set URL in Settings or Stop External LiteLLM":s="\u26AB Not running";const a=[`LiteLLM: ${s}`,`OTEL: ${i}`].join(`
5
5
 
6
- `),r=(0,lifecycle_1.getSpotlightLifecycleAction)(t),o=(0,lifecycle_1.getSpotlightInstallAction)(await this.isAnalyticsConfigured());switch(await vscode.window.showInformationMessage(`${a}`,"Config",o,r)){case"Start":await this.start();break;case"Stop":await this.stop();break;case"Config":await this.openLiteLLMConfig();break;case"Restart All":await this.restart();break;case"Install":process.platform==="win32"?await this.setupWindowsSpotlight({reinstall:!1}):await vscode.commands.executeCommand("agentide.setupAnalytics");break;case"Reinstall":process.platform==="win32"?await this.setupWindowsSpotlight({reinstall:!0}):await vscode.commands.executeCommand("agentide.setupAnalytics");break}}async openLiteLLMConfig(){const t=path.join((0,index_1.getAgentideHome)(),"litellm-otel.yaml");try{await fs_1.promises.access(t)}catch{await vscode.window.showWarningMessage(`${branding_1.AGENTIDE_BRAND_NAME}: LiteLLM OTEL config not found.`,"Install")==="Install"&&await vscode.commands.executeCommand("agentide.setupAnalytics");return}const e=await vscode.workspace.openTextDocument(t);await vscode.window.showTextDocument(e)}async openQueryTerminal(){const t=await this.findScript("query-analytics.sh");if(!t){vscode.window.showErrorMessage(`${branding_1.AGENTIDE_BRAND_NAME}: Query script not found. Run 'Setup Analytics' first.`);return}this.createScriptTerminal("Spotlight Query",t,"--latest-session",!0).show()}async findScript(t){const e=this.extensionContext.extensionPath,i=path.join(e,"out","scripts","analytics",t);try{return await fs_1.promises.access(i),i}catch{}const s=path.join(e,"scripts","analytics",t);try{return await fs_1.promises.access(s),s}catch{}return null}updateStatusBar(t){this._status=t;let e;switch(t){case"running":this.statusBarItem.text="$(pulse) Spotlight",e="Spotlight: Running (OTEL + LiteLLM configured)",this.statusBarItem.color=new vscode.ThemeColor("testing.iconPassed"),this.statusBarItem.backgroundColor=void 0;break;case"partial":this.statusBarItem.text="$(pulse) Spotlight",e="Spotlight: Partial (click to configure)",this.statusBarItem.color=new vscode.ThemeColor("editorWarning.foreground"),this.statusBarItem.backgroundColor=void 0;break;case"stopped":this.statusBarItem.text="$(pulse) Spotlight",e="Spotlight: Stopped (click to start)",this.statusBarItem.color=void 0,this.statusBarItem.backgroundColor=void 0;break;case"checking":this.statusBarItem.text="$(sync~spin) Spotlight",e="Spotlight: Checking...",this.statusBarItem.color=void 0,this.statusBarItem.backgroundColor=void 0;break;case"error":this.statusBarItem.text="$(warning) Spotlight",e="Spotlight: Error (click to retry)",this.statusBarItem.color=new vscode.ThemeColor("errorForeground"),this.statusBarItem.backgroundColor=void 0;break}this.indexProgress.status==="indexing"&&(e+=`
6
+ `),r=(0,lifecycle_1.getSpotlightLifecycleAction)(t),o=(0,lifecycle_1.getSpotlightInstallAction)(await this.isAnalyticsConfigured());switch(await vscode.window.showInformationMessage(`${a}`,"Config",o,r)){case"Start":await this.start();break;case"Stop":await this.stop();break;case"Config":await this.openLiteLLMConfig();break;case"Restart All":await this.restart();break;case"Install":process.platform==="win32"?await this.setupWindowsSpotlight({reinstall:!1}):await vscode.commands.executeCommand("agentide.setupAnalytics");break;case"Reinstall":process.platform==="win32"?await this.setupWindowsSpotlight({reinstall:!0}):await vscode.commands.executeCommand("agentide.setupAnalytics",{reinstall:!0});break}}async openLiteLLMConfig(){const t=path.join((0,index_1.getAgentideHome)(),"litellm-otel.yaml");try{await fs_1.promises.access(t)}catch{await vscode.window.showWarningMessage(`${branding_1.AGENTIDE_BRAND_NAME}: LiteLLM OTEL config not found.`,"Install")==="Install"&&await vscode.commands.executeCommand("agentide.setupAnalytics");return}const e=await vscode.workspace.openTextDocument(t);await vscode.window.showTextDocument(e)}async openQueryTerminal(){const t=await this.findScript("query-analytics.sh");if(!t){vscode.window.showErrorMessage(`${branding_1.AGENTIDE_BRAND_NAME}: Query script not found. Run 'Setup Analytics' first.`);return}this.createScriptTerminal("Spotlight Query",t,"--latest-session",!0).show()}async findScript(t){const e=this.extensionContext.extensionPath,i=path.join(e,"out","scripts","analytics",t);try{return await fs_1.promises.access(i),i}catch{}const s=path.join(e,"scripts","analytics",t);try{return await fs_1.promises.access(s),s}catch{}return null}updateStatusBar(t){this._status=t;let e;switch(t){case"running":this.statusBarItem.text="$(pulse) Spotlight",e="Spotlight: Running (OTEL + LiteLLM configured)",this.statusBarItem.color=new vscode.ThemeColor("testing.iconPassed"),this.statusBarItem.backgroundColor=void 0;break;case"partial":this.statusBarItem.text="$(pulse) Spotlight",e="Spotlight: Partial (click to configure)",this.statusBarItem.color=new vscode.ThemeColor("editorWarning.foreground"),this.statusBarItem.backgroundColor=void 0;break;case"stopped":this.statusBarItem.text="$(pulse) Spotlight",e="Spotlight: Stopped (click to start)",this.statusBarItem.color=void 0,this.statusBarItem.backgroundColor=void 0;break;case"checking":this.statusBarItem.text="$(sync~spin) Spotlight",e="Spotlight: Checking...",this.statusBarItem.color=void 0,this.statusBarItem.backgroundColor=void 0;break;case"error":this.statusBarItem.text="$(warning) Spotlight",e="Spotlight: Error (click to retry)",this.statusBarItem.color=new vscode.ThemeColor("errorForeground"),this.statusBarItem.backgroundColor=void 0;break}this.indexProgress.status==="indexing"&&(e+=`
7
7
 
8
8
  Background analytics indexing is running (${this.indexProgress.percent}% complete). Charts may use JSONL fallback until indexing finishes.`),this.statusBarItem.tooltip=e,this.statusBarItem.show()}log(t){this.outputChannel.appendLine(`[Analytics] ${t}`)}createScriptTerminal(t,e,i,s=!1){const a=(0,index_1.getAgentideHome)();if(s){const r=`"${e}" ${i}`;return vscode.window.createTerminal({name:t,cwd:path.dirname(e),env:{AGENT_HOME_DIR:a},shellPath:"/bin/bash",shellArgs:["-c",`echo '$ ${r}'; echo ''; ${r}; echo ''; exec bash -l`]})}return vscode.window.createTerminal({name:t,cwd:path.dirname(e),env:{AGENT_HOME_DIR:a},shellPath:"/bin/bash",shellArgs:["-c",`"${e}" ${i}`]})}dispose(){this.healthCheckTimer&&(clearInterval(this.healthCheckTimer),this.healthCheckTimer=null),this.statusBarItem.dispose();for(const t of this.disposables)t.dispose()}}exports.AnalyticsService=AnalyticsService;