@@ -98,22 +98,6 @@ export function storeDeleteToken(token: string): boolean {
9898
9999// ---------- Environment ----------
100100
101- /** Find an active or offline environment by machineName (optionally filtered by workerType).
102- * Includes "offline" so ACP agents can be reused on reconnect. */
103- export function storeFindEnvironmentByMachineName (
104- machineName : string ,
105- workerType ?: string ,
106- ) : EnvironmentRecord | undefined {
107- for ( const rec of environments . values ( ) ) {
108- if ( rec . machineName === machineName && ( rec . status === "active" || rec . status === "offline" ) ) {
109- if ( ! workerType || rec . workerType === workerType ) {
110- return rec ;
111- }
112- }
113- }
114- return undefined ;
115- }
116-
117101export function storeCreateEnvironment ( req : {
118102 secret : string ;
119103 machineName ?: string ;
@@ -126,23 +110,6 @@ export function storeCreateEnvironment(req: {
126110 username ?: string ;
127111 capabilities ?: Record < string , unknown > ;
128112} ) : EnvironmentRecord {
129- // ACP: reuse existing active record by machineName
130- if ( req . workerType === "acp" && req . machineName ) {
131- const existing = storeFindEnvironmentByMachineName ( req . machineName , "acp" ) ;
132- if ( existing ) {
133- Object . assign ( existing , {
134- status : "active" ,
135- lastPollAt : new Date ( ) ,
136- updatedAt : new Date ( ) ,
137- maxSessions : req . maxSessions ?? existing . maxSessions ,
138- bridgeId : req . bridgeId ?? existing . bridgeId ,
139- capabilities : req . capabilities ?? existing . capabilities ,
140- username : req . username ?? existing . username ,
141- } ) ;
142- return existing ;
143- }
144- }
145-
146113 const id = `env_${ uuid ( ) . replace ( / - / g, "" ) } ` ;
147114 const now = new Date ( ) ;
148115 const record : EnvironmentRecord = {
0 commit comments