groove-dev 0.26.7 → 0.26.9

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.
@@ -126,18 +126,21 @@ export class AgentLoop extends EventEmitter {
126
126
  }
127
127
  this.messages.push(assistantMsg);
128
128
 
129
- // Broadcast text output to GUI
130
- if (content) {
131
- this._writeLog({ type: 'assistant', content: content.slice(0, 2000) });
132
- this.emit('output', { type: 'activity', subtype: 'text', data: content });
133
- }
134
-
135
- // No tool calls → turn complete, go idle
129
+ // No tool calls → turn complete, broadcast final text and go idle
136
130
  if (!toolCalls || toolCalls.length === 0) {
131
+ if (content) {
132
+ this._writeLog({ type: 'assistant', content: content.slice(0, 2000) });
133
+ }
137
134
  this.emit('output', { type: 'result', data: content || 'Turn complete', turns: this.turns });
138
135
  break;
139
136
  }
140
137
 
138
+ // Has tool calls — broadcast text before executing tools (if model sent text + tools)
139
+ if (content) {
140
+ this._writeLog({ type: 'assistant', content: content.slice(0, 2000) });
141
+ this.emit('output', { type: 'activity', subtype: 'text', data: content });
142
+ }
143
+
141
144
  // Execute each tool call
142
145
  for (const call of toolCalls) {
143
146
  if (!this.running) break;
@@ -148,9 +148,23 @@ export function createApi(app, daemon) {
148
148
  app.post('/api/providers/ollama/pull', async (req, res) => {
149
149
  const { model } = req.body;
150
150
  if (!model) return res.status(400).json({ error: 'model is required' });
151
- if (!OllamaProvider.isInstalled()) return res.status(400).json({ error: 'Ollama is not installed' });
152
- const broadcast = daemon.broadcast || (() => {});
151
+ if (!OllamaProvider.isInstalled()) return res.status(400).json({ error: 'Ollama is not installed. Install with: brew install ollama' });
152
+ const broadcast = daemon.broadcast.bind(daemon);
153
153
  try {
154
+ // Auto-start Ollama server if not running
155
+ const running = await OllamaProvider.isServerRunning();
156
+ if (!running) {
157
+ broadcast({ type: 'ollama:serve:starting' });
158
+ OllamaProvider.startServer();
159
+ // Wait for server to be ready (up to 10s)
160
+ for (let i = 0; i < 20; i++) {
161
+ await new Promise((r) => setTimeout(r, 500));
162
+ if (await OllamaProvider.isServerRunning()) break;
163
+ }
164
+ if (!(await OllamaProvider.isServerRunning())) {
165
+ return res.status(500).json({ error: 'Could not start Ollama server. Run `ollama serve` manually.' });
166
+ }
167
+ }
154
168
  broadcast({ type: 'ollama:pull:start', model });
155
169
  await OllamaProvider.pullModel(model, (progress) => {
156
170
  broadcast({ type: 'ollama:pull:progress', model, progress: progress.trim() });