@ycodium-ai/agent-codex 0.2.2856 → 0.2.2862

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -26
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -854,7 +854,7 @@ function inProgressTurnIdFromThreadRead(result) {
854
854
  const active = asString(thread["activeTurnId"]) ?? asString(thread["inProgressTurnId"]);
855
855
  return active ?? void 0;
856
856
  }
857
- var RECOVERABLE_THREAD_RESUME_ERROR_SNIPPETS = [
857
+ var MISSING_THREAD_RESUME_ERROR_SNIPPETS = [
858
858
  "not found",
859
859
  "missing thread",
860
860
  "no such thread",
@@ -862,10 +862,10 @@ var RECOVERABLE_THREAD_RESUME_ERROR_SNIPPETS = [
862
862
  "does not exist",
863
863
  "no rollout found"
864
864
  ];
865
- function isRecoverableThreadResumeError(message) {
865
+ function isMissingThreadResumeError(message) {
866
866
  const lower = message.toLowerCase();
867
867
  if (!lower.includes("thread")) return false;
868
- return RECOVERABLE_THREAD_RESUME_ERROR_SNIPPETS.some((snippet) => lower.includes(snippet));
868
+ return MISSING_THREAD_RESUME_ERROR_SNIPPETS.some((snippet) => lower.includes(snippet));
869
869
  }
870
870
  function isActiveWriterConflict(message) {
871
871
  return message.toLowerCase().includes("already has an active writer");
@@ -3563,29 +3563,20 @@ var CodexSessionRuntime = class {
3563
3563
  ...this.threadConfigParams(),
3564
3564
  ...requestedModel ? { model: requestedModel } : {}
3565
3565
  };
3566
- if (resume) {
3567
- try {
3568
- const result = await this.withActiveWriterRecovery(
3569
- () => this.rpc.request("thread/resume", { threadId: resume.threadId, ...startParams }, 0),
3570
- true
3571
- );
3572
- const opened = decodeThreadOpen(result);
3573
- this.nativeThreadId = opened.threadId;
3574
- this.model = opened.model ?? requestedModel;
3575
- } catch (error) {
3576
- const message = error instanceof Error ? error.message : String(error);
3577
- if (!isRecoverableThreadResumeError(message)) throw error;
3578
- const result = await this.rpc.request("thread/start", startParams, 0);
3579
- const opened = decodeThreadOpen(result);
3580
- this.nativeThreadId = opened.threadId;
3581
- this.model = opened.model ?? requestedModel;
3582
- }
3583
- } else {
3584
- const result = await this.rpc.request("thread/start", startParams, 0);
3585
- const opened = decodeThreadOpen(result);
3586
- this.nativeThreadId = opened.threadId;
3587
- this.model = opened.model ?? requestedModel;
3588
- }
3566
+ const result = resume ? await this.withActiveWriterRecovery(
3567
+ () => this.rpc.request("thread/resume", { threadId: resume.threadId, ...startParams }, 0),
3568
+ true
3569
+ ).catch((error) => {
3570
+ const message = error instanceof Error ? error.message : String(error);
3571
+ if (!isMissingThreadResumeError(message)) throw error;
3572
+ throw new Error(
3573
+ `Codex could not find this conversation (thread ${resume.threadId}) in its history, so it cannot continue here. Start a new thread to continue.`,
3574
+ { cause: error }
3575
+ );
3576
+ }) : await this.rpc.request("thread/start", startParams, 0);
3577
+ const opened = decodeThreadOpen(result);
3578
+ this.nativeThreadId = opened.threadId;
3579
+ this.model = opened.model ?? requestedModel;
3589
3580
  this.session = {
3590
3581
  ...this.session,
3591
3582
  status: "idle",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-codex",
3
- "version": "0.2.2856",
3
+ "version": "0.2.2862",
4
4
  "description": "Codex executor: Codex CLI over the app-server JSON-RPC protocol.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -29,7 +29,7 @@
29
29
  "tailwindcss": "^4.0.0",
30
30
  "typescript": "~6.0.3",
31
31
  "vite-plus": "0.2.2",
32
- "@ycodium-ai/plugin-api": "0.2.2856",
32
+ "@ycodium-ai/plugin-api": "0.2.0",
33
33
  "ycodium-executor-testing": "0.0.0"
34
34
  },
35
35
  "ycodium": {