feat: Add mol_type schema field for molecule type classification (bd-oxgi)
Add mol_type field to beads for swarm coordination: - Values: 'swarm' (multi-polecat), 'patrol' (recurring ops), 'work' (default) - Nullable, defaults to empty string (treated as 'work') Changes: - Add mol_type column to SQLite schema and migration 031 - Add MolType type with IsValid() validation in types.go - Update insertIssue/GetIssue to handle mol_type - Add --mol-type flag to create command - Add mol_type filtering to list and ready commands - Update RPC protocol for daemon mode support - Update test schema in migrations_test.go 🤝 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -279,6 +279,8 @@ func (s *SQLiteStorage) GetIssue(ctx context.Context, id string) (*types.Issue,
|
||||
var lastActivity sql.NullTime
|
||||
var roleType sql.NullString
|
||||
var rig sql.NullString
|
||||
// Molecule type field
|
||||
var molType sql.NullString
|
||||
|
||||
var contentHash sql.NullString
|
||||
var compactedAtCommit sql.NullString
|
||||
@@ -290,7 +292,7 @@ func (s *SQLiteStorage) GetIssue(ctx context.Context, id string) (*types.Issue,
|
||||
deleted_at, deleted_by, delete_reason, original_type,
|
||||
sender, ephemeral, pinned, is_template,
|
||||
await_type, await_id, timeout_ns, waiters,
|
||||
hook_bead, role_bead, agent_state, last_activity, role_type, rig
|
||||
hook_bead, role_bead, agent_state, last_activity, role_type, rig, mol_type
|
||||
FROM issues
|
||||
WHERE id = ?
|
||||
`, id).Scan(
|
||||
@@ -302,7 +304,7 @@ func (s *SQLiteStorage) GetIssue(ctx context.Context, id string) (*types.Issue,
|
||||
&deletedAt, &deletedBy, &deleteReason, &originalType,
|
||||
&sender, &wisp, &pinned, &isTemplate,
|
||||
&awaitType, &awaitID, &timeoutNs, &waiters,
|
||||
&hookBead, &roleBead, &agentState, &lastActivity, &roleType, &rig,
|
||||
&hookBead, &roleBead, &agentState, &lastActivity, &roleType, &rig, &molType,
|
||||
)
|
||||
|
||||
if err == sql.ErrNoRows {
|
||||
@@ -400,6 +402,10 @@ func (s *SQLiteStorage) GetIssue(ctx context.Context, id string) (*types.Issue,
|
||||
if rig.Valid {
|
||||
issue.Rig = rig.String
|
||||
}
|
||||
// Molecule type field
|
||||
if molType.Valid {
|
||||
issue.MolType = types.MolType(molType.String)
|
||||
}
|
||||
|
||||
// Fetch labels for this issue
|
||||
labels, err := s.GetLabels(ctx, issue.ID)
|
||||
@@ -652,6 +658,8 @@ var allowedUpdateFields = map[string]bool{
|
||||
"last_activity": true,
|
||||
"role_type": true,
|
||||
"rig": true,
|
||||
// Molecule type field
|
||||
"mol_type": true,
|
||||
}
|
||||
|
||||
// validatePriority validates a priority value
|
||||
@@ -1719,6 +1727,12 @@ func (s *SQLiteStorage) SearchIssues(ctx context.Context, query string, filter t
|
||||
args = append(args, *filter.ParentID)
|
||||
}
|
||||
|
||||
// Molecule type filtering
|
||||
if filter.MolType != nil {
|
||||
whereClauses = append(whereClauses, "mol_type = ?")
|
||||
args = append(args, string(*filter.MolType))
|
||||
}
|
||||
|
||||
whereSQL := ""
|
||||
if len(whereClauses) > 0 {
|
||||
whereSQL = "WHERE " + strings.Join(whereClauses, " AND ")
|
||||
|
||||
Reference in New Issue
Block a user