@tractorscorch/clank 1.3.0 → 1.4.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.
@@ -228,6 +228,8 @@
228
228
  if (f.type === 'hello') {
229
229
  setStatus(true);
230
230
  if (f.agents?.length) { currentAgent = f.agents[0].id; document.getElementById('chat-agent').textContent = f.agents[0].name; document.getElementById('chat-model').textContent = f.agents[0].model; }
231
+ // Load session history on connect
232
+ loadChatHistory();
231
233
  return;
232
234
  }
233
235
  if (f.type === 'res' && f.ok && !streaming) return;
@@ -261,6 +263,21 @@
261
263
  }
262
264
 
263
265
  // === Chat ===
266
+ async function loadChatHistory() {
267
+ try {
268
+ const messages = await rpc('chat.history', { sessionKey: currentSession, limit: 50 });
269
+ if (messages?.length) {
270
+ document.getElementById('chat-messages').innerHTML = '';
271
+ for (const msg of messages) {
272
+ const content = typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content);
273
+ if (msg.role === 'user' || msg.role === 'assistant') {
274
+ addMsg(msg.role, content, msg.role === 'assistant');
275
+ }
276
+ }
277
+ }
278
+ } catch {}
279
+ }
280
+
264
281
  function sendMessage() {
265
282
  const text = document.getElementById('input').value.trim();
266
283
  if (!text || !ws) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tractorscorch/clank",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Local-first AI agent gateway. Open-source alternative to OpenClaw, optimized for local models.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",