@@ -12,7 +12,6 @@ import (
1212 "time"
1313
1414 "github.com/bitrise-io/ai-qa-agent-cli/internal/codespaces"
15- codespacesv1 "github.com/bitrise-io/bitrise-codespaces/backend/proto/codespaces/v1"
1615 "github.com/spf13/cobra"
1716)
1817
@@ -199,11 +198,11 @@ func runSessionCreate(cmd *cobra.Command, _ []string) error {
199198 }
200199 inputs = ensureQAAgentInputs (inputs , createDeviceType , createIOSVersion , createXcodeVersion , createUploadDestination , createWatchTimeout , createWatchPoll )
201200
202- req := & codespacesv1 .CreateSessionRequest {
201+ req := & codespaces .CreateSessionRequest {
203202 Name : createName ,
204203 Description : createDescription ,
205- TemplateId : createTemplate ,
206- WorkspaceId : createWorkspace ,
204+ TemplateID : createTemplate ,
205+ WorkspaceID : createWorkspace ,
207206 SessionInputs : inputs ,
208207 EnabledFeatureFlagNames : createFeatureFlags ,
209208 Cluster : createCluster ,
@@ -227,40 +226,40 @@ func runSessionCreate(cmd *cobra.Command, _ []string) error {
227226 if err != nil {
228227 return fmt .Errorf ("CreateSession: %w" , err )
229228 }
230- fmt .Fprintf (os .Stderr , "created session %s (status: %s)\n " , session .GetId () , session .GetStatus () )
229+ fmt .Fprintf (os .Stderr , "created session %s (status: %s)\n " , session .ID , session .Status )
231230
232231 if createWait {
233- session , err = client .WaitForRunning (ctx , session .GetId () , createWorkspace , createPollInterval , func (s codespacesv1 .SessionStatus ) {
232+ session , err = client .WaitForRunning (ctx , session .ID , createWorkspace , createPollInterval , func (s codespaces .SessionStatus ) {
234233 fmt .Fprintf (os .Stderr , " status: %s\n " , s )
235234 })
236235 if err != nil {
237236 return err
238237 }
239238 }
240239
241- if createUpload != "" && session .GetStatus () == codespacesv1 . SessionStatus_SESSION_STATUS_RUNNING {
242- actualPath , err := client .UploadFile (ctx , session .GetId () , createWorkspace , createUpload , createUploadDestination )
240+ if createUpload != "" && session .Status == codespaces . SessionStatusRunning {
241+ actualPath , err := client .UploadFile (ctx , session .ID , createWorkspace , createUpload , createUploadDestination )
243242 if err != nil {
244243 return fmt .Errorf ("upload %s: %w" , createUpload , err )
245244 }
246245 fmt .Fprintf (os .Stderr , "uploaded %s -> %s\n " , createUpload , actualPath )
247246 }
248247
249- if createOpenRemoteAccess && session .GetStatus () == codespacesv1 . SessionStatus_SESSION_STATUS_RUNNING {
250- session , err = client .OpenRemoteAccess (ctx , session .GetId () , createWorkspace )
248+ if createOpenRemoteAccess && session .Status == codespaces . SessionStatusRunning {
249+ session , err = client .OpenRemoteAccess (ctx , session .ID , createWorkspace )
251250 if err != nil {
252251 return fmt .Errorf ("OpenRemoteAccess: %w" , err )
253252 }
254- fmt .Fprintf (os .Stderr , "ssh: %s (password: %s)\n " , session .GetSshAddress () , session .GetSshPassword () )
255- fmt .Fprintf (os .Stderr , "vnc: %s (user: %s, password: %s)\n " , session .GetVncAddress () , session .GetVncUsername () , session .GetVncPassword () )
253+ fmt .Fprintf (os .Stderr , "ssh: %s (password: %s)\n " , session .SSHAddress , session .SSHPassword )
254+ fmt .Fprintf (os .Stderr , "vnc: %s (user: %s, password: %s)\n " , session .VNCAddress , session .VNCUsername , session .VNCPassword )
256255 }
257256
258- fmt .Println (session .GetId () )
257+ fmt .Println (session .ID )
259258 if createUpload != "" {
260259 fmt .Fprintf (os .Stderr ,
261260 "\n When the QA run finishes, collect results + stop the VM with:\n " +
262261 " ai-qa-agent-cli session collect %s --workspace %s\n " ,
263- session .GetId () , createWorkspace )
262+ session .ID , createWorkspace )
264263 }
265264 return nil
266265}
@@ -303,16 +302,16 @@ func resolveUploadAndPrompt(uploadLocal, uploadDest, prompt string, isDefault bo
303302// injectQAPrompt appends the resolved QA prompt as a QA_PROMPT session input.
304303// Errors if the caller already supplied QA_PROMPT via --input / --secret-input
305304// / --saved-input — the dedicated --qa-prompt flag is the supported entry point.
306- func injectQAPrompt (inputs []* codespacesv1 .SessionInputValue , prompt string ) ([]* codespacesv1 .SessionInputValue , error ) {
305+ func injectQAPrompt (inputs []* codespaces .SessionInputValue , prompt string ) ([]* codespaces .SessionInputValue , error ) {
307306 if prompt == "" {
308307 return inputs , nil
309308 }
310309 for _ , in := range inputs {
311- if in .GetKey () == qaPromptInputKey {
310+ if in .Key == qaPromptInputKey {
312311 return nil , fmt .Errorf ("%s already supplied via --input/--secret-input/--saved-input; use --qa-prompt only" , qaPromptInputKey )
313312 }
314313 }
315- return append (inputs , & codespacesv1 .SessionInputValue {Key : qaPromptInputKey , Value : prompt }), nil
314+ return append (inputs , & codespaces .SessionInputValue {Key : qaPromptInputKey , Value : prompt }), nil
316315}
317316
318317// ensureQAAgentInputs forwards the QA Agent template's optional session
@@ -322,13 +321,13 @@ func injectQAPrompt(inputs []*codespacesv1.SessionInputValue, prompt string) ([]
322321// are skipped so the template's own defaults apply. Already-supplied inputs
323322// (via --input / --secret-input / --saved-input) win.
324323func ensureQAAgentInputs (
325- inputs []* codespacesv1 .SessionInputValue ,
324+ inputs []* codespaces .SessionInputValue ,
326325 deviceType , iosVersion , xcodeVersion , watchDir string ,
327326 watchTimeout , watchPoll time.Duration ,
328- ) []* codespacesv1 .SessionInputValue {
327+ ) []* codespaces .SessionInputValue {
329328 have := func (key string ) bool {
330329 for _ , in := range inputs {
331- if in .GetKey () == key {
330+ if in .Key == key {
332331 return true
333332 }
334333 }
@@ -338,7 +337,7 @@ func ensureQAAgentInputs(
338337 if val == "" || have (key ) {
339338 return
340339 }
341- inputs = append (inputs , & codespacesv1 .SessionInputValue {Key : key , Value : val })
340+ inputs = append (inputs , & codespaces .SessionInputValue {Key : key , Value : val })
342341 }
343342 add (deviceTypeInputKey , deviceType )
344343 add (iosVersionInputKey , iosVersion )
@@ -353,29 +352,29 @@ func ensureQAAgentInputs(
353352 return inputs
354353}
355354
356- func buildSessionInputs (plain , secret , saved []string ) ([]* codespacesv1 .SessionInputValue , error ) {
357- out := make ([]* codespacesv1 .SessionInputValue , 0 , len (plain )+ len (secret )+ len (saved ))
355+ func buildSessionInputs (plain , secret , saved []string ) ([]* codespaces .SessionInputValue , error ) {
356+ out := make ([]* codespaces .SessionInputValue , 0 , len (plain )+ len (secret )+ len (saved ))
358357
359358 for _ , kv := range plain {
360359 k , v , ok := strings .Cut (kv , "=" )
361360 if ! ok {
362361 return nil , fmt .Errorf ("--input %q: expected key=value" , kv )
363362 }
364- out = append (out , & codespacesv1 .SessionInputValue {Key : k , Value : v })
363+ out = append (out , & codespaces .SessionInputValue {Key : k , Value : v })
365364 }
366365 for _ , kv := range secret {
367366 k , v , ok := strings .Cut (kv , "=" )
368367 if ! ok {
369368 return nil , fmt .Errorf ("--secret-input %q: expected key=value" , kv )
370369 }
371- out = append (out , & codespacesv1 .SessionInputValue {Key : k , Value : v , IsSecret : true })
370+ out = append (out , & codespaces .SessionInputValue {Key : k , Value : v , IsSecret : true })
372371 }
373372 for _ , kv := range saved {
374373 k , id , ok := strings .Cut (kv , "=" )
375374 if ! ok {
376375 return nil , fmt .Errorf ("--saved-input %q: expected key=savedInputID" , kv )
377376 }
378- out = append (out , & codespacesv1 .SessionInputValue {Key : k , SavedInputId : id })
377+ out = append (out , & codespaces .SessionInputValue {Key : k , SavedInputID : id })
379378 }
380379 return out , nil
381380}
0 commit comments