lunel-cli 0.1.70 → 0.1.72

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.
Files changed (2) hide show
  1. package/dist/ai/codex.js +33 -8
  2. package/package.json +1 -1
package/dist/ai/codex.js CHANGED
@@ -53,19 +53,21 @@ export class CodexProvider {
53
53
  }
54
54
  async createSession(title) {
55
55
  const result = await this.call("thread/start", { cwd: process.cwd() });
56
- const threadId = this.extractThreadId(result);
56
+ const threadObject = this.extractThreadObject(result);
57
+ const threadId = this.extractThreadId(threadObject);
57
58
  if (!threadId) {
58
59
  throw new Error("thread/start response missing threadId");
59
60
  }
60
- const threadTitle = this.extractThreadTitleFromUnknown(result) ?? title ?? "Conversation";
61
+ const threadTitle = this.extractThreadTitle(threadObject) || title || "Conversation";
61
62
  const session = this.upsertSession({
62
63
  id: threadId,
63
64
  title: threadTitle,
64
- createdAt: this.extractCreatedAt(result) ?? Date.now(),
65
- updatedAt: this.extractUpdatedAt(result) ?? Date.now(),
65
+ createdAt: this.extractCreatedAt(threadObject) ?? Date.now(),
66
+ updatedAt: this.extractUpdatedAt(threadObject) ?? Date.now(),
66
67
  archived: false,
67
- cwd: this.extractThreadCwd(result) ?? process.cwd(),
68
+ cwd: this.extractThreadCwd(threadObject) ?? process.cwd(),
68
69
  });
70
+ this.resumedThreadIds.add(threadId);
69
71
  return { session: this.toSessionInfo(session) };
70
72
  }
71
73
  async listSessions() {
@@ -848,11 +850,34 @@ export class CodexProvider {
848
850
  return existing;
849
851
  return this.upsertSession({ id: sessionId, title: "Conversation", createdAt: Date.now(), updatedAt: Date.now() });
850
852
  }
851
- async ensureThreadResumed(threadId) {
853
+ async ensureThreadResumed(threadId, force = false) {
852
854
  if (!threadId || this.resumedThreadIds.has(threadId)) {
853
- return;
855
+ if (!force)
856
+ return;
857
+ }
858
+ const session = this.sessions.get(threadId);
859
+ const params = { threadId };
860
+ if (session?.cwd) {
861
+ params.cwd = session.cwd;
862
+ }
863
+ const result = await this.call("thread/resume", params);
864
+ const payload = this.asRecord(result);
865
+ const threadValue = payload.thread;
866
+ const threadObject = threadValue ? this.asRecord(threadValue) : this.extractThreadObject(result);
867
+ if (threadObject && Object.keys(threadObject).length > 0) {
868
+ const nextSession = this.upsertSession({
869
+ id: threadId,
870
+ title: this.extractThreadTitle(threadObject),
871
+ createdAt: this.extractCreatedAt(threadObject) ?? session?.createdAt ?? Date.now(),
872
+ updatedAt: this.extractUpdatedAt(threadObject) ?? session?.updatedAt ?? Date.now(),
873
+ archived: false,
874
+ cwd: this.extractThreadCwd(threadObject) ?? session?.cwd,
875
+ }, true);
876
+ const historyMessages = this.decodeMessagesFromThreadRead(threadId, threadObject);
877
+ if (historyMessages.length > 0 && (!nextSession.activeTurnId || nextSession.messages.length === 0 || force)) {
878
+ nextSession.messages = historyMessages;
879
+ }
854
880
  }
855
- await this.call("thread/resume", { threadId });
856
881
  this.resumedThreadIds.add(threadId);
857
882
  }
858
883
  resolveSessionFromPayload(payload) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lunel-cli",
3
- "version": "0.1.70",
3
+ "version": "0.1.72",
4
4
  "author": [
5
5
  {
6
6
  "name": "Soham Bharambe",