@agent-link/server 0.1.41 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-link/server",
3
- "version": "0.1.41",
3
+ "version": "0.1.43",
4
4
  "description": "AgentLink relay server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/web/app.js CHANGED
@@ -35,7 +35,12 @@ const App = {
35
35
  return messages.value.slice(messages.value.length - visibleLimit.value);
36
36
  });
37
37
  function loadMoreMessages() {
38
+ const el = document.querySelector('.message-list');
39
+ const prevHeight = el ? el.scrollHeight : 0;
38
40
  visibleLimit.value += 50;
41
+ nextTick(() => {
42
+ if (el) el.scrollTop += el.scrollHeight - prevHeight;
43
+ });
39
44
  }
40
45
  const inputText = ref('');
41
46
  const isProcessing = ref(false);
@@ -24,6 +24,7 @@ export function createConnection(deps) {
24
24
  let sessionKey = null;
25
25
  let reconnectAttempts = 0;
26
26
  let reconnectTimer = null;
27
+ const toolMsgMap = new Map(); // toolId -> message (for fast tool_result lookup)
27
28
 
28
29
  function wsSend(msg) {
29
30
  if (!ws || ws.readyState !== WebSocket.OPEN) return;
@@ -70,12 +71,14 @@ export function createConnection(deps) {
70
71
  finalizeStreamingMsg(scheduleHighlight);
71
72
 
72
73
  for (const tool of data.tools) {
73
- messages.value.push({
74
+ const toolMsg = {
74
75
  id: streaming.nextId(), role: 'tool',
75
76
  toolId: tool.id, toolName: tool.name || 'unknown',
76
77
  toolInput: tool.input ? JSON.stringify(tool.input, null, 2) : '',
77
78
  hasResult: false, expanded: (tool.name === 'Edit' || tool.name === 'TodoWrite'), timestamp: new Date(),
78
- });
79
+ };
80
+ messages.value.push(toolMsg);
81
+ if (tool.id) toolMsgMap.set(tool.id, toolMsg);
79
82
  }
80
83
  scrollToBottom();
81
84
  return;
@@ -85,9 +88,7 @@ export function createConnection(deps) {
85
88
  const result = data.tool_use_result;
86
89
  const results = Array.isArray(result) ? result : [result];
87
90
  for (const r of results) {
88
- const toolMsg = [...messages.value].reverse().find(
89
- m => m.role === 'tool' && m.toolId === r.tool_use_id
90
- );
91
+ const toolMsg = toolMsgMap.get(r.tool_use_id);
91
92
  if (toolMsg) {
92
93
  toolMsg.toolOutput = typeof r.content === 'string'
93
94
  ? r.content : JSON.stringify(r.content, null, 2);
@@ -272,6 +273,7 @@ export function createConnection(deps) {
272
273
  }
273
274
  }
274
275
  messages.value = batch;
276
+ toolMsgMap.clear();
275
277
  }
276
278
  loadingHistory.value = false;
277
279
  messages.value.push({
@@ -290,6 +292,7 @@ export function createConnection(deps) {
290
292
  workDir.value = msg.workDir;
291
293
  localStorage.setItem('agentlink-workdir', msg.workDir);
292
294
  messages.value = [];
295
+ toolMsgMap.clear();
293
296
  visibleLimit.value = 50;
294
297
  streaming.setMessageIdCounter(0);
295
298
  streaming.setStreamingMessageId(null);
package/web/style.css CHANGED
@@ -438,7 +438,7 @@ body {
438
438
  .message-list {
439
439
  flex: 1;
440
440
  overflow-y: auto;
441
- padding: 1.5rem 1.5rem 0.5rem;
441
+ padding: 1.5rem 1.5rem 1rem;
442
442
  display: flex;
443
443
  flex-direction: column;
444
444
  gap: 0.25rem;
@@ -1292,17 +1292,6 @@ body {
1292
1292
  position: relative;
1293
1293
  }
1294
1294
 
1295
- .input-area::before {
1296
- content: '';
1297
- position: absolute;
1298
- top: -2rem;
1299
- left: 0;
1300
- right: 0;
1301
- height: 2rem;
1302
- background: linear-gradient(to top, var(--bg-primary), transparent);
1303
- pointer-events: none;
1304
- }
1305
-
1306
1295
  .input-card {
1307
1296
  max-width: 768px;
1308
1297
  margin: 0 auto;