review: remove slot change-agent action · Entire
review: remove slot change-agent action
f172912→main·
dipree·3w ago·2 files·+36 added/-46 removed
Sessions
1660a0f585ffView transcript
[?
Checkout the hand off doc that I just added.Pi·Opus 4.8·1 step](/content/gh/entireio/cli/session/019eca64-8c2c-7b00-90c6-3aa49738c497#timeline-1660a0f585ff/index.html)
Changes
2
cmd/entire/cli/review
Mpicker.go+16/-46
Mpicker_internal_test.go+20
371 unmodified lines
373
374
375
375
376
377
378
379
380
381
382
383
384
385
380
381
382
10 unmodified lines
393
394
395
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
396
397
398
399
44 unmodified lines
444
445
446
472
473
474
475
476
477
478
479
480
481
447
448
449
450
451
7 unmodified lines
459
460
461
462
463
464
465
466
467
468
469
470
471
472
2 unmodified lines
475
476
477
503
504
505
506
478
479
480
481
482
483
10 unmodified lines
494
495
496
523
524
525
526
497
498
529
499
500
501
502
371 unmodified lines
if convErr != nil || idx < 0 || idx >= len(slots) {
continue
}
action, err := promptSlotAction(ctx, slots[idx], len(candidates) > 1)
action, err := promptSlotAction(ctx, slots[idx])
if err != nil {
return nil, err
}
switch action {
case "agent":
slot, err := promptChangeAgent(ctx, candidates, slots[idx])
if err != nil {
return nil, err
}
slots[idx] = slot
case "model":
slot, err := promptChangeModel(ctx, slots[idx])
if err != nil {
10 unmodified lines
// promptCrewSlot prompts for one reviewer slot: agent plus model. seed
// pre-selects the current agent/model when editing (zero value when adding).
func promptCrewSlot(ctx context.Context, launchable []string, seed crewSlot) (crewSlot, error) {
agentName, err := promptCrewAgent(ctx, launchable, seed.agent, false)
if err != nil {
return crewSlot{}, err
}
seedModel := ""
if agentName == seed.agent {
seedModel = seed.model
}
model, err := promptCrewModel(ctx, agentName, seedModel)
if err != nil {
return crewSlot{}, err
}
return crewSlot{agent: agentName, model: model}, nil
}
// promptChangeAgent swaps the agent on an existing reviewer slot and then asks
// for that agent's model. Keeping the same agent preserves the current model as
// the preselected value.
func promptChangeAgent(ctx context.Context, candidates []string, seed crewSlot) (crewSlot, error) {
agentName, err := promptCrewAgent(ctx, candidates, seed.agent, true)
agentName, err := promptCrewAgent(ctx, launchable, seed.agent)
if err != nil {
return crewSlot{}, err
}
44 unmodified lines
}
// promptSlotAction asks what to do with an existing reviewer slot row.
func promptSlotAction(ctx context.Context, slot crewSlot, allowAgentChange bool) (string, error) {
options := make([]huh.Option[string], 0, 4)
if allowAgentChange {
opptions = append(options, huh.NewOption("Change agent", "agent"))
}
options = append(options,
huh.NewOption("Change model", "model"),
huh.NewOption("Remove", "remove"),
huh.NewOption("Cancel", "cancel"),
)
func promptSlotAction(ctx context.Context, slot crewSlot) (string, error) {
options := slotActionOptions()
picked := "cancel"
form := newAccessibleForm(huh.NewGroup(
huh.NewSelect[string]().
7 unmodified lines
return picked, nil
}
func slotActionOptions() []huh.Option[string] {
return []huh.Option[string]{
huh.NewOption("Change model", "model"),
huh.NewOption("Remove", "remove"),
huh.NewOption("Cancel", "cancel"),
}
}
func slotLabel(s crewSlot) string {
// Surface the model when one was set explicitly.
if model := strings.TrimSpace(s.model); model != "" {
2 unmodified lines
return labelForSimpleAgent(s.agent)
}
// promptCrewAgent picks the agent for a slot. Auto-selects when only one
// launchable agent exists. editing tailors the title for changing an existing
// slot's agent versus choosing one for a brand-new slot.
func promptCrewAgent(ctx context.Context, launchable []string, seedAgent string, editing bool) (string, error) {
// promptCrewAgent picks the agent for a new slot. Auto-selects when only one
// launchable agent exists.
func promptCrewAgent(ctx context.Context, launchable []string, seedAgent string) (string, error) {
if len(launchable) == 1 {
return launchable[0], nil
}
10 unmodified lines
}
}
}
title := "Add a slot: which agent?"
if editing {
title = "Change agent"
}
form := newAccessibleForm(huh.NewGroup(
huh.NewSelect[string]().
.Title(title).
.Title("Add a slot: which agent?").
.Options(options...).
.Height(reviewPickerHeight(len(options))).
.Value(&picked),