projectsync

package
v0.1.55 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package projectsync synchronizes preserved project replicas. Immutable, content-addressed checkpoints are the common base; no source is ever moved, reset, or deleted. Imports use a durable journal and the registry's path gates.

Index

Constants

View Source
const ChunkSize = 256 << 10
View Source
const Version = 2

Variables

This section is empty.

Functions

func NormalizeIncludes

func NormalizeIncludes(paths []string) ([]string, error)

Literal, portable relative paths. These are not shell arguments or glob rules.

func ProtocolVersion

func ProtocolVersion() int

Directory fsync and native file replacement currently have end-to-end support on macOS and Linux. Other hosts must not advertise a durability guarantee.

Types

type Chat

type Chat struct {
	ID             string   `json:"id"` // shared logical chat ID, never a workspace-local cache ID
	Harness        string   `json:"harness"`
	ProfileName    string   `json:"profileName"`
	Title          string   `json:"title"`
	NativeTitle    string   `json:"nativeTitle,omitempty"`
	TitleIsUserSet bool     `json:"titleIsUserSet,omitempty"`
	CreatedAt      string   `json:"createdAt"`
	UpdatedAt      string   `json:"updatedAt,omitempty"`
	SessionID      string   `json:"sessionId,omitempty"`
	ArchiveVersion int      `json:"archiveVersion"`
	NativeFiles    []string `json:"nativeFiles,omitempty"` // keys in Manifest.Entries
}

type Checkpoint

type Checkpoint struct {
	ID          string   `json:"id"`
	ProjectID   string   `json:"projectId"`
	Parents     []string `json:"parents"`
	Manifest    Entry    `json:"manifest"`
	ObjectCount int      `json:"objectCount"`
	Bytes       int64    `json:"bytes"`
}

type Conflict

type Conflict struct {
	Path    string `json:"path"`
	Kind    string `json:"kind"` // file, conversation, git, recovery
	Message string `json:"message"`
}

type Entry

type Entry struct {
	Kind      string   `json:"kind"` // file, directory, symlink
	Mode      uint32   `json:"mode"`
	Size      int64    `json:"size"`
	Chunks    []string `json:"chunks,omitempty"`
	Link      string   `json:"link,omitempty"`
	JSONLines bool     `json:"jsonLines,omitempty"`
}

type Git

type Git struct {
	Head   string            `json:"head"` // symbolic ref or detached object ID
	Refs   map[string]string `json:"refs"`
	Index  map[string]Entry  `json:"index"`            // staged blobs, independently of working files
	Bundle *Entry            `json:"bundle,omitempty"` // reachable local commits, including unpushed work
}

type IgnoredPath

type IgnoredPath struct {
	Path     string `json:"path"`
	Kind     string `json:"kind"`
	Included bool   `json:"included"`
}

type Manifest

type Manifest struct {
	Version   int                        `json:"version"`
	ProjectID string                     `json:"projectId"` // logical identity
	Name      string                     `json:"name"`
	RepoURL   string                     `json:"repoUrl,omitempty"`
	IconPath  *string                    `json:"iconPath,omitempty"`
	CreatedAt string                     `json:"createdAt"`
	Parents   []string                   `json:"parents"`
	Entries   map[string]Entry           `json:"entries"` // files/, native/<harness>/, records/<logical chat>
	Chats     map[string]Chat            `json:"chats"`
	Artifacts map[string]artifact.Record `json:"artifacts,omitempty"`
	Git       *Git                       `json:"git,omitempty"`
	// Excluded paths are outside this checkpoint's file scope, never deletions.
	Excluded []string `json:"excluded,omitempty"`
	// A filtered historical checkpoint retains its original merge identity.
	Origin string `json:"origin,omitempty"`
}

type ObjectPage

type ObjectPage struct {
	Objects []string `json:"objects"`
	Next    int      `json:"next,omitempty"`
}

type Operation

