session-collab-mcp 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/session-collab-mcp +9 -0
- package/migrations/0001_init.sql +72 -0
- package/migrations/0002_auth.sql +56 -0
- package/migrations/0002_session_status.sql +10 -0
- package/package.json +39 -0
- package/src/auth/handlers.ts +326 -0
- package/src/auth/jwt.ts +112 -0
- package/src/auth/middleware.ts +144 -0
- package/src/auth/password.ts +84 -0
- package/src/auth/types.ts +70 -0
- package/src/cli.ts +140 -0
- package/src/db/auth-queries.ts +256 -0
- package/src/db/queries.ts +562 -0
- package/src/db/sqlite-adapter.ts +137 -0
- package/src/db/types.ts +137 -0
- package/src/frontend/app.ts +1181 -0
- package/src/index.ts +438 -0
- package/src/mcp/protocol.ts +99 -0
- package/src/mcp/server.ts +155 -0
- package/src/mcp/tools/claim.ts +358 -0
- package/src/mcp/tools/decision.ts +124 -0
- package/src/mcp/tools/message.ts +150 -0
- package/src/mcp/tools/session.ts +322 -0
- package/src/tokens/generator.ts +33 -0
- package/src/tokens/handlers.ts +113 -0
- package/src/utils/crypto.ts +82 -0
package/src/db/types.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Database types for Session Collaboration MCP
|
|
2
|
+
|
|
3
|
+
export type SessionStatus = 'active' | 'inactive' | 'terminated';
|
|
4
|
+
export type ClaimStatus = 'active' | 'completed' | 'abandoned';
|
|
5
|
+
export type ClaimScope = 'small' | 'medium' | 'large';
|
|
6
|
+
export type DecisionCategory = 'architecture' | 'naming' | 'api' | 'database' | 'ui' | 'other';
|
|
7
|
+
export type UserStatus = 'active' | 'suspended' | 'deleted';
|
|
8
|
+
|
|
9
|
+
// User and authentication types
|
|
10
|
+
export interface User {
|
|
11
|
+
id: string;
|
|
12
|
+
email: string;
|
|
13
|
+
password_hash: string;
|
|
14
|
+
display_name: string | null;
|
|
15
|
+
created_at: string;
|
|
16
|
+
updated_at: string;
|
|
17
|
+
last_login_at: string | null;
|
|
18
|
+
status: UserStatus;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface UserPublic {
|
|
22
|
+
id: string;
|
|
23
|
+
email: string;
|
|
24
|
+
display_name: string | null;
|
|
25
|
+
created_at: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ApiToken {
|
|
29
|
+
id: string;
|
|
30
|
+
user_id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
token_hash: string;
|
|
33
|
+
token_prefix: string;
|
|
34
|
+
scopes: string; // JSON array string
|
|
35
|
+
last_used_at: string | null;
|
|
36
|
+
expires_at: string | null;
|
|
37
|
+
created_at: string;
|
|
38
|
+
revoked_at: string | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ApiTokenPublic {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
token_prefix: string;
|
|
45
|
+
scopes: string[];
|
|
46
|
+
last_used_at: string | null;
|
|
47
|
+
expires_at: string | null;
|
|
48
|
+
created_at: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface RefreshToken {
|
|
52
|
+
id: string;
|
|
53
|
+
user_id: string;
|
|
54
|
+
token_hash: string;
|
|
55
|
+
expires_at: string;
|
|
56
|
+
created_at: string;
|
|
57
|
+
revoked_at: string | null;
|
|
58
|
+
user_agent: string | null;
|
|
59
|
+
ip_address: string | null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface TodoItem {
|
|
63
|
+
content: string;
|
|
64
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface SessionProgress {
|
|
68
|
+
completed: number;
|
|
69
|
+
total: number;
|
|
70
|
+
percentage: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface Session {
|
|
74
|
+
id: string;
|
|
75
|
+
name: string | null;
|
|
76
|
+
project_root: string;
|
|
77
|
+
machine_id: string | null;
|
|
78
|
+
user_id: string | null;
|
|
79
|
+
created_at: string;
|
|
80
|
+
last_heartbeat: string;
|
|
81
|
+
status: SessionStatus;
|
|
82
|
+
current_task: string | null;
|
|
83
|
+
progress: string | null; // JSON string of SessionProgress
|
|
84
|
+
todos: string | null; // JSON string of TodoItem[]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface Claim {
|
|
88
|
+
id: string;
|
|
89
|
+
session_id: string;
|
|
90
|
+
intent: string;
|
|
91
|
+
scope: ClaimScope;
|
|
92
|
+
status: ClaimStatus;
|
|
93
|
+
created_at: string;
|
|
94
|
+
updated_at: string;
|
|
95
|
+
completed_summary: string | null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface ClaimFile {
|
|
99
|
+
id: number;
|
|
100
|
+
claim_id: string;
|
|
101
|
+
file_path: string;
|
|
102
|
+
is_pattern: number; // 0 or 1, SQLite boolean
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface Message {
|
|
106
|
+
id: string;
|
|
107
|
+
from_session_id: string;
|
|
108
|
+
to_session_id: string | null;
|
|
109
|
+
content: string;
|
|
110
|
+
read_at: string | null;
|
|
111
|
+
created_at: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface Decision {
|
|
115
|
+
id: string;
|
|
116
|
+
session_id: string;
|
|
117
|
+
category: DecisionCategory | null;
|
|
118
|
+
title: string;
|
|
119
|
+
description: string;
|
|
120
|
+
created_at: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Extended types with joins
|
|
124
|
+
export interface ClaimWithFiles extends Claim {
|
|
125
|
+
files: string[];
|
|
126
|
+
session_name: string | null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface ConflictInfo {
|
|
130
|
+
claim_id: string;
|
|
131
|
+
session_id: string;
|
|
132
|
+
session_name: string | null;
|
|
133
|
+
file_path: string;
|
|
134
|
+
intent: string;
|
|
135
|
+
scope: ClaimScope;
|
|
136
|
+
created_at: string;
|
|
137
|
+
}
|