codex-multi-auth 0.1.7 → 0.1.8
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/LICENSE +21 -1
- package/README.md +13 -0
- package/assets/readme-hero.svg +31 -31
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/codex-cli/sync.d.ts +9 -16
- package/dist/lib/codex-cli/sync.d.ts.map +1 -1
- package/dist/lib/codex-cli/sync.js +51 -284
- package/dist/lib/codex-cli/sync.js.map +1 -1
- package/dist/lib/codex-manager/settings-hub.d.ts +44 -2
- package/dist/lib/codex-manager/settings-hub.d.ts.map +1 -1
- package/dist/lib/codex-manager/settings-hub.js +746 -117
- package/dist/lib/codex-manager/settings-hub.js.map +1 -1
- package/dist/lib/codex-manager.d.ts.map +1 -1
- package/dist/lib/codex-manager.js +3 -8
- package/dist/lib/codex-manager.js.map +1 -1
- package/dist/lib/context-overflow.js +10 -10
- package/dist/lib/named-backup-export.d.ts +69 -0
- package/dist/lib/named-backup-export.d.ts.map +1 -0
- package/dist/lib/named-backup-export.js +207 -0
- package/dist/lib/named-backup-export.js.map +1 -0
- package/dist/lib/oc-chatgpt-import-adapter.d.ts +64 -0
- package/dist/lib/oc-chatgpt-import-adapter.d.ts.map +1 -0
- package/dist/lib/oc-chatgpt-import-adapter.js +506 -0
- package/dist/lib/oc-chatgpt-import-adapter.js.map +1 -0
- package/dist/lib/oc-chatgpt-orchestrator.d.ts +80 -0
- package/dist/lib/oc-chatgpt-orchestrator.d.ts.map +1 -0
- package/dist/lib/oc-chatgpt-orchestrator.js +130 -0
- package/dist/lib/oc-chatgpt-orchestrator.js.map +1 -0
- package/dist/lib/oc-chatgpt-target-detection.d.ts +59 -0
- package/dist/lib/oc-chatgpt-target-detection.d.ts.map +1 -0
- package/dist/lib/oc-chatgpt-target-detection.js +327 -0
- package/dist/lib/oc-chatgpt-target-detection.js.map +1 -0
- package/dist/lib/prompts/codex.js +2 -2
- package/dist/lib/runtime-paths.d.ts.map +1 -1
- package/dist/lib/runtime-paths.js +21 -1
- package/dist/lib/runtime-paths.js.map +1 -1
- package/dist/lib/storage.d.ts +42 -3
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +519 -51
- package/dist/lib/storage.js.map +1 -1
- package/dist/lib/ui/copy.d.ts +15 -1
- package/dist/lib/ui/copy.d.ts.map +1 -1
- package/dist/lib/ui/copy.js +15 -1
- package/dist/lib/ui/copy.js.map +1 -1
- package/package.json +132 -133
- package/scripts/bench-format/hashline-v2.mjs +642 -642
- package/scripts/bench-format/render.mjs +496 -496
- package/scripts/bench-format/stats.mjs +54 -54
- package/scripts/bench-format/tasks.mjs +151 -151
- package/scripts/benchmark-render-dashboard.mjs +49 -49
- package/scripts/install-codex-auth.js +9 -9
- package/scripts/test-all-models.sh +7 -7
- package/scripts/test-model-matrix.js +138 -46
- package/scripts/validate-model-map.sh +7 -7
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import { previewOcChatgptImportMerge, } from "./oc-chatgpt-import-adapter.js";
|
|
4
|
+
import { detectOcChatgptMultiAuthTarget, } from "./oc-chatgpt-target-detection.js";
|
|
5
|
+
import { exportNamedBackup, normalizeAccountStorage, } from "./storage.js";
|
|
6
|
+
function mapDetectionToBlocked(detection) {
|
|
7
|
+
if (detection.kind === "ambiguous") {
|
|
8
|
+
return { kind: "blocked-ambiguous", detection };
|
|
9
|
+
}
|
|
10
|
+
if (detection.kind === "none") {
|
|
11
|
+
return { kind: "blocked-none", detection };
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
async function loadTargetStorageDefault(target) {
|
|
16
|
+
try {
|
|
17
|
+
const raw = JSON.parse(await fs.readFile(target.accountPath, "utf-8"));
|
|
18
|
+
return normalizeAccountStorage(raw);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
const code = error?.code;
|
|
22
|
+
if (code === "ENOENT")
|
|
23
|
+
return null;
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export async function planOcChatgptSync(options) {
|
|
28
|
+
const detectTarget = options.dependencies?.detectTarget ?? detectOcChatgptMultiAuthTarget;
|
|
29
|
+
const previewMerge = options.dependencies?.previewMerge ?? previewOcChatgptImportMerge;
|
|
30
|
+
const detection = detectTarget(options.detectOptions);
|
|
31
|
+
const blocked = mapDetectionToBlocked(detection);
|
|
32
|
+
if (blocked) {
|
|
33
|
+
return blocked;
|
|
34
|
+
}
|
|
35
|
+
if (detection.kind !== "target") {
|
|
36
|
+
throw new Error("Unexpected oc target detection result");
|
|
37
|
+
}
|
|
38
|
+
const descriptor = detection.descriptor;
|
|
39
|
+
const destination = options.destination === undefined
|
|
40
|
+
? await (options.dependencies?.loadTargetStorage ?? loadTargetStorageDefault)(descriptor)
|
|
41
|
+
: options.destination;
|
|
42
|
+
const preview = previewMerge({
|
|
43
|
+
source: options.source,
|
|
44
|
+
destination,
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
kind: "ready",
|
|
48
|
+
target: descriptor,
|
|
49
|
+
preview,
|
|
50
|
+
payload: preview.payload,
|
|
51
|
+
destination,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async function persistMergedDefault(target, merged) {
|
|
55
|
+
const path = target.accountPath;
|
|
56
|
+
await fs.mkdir(dirname(path), { recursive: true });
|
|
57
|
+
await fs.writeFile(path, `${JSON.stringify(merged, null, 2)}\n`, "utf-8");
|
|
58
|
+
return path;
|
|
59
|
+
}
|
|
60
|
+
export async function applyOcChatgptSync(options) {
|
|
61
|
+
const dependencies = options.dependencies ?? {};
|
|
62
|
+
try {
|
|
63
|
+
const plan = await planOcChatgptSync({
|
|
64
|
+
source: options.source,
|
|
65
|
+
destination: options.destination,
|
|
66
|
+
detectOptions: options.detectOptions,
|
|
67
|
+
dependencies: {
|
|
68
|
+
detectTarget: dependencies.detectTarget,
|
|
69
|
+
previewMerge: dependencies.previewMerge,
|
|
70
|
+
loadTargetStorage: dependencies.loadTargetStorage,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
if (plan.kind !== "ready") {
|
|
74
|
+
return plan;
|
|
75
|
+
}
|
|
76
|
+
const persistMerged = dependencies.persistMerged ?? persistMergedDefault;
|
|
77
|
+
const persistedPath = await persistMerged(plan.target, plan.preview.merged);
|
|
78
|
+
return {
|
|
79
|
+
kind: "applied",
|
|
80
|
+
target: plan.target,
|
|
81
|
+
preview: plan.preview,
|
|
82
|
+
merged: plan.preview.merged,
|
|
83
|
+
destination: plan.destination,
|
|
84
|
+
persistedPath,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const detection = dependencies.detectTarget?.(options.detectOptions) ??
|
|
89
|
+
detectOcChatgptMultiAuthTarget(options.detectOptions);
|
|
90
|
+
const blocked = mapDetectionToBlocked(detection);
|
|
91
|
+
if (blocked) {
|
|
92
|
+
return blocked;
|
|
93
|
+
}
|
|
94
|
+
if (detection.kind !== "target") {
|
|
95
|
+
throw new Error("Unexpected oc target detection result");
|
|
96
|
+
}
|
|
97
|
+
return { kind: "error", target: detection.descriptor, error };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function extractCollisionPath(error) {
|
|
101
|
+
const asErr = error;
|
|
102
|
+
if (asErr?.code === "EEXIST" &&
|
|
103
|
+
typeof asErr?.path === "string" &&
|
|
104
|
+
asErr.path.trim().length > 0) {
|
|
105
|
+
return asErr.path;
|
|
106
|
+
}
|
|
107
|
+
const message = (asErr?.message ?? "").trim();
|
|
108
|
+
if (message.length === 0)
|
|
109
|
+
return undefined;
|
|
110
|
+
const match = message.match(/already exists: (?<path>.+)$/i);
|
|
111
|
+
if (match?.groups?.path) {
|
|
112
|
+
return match.groups.path.trim();
|
|
113
|
+
}
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
export async function runNamedBackupExport(options) {
|
|
117
|
+
const exportBackup = options.dependencies?.exportBackup ?? exportNamedBackup;
|
|
118
|
+
try {
|
|
119
|
+
const path = await exportBackup(options.name, { force: options.force });
|
|
120
|
+
return { kind: "exported", path };
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
const path = extractCollisionPath(error);
|
|
124
|
+
if (path) {
|
|
125
|
+
return { kind: "collision", path };
|
|
126
|
+
}
|
|
127
|
+
return { kind: "error", path, error };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=oc-chatgpt-orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oc-chatgpt-orchestrator.js","sourceRoot":"","sources":["../../lib/oc-chatgpt-orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAGN,2BAA2B,GAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,8BAA8B,GAK9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEN,iBAAiB,EACjB,uBAAuB,GACvB,MAAM,cAAc,CAAC;AA4CtB,SAAS,qBAAqB,CAC7B,SAAyC;IAEzC,IAAI,SAAS,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC;IACjD,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,KAAK,UAAU,wBAAwB,CACtC,MAAiC;IAEjC,IAAI,CAAC;QAC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;IAC7D,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,OAAoC;IAEpC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,EAAE,YAAY,IAAI,iBAAiB,CAAC;IAC7E,IAAI,CAAC;QACJ,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACxE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACvC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
type OcChatgptTargetScope = "global" | "project";
|
|
2
|
+
type OcChatgptTargetSource = "explicit" | "default-global" | "project";
|
|
3
|
+
type OcChatgptTargetCandidate = {
|
|
4
|
+
scope: OcChatgptTargetScope;
|
|
5
|
+
source: OcChatgptTargetSource;
|
|
6
|
+
root: string;
|
|
7
|
+
accountPath: string;
|
|
8
|
+
backupRoot: string;
|
|
9
|
+
hasAccountArtifacts: boolean;
|
|
10
|
+
hasSignals: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type OcChatgptTargetDescriptor = {
|
|
13
|
+
scope: OcChatgptTargetScope;
|
|
14
|
+
root: string;
|
|
15
|
+
accountPath: string;
|
|
16
|
+
backupRoot: string;
|
|
17
|
+
source: OcChatgptTargetSource;
|
|
18
|
+
resolution: "accounts" | "signals";
|
|
19
|
+
};
|
|
20
|
+
export type OcChatgptTargetAmbiguous = {
|
|
21
|
+
kind: "ambiguous";
|
|
22
|
+
reason: string;
|
|
23
|
+
candidates: Array<Pick<OcChatgptTargetCandidate, "scope" | "root" | "accountPath" | "backupRoot" | "source" | "hasAccountArtifacts" | "hasSignals">>;
|
|
24
|
+
};
|
|
25
|
+
export type OcChatgptTargetNone = {
|
|
26
|
+
kind: "none";
|
|
27
|
+
reason: string;
|
|
28
|
+
tried: Array<Pick<OcChatgptTargetCandidate, "scope" | "root" | "accountPath" | "backupRoot" | "source">>;
|
|
29
|
+
};
|
|
30
|
+
export type OcChatgptTargetFound = {
|
|
31
|
+
kind: "target";
|
|
32
|
+
descriptor: OcChatgptTargetDescriptor;
|
|
33
|
+
};
|
|
34
|
+
export type OcChatgptTargetDetectionResult = OcChatgptTargetFound | OcChatgptTargetAmbiguous | OcChatgptTargetNone;
|
|
35
|
+
/**
|
|
36
|
+
* Detects the oc-chatgpt multi-auth storage target by evaluating explicit, canonical, and per-project candidate roots.
|
|
37
|
+
*
|
|
38
|
+
* Examines an explicit override (OC_CHATGPT_MULTI_AUTH_DIR or options.explicitRoot), the canonical user store (~/.opencode),
|
|
39
|
+
* and a per-project storage location (derived from options.projectRoot or the current working directory). For each candidate
|
|
40
|
+
* it checks for account artifacts and storage signals and returns a single resolved target, an ambiguity listing multiple
|
|
41
|
+
* matching candidates, or a "none" result with the attempted candidates. This function performs synchronous filesystem checks
|
|
42
|
+
* and tolerates unreadable directories; callers should treat it as a blocking operation. On Windows, path normalization and
|
|
43
|
+
* deduplication are case-insensitive and drive-root variants (e.g. `C:` vs `C:\`) are normalized consistently. Returned
|
|
44
|
+
* descriptors include normalized paths but do not contain authentication tokens or other secret material.
|
|
45
|
+
*
|
|
46
|
+
* @param options - Optional overrides:
|
|
47
|
+
* - explicitRoot: absolute path to force as the candidate root (use `null` to explicitly disable); if omitted the
|
|
48
|
+
* OC_CHATGPT_MULTI_AUTH_DIR environment variable is considered.
|
|
49
|
+
* - projectRoot: explicit project root to derive per-project storage; if omitted the current working directory is used to
|
|
50
|
+
* discover the project root.
|
|
51
|
+
* @returns An OcChatgptTargetDetectionResult describing either a resolved `target` (with `descriptor` and a `resolution`
|
|
52
|
+
* of `"accounts"` or `"signals"`), an `ambiguous` outcome listing conflicting candidates, or `none` with the tried candidates.
|
|
53
|
+
*/
|
|
54
|
+
export declare function detectOcChatgptMultiAuthTarget(options?: {
|
|
55
|
+
explicitRoot?: string | null;
|
|
56
|
+
projectRoot?: string | null;
|
|
57
|
+
}): OcChatgptTargetDetectionResult;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=oc-chatgpt-target-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oc-chatgpt-target-detection.d.ts","sourceRoot":"","sources":["../../lib/oc-chatgpt-target-detection.ts"],"names":[],"mappings":"AAcA,KAAK,oBAAoB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjD,KAAK,qBAAqB,GAAG,UAAU,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAEvE,KAAK,wBAAwB,GAAG;IAC/B,KAAK,EAAE,oBAAoB,CAAC;IAC5B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACvC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAChB,IAAI,CACH,wBAAwB,EACtB,OAAO,GACP,MAAM,GACN,aAAa,GACb,YAAY,GACZ,QAAQ,GACR,qBAAqB,GACrB,YAAY,CACd,CACD,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CACX,IAAI,CACH,wBAAwB,EACxB,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,QAAQ,CAC1D,CACD,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,yBAAyB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GACvC,oBAAoB,GACpB,wBAAwB,GACxB,mBAAmB,CAAC;AAoMvB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,CAAC,EAAE;IACxD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GAAG,8BAA8B,CA4JjC"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join, normalize, relative, resolve, sep, win32 } from "node:path";
|
|
4
|
+
import { findProjectRoot, getProjectStorageKey, resolveProjectStorageIdentityRoot, } from "./storage/paths.js";
|
|
5
|
+
const ACCOUNT_FILE_NAME = "openai-codex-accounts.json";
|
|
6
|
+
const BACKUPS_DIR_NAME = "backups";
|
|
7
|
+
const PROJECTS_DIR_NAME = "projects";
|
|
8
|
+
const CANONICAL_HOME_BASENAME = ".opencode";
|
|
9
|
+
/**
|
|
10
|
+
* Selects the first non-empty trimmed string from the provided array.
|
|
11
|
+
*
|
|
12
|
+
* @param values - An array of strings or undefined values to examine
|
|
13
|
+
* @returns The first value with surrounding whitespace removed, or `null` if no non-empty value is found
|
|
14
|
+
*/
|
|
15
|
+
function firstNonEmpty(values) {
|
|
16
|
+
for (const value of values) {
|
|
17
|
+
const trimmed = (value ?? "").trim();
|
|
18
|
+
if (trimmed.length > 0) {
|
|
19
|
+
return trimmed;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolve the effective user home directory, preferring sensible platform-specific environment variables.
|
|
26
|
+
*
|
|
27
|
+
* @returns The resolved home directory path.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* - On Windows this prefers USERPROFILE, then HOME, then the combination of HOMEDRIVE+HOMEPATH, and finally os.homedir(). On non-Windows it prefers HOME then os.homedir().
|
|
31
|
+
* - The function is pure and safe for concurrent calls within a single process (it only reads environment and os state).
|
|
32
|
+
* - Environment-derived paths may contain sensitive tokens; callers should redact or treat returned paths as potentially sensitive before logging or emitting them.
|
|
33
|
+
*/
|
|
34
|
+
function getResolvedUserHomeDir() {
|
|
35
|
+
if (process.platform === "win32") {
|
|
36
|
+
const homeDrive = (process.env.HOMEDRIVE ?? "").trim();
|
|
37
|
+
const homePath = (process.env.HOMEPATH ?? "").trim();
|
|
38
|
+
const drivePathHome = homeDrive.length > 0 && homePath.length > 0
|
|
39
|
+
? win32.resolve(`${homeDrive}\\`, homePath)
|
|
40
|
+
: undefined;
|
|
41
|
+
return (firstNonEmpty([
|
|
42
|
+
process.env.USERPROFILE,
|
|
43
|
+
process.env.HOME,
|
|
44
|
+
drivePathHome,
|
|
45
|
+
homedir(),
|
|
46
|
+
]) ?? homedir());
|
|
47
|
+
}
|
|
48
|
+
return firstNonEmpty([process.env.HOME, homedir()]) ?? homedir();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Determines whether a path string represents a Windows drive root (e.g., `C:` or `C:\`).
|
|
52
|
+
*
|
|
53
|
+
* @param candidate - The path string to test; typically a normalized candidate path.
|
|
54
|
+
* @returns `true` if `candidate` is a Windows drive root like `C:` or `C:\`, `false` otherwise.
|
|
55
|
+
*
|
|
56
|
+
* Notes:
|
|
57
|
+
* - This is a pure, concurrency-safe predicate.
|
|
58
|
+
* - Windows-specific behavior: accepts both `X:` and `X:\` forms as drive roots.
|
|
59
|
+
* - No token or secret redaction is performed by this function; it only inspects the string.
|
|
60
|
+
*/
|
|
61
|
+
function isWindowsDriveRoot(candidate) {
|
|
62
|
+
return /^[a-zA-Z]:\\?$/.test(candidate);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Normalize and canonicalize a filesystem candidate path for comparison and storage.
|
|
66
|
+
*
|
|
67
|
+
* @param candidate - Path string to normalize; leading and trailing whitespace are ignored.
|
|
68
|
+
* @returns The normalized, resolved path. On Windows drive roots a trailing backslash is preserved (e.g. `C:\`); for non-root paths trailing path separators are removed. Returns an empty string when `candidate` is empty or only whitespace.
|
|
69
|
+
*
|
|
70
|
+
* @remarks This function is pure and safe to call concurrently. It applies platform-aware normalization (Windows drive-root handling) and does not perform token redaction or other secret-masking IO. */
|
|
71
|
+
function normalizeCandidatePath(candidate) {
|
|
72
|
+
const trimmed = candidate.trim();
|
|
73
|
+
if (trimmed.length === 0)
|
|
74
|
+
return "";
|
|
75
|
+
const normalized = normalize(resolve(trimmed));
|
|
76
|
+
if (process.platform === "win32" && isWindowsDriveRoot(normalized)) {
|
|
77
|
+
return normalized.endsWith("\\") ? normalized : normalized + "\\";
|
|
78
|
+
}
|
|
79
|
+
if (normalized.length > 1 && /[\\/]$/.test(normalized)) {
|
|
80
|
+
return normalized.replace(/[\\/]+$/, "");
|
|
81
|
+
}
|
|
82
|
+
return normalized;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Normalize and deduplicate a list of filesystem candidate paths while preserving first-seen ordering.
|
|
86
|
+
*
|
|
87
|
+
* This function normalizes each input path (via normalizeCandidatePath), drops empty results,
|
|
88
|
+
* and removes duplicates. On Windows the deduplication is case-insensitive; on other platforms it is case-sensitive.
|
|
89
|
+
* The function is synchronous and free of side effects, so it is safe to call concurrently from multiple callers.
|
|
90
|
+
* Note: this function does not redact or mask any sensitive tokens that may appear in path strings.
|
|
91
|
+
*
|
|
92
|
+
* @param paths - Array of candidate path strings to normalize and de-duplicate
|
|
93
|
+
* @returns An array of normalized, unique paths in their first-seen order
|
|
94
|
+
*/
|
|
95
|
+
function deduplicatePaths(paths) {
|
|
96
|
+
const seen = new Set();
|
|
97
|
+
const result = [];
|
|
98
|
+
for (const candidate of paths) {
|
|
99
|
+
const normalized = normalizeCandidatePath(candidate);
|
|
100
|
+
if (normalized.length === 0)
|
|
101
|
+
continue;
|
|
102
|
+
const key = process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
103
|
+
if (seen.has(key))
|
|
104
|
+
continue;
|
|
105
|
+
seen.add(key);
|
|
106
|
+
result.push(normalized);
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Detects whether an account file or rotated account artifacts exist under the specified storage root.
|
|
112
|
+
*
|
|
113
|
+
* Scans for the canonical account file and its WAL variant, rotated/archived files matching the account filename pattern (excluding `.tmp`, `.wal`, and names containing `.rotate.`), and the backups directory. The probe is tolerant of unreadable directories (errors are ignored) and does not read file contents. Callers should be aware of concurrent filesystem changes — a `false` result does not guarantee no artifact will appear shortly after. On Windows, filesystem matching should be considered case-insensitive by callers. This check does not expose or parse any token contents.
|
|
114
|
+
*
|
|
115
|
+
* @param root - Filesystem path of the storage root to probe
|
|
116
|
+
* @returns `true` if any account file or rotated account artifact exists under `root` or its backups directory, `false` otherwise.
|
|
117
|
+
*/
|
|
118
|
+
function hasAccountArtifacts(root) {
|
|
119
|
+
const accountPath = join(root, ACCOUNT_FILE_NAME);
|
|
120
|
+
if (existsSync(accountPath) || existsSync(`${accountPath}.wal`)) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
const hasRotated = (dir) => {
|
|
124
|
+
try {
|
|
125
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
126
|
+
for (const entry of entries) {
|
|
127
|
+
if (!entry.isFile())
|
|
128
|
+
continue;
|
|
129
|
+
if (!entry.name.startsWith(`${ACCOUNT_FILE_NAME}.`))
|
|
130
|
+
continue;
|
|
131
|
+
if (entry.name.endsWith(".tmp"))
|
|
132
|
+
continue;
|
|
133
|
+
if (entry.name.endsWith(".wal"))
|
|
134
|
+
continue;
|
|
135
|
+
if (entry.name.includes(".rotate."))
|
|
136
|
+
continue;
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// Ignore unreadable directories and fall back to other probes.
|
|
142
|
+
}
|
|
143
|
+
return false;
|
|
144
|
+
};
|
|
145
|
+
if (hasRotated(root)) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
const backupsDir = join(root, BACKUPS_DIR_NAME);
|
|
149
|
+
if (existsSync(join(backupsDir, ACCOUNT_FILE_NAME))) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
if (hasRotated(backupsDir)) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Determines whether the given storage root contains on-disk storage signals (backups or projects).
|
|
159
|
+
*
|
|
160
|
+
* Checks for the presence of a "backups" or "projects" directory directly under `root`. The result
|
|
161
|
+
* reflects the filesystem state at the time of the call and may change concurrently; callers should
|
|
162
|
+
* treat this as a best-effort, race-prone probe. On Windows this uses the OS filesystem semantics
|
|
163
|
+
* for path existence checks. This function does not read or expose file contents and therefore does
|
|
164
|
+
* not reveal tokens or other secret material.
|
|
165
|
+
*
|
|
166
|
+
* @param root - Filesystem path to the candidate storage root
|
|
167
|
+
* @returns `true` if either a `backups` or `projects` directory exists under `root`, `false` otherwise
|
|
168
|
+
*/
|
|
169
|
+
function hasStorageSignals(root) {
|
|
170
|
+
return (existsSync(join(root, BACKUPS_DIR_NAME)) ||
|
|
171
|
+
existsSync(join(root, PROJECTS_DIR_NAME)));
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Determines whether a storage root is a per-project location or the global location.
|
|
175
|
+
*
|
|
176
|
+
* @param root - The candidate storage root path to classify.
|
|
177
|
+
* @param canonicalRoot - The canonical root path (typically the user-level `.opencode` directory).
|
|
178
|
+
* @returns The inferred scope: `"project"` if `root` is located under the `projects` subdirectory of `canonicalRoot`, `"global"` otherwise.
|
|
179
|
+
*
|
|
180
|
+
* Notes:
|
|
181
|
+
* - Uses Node's path.relative and the platform path separator; on Windows this comparison uses backslashes.
|
|
182
|
+
* - Pure and side-effect free; safe for concurrent use.
|
|
183
|
+
* - Only inspects path structure, not file contents, so no secrets or tokens are read or redacted here.
|
|
184
|
+
*/
|
|
185
|
+
function inferScopeFromRoot(root, canonicalRoot) {
|
|
186
|
+
const relativeRoot = relative(canonicalRoot, root);
|
|
187
|
+
return relativeRoot.startsWith(`${PROJECTS_DIR_NAME}${sep}`)
|
|
188
|
+
? "project"
|
|
189
|
+
: "global";
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Detects the oc-chatgpt multi-auth storage target by evaluating explicit, canonical, and per-project candidate roots.
|
|
193
|
+
*
|
|
194
|
+
* Examines an explicit override (OC_CHATGPT_MULTI_AUTH_DIR or options.explicitRoot), the canonical user store (~/.opencode),
|
|
195
|
+
* and a per-project storage location (derived from options.projectRoot or the current working directory). For each candidate
|
|
196
|
+
* it checks for account artifacts and storage signals and returns a single resolved target, an ambiguity listing multiple
|
|
197
|
+
* matching candidates, or a "none" result with the attempted candidates. This function performs synchronous filesystem checks
|
|
198
|
+
* and tolerates unreadable directories; callers should treat it as a blocking operation. On Windows, path normalization and
|
|
199
|
+
* deduplication are case-insensitive and drive-root variants (e.g. `C:` vs `C:\`) are normalized consistently. Returned
|
|
200
|
+
* descriptors include normalized paths but do not contain authentication tokens or other secret material.
|
|
201
|
+
*
|
|
202
|
+
* @param options - Optional overrides:
|
|
203
|
+
* - explicitRoot: absolute path to force as the candidate root (use `null` to explicitly disable); if omitted the
|
|
204
|
+
* OC_CHATGPT_MULTI_AUTH_DIR environment variable is considered.
|
|
205
|
+
* - projectRoot: explicit project root to derive per-project storage; if omitted the current working directory is used to
|
|
206
|
+
* discover the project root.
|
|
207
|
+
* @returns An OcChatgptTargetDetectionResult describing either a resolved `target` (with `descriptor` and a `resolution`
|
|
208
|
+
* of `"accounts"` or `"signals"`), an `ambiguous` outcome listing conflicting candidates, or `none` with the tried candidates.
|
|
209
|
+
*/
|
|
210
|
+
export function detectOcChatgptMultiAuthTarget(options) {
|
|
211
|
+
const explicitFromEnv = (process.env.OC_CHATGPT_MULTI_AUTH_DIR ?? "").trim();
|
|
212
|
+
const hasExplicitRootOption = options !== undefined && "explicitRoot" in options;
|
|
213
|
+
const explicitRoot = (hasExplicitRootOption ? (options.explicitRoot ?? "") : explicitFromEnv).trim();
|
|
214
|
+
const userHome = getResolvedUserHomeDir();
|
|
215
|
+
const canonicalRoot = join(userHome, CANONICAL_HOME_BASENAME);
|
|
216
|
+
const projectRoot = options?.projectRoot ?? findProjectRoot(process.cwd());
|
|
217
|
+
const identityRoot = projectRoot
|
|
218
|
+
? resolveProjectStorageIdentityRoot(projectRoot)
|
|
219
|
+
: null;
|
|
220
|
+
const projectStorageRoot = identityRoot
|
|
221
|
+
? join(canonicalRoot, PROJECTS_DIR_NAME, getProjectStorageKey(identityRoot))
|
|
222
|
+
: null;
|
|
223
|
+
const normalizedExplicitRoot = explicitRoot
|
|
224
|
+
? normalizeCandidatePath(explicitRoot)
|
|
225
|
+
: "";
|
|
226
|
+
const orderedRoots = normalizedExplicitRoot
|
|
227
|
+
? [normalizedExplicitRoot]
|
|
228
|
+
: deduplicatePaths([canonicalRoot, projectStorageRoot].filter((entry) => Boolean(entry)));
|
|
229
|
+
const candidates = orderedRoots.map((root) => {
|
|
230
|
+
const inferredScope = inferScopeFromRoot(root, canonicalRoot);
|
|
231
|
+
const source = root === normalizedExplicitRoot
|
|
232
|
+
? "explicit"
|
|
233
|
+
: inferredScope === "project"
|
|
234
|
+
? "project"
|
|
235
|
+
: "default-global";
|
|
236
|
+
const accountPath = join(root, ACCOUNT_FILE_NAME);
|
|
237
|
+
const backupRoot = join(root, BACKUPS_DIR_NAME);
|
|
238
|
+
const hasAccountArtifactsFlag = hasAccountArtifacts(root);
|
|
239
|
+
return {
|
|
240
|
+
scope: inferredScope,
|
|
241
|
+
source,
|
|
242
|
+
root,
|
|
243
|
+
accountPath,
|
|
244
|
+
backupRoot,
|
|
245
|
+
hasAccountArtifacts: hasAccountArtifactsFlag,
|
|
246
|
+
hasSignals: hasAccountArtifactsFlag || hasStorageSignals(root),
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
const withAccounts = candidates.filter((candidate) => candidate.hasAccountArtifacts);
|
|
250
|
+
if (withAccounts.length === 1) {
|
|
251
|
+
const winner = withAccounts[0];
|
|
252
|
+
if (!winner) {
|
|
253
|
+
throw new Error("Expected one target candidate with account artifacts");
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
kind: "target",
|
|
257
|
+
descriptor: {
|
|
258
|
+
scope: winner.scope,
|
|
259
|
+
source: winner.source,
|
|
260
|
+
root: winner.root,
|
|
261
|
+
accountPath: winner.accountPath,
|
|
262
|
+
backupRoot: winner.backupRoot,
|
|
263
|
+
resolution: "accounts",
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
if (withAccounts.length > 1) {
|
|
268
|
+
return {
|
|
269
|
+
kind: "ambiguous",
|
|
270
|
+
reason: "Multiple oc-chatgpt-multi-auth targets contain account artifacts; refusing to guess.",
|
|
271
|
+
candidates: withAccounts.map(({ scope, source, root, accountPath, backupRoot, hasAccountArtifacts, hasSignals, }) => ({
|
|
272
|
+
scope,
|
|
273
|
+
source,
|
|
274
|
+
root,
|
|
275
|
+
accountPath,
|
|
276
|
+
backupRoot,
|
|
277
|
+
hasAccountArtifacts,
|
|
278
|
+
hasSignals,
|
|
279
|
+
})),
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const withSignals = candidates.filter((candidate) => candidate.hasSignals);
|
|
283
|
+
if (withSignals.length === 1) {
|
|
284
|
+
const winner = withSignals[0];
|
|
285
|
+
if (!winner) {
|
|
286
|
+
throw new Error("Expected one target candidate with storage signals");
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
kind: "target",
|
|
290
|
+
descriptor: {
|
|
291
|
+
scope: winner.scope,
|
|
292
|
+
source: winner.source,
|
|
293
|
+
root: winner.root,
|
|
294
|
+
accountPath: winner.accountPath,
|
|
295
|
+
backupRoot: winner.backupRoot,
|
|
296
|
+
resolution: "signals",
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
if (withSignals.length > 1) {
|
|
301
|
+
return {
|
|
302
|
+
kind: "ambiguous",
|
|
303
|
+
reason: "Multiple oc-chatgpt-multi-auth targets contain storage signals; refusing to guess.",
|
|
304
|
+
candidates: withSignals.map(({ scope, source, root, accountPath, backupRoot, hasAccountArtifacts, hasSignals, }) => ({
|
|
305
|
+
scope,
|
|
306
|
+
source,
|
|
307
|
+
root,
|
|
308
|
+
accountPath,
|
|
309
|
+
backupRoot,
|
|
310
|
+
hasAccountArtifacts,
|
|
311
|
+
hasSignals,
|
|
312
|
+
})),
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
return {
|
|
316
|
+
kind: "none",
|
|
317
|
+
reason: "No oc-chatgpt-multi-auth target root found; create ~/.opencode or supply OC_CHATGPT_MULTI_AUTH_DIR.",
|
|
318
|
+
tried: candidates.map(({ scope, source, root, accountPath, backupRoot }) => ({
|
|
319
|
+
scope,
|
|
320
|
+
source,
|
|
321
|
+
root,
|
|
322
|
+
accountPath,
|
|
323
|
+
backupRoot,
|
|
324
|
+
})),
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=oc-chatgpt-target-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oc-chatgpt-target-detection.js","sourceRoot":"","sources":["../../lib/oc-chatgpt-target-detection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EACN,eAAe,EACf,oBAAoB,EACpB,iCAAiC,GACjC,MAAM,oBAAoB,CAAC;AAE5B,MAAM,iBAAiB,GAAG,4BAA4B,CAAC;AACvD,MAAM,gBAAgB,GAAG,SAAS,CAAC;AACnC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AACrC,MAAM,uBAAuB,GAAG,WAAW,CAAC;AA+D5C;;;;;GAKG;AACH,SAAS,aAAa,CAAC,MAAiC;IACvD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,OAAO,OAAO,CAAC;QAChB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,sBAAsB;IAC9B,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,CAAC,O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BAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,UAAU,EAAE,SAAS;aACrB;SACD,CAAC;IACH,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO;YACN,IAAI,EAAE,WAAW;YACjB,MAAM,EACL,oFAAoF;YACrF,UAAU,EAAE,WAAW,CAAC,GAAG,CAC1B,CAAC,EACA,KAAK,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,UAAU,GACV,EAAE,EAAE,CAAC,CAAC;gBACN,KAAK;gBACL,MAAM;gBACN,IAAI;gBACJ,WAAW;gBACX,UAAU;gBACV,mBAAmB;gBACnB,UAAU;aACV,CAAC,CACF;SACD,CAAC;IACH,CAAC;IAED,OAAO;QACN,IAAI,EAAE,MAAM;QACZ,MAAM,EACL,qGAAqG;QACtG,KAAK,EAAE,UAAU,CAAC,GAAG,CACpB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;YACtD,KAAK;YACL,MAAM;YACN,IAAI;YACJ,WAAW;YACX,UAAU;SACV,CAAC,CACF;KACD,CAAC;AACH,CAAC"}
|
|
@@ -307,7 +307,7 @@ YOU ARE IN A DIFFERENT ENVIRONMENT. These instructions override ALL previous too
|
|
|
307
307
|
|
|
308
308
|
<tool_replacements priority="0">
|
|
309
309
|
<critical_rule priority="0">
|
|
310
|
-
apply_patch/applyPatch are Codex names, but host tool names vary by version.
|
|
310
|
+
apply_patch/applyPatch are Codex names, but host tool names vary by version.
|
|
311
311
|
- Inspect the actual tool list before editing.
|
|
312
312
|
- If edit exists: use edit for precise in-place string replacements and hashline edits.
|
|
313
313
|
- If edit is absent and apply_patch exists: use apply_patch for those precise/hashline edits in this plugin.
|
|
@@ -329,7 +329,7 @@ File Operations:
|
|
|
329
329
|
- write - Create new files (if available)
|
|
330
330
|
- edit - Modify existing files with string replacement (version-dependent)
|
|
331
331
|
- oldString must be literal text from the current file; never pass unresolved placeholders like \${TARGET_SNIPPET}
|
|
332
|
-
- apply_patch - May be the edit/patch tool name in newer host builds (version-dependent)
|
|
332
|
+
- apply_patch - May be the edit/patch tool name in newer host builds (version-dependent)
|
|
333
333
|
- hashline_read - Read lines with hashline refs (L<line>#<hash>) for deterministic edits
|
|
334
334
|
- patch - Apply diff patches (version-dependent)
|
|
335
335
|
- read - Read file contents
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-paths.d.ts","sourceRoot":"","sources":["../../lib/runtime-paths.ts"],"names":[],"mappings":"AAkCA;;;;;;GAMG;AAEH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;
|
|
1
|
+
{"version":3,"file":"runtime-paths.d.ts","sourceRoot":"","sources":["../../lib/runtime-paths.ts"],"names":[],"mappings":"AAkCA;;;;;;GAMG;AAEH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AA2HD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CA0C7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
|
-
import { join, win32 } from "node:path";
|
|
2
|
+
import { join, normalize, win32 } from "node:path";
|
|
3
3
|
import { existsSync, readdirSync } from "node:fs";
|
|
4
4
|
function firstNonEmpty(values) {
|
|
5
5
|
for (const value of values) {
|
|
@@ -65,6 +65,20 @@ function deduplicatePaths(paths) {
|
|
|
65
65
|
}
|
|
66
66
|
return result;
|
|
67
67
|
}
|
|
68
|
+
function pathsEqualNormalized(a, b) {
|
|
69
|
+
const normalizePath = (value) => {
|
|
70
|
+
const trimmed = value.trim();
|
|
71
|
+
if (process.platform === "win32") {
|
|
72
|
+
const normalized = win32.normalize(trimmed);
|
|
73
|
+
const root = win32.parse(normalized).root;
|
|
74
|
+
const withoutTrailing = normalized === root ? normalized : normalized.replace(/[\\/]+$/, "");
|
|
75
|
+
return withoutTrailing.toLowerCase();
|
|
76
|
+
}
|
|
77
|
+
const normalized = normalize(trimmed);
|
|
78
|
+
return normalized === "/" ? "/" : normalized.replace(/\/+$/, "");
|
|
79
|
+
};
|
|
80
|
+
return normalizePath(a) === normalizePath(b);
|
|
81
|
+
}
|
|
68
82
|
/**
|
|
69
83
|
* Detects whether a directory contains known Codex storage indicators.
|
|
70
84
|
*
|
|
@@ -161,12 +175,18 @@ export function getCodexMultiAuthDir() {
|
|
|
161
175
|
if (fromEnv.length > 0) {
|
|
162
176
|
return fromEnv;
|
|
163
177
|
}
|
|
178
|
+
const codexHomeFromEnv = (process.env.CODEX_HOME ?? "").trim();
|
|
179
|
+
const defaultCodexHome = join(getResolvedUserHomeDir(), ".codex");
|
|
180
|
+
const isExplicitNonDefaultHome = codexHomeFromEnv.length > 0 && !pathsEqualNormalized(codexHomeFromEnv, defaultCodexHome);
|
|
164
181
|
const primary = join(getCodexHomeDir(), "multi-auth");
|
|
165
182
|
const fallbackCandidates = deduplicatePaths([
|
|
166
183
|
...getFallbackCodexHomeDirs().map((dir) => join(dir, "multi-auth")),
|
|
167
184
|
getLegacyCodexDir(),
|
|
168
185
|
]);
|
|
169
186
|
const orderedCandidates = deduplicatePaths([primary, ...fallbackCandidates]);
|
|
187
|
+
if (isExplicitNonDefaultHome) {
|
|
188
|
+
return primary;
|
|
189
|
+
}
|
|
170
190
|
// Prefer candidates that actually contain account storage. This prevents
|
|
171
191
|
// accidentally switching to a fresh empty directory that only has settings files.
|
|
172
192
|
for (const candidate of orderedCandidates) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-paths.js","sourceRoot":"","sources":["../../lib/runtime-paths.ts"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