@agentproto/runtime 5.13.0 → 5.14.0

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.
@@ -2,7 +2,7 @@ import { createHash } from 'crypto';
2
2
  import { join, resolve } from 'path';
3
3
  import '@agentproto/model-catalog/llm';
4
4
  import '@agentproto/model-catalog/route-identity';
5
- import { createReadStream, promises } from 'fs';
5
+ import { createReadStream, promises, existsSync } from 'fs';
6
6
  import { homedir } from 'os';
7
7
  import { createInterface } from 'readline';
8
8
  import 'fs/promises';
@@ -886,7 +886,11 @@ async function readFirstJsonLine(path) {
886
886
  function codexHome() {
887
887
  return process.env.CODEX_HOME ?? join(homedir(), ".codex");
888
888
  }
889
- function codexSessionsDir() {
889
+ function codexSessionsDir(configDir) {
890
+ if (configDir) {
891
+ const isolated = join(configDir, "sessions");
892
+ if (existsSync(isolated)) return isolated;
893
+ }
890
894
  return join(codexHome(), "sessions");
891
895
  }
892
896
  async function walkCodexRollouts(dir) {
@@ -921,8 +925,8 @@ function codexBlocksText(content) {
921
925
  }
922
926
  return acc;
923
927
  }
924
- async function findCodexRolloutFile(conversationId) {
925
- const files = await walkCodexRollouts(codexSessionsDir());
928
+ async function findCodexRolloutFile(conversationId, configDir) {
929
+ const files = await walkCodexRollouts(codexSessionsDir(configDir));
926
930
  const byName = files.find((f) => f.endsWith(`-${conversationId}.jsonl`));
927
931
  if (byName) return byName;
928
932
  for (const f of files) {
@@ -939,11 +943,11 @@ async function findCodexRolloutFile(conversationId) {
939
943
  }
940
944
  return void 0;
941
945
  }
942
- async function exportCodexSession(conversationId) {
943
- const file = await findCodexRolloutFile(conversationId);
946
+ async function exportCodexSession(conversationId, configDir) {
947
+ const file = await findCodexRolloutFile(conversationId, configDir);
944
948
  if (!file) {
945
949
  throw new Error(
946
- `codex: no rollout file for conversation "${conversationId}" under ${codexSessionsDir()}.
950
+ `codex: no rollout file for conversation "${conversationId}" under ${codexSessionsDir(configDir)}.
947
951
  The session may predate persistence, or CODEX_HOME points elsewhere.`
948
952
  );
949
953
  }
@@ -1593,7 +1597,7 @@ var init_transcript_export = __esm({
1593
1597
  exportSession: (id) => exportHermesSession(id)
1594
1598
  },
1595
1599
  codex: {
1596
- exportSession: (id) => exportCodexSession(id)
1600
+ exportSession: (id, _cwd, configDir) => exportCodexSession(id, configDir)
1597
1601
  },
1598
1602
  opencode: {
1599
1603
  exportSession: (id) => exportOpenCodeSession(id)