Implement comprehensive collaborative creative system with cross-character memory sharing
Major Features Added: • Cross-character memory sharing with trust-based permissions (Basic 30%, Personal 50%, Intimate 70%, Full 90%) • Complete collaborative creative projects system with MCP integration • Database persistence for all creative project data with proper migrations • Trust evolution system based on interaction quality and relationship development • Memory sharing MCP server with 6 autonomous tools for character decision-making • Creative projects MCP server with 8 tools for autonomous project management • Enhanced character integration with all RAG and MCP capabilities • Demo scripts showcasing memory sharing and creative collaboration workflows System Integration: • Main application now initializes memory sharing and creative managers • Conversation engine upgraded to use EnhancedCharacter objects with full RAG access • Database models added for creative projects, collaborators, contributions, and invitations • Complete prompt construction pipeline enriched with RAG insights and trust data • Characters can now autonomously propose projects, share memories, and collaborate creatively
This commit is contained in:
96
migrations/versions/004_add_creative_projects.py
Normal file
96
migrations/versions/004_add_creative_projects.py
Normal file
@@ -0,0 +1,96 @@
|
||||
"""Add creative projects tables
|
||||
|
||||
Revision ID: 004
|
||||
Revises: 003
|
||||
Create Date: 2024-12-20 12:00:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers
|
||||
revision = '004'
|
||||
down_revision = '003'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
def upgrade():
|
||||
# Create creative_projects table
|
||||
op.create_table('creative_projects',
|
||||
sa.Column('id', sa.String(255), primary_key=True, index=True),
|
||||
sa.Column('title', sa.String(200), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=False),
|
||||
sa.Column('project_type', sa.String(50), nullable=False),
|
||||
sa.Column('status', sa.String(50), default='proposed'),
|
||||
sa.Column('initiator_id', sa.Integer(), sa.ForeignKey('characters.id'), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now()),
|
||||
sa.Column('target_completion', sa.DateTime()),
|
||||
sa.Column('project_goals', sa.JSON(), default=list),
|
||||
sa.Column('style_guidelines', sa.JSON(), default=dict),
|
||||
sa.Column('current_content', sa.Text(), default=''),
|
||||
sa.Column('metadata', sa.JSON(), default=dict)
|
||||
)
|
||||
|
||||
# Create indexes for creative_projects
|
||||
op.create_index('ix_projects_status', 'creative_projects', ['status'])
|
||||
op.create_index('ix_projects_type', 'creative_projects', ['project_type'])
|
||||
op.create_index('ix_projects_initiator', 'creative_projects', ['initiator_id', 'created_at'])
|
||||
|
||||
# Create project_collaborators table
|
||||
op.create_table('project_collaborators',
|
||||
sa.Column('id', sa.Integer(), primary_key=True, index=True),
|
||||
sa.Column('project_id', sa.String(255), sa.ForeignKey('creative_projects.id'), nullable=False),
|
||||
sa.Column('character_id', sa.Integer(), sa.ForeignKey('characters.id'), nullable=False),
|
||||
sa.Column('role_description', sa.String(200), default='collaborator'),
|
||||
sa.Column('joined_at', sa.DateTime(), server_default=sa.func.now()),
|
||||
sa.Column('is_active', sa.Boolean(), default=True)
|
||||
)
|
||||
|
||||
# Create indexes for project_collaborators
|
||||
op.create_index('ix_collaborators_project', 'project_collaborators', ['project_id'])
|
||||
op.create_index('ix_collaborators_character', 'project_collaborators', ['character_id'])
|
||||
|
||||
# Create project_contributions table
|
||||
op.create_table('project_contributions',
|
||||
sa.Column('id', sa.String(255), primary_key=True, index=True),
|
||||
sa.Column('project_id', sa.String(255), sa.ForeignKey('creative_projects.id'), nullable=False),
|
||||
sa.Column('contributor_id', sa.Integer(), sa.ForeignKey('characters.id'), nullable=False),
|
||||
sa.Column('contribution_type', sa.String(50), nullable=False),
|
||||
sa.Column('content', sa.Text(), nullable=False),
|
||||
sa.Column('timestamp', sa.DateTime(), server_default=sa.func.now()),
|
||||
sa.Column('build_on_contribution_id', sa.String(255), sa.ForeignKey('project_contributions.id')),
|
||||
sa.Column('feedback_for_contribution_id', sa.String(255), sa.ForeignKey('project_contributions.id')),
|
||||
sa.Column('metadata', sa.JSON(), default=dict)
|
||||
)
|
||||
|
||||
# Create indexes for project_contributions
|
||||
op.create_index('ix_contributions_project', 'project_contributions', ['project_id', 'timestamp'])
|
||||
op.create_index('ix_contributions_contributor', 'project_contributions', ['contributor_id', 'timestamp'])
|
||||
op.create_index('ix_contributions_type', 'project_contributions', ['contribution_type'])
|
||||
|
||||
# Create project_invitations table
|
||||
op.create_table('project_invitations',
|
||||
sa.Column('id', sa.String(255), primary_key=True, index=True),
|
||||
sa.Column('project_id', sa.String(255), sa.ForeignKey('creative_projects.id'), nullable=False),
|
||||
sa.Column('inviter_id', sa.Integer(), sa.ForeignKey('characters.id'), nullable=False),
|
||||
sa.Column('invitee_id', sa.Integer(), sa.ForeignKey('characters.id'), nullable=False),
|
||||
sa.Column('role_description', sa.String(200), default='collaborator'),
|
||||
sa.Column('invitation_message', sa.Text()),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now()),
|
||||
sa.Column('expires_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('status', sa.String(50), default='pending'),
|
||||
sa.Column('response_message', sa.Text()),
|
||||
sa.Column('responded_at', sa.DateTime())
|
||||
)
|
||||
|
||||
# Create indexes for project_invitations
|
||||
op.create_index('ix_invitations_invitee', 'project_invitations', ['invitee_id', 'status'])
|
||||
op.create_index('ix_invitations_project', 'project_invitations', ['project_id', 'created_at'])
|
||||
|
||||
def downgrade():
|
||||
# Drop tables in reverse order
|
||||
op.drop_table('project_invitations')
|
||||
op.drop_table('project_contributions')
|
||||
op.drop_table('project_collaborators')
|
||||
op.drop_table('creative_projects')
|
||||
Reference in New Issue
Block a user