@agentproto/runtime 5.13.0 → 5.15.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 { join, resolve, dirname } from 'path';
2
2
  import '@agentproto/model-catalog/llm';
3
3
  import '@agentproto/model-catalog/route-identity';
4
4
  import 'crypto';
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
 
@@ -817,7 +817,11 @@ async function readFirstJsonLine(path) {
817
817
  function codexHome() {
818
818
  return process.env.CODEX_HOME ?? join(homedir(), ".codex");
819
819
  }
820
- function codexSessionsDir() {
820
+ function codexSessionsDir(configDir) {
821
+ if (configDir) {
822
+ const isolated = join(configDir, "sessions");
823
+ if (existsSync(isolated)) return isolated;
824
+ }
821
825
  return join(codexHome(), "sessions");
822
826
  }
823
827
  async function walkCodexRollouts(dir) {
@@ -852,8 +856,8 @@ function codexBlocksText(content) {
852
856
  }
853
857
  return acc;
854
858
  }
855
- async function findCodexRolloutFile(conversationId) {
856
- const files = await walkCodexRollouts(codexSessionsDir());
859
+ async function findCodexRolloutFile(conversationId, configDir) {
860
+ const files = await walkCodexRollouts(codexSessionsDir(configDir));
857
861
  const byName = files.find((f) => f.endsWith(`-${conversationId}.jsonl`));
858
862
  if (byName) return byName;
859
863
  for (const f of files) {
@@ -870,11 +874,11 @@ async function findCodexRolloutFile(conversationId) {
870
874
  }
871
875
  return void 0;
872
876
  }
873
- async function exportCodexSession(conversationId) {
874
- const file = await findCodexRolloutFile(conversationId);
877
+ async function exportCodexSession(conversationId, configDir) {
878
+ const file = await findCodexRolloutFile(conversationId, configDir);
875
879
  if (!file) {
876
880
  throw new Error(
877
- `codex: no rollout file for conversation "${conversationId}" under ${codexSessionsDir()}.
881
+ `codex: no rollout file for conversation "${conversationId}" under ${codexSessionsDir(configDir)}.
878
882
  The session may predate persistence, or CODEX_HOME points elsewhere.`
879
883
  );
880
884
  }
@@ -1524,7 +1528,7 @@ var init_transcript_export = __esm({
1524
1528
  exportSession: (id) => exportHermesSession(id)
1525
1529
  },
1526
1530
  codex: {
1527
- exportSession: (id) => exportCodexSession(id)
1531
+ exportSession: (id, _cwd, configDir) => exportCodexSession(id, configDir)
1528
1532
  },
1529
1533
  opencode: {
1530
1534
  exportSession: (id) => exportOpenCodeSession(id)