tuna-agent 0.1.167 → 0.1.168

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.
@@ -221,6 +221,15 @@ export async function startDaemon(config) {
221
221
  }
222
222
  // Per-agent concurrency: if busy, queue instead of rejecting.
223
223
  const agentId = task.agentId || '__default__';
224
+ // Dedup: the API sweep re-dispatches queued tasks every 30s. Without this,
225
+ // a task sent repeatedly while the agent is busy piles up as duplicates in
226
+ // the queue (and would run N times). Ignore if already running or queued.
227
+ const alreadyRunning = Array.from(activeAgentTasks.values()).includes(task.id);
228
+ const alreadyQueued = (agentQueues.get(agentId) || []).some((it) => it.kind === 'task' && it.task.id === task.id);
229
+ if (alreadyRunning || alreadyQueued) {
230
+ console.log(`[Daemon] Task ${task.id} already running/queued — ignoring duplicate dispatch`);
231
+ break;
232
+ }
224
233
  if (activeAgentTasks.has(agentId)) {
225
234
  enqueueForAgent(agentId, { kind: 'task', task });
226
235
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuna-agent",
3
- "version": "0.1.167",
3
+ "version": "0.1.168",
4
4
  "description": "Tuna Agent - Run AI coding tasks on your machine",
5
5
  "bin": {
6
6
  "tuna-agent": "dist/cli/index.js"