MCPcopy Index your code
hub / github.com/openai/codex-plugin-cc / importedThreadIdForSource

Function importedThreadIdForSource

plugins/codex/scripts/lib/codex.mjs:661–679  ·  view source on GitHub ↗
(sourcePath)

Source from the content-addressed store, hash-verified

659}
660
661function importedThreadIdForSource(sourcePath) {
662 const ledgerPath = path.join(resolveCodexHome(), "external_agent_session_imports.json");
663 if (!fs.existsSync(ledgerPath)) {
664 return null;
665 }
666 const ledger = readJsonFile(ledgerPath);
667 const canonicalSource = fs.realpathSync(sourcePath);
668 const contentSha256 = sourceContentSha256(canonicalSource);
669 const records = Array.isArray(ledger?.records) ? ledger.records : [];
670 const match = records
671 .filter(
672 (record) =>
673 record?.source_path === canonicalSource &&
674 record?.content_sha256 === contentSha256 &&
675 typeof record?.imported_thread_id === "string"
676 )
677 .at(-1);
678 return match?.imported_thread_id ?? null;
679}
680
681function externalAgentSessionMigration(sourcePath, cwd) {
682 return {

Callers 1

Calls 3

readJsonFileFunction · 0.90
resolveCodexHomeFunction · 0.85
sourceContentSha256Function · 0.85

Tested by

no test coverage detected