@agent-link/server 0.1.31 → 0.1.32

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.31",
3
+ "version": "0.1.32",
4
4
  "description": "AgentLink relay server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/web/app.js CHANGED
@@ -45,7 +45,7 @@ const App = {
45
45
  // Sidebar state
46
46
  const sidebarOpen = ref(window.innerWidth > 768);
47
47
  const historySessions = ref([]);
48
- const currentClaudeSessionId = ref(null);
48
+ const currentClaudeSessionId = ref(localStorage.getItem('agentlink-claude-session') || null);
49
49
  const needsResume = ref(false);
50
50
  const loadingSessions = ref(false);
51
51
  const loadingHistory = ref(false);
@@ -134,7 +134,7 @@ const App = {
134
134
  const { connect, wsSend, closeWs } = createConnection({
135
135
  status, agentName, hostname, workDir, sessionId, error,
136
136
  messages, isProcessing, isCompacting, visibleLimit,
137
- historySessions, currentClaudeSessionId, loadingSessions, loadingHistory,
137
+ historySessions, currentClaudeSessionId, needsResume, loadingSessions, loadingHistory,
138
138
  folderPickerLoading, folderPickerEntries, folderPickerPath,
139
139
  streaming, sidebar, scrollToBottom,
140
140
  });
@@ -14,7 +14,7 @@ export function createConnection(deps) {
14
14
  const {
15
15
  status, agentName, hostname, workDir, sessionId, error,
16
16
  messages, isProcessing, isCompacting, visibleLimit,
17
- historySessions, currentClaudeSessionId, loadingSessions, loadingHistory,
17
+ historySessions, currentClaudeSessionId, needsResume, loadingSessions, loadingHistory,
18
18
  folderPickerLoading, folderPickerEntries, folderPickerPath,
19
19
  streaming, sidebar,
20
20
  scrollToBottom,
@@ -150,6 +150,15 @@ export function createConnection(deps) {
150
150
  wsSend({ type: 'change_workdir', workDir: savedDir });
151
151
  }
152
152
  sidebar.requestSessionList();
153
+ // Auto-resume last active session after page refresh
154
+ if (currentClaudeSessionId.value && messages.value.length === 0) {
155
+ needsResume.value = true;
156
+ loadingHistory.value = true;
157
+ wsSend({
158
+ type: 'resume_conversation',
159
+ claudeSessionId: currentClaudeSessionId.value,
160
+ });
161
+ }
153
162
  } else {
154
163
  status.value = 'Waiting';
155
164
  error.value = 'Agent is not connected yet.';
@@ -170,6 +179,15 @@ export function createConnection(deps) {
170
179
  workDir.value = msg.agent.workDir;
171
180
  }
172
181
  sidebar.requestSessionList();
182
+ // Auto-resume last active session after agent reconnect
183
+ if (currentClaudeSessionId.value && messages.value.length === 0) {
184
+ needsResume.value = true;
185
+ loadingHistory.value = true;
186
+ wsSend({
187
+ type: 'resume_conversation',
188
+ claudeSessionId: currentClaudeSessionId.value,
189
+ });
190
+ }
173
191
  } else if (msg.type === 'error') {
174
192
  status.value = 'Error';
175
193
  error.value = msg.message;
@@ -236,8 +254,12 @@ export function createConnection(deps) {
236
254
  } else if (msg.type === 'sessions_list') {
237
255
  historySessions.value = msg.sessions || [];
238
256
  loadingSessions.value = false;
257
+ } else if (msg.type === 'session_started') {
258
+ currentClaudeSessionId.value = msg.claudeSessionId;
259
+ localStorage.setItem('agentlink-claude-session', msg.claudeSessionId);
239
260
  } else if (msg.type === 'conversation_resumed') {
240
261
  currentClaudeSessionId.value = msg.claudeSessionId;
262
+ localStorage.setItem('agentlink-claude-session', msg.claudeSessionId);
241
263
  if (msg.history && Array.isArray(msg.history)) {
242
264
  const batch = [];
243
265
  for (const h of msg.history) {
@@ -299,6 +321,7 @@ export function createConnection(deps) {
299
321
  streaming.setStreamingMessageId(null);
300
322
  streaming.reset();
301
323
  currentClaudeSessionId.value = null;
324
+ localStorage.removeItem('agentlink-claude-session');
302
325
  isProcessing.value = false;
303
326
  messages.value.push({
304
327
  id: streaming.nextId(), role: 'system',
@@ -50,6 +50,7 @@ export function createSidebar(deps) {
50
50
  currentClaudeSessionId.value = session.sessionId;
51
51
  needsResume.value = true;
52
52
  loadingHistory.value = true;
53
+ localStorage.setItem('agentlink-claude-session', session.sessionId);
53
54
 
54
55
  wsSend({
55
56
  type: 'resume_conversation',
@@ -67,6 +68,7 @@ export function createSidebar(deps) {
67
68
  streaming.reset();
68
69
  currentClaudeSessionId.value = null;
69
70
  needsResume.value = false;
71
+ localStorage.removeItem('agentlink-claude-session');
70
72
 
71
73
  messages.value.push({
72
74
  id: streaming.nextId(), role: 'system',