lunel-cli 0.1.68 → 0.1.69

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.
@@ -75,10 +75,6 @@ export declare class CodexProvider implements AIProvider {
75
75
  private getTransportThreadId;
76
76
  private findSessionByThreadId;
77
77
  private ensureThreadResumed;
78
- private shouldTreatAsThreadNotFound;
79
- private ensurePromptSessionReady;
80
- private createContinuationSession;
81
- private handleMissingThread;
82
78
  private resolveSessionFromPayload;
83
79
  private resolveInFlightTurnId;
84
80
  private decodeMessagesFromThreadRead;
package/dist/ai/codex.js CHANGED
@@ -131,12 +131,12 @@ export class CodexProvider {
131
131
  session.updatedAt = Date.now();
132
132
  (async () => {
133
133
  try {
134
- let targetSession = await this.ensurePromptSessionReady(session);
134
+ await this.ensureThreadResumed(this.getTransportThreadId(session));
135
135
  let imageUrlKey = "url";
136
136
  while (true) {
137
137
  try {
138
138
  await this.call("turn/start", {
139
- threadId: this.getTransportThreadId(targetSession),
139
+ threadId: this.getTransportThreadId(session),
140
140
  input: this.makeTurnInputPayload(text, files, imageUrlKey),
141
141
  ...(model ? { model: model.providerID === "codex" ? model.modelID : `${model.providerID}/${model.modelID}` } : {}),
142
142
  ...(agent ? { agent } : {}),
@@ -144,11 +144,6 @@ export class CodexProvider {
144
144
  break;
145
145
  }
146
146
  catch (err) {
147
- if (this.shouldTreatAsThreadNotFound(err)) {
148
- targetSession = await this.createContinuationSession(targetSession);
149
- imageUrlKey = "url";
150
- continue;
151
- }
152
147
  if (imageUrlKey === "url"
153
148
  && files.length > 0
154
149
  && this.shouldRetryTurnStartWithImageURLField(err)) {
@@ -883,79 +878,6 @@ export class CodexProvider {
883
878
  await this.call("thread/resume", { threadId });
884
879
  this.resumedThreadIds.add(threadId);
885
880
  }
886
- shouldTreatAsThreadNotFound(error) {
887
- const message = (error instanceof Error ? error.message : String(error)).toLowerCase();
888
- if (message.includes("not materialized") || message.includes("not yet materialized")) {
889
- return false;
890
- }
891
- return (message.includes("thread not found")
892
- || message.includes("unknown thread")
893
- || message.includes("no rollout found for thread id")
894
- || message.includes("no rollout found"));
895
- }
896
- async ensurePromptSessionReady(session) {
897
- const threadId = this.getTransportThreadId(session);
898
- try {
899
- await this.ensureThreadResumed(threadId);
900
- return session;
901
- }
902
- catch (error) {
903
- if (!this.shouldTreatAsThreadNotFound(error)) {
904
- throw error;
905
- }
906
- return this.createContinuationSession(session);
907
- }
908
- }
909
- async createContinuationSession(session) {
910
- const previousThreadId = this.getTransportThreadId(session);
911
- this.handleMissingThread(session);
912
- const result = await this.call("thread/start", {
913
- ...(session.cwd ? { cwd: session.cwd } : { cwd: process.cwd() }),
914
- });
915
- const threadId = this.extractThreadId(result);
916
- if (!threadId) {
917
- throw new Error("thread/start response missing threadId");
918
- }
919
- session.transportThreadId = threadId;
920
- session.updatedAt = Date.now();
921
- session.archived = false;
922
- this.upsertSession({
923
- id: session.id,
924
- title: this.extractThreadTitleFromUnknown(result) ?? session.title,
925
- createdAt: session.createdAt,
926
- updatedAt: this.extractUpdatedAt(result) ?? Date.now(),
927
- archived: false,
928
- transportThreadId: threadId,
929
- cwd: this.extractThreadCwd(result) ?? session.cwd ?? process.cwd(),
930
- }, true);
931
- this.resumedThreadIds.add(threadId);
932
- const systemMessageId = `system:${crypto.randomUUID()}`;
933
- session.messages.push({
934
- id: systemMessageId,
935
- role: "assistant",
936
- parts: [{
937
- id: `${systemMessageId}:text`,
938
- type: "text",
939
- text: `Continued from archived thread \`${previousThreadId}\``,
940
- sessionID: session.id,
941
- messageID: systemMessageId,
942
- }],
943
- time: Date.now(),
944
- });
945
- this.emitMessagePartEvent(session.id, systemMessageId, "assistant", {
946
- id: `${systemMessageId}:text`,
947
- type: "text",
948
- text: `Continued from archived thread \`${previousThreadId}\``,
949
- sessionID: session.id,
950
- messageID: systemMessageId,
951
- });
952
- return session;
953
- }
954
- handleMissingThread(session) {
955
- const threadId = this.getTransportThreadId(session);
956
- this.resumedThreadIds.delete(threadId);
957
- session.activeTurnId = undefined;
958
- }
959
881
  resolveSessionFromPayload(payload) {
960
882
  const threadId = this.extractThreadId(payload);
961
883
  if (!threadId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lunel-cli",
3
- "version": "0.1.68",
3
+ "version": "0.1.69",
4
4
  "author": [
5
5
  {
6
6
  "name": "Soham Bharambe",