sam-coder-cli 1.0.42 → 1.0.43
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/ai-team.js +7 -1
- package/bin/multiplayer-client.js +10 -1
- package/package.json +1 -1
package/bin/ai-team.js
CHANGED
|
@@ -124,13 +124,19 @@ class AITeam {
|
|
|
124
124
|
|
|
125
125
|
if (actualSessionId) {
|
|
126
126
|
console.log(`Joining session ${actualSessionId}...`);
|
|
127
|
-
await this.client.joinSession(actualSessionId);
|
|
127
|
+
await this.client.joinSession(actualSessionId, false); // Don't create if not exists
|
|
128
128
|
} else {
|
|
129
|
+
// Create a new session - this user will be the host
|
|
129
130
|
console.log('Creating new session...');
|
|
130
131
|
const newSessionId = await this.client.createSession();
|
|
132
|
+
this.client.isHost = true; // Ensure this client is marked as host
|
|
131
133
|
console.log(chalk.green(`✅ Created new session: ${newSessionId}`));
|
|
134
|
+
console.log(chalk.yellow('You are the host of this session.'));
|
|
132
135
|
console.log('Share this ID with others to collaborate!');
|
|
133
136
|
console.log(chalk.yellow(`To join this session, use: ${serverId || 'localhost:8080'}:${newSessionId}`));
|
|
137
|
+
|
|
138
|
+
// Notify the user they are the host
|
|
139
|
+
console.log('\nAs the host, you can now enter a project prompt (e.g., "create a calculator"):');
|
|
134
140
|
}
|
|
135
141
|
} catch (error) {
|
|
136
142
|
console.error(chalk.red('Failed to connect to server:'), error.message);
|
|
@@ -419,6 +419,11 @@ class MultiplayerClient extends EventEmitter {
|
|
|
419
419
|
this.clients = message.clients || [];
|
|
420
420
|
this.workHistory = message.workHistory || [];
|
|
421
421
|
|
|
422
|
+
// Update host status if this client is the host
|
|
423
|
+
if (message.isHost !== undefined) {
|
|
424
|
+
this.isHost = message.isHost;
|
|
425
|
+
}
|
|
426
|
+
|
|
422
427
|
// Process any pending tasks
|
|
423
428
|
if (message.pendingTasks && message.pendingTasks.length > 0) {
|
|
424
429
|
message.pendingTasks.forEach(task => {
|
|
@@ -426,7 +431,11 @@ class MultiplayerClient extends EventEmitter {
|
|
|
426
431
|
});
|
|
427
432
|
}
|
|
428
433
|
|
|
429
|
-
|
|
434
|
+
// Emit session_joined with host status
|
|
435
|
+
this.emit('session_joined', {
|
|
436
|
+
...message,
|
|
437
|
+
isHost: this.isHost
|
|
438
|
+
});
|
|
430
439
|
}
|
|
431
440
|
|
|
432
441
|
handleClientUpdated(data) {
|