@parall/codex-agent 1.30.0 → 1.31.0
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/config.js +2 -2
- package/dist/dispatch.js +1 -1
- package/dist/index.js +20 -1
- package/package.json +4 -4
- package/src/config.ts +2 -2
- package/src/dispatch.ts +1 -1
- package/src/index.ts +17 -1
package/dist/config.js
CHANGED
|
@@ -26,9 +26,9 @@ export function resolveCodexAgentConfig(env = process.env) {
|
|
|
26
26
|
|| path.join(env.HOME || os.homedir(), ".codex"));
|
|
27
27
|
// Bridge state lives outside CODEX_HOME to avoid polluting codex's own
|
|
28
28
|
// directory with non-codex files.
|
|
29
|
-
const stateDir = resolvePath(env.
|
|
29
|
+
const stateDir = resolvePath(env.PRLL_STATE_DIR?.trim()
|
|
30
30
|
|| path.join(env.HOME || os.homedir(), ".parall-agent"));
|
|
31
|
-
const workspaceDir = resolvePath(env.
|
|
31
|
+
const workspaceDir = resolvePath(env.PRLL_WORKSPACE_DIR?.trim() || path.join(stateDir, "workspace"));
|
|
32
32
|
return {
|
|
33
33
|
apiUrl,
|
|
34
34
|
apiKey,
|
package/dist/dispatch.js
CHANGED
|
@@ -611,7 +611,7 @@ function ensureGitRepo(workingDirectory) {
|
|
|
611
611
|
fs.mkdirSync(workingDirectory, { recursive: true });
|
|
612
612
|
// Only `git init` if the workspace isn't already inside any git repo. A
|
|
613
613
|
// bare existsSync(.git) check would miss the common case of a user pointing
|
|
614
|
-
//
|
|
614
|
+
// PRLL_WORKSPACE_DIR at a subdirectory of their existing project,
|
|
615
615
|
// and silently creating a nested repo there would mangle their layout.
|
|
616
616
|
try {
|
|
617
617
|
execSync("git rev-parse --is-inside-work-tree", { cwd: workingDirectory, stdio: "pipe" });
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as os from "node:os";
|
|
3
|
-
import { ParallAgentGateway, createPlatformConfigManager, createLogger, childLogger, isPlatformManagedProfile, parseShutdownDeadlineMs } from "@parall/agent-core";
|
|
3
|
+
import { ParallAgentGateway, createPlatformConfigManager, createLogger, childLogger, isPlatformManagedProfile, parseShutdownDeadlineMs, parseProviderConfig, clearAllProviderCreds, llmSource } from "@parall/agent-core";
|
|
4
4
|
import { ApiError, ParallClient, ParallWs } from "@parall/sdk";
|
|
5
5
|
import { buildCodexRuntimeKey, contextFilePathForSession, resolveCodexAgentConfig, resolveWsUrl, sessionStateFilePathForRuntime, stepIdFilePathForSession, } from "./config.js";
|
|
6
6
|
import { CodexAppServerAdapter } from "./dispatch.js";
|
|
@@ -20,7 +20,25 @@ async function getAgentMeWithLegacyFallback(client, orgId) {
|
|
|
20
20
|
return { ...user, agent_profile: null };
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
function resolveProviderEnv() {
|
|
24
|
+
const pc = parseProviderConfig(process.env);
|
|
25
|
+
if (!pc)
|
|
26
|
+
return;
|
|
27
|
+
clearAllProviderCreds(process.env);
|
|
28
|
+
const source = llmSource(pc);
|
|
29
|
+
if (source === "parall") {
|
|
30
|
+
process.env.OPENAI_API_KEY = process.env.PRLL_API_KEY;
|
|
31
|
+
process.env.OPENAI_BASE_URL = `${process.env.PRLL_API_URL}/api/llm/v1`;
|
|
32
|
+
}
|
|
33
|
+
else if (source === "custom") {
|
|
34
|
+
if (pc.openai_api_key)
|
|
35
|
+
process.env.OPENAI_API_KEY = pc.openai_api_key;
|
|
36
|
+
if (pc.openai_base_url)
|
|
37
|
+
process.env.OPENAI_BASE_URL = pc.openai_base_url;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
23
40
|
async function main() {
|
|
41
|
+
resolveProviderEnv();
|
|
24
42
|
const config = resolveCodexAgentConfig(process.env);
|
|
25
43
|
const client = new ParallClient({
|
|
26
44
|
baseUrl: config.apiUrl,
|
|
@@ -117,6 +135,7 @@ async function main() {
|
|
|
117
135
|
});
|
|
118
136
|
},
|
|
119
137
|
onNewSession: () => { sessionManager.clearMainThread(); },
|
|
138
|
+
onSessionStale: () => { sessionManager.clearMainThread(); },
|
|
120
139
|
});
|
|
121
140
|
const abortController = new AbortController();
|
|
122
141
|
const abort = () => abortController.abort();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/codex-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Codex CLI bridge runtime for self-hosted Parall agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"smol-toml": "^1.6.1",
|
|
29
|
-
"@parall/
|
|
30
|
-
"@parall/
|
|
31
|
-
"@parall/sdk": "1.
|
|
29
|
+
"@parall/cli": "1.31.0",
|
|
30
|
+
"@parall/agent-core": "1.31.0",
|
|
31
|
+
"@parall/sdk": "1.31.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^22.0.0",
|
package/src/config.ts
CHANGED
|
@@ -63,10 +63,10 @@ export function resolveCodexAgentConfig(env: NodeJS.ProcessEnv = process.env): C
|
|
|
63
63
|
// Bridge state lives outside CODEX_HOME to avoid polluting codex's own
|
|
64
64
|
// directory with non-codex files.
|
|
65
65
|
const stateDir = resolvePath(
|
|
66
|
-
env.
|
|
66
|
+
env.PRLL_STATE_DIR?.trim()
|
|
67
67
|
|| path.join(env.HOME || os.homedir(), ".parall-agent"),
|
|
68
68
|
);
|
|
69
|
-
const workspaceDir = resolvePath(env.
|
|
69
|
+
const workspaceDir = resolvePath(env.PRLL_WORKSPACE_DIR?.trim() || path.join(stateDir, "workspace"));
|
|
70
70
|
|
|
71
71
|
return {
|
|
72
72
|
apiUrl,
|
package/src/dispatch.ts
CHANGED
|
@@ -671,7 +671,7 @@ function ensureGitRepo(workingDirectory: string): void {
|
|
|
671
671
|
fs.mkdirSync(workingDirectory, { recursive: true });
|
|
672
672
|
// Only `git init` if the workspace isn't already inside any git repo. A
|
|
673
673
|
// bare existsSync(.git) check would miss the common case of a user pointing
|
|
674
|
-
//
|
|
674
|
+
// PRLL_WORKSPACE_DIR at a subdirectory of their existing project,
|
|
675
675
|
// and silently creating a nested repo there would mangle their layout.
|
|
676
676
|
try {
|
|
677
677
|
execSync("git rev-parse --is-inside-work-tree", { cwd: workingDirectory, stdio: "pipe" });
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import * as os from "node:os";
|
|
4
|
-
import { ParallAgentGateway, createPlatformConfigManager, createLogger, childLogger, isPlatformManagedProfile, parseShutdownDeadlineMs } from "@parall/agent-core";
|
|
4
|
+
import { ParallAgentGateway, createPlatformConfigManager, createLogger, childLogger, isPlatformManagedProfile, parseShutdownDeadlineMs, parseProviderConfig, clearAllProviderCreds, llmSource } from "@parall/agent-core";
|
|
5
5
|
import { ApiError, ParallClient, ParallWs } from "@parall/sdk";
|
|
6
6
|
import {
|
|
7
7
|
buildCodexRuntimeKey,
|
|
@@ -30,7 +30,22 @@ async function getAgentMeWithLegacyFallback(client: ParallClient, orgId: string)
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
function resolveProviderEnv(): void {
|
|
34
|
+
const pc = parseProviderConfig(process.env);
|
|
35
|
+
if (!pc) return;
|
|
36
|
+
clearAllProviderCreds(process.env);
|
|
37
|
+
const source = llmSource(pc);
|
|
38
|
+
if (source === "parall") {
|
|
39
|
+
process.env.OPENAI_API_KEY = process.env.PRLL_API_KEY;
|
|
40
|
+
process.env.OPENAI_BASE_URL = `${process.env.PRLL_API_URL}/api/llm/v1`;
|
|
41
|
+
} else if (source === "custom") {
|
|
42
|
+
if (pc.openai_api_key) process.env.OPENAI_API_KEY = pc.openai_api_key;
|
|
43
|
+
if (pc.openai_base_url) process.env.OPENAI_BASE_URL = pc.openai_base_url;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
33
47
|
async function main() {
|
|
48
|
+
resolveProviderEnv();
|
|
34
49
|
const config = resolveCodexAgentConfig(process.env);
|
|
35
50
|
|
|
36
51
|
const client = new ParallClient({
|
|
@@ -135,6 +150,7 @@ async function main() {
|
|
|
135
150
|
});
|
|
136
151
|
},
|
|
137
152
|
onNewSession: () => { sessionManager.clearMainThread(); },
|
|
153
|
+
onSessionStale: () => { sessionManager.clearMainThread(); },
|
|
138
154
|
});
|
|
139
155
|
|
|
140
156
|
const abortController = new AbortController();
|