lunel-cli 0.1.70 → 0.1.71
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/dist/ai/codex.js +26 -3
- package/package.json +1 -1
package/dist/ai/codex.js
CHANGED
|
@@ -848,11 +848,34 @@ export class CodexProvider {
|
|
|
848
848
|
return existing;
|
|
849
849
|
return this.upsertSession({ id: sessionId, title: "Conversation", createdAt: Date.now(), updatedAt: Date.now() });
|
|
850
850
|
}
|
|
851
|
-
async ensureThreadResumed(threadId) {
|
|
851
|
+
async ensureThreadResumed(threadId, force = false) {
|
|
852
852
|
if (!threadId || this.resumedThreadIds.has(threadId)) {
|
|
853
|
-
|
|
853
|
+
if (!force)
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
const session = this.sessions.get(threadId);
|
|
857
|
+
const params = { threadId };
|
|
858
|
+
if (session?.cwd) {
|
|
859
|
+
params.cwd = session.cwd;
|
|
860
|
+
}
|
|
861
|
+
const result = await this.call("thread/resume", params);
|
|
862
|
+
const payload = this.asRecord(result);
|
|
863
|
+
const threadValue = payload.thread;
|
|
864
|
+
const threadObject = threadValue ? this.asRecord(threadValue) : this.extractThreadObject(result);
|
|
865
|
+
if (threadObject && Object.keys(threadObject).length > 0) {
|
|
866
|
+
const nextSession = this.upsertSession({
|
|
867
|
+
id: threadId,
|
|
868
|
+
title: this.extractThreadTitle(threadObject),
|
|
869
|
+
createdAt: this.extractCreatedAt(threadObject) ?? session?.createdAt ?? Date.now(),
|
|
870
|
+
updatedAt: this.extractUpdatedAt(threadObject) ?? session?.updatedAt ?? Date.now(),
|
|
871
|
+
archived: false,
|
|
872
|
+
cwd: this.extractThreadCwd(threadObject) ?? session?.cwd,
|
|
873
|
+
}, true);
|
|
874
|
+
const historyMessages = this.decodeMessagesFromThreadRead(threadId, threadObject);
|
|
875
|
+
if (historyMessages.length > 0 && (!nextSession.activeTurnId || nextSession.messages.length === 0 || force)) {
|
|
876
|
+
nextSession.messages = historyMessages;
|
|
877
|
+
}
|
|
854
878
|
}
|
|
855
|
-
await this.call("thread/resume", { threadId });
|
|
856
879
|
this.resumedThreadIds.add(threadId);
|
|
857
880
|
}
|
|
858
881
|
resolveSessionFromPayload(payload) {
|