@skylandnpm/octopus-proxy 0.1.23 → 0.1.26

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.
@@ -12459,6 +12459,9 @@ var EventStream = class {
12459
12459
 
12460
12460
  // src/proxy-snapshot.ts
12461
12461
  import { randomUUID as randomUUID5 } from "node:crypto";
12462
+ import { execFile as execFile2 } from "node:child_process";
12463
+ import { promisify as promisify2 } from "node:util";
12464
+ var execute2 = promisify2(execFile2);
12462
12465
  function record(value) {
12463
12466
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
12464
12467
  }
@@ -12478,10 +12481,32 @@ function publicModels(value) {
12478
12481
  }
12479
12482
  return result;
12480
12483
  }
12484
+ async function gitBranch(directory) {
12485
+ const git = async (...args) => (await execute2("git", ["--no-optional-locks", ...args], {
12486
+ cwd: directory,
12487
+ encoding: "utf8",
12488
+ timeout: 3e3,
12489
+ maxBuffer: 64 * 1024
12490
+ })).stdout.trim();
12491
+ try {
12492
+ const branch = await git("branch", "--show-current");
12493
+ if (branch) return branch;
12494
+ const commit = await git("rev-parse", "--short", "HEAD");
12495
+ return commit ? `HEAD@${commit}` : void 0;
12496
+ } catch {
12497
+ return void 0;
12498
+ }
12499
+ }
12500
+ async function publicProjects(config) {
12501
+ return Promise.all(config.projects.map(async ({ id, name, directory, specDirectories }) => {
12502
+ const branch = await gitBranch(directory);
12503
+ return { id, name, directory, specDirectories, ...branch ? { gitBranch: branch } : {} };
12504
+ }));
12505
+ }
12481
12506
  async function buildProxySnapshot(config, runtime, adapter, requestedProjectId) {
12482
12507
  const capabilities = adapter.supportedOperations();
12483
12508
  const status = record(await runtime.status());
12484
- const projects = config.projects.map(({ id, name, directory, specDirectories }) => ({ id, name, directory, specDirectories }));
12509
+ const projects = await publicProjects(config);
12485
12510
  const projectId = projects.find((project) => project.id === requestedProjectId)?.id ?? projects[0]?.id;
12486
12511
  const models = [];
12487
12512
  let modelCatalogStatus = capabilities.includes("configuration.models") ? "unavailable" : "unsupported";
@@ -14831,8 +14856,8 @@ function zcodeEnvironment(command) {
14831
14856
  }
14832
14857
 
14833
14858
  // src/tools/stdio-runtime.ts
14834
- import { spawn as spawn2, execFile as execFile2 } from "node:child_process";
14835
- import { promisify as promisify2 } from "node:util";
14859
+ import { spawn as spawn2, execFile as execFile3 } from "node:child_process";
14860
+ import { promisify as promisify3 } from "node:util";
14836
14861
  import { mkdir as mkdir5, open as open5 } from "node:fs/promises";
14837
14862
  import { join as join7 } from "node:path";
14838
14863
 
@@ -15026,7 +15051,7 @@ function wrapEnvelope(frame) {
15026
15051
  }
15027
15052
 
15028
15053
  // src/tools/stdio-runtime.ts
15029
- var run = promisify2(execFile2);
15054
+ var run = promisify3(execFile3);
15030
15055
  var StdioRuntime = class {
15031
15056
  constructor(config) {
15032
15057
  this.config = config;
@@ -16384,11 +16409,11 @@ var PiAdapter = class {
16384
16409
  };
16385
16410
 
16386
16411
  // src/tools/pi-runtime.ts
16387
- import { execFile as execFile3, spawn as spawn4 } from "node:child_process";
16412
+ import { execFile as execFile4, spawn as spawn4 } from "node:child_process";
16388
16413
  import { mkdir as mkdir6, open as open6 } from "node:fs/promises";
16389
16414
  import { join as join9 } from "node:path";
16390
- import { promisify as promisify3 } from "node:util";
16391
- var run2 = promisify3(execFile3);
16415
+ import { promisify as promisify4 } from "node:util";
16416
+ var run2 = promisify4(execFile4);
16392
16417
  var PiRuntime = class {
16393
16418
  constructor(config) {
16394
16419
  this.config = config;
@@ -16622,7 +16647,7 @@ async function runDaemon(configPath) {
16622
16647
  if (c.operation === "runtime.start") return runtime.start();
16623
16648
  if (c.operation === "runtime.stop") return runtime.stop();
16624
16649
  if (c.operation === "runtime.restart") return runtime.restart();
16625
- if (c.operation === "workspace.projects") return config.projects.map(({ id, name }) => ({ id, name }));
16650
+ if (c.operation === "workspace.projects") return publicProjects(config);
16626
16651
  const project = c.projectId;
16627
16652
  if (!project) throw new Error("Project required");
16628
16653
  workspace.project(project);
package/dist/cli.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  runDaemon,
23
23
  supportedPlatform,
24
24
  systemdUnitPath
25
- } from "./chunk-KYGWORYZ.js";
25
+ } from "./chunk-3IEPWZVZ.js";
26
26
 
27
27
  // src/cli.ts
28
28
  import { spawn } from "node:child_process";
package/dist/main.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ConfigError,
4
4
  runDaemon
5
- } from "./chunk-KYGWORYZ.js";
5
+ } from "./chunk-3IEPWZVZ.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.23",
3
+ "version": "0.1.26",
4
4
  "type": "module",
5
5
  "description": "Octopus host proxy: OpenCode, Codex, ZCode and Pi adapters with service installer CLI",
6
6
  "bin": {