lunel-cli 0.1.69 → 0.1.70

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.
@@ -72,8 +72,6 @@ export declare class CodexProvider implements AIProvider {
72
72
  private mergeSession;
73
73
  private upsertSession;
74
74
  private ensureLocalSession;
75
- private getTransportThreadId;
76
- private findSessionByThreadId;
77
75
  private ensureThreadResumed;
78
76
  private resolveSessionFromPayload;
79
77
  private resolveInFlightTurnId;
package/dist/ai/codex.js CHANGED
@@ -102,9 +102,8 @@ export class CodexProvider {
102
102
  }
103
103
  async getMessages(sessionId) {
104
104
  const session = this.ensureLocalSession(sessionId);
105
- const transportThreadId = this.getTransportThreadId(session);
106
105
  const result = await this.call("thread/read", {
107
- threadId: transportThreadId,
106
+ threadId: session.id,
108
107
  includeTurns: true,
109
108
  });
110
109
  const threadObject = this.extractThreadObject(result);
@@ -121,7 +120,6 @@ export class CodexProvider {
121
120
  createdAt: this.extractCreatedAt(threadObject) ?? session.createdAt,
122
121
  updatedAt: this.extractUpdatedAt(threadObject) ?? session.updatedAt,
123
122
  archived: false,
124
- transportThreadId,
125
123
  cwd: this.extractThreadCwd(threadObject) ?? session.cwd,
126
124
  });
127
125
  return { messages: session.messages };
@@ -131,12 +129,12 @@ export class CodexProvider {
131
129
  session.updatedAt = Date.now();
132
130
  (async () => {
133
131
  try {
134
- await this.ensureThreadResumed(this.getTransportThreadId(session));
132
+ await this.ensureThreadResumed(session.id);
135
133
  let imageUrlKey = "url";
136
134
  while (true) {
137
135
  try {
138
136
  await this.call("turn/start", {
139
- threadId: this.getTransportThreadId(session),
137
+ threadId: session.id,
140
138
  input: this.makeTurnInputPayload(text, files, imageUrlKey),
141
139
  ...(model ? { model: model.providerID === "codex" ? model.modelID : `${model.providerID}/${model.modelID}` } : {}),
142
140
  ...(agent ? { agent } : {}),
@@ -164,13 +162,12 @@ export class CodexProvider {
164
162
  }
165
163
  async abort(sessionId) {
166
164
  const session = this.ensureLocalSession(sessionId);
167
- const transportThreadId = this.getTransportThreadId(session);
168
- const turnId = session.activeTurnId ?? await this.resolveInFlightTurnId(transportThreadId);
165
+ const turnId = session.activeTurnId ?? await this.resolveInFlightTurnId(session.id);
169
166
  if (!turnId) {
170
167
  throw new Error(`Session ${sessionId} has no active interruptible Codex turn`);
171
168
  }
172
169
  session.activeTurnId = turnId;
173
- await this.call("turn/interrupt", { threadId: transportThreadId, turnId });
170
+ await this.call("turn/interrupt", { threadId: session.id, turnId });
174
171
  return {};
175
172
  }
176
173
  async agents() {
@@ -668,9 +665,8 @@ export class CodexProvider {
668
665
  }
669
666
  async refreshSessionMetadata(sessionId) {
670
667
  const session = this.sessions.get(sessionId);
671
- const transportThreadId = session ? this.getTransportThreadId(session) : sessionId;
672
668
  const result = await this.call("thread/read", {
673
- threadId: transportThreadId,
669
+ threadId: sessionId,
674
670
  includeTurns: false,
675
671
  });
676
672
  const threadObject = this.extractThreadObject(result);
@@ -683,7 +679,6 @@ export class CodexProvider {
683
679
  createdAt: this.extractCreatedAt(threadObject) ?? session?.createdAt ?? Date.now(),
684
680
  updatedAt: this.extractUpdatedAt(threadObject) ?? session?.updatedAt ?? Date.now(),
685
681
  archived: false,
686
- transportThreadId,
687
682
  cwd: this.extractThreadCwd(threadObject) ?? session?.cwd,
688
683
  }, true);
689
684
  }
@@ -810,7 +805,6 @@ export class CodexProvider {
810
805
  createdAt: input.createdAt ?? Date.now(),
811
806
  updatedAt: input.updatedAt ?? Date.now(),
812
807
  archived: input.archived ?? false,
813
- transportThreadId: input.transportThreadId ?? input.id,
814
808
  cwd: input.cwd,
815
809
  messages: [],
816
810
  };
@@ -821,19 +815,17 @@ export class CodexProvider {
821
815
  ? Math.max(existing.updatedAt, input.updatedAt)
822
816
  : existing.updatedAt;
823
817
  existing.archived = input.archived ?? existing.archived ?? false;
824
- existing.transportThreadId = input.transportThreadId ?? input.id ?? existing.transportThreadId ?? existing.id;
825
818
  existing.cwd = input.cwd ?? existing.cwd;
826
819
  return existing;
827
820
  }
828
821
  upsertSession(input, emitUpdated = false) {
829
- const existing = this.findSessionByThreadId(input.id);
822
+ const existing = this.sessions.get(input.id);
830
823
  const before = existing
831
824
  ? {
832
825
  title: existing.title,
833
826
  createdAt: existing.createdAt,
834
827
  updatedAt: existing.updatedAt,
835
828
  archived: existing.archived ?? false,
836
- transportThreadId: existing.transportThreadId ?? existing.id,
837
829
  cwd: existing.cwd,
838
830
  }
839
831
  : null;
@@ -844,7 +836,6 @@ export class CodexProvider {
844
836
  || before.createdAt !== session.createdAt
845
837
  || before.updatedAt !== session.updatedAt
846
838
  || before.archived !== (session.archived ?? false)
847
- || before.transportThreadId !== (session.transportThreadId ?? session.id)
848
839
  || before.cwd !== session.cwd;
849
840
  if (emitUpdated && changed) {
850
841
  this.emitter?.({ type: "session.updated", properties: { info: this.toSessionInfo(session) } });
@@ -857,20 +848,6 @@ export class CodexProvider {
857
848
  return existing;
858
849
  return this.upsertSession({ id: sessionId, title: "Conversation", createdAt: Date.now(), updatedAt: Date.now() });
859
850
  }
860
- getTransportThreadId(session) {
861
- return session.transportThreadId ?? session.id;
862
- }
863
- findSessionByThreadId(threadId) {
864
- const direct = this.sessions.get(threadId);
865
- if (direct)
866
- return direct;
867
- for (const session of this.sessions.values()) {
868
- if ((session.transportThreadId ?? session.id) === threadId) {
869
- return session;
870
- }
871
- }
872
- return undefined;
873
- }
874
851
  async ensureThreadResumed(threadId) {
875
852
  if (!threadId || this.resumedThreadIds.has(threadId)) {
876
853
  return;
@@ -882,7 +859,7 @@ export class CodexProvider {
882
859
  const threadId = this.extractThreadId(payload);
883
860
  if (!threadId)
884
861
  return undefined;
885
- return this.findSessionByThreadId(threadId) ?? this.ensureLocalSession(threadId);
862
+ return this.ensureLocalSession(threadId);
886
863
  }
887
864
  async resolveInFlightTurnId(threadId) {
888
865
  const result = await this.call("thread/read", { threadId, includeTurns: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lunel-cli",
3
- "version": "0.1.69",
3
+ "version": "0.1.70",
4
4
  "author": [
5
5
  {
6
6
  "name": "Soham Bharambe",