@seaveyon/harness-switch 0.7.0 → 0.9.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.
@@ -7015,7 +7015,7 @@ var require_public_api = __commonJS((exports) => {
7015
7015
 
7016
7016
  // src/app.ts
7017
7017
  import { existsSync as existsSync3 } from "fs";
7018
- import { join as join9 } from "path";
7018
+ import { join as join10 } from "path";
7019
7019
 
7020
7020
  // ../../node_modules/hono/dist/compose.js
7021
7021
  var compose = (middleware, onError, onNotFound) => {
@@ -12724,6 +12724,21 @@ async function readBody2(read) {
12724
12724
  });
12725
12725
  }
12726
12726
 
12727
+ // src/version.ts
12728
+ import { join as join9 } from "path";
12729
+ var cached;
12730
+ async function serverVersion() {
12731
+ if (cached)
12732
+ return cached;
12733
+ try {
12734
+ const pkg = JSON.parse(await Bun.file(join9(import.meta.dir, "../package.json")).text());
12735
+ cached = typeof pkg.version === "string" ? pkg.version : "0.0.0";
12736
+ } catch {
12737
+ cached = "0.0.0";
12738
+ }
12739
+ return cached;
12740
+ }
12741
+
12727
12742
  // src/app.ts
12728
12743
  function createApp(services) {
12729
12744
  const app = new Hono2;
@@ -12733,6 +12748,7 @@ function createApp(services) {
12733
12748
  app.get("/healthz", (c) => c.json({ ok: true }));
12734
12749
  const api = new Hono2;
12735
12750
  api.use("*", createOriginGuard());
12751
+ api.get("/version", async (c) => c.json({ name: "harness-switch", version: await serverVersion() }));
12736
12752
  api.route("/auth", createAuthRoutes(services));
12737
12753
  api.use("/harnesses/*", createAuthGuard(services));
12738
12754
  api.use("/harnesses", createAuthGuard(services));
@@ -12750,11 +12766,11 @@ function createApp(services) {
12750
12766
  if (c.req.path.startsWith("/api") || c.req.path === "/healthz") {
12751
12767
  return next();
12752
12768
  }
12753
- const assetPath = join9(publicDir, c.req.path.replace(/^\//, ""));
12769
+ const assetPath = join10(publicDir, c.req.path.replace(/^\//, ""));
12754
12770
  if (c.req.path !== "/" && existsSync3(assetPath)) {
12755
12771
  return serveStatic2({ root: publicDir })(c, next);
12756
12772
  }
12757
- const index = join9(publicDir, "index.html");
12773
+ const index = join10(publicDir, "index.html");
12758
12774
  if (existsSync3(index)) {
12759
12775
  c.header("Cache-Control", "no-store");
12760
12776
  return c.html(await Bun.file(index).text());
@@ -12795,19 +12811,19 @@ function createServices() {
12795
12811
  import { spawn } from "child_process";
12796
12812
  import { mkdirSync as mkdirSync3, openSync, readFileSync as readFileSync2, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
12797
12813
  import { homedir as homedir2 } from "os";
12798
- import { join as join10, resolve } from "path";
12814
+ import { join as join11, resolve } from "path";
12799
12815
  var DEFAULT_HOST = "127.0.0.1";
12800
12816
  var DEFAULT_PORT = 8787;
12801
12817
  var STOP_TIMEOUT_MS = 5000;
12802
12818
  var START_GRACE_MS = 500;
12803
12819
  function daemonDataDir() {
12804
- return process.env.HSW_DATA_DIR || join10(homedir2(), ".harness-switch");
12820
+ return process.env.HSW_DATA_DIR || join11(homedir2(), ".harness-switch");
12805
12821
  }
12806
12822
  function daemonPidFile() {
12807
- return join10(daemonDataDir(), "daemon.pid");
12823
+ return join11(daemonDataDir(), "daemon.pid");
12808
12824
  }
12809
12825
  function daemonLogFile() {
12810
- return join10(daemonDataDir(), "daemon.log");
12826
+ return join11(daemonDataDir(), "daemon.log");
12811
12827
  }
12812
12828
  function readPid() {
12813
12829
  try {
@@ -12872,7 +12888,7 @@ function printStatus() {
12872
12888
  console.log(`harness-switch daemon: ${running ? `running (pid ${pid})` : "not running"}`);
12873
12889
  console.log(` url: http://${host}:${port}`);
12874
12890
  console.log(` log: ${daemonLogFile()}`);
12875
- console.log(` password: ${join10(daemonDataDir(), "web_password")}`);
12891
+ console.log(` password: ${join11(daemonDataDir(), "web_password")}`);
12876
12892
  console.log(` data: ${daemonDataDir()}`);
12877
12893
  }
12878
12894
  async function daemonize() {
@@ -12910,7 +12926,7 @@ async function daemonize() {
12910
12926
  console.log(` url: http://${host}:${port}`);
12911
12927
  console.log(` log: ${logPath}`);
12912
12928
  console.log(" manage: harness-switch status | harness-switch stop");
12913
- console.log(` password (first run): ${join10(daemonDataDir(), "web_password")}`);
12929
+ console.log(` password (first run): ${join11(daemonDataDir(), "web_password")}`);
12914
12930
  }
12915
12931
  function usage() {
12916
12932
  return "usage: harness-switch [server|daemon|status|stop]";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seaveyon/harness-switch",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "A secure web control plane that switches API providers for Claude Code, Codex, Kimi Code, Pi and DeepSeek Harness by writing their native config files on SSH servers.",
5
5
  "keywords": [
6
6
  "claude-code",