feat: Add project lock mechanism for session exclusivity

New MCP tools:
- project_lock: Lock a project for exclusive session access
- project_unlock: Release a project lock
- project_lock_status: Check lock status for project(s)

Features:
- Automatic lock expiration (default 2h)
- Session ownership verification
- Force unlock option for emergencies
- Lock extension on re-lock by same session

Migration 004: project_locks table with expiry tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-10 09:22:26 +02:00
parent fe2cd82587
commit 837fb8060c
4 changed files with 231 additions and 0 deletions

View File

@@ -233,4 +233,43 @@ export const toolDefinitions = [
},
},
},
// Project Lock Tools
{
name: 'project_lock',
description: 'Lock a project for exclusive session access. Prevents other sessions from working on it.',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key (e.g., VPN, ST)' },
session_id: { type: 'string', description: 'Unique session identifier' },
duration_minutes: { type: 'number', description: 'Lock duration in minutes (default: 120)' },
reason: { type: 'string', description: 'Optional reason for locking' },
},
required: ['project', 'session_id'],
},
},
{
name: 'project_unlock',
description: 'Release a project lock',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key to unlock' },
session_id: { type: 'string', description: 'Session ID (must match lock owner unless force=true)' },
force: { type: 'boolean', description: 'Force unlock even if owned by different session' },
},
required: ['project'],
},
},
{
name: 'project_lock_status',
description: 'Check lock status for a project or all projects',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key (optional, shows all if omitted)' },
},
},
},
];