Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
fix(openclaw): launch Windows headroom shims via shell
JerrettDavisafb339059b04
diff --git a/plugins/openclaw/src/proxy-manager.ts b/plugins/openclaw/src/proxy-manager.tsindex cece87294..b85e0373a 100644--- a/plugins/openclaw/src/proxy-manager.ts+++ b/plugins/openclaw/src/proxy-manager.ts@@ -47,6 +47,8 @@ interface LaunchSpec {args: string[];checkCommand: string;checkArgs: string[];+ useShell?: boolean;+ checkUseShell?: boolean;}export class ProxyManager {@@ -177,7 +179,7 @@ export class ProxyManager {const errors: string[] = [];for (const spec of specs) {- if (!this.canExecute(spec.checkCommand, spec.checkArgs)) {+ if (!this.canExecute(spec.checkCommand, spec.checkArgs, spec.checkUseShell ?? spec.useShell)) {this.logger.debug(`Launcher unavailable: ${spec.label}`);continue;}@@ -185,6 +187,7 @@ export class ProxyManager {try {const child = spawn(spec.command, spec.args, {detached: true,+ shell: spec.useShell === true,stdio: "ignore",});child.unref();@@ -213,6 +216,7 @@ export class ProxyManager {args: commonArgs,checkCommand: "headroom",checkArgs: ["--version"],+ useShell: process.platform === "win32",});// 2) Local npm install (inside plugin install path)@@ -224,14 +228,15 @@ export class ProxyManager {: [join(localBinDir, "headroom")];for (const localBin of localBins) {if (!existsSync(localBin)) continue;- specs.push({- label: `Local npm: ${localBin}`,- command: localBin,- args: commonArgs,- checkCommand: localBin,- checkArgs: ["--version"],- });- }+ specs.push({+ label: `Local npm: ${localBin}`,+ command: localBin,+ args: commonArgs,+ checkCommand: localBin,+ checkArgs: ["--version"],+ useShell: process.platform === "win32",+ });+ }// 3) Global npm installconst npmPrefix = this.getNpmGlobalPrefix();@@ -248,6 +253,7 @@ export class ProxyManager {args: commonArgs,checkCommand: globalBin,checkArgs: ["--version"],+ useShell: process.platform === "win32",});}}@@ -281,9 +287,10 @@ export class ProxyManager {return commands;}- private canExecute(command: string, args: string[]): boolean {+ private canExecute(command: string, args: string[], useShell = false): boolean {try {const result = spawnSync(command, args, {+ shell: useShell,stdio: "ignore",timeout: 5000,});diff --git a/plugins/openclaw/test/proxy-manager.test.ts b/plugins/openclaw/test/proxy-manager.test.tsindex cf85634af..80ef27b16 100644--- a/plugins/openclaw/test/proxy-manager.test.ts+++ b/plugins/openclaw/test/proxy-manager.test.ts@@ -229,6 +229,27 @@ describe("ProxyManager launch internals", () => {expect(infoSpy).toHaveBeenCalledWith(expect.stringContaining("second-node"));});+ it("supports shell-backed launch specs for PATH shims and script wrappers", async () => {+ const manager = new ProxyManager({});+ const shellBuiltin = process.platform === "win32" ? "dir" : ":";+ (manager as any).buildLaunchSpecs = () => [+ {+ label: "shell-backed",+ command: shellBuiltin,+ args: [],+ checkCommand: shellBuiltin,+ checkArgs: [],+ useShell: true,+ },+ ];+ const infoSpy = vi.spyOn((manager as any).logger, "info");++ await (manager as any).startHeadroomProxy("http://127.0.0.1:8787", 8787);++ expect(infoSpy).toHaveBeenCalledWith(expect.stringContaining("Auto-start launcher selected"));+ expect(infoSpy).toHaveBeenCalledWith(expect.stringContaining("shell-backed"));+ });+it("throws when no launcher is executable", async () => {const manager = new ProxyManager({});(manager as any).buildLaunchSpecs = () => [