@skylandnpm/octopus-proxy 0.1.31 → 0.1.33

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.
@@ -11664,6 +11664,10 @@ async function loadConfig(path, options = {}) {
11664
11664
  }
11665
11665
  }
11666
11666
 
11667
+ // src/version.ts
11668
+ import { readFileSync } from "node:fs";
11669
+ var proxyVersion = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
11670
+
11667
11671
  // src/host-identity.ts
11668
11672
  import { execFile } from "node:child_process";
11669
11673
  import { createHash, randomUUID, X509Certificate } from "node:crypto";
@@ -12509,6 +12513,7 @@ var Artifacts = class {
12509
12513
  import WebSocket from "ws";
12510
12514
  import { Duplex } from "node:stream";
12511
12515
  import { createPublicKey, randomUUID as randomUUID7, verify } from "node:crypto";
12516
+ import { userInfo as userInfo2 } from "node:os";
12512
12517
  import { TLSSocket, createSecureContext } from "node:tls";
12513
12518
 
12514
12519
  // src/host-auth.ts
@@ -12646,6 +12651,7 @@ var SecureChat = class {
12646
12651
  eventBytes = 0;
12647
12652
  stopping = false;
12648
12653
  context;
12654
+ serviceAccount = userInfo2().username;
12649
12655
  timer;
12650
12656
  start() {
12651
12657
  this.connect();
@@ -12681,7 +12687,11 @@ var SecureChat = class {
12681
12687
  if (this.stopping) return;
12682
12688
  const url = new URL("/ws/proxy-chat", this.config.hubUrl);
12683
12689
  url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
12684
- const socket = new WebSocket(url, { headers: { Authorization: `SecretKey ${this.config.secretKey}`, "X-Octopus-Bot-Id": this.config.botId }, maxPayload: 1024 * 1024 });
12690
+ const socket = new WebSocket(url, { headers: {
12691
+ Authorization: `SecretKey ${this.config.secretKey}`,
12692
+ "X-Octopus-Bot-Id": this.config.botId,
12693
+ "X-Octopus-Proxy-Version": proxyVersion
12694
+ }, maxPayload: 1024 * 1024 });
12685
12695
  this.outer = socket;
12686
12696
  let lastPong = Date.now();
12687
12697
  const heartbeat = setInterval(() => {
@@ -12736,7 +12746,7 @@ var SecureChat = class {
12736
12746
  return;
12737
12747
  }
12738
12748
  const exporter = tls.exportKeyingMaterial(32, "EXPORTER-octopus-device-v1", Buffer.from(this.config.botId));
12739
- sendJson(tls, { type: "auth.challenge", botId: this.config.botId, tunnelId: id, exporter: exporter.toString("base64") });
12749
+ sendJson(tls, { type: "auth.challenge", botId: this.config.botId, tunnelId: id, exporter: exporter.toString("base64"), serviceAccount: this.serviceAccount });
12740
12750
  });
12741
12751
  tls.on("data", (chunk) => this.receivePlaintext(id, Buffer.from(chunk)));
12742
12752
  tls.on("error", () => this.closeSession(id));
@@ -12785,7 +12795,7 @@ var SecureChat = class {
12785
12795
  const exporter = session.tls.exportKeyingMaterial(32, "EXPORTER-octopus-device-v1", Buffer.from(this.config.botId)).toString("base64");
12786
12796
  const proof = Buffer.from(`${this.config.botId}\0${id}\0${exporter}`);
12787
12797
  if (!verify(null, proof, createPublicKey({ key: Buffer.concat([ED25519_SPKI, key]), format: "der", type: "spki" }), signature)) throw new Error("Invalid device proof");
12788
- const valid = await this.authenticate(this.config.stateDirectory, String(message.username ?? ""), String(message.password ?? ""));
12798
+ const valid = await this.authenticate(this.config.stateDirectory, this.serviceAccount, String(message.password ?? ""));
12789
12799
  if (!valid) throw new Error("Host authentication failed");
12790
12800
  if (this.sessions.get(id) !== session) return;
12791
12801
  session.authenticated = true;
@@ -17147,7 +17157,7 @@ var ProjectRegistry = class {
17147
17157
  import { randomUUID as randomUUID15 } from "node:crypto";
17148
17158
  import { access } from "node:fs/promises";
17149
17159
  import { constants as constants4 } from "node:fs";
17150
- import { platform as platform3, userInfo as userInfo2 } from "node:os";
17160
+ import { platform as platform3, userInfo as userInfo3 } from "node:os";
17151
17161
  import * as pty from "node-pty";
17152
17162
  var TerminalManager = class {
17153
17163
  constructor(workspace, emit) {
@@ -17178,7 +17188,7 @@ var TerminalManager = class {
17178
17188
  cols: 80,
17179
17189
  rows: 24,
17180
17190
  cwd,
17181
- env: { PATH: process.env.PATH || "/usr/bin:/bin", HOME: userInfo2().homedir, TERM: "xterm-256color", USER: userInfo2().username }
17191
+ env: { PATH: process.env.PATH || "/usr/bin:/bin", HOME: userInfo3().homedir, TERM: "xterm-256color", USER: userInfo3().username }
17182
17192
  });
17183
17193
  const terminal2 = { id, project, owner, process: terminalProcess, history: "" };
17184
17194
  this.terminals.set(id, terminal2);
@@ -17349,6 +17359,7 @@ export {
17349
17359
  atomicJson,
17350
17360
  Uploads,
17351
17361
  ensureHostAuth,
17362
+ proxyVersion,
17352
17363
  ensureHostIdentity,
17353
17364
  createRuntime,
17354
17365
  createAdapter,
package/dist/cli.js CHANGED
@@ -19,11 +19,12 @@ import {
19
19
  launchdLogPath,
20
20
  launchdPlistPath,
21
21
  loadConfig,
22
+ proxyVersion,
22
23
  resolveConfigPath,
23
24
  runDaemon,
24
25
  supportedPlatform,
25
26
  systemdUnitPath
26
- } from "./chunk-KDOXN43O.js";
27
+ } from "./chunk-2RX5VSBS.js";
27
28
 
28
29
  // src/cli.ts
29
30
  import { spawn } from "node:child_process";
@@ -699,10 +700,6 @@ async function manageProjects(configPath2, remove) {
699
700
  }
700
701
  }
701
702
 
702
- // src/version.ts
703
- import { readFileSync } from "node:fs";
704
- var proxyVersion = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
705
-
706
703
  // src/cli.ts
707
704
  var USAGE = `octopus-proxy \u2014 Octopus \u4E3B\u673A\u4EE3\u7406
708
705
 
package/dist/main.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ConfigError,
4
4
  runDaemon
5
- } from "./chunk-KDOXN43O.js";
5
+ } from "./chunk-2RX5VSBS.js";
6
6
 
7
7
  // src/main.ts
8
8
  runDaemon(process.env.OCTOPUS_PROXY_CONFIG ?? "proxy.json").catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skylandnpm/octopus-proxy",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "type": "module",
5
5
  "description": "Octopus host proxy: OpenCode, Codex, ZCode and Pi adapters with service installer CLI",
6
6
  "bin": {