lunel-cli 0.1.54 → 0.1.55

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.
@@ -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
- return this.readString(thread.title)
1035
- ?? this.readString(thread.name)
1036
- ?? this.readString(payload.title)
1037
- ?? this.readString(payload.name);
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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lunel-cli",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "author": [
5
5
  {
6
6
  "name": "Soham Bharambe",