@@ -5,7 +5,7 @@ let g:autoloaded_copilot_agent = 1
55
66scriptencoding utf- 8
77
8- let s: plugin_version = ' 1.3.1 '
8+ let s: plugin_version = ' 1.3.2 '
99
1010let s: error_exit = -1
1111
@@ -71,7 +71,7 @@ function! s:RequestAwait() dict abort
7171endfunction
7272
7373function s: RequestAgent () dict abort
74- return get (s: instances , self .agent_pid , v: null )
74+ return get (s: instances , self .agent_id , v: null )
7575endfunction
7676
7777if ! exists (' s:id' )
@@ -82,7 +82,7 @@ function! s:AgentRequest(method, params, ...) dict abort
8282 let request = {' method' : a: method , ' params' : a: params , ' id' : s: id }
8383 call s: Send (self , request)
8484 call extend (request, {
85- \ ' agent_pid ' : self .pid ,
85+ \ ' agent_id ' : self .id ,
8686 \ ' Agent' : function (' s:RequestAgent' ),
8787 \ ' Wait' : function (' s:RequestWait' ),
8888 \ ' Await' : function (' s:RequestAwait' ),
@@ -173,7 +173,7 @@ function! s:OnMessage(agent, body, ...) abort
173173 elseif has_key (a: agent .methods, response.method)
174174 call timer_start (0 , function (' s:DispatchMessage' , [a: agent , a: agent .methods[response.method], id, params]))
175175 else
176- return s: Send (a: agent , {" id" : id, " code" : -32700 , " message" : " Method not found: " . method})
176+ return s: Send (a: agent , {" id" : id, " error " : { " code" : -32700 , " message" : " Method not found: " . response. method} })
177177 endif
178178 return
179179 endif
@@ -257,7 +257,7 @@ function! s:OnExit(agent, code) abort
257257 let request.waiting[timer_start (0 , function (' s:Callback' , [request, ' error' , Cb]))] = 1
258258 endfor
259259 endfor
260- call timer_start (0 , { _ - > get (s: instances , a: agent .pid ) is # a: agent ? remove (s: instances , a: agent .pid ) : {} })
260+ call timer_start (0 , { _ - > get (s: instances , a: agent .id ) is # a: agent ? remove (s: instances , a: agent .id ) : {} })
261261 call copilot#logger#Info (' agent exited with status ' . a: code )
262262endfunction
263263
@@ -372,7 +372,7 @@ function! copilot#agent#New(...) abort
372372 \ }
373373 let [command , command_error] = s: Command ()
374374 if len (command_error)
375- let instance.pid = -1
375+ let instance.id = -1
376376 let instance.startup_error = command_error
377377 return instance
378378 endif
@@ -381,9 +381,9 @@ function! copilot#agent#New(...) abort
381381 \ function (' s:OnOut' , [instance, state ]),
382382 \ function (' s:OnErr' , [instance]),
383383 \ function (' s:OnExit' , [instance]))
384- let instance.pid = exists (' *jobpid' ) ? jobpid (instance.job) : job_info (instance.job).process
384+ let instance.id = exists (' *jobpid' ) ? jobpid (instance.job) : job_info (instance.job).process
385385 let request = instance.Request (' initialize' , {' capabilities' : {}}, function (' s:GetCapabilitiesResult' ), function (' s:GetCapabilitiesError' ), instance)
386- let s: instances [instance.pid ] = instance
386+ let s: instances [instance.id ] = instance
387387 return instance
388388endfunction
389389
0 commit comments