@agent-link/server 0.1.168 → 0.1.169

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-link/server",
3
- "version": "0.1.168",
3
+ "version": "0.1.169",
4
4
  "description": "AgentLink relay server",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -403,7 +403,7 @@ export function createConnection(deps) {
403
403
 
404
404
  // Restore active team state on reconnect
405
405
  if (team && msg.activeTeam) {
406
- team.handleActiveTeamRestore(msg.activeTeam);
406
+ team.handleActiveTeamRestore(msg.activeTeam, workDir.value);
407
407
  }
408
408
  resetIdleCheck();
409
409
  } else if (msg.type === 'error') {
@@ -614,7 +614,14 @@ export function createConnection(deps) {
614
614
  });
615
615
  // Clear old history immediately so UI doesn't show stale data
616
616
  historySessions.value = [];
617
- if (team) team.teamsList.value = [];
617
+ if (team) {
618
+ team.teamsList.value = [];
619
+ team.teamState.value = null;
620
+ team.historicalTeam.value = null;
621
+ if (team.viewMode.value === 'team') {
622
+ team.viewMode.value = 'chat';
623
+ }
624
+ }
618
625
  if (loop) loop.loopsList.value = [];
619
626
  memoryFiles.value = [];
620
627
  memoryDir.value = null;
@@ -352,10 +352,18 @@ export function createTeam(deps) {
352
352
  * Handle active_conversations response that includes activeTeam.
353
353
  * Called on initial connect + reconnect to restore team state.
354
354
  */
355
- function handleActiveTeamRestore(activeTeam) {
355
+ function handleActiveTeamRestore(activeTeam, currentWorkDir) {
356
356
  if (!activeTeam) return;
357
+ // Skip if the active team belongs to a different workdir
358
+ if (currentWorkDir && activeTeam.workDir && activeTeam.workDir !== currentWorkDir) return;
359
+
360
+ const wasAlreadyLoaded = teamState.value !== null;
357
361
  teamState.value = activeTeam;
358
- viewMode.value = 'team';
362
+ // Only switch to team view on first restore (initial connect / reconnect),
363
+ // not on idle-check polls — otherwise the user gets yanked out of chat.
364
+ if (!wasAlreadyLoaded) {
365
+ viewMode.value = 'team';
366
+ }
359
367
  // Re-initialize agent message lists (messages lost on reconnect)
360
368
  if (!agentMessages.value['lead']) {
361
369
  agentMessages.value['lead'] = [];