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
34 lines
822 B
Go
34 lines
822 B
Go
package agentextension
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
const setupDiscoveryRelativeDir = "agent/discovery/agent-extensions"
|
|
|
|
type FileSetupDiscoveryDirectory struct {
|
|
stateDir string
|
|
}
|
|
|
|
func NewFileSetupDiscoveryDirectory(stateDir string) *FileSetupDiscoveryDirectory {
|
|
return &FileSetupDiscoveryDirectory{stateDir: strings.TrimSpace(stateDir)}
|
|
}
|
|
|
|
func (d *FileSetupDiscoveryDirectory) Ensure(ctx context.Context) (string, error) {
|
|
if err := ctx.Err(); err != nil {
|
|
return "", err
|
|
}
|
|
if d == nil || d.stateDir == "" {
|
|
return "", errors.New("agent extension setup discovery state directory is required")
|
|
}
|
|
root := filepath.Join(d.stateDir, filepath.FromSlash(setupDiscoveryRelativeDir))
|
|
if err := os.MkdirAll(root, 0o700); err != nil {
|
|
return "", err
|
|
}
|
|
return root, nil
|
|
}
|