lunel-cli 0.1.54 → 0.1.56
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.d.ts +1 -0
- package/dist/ai/codex.js +32 -5
- package/package.json +1 -1
package/dist/ai/codex.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export declare class CodexProvider implements AIProvider {
|
|
|
58
58
|
private ensureAssistantMessage;
|
|
59
59
|
private upsertLocalMessagePart;
|
|
60
60
|
private fetchServerThreads;
|
|
61
|
+
private refreshSessionMetadata;
|
|
61
62
|
private fetchServerThreadsByArchiveState;
|
|
62
63
|
private fetchModels;
|
|
63
64
|
private parseThreadListEntry;
|
package/dist/ai/codex.js
CHANGED
|
@@ -348,6 +348,9 @@ export class CodexProvider {
|
|
|
348
348
|
session.activeTurnId = undefined;
|
|
349
349
|
session.updatedAt = Date.now();
|
|
350
350
|
this.finishAssistantTurn(session, params, method === "turn/failed");
|
|
351
|
+
this.refreshSessionMetadata(session.id).catch(() => {
|
|
352
|
+
// Best-effort metadata refresh for title/preview updates after a turn ends.
|
|
353
|
+
});
|
|
351
354
|
this.emitter?.({ type: "session.idle", properties: { sessionID: session.id } });
|
|
352
355
|
if (method === "turn/failed") {
|
|
353
356
|
const error = this.readString(this.asRecord(params.error).message) ?? "Turn failed";
|
|
@@ -625,6 +628,24 @@ export class CodexProvider {
|
|
|
625
628
|
async fetchServerThreads() {
|
|
626
629
|
return this.fetchServerThreadsByArchiveState(false);
|
|
627
630
|
}
|
|
631
|
+
async refreshSessionMetadata(sessionId) {
|
|
632
|
+
const session = this.sessions.get(sessionId);
|
|
633
|
+
const result = await this.call("thread/read", {
|
|
634
|
+
threadId: sessionId,
|
|
635
|
+
includeTurns: false,
|
|
636
|
+
});
|
|
637
|
+
const threadObject = this.extractThreadObject(result);
|
|
638
|
+
if (!threadObject || Object.keys(threadObject).length === 0) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
this.upsertSession({
|
|
642
|
+
id: sessionId,
|
|
643
|
+
title: this.extractThreadTitle(threadObject),
|
|
644
|
+
createdAt: this.extractCreatedAt(threadObject) ?? session?.createdAt ?? Date.now(),
|
|
645
|
+
updatedAt: this.extractUpdatedAt(threadObject) ?? session?.updatedAt ?? Date.now(),
|
|
646
|
+
archived: false,
|
|
647
|
+
}, true);
|
|
648
|
+
}
|
|
628
649
|
async fetchServerThreadsByArchiveState(archived) {
|
|
629
650
|
const threads = [];
|
|
630
651
|
let nextCursor = null;
|
|
@@ -1031,10 +1052,16 @@ export class CodexProvider {
|
|
|
1031
1052
|
}
|
|
1032
1053
|
extractThreadTitle(payload) {
|
|
1033
1054
|
const thread = this.asRecord(payload.thread);
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1055
|
+
const explicitName = this.readString(thread.name) ?? this.readString(payload.name);
|
|
1056
|
+
if (explicitName)
|
|
1057
|
+
return explicitName;
|
|
1058
|
+
const explicitTitle = this.readString(thread.title) ?? this.readString(payload.title);
|
|
1059
|
+
if (explicitTitle)
|
|
1060
|
+
return explicitTitle;
|
|
1061
|
+
const preview = this.readString(thread.preview) ?? this.readString(payload.preview);
|
|
1062
|
+
if (!preview)
|
|
1063
|
+
return undefined;
|
|
1064
|
+
return preview.charAt(0).toUpperCase() + preview.slice(1);
|
|
1038
1065
|
}
|
|
1039
1066
|
extractTurnId(payload) {
|
|
1040
1067
|
return (this.readString(payload.turnId)
|
|
@@ -1080,7 +1107,7 @@ export class CodexProvider {
|
|
|
1080
1107
|
if (!payload || typeof payload !== "object")
|
|
1081
1108
|
return undefined;
|
|
1082
1109
|
const obj = payload;
|
|
1083
|
-
const direct = this.readString(obj.threadId) ?? this.readString(obj.thread_id);
|
|
1110
|
+
const direct = this.readString(obj.threadId) ?? this.readString(obj.thread_id) ?? this.readString(obj.id);
|
|
1084
1111
|
if (direct)
|
|
1085
1112
|
return direct;
|
|
1086
1113
|
const thread = this.asRecord(obj.thread);
|