tuna-agent 0.1.128 → 0.1.129

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.
@@ -137,17 +137,32 @@ export async function handleClaudePromptStream(ws, code, taskId, prompt, systemP
137
137
  includePartialMessages: true,
138
138
  timeoutMs: 200000,
139
139
  signal: abortController.signal,
140
- onStreamLine: (data) => {
141
- if (data.type === 'stream_event') {
142
- const event = data.event;
143
- if (event?.type === 'content_block_delta') {
144
- const delta = event.delta;
145
- if (delta?.type === 'text_delta' && delta.text) {
146
- ws.sendExtensionStream(code, taskId, delta.text);
140
+ onStreamLine: (() => {
141
+ let sentTextPhase = false;
142
+ return (data) => {
143
+ if (data.type === 'stream_event') {
144
+ const event = data.event;
145
+ if (event?.type === 'content_block_start') {
146
+ const cb = event.content_block;
147
+ if (cb?.type === 'thinking') {
148
+ ws.sendExtensionStream(code, taskId, '__PHASE:thinking__');
149
+ }
150
+ }
151
+ if (event?.type === 'content_block_delta') {
152
+ const delta = event.delta;
153
+ if (delta?.type === 'text_delta') {
154
+ if (!sentTextPhase) {
155
+ sentTextPhase = true;
156
+ ws.sendExtensionStream(code, taskId, '__PHASE:writing__');
157
+ }
158
+ if (delta.text) {
159
+ ws.sendExtensionStream(code, taskId, delta.text);
160
+ }
161
+ }
147
162
  }
148
163
  }
149
- }
150
- },
164
+ };
165
+ })(),
151
166
  });
152
167
  const text = typeof result === 'string' ? result : result.result || JSON.stringify(result);
153
168
  console.log(`[claude_prompt_stream] Done: ${text.substring(0, 200)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuna-agent",
3
- "version": "0.1.128",
3
+ "version": "0.1.129",
4
4
  "description": "Tuna Agent - Run AI coding tasks on your machine",
5
5
  "bin": {
6
6
  "tuna-agent": "dist/cli/index.js"