@openagents-org/agent-launcher 0.2.120 → 0.2.121

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagents-org/agent-launcher",
3
- "version": "0.2.120",
3
+ "version": "0.2.121",
4
4
  "description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -500,6 +500,18 @@ class BaseAdapter {
500
500
  }
501
501
  }
502
502
 
503
+ async getRemainingTodos(channel) {
504
+ try {
505
+ const result = await this.client.getTodos(this.workspaceId, channel, this.token, {
506
+ all: false,
507
+ });
508
+ const todos = (result && result.todos) || [];
509
+ return todos.filter((t) => t.status === 'pending' || t.status === 'in_progress');
510
+ } catch {
511
+ return [];
512
+ }
513
+ }
514
+
503
515
  async sendTodos(channel, todos) {
504
516
  try {
505
517
  await this.client.putTodos(this.workspaceId, channel, this.token, todos, {
@@ -798,10 +798,33 @@ class ClaudeAdapter extends BaseAdapter {
798
798
 
799
799
  delete this._channelProcesses[msgChannel];
800
800
 
801
- // Clean up stale todos: mark pending/in_progress as cancelled
802
- try { await this.cleanupTodos(msgChannel); } catch {}
803
-
804
801
  const stoppedByUser = this._stoppingChannels.has(msgChannel);
802
+
803
+ if (stoppedByUser) {
804
+ // User explicitly stopped — cancel all remaining todos
805
+ try { await this.cleanupTodos(msgChannel); } catch {}
806
+ } else if (!msg._todoNudge) {
807
+ // Normal exit (not already a nudge) — check for remaining pending todos
808
+ try {
809
+ const remaining = await this.getRemainingTodos(msgChannel);
810
+ if (remaining.length > 0) {
811
+ const items = remaining.map((t) => `- ${t.content}`).join('\n');
812
+ const nudge = `You have ${remaining.length} remaining task(s) from your plan:\n${items}\n\nPlease continue working on them.`;
813
+ if (!this._channelQueues[msgChannel]) this._channelQueues[msgChannel] = [];
814
+ this._channelQueues[msgChannel].push({
815
+ content: nudge,
816
+ senderType: 'system',
817
+ senderName: 'system:todos',
818
+ sessionId: msgChannel,
819
+ messageType: 'chat',
820
+ _todoNudge: true,
821
+ });
822
+ }
823
+ } catch {}
824
+ } else {
825
+ // Nudge response finished but todos still pending — cancel to avoid infinite loop
826
+ try { await this.cleanupTodos(msgChannel); } catch {}
827
+ }
805
828
  if (stoppedByUser) {
806
829
  this._stoppingChannels.delete(msgChannel);
807
830
  resolve(false);