viagen 0.2.2 → 0.2.5
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/cli.js +12 -4
- package/dist/index.js +13 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -19479,7 +19479,15 @@ var ProcessManager = class {
|
|
|
19479
19479
|
const stderrFd = openSync(this.stderrLog, "a");
|
|
19480
19480
|
this.child = spawn(this.command, [], {
|
|
19481
19481
|
cwd: this.cwd,
|
|
19482
|
-
env: {
|
|
19482
|
+
env: {
|
|
19483
|
+
...process.env,
|
|
19484
|
+
...this.env,
|
|
19485
|
+
PORT: String(this.appPort),
|
|
19486
|
+
__VIAGEN_CHILD: "1",
|
|
19487
|
+
// Child app runs without viagen auth — the app should handle its own
|
|
19488
|
+
// auth if needed. Viagen auth only protects the chat/AI server.
|
|
19489
|
+
VIAGEN_AUTH_TOKEN: ""
|
|
19490
|
+
},
|
|
19483
19491
|
stdio: ["ignore", stdoutFd, stderrFd],
|
|
19484
19492
|
shell: true,
|
|
19485
19493
|
// Detached so the app survives if the viagen chat server restarts
|
|
@@ -19827,12 +19835,13 @@ ${payload.err.frame || ""}`
|
|
|
19827
19835
|
logBuffer.push("warn", `[viagen] Could not checkout ${gitBranch} (dirty working tree?): ${msg}`);
|
|
19828
19836
|
}
|
|
19829
19837
|
}
|
|
19838
|
+
const isChildProcess = process.env["__VIAGEN_CHILD"] === "1";
|
|
19830
19839
|
const authToken = env["VIAGEN_AUTH_TOKEN"];
|
|
19831
|
-
if (authToken) {
|
|
19840
|
+
if (authToken && !isChildProcess) {
|
|
19832
19841
|
debug("server", "auth middleware enabled (VIAGEN_AUTH_TOKEN set)");
|
|
19833
19842
|
server.middlewares.use(createAuthMiddleware(authToken));
|
|
19834
19843
|
} else {
|
|
19835
|
-
debug("server",
|
|
19844
|
+
debug("server", `auth middleware DISABLED (${isChildProcess ? "child process" : "no VIAGEN_AUTH_TOKEN"})`);
|
|
19836
19845
|
}
|
|
19837
19846
|
const platformToken = env["VIAGEN_USER_TOKEN"] || env["VIAGEN_AUTH_TOKEN"];
|
|
19838
19847
|
const platformUrl = env["VIAGEN_PLATFORM_URL"] || "https://app.viagen.dev";
|
|
@@ -19949,7 +19958,6 @@ Page URL: ${pageUrl}`);
|
|
|
19949
19958
|
let processManager;
|
|
19950
19959
|
const rawAppCmd = options?.standalone ? env["VIAGEN_APP_COMMAND"] || process.env["VIAGEN_APP_COMMAND"] : void 0;
|
|
19951
19960
|
const appCommand = rawAppCmd?.replace(/^["']|["']$/g, "") || void 0;
|
|
19952
|
-
const isChildProcess = process.env["__VIAGEN_CHILD"] === "1";
|
|
19953
19961
|
if (isChildProcess) {
|
|
19954
19962
|
debug("server", "skipping process manager (running as child process)");
|
|
19955
19963
|
} else if (appCommand) {
|
package/dist/index.js
CHANGED
|
@@ -111,7 +111,7 @@ function registerHealthRoutes(server, env, errorRef) {
|
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
|
-
const currentVersion = true ? "0.2.
|
|
114
|
+
const currentVersion = true ? "0.2.5" : "0.0.0";
|
|
115
115
|
debug("health", `version resolved: ${currentVersion}`);
|
|
116
116
|
let versionCache = null;
|
|
117
117
|
server.middlewares.use("/via/version", (_req, res) => {
|
|
@@ -19075,7 +19075,15 @@ var ProcessManager = class {
|
|
|
19075
19075
|
const stderrFd = openSync(this.stderrLog, "a");
|
|
19076
19076
|
this.child = spawn(this.command, [], {
|
|
19077
19077
|
cwd: this.cwd,
|
|
19078
|
-
env: {
|
|
19078
|
+
env: {
|
|
19079
|
+
...process.env,
|
|
19080
|
+
...this.env,
|
|
19081
|
+
PORT: String(this.appPort),
|
|
19082
|
+
__VIAGEN_CHILD: "1",
|
|
19083
|
+
// Child app runs without viagen auth — the app should handle its own
|
|
19084
|
+
// auth if needed. Viagen auth only protects the chat/AI server.
|
|
19085
|
+
VIAGEN_AUTH_TOKEN: ""
|
|
19086
|
+
},
|
|
19079
19087
|
stdio: ["ignore", stdoutFd, stderrFd],
|
|
19080
19088
|
shell: true,
|
|
19081
19089
|
// Detached so the app survives if the viagen chat server restarts
|
|
@@ -19744,12 +19752,13 @@ ${payload.err.frame || ""}`
|
|
|
19744
19752
|
logBuffer.push("warn", `[viagen] Could not checkout ${gitBranch} (dirty working tree?): ${msg}`);
|
|
19745
19753
|
}
|
|
19746
19754
|
}
|
|
19755
|
+
const isChildProcess = process.env["__VIAGEN_CHILD"] === "1";
|
|
19747
19756
|
const authToken = env["VIAGEN_AUTH_TOKEN"];
|
|
19748
|
-
if (authToken) {
|
|
19757
|
+
if (authToken && !isChildProcess) {
|
|
19749
19758
|
debug("server", "auth middleware enabled (VIAGEN_AUTH_TOKEN set)");
|
|
19750
19759
|
server.middlewares.use(createAuthMiddleware(authToken));
|
|
19751
19760
|
} else {
|
|
19752
|
-
debug("server",
|
|
19761
|
+
debug("server", `auth middleware DISABLED (${isChildProcess ? "child process" : "no VIAGEN_AUTH_TOKEN"})`);
|
|
19753
19762
|
}
|
|
19754
19763
|
const platformToken = env["VIAGEN_USER_TOKEN"] || env["VIAGEN_AUTH_TOKEN"];
|
|
19755
19764
|
const platformUrl = env["VIAGEN_PLATFORM_URL"] || "https://app.viagen.dev";
|
|
@@ -19866,7 +19875,6 @@ Page URL: ${pageUrl}`);
|
|
|
19866
19875
|
let processManager;
|
|
19867
19876
|
const rawAppCmd = options?.standalone ? env["VIAGEN_APP_COMMAND"] || process.env["VIAGEN_APP_COMMAND"] : void 0;
|
|
19868
19877
|
const appCommand = rawAppCmd?.replace(/^["']|["']$/g, "") || void 0;
|
|
19869
|
-
const isChildProcess = process.env["__VIAGEN_CHILD"] === "1";
|
|
19870
19878
|
if (isChildProcess) {
|
|
19871
19879
|
debug("server", "skipping process manager (running as child process)");
|
|
19872
19880
|
} else if (appCommand) {
|