groove-dev 0.26.0 → 0.26.2
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/node_modules/@groove-dev/daemon/src/agent-loop.js +3 -38
- package/node_modules/@groove-dev/gui/dist/assets/{index-BqL4GcgZ.js → index-BC2Bhfv0.js} +22 -22
- package/node_modules/@groove-dev/gui/dist/index.html +1 -1
- package/node_modules/@groove-dev/gui/src/stores/groove.js +7 -1
- package/package.json +1 -1
- package/packages/daemon/src/agent-loop.js +3 -38
- package/packages/gui/dist/assets/{index-BqL4GcgZ.js → index-BC2Bhfv0.js} +22 -22
- package/packages/gui/dist/index.html +1 -1
- package/packages/gui/src/stores/groove.js +7 -1
|
@@ -28,7 +28,6 @@ export class AgentLoop extends EventEmitter {
|
|
|
28
28
|
this.turns = 0;
|
|
29
29
|
this.toolCallCount = 0;
|
|
30
30
|
this.startedAt = Date.now();
|
|
31
|
-
this.lastContextUsage = 0;
|
|
32
31
|
|
|
33
32
|
// Tool executor — sandboxed to agent's working directory
|
|
34
33
|
this.executor = new ToolExecutor(
|
|
@@ -190,8 +189,9 @@ export class AgentLoop extends EventEmitter {
|
|
|
190
189
|
});
|
|
191
190
|
}
|
|
192
191
|
|
|
193
|
-
// Context
|
|
194
|
-
|
|
192
|
+
// Context rotation is handled by the Rotator's 15s polling loop
|
|
193
|
+
// which checks registry.contextUsage against the adaptive threshold.
|
|
194
|
+
// The journalist has full logs — no need for in-loop compaction.
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -356,7 +356,6 @@ export class AgentLoop extends EventEmitter {
|
|
|
356
356
|
// Context usage = how full the context window is
|
|
357
357
|
const contextWindow = this.config.contextWindow || 32768;
|
|
358
358
|
const contextUsage = contextWindow > 0 ? Math.min(inputTokens / contextWindow, 1) : 0;
|
|
359
|
-
this.lastContextUsage = contextUsage;
|
|
360
359
|
|
|
361
360
|
// Emit token event — ProcessManager handles registry updates + subsystem feeding
|
|
362
361
|
this.emit('output', {
|
|
@@ -369,40 +368,6 @@ export class AgentLoop extends EventEmitter {
|
|
|
369
368
|
});
|
|
370
369
|
}
|
|
371
370
|
|
|
372
|
-
// --- Context Management ---
|
|
373
|
-
|
|
374
|
-
_checkContext() {
|
|
375
|
-
// Compact old messages to buy time before rotation kicks in
|
|
376
|
-
// (Uses internal tracker — registry.contextUsage is set by PM handler)
|
|
377
|
-
if (this.lastContextUsage > 0.7 && this.messages.length > 20) {
|
|
378
|
-
this._compactHistory();
|
|
379
|
-
}
|
|
380
|
-
// Rotation itself is handled by the Rotator's 15s polling loop
|
|
381
|
-
// which checks registry.contextUsage against adaptive threshold
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
_compactHistory() {
|
|
385
|
-
const systemPrompt = this.messages[0];
|
|
386
|
-
const keepRecent = 14;
|
|
387
|
-
|
|
388
|
-
if (this.messages.length <= keepRecent + 2) return;
|
|
389
|
-
|
|
390
|
-
// Truncate tool results in old messages to save tokens
|
|
391
|
-
const old = this.messages.slice(1, -(keepRecent));
|
|
392
|
-
const compacted = old.map((msg) => {
|
|
393
|
-
if (msg.role === 'tool' && msg.content && msg.content.length > 200) {
|
|
394
|
-
return { ...msg, content: msg.content.slice(0, 150) + '\n[... truncated to save context]' };
|
|
395
|
-
}
|
|
396
|
-
if (msg.role === 'assistant' && msg.content && msg.content.length > 500) {
|
|
397
|
-
return { ...msg, content: msg.content.slice(0, 400) + '\n[... truncated]' };
|
|
398
|
-
}
|
|
399
|
-
return msg;
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
const recent = this.messages.slice(-(keepRecent));
|
|
403
|
-
this.messages = [systemPrompt, ...compacted, ...recent];
|
|
404
|
-
}
|
|
405
|
-
|
|
406
371
|
// --- System Prompt ---
|
|
407
372
|
|
|
408
373
|
_buildSystemPrompt() {
|