@vtxmacro/cli 2026.8.35 → 2026.8.36

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.
Files changed (2) hide show
  1. package/bin/vtx.js +227 -87
  2. package/package.json +1 -1
package/bin/vtx.js CHANGED
@@ -38,7 +38,7 @@ var init_agent_cli_release = __esm({
38
38
  "agent-cli-release.json"() {
39
39
  agent_cli_release_default = {
40
40
  package_name: "@vtxmacro/cli",
41
- package_version: "2026.8.35",
41
+ package_version: "2026.8.36",
42
42
  codex_package_name: "@openai/codex",
43
43
  codex_version: "0.147.0",
44
44
  platforms: {
@@ -16619,66 +16619,86 @@ async function acquireInferenceHostProcessLock(path, dependencies = {}) {
16619
16619
  }
16620
16620
  };
16621
16621
  }
16622
- var INFERENCE_CREDENTIAL_NAMESPACE, MAX_INFERENCE_PRIVATE_FILE_BYTES, WINDOWS_PRIVATE_ACL_SCRIPT, windowsPrivateAclInvocation, runWindowsPrivateAcl, windowsAclCache, windowsAclIdentity, aclCacheKey, secureWindowsPrivatePath, invalidateWindowsAclCache, rebindHardenedWindowsAclAfterRename, rebindHardenedWindowsDirectoryAfterOwnedMutation, isDefaultWindowsPrivatePath, secureExistingWindowsPath, linuxProcessIdentity, windowsProcessIdentity, darwinProcessIdentity, runSmallIdentityCommand, cachedSystemBootIdentity, readInferenceSystemBootIdentity, defaultProcessIdentity, defaultCurrentProcessIdentity, processLockObservationCache, inferenceProcessIdentitiesMatch, DEFAULT_INFERENCE_HOST_INSTANCE, SAFE_INFERENCE_HOST_INSTANCE, requireNamedInstancePath, credentialStoreIdentity;
16622
+ var INFERENCE_CREDENTIAL_NAMESPACE, MAX_INFERENCE_PRIVATE_FILE_BYTES, WINDOWS_PRIVATE_ACL_BROKER_SCRIPT, windowsPrivateAclBrokerInvocation, WindowsPrivateAclBroker, defaultWindowsPrivateAclBroker, runWindowsPrivateAcl, windowsAclCache, windowsAclIdentity, aclCacheKey, secureWindowsPrivatePath, invalidateWindowsAclCache, rebindHardenedWindowsAclAfterRename, rebindHardenedWindowsDirectoryAfterOwnedMutation, isDefaultWindowsPrivatePath, secureExistingWindowsPath, linuxProcessIdentity, windowsProcessIdentity, darwinProcessIdentity, runSmallIdentityCommand, cachedSystemBootIdentity, readInferenceSystemBootIdentity, defaultProcessIdentity, defaultCurrentProcessIdentity, processLockObservationCache, inferenceProcessIdentitiesMatch, DEFAULT_INFERENCE_HOST_INSTANCE, SAFE_INFERENCE_HOST_INSTANCE, requireNamedInstancePath, credentialStoreIdentity;
16623
16623
  var init_config = __esm({
16624
16624
  "lib/inference-host/config.ts"() {
16625
16625
  "use strict";
16626
16626
  INFERENCE_CREDENTIAL_NAMESPACE = "vtxmacro-insights-inference";
16627
16627
  MAX_INFERENCE_PRIVATE_FILE_BYTES = 16 * 1024 * 1024;
16628
- WINDOWS_PRIVATE_ACL_SCRIPT = `$ErrorActionPreference='Stop'
16629
- $path=[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($env:VTX_PRIVATE_PATH_B64))
16630
- $kind=$env:VTX_PRIVATE_PATH_KIND
16631
- $mode=$env:VTX_PRIVATE_ACL_MODE
16632
- if(-not (Test-Path -LiteralPath $path)) { [Console]::Out.Write('missing'); exit 3 }
16633
- $current=[Security.Principal.WindowsIdentity]::GetCurrent().User
16634
- $system=New-Object Security.Principal.SecurityIdentifier('S-1-5-18')
16635
- $admins=New-Object Security.Principal.SecurityIdentifier('S-1-5-32-544')
16636
- $allowed=@($current.Value,$system.Value,$admins.Value)
16637
- if($mode -eq 'harden') {
16638
- $acl=Get-Acl -LiteralPath $path
16639
- $existingOwner=(New-Object Security.Principal.NTAccount($acl.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
16640
- if($existingOwner -ne $current.Value) { throw 'private ACL owner is invalid' }
16641
- $acl.SetAccessRuleProtection($true,$false)
16642
- foreach($existingRule in @($acl.Access)) {
16643
- [void]$acl.RemoveAccessRuleSpecific($existingRule)
16644
- }
16645
- $inherit=if($kind -eq 'directory') {
16646
- [Security.AccessControl.InheritanceFlags]'ContainerInherit,ObjectInherit'
16647
- } else { [Security.AccessControl.InheritanceFlags]::None }
16648
- foreach($sid in @($current,$system,$admins)) {
16649
- $rule=New-Object Security.AccessControl.FileSystemAccessRule(
16650
- $sid,
16651
- [Security.AccessControl.FileSystemRights]::FullControl,
16652
- $inherit,
16653
- [Security.AccessControl.PropagationFlags]::None,
16654
- [Security.AccessControl.AccessControlType]::Allow
16655
- )
16656
- [void]$acl.AddAccessRule($rule)
16657
- }
16658
- (Get-Item -LiteralPath $path).SetAccessControl($acl)
16659
- }
16660
- $actual=Get-Acl -LiteralPath $path
16661
- $owner=(New-Object Security.Principal.NTAccount($actual.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
16662
- if($owner -ne $current.Value) { throw 'private ACL owner is invalid' }
16663
- if($mode -eq 'verify-owner') { [Console]::Out.Write('ok'); exit 0 }
16664
- if(-not $actual.AreAccessRulesProtected) { throw 'private ACL inheritance is invalid' }
16665
- $userFull=$false
16666
- foreach($rule in $actual.Access) {
16667
- $sid=$rule.IdentityReference.Translate([Security.Principal.SecurityIdentifier]).Value
16668
- if($rule.IsInherited -or $allowed -notcontains $sid -or $rule.AccessControlType -ne [Security.AccessControl.AccessControlType]::Allow) {
16669
- throw 'private ACL contains an unauthorized access rule'
16670
- }
16671
- if($sid -eq $current.Value -and (($rule.FileSystemRights -band [Security.AccessControl.FileSystemRights]::FullControl) -eq [Security.AccessControl.FileSystemRights]::FullControl)) { $userFull=$true }
16672
- }
16673
- if(-not $userFull) { throw 'private ACL does not grant the current user full control' }
16674
- [Console]::Out.Write('ok')`;
16675
- windowsPrivateAclInvocation = (path, kind, mode) => ({
16628
+ WINDOWS_PRIVATE_ACL_BROKER_SCRIPT = `$ErrorActionPreference='Stop'
16629
+ $ProgressPreference='SilentlyContinue'
16630
+ while(($line=[Console]::In.ReadLine()) -ne $null) {
16631
+ $requestId=$null
16632
+ try {
16633
+ if($line.Length -lt 2 -or $line.Length -gt 65536) { throw 'invalid request size' }
16634
+ $request=$line | ConvertFrom-Json
16635
+ $names=@($request.PSObject.Properties.Name | Sort-Object)
16636
+ if(($names -join ',') -ne 'id,kind,mode,path_b64') { throw 'invalid request shape' }
16637
+ if($request.id -isnot [long] -and $request.id -isnot [int]) { throw 'invalid request id' }
16638
+ $requestId=[long]$request.id
16639
+ if($requestId -lt 1) { throw 'invalid request id' }
16640
+ $kind=[string]$request.kind
16641
+ $mode=[string]$request.mode
16642
+ if($kind -ne 'directory' -and $kind -ne 'file') { throw 'invalid path kind' }
16643
+ if($mode -ne 'harden' -and $mode -ne 'verify' -and $mode -ne 'verify-owner') { throw 'invalid ACL mode' }
16644
+ $path=[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String([string]$request.path_b64))
16645
+ if([string]::IsNullOrWhiteSpace($path) -or $path.Length -gt 32767 -or $path.Contains([char]0)) { throw 'invalid path' }
16646
+ if(-not (Test-Path -LiteralPath $path)) {
16647
+ [Console]::Out.WriteLine((@{id=$requestId;status='missing'} | ConvertTo-Json -Compress))
16648
+ continue
16649
+ }
16650
+ $current=[Security.Principal.WindowsIdentity]::GetCurrent().User
16651
+ $system=New-Object Security.Principal.SecurityIdentifier('S-1-5-18')
16652
+ $admins=New-Object Security.Principal.SecurityIdentifier('S-1-5-32-544')
16653
+ $allowed=@($current.Value,$system.Value,$admins.Value)
16654
+ if($mode -eq 'harden') {
16655
+ $acl=Get-Acl -LiteralPath $path
16656
+ $existingOwner=(New-Object Security.Principal.NTAccount($acl.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
16657
+ if($existingOwner -ne $current.Value) { throw 'private ACL owner is invalid' }
16658
+ $acl.SetAccessRuleProtection($true,$false)
16659
+ foreach($existingRule in @($acl.Access)) { [void]$acl.RemoveAccessRuleSpecific($existingRule) }
16660
+ $inherit=if($kind -eq 'directory') {
16661
+ [Security.AccessControl.InheritanceFlags]'ContainerInherit,ObjectInherit'
16662
+ } else { [Security.AccessControl.InheritanceFlags]::None }
16663
+ foreach($sid in @($current,$system,$admins)) {
16664
+ $rule=New-Object Security.AccessControl.FileSystemAccessRule(
16665
+ $sid,
16666
+ [Security.AccessControl.FileSystemRights]::FullControl,
16667
+ $inherit,
16668
+ [Security.AccessControl.PropagationFlags]::None,
16669
+ [Security.AccessControl.AccessControlType]::Allow
16670
+ )
16671
+ [void]$acl.AddAccessRule($rule)
16672
+ }
16673
+ (Get-Item -LiteralPath $path).SetAccessControl($acl)
16674
+ }
16675
+ $actual=Get-Acl -LiteralPath $path
16676
+ $owner=(New-Object Security.Principal.NTAccount($actual.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
16677
+ if($owner -ne $current.Value) { throw 'private ACL owner is invalid' }
16678
+ if($mode -ne 'verify-owner') {
16679
+ if(-not $actual.AreAccessRulesProtected) { throw 'private ACL inheritance is invalid' }
16680
+ $userFull=$false
16681
+ foreach($rule in $actual.Access) {
16682
+ $sid=$rule.IdentityReference.Translate([Security.Principal.SecurityIdentifier]).Value
16683
+ if($rule.IsInherited -or $allowed -notcontains $sid -or $rule.AccessControlType -ne [Security.AccessControl.AccessControlType]::Allow) {
16684
+ throw 'private ACL contains an unauthorized access rule'
16685
+ }
16686
+ if($sid -eq $current.Value -and (($rule.FileSystemRights -band [Security.AccessControl.FileSystemRights]::FullControl) -eq [Security.AccessControl.FileSystemRights]::FullControl)) { $userFull=$true }
16687
+ }
16688
+ if(-not $userFull) { throw 'private ACL does not grant the current user full control' }
16689
+ }
16690
+ [Console]::Out.WriteLine((@{id=$requestId;status='ok'} | ConvertTo-Json -Compress))
16691
+ } catch {
16692
+ [Console]::Out.WriteLine((@{id=$requestId;status='error'} | ConvertTo-Json -Compress))
16693
+ }
16694
+ }`;
16695
+ windowsPrivateAclBrokerInvocation = () => ({
16676
16696
  args: [
16677
16697
  "-NoLogo",
16678
16698
  "-NoProfile",
16679
16699
  "-NonInteractive",
16680
16700
  "-EncodedCommand",
16681
- Buffer.from(WINDOWS_PRIVATE_ACL_SCRIPT, "utf16le").toString("base64")
16701
+ Buffer.from(WINDOWS_PRIVATE_ACL_BROKER_SCRIPT, "utf16le").toString("base64")
16682
16702
  ],
16683
16703
  env: {
16684
16704
  NODE_ENV: process.env.NODE_ENV,
@@ -16688,49 +16708,169 @@ if(-not $userFull) { throw 'private ACL does not grant the current user full con
16688
16708
  PATHEXT: process.env.PATHEXT,
16689
16709
  PSModulePath: process.env.PSModulePath,
16690
16710
  TEMP: process.env.TEMP,
16691
- TMP: process.env.TMP,
16692
- VTX_PRIVATE_PATH_B64: Buffer.from(path, "utf8").toString("base64"),
16693
- VTX_PRIVATE_PATH_KIND: kind,
16694
- VTX_PRIVATE_ACL_MODE: mode
16711
+ TMP: process.env.TMP
16695
16712
  }
16696
16713
  });
16697
- runWindowsPrivateAcl = async (path, kind, mode) => await new Promise((resolvePromise, reject) => {
16698
- const invocation = windowsPrivateAclInvocation(path, kind, mode);
16699
- const child = spawn("powershell.exe", [...invocation.args], {
16700
- env: invocation.env,
16701
- windowsHide: true,
16702
- stdio: ["ignore", "pipe", "pipe"]
16703
- });
16704
- const stdout = [];
16705
- const stderr = [];
16706
- let settled = false;
16707
- const timer = setTimeout(() => child.kill("SIGKILL"), 15e3);
16708
- child.stdout.on("data", (chunk) => stdout.push(Buffer.from(chunk)));
16709
- child.stderr.on("data", (chunk) => stderr.push(Buffer.from(chunk)));
16710
- const settle = (error48) => {
16711
- if (settled) return;
16712
- settled = true;
16713
- clearTimeout(timer);
16714
- if (error48) reject(error48);
16715
- else resolvePromise();
16716
- };
16717
- child.once("error", (error48) => settle(error48));
16718
- child.once("exit", (code) => {
16719
- const output3 = Buffer.concat(stdout).toString("utf8").trim();
16720
- if (code === 0 && output3 === "ok") {
16721
- settle();
16714
+ WindowsPrivateAclBroker = class {
16715
+ constructor(dependencies = {}) {
16716
+ this.child = null;
16717
+ this.requestSequence = 0;
16718
+ this.queue = Promise.resolve();
16719
+ this.pending = null;
16720
+ this.outputBuffer = "";
16721
+ this.idleTimer = null;
16722
+ this.run = async (path, kind, mode) => {
16723
+ const operation = this.queue.then(
16724
+ () => this.dispatch(path, kind, mode),
16725
+ () => this.dispatch(path, kind, mode)
16726
+ );
16727
+ this.queue = operation.then(() => void 0, () => void 0);
16728
+ await operation;
16729
+ };
16730
+ this.requestTimeoutMs = dependencies.requestTimeoutMs ?? 15e3;
16731
+ this.idleShutdownMs = dependencies.idleShutdownMs ?? 3e4;
16732
+ this.spawnProcess = dependencies.spawnProcess ?? (() => {
16733
+ const invocation = windowsPrivateAclBrokerInvocation();
16734
+ return spawn("powershell.exe", [...invocation.args], {
16735
+ env: invocation.env,
16736
+ windowsHide: true,
16737
+ stdio: ["pipe", "pipe", "pipe"]
16738
+ });
16739
+ });
16740
+ }
16741
+ scheduleIdleShutdown() {
16742
+ if (this.idleTimer) clearTimeout(this.idleTimer);
16743
+ this.idleTimer = setTimeout(() => {
16744
+ this.idleTimer = null;
16745
+ const child = this.child;
16746
+ if (!child || this.pending) return;
16747
+ this.child = null;
16748
+ this.outputBuffer = "";
16749
+ child.stdin.end();
16750
+ const force = setTimeout(() => child.kill("SIGKILL"), 1e3);
16751
+ force.unref();
16752
+ child.once("exit", () => clearTimeout(force));
16753
+ }, this.idleShutdownMs);
16754
+ this.idleTimer.unref();
16755
+ }
16756
+ failChild(child, error48) {
16757
+ if (this.child !== child) return;
16758
+ this.child = null;
16759
+ this.outputBuffer = "";
16760
+ if (this.idleTimer) {
16761
+ clearTimeout(this.idleTimer);
16762
+ this.idleTimer = null;
16763
+ }
16764
+ const pending = this.pending;
16765
+ this.pending = null;
16766
+ if (pending) {
16767
+ clearTimeout(pending.timer);
16768
+ pending.reject(error48);
16769
+ }
16770
+ child.kill("SIGKILL");
16771
+ }
16772
+ acceptLine(child, line) {
16773
+ const pending = this.pending;
16774
+ if (!pending || !line || line.length > 4096) {
16775
+ this.failChild(child, new Error("Windows private ACL broker returned malformed output."));
16776
+ return;
16777
+ }
16778
+ let response;
16779
+ try {
16780
+ const parsed = JSON.parse(line);
16781
+ if (Object.keys(parsed).sort().join("\0") !== "id\0status" || parsed.id !== pending.id || !["ok", "missing", "error"].includes(String(parsed.status))) throw new Error("invalid response");
16782
+ response = parsed;
16783
+ } catch {
16784
+ this.failChild(child, new Error("Windows private ACL broker returned malformed output."));
16722
16785
  return;
16723
16786
  }
16724
- const detail = Buffer.concat(stderr).toString("utf8").trim();
16725
- if (code === 3 && output3 === "missing" || /GetAcl_PathNotFound|Cannot find path .* because it does not exist/iu.test(detail)) {
16787
+ this.pending = null;
16788
+ clearTimeout(pending.timer);
16789
+ if (response.status === "ok") {
16790
+ pending.resolve();
16791
+ } else if (response.status === "missing") {
16726
16792
  const error48 = new Error("Windows private path no longer exists.");
16727
16793
  error48.code = "ENOENT";
16728
- settle(error48);
16729
- return;
16794
+ pending.reject(error48);
16795
+ } else {
16796
+ pending.reject(new Error(`Windows private ACL ${pending.mode} failed.`));
16730
16797
  }
16731
- settle(new Error(`Windows private ACL ${mode} failed${detail ? `: ${detail}` : "."}`));
16732
- });
16733
- });
16798
+ this.scheduleIdleShutdown();
16799
+ }
16800
+ ensureChild() {
16801
+ if (this.child && this.child.exitCode === null && !this.child.killed) return this.child;
16802
+ const child = this.spawnProcess();
16803
+ this.child = child;
16804
+ this.outputBuffer = "";
16805
+ child.stdout.setEncoding("utf8");
16806
+ child.stdout.on("data", (chunk) => {
16807
+ if (this.child !== child) return;
16808
+ this.outputBuffer += chunk;
16809
+ if (this.outputBuffer.length > 65536) {
16810
+ this.failChild(child, new Error("Windows private ACL broker exceeded its output limit."));
16811
+ return;
16812
+ }
16813
+ while (this.child === child) {
16814
+ const newline = this.outputBuffer.indexOf("\n");
16815
+ if (newline < 0) break;
16816
+ const line = this.outputBuffer.slice(0, newline).trim();
16817
+ this.outputBuffer = this.outputBuffer.slice(newline + 1);
16818
+ this.acceptLine(child, line);
16819
+ }
16820
+ });
16821
+ child.stderr.on("data", () => void 0);
16822
+ child.once("error", () => {
16823
+ this.failChild(child, new Error("Windows private ACL broker failed to start."));
16824
+ });
16825
+ child.once("exit", () => {
16826
+ this.failChild(child, new Error("Windows private ACL broker exited before confirmation."));
16827
+ });
16828
+ child.unref();
16829
+ for (const stream of [child.stdin, child.stdout, child.stderr]) {
16830
+ stream.unref?.();
16831
+ }
16832
+ return child;
16833
+ }
16834
+ async dispatch(path, kind, mode) {
16835
+ if (this.idleTimer) {
16836
+ clearTimeout(this.idleTimer);
16837
+ this.idleTimer = null;
16838
+ }
16839
+ const id2 = ++this.requestSequence;
16840
+ const request = `${JSON.stringify({
16841
+ id: id2,
16842
+ kind,
16843
+ mode,
16844
+ path_b64: Buffer.from(path, "utf8").toString("base64")
16845
+ })}
16846
+ `;
16847
+ if (Buffer.byteLength(request, "utf8") > 65536) {
16848
+ throw new Error("Windows private ACL broker request exceeds its input limit.");
16849
+ }
16850
+ const child = this.ensureChild();
16851
+ await new Promise((resolvePromise, reject) => {
16852
+ const timer = setTimeout(() => {
16853
+ this.failChild(child, new Error("Windows private ACL broker request timed out."));
16854
+ }, this.requestTimeoutMs);
16855
+ this.pending = { id: id2, mode, resolve: resolvePromise, reject, timer };
16856
+ child.stdin.write(request, "utf8", (error48) => {
16857
+ if (error48) {
16858
+ this.failChild(child, new Error("Windows private ACL broker request failed."));
16859
+ }
16860
+ });
16861
+ });
16862
+ }
16863
+ close() {
16864
+ if (this.idleTimer) clearTimeout(this.idleTimer);
16865
+ this.idleTimer = null;
16866
+ const child = this.child;
16867
+ this.child = null;
16868
+ this.outputBuffer = "";
16869
+ if (child) child.stdin.end();
16870
+ }
16871
+ };
16872
+ defaultWindowsPrivateAclBroker = new WindowsPrivateAclBroker();
16873
+ runWindowsPrivateAcl = async (path, kind, mode) => await defaultWindowsPrivateAclBroker.run(path, kind, mode);
16734
16874
  windowsAclCache = /* @__PURE__ */ new Map();
16735
16875
  windowsAclIdentity = async (path) => {
16736
16876
  const metadata = await lstat(path, { bigint: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtxmacro/cli",
3
- "version": "2026.8.35",
3
+ "version": "2026.8.36",
4
4
  "description": "VTX Macro CLI, MCP server, and durable subscription inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",