type Operation struct {
	Request
	Kind                 string     `json:"kind"`
	Status               string     `json:"status"`
	Phase                string     `json:"phase"`
	Progress             float64    `json:"progress"`
	ResultProjectID      string     `json:"resultProjectId,omitempty"`
	ResultCheckpointID   string     `json:"resultCheckpointId,omitempty"`
	RecoveryCheckpointID string     `json:"recoveryCheckpointId,omitempty"`
	Conflicts            []Conflict `json:"conflicts,omitempty"`
	Error                string     `json:"error,omitempty"`
	CreatedAt            string     `json:"createdAt"`
	UpdatedAt            string     `json:"updatedAt"`
}

func (Operation) Active

func (o Operation) Active() bool

type Preview

type Preview struct {
	Version        int           `json:"version"`
	FileCount      int           `json:"fileCount"`
	Bytes          int64         `json:"bytes"` // working files only; Git history/chats are additional
	IgnoredCount   int           `json:"ignoredCount"`
	Ignored        []IgnoredPath `json:"ignored"`
	IncludeIgnored []string      `json:"includeIgnored"`
	Next           int           `json:"next,omitempty"`
	SelectionToken string        `json:"selectionToken"`
}

type PreviewRequest

type PreviewRequest struct {
	ProjectID      string   `json:"projectId"`
	IncludeIgnored []string `json:"includeIgnored,omitempty"`
	Cursor         int      `json:"cursor,omitempty"`
}

type Request

type Request struct {
	ID             string   `json:"id"`                       // idempotency key, retained across retries/disconnects
	ProjectID      string   `json:"projectId,omitempty"`      // local project, for export
	CheckpointID   string   `json:"checkpointId,omitempty"`   // incoming checkpoint, for import
	Path           string   `json:"path,omitempty"`           // needed only when this workspace has no replica
	IncludeIgnored []string `json:"includeIgnored,omitempty"` // explicit project-relative Git-ignore overrides
	SelectionToken string   `json:"selectionToken,omitempty"` // binds an optional preview to its reviewed scope
}

type Resource

type Resource struct {
	Harness   string `json:"harness"`
	SessionID string `json:"sessionId"`
	Name      string `json:"name"`
}

type RunGuard

type RunGuard interface {
	Busy(string) bool
	BusyPath(string) bool
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(reg *registry.Store, store *session.Store, runs RunGuard, gate *sync.Mutex, adapters []agent.Adapter, discover func(context.Context, string) error) (*Service, error)

func (*Service) AcceptCheckpoint

func (s *Service) AcceptCheckpoint(ctx context.Context, c Checkpoint) error

func (*Service) ActiveCount

func (s *Service) ActiveCount() int

func (*Service) Cancel

func (s *Service) Cancel(id string) (Operation, error)

func (*Service) Checkpoint

func (s *Service) Checkpoint(id string) (Checkpoint, error)

func (*Service) Close

func (s *Service) Close()

func (*Service) Get

func (s *Service) Get(id string) (Operation, error)

func (*Service) GetObject

func (s *Service) GetObject(id string) ([]byte, error)

func (*Service) List

func (s *Service) List() ([]Operation, error)

func (*Service) Missing

func (s *Service) Missing(ids []string) ([]string, error)

func (*Service) Objects

func (s *Service) Objects(id string, cursor int) (ObjectPage, error)

func (*Service) Preview

func (s *Service) Preview(ctx context.Context, req PreviewRequest) (Preview, error)

func (*Service) PutObject

func (s *Service) PutObject(id string, b []byte) error

func (*Service) Retry

func (s *Service) Retry(id string) (Operation, error)

func (*Service) Start

func (s *Service) Start(kind string, req Request) (Operation, error)

func (*Service) Wait

func (s *Service) Wait(ctx context.Context, id string) (Operation, error)

type Write

type Write struct {
	Path     string    `json:"path"`
	Before   *Entry    `json:"before,omitempty"`
	After    *Entry    `json:"after,omitempty"`
	CWD      string    `json:"cwd,omitempty"`
	Private  bool      `json:"private,omitempty"`
	Resource *Resource `json:"resource,omitempty"`
}

Recovery journal owns only changed paths. Expected and desired content are immutable objects, so interrupted writes are replayable without a hard reset.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL