Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
57 lines
1.5 KiB
Go
57 lines
1.5 KiB
Go
package agentstatus
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
agentruntime "github.com/tutti-os/tutti/packages/agent/daemon/runtime"
|
|
)
|
|
|
|
type CodexAuthProbeEvidence struct {
|
|
State agentruntime.CodexAppServerAccountState
|
|
AccountLabel string
|
|
AuthMethod string
|
|
}
|
|
|
|
func (s Service) probeCodexAuth(
|
|
ctx context.Context,
|
|
command []string,
|
|
env []string,
|
|
timeout time.Duration,
|
|
) CodexAuthProbeEvidence {
|
|
if s.CodexAuthProbe != nil {
|
|
return s.CodexAuthProbe(ctx, append([]string(nil), command...), append([]string(nil), env...))
|
|
}
|
|
result := agentruntime.ProbeCodexAppServer(ctx, agentruntime.CodexAppServerProbeInput{
|
|
Command: command,
|
|
Env: env,
|
|
Host: agentruntime.HostMetadata{ClientInfo: agentruntime.ClientInfo{
|
|
Name: "tutti-desktop", Title: "Tutti", Version: "0.1.0",
|
|
}},
|
|
ReadAccount: true,
|
|
StartupTimeout: timeout,
|
|
HandshakeTimeout: timeout,
|
|
ShutdownTimeout: s.probeReadyAfter(),
|
|
})
|
|
return CodexAuthProbeEvidence{
|
|
State: result.AccountState,
|
|
AccountLabel: result.AccountLabel,
|
|
AuthMethod: result.AuthMethod,
|
|
}
|
|
}
|
|
|
|
func authInfoFromCodexProbe(evidence CodexAuthProbeEvidence) AuthInfo {
|
|
switch evidence.State {
|
|
case agentruntime.CodexAppServerAccountAuthenticated:
|
|
return AuthInfo{
|
|
Status: AuthAuthenticated,
|
|
AccountLabel: evidence.AccountLabel,
|
|
AuthMethod: evidence.AuthMethod,
|
|
}
|
|
case agentruntime.CodexAppServerAccountRequired:
|
|
return AuthInfo{Status: AuthRequired}
|
|
default:
|
|
return AuthInfo{Status: AuthUnknown}
|
|
}
|
|
}
|