@neuralnomads/codenomad-dev 0.14.0-dev-20260427-0ba13713 → 0.14.0-dev-20260502-ff4446a3
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.
|
@@ -36,9 +36,10 @@ describe("buildWindowsSpawnSpec", () => {
|
|
|
36
36
|
env: {
|
|
37
37
|
OPENCODE_CONFIG_DIR: String.raw `C:\Users\dev\AppData\Roaming\CodeNomad\opencode-config`,
|
|
38
38
|
CODENOMAD_INSTANCE_ID: "workspace-123",
|
|
39
|
+
OPENCODE_SERVER_BASE_URL: "https://127.0.0.1:4321/workspaces/workspace-123/worktrees/root/instance",
|
|
39
40
|
OPENCODE_SERVER_PASSWORD: "secret",
|
|
40
41
|
},
|
|
41
|
-
propagateEnvKeys: ["OPENCODE_CONFIG_DIR", "CODENOMAD_INSTANCE_ID", "OPENCODE_SERVER_PASSWORD"],
|
|
42
|
+
propagateEnvKeys: ["OPENCODE_CONFIG_DIR", "CODENOMAD_INSTANCE_ID", "OPENCODE_SERVER_BASE_URL", "OPENCODE_SERVER_PASSWORD"],
|
|
42
43
|
});
|
|
43
44
|
assert.equal(spec.command, "wsl.exe");
|
|
44
45
|
assert.deepEqual(spec.args, [
|
|
@@ -53,7 +54,7 @@ describe("buildWindowsSpawnSpec", () => {
|
|
|
53
54
|
"0",
|
|
54
55
|
]);
|
|
55
56
|
assert.equal(spec.cwd, undefined);
|
|
56
|
-
assert.equal(spec.env?.WSLENV, "OPENCODE_CONFIG_DIR/p:CODENOMAD_INSTANCE_ID:OPENCODE_SERVER_PASSWORD");
|
|
57
|
+
assert.equal(spec.env?.WSLENV, "OPENCODE_CONFIG_DIR/p:CODENOMAD_INSTANCE_ID:OPENCODE_SERVER_BASE_URL:OPENCODE_SERVER_PASSWORD");
|
|
57
58
|
});
|
|
58
59
|
it("upgrades existing WSLENV path entries to include /p", () => {
|
|
59
60
|
const spec = buildWindowsSpawnSpec(String.raw `\\wsl.localhost\Ubuntu\home\dev\.opencode\bin\opencode`, ["serve"], {
|
|
@@ -6,7 +6,7 @@ import { searchWorkspaceFiles } from "../filesystem/search";
|
|
|
6
6
|
import { clearWorkspaceSearchCache } from "../filesystem/search-cache";
|
|
7
7
|
import { WorkspaceRuntime } from "./runtime";
|
|
8
8
|
import { getOpencodeConfigDir } from "../opencode-config.js";
|
|
9
|
-
import { buildOpencodeBasicAuthHeader, OPENCODE_SERVER_PASSWORD_ENV, OPENCODE_SERVER_USERNAME_ENV, resolveOpencodeServerAuth, } from "./opencode-auth";
|
|
9
|
+
import { OPENCODE_SERVER_BASE_URL_ENV, buildOpencodeBasicAuthHeader, OPENCODE_SERVER_PASSWORD_ENV, OPENCODE_SERVER_USERNAME_ENV, resolveOpencodeServerAuth, } from "./opencode-auth";
|
|
10
10
|
const STARTUP_STABILITY_DELAY_MS = 1500;
|
|
11
11
|
export class WorkspaceManager {
|
|
12
12
|
constructor(options) {
|
|
@@ -77,6 +77,8 @@ export class WorkspaceManager {
|
|
|
77
77
|
const serverConfig = this.options.settings.getOwner("config", "server");
|
|
78
78
|
const envVars = serverConfig?.environmentVariables;
|
|
79
79
|
const userEnvironment = envVars && typeof envVars === "object" && !Array.isArray(envVars) ? envVars : {};
|
|
80
|
+
const serverBaseUrl = this.options.getServerBaseUrl();
|
|
81
|
+
const normalizedServerBaseUrl = serverBaseUrl.replace(/\/+$/, "");
|
|
80
82
|
const { username: opencodeUsername, password: opencodePassword } = resolveOpencodeServerAuth({
|
|
81
83
|
userEnvironment,
|
|
82
84
|
processEnv: process.env,
|
|
@@ -90,8 +92,9 @@ export class WorkspaceManager {
|
|
|
90
92
|
...userEnvironment,
|
|
91
93
|
OPENCODE_CONFIG_DIR: this.opencodeConfigDir,
|
|
92
94
|
CODENOMAD_INSTANCE_ID: id,
|
|
93
|
-
CODENOMAD_BASE_URL:
|
|
95
|
+
CODENOMAD_BASE_URL: serverBaseUrl,
|
|
94
96
|
...(this.options.nodeExtraCaCertsPath ? { NODE_EXTRA_CA_CERTS: this.options.nodeExtraCaCertsPath } : {}),
|
|
97
|
+
[OPENCODE_SERVER_BASE_URL_ENV]: `${normalizedServerBaseUrl}${proxyPath}`,
|
|
95
98
|
[OPENCODE_SERVER_USERNAME_ENV]: opencodeUsername,
|
|
96
99
|
[OPENCODE_SERVER_PASSWORD_ENV]: opencodePassword,
|
|
97
100
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
export const OPENCODE_SERVER_USERNAME_ENV = "OPENCODE_SERVER_USERNAME";
|
|
3
3
|
export const OPENCODE_SERVER_PASSWORD_ENV = "OPENCODE_SERVER_PASSWORD";
|
|
4
|
+
export const OPENCODE_SERVER_BASE_URL_ENV = "OPENCODE_SERVER_BASE_URL";
|
|
4
5
|
export const DEFAULT_OPENCODE_USERNAME = "codenomad";
|
|
5
6
|
export function generateOpencodeServerPassword() {
|
|
6
7
|
return crypto.randomBytes(32).toString("base64url");
|