@agenthippo-ai/agenthippo 1.110.46 → 1.110.48

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,2 +1,2 @@
1
1
  /*! Copyright (c) 2026 AgentHippo.ai. All rights reserved. Proprietary; see LICENSE. */
2
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(s,t,e,n){n===void 0&&(n=e);var o=Object.getOwnPropertyDescriptor(t,e);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(s,n,o)}):(function(s,t,e,n){n===void 0&&(n=e),s[n]=t[e]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(s,t){Object.defineProperty(s,"default",{enumerable:!0,value:t})}):function(s,t){s.default=t}),__importStar=this&&this.__importStar||(function(){var s=function(t){return s=Object.getOwnPropertyNames||function(e){var n=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[n.length]=o);return n},s(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=s(t),o=0;o<n.length;o++)n[o]!=="default"&&__createBinding(e,t,n[o]);return __setModuleDefault(e,t),e}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.AgentHippoAuthProvider=exports.getAgentHippoAccessToken=void 0,exports.registerAgentHippoAuth=registerAgentHippoAuth,exports.refreshBootstrapIfSignedIn=refreshBootstrapIfSignedIn,exports.startAgentHippoTokenRefreshTimer=startAgentHippoTokenRefreshTimer;const vscode=__importStar(require("vscode")),authBaseUrl_js_1=require("./authBaseUrl.js"),bootstrapApply_js_1=require("./bootstrapApply.js"),types_js_1=require("./types.js"),signInFlow_js_1=require("./signInFlow.js"),sessionStore_js_1=require("./sessionStore.js");var sessionStore_js_2=require("./sessionStore.js");Object.defineProperty(exports,"getAgentHippoAccessToken",{enumerable:!0,get:function(){return sessionStore_js_2.getAgentHippoAccessToken}});async function syncAgentHippoModelGatewayToken(s){try{return await vscode.commands.executeCommand("agentide.auth.applyBootstrapKeys",{provider:"agenthippo",apiKey:s}),!0}catch{return!1}}async function clearAgentHippoModelGatewayToken(){try{await vscode.commands.executeCommand("agentide.auth.applyBootstrapKeys",{provider:"agenthippo",apiKey:""})}catch{}}class AgentHippoAuthProvider{context;_onDidChangeSessions=new vscode.EventEmitter;onDidChangeSessions=this._onDidChangeSessions.event;constructor(t){this.context=t}dispose(){}async getSessions(t){const e=await(0,sessionStore_js_1.getStoredAuthSession)(this.context.secrets);return e?t?.length&&!t.every(n=>e.scopes.includes(n))?[]:[(0,sessionStore_js_1.storedSessionToVsCode)(e)]:[]}async createSession(t){const e=await(0,signInFlow_js_1.runAgentHippoSignInFlow)(this.context,{scopes:t});if(!e)throw new Error("Sign-in cancelled");return await syncAgentHippoModelGatewayToken(e.accessToken),this._onDidChangeSessions.fire({added:[e],removed:[],changed:[]}),e}async removeSession(t){const e=await(0,sessionStore_js_1.getStoredAuthSession)(this.context.secrets),n=e?(0,sessionStore_js_1.storedSessionToVsCode)(e):void 0;if(e){const r=(0,authBaseUrl_js_1.resolveAuthBrokerBaseUrl)(vscode.workspace.getConfiguration("agentide"),i=>console.warn(i));try{await fetch(`${r}/api/ide/signout`,{method:"POST",headers:{Authorization:`Bearer ${e.accessToken}`}})}catch{}}await(0,sessionStore_js_1.clearAuthSession)(this.context.secrets),clearAgentHippoModelGatewayToken(),await(0,bootstrapApply_js_1.revertTeamManagedBootstrap)({getConfiguration:r=>vscode.workspace.getConfiguration(r),ConfigurationTarget:vscode.ConfigurationTarget,setParticipantApiKey:async r=>{await vscode.commands.executeCommand("agentide.setParticipantApiKey",r),await vscode.commands.executeCommand("agentide.auth.applyBootstrapKeys",r)},globalStateUpdate:async(r,i)=>{await this.context.globalState.update(r,i)},globalStateGet:r=>this.context.globalState.get(r)});const o=n?[n]:[];this._onDidChangeSessions.fire({added:[],removed:o,changed:[]})}}exports.AgentHippoAuthProvider=AgentHippoAuthProvider;function registerAgentHippoAuth(s){const t=new AgentHippoAuthProvider(s);s.subscriptions.push(vscode.authentication.registerAuthenticationProvider(types_js_1.AUTH_PROVIDER_ID,"AgentHippo",t,{supportsMultipleAccounts:!1}),vscode.commands.registerCommand("agenthippo.signIn",async()=>{try{await vscode.authentication.getSession(types_js_1.AUTH_PROVIDER_ID,[...types_js_1.AUTH_SCOPES],{forceNewSession:!0})}catch(e){const n=e instanceof Error?e.message:String(e);n.toLowerCase().includes("cancel")||vscode.window.showErrorMessage(`AgentHippo sign-in failed: ${n}`)}}),vscode.commands.registerCommand("agenthippo.signOut",async()=>{const e=await(0,sessionStore_js_1.getStoredAuthSession)(s.secrets);e&&await t.removeSession(e.accountId)}),vscode.commands.registerCommand("agentide.auth.refreshToken",async()=>{const e=await(0,sessionStore_js_1.getAgentHippoAccessToken)(s);return e?syncAgentHippoModelGatewayToken(e.accessToken):!1}))}async function refreshBootstrapIfSignedIn(s){const t=await(0,sessionStore_js_1.getAgentHippoAccessToken)(s);if(t){try{await(0,sessionStore_js_1.applyIdeBootstrapForContext)(s,t.accessToken)}catch{}syncAgentHippoModelGatewayToken(t.accessToken)}}const TOKEN_REFRESH_INTERVAL_MS=6e4;function startAgentHippoTokenRefreshTimer(s){let t="",e=!1;const n=setInterval(()=>{e||(async()=>{e=!0;try{const o=await(0,sessionStore_js_1.getAgentHippoAccessToken)(s);if(!o)return;o.accessToken!==t&&await syncAgentHippoModelGatewayToken(o.accessToken)&&(t=o.accessToken)}finally{e=!1}})()},TOKEN_REFRESH_INTERVAL_MS);return{dispose:()=>clearInterval(n)}}
2
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(s,t,e,n){n===void 0&&(n=e);var o=Object.getOwnPropertyDescriptor(t,e);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(s,n,o)}):(function(s,t,e,n){n===void 0&&(n=e),s[n]=t[e]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(s,t){Object.defineProperty(s,"default",{enumerable:!0,value:t})}):function(s,t){s.default=t}),__importStar=this&&this.__importStar||(function(){var s=function(t){return s=Object.getOwnPropertyNames||function(e){var n=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[n.length]=o);return n},s(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=s(t),o=0;o<n.length;o++)n[o]!=="default"&&__createBinding(e,t,n[o]);return __setModuleDefault(e,t),e}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.AgentHippoAuthProvider=exports.getAgentHippoAccessToken=void 0,exports.registerAgentHippoAuth=registerAgentHippoAuth,exports.refreshBootstrapIfSignedIn=refreshBootstrapIfSignedIn,exports.refreshAndSyncAgentHippoGatewayToken=refreshAndSyncAgentHippoGatewayToken,exports.startAgentHippoTokenRefreshTimer=startAgentHippoTokenRefreshTimer;const vscode=__importStar(require("vscode")),authBaseUrl_js_1=require("./authBaseUrl.js"),bootstrapApply_js_1=require("./bootstrapApply.js"),types_js_1=require("./types.js"),signInFlow_js_1=require("./signInFlow.js"),sessionStore_js_1=require("./sessionStore.js");var sessionStore_js_2=require("./sessionStore.js");Object.defineProperty(exports,"getAgentHippoAccessToken",{enumerable:!0,get:function(){return sessionStore_js_2.getAgentHippoAccessToken}});async function syncAgentHippoModelGatewayToken(s){try{return await vscode.commands.executeCommand("agentide.auth.applyBootstrapKeys",{provider:"agenthippo",apiKey:s}),!0}catch{return!1}}async function clearAgentHippoModelGatewayToken(){try{await vscode.commands.executeCommand("agentide.auth.applyBootstrapKeys",{provider:"agenthippo",apiKey:""})}catch{}}class AgentHippoAuthProvider{context;_onDidChangeSessions=new vscode.EventEmitter;onDidChangeSessions=this._onDidChangeSessions.event;constructor(t){this.context=t}dispose(){}async getSessions(t){const e=await(0,sessionStore_js_1.getStoredAuthSession)(this.context.secrets);return e?t?.length&&!t.every(n=>e.scopes.includes(n))?[]:[(0,sessionStore_js_1.storedSessionToVsCode)(e)]:[]}async createSession(t){const e=await(0,signInFlow_js_1.runAgentHippoSignInFlow)(this.context,{scopes:t});if(!e)throw new Error("Sign-in cancelled");return await syncAgentHippoModelGatewayToken(e.accessToken),this._onDidChangeSessions.fire({added:[e],removed:[],changed:[]}),e}async removeSession(t){const e=await(0,sessionStore_js_1.getStoredAuthSession)(this.context.secrets),n=e?(0,sessionStore_js_1.storedSessionToVsCode)(e):void 0;if(e){const r=(0,authBaseUrl_js_1.resolveAuthBrokerBaseUrl)(vscode.workspace.getConfiguration("agentide"),i=>console.warn(i));try{await fetch(`${r}/api/ide/signout`,{method:"POST",headers:{Authorization:`Bearer ${e.accessToken}`}})}catch{}}await(0,sessionStore_js_1.clearAuthSession)(this.context.secrets),clearAgentHippoModelGatewayToken(),await(0,bootstrapApply_js_1.revertTeamManagedBootstrap)({getConfiguration:r=>vscode.workspace.getConfiguration(r),ConfigurationTarget:vscode.ConfigurationTarget,setParticipantApiKey:async r=>{await vscode.commands.executeCommand("agentide.setParticipantApiKey",r),await vscode.commands.executeCommand("agentide.auth.applyBootstrapKeys",r)},globalStateUpdate:async(r,i)=>{await this.context.globalState.update(r,i)},globalStateGet:r=>this.context.globalState.get(r)});const o=n?[n]:[];this._onDidChangeSessions.fire({added:[],removed:o,changed:[]})}}exports.AgentHippoAuthProvider=AgentHippoAuthProvider;function registerAgentHippoAuth(s){const t=new AgentHippoAuthProvider(s);s.subscriptions.push(vscode.authentication.registerAuthenticationProvider(types_js_1.AUTH_PROVIDER_ID,"AgentHippo",t,{supportsMultipleAccounts:!1}),vscode.commands.registerCommand("agenthippo.signIn",async()=>{try{await vscode.authentication.getSession(types_js_1.AUTH_PROVIDER_ID,[...types_js_1.AUTH_SCOPES],{forceNewSession:!0})}catch(e){const n=e instanceof Error?e.message:String(e);n.toLowerCase().includes("cancel")||vscode.window.showErrorMessage(`AgentHippo sign-in failed: ${n}`)}}),vscode.commands.registerCommand("agenthippo.signOut",async()=>{const e=await(0,sessionStore_js_1.getStoredAuthSession)(s.secrets);e&&await t.removeSession(e.accountId)}),vscode.commands.registerCommand("agentide.auth.refreshToken",async e=>{const n=await(0,sessionStore_js_1.getAgentHippoAccessToken)(s,{forceRefresh:e?.force===!0});return n?syncAgentHippoModelGatewayToken(n.accessToken):!1}))}async function refreshBootstrapIfSignedIn(s){const t=await(0,sessionStore_js_1.getAgentHippoAccessToken)(s);if(t){try{await(0,sessionStore_js_1.applyIdeBootstrapForContext)(s,t.accessToken)}catch{}syncAgentHippoModelGatewayToken(t.accessToken)}}const TOKEN_REFRESH_INTERVAL_MS=6e4;async function refreshAndSyncAgentHippoGatewayToken(s,t){const e=await(0,sessionStore_js_1.getAgentHippoAccessToken)(s,t);return e&&await syncAgentHippoModelGatewayToken(e.accessToken)?e.accessToken:void 0}function startAgentHippoTokenRefreshTimer(s){let t="",e=!1;const n=setInterval(()=>{e||(async()=>{e=!0;try{const o=await(0,sessionStore_js_1.getAgentHippoAccessToken)(s);if(!o)return;o.accessToken!==t&&await syncAgentHippoModelGatewayToken(o.accessToken)&&(t=o.accessToken)}finally{e=!1}})()},TOKEN_REFRESH_INTERVAL_MS);return{dispose:()=>clearInterval(n)}}
@@ -1,2 +1,2 @@
1
1
  /*! Copyright (c) 2026 AgentHippo.ai. All rights reserved. Proprietary; see LICENSE. */
2
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(t,e,r,s){s===void 0&&(s=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,n)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),__importStar=this&&this.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var s=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[s.length]=n);return s},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var s=t(e),n=0;n<s.length;n++)s[n]!=="default"&&__createBinding(r,e,s[n]);return __setModuleDefault(r,e),r}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStoredAuthSession=getStoredAuthSession,exports.persistAuthSession=persistAuthSession,exports.applyIdeBootstrapForContext=applyIdeBootstrapForContext,exports.getAgentHippoAccessToken=getAgentHippoAccessToken,exports.clearAuthSession=clearAuthSession,exports.storedSessionToVsCode=storedSessionToVsCode;const vscode=__importStar(require("vscode")),brokerClient_js_1=require("./brokerClient.js"),authBaseUrl_js_1=require("./authBaseUrl.js"),bootstrapApply_js_1=require("./bootstrapApply.js"),SESSION_SECRET_KEY="agenthippo.auth.session",REFRESH_WINDOW_MS=5*6e4;let inFlightRefresh;async function getStoredAuthSession(t){const e=await t.get(SESSION_SECRET_KEY);if(e)try{return JSON.parse(e)}catch{return}}async function storeAuthSession(t,e){await t.store(SESSION_SECRET_KEY,JSON.stringify(e))}function toVsCodeSession(t){return{id:t.accountId,accessToken:t.accessToken,account:{id:t.accountId,label:t.accountLabel},scopes:t.scopes}}async function persistAuthSession(t,e,r,s){const n={accessToken:e.access_token,refreshToken:e.refresh_token,accountId:r.user.id,accountLabel:r.user.email,scopes:[...s],expiresAt:Date.now()+e.expires_in*1e3};return await storeAuthSession(t,n),toVsCodeSession(n)}async function applyIdeBootstrapForContext(t,e){const r=(0,authBaseUrl_js_1.resolveAuthBrokerBaseUrl)(vscode.workspace.getConfiguration("agentide"),n=>console.warn(n)),s=await(0,brokerClient_js_1.fetchBootstrap)(r,e);return await(0,bootstrapApply_js_1.applyIdeBootstrap)(s,{getConfiguration:n=>vscode.workspace.getConfiguration(n),ConfigurationTarget:vscode.ConfigurationTarget,setParticipantApiKey:async n=>{await vscode.commands.executeCommand("agentide.setParticipantApiKey",n),await vscode.commands.executeCommand("agentide.auth.applyBootstrapKeys",n)},globalStateUpdate:async(n,o)=>{await t.globalState.update(n,o)},globalStateGet:n=>t.globalState.get(n)}),s}async function getAgentHippoAccessToken(t){const e=await getStoredAuthSession(t.secrets);if(!e)return;if(e.expiresAt>Date.now()+REFRESH_WINDOW_MS)return{accessToken:e.accessToken,email:e.accountLabel};if(!inFlightRefresh){const s=(0,authBaseUrl_js_1.resolveAuthBrokerBaseUrl)(vscode.workspace.getConfiguration("agentide"),o=>console.warn(o)),n=e;inFlightRefresh=(async()=>{try{const o=await(0,brokerClient_js_1.refreshAccessToken)(s,n.refreshToken),a={...n,accessToken:o.access_token,refreshToken:o.refresh_token,expiresAt:Date.now()+o.expires_in*1e3};return await storeAuthSession(t.secrets,a),a}catch{return}finally{inFlightRefresh=void 0}})()}const r=await inFlightRefresh;if(r)return{accessToken:r.accessToken,email:r.accountLabel}}async function clearAuthSession(t){await t.delete(SESSION_SECRET_KEY)}function storedSessionToVsCode(t){return toVsCodeSession(t)}
2
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(e,t,r,s){s===void 0&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}):(function(e,t,r,s){s===void 0&&(s=r),e[s]=t[r]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),__importStar=this&&this.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var s=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[s.length]=n);return s},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var s=e(t),n=0;n<s.length;n++)s[n]!=="default"&&__createBinding(r,t,s[n]);return __setModuleDefault(r,t),r}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStoredAuthSession=getStoredAuthSession,exports.persistAuthSession=persistAuthSession,exports.applyIdeBootstrapForContext=applyIdeBootstrapForContext,exports.getAgentHippoAccessToken=getAgentHippoAccessToken,exports.clearAuthSession=clearAuthSession,exports.storedSessionToVsCode=storedSessionToVsCode;const vscode=__importStar(require("vscode")),brokerClient_js_1=require("./brokerClient.js"),authBaseUrl_js_1=require("./authBaseUrl.js"),bootstrapApply_js_1=require("./bootstrapApply.js"),SESSION_SECRET_KEY="agenthippo.auth.session",REFRESH_WINDOW_MS=5*6e4;let inFlightRefresh;async function getStoredAuthSession(e){const t=await e.get(SESSION_SECRET_KEY);if(t)try{return JSON.parse(t)}catch{return}}async function storeAuthSession(e,t){await e.store(SESSION_SECRET_KEY,JSON.stringify(t))}function toVsCodeSession(e){return{id:e.accountId,accessToken:e.accessToken,account:{id:e.accountId,label:e.accountLabel},scopes:e.scopes}}async function persistAuthSession(e,t,r,s){const n={accessToken:t.access_token,refreshToken:t.refresh_token,accountId:r.user.id,accountLabel:r.user.email,scopes:[...s],expiresAt:Date.now()+t.expires_in*1e3};return await storeAuthSession(e,n),toVsCodeSession(n)}async function applyIdeBootstrapForContext(e,t){const r=(0,authBaseUrl_js_1.resolveAuthBrokerBaseUrl)(vscode.workspace.getConfiguration("agentide"),n=>console.warn(n)),s=await(0,brokerClient_js_1.fetchBootstrap)(r,t);return await(0,bootstrapApply_js_1.applyIdeBootstrap)(s,{getConfiguration:n=>vscode.workspace.getConfiguration(n),ConfigurationTarget:vscode.ConfigurationTarget,setParticipantApiKey:async n=>{await vscode.commands.executeCommand("agentide.setParticipantApiKey",n),await vscode.commands.executeCommand("agentide.auth.applyBootstrapKeys",n)},globalStateUpdate:async(n,a)=>{await e.globalState.update(n,a)},globalStateGet:n=>e.globalState.get(n)}),s}async function getAgentHippoAccessToken(e,t){const r=await getStoredAuthSession(e.secrets);if(!r)return;if(!(t?.forceRefresh===!0)&&r.expiresAt>Date.now()+REFRESH_WINDOW_MS)return{accessToken:r.accessToken,email:r.accountLabel};if(!inFlightRefresh){const a=(0,authBaseUrl_js_1.resolveAuthBrokerBaseUrl)(vscode.workspace.getConfiguration("agentide"),o=>console.warn(o)),i=r;inFlightRefresh=(async()=>{try{const o=await(0,brokerClient_js_1.refreshAccessToken)(a,i.refreshToken),c={...i,accessToken:o.access_token,refreshToken:o.refresh_token,expiresAt:Date.now()+o.expires_in*1e3};return await storeAuthSession(e.secrets,c),c}catch(o){console.warn("[AgentHippo auth] Access token refresh failed:",o instanceof Error?o.message:String(o));return}finally{inFlightRefresh=void 0}})()}const n=await inFlightRefresh;if(n)return{accessToken:n.accessToken,email:n.accountLabel}}async function clearAuthSession(e){await e.delete(SESSION_SECRET_KEY)}function storedSessionToVsCode(e){return toVsCodeSession(e)}