@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.
package/dist/config.mjs CHANGED
@@ -2,7 +2,7 @@ import { createHash } from 'crypto';
2
2
  import { join, resolve, dirname } 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';
@@ -896,7 +896,11 @@ async function readFirstJsonLine(path) {
896
896
  function codexHome() {
897
897
  return process.env.CODEX_HOME ?? join(homedir(), ".codex");
898
898
  }
899
- function codexSessionsDir() {
899
+ function codexSessionsDir(configDir) {
900
+ if (configDir) {
901
+ const isolated = join(configDir, "sessions");
902
+ if (existsSync(isolated)) return isolated;
903
+ }
900
904
  return join(codexHome(), "sessions");
901
905
  }
902
906
  async function walkCodexRollouts(dir) {
@@ -931,8 +935,8 @@ function codexBlocksText(content) {
931
935
  }
932
936
  return acc;
933
937
  }
934
- async function findCodexRolloutFile(conversationId) {
935
- const files = await walkCodexRollouts(codexSessionsDir());
938
+ async function findCodexRolloutFile(conversationId, configDir) {
939
+ const files = await walkCodexRollouts(codexSessionsDir(configDir));
936
940
  const byName = files.find((f) => f.endsWith(`-${conversationId}.jsonl`));
937
941
  if (byName) return byName;
938
942
  for (const f of files) {
@@ -949,11 +953,11 @@ async function findCodexRolloutFile(conversationId) {
949
953
  }
950
954
  return void 0;
951
955
  }
952
- async function exportCodexSession(conversationId) {
953
- const file = await findCodexRolloutFile(conversationId);
956
+ async function exportCodexSession(conversationId, configDir) {
957
+ const file = await findCodexRolloutFile(conversationId, configDir);
954
958
  if (!file) {
955
959
  throw new Error(
956
- `codex: no rollout file for conversation "${conversationId}" under ${codexSessionsDir()}.
960
+ `codex: no rollout file for conversation "${conversationId}" under ${codexSessionsDir(configDir)}.
957
961
  The session may predate persistence, or CODEX_HOME points elsewhere.`
958
962
  );
959
963
  }
@@ -1603,7 +1607,7 @@ var init_transcript_export = __esm({
1603
1607
  exportSession: (id) => exportHermesSession(id)
1604
1608
  },
1605
1609
  codex: {
1606
- exportSession: (id) => exportCodexSession(id)
1610
+ exportSession: (id, _cwd, configDir) => exportCodexSession(id, configDir)
1607
1611
  },
1608
1612
  opencode: {
1609
1613
  exportSession: (id) => exportOpenCodeSession(id)