@jacobbd/relay-ai 0.12.1 → 0.12.3
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/{chunk-UQKYSNDM.js → chunk-3K2DFBNP.js} +2 -2
- package/dist/{chunk-7ASGPECN.js → chunk-C7TTIGMR.js} +7 -4
- package/dist/{chunk-7ASGPECN.js.map → chunk-C7TTIGMR.js.map} +1 -1
- package/dist/{chunk-OYE6YZYP.js → chunk-R427D6VA.js} +2 -2
- package/dist/cli.js +71 -10
- package/dist/cli.js.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/{manual-models-FJZEOQSO.js → manual-models-MN2GWS4I.js} +3 -3
- package/dist/{ui-command-QFXKL6HH.js → ui-command-Q27TKD53.js} +4 -4
- package/package.json +1 -1
- /package/dist/{chunk-UQKYSNDM.js.map → chunk-3K2DFBNP.js.map} +0 -0
- /package/dist/{chunk-OYE6YZYP.js.map → chunk-R427D6VA.js.map} +0 -0
- /package/dist/{manual-models-FJZEOQSO.js.map → manual-models-MN2GWS4I.js.map} +0 -0
- /package/dist/{ui-command-QFXKL6HH.js.map → ui-command-Q27TKD53.js.map} +0 -0
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
translateRequest,
|
|
86
86
|
upstreamHttpStatus,
|
|
87
87
|
validateCustomEndpointUrl
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-C7TTIGMR.js";
|
|
89
89
|
|
|
90
90
|
// src/registry/google-model-id.ts
|
|
91
91
|
var GOOGLE_MODEL_PREFIX = "models/";
|
|
@@ -9661,4 +9661,4 @@ export {
|
|
|
9661
9661
|
supportsClaudeTransparentMode,
|
|
9662
9662
|
buildHttpProxyRoutes
|
|
9663
9663
|
};
|
|
9664
|
-
//# sourceMappingURL=chunk-
|
|
9664
|
+
//# sourceMappingURL=chunk-R427D6VA.js.map
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
addManualModel,
|
|
4
4
|
removeManualModel
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3K2DFBNP.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_APP_AUTO_COMPACT_RATIO,
|
|
8
8
|
CODEX_APP_PROVIDER_ID,
|
|
@@ -148,7 +148,7 @@ import {
|
|
|
148
148
|
waitForCodexAppQuit,
|
|
149
149
|
writeSecureLogLine,
|
|
150
150
|
zenRegistryStub
|
|
151
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-R427D6VA.js";
|
|
152
152
|
import {
|
|
153
153
|
filterTemplates,
|
|
154
154
|
getTemplateById,
|
|
@@ -222,7 +222,7 @@ import {
|
|
|
222
222
|
thinkingProviderOptions,
|
|
223
223
|
upstreamHttpStatus,
|
|
224
224
|
validateCustomEndpointUrl
|
|
225
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-C7TTIGMR.js";
|
|
226
226
|
import "./chunk-JIDIH7DS.js";
|
|
227
227
|
|
|
228
228
|
// src/cli.ts
|
|
@@ -12541,6 +12541,43 @@ function getConfigLibraryPath() {
|
|
|
12541
12541
|
function getMetaJsonPath() {
|
|
12542
12542
|
return join14(getConfigLibraryPath(), "_meta.json");
|
|
12543
12543
|
}
|
|
12544
|
+
function getClaudeDesktopConfigJsonPath() {
|
|
12545
|
+
return join14(getClaudeDesktopHome(), "claude_desktop_config.json");
|
|
12546
|
+
}
|
|
12547
|
+
function readDesktopConfigJson() {
|
|
12548
|
+
const path3 = getClaudeDesktopConfigJsonPath();
|
|
12549
|
+
if (!existsSync10(path3)) return {};
|
|
12550
|
+
try {
|
|
12551
|
+
const parsed = JSON.parse(readFileSync6(path3, "utf8"));
|
|
12552
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
|
|
12553
|
+
} catch {
|
|
12554
|
+
return {};
|
|
12555
|
+
}
|
|
12556
|
+
}
|
|
12557
|
+
function writeDesktopConfigJson(config) {
|
|
12558
|
+
const path3 = getClaudeDesktopConfigJsonPath();
|
|
12559
|
+
mkdirSync6(dirname3(path3), { recursive: true });
|
|
12560
|
+
writeFileSync5(path3, `${JSON.stringify(config, null, 2)}
|
|
12561
|
+
`, "utf8");
|
|
12562
|
+
}
|
|
12563
|
+
function readDeploymentMode() {
|
|
12564
|
+
const mode = readDesktopConfigJson()["deploymentMode"];
|
|
12565
|
+
return mode === "3p" || mode === "1p" ? mode : null;
|
|
12566
|
+
}
|
|
12567
|
+
function applyDeploymentMode3p() {
|
|
12568
|
+
const config = readDesktopConfigJson();
|
|
12569
|
+
const previous = readDeploymentMode();
|
|
12570
|
+
if (previous === "3p") return void 0;
|
|
12571
|
+
config["deploymentMode"] = "3p";
|
|
12572
|
+
writeDesktopConfigJson(config);
|
|
12573
|
+
return { previous };
|
|
12574
|
+
}
|
|
12575
|
+
function restoreDeploymentMode(previous) {
|
|
12576
|
+
const config = readDesktopConfigJson();
|
|
12577
|
+
if (previous === null) delete config["deploymentMode"];
|
|
12578
|
+
else config["deploymentMode"] = previous;
|
|
12579
|
+
writeDesktopConfigJson(config);
|
|
12580
|
+
}
|
|
12544
12581
|
function readMetaJson() {
|
|
12545
12582
|
const metaPath = getMetaJsonPath();
|
|
12546
12583
|
if (!existsSync10(metaPath)) return null;
|
|
@@ -12787,6 +12824,17 @@ function restoreMetaJson() {
|
|
|
12787
12824
|
unlinkSync2(backupPath);
|
|
12788
12825
|
}
|
|
12789
12826
|
}
|
|
12827
|
+
function restoreDeploymentModeFromLock(lock) {
|
|
12828
|
+
if (!lock || !("previousDeploymentMode" in lock)) return;
|
|
12829
|
+
restoreDeploymentMode(lock.previousDeploymentMode ?? null);
|
|
12830
|
+
}
|
|
12831
|
+
function safeCleanupStep(label, fn) {
|
|
12832
|
+
try {
|
|
12833
|
+
fn();
|
|
12834
|
+
} catch (err) {
|
|
12835
|
+
console.error(`[claude-app] ${label} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
12836
|
+
}
|
|
12837
|
+
}
|
|
12790
12838
|
function removeRelayAiConfig(uuid) {
|
|
12791
12839
|
const configPath = join15(getConfigLibraryPath(), `${uuid}.json`);
|
|
12792
12840
|
if (existsSync11(configPath)) {
|
|
@@ -12811,7 +12859,7 @@ function lockHeldByAnotherLiveProcess(lock) {
|
|
|
12811
12859
|
function recoverSession() {
|
|
12812
12860
|
const state = inspectSessionLock();
|
|
12813
12861
|
if (state.status === "unreadable") {
|
|
12814
|
-
restoreMetaJson
|
|
12862
|
+
safeCleanupStep("restore _meta.json", restoreMetaJson);
|
|
12815
12863
|
try {
|
|
12816
12864
|
rmSync5(getSessionLockPath2(), { force: true });
|
|
12817
12865
|
} catch {
|
|
@@ -12828,14 +12876,15 @@ function recoverSession() {
|
|
|
12828
12876
|
};
|
|
12829
12877
|
}
|
|
12830
12878
|
if (lock) {
|
|
12831
|
-
restoreMetaJson
|
|
12879
|
+
safeCleanupStep("restore _meta.json", restoreMetaJson);
|
|
12880
|
+
safeCleanupStep("restore deploymentMode", () => restoreDeploymentModeFromLock(lock));
|
|
12832
12881
|
removeRelayAiConfig(lock.uuid);
|
|
12833
12882
|
try {
|
|
12834
12883
|
rmSync5(getSessionLockPath2(), { force: true });
|
|
12835
12884
|
} catch {
|
|
12836
12885
|
}
|
|
12837
12886
|
} else {
|
|
12838
|
-
restoreMetaJson
|
|
12887
|
+
safeCleanupStep("restore _meta.json", restoreMetaJson);
|
|
12839
12888
|
}
|
|
12840
12889
|
return { recovered: true, message: "Restored Claude Desktop relay-ai config." };
|
|
12841
12890
|
}
|
|
@@ -12862,7 +12911,8 @@ function cleanupSession(uuid) {
|
|
|
12862
12911
|
const lock = state.status === "valid" ? state.lock : null;
|
|
12863
12912
|
const sharedStateIsOwnedElsewhere = lockHeldByAnotherLiveProcess(lock);
|
|
12864
12913
|
if (!sharedStateIsOwnedElsewhere) {
|
|
12865
|
-
restoreMetaJson
|
|
12914
|
+
safeCleanupStep("restore _meta.json", restoreMetaJson);
|
|
12915
|
+
safeCleanupStep("restore deploymentMode", () => restoreDeploymentModeFromLock(lock));
|
|
12866
12916
|
try {
|
|
12867
12917
|
rmSync5(getSessionLockPath2(), { force: true });
|
|
12868
12918
|
} catch {
|
|
@@ -12875,7 +12925,13 @@ function cleanupSession(uuid) {
|
|
|
12875
12925
|
}
|
|
12876
12926
|
}
|
|
12877
12927
|
function setupExitCleanup(uuid) {
|
|
12878
|
-
process.on("exit", () =>
|
|
12928
|
+
process.on("exit", () => {
|
|
12929
|
+
try {
|
|
12930
|
+
cleanupSession(uuid);
|
|
12931
|
+
} catch (err) {
|
|
12932
|
+
console.error(`[claude-app] cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
12933
|
+
}
|
|
12934
|
+
});
|
|
12879
12935
|
}
|
|
12880
12936
|
|
|
12881
12937
|
// src/claude-app.ts
|
|
@@ -13050,11 +13106,13 @@ async function runClaudeAppCommand(args, boot) {
|
|
|
13050
13106
|
debugLogPath
|
|
13051
13107
|
});
|
|
13052
13108
|
uuid = writeRelayAiConfig(proxyHandle.port);
|
|
13109
|
+
const deploymentModeChange = applyDeploymentMode3p();
|
|
13053
13110
|
writeSessionLock2({
|
|
13054
13111
|
pid: process.pid,
|
|
13055
13112
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13056
13113
|
uuid,
|
|
13057
|
-
proxyPort: proxyHandle.port
|
|
13114
|
+
proxyPort: proxyHandle.port,
|
|
13115
|
+
...deploymentModeChange ? { previousDeploymentMode: deploymentModeChange.previous } : {}
|
|
13058
13116
|
});
|
|
13059
13117
|
sessionActive = true;
|
|
13060
13118
|
setupExitCleanup(uuid);
|
|
@@ -13069,6 +13127,9 @@ async function runClaudeAppCommand(args, boot) {
|
|
|
13069
13127
|
}
|
|
13070
13128
|
console.log(`
|
|
13071
13129
|
${pc11.green("\u2714")} Proxy started on port ${proxyHandle.port}`);
|
|
13130
|
+
if (deploymentModeChange?.previous === "1p") {
|
|
13131
|
+
p14.log.info("Claude Desktop was pinned to first-party mode; switched it to third-party for this session.");
|
|
13132
|
+
}
|
|
13072
13133
|
try {
|
|
13073
13134
|
await launchOrRestartClaudeApp();
|
|
13074
13135
|
} catch (err) {
|
|
@@ -15981,7 +16042,7 @@ Options:
|
|
|
15981
16042
|
--trace Write debug logs under ~/.relay-ai/logs/`);
|
|
15982
16043
|
return 0;
|
|
15983
16044
|
}
|
|
15984
|
-
const { runUiCommand } = await import("./ui-command-
|
|
16045
|
+
const { runUiCommand } = await import("./ui-command-Q27TKD53.js");
|
|
15985
16046
|
return runUiCommand({ trace: parsed.trace, serverMode: parsed.uiServerMode });
|
|
15986
16047
|
}
|
|
15987
16048
|
if (parsed.command === "models") {
|