oh-my-codex 0.18.12 → 0.18.13
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/Cargo.lock +6 -6
- package/Cargo.toml +1 -1
- package/README.md +7 -0
- package/dist/autopilot/__tests__/ralplan-gate.test.js +621 -0
- package/dist/autopilot/__tests__/ralplan-gate.test.js.map +1 -1
- package/dist/autopilot/ralplan-gate.d.ts.map +1 -1
- package/dist/autopilot/ralplan-gate.js +32 -18
- package/dist/autopilot/ralplan-gate.js.map +1 -1
- package/dist/cli/__tests__/doctor-invalid-config.test.js +35 -0
- package/dist/cli/__tests__/doctor-invalid-config.test.js.map +1 -1
- package/dist/cli/__tests__/index.test.js +54 -1
- package/dist/cli/__tests__/index.test.js.map +1 -1
- package/dist/cli/__tests__/resume.test.js +217 -1
- package/dist/cli/__tests__/resume.test.js.map +1 -1
- package/dist/cli/__tests__/session-search-help.test.js +3 -2
- package/dist/cli/__tests__/session-search-help.test.js.map +1 -1
- package/dist/cli/__tests__/session-search.test.js +64 -2
- package/dist/cli/__tests__/session-search.test.js.map +1 -1
- package/dist/cli/__tests__/setup-install-mode.test.js +6 -5
- package/dist/cli/__tests__/setup-install-mode.test.js.map +1 -1
- package/dist/cli/__tests__/setup-prompts-overwrite.test.js +74 -0
- package/dist/cli/__tests__/setup-prompts-overwrite.test.js.map +1 -1
- package/dist/cli/__tests__/setup-scope.test.js +45 -0
- package/dist/cli/__tests__/setup-scope.test.js.map +1 -1
- package/dist/cli/__tests__/update.test.js +5 -2
- package/dist/cli/__tests__/update.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +9 -1
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/index.d.ts +9 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +209 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/project-runtime-codex-homes.d.ts +6 -0
- package/dist/cli/project-runtime-codex-homes.d.ts.map +1 -0
- package/dist/cli/project-runtime-codex-homes.js +27 -0
- package/dist/cli/project-runtime-codex-homes.js.map +1 -0
- package/dist/cli/session-search.d.ts.map +1 -1
- package/dist/cli/session-search.js +8 -1
- package/dist/cli/session-search.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +168 -4
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +2 -0
- package/dist/cli/update.js.map +1 -1
- package/dist/config/__tests__/codex-hooks.test.js +38 -24
- package/dist/config/__tests__/codex-hooks.test.js.map +1 -1
- package/dist/config/codex-hooks.d.ts +6 -0
- package/dist/config/codex-hooks.d.ts.map +1 -1
- package/dist/config/codex-hooks.js +34 -49
- package/dist/config/codex-hooks.js.map +1 -1
- package/dist/pipeline/__tests__/orchestrator.test.js +125 -0
- package/dist/pipeline/__tests__/orchestrator.test.js.map +1 -1
- package/dist/pipeline/__tests__/stages.test.js +109 -0
- package/dist/pipeline/__tests__/stages.test.js.map +1 -1
- package/dist/pipeline/orchestrator.d.ts.map +1 -1
- package/dist/pipeline/orchestrator.js +7 -0
- package/dist/pipeline/orchestrator.js.map +1 -1
- package/dist/ralplan/__tests__/consensus-gate.test.js +440 -1
- package/dist/ralplan/__tests__/consensus-gate.test.js.map +1 -1
- package/dist/ralplan/consensus-gate.d.ts +2 -0
- package/dist/ralplan/consensus-gate.d.ts.map +1 -1
- package/dist/ralplan/consensus-gate.js +173 -71
- package/dist/ralplan/consensus-gate.js.map +1 -1
- package/dist/scripts/__tests__/codex-native-hook.test.js +273 -0
- package/dist/scripts/__tests__/codex-native-hook.test.js.map +1 -1
- package/dist/scripts/codex-native-hook.d.ts.map +1 -1
- package/dist/scripts/codex-native-hook.js +56 -12
- package/dist/scripts/codex-native-hook.js.map +1 -1
- package/dist/scripts/codex-native-pre-post.d.ts +1 -0
- package/dist/scripts/codex-native-pre-post.d.ts.map +1 -1
- package/dist/scripts/codex-native-pre-post.js +130 -0
- package/dist/scripts/codex-native-pre-post.js.map +1 -1
- package/dist/session-history/__tests__/search.test.js +166 -0
- package/dist/session-history/__tests__/search.test.js.map +1 -1
- package/dist/session-history/search.d.ts +7 -0
- package/dist/session-history/search.d.ts.map +1 -1
- package/dist/session-history/search.js +83 -24
- package/dist/session-history/search.js.map +1 -1
- package/dist/sidecar/__tests__/collector.test.js +60 -0
- package/dist/sidecar/__tests__/collector.test.js.map +1 -1
- package/dist/sidecar/collector.d.ts.map +1 -1
- package/dist/sidecar/collector.js +3 -6
- package/dist/sidecar/collector.js.map +1 -1
- package/dist/verification/__tests__/ci-rust-gates.test.js +4 -2
- package/dist/verification/__tests__/ci-rust-gates.test.js.map +1 -1
- package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.js +71 -3
- package/dist/verification/__tests__/dev-merge-issue-close-workflow.test.js.map +1 -1
- package/package.json +1 -1
- package/plugins/oh-my-codex/.codex-plugin/plugin.json +1 -1
- package/src/scripts/__tests__/codex-native-hook.test.ts +363 -0
- package/src/scripts/codex-native-hook.ts +68 -18
- package/src/scripts/codex-native-pre-post.ts +137 -0
package/dist/cli/index.js
CHANGED
|
@@ -41,6 +41,7 @@ import { MADMAX_FLAG, CODEX_BYPASS_FLAG, HIGH_REASONING_FLAG, XHIGH_REASONING_FL
|
|
|
41
41
|
import { getBaseStateDir, getStateDir, listModeStateFilesWithScopePreference, } from "../mcp/state-paths.js";
|
|
42
42
|
import { evaluateRalphCompletionAuditEvidence, isRalphCompletePhase } from "../ralph/completion-audit.js";
|
|
43
43
|
import { readPersistedSetupPreferences, resolveCodexConfigPathForLaunch, resolveCodexHomeForLaunch, resolveProjectLocalCodexHomeForLaunch, } from "./codex-home.js";
|
|
44
|
+
import { discoverProjectRuntimeCodexHomes } from "./project-runtime-codex-homes.js";
|
|
44
45
|
import { escapeTomlString, readTopLevelTomlString, upsertTopLevelTomlString } from "../utils/toml.js";
|
|
45
46
|
export { readPersistedSetupPreferences, readPersistedSetupScope, resolveCodexConfigPathForLaunch, resolveCodexHomeForLaunch, resolveProjectLocalCodexHomeForLaunch, } from "./codex-home.js";
|
|
46
47
|
import { SKILL_ACTIVE_STATE_MODE, extractSessionIdFromInitializedStatePath, getSkillActiveStatePathsForStateDir, listActiveSkills, readSkillActiveState, syncCanonicalSkillStateForMode, } from "../state/skill-active.js";
|
|
@@ -107,10 +108,10 @@ Usage:
|
|
|
107
108
|
omx auth Manage Codex OAuth auth slots (add|list|use)
|
|
108
109
|
omx question OMX-owned blocking question UI entrypoint for agent-invoked user questions
|
|
109
110
|
omx adapt Scaffold OMX-owned adapter foundations for persistent external targets
|
|
110
|
-
omx resume Resume
|
|
111
|
+
omx resume Resume Codex sessions (supports --project and --codex-home <path>)
|
|
111
112
|
omx explore DEPRECATED compatibility command; use normal repo inspection or omx sparkshell
|
|
112
113
|
omx api Run native omx-api localhost gateway commands (serve|status|stop|generate)
|
|
113
|
-
omx session Search prior local session transcripts
|
|
114
|
+
omx session Search prior local session transcripts (--codex-home <path> escape hatch)
|
|
114
115
|
omx agents-init [path]
|
|
115
116
|
Bootstrap lightweight AGENTS.md files for a repo/subtree
|
|
116
117
|
omx agents Manage Codex native agent TOML files
|
|
@@ -563,14 +564,124 @@ const PROJECT_LAUNCH_PERSISTED_RUNTIME_ENTRY_NAMES = new Set([
|
|
|
563
564
|
// log the contents.
|
|
564
565
|
"auth.json",
|
|
565
566
|
]);
|
|
567
|
+
const PROJECT_LAUNCH_DURABLE_HISTORY_ENTRY_NAMES = new Set([
|
|
568
|
+
"sessions",
|
|
569
|
+
"history.jsonl",
|
|
570
|
+
"session_index.jsonl",
|
|
571
|
+
]);
|
|
566
572
|
// Mirroring these files into the runtime CODEX_HOME would cause Codex to load
|
|
567
573
|
// them as user-scope config alongside the canonical project-scope copies under
|
|
568
574
|
// <cwd>/.codex, duplicating every native hook and asking the user to re-trust
|
|
569
575
|
// hooks on every launch. See GH issue #2470.
|
|
570
576
|
const PROJECT_LAUNCH_RUNTIME_SKIPPED_ENTRY_NAMES = new Set(["hooks.json"]);
|
|
577
|
+
function shouldMirrorProjectLaunchRuntimeEntry(entryName, includeHistoryArtifacts) {
|
|
578
|
+
if (PROJECT_LAUNCH_DURABLE_HISTORY_ENTRY_NAMES.has(entryName))
|
|
579
|
+
return true;
|
|
580
|
+
if (isCodexSqliteArtifact(entryName))
|
|
581
|
+
return includeHistoryArtifacts;
|
|
582
|
+
return true;
|
|
583
|
+
}
|
|
571
584
|
function shouldPersistProjectLaunchRuntimeEntry(entryName) {
|
|
572
585
|
return PROJECT_LAUNCH_PERSISTED_RUNTIME_ENTRY_NAMES.has(entryName);
|
|
573
586
|
}
|
|
587
|
+
function uniqueJsonlLines(contents) {
|
|
588
|
+
const seen = new Set();
|
|
589
|
+
const lines = [];
|
|
590
|
+
for (const line of contents.split(/\r?\n/)) {
|
|
591
|
+
if (line === "" || seen.has(line))
|
|
592
|
+
continue;
|
|
593
|
+
seen.add(line);
|
|
594
|
+
lines.push(line);
|
|
595
|
+
}
|
|
596
|
+
return lines;
|
|
597
|
+
}
|
|
598
|
+
async function persistProjectLaunchRuntimeJsonlArtifact(source, destination) {
|
|
599
|
+
const existing = existsSync(destination) ? await readFile(destination, "utf-8").catch(() => "") : "";
|
|
600
|
+
const sourceContents = await readFile(source, "utf-8");
|
|
601
|
+
const separator = existing === "" || existing.endsWith("\n") || sourceContents === "" ? "" : "\n";
|
|
602
|
+
const lines = uniqueJsonlLines(`${existing}${separator}${sourceContents}`);
|
|
603
|
+
await writeFile(destination, lines.length > 0 ? `${lines.join("\n")}\n` : "", "utf-8");
|
|
604
|
+
}
|
|
605
|
+
async function persistProjectLaunchRuntimeHistoryArtifacts(runtimeCodexHome, projectCodexHome) {
|
|
606
|
+
if (!runtimeCodexHome || !projectCodexHome)
|
|
607
|
+
return;
|
|
608
|
+
if (!existsSync(runtimeCodexHome))
|
|
609
|
+
return;
|
|
610
|
+
await mkdir(projectCodexHome, { recursive: true });
|
|
611
|
+
for (const entryName of PROJECT_LAUNCH_DURABLE_HISTORY_ENTRY_NAMES) {
|
|
612
|
+
const source = join(runtimeCodexHome, entryName);
|
|
613
|
+
if (!existsSync(source))
|
|
614
|
+
continue;
|
|
615
|
+
const sourceStat = await lstat(source);
|
|
616
|
+
if (sourceStat.isSymbolicLink())
|
|
617
|
+
continue;
|
|
618
|
+
const destination = join(projectCodexHome, entryName);
|
|
619
|
+
if (sourceStat.isDirectory()) {
|
|
620
|
+
await cp(source, destination, { recursive: true, force: true, verbatimSymlinks: true });
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
if (entryName === "history.jsonl" || entryName === "session_index.jsonl") {
|
|
624
|
+
await persistProjectLaunchRuntimeJsonlArtifact(source, destination);
|
|
625
|
+
continue;
|
|
626
|
+
}
|
|
627
|
+
if (sourceStat.isFile()) {
|
|
628
|
+
await copyFile(source, destination);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
async function ensureProjectLaunchRuntimeHistoryLinks(runtimeCodexHome, projectCodexHome) {
|
|
633
|
+
await mkdir(projectCodexHome, { recursive: true });
|
|
634
|
+
for (const entryName of PROJECT_LAUNCH_DURABLE_HISTORY_ENTRY_NAMES) {
|
|
635
|
+
const runtimeEntry = join(runtimeCodexHome, entryName);
|
|
636
|
+
if (existsSync(runtimeEntry))
|
|
637
|
+
continue;
|
|
638
|
+
const projectEntry = join(projectCodexHome, entryName);
|
|
639
|
+
if (entryName === "sessions") {
|
|
640
|
+
await mkdir(projectEntry, { recursive: true });
|
|
641
|
+
}
|
|
642
|
+
else if (!existsSync(projectEntry)) {
|
|
643
|
+
await writeFile(projectEntry, "");
|
|
644
|
+
}
|
|
645
|
+
await linkOrCopyCodexHomeEntry(projectEntry, runtimeEntry);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
async function materializeProjectLaunchRuntimeHistoryEntries(runtimeCodexHome, sourceCodexHome) {
|
|
649
|
+
for (const entryName of PROJECT_LAUNCH_DURABLE_HISTORY_ENTRY_NAMES) {
|
|
650
|
+
const source = join(sourceCodexHome, entryName);
|
|
651
|
+
if (!existsSync(source))
|
|
652
|
+
continue;
|
|
653
|
+
const destination = join(runtimeCodexHome, entryName);
|
|
654
|
+
await rm(destination, { recursive: true, force: true });
|
|
655
|
+
const sourceStat = await lstat(source);
|
|
656
|
+
if (sourceStat.isDirectory()) {
|
|
657
|
+
await cp(source, destination, { recursive: true, force: true, dereference: true });
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
await copyFile(source, destination);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
async function mergeProjectLaunchRuntimeHistoryEntries(runtimeCodexHome, sourceCodexHome) {
|
|
664
|
+
for (const entryName of PROJECT_LAUNCH_DURABLE_HISTORY_ENTRY_NAMES) {
|
|
665
|
+
const source = join(sourceCodexHome, entryName);
|
|
666
|
+
if (!existsSync(source))
|
|
667
|
+
continue;
|
|
668
|
+
const destination = join(runtimeCodexHome, entryName);
|
|
669
|
+
const sourceStat = await lstat(source);
|
|
670
|
+
if (sourceStat.isDirectory()) {
|
|
671
|
+
await mkdir(destination, { recursive: true });
|
|
672
|
+
await cp(source, destination, { recursive: true, force: true, dereference: true });
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
675
|
+
if (existsSync(destination)) {
|
|
676
|
+
const existing = await readFile(destination, "utf-8").catch(() => "");
|
|
677
|
+
const addition = await readFile(source, "utf-8");
|
|
678
|
+
const separator = existing === "" || existing.endsWith("\n") || addition === "" ? "" : "\n";
|
|
679
|
+
await writeFile(destination, `${existing}${separator}${addition}`, "utf-8");
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
await copyFile(source, destination);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
574
685
|
export async function persistProjectLaunchRuntimeAuthState(runtimeCodexHome, projectCodexHome) {
|
|
575
686
|
if (!runtimeCodexHome || !projectCodexHome)
|
|
576
687
|
return;
|
|
@@ -587,10 +698,12 @@ export async function prepareRuntimeCodexHomeForProjectLaunch(cwd, sessionId, pr
|
|
|
587
698
|
const runtimeCodexHome = runtimeCodexHomePath(cwd, sessionId);
|
|
588
699
|
await rm(runtimeCodexHome, { recursive: true, force: true });
|
|
589
700
|
await mkdir(runtimeCodexHome, { recursive: true });
|
|
590
|
-
if (!existsSync(projectCodexHome))
|
|
701
|
+
if (!existsSync(projectCodexHome)) {
|
|
702
|
+
await ensureProjectLaunchRuntimeHistoryLinks(runtimeCodexHome, projectCodexHome);
|
|
591
703
|
return runtimeCodexHome;
|
|
704
|
+
}
|
|
592
705
|
for (const entry of await readdir(projectCodexHome, { withFileTypes: true })) {
|
|
593
|
-
if (
|
|
706
|
+
if (!shouldMirrorProjectLaunchRuntimeEntry(entry.name, options.includeHistoryArtifacts === true))
|
|
594
707
|
continue;
|
|
595
708
|
if (PROJECT_LAUNCH_RUNTIME_SKIPPED_ENTRY_NAMES.has(entry.name))
|
|
596
709
|
continue;
|
|
@@ -608,6 +721,13 @@ export async function prepareRuntimeCodexHomeForProjectLaunch(cwd, sessionId, pr
|
|
|
608
721
|
}
|
|
609
722
|
await linkOrCopyCodexHomeEntry(source, destination);
|
|
610
723
|
}
|
|
724
|
+
await ensureProjectLaunchRuntimeHistoryLinks(runtimeCodexHome, projectCodexHome);
|
|
725
|
+
if (options.includeHistoryArtifacts === true && (options.extraHistoryCodexHomes?.length ?? 0) > 0) {
|
|
726
|
+
await materializeProjectLaunchRuntimeHistoryEntries(runtimeCodexHome, projectCodexHome);
|
|
727
|
+
for (const extraCodexHome of options.extraHistoryCodexHomes ?? []) {
|
|
728
|
+
await mergeProjectLaunchRuntimeHistoryEntries(runtimeCodexHome, extraCodexHome);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
611
731
|
return runtimeCodexHome;
|
|
612
732
|
}
|
|
613
733
|
function resolveProjectSqliteHomeForLaunch(projectCodexHome, env) {
|
|
@@ -619,7 +739,7 @@ function resolveProjectSqliteHomeForLaunch(projectCodexHome, env) {
|
|
|
619
739
|
export async function prepareCodexHomeForLaunch(cwd, sessionId, env = process.env, options = {}) {
|
|
620
740
|
const projectLocalCodexHomeForCleanup = resolveProjectLocalCodexHomeForLaunch(cwd, env);
|
|
621
741
|
if (projectLocalCodexHomeForCleanup) {
|
|
622
|
-
const runtimeCodexHome = await prepareRuntimeCodexHomeForProjectLaunch(cwd, sessionId, projectLocalCodexHomeForCleanup, { includeHistoryArtifacts: options.includeHistoryArtifacts });
|
|
742
|
+
const runtimeCodexHome = await prepareRuntimeCodexHomeForProjectLaunch(cwd, sessionId, projectLocalCodexHomeForCleanup, { includeHistoryArtifacts: options.includeHistoryArtifacts, extraHistoryCodexHomes: options.extraHistoryCodexHomes });
|
|
623
743
|
return {
|
|
624
744
|
codexHomeOverride: runtimeCodexHome,
|
|
625
745
|
sqliteHomeOverride: resolveProjectSqliteHomeForLaunch(projectLocalCodexHomeForCleanup, env),
|
|
@@ -632,6 +752,81 @@ export async function prepareCodexHomeForLaunch(cwd, sessionId, env = process.en
|
|
|
632
752
|
projectLocalCodexHomeForCleanup,
|
|
633
753
|
};
|
|
634
754
|
}
|
|
755
|
+
export function parseResumeCodexHomeSelection(args) {
|
|
756
|
+
const nextArgs = [];
|
|
757
|
+
let explicitCodexHome;
|
|
758
|
+
let projectOnly = false;
|
|
759
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
760
|
+
const arg = args[index];
|
|
761
|
+
if (arg === "--codex-home") {
|
|
762
|
+
const value = args[index + 1];
|
|
763
|
+
if (!value || value.startsWith("-")) {
|
|
764
|
+
throw new Error("Missing value after --codex-home.");
|
|
765
|
+
}
|
|
766
|
+
explicitCodexHome = value;
|
|
767
|
+
index += 1;
|
|
768
|
+
continue;
|
|
769
|
+
}
|
|
770
|
+
if (arg.startsWith("--codex-home=")) {
|
|
771
|
+
explicitCodexHome = arg.slice("--codex-home=".length);
|
|
772
|
+
if (explicitCodexHome.trim() === "") {
|
|
773
|
+
throw new Error("Missing value after --codex-home.");
|
|
774
|
+
}
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
if (arg === "--project") {
|
|
778
|
+
projectOnly = true;
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
nextArgs.push(arg);
|
|
782
|
+
}
|
|
783
|
+
return {
|
|
784
|
+
args: nextArgs,
|
|
785
|
+
explicitCodexHome,
|
|
786
|
+
projectOnly,
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
async function prepareResumeCodexHomeForLaunch(cwd, sessionId, args, env = process.env) {
|
|
790
|
+
const selection = parseResumeCodexHomeSelection(args);
|
|
791
|
+
if (selection.explicitCodexHome) {
|
|
792
|
+
return {
|
|
793
|
+
args: selection.args,
|
|
794
|
+
prepared: {
|
|
795
|
+
codexHomeOverride: resolve(selection.explicitCodexHome),
|
|
796
|
+
},
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
const projectHomes = await discoverProjectRuntimeCodexHomes(cwd);
|
|
800
|
+
if (selection.projectOnly) {
|
|
801
|
+
if (projectHomes.length === 0) {
|
|
802
|
+
const emptyRuntimeCodexHome = runtimeCodexHomePath(cwd, sessionId);
|
|
803
|
+
await rm(emptyRuntimeCodexHome, { recursive: true, force: true });
|
|
804
|
+
await mkdir(join(emptyRuntimeCodexHome, "sessions"), { recursive: true });
|
|
805
|
+
return {
|
|
806
|
+
args: selection.args,
|
|
807
|
+
prepared: {
|
|
808
|
+
codexHomeOverride: emptyRuntimeCodexHome,
|
|
809
|
+
runtimeCodexHomeForCleanup: emptyRuntimeCodexHome,
|
|
810
|
+
},
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
const runtimeCodexHome = await prepareRuntimeCodexHomeForProjectLaunch(cwd, sessionId, projectHomes[0].path, {
|
|
814
|
+
includeHistoryArtifacts: true,
|
|
815
|
+
extraHistoryCodexHomes: projectHomes.slice(1).map((home) => home.path),
|
|
816
|
+
});
|
|
817
|
+
return {
|
|
818
|
+
args: selection.args,
|
|
819
|
+
prepared: {
|
|
820
|
+
codexHomeOverride: runtimeCodexHome,
|
|
821
|
+
},
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
const prepared = await prepareCodexHomeForLaunch(cwd, sessionId, env, {
|
|
825
|
+
includeHistoryArtifacts: true,
|
|
826
|
+
extraHistoryCodexHomes: projectHomes.map((home) => home.path),
|
|
827
|
+
});
|
|
828
|
+
return { args: selection.args, prepared };
|
|
829
|
+
}
|
|
635
830
|
export async function persistProjectLaunchRuntimeProjectTrustState(runtimeCodexHome, projectCodexHome) {
|
|
636
831
|
if (!runtimeCodexHome || !projectCodexHome)
|
|
637
832
|
return;
|
|
@@ -654,6 +849,7 @@ export async function cleanupRuntimeCodexHome(runtimeCodexHomeForCleanup, projec
|
|
|
654
849
|
if (!runtimeCodexHomeForCleanup)
|
|
655
850
|
return;
|
|
656
851
|
await persistProjectLaunchRuntimeAuthState(runtimeCodexHomeForCleanup, projectCodexHomeForPersistence);
|
|
852
|
+
await persistProjectLaunchRuntimeHistoryArtifacts(runtimeCodexHomeForCleanup, projectCodexHomeForPersistence);
|
|
657
853
|
await persistProjectLaunchRuntimeProjectTrustState(runtimeCodexHomeForCleanup, projectCodexHomeForPersistence);
|
|
658
854
|
await rm(runtimeCodexHomeForCleanup, { recursive: true, force: true });
|
|
659
855
|
}
|
|
@@ -1891,7 +2087,7 @@ export async function launchWithHud(args) {
|
|
|
1891
2087
|
const { launchPolicy, effectiveExplicitLaunchPolicy } = resolveTmuxAwareLaunchPolicy(explicitLaunchPolicy, isNativeWindows());
|
|
1892
2088
|
const enableNotifyFallbackAuthority = launchPolicy === "direct";
|
|
1893
2089
|
const workerSparkModel = resolveWorkerSparkModel(notifyTempResult.passthroughArgs, persistentCodexHomeForLaunch);
|
|
1894
|
-
|
|
2090
|
+
let normalizedArgs = normalizeCodexLaunchArgs(notifyTempResult.passthroughArgs);
|
|
1895
2091
|
let cwd = launchCwd;
|
|
1896
2092
|
let worktreeDirty = false;
|
|
1897
2093
|
let ensuredLaunchWorktree;
|
|
@@ -1949,7 +2145,13 @@ export async function launchWithHud(args) {
|
|
|
1949
2145
|
catch {
|
|
1950
2146
|
// Non-fatal: repair failure must not block launch
|
|
1951
2147
|
}
|
|
1952
|
-
const
|
|
2148
|
+
const resumePrepared = normalizedArgs[0] === "resume"
|
|
2149
|
+
? await prepareResumeCodexHomeForLaunch(launchCwd, sessionId, normalizedArgs, process.env)
|
|
2150
|
+
: null;
|
|
2151
|
+
if (resumePrepared) {
|
|
2152
|
+
normalizedArgs = resumePrepared.args;
|
|
2153
|
+
}
|
|
2154
|
+
const preparedCodexHome = resumePrepared?.prepared ?? await prepareCodexHomeForLaunch(launchCwd, sessionId, process.env, {
|
|
1953
2155
|
includeHistoryArtifacts: normalizedArgs[0] === "resume",
|
|
1954
2156
|
});
|
|
1955
2157
|
const codexHomeOverride = preparedCodexHome.codexHomeOverride;
|