claude-remote-agent 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/agent.js +11 -2
  2. package/package.json +1 -1
package/agent.js CHANGED
@@ -407,6 +407,8 @@ function handleChatMessage(sessionId, text, images) {
407
407
  });
408
408
 
409
409
  let buffer = '';
410
+ let lastTextLen = 0;
411
+ let sentToolIds = new Set();
410
412
 
411
413
  proc.stdout.on('data', (chunk) => {
412
414
  buffer += chunk.toString();
@@ -421,13 +423,20 @@ function handleChatMessage(sessionId, text, images) {
421
423
  session.claudeSessionId = obj.session_id;
422
424
  console.log(`[${ts()}] Chat ${sessionId.slice(0, 8)} got claude session: ${obj.session_id.slice(0, 8)}`);
423
425
  }
426
+ let fullText = '';
424
427
  for (const block of obj.message.content) {
425
428
  if (block.type === 'text') {
426
- send({ type: 'chat-text', sessionId, text: block.text, done: false });
427
- } else if (block.type === 'tool_use') {
429
+ fullText += block.text;
430
+ } else if (block.type === 'tool_use' && !sentToolIds.has(block.id)) {
431
+ sentToolIds.add(block.id);
428
432
  send({ type: 'chat-tool', sessionId, tool: block.name, input: block.input });
429
433
  }
430
434
  }
435
+ if (fullText.length > lastTextLen) {
436
+ const delta = fullText.slice(lastTextLen);
437
+ lastTextLen = fullText.length;
438
+ send({ type: 'chat-text', sessionId, text: delta, done: false });
439
+ }
431
440
  } else if (obj.type === 'result') {
432
441
  if (obj.session_id && !session.claudeSessionId) {
433
442
  session.claudeSessionId = obj.session_id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-remote-agent",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Agent for Claude Remote — connects your machine to the relay server",
5
5
  "bin": {
6
6
  "claude-remote-agent": "./cli.js"