05ae530442
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers. Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent. Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
84 lines
3.0 KiB
Go
84 lines
3.0 KiB
Go
package harness
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"strings"
|
|
)
|
|
|
|
// Onboarding renders the styled, non-interactive presentation for
|
|
// `pipelines harness setup`. It shares the picker's style vocabulary, performs no
|
|
// inference or network access, and is used by both fresh setup and reconfiguration
|
|
// so the two paths never duplicate presentation logic.
|
|
type Onboarding struct {
|
|
out io.Writer
|
|
plain bool
|
|
}
|
|
|
|
func NewOnboarding(out io.Writer) Onboarding {
|
|
return Onboarding{out: out, plain: plainOutput() || !isTerminal(out)}
|
|
}
|
|
|
|
func (o Onboarding) styles() pickerStyles { return pickerStyles{plain: o.plain} }
|
|
|
|
// Header introduces a harness configuration session.
|
|
func (o Onboarding) Header(name, action string) {
|
|
s := o.styles()
|
|
fmt.Fprintln(o.out)
|
|
fmt.Fprintln(o.out, s.title("Pipelines harness setup"))
|
|
fmt.Fprintln(o.out, s.muted(action+" · "+DisplayName(name)))
|
|
fmt.Fprintln(o.out)
|
|
}
|
|
|
|
// Versions prints the Docker harness versions already verified by the single
|
|
// in-image probe, so setup never runs another subprocess just to show them.
|
|
func (o Onboarding) Versions(versions string) {
|
|
if strings.TrimSpace(versions) == "" {
|
|
return
|
|
}
|
|
fmt.Fprintf(o.out, "%s %s\n\n", o.styles().muted("Docker image harnesses:"), versions)
|
|
}
|
|
|
|
// AuthHandoff explains exactly how Pi's in-session sign-in works. Pi has no
|
|
// standalone `auth login` command, so we open a fresh, no-context,
|
|
// extension-free, no-tools session and never inject a coding/task prompt or
|
|
// scripted keys. The copy is deliberately a few short lines so the Pipelines
|
|
// header and this handoff stay visible above Pi's regular interface at 80x30;
|
|
// it names Pi's real authentication-method step and exit keys, notes that
|
|
// existing sign-ins can be reused in the Docker volume, and makes the API-key
|
|
// choice conditional on using provider API credentials.
|
|
func (o Onboarding) AuthHandoff() {
|
|
s := o.styles()
|
|
fmt.Fprintln(o.out, s.title("Pi sign-in"))
|
|
for _, line := range []string{
|
|
"Existing credentials stay; exit to reuse them. Type /login.",
|
|
"Choose an authentication method (account/API key/Radius).",
|
|
"Finish provider sign-in (API: \"Sign in with an API key\"); exit ctrl+c/ctrl+d.",
|
|
} {
|
|
fmt.Fprintln(o.out, s.muted(line))
|
|
}
|
|
}
|
|
|
|
// Summary reports the saved choices without implying inference.
|
|
func (o Onboarding) Summary(name, harnessModel, pipelineModel, defaultHarness string) {
|
|
s := o.styles()
|
|
fmt.Fprintln(o.out)
|
|
fmt.Fprintln(o.out, s.title("Configuration complete"))
|
|
fmt.Fprintf(o.out, " %s %s\n", s.muted("Interactive "+DisplayName(name)+" model:"), s.step(harnessModel))
|
|
fmt.Fprintf(o.out, " %s %s\n", s.muted("New "+DisplayName(name)+" pipeline model:"), s.step(pipelineModel))
|
|
fmt.Fprintf(o.out, " %s %s\n", s.muted("Default harness:"), s.step(defaultHarness))
|
|
fmt.Fprintln(o.out, s.muted(" No inference was performed; published workflows and drafts were not rewritten."))
|
|
}
|
|
|
|
// DisplayName returns the human-facing name of a configured harness.
|
|
func DisplayName(name string) string {
|
|
switch name {
|
|
case "opencode":
|
|
return "OpenCode"
|
|
case "pi":
|
|
return "Pi"
|
|
default:
|
|
return name
|
|
}
|
|
}
|