(sourcePath)
| 659 | } |
| 660 | |
| 661 | function 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 | |
| 681 | function externalAgentSessionMigration(sourcePath, cwd) { |
| 682 | return { |
no test coverage detected