lunel-cli 0.1.81 → 0.1.82

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.
@@ -6,6 +6,7 @@ export declare class CodexProvider implements AIProvider {
6
6
  private nextId;
7
7
  private pending;
8
8
  private sessions;
9
+ private deletedThreadIds;
9
10
  private resumedThreadIds;
10
11
  private pendingPermissionRequestIds;
11
12
  private assistantMessageIdByTurnId;
@@ -22,7 +23,9 @@ export declare class CodexProvider implements AIProvider {
22
23
  getSession(id: string): Promise<{
23
24
  session: SessionInfo;
24
25
  }>;
25
- deleteSession(id: string): Promise<Record<string, never>>;
26
+ deleteSession(id: string): Promise<{
27
+ deleted: boolean;
28
+ }>;
26
29
  getMessages(sessionId: string): Promise<{
27
30
  messages: MessageInfo[];
28
31
  }>;
package/dist/ai/codex.js CHANGED
@@ -13,6 +13,7 @@ export class CodexProvider {
13
13
  nextId = 1;
14
14
  pending = new Map();
15
15
  sessions = new Map();
16
+ deletedThreadIds = new Set();
16
17
  resumedThreadIds = new Set();
17
18
  pendingPermissionRequestIds = new Map();
18
19
  assistantMessageIdByTurnId = new Map();
@@ -81,6 +82,8 @@ export class CodexProvider {
81
82
  }
82
83
  this.reconcileSessionsWithServer(activeThreads, archivedThreads);
83
84
  const sessions = Array.from(this.sessions.values())
85
+ .filter((session) => !session.archived)
86
+ .filter((session) => !this.deletedThreadIds.has(session.id))
84
87
  .filter((session) => this.belongsToCurrentRoot(session))
85
88
  .sort((a, b) => a.updatedAt - b.updatedAt)
86
89
  .map((session) => this.toSessionInfo(session));
@@ -99,8 +102,21 @@ export class CodexProvider {
99
102
  return { session: this.toSessionInfo(next) };
100
103
  }
101
104
  async deleteSession(id) {
105
+ const session = this.sessions.get(id);
106
+ this.deletedThreadIds.add(id);
102
107
  this.sessions.delete(id);
103
- return {};
108
+ this.resumedThreadIds.delete(id);
109
+ try {
110
+ const params = { threadId: id };
111
+ if (session?.cwd) {
112
+ params.cwd = session.cwd;
113
+ }
114
+ await this.call("thread/archive", params);
115
+ }
116
+ catch {
117
+ // Match Remodex behavior: delete is optimistic locally, archive is best effort.
118
+ }
119
+ return { deleted: true };
104
120
  }
105
121
  async getMessages(sessionId) {
106
122
  const session = this.ensureLocalSession(sessionId);
@@ -783,10 +799,14 @@ export class CodexProvider {
783
799
  const localSessions = this.sessions;
784
800
  const merged = new Map();
785
801
  for (const thread of activeThreads) {
802
+ if (this.deletedThreadIds.has(thread.id))
803
+ continue;
786
804
  const session = this.mergeSession(localSessions.get(thread.id), { ...thread, archived: false });
787
805
  merged.set(thread.id, session);
788
806
  }
789
807
  for (const thread of archivedThreads) {
808
+ if (this.deletedThreadIds.has(thread.id))
809
+ continue;
790
810
  if (merged.has(thread.id))
791
811
  continue;
792
812
  const session = this.mergeSession(localSessions.get(thread.id), { ...thread, archived: true });
@@ -20,7 +20,9 @@ export declare class AiManager {
20
20
  getSession(backend: AiBackend, id: string): Promise<{
21
21
  session: import("./interface.js").SessionInfo;
22
22
  }>;
23
- deleteSession(backend: AiBackend, id: string): Promise<Record<string, never>>;
23
+ deleteSession(backend: AiBackend, id: string): Promise<{
24
+ deleted: boolean;
25
+ }>;
24
26
  getMessages(backend: AiBackend, sessionId: string): Promise<{
25
27
  messages: import("./interface.js").MessageInfo[];
26
28
  }>;
@@ -53,7 +53,9 @@ export interface AIProvider {
53
53
  getSession(id: string): Promise<{
54
54
  session: SessionInfo;
55
55
  }>;
56
- deleteSession(id: string): Promise<Record<string, never>>;
56
+ deleteSession(id: string): Promise<{
57
+ deleted: boolean;
58
+ }>;
57
59
  getMessages(sessionId: string): Promise<{
58
60
  messages: MessageInfo[];
59
61
  }>;
@@ -21,7 +21,9 @@ export declare class OpenCodeProvider implements AIProvider {
21
21
  getSession(id: string): Promise<{
22
22
  session: SessionInfo;
23
23
  }>;
24
- deleteSession(id: string): Promise<Record<string, never>>;
24
+ deleteSession(id: string): Promise<{
25
+ deleted: boolean;
26
+ }>;
25
27
  getMessages(sessionId: string): Promise<{
26
28
  messages: MessageInfo[];
27
29
  }>;
@@ -108,9 +108,7 @@ export class OpenCodeProvider {
108
108
  }
109
109
  async deleteSession(id) {
110
110
  const response = await this.client.session.delete({ path: { id } });
111
- if (response.error)
112
- throw new Error(JSON.stringify(response.error));
113
- return {};
111
+ return { deleted: Boolean(requireData(response, "session.delete")) };
114
112
  }
115
113
  // -------------------------------------------------------------------------
116
114
  // Messages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lunel-cli",
3
- "version": "0.1.81",
3
+ "version": "0.1.82",
4
4
  "author": [
5
5
  {
6
6
  "name": "Soham Bharambe",