gsd-agent 1.0.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/README.md +221 -0
- package/bin/cli.js +313 -0
- package/dist/auth-flow.d.ts +50 -0
- package/dist/auth-flow.d.ts.map +1 -0
- package/dist/auth-flow.js +233 -0
- package/dist/auth-flow.js.map +1 -0
- package/dist/auth.d.ts +42 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +117 -0
- package/dist/auth.js.map +1 -0
- package/dist/command-executor.d.ts +44 -0
- package/dist/command-executor.d.ts.map +1 -0
- package/dist/command-executor.js +193 -0
- package/dist/command-executor.js.map +1 -0
- package/dist/command-executor.test.d.ts +8 -0
- package/dist/command-executor.test.d.ts.map +1 -0
- package/dist/command-executor.test.js +87 -0
- package/dist/command-executor.test.js.map +1 -0
- package/dist/command-queue.d.ts +44 -0
- package/dist/command-queue.d.ts.map +1 -0
- package/dist/command-queue.js +184 -0
- package/dist/command-queue.js.map +1 -0
- package/dist/command-queue.test.d.ts +7 -0
- package/dist/command-queue.test.d.ts.map +1 -0
- package/dist/command-queue.test.js +220 -0
- package/dist/command-queue.test.js.map +1 -0
- package/dist/config.d.ts +25 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +103 -0
- package/dist/config.js.map +1 -0
- package/dist/conflict-resolver.d.ts +43 -0
- package/dist/conflict-resolver.d.ts.map +1 -0
- package/dist/conflict-resolver.js +91 -0
- package/dist/conflict-resolver.js.map +1 -0
- package/dist/conflict-resolver.test.d.ts +7 -0
- package/dist/conflict-resolver.test.d.ts.map +1 -0
- package/dist/conflict-resolver.test.js +123 -0
- package/dist/conflict-resolver.test.js.map +1 -0
- package/dist/discovery.d.ts +59 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +180 -0
- package/dist/discovery.js.map +1 -0
- package/dist/discovery.test.d.ts +8 -0
- package/dist/discovery.test.d.ts.map +1 -0
- package/dist/discovery.test.js +132 -0
- package/dist/discovery.test.js.map +1 -0
- package/dist/hash.d.ts +20 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +35 -0
- package/dist/hash.js.map +1 -0
- package/dist/hash.test.d.ts +7 -0
- package/dist/hash.test.d.ts.map +1 -0
- package/dist/hash.test.js +58 -0
- package/dist/hash.test.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +202 -0
- package/dist/index.js.map +1 -0
- package/dist/integration.test.d.ts +8 -0
- package/dist/integration.test.d.ts.map +1 -0
- package/dist/integration.test.js +37 -0
- package/dist/integration.test.js.map +1 -0
- package/dist/logger.d.ts +68 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +159 -0
- package/dist/logger.js.map +1 -0
- package/dist/output-streamer.d.ts +27 -0
- package/dist/output-streamer.d.ts.map +1 -0
- package/dist/output-streamer.js +71 -0
- package/dist/output-streamer.js.map +1 -0
- package/dist/output-streamer.test.d.ts +7 -0
- package/dist/output-streamer.test.d.ts.map +1 -0
- package/dist/output-streamer.test.js +90 -0
- package/dist/output-streamer.test.js.map +1 -0
- package/dist/realtime-subscriber.d.ts +63 -0
- package/dist/realtime-subscriber.d.ts.map +1 -0
- package/dist/realtime-subscriber.js +201 -0
- package/dist/realtime-subscriber.js.map +1 -0
- package/dist/realtime-subscriber.test.d.ts +7 -0
- package/dist/realtime-subscriber.test.d.ts.map +1 -0
- package/dist/realtime-subscriber.test.js +183 -0
- package/dist/realtime-subscriber.test.js.map +1 -0
- package/dist/reconnection-manager.d.ts +88 -0
- package/dist/reconnection-manager.d.ts.map +1 -0
- package/dist/reconnection-manager.js +229 -0
- package/dist/reconnection-manager.js.map +1 -0
- package/dist/reconnection-manager.test.d.ts +8 -0
- package/dist/reconnection-manager.test.d.ts.map +1 -0
- package/dist/reconnection-manager.test.js +151 -0
- package/dist/reconnection-manager.test.js.map +1 -0
- package/dist/remote-sync-handler.d.ts +61 -0
- package/dist/remote-sync-handler.d.ts.map +1 -0
- package/dist/remote-sync-handler.js +197 -0
- package/dist/remote-sync-handler.js.map +1 -0
- package/dist/remote-sync-handler.test.d.ts +7 -0
- package/dist/remote-sync-handler.test.d.ts.map +1 -0
- package/dist/remote-sync-handler.test.js +212 -0
- package/dist/remote-sync-handler.test.js.map +1 -0
- package/dist/retry.d.ts +35 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +63 -0
- package/dist/retry.js.map +1 -0
- package/dist/retry.test.d.ts +5 -0
- package/dist/retry.test.d.ts.map +1 -0
- package/dist/retry.test.js +84 -0
- package/dist/retry.test.js.map +1 -0
- package/dist/storage-client.d.ts +69 -0
- package/dist/storage-client.d.ts.map +1 -0
- package/dist/storage-client.js +168 -0
- package/dist/storage-client.js.map +1 -0
- package/dist/storage-client.test.d.ts +7 -0
- package/dist/storage-client.test.d.ts.map +1 -0
- package/dist/storage-client.test.js +126 -0
- package/dist/storage-client.test.js.map +1 -0
- package/dist/supabase.d.ts +82 -0
- package/dist/supabase.d.ts.map +1 -0
- package/dist/supabase.js +341 -0
- package/dist/supabase.js.map +1 -0
- package/dist/supabase.test.d.ts +7 -0
- package/dist/supabase.test.d.ts.map +1 -0
- package/dist/supabase.test.js +273 -0
- package/dist/supabase.test.js.map +1 -0
- package/dist/sync-engine.d.ts +84 -0
- package/dist/sync-engine.d.ts.map +1 -0
- package/dist/sync-engine.js +251 -0
- package/dist/sync-engine.js.map +1 -0
- package/dist/sync-engine.test.d.ts +7 -0
- package/dist/sync-engine.test.d.ts.map +1 -0
- package/dist/sync-engine.test.js +241 -0
- package/dist/sync-engine.test.js.map +1 -0
- package/dist/sync-state.d.ts +82 -0
- package/dist/sync-state.d.ts.map +1 -0
- package/dist/sync-state.js +145 -0
- package/dist/sync-state.js.map +1 -0
- package/dist/sync-state.test.d.ts +7 -0
- package/dist/sync-state.test.d.ts.map +1 -0
- package/dist/sync-state.test.js +129 -0
- package/dist/sync-state.test.js.map +1 -0
- package/dist/types.d.ts +148 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/types.test.d.ts +7 -0
- package/dist/types.test.d.ts.map +1 -0
- package/dist/types.test.js +73 -0
- package/dist/types.test.js.map +1 -0
- package/dist/watcher.d.ts +55 -0
- package/dist/watcher.d.ts.map +1 -0
- package/dist/watcher.js +214 -0
- package/dist/watcher.js.map +1 -0
- package/dist/watcher.test.d.ts +8 -0
- package/dist/watcher.test.d.ts.map +1 -0
- package/dist/watcher.test.js +164 -0
- package/dist/watcher.test.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supabase client and database operations
|
|
3
|
+
*
|
|
4
|
+
* Provides connection management, workspace sync, and file sync operations.
|
|
5
|
+
* Handles network errors gracefully with exponential backoff retry logic.
|
|
6
|
+
*/
|
|
7
|
+
import type { SyncConfig, Workspace, FileChangeEvent } from './types.js';
|
|
8
|
+
import type { Logger } from './logger.js';
|
|
9
|
+
import type { StorageClient } from './storage-client.js';
|
|
10
|
+
/**
|
|
11
|
+
* Operation result type
|
|
12
|
+
*/
|
|
13
|
+
export interface OperationResult {
|
|
14
|
+
success: boolean;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Supabase client wrapper with database operations
|
|
19
|
+
*/
|
|
20
|
+
export declare class SupabaseClient {
|
|
21
|
+
private client;
|
|
22
|
+
private config;
|
|
23
|
+
private logger;
|
|
24
|
+
private storageClient;
|
|
25
|
+
private userId;
|
|
26
|
+
constructor(config: SyncConfig, logger: Logger, storageClient: StorageClient, userId: string);
|
|
27
|
+
/**
|
|
28
|
+
* Test connection to Supabase
|
|
29
|
+
* @returns Operation result
|
|
30
|
+
*/
|
|
31
|
+
connect(): Promise<OperationResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Graceful shutdown
|
|
34
|
+
*/
|
|
35
|
+
disconnect(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Sync workspace to database (upsert)
|
|
38
|
+
* Preserves existing workspace ID if root_path already exists
|
|
39
|
+
* Updates the workspace object with the actual database ID
|
|
40
|
+
* @param workspace - Workspace to sync (will be mutated with database ID)
|
|
41
|
+
* @returns Operation result with database ID
|
|
42
|
+
*/
|
|
43
|
+
syncWorkspace(workspace: Workspace): Promise<OperationResult & {
|
|
44
|
+
id?: string;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Sync single file to database (upsert)
|
|
48
|
+
* Large files (>200KB) are uploaded to Storage, small files stored in database
|
|
49
|
+
* @param event - File change event
|
|
50
|
+
* @returns Operation result
|
|
51
|
+
*/
|
|
52
|
+
syncFile(event: FileChangeEvent): Promise<OperationResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Sync multiple files in a single batch (upsert)
|
|
55
|
+
* Rate limiting: Supabase free tier allows 100 msg/s, we target 50 msg/s max
|
|
56
|
+
* Large files (>200KB) are uploaded to Storage, small files stored in database
|
|
57
|
+
* @param events - Array of file change events
|
|
58
|
+
* @returns Operation result
|
|
59
|
+
*/
|
|
60
|
+
syncFileBatch(events: FileChangeEvent[]): Promise<OperationResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Send heartbeat to update agent status
|
|
63
|
+
* @returns Operation result
|
|
64
|
+
*/
|
|
65
|
+
heartbeat(): Promise<OperationResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Check if error message indicates rate limiting
|
|
68
|
+
* @param message - Error message
|
|
69
|
+
* @returns True if rate limit error
|
|
70
|
+
*/
|
|
71
|
+
private isRateLimitError;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Factory function to create Supabase client
|
|
75
|
+
* @param config - Sync configuration
|
|
76
|
+
* @param logger - Logger instance
|
|
77
|
+
* @param storageClient - Storage client instance
|
|
78
|
+
* @param userId - User ID for multi-user support
|
|
79
|
+
* @returns Supabase client instance
|
|
80
|
+
*/
|
|
81
|
+
export declare function createSupabaseClient(config: SyncConfig, logger: Logger, storageClient: StorageClient, userId: string): SupabaseClient;
|
|
82
|
+
//# sourceMappingURL=supabase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../src/supabase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,MAAM,CAAQ;gBAEV,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM;IAkB5F;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC;IAwBzC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC;;;;;;OAMG;IACG,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,eAAe,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAwDrF;;;;;OAKG;IACG,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAgFhE;;;;;;OAMG;IACG,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAoGxE;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC;IA8B3C;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;CAGzB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,GACb,cAAc,CAEhB"}
|
package/dist/supabase.js
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supabase client and database operations
|
|
3
|
+
*
|
|
4
|
+
* Provides connection management, workspace sync, and file sync operations.
|
|
5
|
+
* Handles network errors gracefully with exponential backoff retry logic.
|
|
6
|
+
*/
|
|
7
|
+
import { createClient } from '@supabase/supabase-js';
|
|
8
|
+
/**
|
|
9
|
+
* Supabase client wrapper with database operations
|
|
10
|
+
*/
|
|
11
|
+
export class SupabaseClient {
|
|
12
|
+
client;
|
|
13
|
+
config;
|
|
14
|
+
logger;
|
|
15
|
+
storageClient;
|
|
16
|
+
userId;
|
|
17
|
+
constructor(config, logger, storageClient, userId) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.logger = logger;
|
|
20
|
+
this.storageClient = storageClient;
|
|
21
|
+
this.userId = userId;
|
|
22
|
+
// Initialize Supabase client with user token for multi-user support
|
|
23
|
+
this.client = createClient(config.supabase_url, config.supabase_key, {
|
|
24
|
+
auth: {
|
|
25
|
+
persistSession: false, // agent doesn't need session persistence
|
|
26
|
+
autoRefreshToken: false // handled by auth flow
|
|
27
|
+
},
|
|
28
|
+
db: {
|
|
29
|
+
schema: 'public'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Test connection to Supabase
|
|
35
|
+
* @returns Operation result
|
|
36
|
+
*/
|
|
37
|
+
async connect() {
|
|
38
|
+
try {
|
|
39
|
+
// Test connection with simple query that verifies user access
|
|
40
|
+
const { error } = await this.client
|
|
41
|
+
.from('workspaces')
|
|
42
|
+
.select('count')
|
|
43
|
+
.eq('user_id', this.userId)
|
|
44
|
+
.limit(1);
|
|
45
|
+
if (error) {
|
|
46
|
+
const message = `Failed to connect to Supabase: ${error.message}`;
|
|
47
|
+
this.logger.error(message, { error });
|
|
48
|
+
return { success: false, error: message };
|
|
49
|
+
}
|
|
50
|
+
this.logger.info('Connected to Supabase successfully', { user_id: this.userId });
|
|
51
|
+
return { success: true };
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const message = `Failed to connect to Supabase: ${error}`;
|
|
55
|
+
this.logger.error(message, { error });
|
|
56
|
+
return { success: false, error: message };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Graceful shutdown
|
|
61
|
+
*/
|
|
62
|
+
async disconnect() {
|
|
63
|
+
this.logger.info('Disconnecting from Supabase');
|
|
64
|
+
// No explicit disconnect needed for HTTP client
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Sync workspace to database (upsert)
|
|
68
|
+
* Preserves existing workspace ID if root_path already exists
|
|
69
|
+
* Updates the workspace object with the actual database ID
|
|
70
|
+
* @param workspace - Workspace to sync (will be mutated with database ID)
|
|
71
|
+
* @returns Operation result with database ID
|
|
72
|
+
*/
|
|
73
|
+
async syncWorkspace(workspace) {
|
|
74
|
+
try {
|
|
75
|
+
// First, check if workspace exists by root_path for this user
|
|
76
|
+
const { data: existing, error: queryError } = await this.client
|
|
77
|
+
.from('workspaces')
|
|
78
|
+
.select('id')
|
|
79
|
+
.eq('root_path', workspace.root_path)
|
|
80
|
+
.eq('user_id', this.userId)
|
|
81
|
+
.maybeSingle();
|
|
82
|
+
if (queryError) {
|
|
83
|
+
const message = `Failed to query workspace: ${queryError.message}`;
|
|
84
|
+
this.logger.error(message, { root_path: workspace.root_path, error: queryError });
|
|
85
|
+
return { success: false, error: message };
|
|
86
|
+
}
|
|
87
|
+
// Use existing ID if found, otherwise use new ID
|
|
88
|
+
const workspaceId = existing?.id || workspace.id;
|
|
89
|
+
const { error } = await this.client
|
|
90
|
+
.from('workspaces')
|
|
91
|
+
.upsert({
|
|
92
|
+
id: workspaceId,
|
|
93
|
+
user_id: this.userId, // Add user_id for multi-user support
|
|
94
|
+
root_path: workspace.root_path,
|
|
95
|
+
name: workspace.name,
|
|
96
|
+
status: workspace.status,
|
|
97
|
+
last_sync: workspace.last_sync,
|
|
98
|
+
discovered_at: workspace.discovered_at
|
|
99
|
+
});
|
|
100
|
+
if (error) {
|
|
101
|
+
// Check for rate limit errors
|
|
102
|
+
if (this.isRateLimitError(error.message)) {
|
|
103
|
+
const message = `Rate limit exceeded while syncing workspace ${workspaceId}`;
|
|
104
|
+
this.logger.warn(message, { workspace_id: workspaceId, error: error.message });
|
|
105
|
+
return { success: false, error: message };
|
|
106
|
+
}
|
|
107
|
+
const message = `Failed to sync workspace ${workspaceId}: ${error.message}`;
|
|
108
|
+
this.logger.error(message, { workspace_id: workspaceId, error });
|
|
109
|
+
return { success: false, error: message };
|
|
110
|
+
}
|
|
111
|
+
// Update workspace object with database ID
|
|
112
|
+
workspace.id = workspaceId;
|
|
113
|
+
this.logger.debug('Synced workspace', { workspace_id: workspaceId, user_id: this.userId });
|
|
114
|
+
return { success: true, id: workspaceId };
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
const message = `Failed to sync workspace ${workspace.id}: ${error}`;
|
|
118
|
+
this.logger.error(message, { workspace_id: workspace.id, error });
|
|
119
|
+
return { success: false, error: message };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Sync single file to database (upsert)
|
|
124
|
+
* Large files (>200KB) are uploaded to Storage, small files stored in database
|
|
125
|
+
* @param event - File change event
|
|
126
|
+
* @returns Operation result
|
|
127
|
+
*/
|
|
128
|
+
async syncFile(event) {
|
|
129
|
+
try {
|
|
130
|
+
const LARGE_FILE_THRESHOLD = 200 * 1024; // 200KB
|
|
131
|
+
let dbContent = event.content || null;
|
|
132
|
+
let storageUrl = undefined;
|
|
133
|
+
// Check if file is large enough for Storage
|
|
134
|
+
if (event.metadata.size > LARGE_FILE_THRESHOLD) {
|
|
135
|
+
// Upload to Storage
|
|
136
|
+
const uploadResult = await this.storageClient.uploadFile(event.workspace_id, event.file_path, event.content || '');
|
|
137
|
+
if (uploadResult.success) {
|
|
138
|
+
// Store reference in database, not content
|
|
139
|
+
dbContent = null;
|
|
140
|
+
storageUrl = uploadResult.storage_url;
|
|
141
|
+
this.logger.debug('Uploaded large file to Storage', {
|
|
142
|
+
file_path: event.file_path,
|
|
143
|
+
size: event.metadata.size,
|
|
144
|
+
storage_url: storageUrl
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Storage upload failed - fall back to database if size allows
|
|
149
|
+
if (event.metadata.size < LARGE_FILE_THRESHOLD) {
|
|
150
|
+
this.logger.warn('Storage upload failed, falling back to database', {
|
|
151
|
+
file_path: event.file_path,
|
|
152
|
+
error: uploadResult.error
|
|
153
|
+
});
|
|
154
|
+
// Keep dbContent as is (event.content)
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
// File too large for database fallback
|
|
158
|
+
const message = `Failed to upload large file to Storage: ${uploadResult.error}`;
|
|
159
|
+
this.logger.error(message, { file_path: event.file_path });
|
|
160
|
+
return { success: false, error: message };
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// Upsert to database with user_id
|
|
165
|
+
const { error } = await this.client
|
|
166
|
+
.from('files')
|
|
167
|
+
.upsert({
|
|
168
|
+
workspace_id: event.workspace_id,
|
|
169
|
+
user_id: this.userId, // Add user_id for multi-user support
|
|
170
|
+
file_path: event.file_path,
|
|
171
|
+
content: dbContent,
|
|
172
|
+
content_hash: event.content_hash,
|
|
173
|
+
size: event.metadata.size,
|
|
174
|
+
updated_at: event.timestamp,
|
|
175
|
+
...(storageUrl && { storage_url: storageUrl })
|
|
176
|
+
}, {
|
|
177
|
+
onConflict: 'workspace_id,file_path'
|
|
178
|
+
});
|
|
179
|
+
if (error) {
|
|
180
|
+
// Check for rate limit errors
|
|
181
|
+
if (this.isRateLimitError(error.message)) {
|
|
182
|
+
const message = `Rate limit exceeded while syncing file ${event.file_path}`;
|
|
183
|
+
this.logger.warn(message, { file_path: event.file_path, error: error.message });
|
|
184
|
+
return { success: false, error: message };
|
|
185
|
+
}
|
|
186
|
+
const message = `Failed to sync file ${event.file_path}: ${error.message}`;
|
|
187
|
+
this.logger.error(message, { file_path: event.file_path, error });
|
|
188
|
+
return { success: false, error: message };
|
|
189
|
+
}
|
|
190
|
+
this.logger.debug('Synced file', { file_path: event.file_path, storage: !!storageUrl, user_id: this.userId });
|
|
191
|
+
return { success: true };
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
const message = `Failed to sync file ${event.file_path}: ${error}`;
|
|
195
|
+
this.logger.error(message, { file_path: event.file_path, error });
|
|
196
|
+
return { success: false, error: message };
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Sync multiple files in a single batch (upsert)
|
|
201
|
+
* Rate limiting: Supabase free tier allows 100 msg/s, we target 50 msg/s max
|
|
202
|
+
* Large files (>200KB) are uploaded to Storage, small files stored in database
|
|
203
|
+
* @param events - Array of file change events
|
|
204
|
+
* @returns Operation result
|
|
205
|
+
*/
|
|
206
|
+
async syncFileBatch(events) {
|
|
207
|
+
if (events.length === 0) {
|
|
208
|
+
return { success: true };
|
|
209
|
+
}
|
|
210
|
+
// Enforce batch size limit
|
|
211
|
+
const maxBatchSize = this.config.batch_size;
|
|
212
|
+
if (events.length > maxBatchSize) {
|
|
213
|
+
this.logger.warn(`Batch size ${events.length} exceeds limit ${maxBatchSize}, splitting`, { batch_size: events.length, limit: maxBatchSize });
|
|
214
|
+
// Split into chunks and process sequentially
|
|
215
|
+
const chunks = [];
|
|
216
|
+
for (let i = 0; i < events.length; i += maxBatchSize) {
|
|
217
|
+
chunks.push(events.slice(i, i + maxBatchSize));
|
|
218
|
+
}
|
|
219
|
+
for (const chunk of chunks) {
|
|
220
|
+
const result = await this.syncFileBatch(chunk);
|
|
221
|
+
if (!result.success) {
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return { success: true };
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
const LARGE_FILE_THRESHOLD = 200 * 1024; // 200KB
|
|
229
|
+
// Split events into small and large files
|
|
230
|
+
const smallFiles = [];
|
|
231
|
+
const largeFiles = [];
|
|
232
|
+
for (const event of events) {
|
|
233
|
+
if (event.metadata.size > LARGE_FILE_THRESHOLD) {
|
|
234
|
+
largeFiles.push(event);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
smallFiles.push(event);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Process small files with batch upsert
|
|
241
|
+
if (smallFiles.length > 0) {
|
|
242
|
+
const records = smallFiles.map(event => ({
|
|
243
|
+
workspace_id: event.workspace_id,
|
|
244
|
+
user_id: this.userId, // Add user_id for multi-user support
|
|
245
|
+
file_path: event.file_path,
|
|
246
|
+
content: event.content,
|
|
247
|
+
content_hash: event.content_hash,
|
|
248
|
+
size: event.metadata.size,
|
|
249
|
+
updated_at: event.timestamp
|
|
250
|
+
}));
|
|
251
|
+
const { error } = await this.client
|
|
252
|
+
.from('files')
|
|
253
|
+
.upsert(records, {
|
|
254
|
+
onConflict: 'workspace_id,file_path'
|
|
255
|
+
});
|
|
256
|
+
if (error) {
|
|
257
|
+
// Check for rate limit errors
|
|
258
|
+
if (this.isRateLimitError(error.message)) {
|
|
259
|
+
const message = `Rate limit exceeded while syncing batch of ${smallFiles.length} files`;
|
|
260
|
+
this.logger.warn(message, { batch_size: smallFiles.length, error: error.message });
|
|
261
|
+
return { success: false, error: message };
|
|
262
|
+
}
|
|
263
|
+
const message = `Failed to sync batch of ${smallFiles.length} files: ${error.message}`;
|
|
264
|
+
this.logger.error(message, { batch_size: smallFiles.length, error });
|
|
265
|
+
return { success: false, error: message };
|
|
266
|
+
}
|
|
267
|
+
this.logger.debug('Synced small file batch', { batch_size: smallFiles.length, user_id: this.userId });
|
|
268
|
+
}
|
|
269
|
+
// Process large files sequentially (upload to Storage, then upsert database record)
|
|
270
|
+
for (const event of largeFiles) {
|
|
271
|
+
const result = await this.syncFile(event);
|
|
272
|
+
if (!result.success) {
|
|
273
|
+
return result;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
this.logger.debug('Synced file batch', {
|
|
277
|
+
total: events.length,
|
|
278
|
+
small: smallFiles.length,
|
|
279
|
+
large: largeFiles.length,
|
|
280
|
+
user_id: this.userId
|
|
281
|
+
});
|
|
282
|
+
return { success: true };
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
const message = `Failed to sync batch of ${events.length} files: ${error}`;
|
|
286
|
+
this.logger.error(message, { batch_size: events.length, error });
|
|
287
|
+
return { success: false, error: message };
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Send heartbeat to update agent status
|
|
292
|
+
* @returns Operation result
|
|
293
|
+
*/
|
|
294
|
+
async heartbeat() {
|
|
295
|
+
try {
|
|
296
|
+
const timestamp = new Date().toISOString();
|
|
297
|
+
const { error } = await this.client
|
|
298
|
+
.from('agent_health')
|
|
299
|
+
.upsert({
|
|
300
|
+
user_id: this.userId,
|
|
301
|
+
status: 'active',
|
|
302
|
+
last_heartbeat: timestamp,
|
|
303
|
+
updated_at: timestamp
|
|
304
|
+
}, {
|
|
305
|
+
onConflict: 'user_id'
|
|
306
|
+
});
|
|
307
|
+
if (error) {
|
|
308
|
+
const message = `Failed to send heartbeat: ${error.message}`;
|
|
309
|
+
this.logger.error(message, { error });
|
|
310
|
+
return { success: false, error: message };
|
|
311
|
+
}
|
|
312
|
+
this.logger.debug('Sent heartbeat', { timestamp, user_id: this.userId });
|
|
313
|
+
return { success: true };
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
const message = `Failed to send heartbeat: ${error}`;
|
|
317
|
+
this.logger.error(message, { error });
|
|
318
|
+
return { success: false, error: message };
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Check if error message indicates rate limiting
|
|
323
|
+
* @param message - Error message
|
|
324
|
+
* @returns True if rate limit error
|
|
325
|
+
*/
|
|
326
|
+
isRateLimitError(message) {
|
|
327
|
+
return message.includes('tenant_events') || message.includes('too_many_joins');
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Factory function to create Supabase client
|
|
332
|
+
* @param config - Sync configuration
|
|
333
|
+
* @param logger - Logger instance
|
|
334
|
+
* @param storageClient - Storage client instance
|
|
335
|
+
* @param userId - User ID for multi-user support
|
|
336
|
+
* @returns Supabase client instance
|
|
337
|
+
*/
|
|
338
|
+
export function createSupabaseClient(config, logger, storageClient, userId) {
|
|
339
|
+
return new SupabaseClient(config, logger, storageClient, userId);
|
|
340
|
+
}
|
|
341
|
+
//# sourceMappingURL=supabase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supabase.js","sourceRoot":"","sources":["../src/supabase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAsC,MAAM,uBAAuB,CAAA;AAaxF;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,MAAM,CAAkB;IACxB,MAAM,CAAY;IAClB,MAAM,CAAQ;IACd,aAAa,CAAe;IAC5B,MAAM,CAAQ;IAEtB,YAAY,MAAkB,EAAE,MAAc,EAAE,aAA4B,EAAE,MAAc;QAC1F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QAEpB,oEAAoE;QACpE,IAAI,CAAC,MAAM,GAAG,YAAY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