workspace

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package workspace retains logical organization independently of the records it groups. A membership neither moves a conversation nor grants control of it.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid  = errors.New("invalid collection or reference")
	ErrNotFound = errors.New("collection not found")
	ErrCycle    = errors.New("collection membership would form a cycle")
	// ErrBusy is a lock this store waited busyTimeout for and did not get. It is
	// not corruption and not a refusal: another command is still writing, so
	// this command left the collections database unchanged and can be retried.
	ErrBusy = errors.New("the collections database is busy being written by something else")
)

Functions

func ValidateName

func ValidateName(name string) error

ValidateName lets command adapters reject malformed requests before opening durable storage. Create and Rename enforce the same rule at the write boundary.

Types

type Collection

type Collection struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Kind

type Kind string
const (
	CollectionKind   Kind = "collection"
	ConversationKind Kind = "conversation"
	TaskKind         Kind = "task"
	StandingKind     Kind = "standing"
	ArtifactKind     Kind = "artifact"
)

type Ref

type Ref struct {
	Kind      Kind   `json:"kind"`
	ID        string `json:"id"`
	SessionID string `json:"session_id,omitempty"`
}

Ref preserves the address used by the existing record owner. TASK NUMBERS ARE LOCAL TO A CONVERSATION, so their session is part of their identity. Artifact IDs are absolute paths, not claims of permanent content identity.

func (Ref) Validate

func (r Ref) Validate() error

Validate checks the reference shape without asking an execution owner to open it. A temporarily unavailable record must remain discoverable here.

type Store

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

Store owns collection metadata only. Transcripts, task checkpoints, standing items and artifacts retain their existing owners and persistence formats.

THE SCHEMA IS BUILT BY THE FIRST WRITE THAT NEEDS IT, never by Open. Opening is also how `list`, `show` and `find` reach the file, and a read that built a schema would write to a database nobody asked to change and take the writer lock to do it — which is what put a plain read behind whichever peer happened to be adding a membership. `ready` is that question already answered, and `schemaMu` keeps two goroutines on one handle from both answering it.

func Open

func Open(path string) (*Store, error)

Open creates a private collection store or checks an existing one. Unknown databases fail explicitly; they must never be interpreted as empty state.

func (*Store) Add

func (s *Store) Add(ctx context.Context, id string, ref Ref) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) Collections

func (s *Store) Collections(ctx context.Context) ([]Collection, error)

func (*Store) CollectionsFor

func (s *Store) CollectionsFor(ctx context.Context, ref Ref) ([]Collection, error)

func (*Store) Create

func (s *Store) Create(ctx context.Context, name string) (Collection, error)

func (*Store) Members

func (s *Store) Members(ctx context.Context, id string) ([]Ref, error)

func (*Store) Remove

func (s *Store) Remove(ctx context.Context, id string, ref Ref) error

Remove detaches a reference; it never removes or stops the referenced work.

func (*Store) Rename

func (s *Store) Rename(ctx context.Context, id, name string) error

Jump to

Keyboard shortcuts

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