Documentation
¶
Index ¶
- Variables
- type Chronicler
- type Contribution
- type ContributionTracker
- func (t *ContributionTracker) Get(workspaceID, did string) *Contribution
- func (t *ContributionTracker) List(workspaceID string) []*Contribution
- func (t *ContributionTracker) RecordCommit(workspaceID, did string, codeBytes int64)
- func (t *ContributionTracker) RecordMessage(workspaceID, did string)
- func (t *ContributionTracker) Remove(workspaceID string)
- type CreateRequest
- type GossipConfig
- type Manager
- func (m *Manager) Activate(ctx context.Context, workspaceID string) error
- func (m *Manager) AddMember(ctx context.Context, workspaceID string, member *Member) error
- func (m *Manager) Archive(ctx context.Context, workspaceID string) error
- func (m *Manager) Create(ctx context.Context, req CreateRequest) (*Workspace, error)
- func (m *Manager) Get(ctx context.Context, workspaceID string) (*Workspace, error)
- func (m *Manager) Join(ctx context.Context, workspaceID string) error
- func (m *Manager) Leave(ctx context.Context, workspaceID string) error
- func (m *Manager) List(ctx context.Context) ([]*Workspace, error)
- func (m *Manager) Post(ctx context.Context, workspaceID string, msg Message) error
- func (m *Manager) Read(ctx context.Context, workspaceID string, opts ReadOptions) ([]Message, error)
- type ManagerConfig
- type Member
- type Message
- type MessageHandler
- type MessageType
- type ReadOptions
- type Role
- type Status
- type Triple
- type TripleAdder
- type Workspace
- type WorkspaceGossip
- func (g *WorkspaceGossip) Publish(ctx context.Context, workspaceID string, msg Message) error
- func (g *WorkspaceGossip) Stop()
- func (g *WorkspaceGossip) Subscribe(workspaceID string) error
- func (g *WorkspaceGossip) SubscribedWorkspaces() []string
- func (g *WorkspaceGossip) Unsubscribe(workspaceID string)
Constants ¶
This section is empty.
Variables ¶
var (
ErrWorkspaceNotFound = errors.New("workspace not found")
)
Functions ¶
This section is empty.
Types ¶
type Chronicler ¶
type Chronicler struct {
// contains filtered or unexported fields
}
Chronicler persists workspace messages as triples in the graph store.
func NewChronicler ¶
func NewChronicler(adder TripleAdder, logger *zap.SugaredLogger) *Chronicler
NewChronicler creates a new message chronicler.
func (*Chronicler) HandleMessage ¶
func (c *Chronicler) HandleMessage(msg Message)
HandleMessage is a MessageHandler that records messages via the chronicler.
type Contribution ¶
type Contribution struct {
DID string `json:"did"`
Commits int `json:"commits"`
CodeBytes int64 `json:"codeBytes"`
Messages int `json:"messages"`
LastActive time.Time `json:"lastActive"`
}
Contribution records a member's contribution to a workspace.
type ContributionTracker ¶
type ContributionTracker struct {
// contains filtered or unexported fields
}
ContributionTracker tracks contributions per member per workspace.
func NewContributionTracker ¶
func NewContributionTracker() *ContributionTracker
NewContributionTracker creates a new contribution tracker.
func (*ContributionTracker) Get ¶
func (t *ContributionTracker) Get(workspaceID, did string) *Contribution
Get returns the contribution for a member in a workspace.
func (*ContributionTracker) List ¶
func (t *ContributionTracker) List(workspaceID string) []*Contribution
List returns all contributions for a workspace.
func (*ContributionTracker) RecordCommit ¶
func (t *ContributionTracker) RecordCommit(workspaceID, did string, codeBytes int64)
RecordCommit records a commit contribution.
func (*ContributionTracker) RecordMessage ¶
func (t *ContributionTracker) RecordMessage(workspaceID, did string)
RecordMessage records a message contribution.
func (*ContributionTracker) Remove ¶
func (t *ContributionTracker) Remove(workspaceID string)
Remove deletes all contribution data for a workspace.
type CreateRequest ¶
type CreateRequest struct {
Name string `json:"name"`
Goal string `json:"goal"`
Metadata map[string]string `json:"metadata,omitempty"`
}
CreateRequest holds parameters for creating a new workspace.
type GossipConfig ¶
type GossipConfig struct {
PubSub *pubsub.PubSub
LocalID peer.ID
Handler MessageHandler
Logger *zap.SugaredLogger
}
GossipConfig configures the workspace gossip.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages workspace lifecycle with BoltDB persistence.
func NewManager ¶
func NewManager(cfg ManagerConfig) (*Manager, error)
NewManager creates a new workspace manager.
type ManagerConfig ¶
type ManagerConfig struct {
DB *bolt.DB
LocalDID string
MaxWorkspaces int
Logger *zap.SugaredLogger
}
ManagerConfig configures the WorkspaceManager.
type Member ¶
type Member struct {
DID string `json:"did"`
Name string `json:"name,omitempty"`
Role Role `json:"role"`
JoinedAt time.Time `json:"joinedAt"`
}
Member represents a participant in a workspace.
type Message ¶
type Message struct {
ID string `json:"id"`
Type MessageType `json:"type"`
WorkspaceID string `json:"workspaceId"`
SenderDID string `json:"senderDid"`
Content string `json:"content"`
Metadata map[string]string `json:"metadata,omitempty"`
ParentID string `json:"parentId,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
Message represents a message posted to a workspace.
type MessageHandler ¶
type MessageHandler func(msg Message)
MessageHandler is called when a workspace message is received via GossipSub.
type MessageType ¶
type MessageType string
MessageType identifies the kind of workspace message.
const ( MessageTypeTaskProposal MessageType = "TASK_PROPOSAL" MessageTypeLogStream MessageType = "LOG_STREAM" MessageTypeCommitSignal MessageType = "COMMIT_SIGNAL" MessageTypeMemberJoined MessageType = "MEMBER_JOINED" MessageTypeMemberLeft MessageType = "MEMBER_LEFT" // Conflict and branch collaboration message types. MessageTypeConflictReport MessageType = "CONFLICT_REPORT" MessageTypeBranchCreated MessageType = "BRANCH_CREATED" MessageTypeBranchMerged MessageType = "BRANCH_MERGED" MessageTypeSyncRequest MessageType = "SYNC_REQUEST" )
type ReadOptions ¶
type ReadOptions struct {
Limit int `json:"limit,omitempty"`
Before time.Time `json:"before,omitempty"`
After time.Time `json:"after,omitempty"`
SenderDID string `json:"senderDID,omitempty"`
Types []string `json:"types,omitempty"`
ParentID string `json:"parentID,omitempty"`
}
ReadOptions controls workspace message listing.
type TripleAdder ¶
TripleAdder persists triples to a graph store.
type Workspace ¶
type Workspace struct {
ID string `json:"id"`
Name string `json:"name"`
Goal string `json:"goal"`
Status Status `json:"status"`
Members []*Member `json:"members"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Metadata map[string]string `json:"metadata,omitempty"`
}
Workspace represents a collaborative workspace where agents share code and messages.
type WorkspaceGossip ¶
type WorkspaceGossip struct {
// contains filtered or unexported fields
}
WorkspaceGossip manages per-workspace GossipSub topics.
func NewWorkspaceGossip ¶
func NewWorkspaceGossip(cfg GossipConfig) *WorkspaceGossip
NewWorkspaceGossip creates a new workspace gossip manager.
func (*WorkspaceGossip) Stop ¶
func (g *WorkspaceGossip) Stop()
Stop unsubscribes from all workspace topics.
func (*WorkspaceGossip) Subscribe ¶
func (g *WorkspaceGossip) Subscribe(workspaceID string) error
Subscribe joins the GossipSub topic for a workspace and starts listening.
func (*WorkspaceGossip) SubscribedWorkspaces ¶
func (g *WorkspaceGossip) SubscribedWorkspaces() []string
SubscribedWorkspaces returns the list of workspace IDs currently subscribed.
func (*WorkspaceGossip) Unsubscribe ¶
func (g *WorkspaceGossip) Unsubscribe(workspaceID string)
Unsubscribe leaves the GossipSub topic for a workspace.