@vtxmacro/cli 2026.8.42 → 2026.8.44
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.
- package/README.md +5 -2
- package/bin/vtx.js +197 -83
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,9 @@ Copilot is an additive preview adapter that uses the official SDK and validates
|
|
|
60
60
|
final text against VTX's immutable schema. An uncertain interrupted Copilot call
|
|
61
61
|
is quarantined as `outcome_unknown` and is never blindly repeated. A different
|
|
62
62
|
adapter cannot replace an installed Codex instance; it needs a distinct instance
|
|
63
|
-
and VTX grant.
|
|
63
|
+
and VTX grant. VTX resolves the package-owned pinned Copilot platform runtime
|
|
64
|
+
explicitly and rejects an `auto`-only catalog because it cannot prove the
|
|
65
|
+
effective model.
|
|
64
66
|
|
|
65
67
|
Before the first Codex login, enable **Device code authorization for Codex** in
|
|
66
68
|
ChatGPT Security settings. Only enter a device code from a login you initiated,
|
|
@@ -200,7 +202,8 @@ Use `not_dispatched` only when no harness inference began,
|
|
|
200
202
|
`outcome_unknown` when dispatch itself cannot be confirmed. Pipe exactly one
|
|
201
203
|
object to `vtx inference-host agent-fail --json`.
|
|
202
204
|
|
|
203
|
-
Claude Code, Kiro, Grok Build, Cursor, Amp, Auggie,
|
|
205
|
+
Claude Code, Antigravity, Gemini CLI, Kiro, Grok Build, Cursor, Amp, Auggie,
|
|
206
|
+
Junie, Warp/Oz, Qwen Code, and OpenCode remain on
|
|
204
207
|
the explicit foreground agent loop. Their current subscription routing,
|
|
205
208
|
effective-model identity, schema, usage, or crash-recovery contracts do not yet
|
|
206
209
|
meet every durable VTX acceptance fence. The public Insights matrix records the
|
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.
|
|
41
|
+
package_version: "2026.8.44",
|
|
42
42
|
codex_package_name: "@openai/codex",
|
|
43
43
|
codex_version: "0.147.0",
|
|
44
44
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -16196,7 +16196,7 @@ import { spawn } from "node:child_process";
|
|
|
16196
16196
|
import { constants } from "node:fs";
|
|
16197
16197
|
import { lstat, mkdir, open, readFile, realpath, rename, rm } from "node:fs/promises";
|
|
16198
16198
|
import { homedir } from "node:os";
|
|
16199
|
-
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
16199
|
+
import { dirname, isAbsolute, join, relative, resolve, win32 as windowsPath } from "node:path";
|
|
16200
16200
|
function inferenceBaseDir(env) {
|
|
16201
16201
|
const configured = String(env.VTX_INFERENCE_HOST_HOME || "").trim();
|
|
16202
16202
|
return configured || join(homedir(), ".vtx", "inference-host");
|
|
@@ -16737,7 +16737,7 @@ async function acquireInferenceHostProcessLock(path, dependencies = {}) {
|
|
|
16737
16737
|
}
|
|
16738
16738
|
};
|
|
16739
16739
|
}
|
|
16740
|
-
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, inferenceHostCredentialContextPath, inferenceHostCredentialContextTransitionPath, credentialContextForConfig;
|
|
16740
|
+
var INFERENCE_CREDENTIAL_NAMESPACE, MAX_INFERENCE_PRIVATE_FILE_BYTES, WINDOWS_PRIVATE_ACL_BROKER_SCRIPT, WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS, WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS, SMALL_IDENTITY_COMMAND_TIMEOUT_MS, windowsPowerShellEnvironment, windowsPrivateAclBrokerInvocation, WindowsPrivateAclBroker, defaultWindowsPrivateAclBroker, runWindowsPrivateAcl, windowsAclCache, windowsAclIdentity, aclCacheKey, secureWindowsPrivatePath, invalidateWindowsAclCache, rebindHardenedWindowsAclAfterRename, rebindHardenedWindowsDirectoryAfterOwnedMutation, isDefaultWindowsPrivatePath, secureExistingWindowsPath, linuxProcessIdentity, windowsProcessIdentityInvocation, windowsBootIdentityInvocation, windowsProcessIdentity, darwinProcessIdentity, runSmallIdentityCommand, cachedSystemBootIdentity, readInferenceSystemBootIdentity, defaultProcessIdentity, defaultCurrentProcessIdentity, processLockObservationCache, inferenceProcessIdentitiesMatch, DEFAULT_INFERENCE_HOST_INSTANCE, SAFE_INFERENCE_HOST_INSTANCE, requireNamedInstancePath, credentialStoreIdentity, inferenceHostCredentialContextPath, inferenceHostCredentialContextTransitionPath, credentialContextForConfig;
|
|
16741
16741
|
var init_config = __esm({
|
|
16742
16742
|
"lib/inference-host/config.ts"() {
|
|
16743
16743
|
"use strict";
|
|
@@ -16747,6 +16747,7 @@ var init_config = __esm({
|
|
|
16747
16747
|
$ProgressPreference='SilentlyContinue'
|
|
16748
16748
|
while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
16749
16749
|
$requestId=$null
|
|
16750
|
+
$failureStage='request_validation'
|
|
16750
16751
|
try {
|
|
16751
16752
|
if($line.Length -lt 2 -or $line.Length -gt 65536) { throw 'invalid request size' }
|
|
16752
16753
|
$request=$line | ConvertFrom-Json
|
|
@@ -16761,18 +16762,25 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16761
16762
|
if($mode -ne 'harden' -and $mode -ne 'verify' -and $mode -ne 'verify-owner') { throw 'invalid ACL mode' }
|
|
16762
16763
|
$path=[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String([string]$request.path_b64))
|
|
16763
16764
|
if([string]::IsNullOrWhiteSpace($path) -or $path.Length -gt 32767 -or $path.Contains([char]0)) { throw 'invalid path' }
|
|
16765
|
+
$failureStage='path_lookup'
|
|
16764
16766
|
if(-not (Test-Path -LiteralPath $path)) {
|
|
16765
16767
|
[Console]::Out.WriteLine((@{id=$requestId;status='missing'} | ConvertTo-Json -Compress))
|
|
16766
16768
|
continue
|
|
16767
16769
|
}
|
|
16768
|
-
$
|
|
16770
|
+
$failureStage='principal_resolution'
|
|
16771
|
+
$currentIdentity=[Security.Principal.WindowsIdentity]::GetCurrent()
|
|
16772
|
+
$current=$currentIdentity.User
|
|
16769
16773
|
$system=New-Object Security.Principal.SecurityIdentifier('S-1-5-18')
|
|
16770
16774
|
$admins=New-Object Security.Principal.SecurityIdentifier('S-1-5-32-544')
|
|
16775
|
+
$currentIsAdmin=(New-Object Security.Principal.WindowsPrincipal($currentIdentity)).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
|
16771
16776
|
$allowed=@($current.Value,$system.Value,$admins.Value)
|
|
16772
16777
|
if($mode -eq 'harden') {
|
|
16778
|
+
$failureStage='acl_read'
|
|
16773
16779
|
$acl=Get-Acl -LiteralPath $path
|
|
16780
|
+
$failureStage='owner_validation'
|
|
16774
16781
|
$existingOwner=(New-Object Security.Principal.NTAccount($acl.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
|
|
16775
|
-
if($existingOwner -ne $current.Value) { throw 'private ACL owner is invalid' }
|
|
16782
|
+
if($existingOwner -ne $current.Value -and ($existingOwner -ne $admins.Value -or -not $currentIsAdmin)) { throw 'private ACL owner is invalid' }
|
|
16783
|
+
$failureStage='acl_mutation'
|
|
16776
16784
|
$acl.SetAccessRuleProtection($true,$false)
|
|
16777
16785
|
foreach($existingRule in @($acl.Access)) { [void]$acl.RemoveAccessRuleSpecific($existingRule) }
|
|
16778
16786
|
$inherit=if($kind -eq 'directory') {
|
|
@@ -16788,11 +16796,14 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16788
16796
|
)
|
|
16789
16797
|
[void]$acl.AddAccessRule($rule)
|
|
16790
16798
|
}
|
|
16799
|
+
$failureStage='acl_write'
|
|
16791
16800
|
(Get-Item -LiteralPath $path).SetAccessControl($acl)
|
|
16792
16801
|
}
|
|
16802
|
+
$failureStage='acl_readback'
|
|
16793
16803
|
$actual=Get-Acl -LiteralPath $path
|
|
16804
|
+
$failureStage='acl_verification'
|
|
16794
16805
|
$owner=(New-Object Security.Principal.NTAccount($actual.Owner)).Translate([Security.Principal.SecurityIdentifier]).Value
|
|
16795
|
-
if($owner -ne $current.Value) { throw 'private ACL owner is invalid' }
|
|
16806
|
+
if($owner -ne $current.Value -and ($owner -ne $admins.Value -or -not $currentIsAdmin)) { throw 'private ACL owner is invalid' }
|
|
16796
16807
|
if($mode -ne 'verify-owner') {
|
|
16797
16808
|
if(-not $actual.AreAccessRulesProtected) { throw 'private ACL inheritance is invalid' }
|
|
16798
16809
|
$userFull=$false
|
|
@@ -16807,9 +16818,28 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16807
16818
|
}
|
|
16808
16819
|
[Console]::Out.WriteLine((@{id=$requestId;status='ok'} | ConvertTo-Json -Compress))
|
|
16809
16820
|
} catch {
|
|
16810
|
-
[Console]::Out.WriteLine((@{id=$requestId;status='error'} | ConvertTo-Json -Compress))
|
|
16821
|
+
[Console]::Out.WriteLine((@{id=$requestId;status='error';error_code=$failureStage} | ConvertTo-Json -Compress))
|
|
16811
16822
|
}
|
|
16812
16823
|
}`;
|
|
16824
|
+
WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS = 15e3;
|
|
16825
|
+
WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS = 45e3;
|
|
16826
|
+
SMALL_IDENTITY_COMMAND_TIMEOUT_MS = 5e3;
|
|
16827
|
+
windowsPowerShellEnvironment = (extra = {}) => {
|
|
16828
|
+
const sanitizedExtra = { ...extra };
|
|
16829
|
+
delete sanitizedExtra.PSModulePath;
|
|
16830
|
+
const windowsRoot = process.env.SystemRoot ?? process.env.WINDIR;
|
|
16831
|
+
return {
|
|
16832
|
+
...sanitizedExtra,
|
|
16833
|
+
NODE_ENV: process.env.NODE_ENV,
|
|
16834
|
+
SystemRoot: process.env.SystemRoot,
|
|
16835
|
+
WINDIR: process.env.WINDIR,
|
|
16836
|
+
ComSpec: process.env.ComSpec,
|
|
16837
|
+
PATHEXT: process.env.PATHEXT,
|
|
16838
|
+
PSModulePath: windowsRoot ? windowsPath.join(windowsRoot, "System32", "WindowsPowerShell", "v1.0", "Modules") : void 0,
|
|
16839
|
+
TEMP: process.env.TEMP,
|
|
16840
|
+
TMP: process.env.TMP
|
|
16841
|
+
};
|
|
16842
|
+
};
|
|
16813
16843
|
windowsPrivateAclBrokerInvocation = () => ({
|
|
16814
16844
|
args: [
|
|
16815
16845
|
"-NoLogo",
|
|
@@ -16818,16 +16848,7 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16818
16848
|
"-EncodedCommand",
|
|
16819
16849
|
Buffer.from(WINDOWS_PRIVATE_ACL_BROKER_SCRIPT, "utf16le").toString("base64")
|
|
16820
16850
|
],
|
|
16821
|
-
env:
|
|
16822
|
-
NODE_ENV: process.env.NODE_ENV,
|
|
16823
|
-
SystemRoot: process.env.SystemRoot,
|
|
16824
|
-
WINDIR: process.env.WINDIR,
|
|
16825
|
-
ComSpec: process.env.ComSpec,
|
|
16826
|
-
PATHEXT: process.env.PATHEXT,
|
|
16827
|
-
PSModulePath: process.env.PSModulePath,
|
|
16828
|
-
TEMP: process.env.TEMP,
|
|
16829
|
-
TMP: process.env.TMP
|
|
16830
|
-
}
|
|
16851
|
+
env: windowsPowerShellEnvironment()
|
|
16831
16852
|
});
|
|
16832
16853
|
WindowsPrivateAclBroker = class {
|
|
16833
16854
|
constructor(dependencies = {}) {
|
|
@@ -16846,6 +16867,7 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16846
16867
|
await operation;
|
|
16847
16868
|
};
|
|
16848
16869
|
this.requestTimeoutMs = dependencies.requestTimeoutMs ?? 15e3;
|
|
16870
|
+
this.startupRequestTimeoutMs = dependencies.startupRequestTimeoutMs ?? WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS;
|
|
16849
16871
|
this.idleShutdownMs = dependencies.idleShutdownMs ?? 3e4;
|
|
16850
16872
|
this.spawnProcess = dependencies.spawnProcess ?? (() => {
|
|
16851
16873
|
const invocation = windowsPrivateAclBrokerInvocation();
|
|
@@ -16896,7 +16918,19 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16896
16918
|
let response;
|
|
16897
16919
|
try {
|
|
16898
16920
|
const parsed = JSON.parse(line);
|
|
16899
|
-
|
|
16921
|
+
const status = String(parsed.status);
|
|
16922
|
+
const expectedKeys = status === "error" ? "error_code\0id\0status" : "id\0status";
|
|
16923
|
+
if (Object.keys(parsed).sort().join("\0") !== expectedKeys || parsed.id !== pending.id || !["ok", "missing", "error"].includes(status) || status === "error" && ![
|
|
16924
|
+
"request_validation",
|
|
16925
|
+
"path_lookup",
|
|
16926
|
+
"principal_resolution",
|
|
16927
|
+
"acl_read",
|
|
16928
|
+
"owner_validation",
|
|
16929
|
+
"acl_mutation",
|
|
16930
|
+
"acl_write",
|
|
16931
|
+
"acl_readback",
|
|
16932
|
+
"acl_verification"
|
|
16933
|
+
].includes(String(parsed.error_code))) throw new Error("invalid response");
|
|
16900
16934
|
response = parsed;
|
|
16901
16935
|
} catch {
|
|
16902
16936
|
this.failChild(child, new Error("Windows private ACL broker returned malformed output."));
|
|
@@ -16911,12 +16945,16 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16911
16945
|
error48.code = "ENOENT";
|
|
16912
16946
|
pending.reject(error48);
|
|
16913
16947
|
} else {
|
|
16914
|
-
pending.reject(new Error(
|
|
16948
|
+
pending.reject(new Error(
|
|
16949
|
+
`Windows private ACL ${pending.mode} failed (${response.error_code}).`
|
|
16950
|
+
));
|
|
16915
16951
|
}
|
|
16916
16952
|
this.scheduleIdleShutdown();
|
|
16917
16953
|
}
|
|
16918
16954
|
ensureChild() {
|
|
16919
|
-
if (this.child && this.child.exitCode === null && !this.child.killed)
|
|
16955
|
+
if (this.child && this.child.exitCode === null && !this.child.killed) {
|
|
16956
|
+
return { child: this.child, startedNow: false };
|
|
16957
|
+
}
|
|
16920
16958
|
const child = this.spawnProcess();
|
|
16921
16959
|
this.child = child;
|
|
16922
16960
|
this.outputBuffer = "";
|
|
@@ -16947,7 +16985,7 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16947
16985
|
for (const stream of [child.stdin, child.stdout, child.stderr]) {
|
|
16948
16986
|
stream.unref?.();
|
|
16949
16987
|
}
|
|
16950
|
-
return child;
|
|
16988
|
+
return { child, startedNow: true };
|
|
16951
16989
|
}
|
|
16952
16990
|
async dispatch(path, kind, mode) {
|
|
16953
16991
|
if (this.idleTimer) {
|
|
@@ -16965,11 +17003,12 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16965
17003
|
if (Buffer.byteLength(request, "utf8") > 65536) {
|
|
16966
17004
|
throw new Error("Windows private ACL broker request exceeds its input limit.");
|
|
16967
17005
|
}
|
|
16968
|
-
const child = this.ensureChild();
|
|
17006
|
+
const { child, startedNow } = this.ensureChild();
|
|
17007
|
+
const timeoutMs = startedNow ? this.startupRequestTimeoutMs : this.requestTimeoutMs;
|
|
16969
17008
|
await new Promise((resolvePromise, reject) => {
|
|
16970
17009
|
const timer = setTimeout(() => {
|
|
16971
17010
|
this.failChild(child, new Error("Windows private ACL broker request timed out."));
|
|
16972
|
-
},
|
|
17011
|
+
}, timeoutMs);
|
|
16973
17012
|
this.pending = { id: id2, mode, resolve: resolvePromise, reject, timer };
|
|
16974
17013
|
child.stdin.write(request, "utf8", (error48) => {
|
|
16975
17014
|
if (error48) {
|
|
@@ -17072,26 +17111,40 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
17072
17111
|
return null;
|
|
17073
17112
|
}
|
|
17074
17113
|
};
|
|
17114
|
+
windowsProcessIdentityInvocation = (pid) => {
|
|
17115
|
+
const script = `$ErrorActionPreference='Stop';$p=[Diagnostics.Process]::GetProcessById([int]$env:VTX_PROCESS_PID);[Console]::Out.Write($p.StartTime.ToUniversalTime().ToFileTimeUtc())`;
|
|
17116
|
+
return {
|
|
17117
|
+
args: [
|
|
17118
|
+
"-NoLogo",
|
|
17119
|
+
"-NoProfile",
|
|
17120
|
+
"-NonInteractive",
|
|
17121
|
+
"-EncodedCommand",
|
|
17122
|
+
Buffer.from(script, "utf16le").toString("base64")
|
|
17123
|
+
],
|
|
17124
|
+
env: windowsPowerShellEnvironment({ VTX_PROCESS_PID: String(pid) }),
|
|
17125
|
+
timeoutMs: WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS
|
|
17126
|
+
};
|
|
17127
|
+
};
|
|
17128
|
+
windowsBootIdentityInvocation = () => {
|
|
17129
|
+
const script = `$ErrorActionPreference='Stop';$s=[System.Management.ManagementObjectSearcher]::new('SELECT LastBootUpTime FROM Win32_OperatingSystem');try{$c=$s.Get();$e=$c.GetEnumerator();if(-not $e.MoveNext()){throw 'boot identity unavailable'};$raw=[string]$e.Current['LastBootUpTime'];$v=[System.Management.ManagementDateTimeConverter]::ToDateTime($raw).ToUniversalTime().ToFileTimeUtc();[Console]::Out.Write($v)}finally{if($c){$c.Dispose()};$s.Dispose()}`;
|
|
17130
|
+
return {
|
|
17131
|
+
args: [
|
|
17132
|
+
"-NoLogo",
|
|
17133
|
+
"-NoProfile",
|
|
17134
|
+
"-NonInteractive",
|
|
17135
|
+
"-EncodedCommand",
|
|
17136
|
+
Buffer.from(script, "utf16le").toString("base64")
|
|
17137
|
+
],
|
|
17138
|
+
env: windowsPowerShellEnvironment(),
|
|
17139
|
+
timeoutMs: WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS
|
|
17140
|
+
};
|
|
17141
|
+
};
|
|
17075
17142
|
windowsProcessIdentity = async (pid) => await new Promise((resolvePromise) => {
|
|
17076
|
-
const
|
|
17077
|
-
const child = spawn("powershell.exe", [
|
|
17078
|
-
"-NoLogo",
|
|
17079
|
-
"-NoProfile",
|
|
17080
|
-
"-NonInteractive",
|
|
17081
|
-
"-EncodedCommand",
|
|
17082
|
-
Buffer.from(script, "utf16le").toString("base64")
|
|
17083
|
-
], {
|
|
17143
|
+
const invocation = windowsProcessIdentityInvocation(pid);
|
|
17144
|
+
const child = spawn("powershell.exe", [...invocation.args], {
|
|
17084
17145
|
windowsHide: true,
|
|
17085
17146
|
stdio: ["ignore", "pipe", "ignore"],
|
|
17086
|
-
env:
|
|
17087
|
-
NODE_ENV: process.env.NODE_ENV,
|
|
17088
|
-
SystemRoot: process.env.SystemRoot,
|
|
17089
|
-
WINDIR: process.env.WINDIR,
|
|
17090
|
-
ComSpec: process.env.ComSpec,
|
|
17091
|
-
PATHEXT: process.env.PATHEXT,
|
|
17092
|
-
PSModulePath: process.env.PSModulePath,
|
|
17093
|
-
VTX_PROCESS_PID: String(pid)
|
|
17094
|
-
}
|
|
17147
|
+
env: invocation.env
|
|
17095
17148
|
});
|
|
17096
17149
|
const output3 = [];
|
|
17097
17150
|
let settled = false;
|
|
@@ -17104,7 +17157,7 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
17104
17157
|
const timer = setTimeout(() => {
|
|
17105
17158
|
child.kill("SIGKILL");
|
|
17106
17159
|
settle(null);
|
|
17107
|
-
},
|
|
17160
|
+
}, invocation.timeoutMs);
|
|
17108
17161
|
child.stdout.on("data", (chunk) => {
|
|
17109
17162
|
if (output3.reduce((total, item) => total + item.byteLength, 0) + Buffer.byteLength(chunk) > 1024) {
|
|
17110
17163
|
child.kill("SIGKILL");
|
|
@@ -17142,7 +17195,7 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
17142
17195
|
settle(code === 0 && Number.isFinite(started) ? `darwin:${Math.floor(started / 1e3)}` : null);
|
|
17143
17196
|
});
|
|
17144
17197
|
});
|
|
17145
|
-
runSmallIdentityCommand = async (command, args, env) => await new Promise((resolvePromise) => {
|
|
17198
|
+
runSmallIdentityCommand = async (command, args, env, timeoutMs = SMALL_IDENTITY_COMMAND_TIMEOUT_MS) => await new Promise((resolvePromise) => {
|
|
17146
17199
|
const child = spawn(command, [...args], {
|
|
17147
17200
|
windowsHide: true,
|
|
17148
17201
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -17160,7 +17213,7 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
17160
17213
|
const timer = setTimeout(() => {
|
|
17161
17214
|
child.kill("SIGKILL");
|
|
17162
17215
|
settle(null);
|
|
17163
|
-
},
|
|
17216
|
+
}, timeoutMs);
|
|
17164
17217
|
child.stdout.on("data", (chunk) => {
|
|
17165
17218
|
bytes3 += Buffer.byteLength(chunk);
|
|
17166
17219
|
if (bytes3 > 4096) {
|
|
@@ -17189,21 +17242,13 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
17189
17242
|
identity = null;
|
|
17190
17243
|
}
|
|
17191
17244
|
} else if (platform === "win32") {
|
|
17192
|
-
const
|
|
17193
|
-
identity = await runSmallIdentityCommand(
|
|
17194
|
-
"
|
|
17195
|
-
|
|
17196
|
-
|
|
17197
|
-
|
|
17198
|
-
|
|
17199
|
-
], {
|
|
17200
|
-
NODE_ENV: process.env.NODE_ENV,
|
|
17201
|
-
SystemRoot: process.env.SystemRoot,
|
|
17202
|
-
WINDIR: process.env.WINDIR,
|
|
17203
|
-
ComSpec: process.env.ComSpec,
|
|
17204
|
-
PATHEXT: process.env.PATHEXT,
|
|
17205
|
-
PSModulePath: process.env.PSModulePath
|
|
17206
|
-
});
|
|
17245
|
+
const invocation = windowsBootIdentityInvocation();
|
|
17246
|
+
identity = await runSmallIdentityCommand(
|
|
17247
|
+
"powershell.exe",
|
|
17248
|
+
invocation.args,
|
|
17249
|
+
invocation.env,
|
|
17250
|
+
invocation.timeoutMs
|
|
17251
|
+
);
|
|
17207
17252
|
} else if (platform === "darwin") {
|
|
17208
17253
|
identity = await runSmallIdentityCommand("sysctl", ["-n", "kern.boottime"], void 0);
|
|
17209
17254
|
}
|
|
@@ -22788,16 +22833,44 @@ $items = @(Get-CimInstance Win32_Process | Where-Object { $_.Name -in @('node.ex
|
|
|
22788
22833
|
|
|
22789
22834
|
// lib/inference-host/copilot-adapter.ts
|
|
22790
22835
|
import { mkdtemp as mkdtemp2, rm as rm4 } from "node:fs/promises";
|
|
22836
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
22791
22837
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
22792
22838
|
import { join as join5 } from "node:path";
|
|
22793
|
-
import {
|
|
22794
|
-
|
|
22839
|
+
import {
|
|
22840
|
+
CopilotClient,
|
|
22841
|
+
RuntimeConnection
|
|
22842
|
+
} from "@github/copilot-sdk";
|
|
22843
|
+
var COPILOT_SDK_VERSION, MAX_RESULT_BYTES, resolveRuntimePackage, copilotRuntimePackageCandidates, resolvePinnedCopilotCliPath, createPrivateWorkspace, cleanCopilotEnvironment, defaultClient, modelCapabilities, requiredUsageInteger, optionalUsageInteger, CopilotSubscriptionAdapter;
|
|
22795
22844
|
var init_copilot_adapter = __esm({
|
|
22796
22845
|
"lib/inference-host/copilot-adapter.ts"() {
|
|
22797
22846
|
"use strict";
|
|
22798
22847
|
init_codex_app_server();
|
|
22799
22848
|
COPILOT_SDK_VERSION = "1.0.0-beta.8";
|
|
22800
22849
|
MAX_RESULT_BYTES = 3e5;
|
|
22850
|
+
resolveRuntimePackage = createRequire2(import.meta.url).resolve;
|
|
22851
|
+
copilotRuntimePackageCandidates = () => {
|
|
22852
|
+
if (process.arch !== "x64") {
|
|
22853
|
+
throw new Error(`copilot_runtime_platform_unsupported:${process.platform}-${process.arch}`);
|
|
22854
|
+
}
|
|
22855
|
+
if (process.platform === "win32") return ["@github/copilot-win32-x64"];
|
|
22856
|
+
if (process.platform === "linux") {
|
|
22857
|
+
const report = process.report?.getReport();
|
|
22858
|
+
const glibcVersion = report?.header?.glibcVersionRuntime;
|
|
22859
|
+
return glibcVersion ? ["@github/copilot-linux-x64", "@github/copilot-linuxmusl-x64"] : ["@github/copilot-linuxmusl-x64", "@github/copilot-linux-x64"];
|
|
22860
|
+
}
|
|
22861
|
+
throw new Error(`copilot_runtime_platform_unsupported:${process.platform}-${process.arch}`);
|
|
22862
|
+
};
|
|
22863
|
+
resolvePinnedCopilotCliPath = () => {
|
|
22864
|
+
const failures = [];
|
|
22865
|
+
for (const packageName of copilotRuntimePackageCandidates()) {
|
|
22866
|
+
try {
|
|
22867
|
+
return resolveRuntimePackage(packageName);
|
|
22868
|
+
} catch (error48) {
|
|
22869
|
+
failures.push(error48 instanceof Error ? error48.message : String(error48));
|
|
22870
|
+
}
|
|
22871
|
+
}
|
|
22872
|
+
throw new Error(`copilot_runtime_package_missing:${failures.join(";")}`);
|
|
22873
|
+
};
|
|
22801
22874
|
createPrivateWorkspace = async () => {
|
|
22802
22875
|
const path = await mkdtemp2(join5(tmpdir3(), "vtx-copilot-"));
|
|
22803
22876
|
return {
|
|
@@ -22824,13 +22897,14 @@ var init_copilot_adapter = __esm({
|
|
|
22824
22897
|
return environment;
|
|
22825
22898
|
};
|
|
22826
22899
|
defaultClient = (workingDirectory) => new CopilotClient({
|
|
22900
|
+
connection: RuntimeConnection.forStdio({ path: resolvePinnedCopilotCliPath() }),
|
|
22827
22901
|
workingDirectory,
|
|
22828
22902
|
env: cleanCopilotEnvironment(),
|
|
22829
22903
|
useLoggedInUser: true,
|
|
22830
22904
|
logLevel: "error"
|
|
22831
22905
|
});
|
|
22832
22906
|
modelCapabilities = (models) => {
|
|
22833
|
-
const capabilities = models.filter((model) => model.policy?.state !== "disabled" && model.policy?.state !== "unconfigured").flatMap((model) => {
|
|
22907
|
+
const capabilities = models.filter((model) => model.id !== "auto" && model.id.trim() !== "" && model.policy?.state !== "disabled" && model.policy?.state !== "unconfigured").flatMap((model) => {
|
|
22834
22908
|
const efforts = model.capabilities.supports.reasoningEffort ? [...model.supportedReasoningEfforts ?? []] : ["none"];
|
|
22835
22909
|
if (efforts.length === 0) return [];
|
|
22836
22910
|
const defaultEffort = model.defaultReasoningEffort && efforts.includes(model.defaultReasoningEffort) ? model.defaultReasoningEffort : efforts[0];
|
|
@@ -29688,7 +29762,7 @@ function createDefaultInferenceHostRunnerDependencies(options) {
|
|
|
29688
29762
|
envelopePublicKey: options.envelopePublicKey
|
|
29689
29763
|
};
|
|
29690
29764
|
}
|
|
29691
|
-
var import_ajv, RUNTIME_RECEIPT_SCHEMA_VERSION, ATTEMPT_RECEIPT_SCHEMA_VERSION, DEFAULT_ADVERTISEMENT_TTL_MS, DEFAULT_ADVERTISEMENT_REFRESH_LEAD_MS, DEFAULT_HOST_HEARTBEAT_MS, DEFAULT_PROVIDER_RATE_LIMIT_REFRESH_MS, DEFAULT_ATTEMPT_HEARTBEAT_MS, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_REMOTE_RETRY_LIMIT, MIN_SLEEP_MS, DEFAULT_CODEX_ACCOUNT_COOLDOWN_MS, MIN_CLAIM_START_WINDOW_MS, UNBOUNDED_AVAILABLE_SLOTS, buildInferenceAdvertisedModels, summarizeInferenceHostRuntimeRecovery, FileInferenceHostRuntimeReceiptStore, InferenceHostRecoveryRequiredError, InferenceHostRunnerError, defaultSleep, abortError, defaultRegisterSignalHandlers, safeInteger, exactObjectKeys, validIso, validateAttemptReceipt, validateRuntimeReceipt, sha256, stableOperationId, buildAttemptStartRequest, isoAt, providerWeeklyQuotaFromRateLimits, finitePositiveOption, validateRunnerOptions, assertLocalCredentialIdentity, retryableRemoteError, remoteRetryAfterMs, controlPlaneFatal, defaultValidateOutput, objectRecord, positiveUtf8ByteLimit, assertCompilableOutputSchema, parseOutputContract, membershipFailureDisposition, safeFailureCode, exactJson2, runnerIdentityMismatch, assertAdvertisementResult, assertHostHeartbeatResult, assertClaimResult, assertStartResult, assertJobHeartbeatResult, assertTerminalResult, classifyFailure, ambiguousHeartbeatTransport, reportedTokenUsage, reportedUsage, InferenceHostRunner;
|
|
29765
|
+
var import_ajv, RUNTIME_RECEIPT_SCHEMA_VERSION, ATTEMPT_RECEIPT_SCHEMA_VERSION, DEFAULT_ADVERTISEMENT_TTL_MS, DEFAULT_ADVERTISEMENT_REFRESH_LEAD_MS, DEFAULT_HOST_HEARTBEAT_MS, DEFAULT_PROVIDER_RATE_LIMIT_REFRESH_MS, DEFAULT_ATTEMPT_HEARTBEAT_MS, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_REMOTE_RETRY_LIMIT, MIN_SLEEP_MS, DEFAULT_CODEX_ACCOUNT_COOLDOWN_MS, MIN_CLAIM_START_WINDOW_MS, MAX_ATTEMPT_START_RETRY_DELAY_MS, UNBOUNDED_AVAILABLE_SLOTS, buildInferenceAdvertisedModels, summarizeInferenceHostRuntimeRecovery, FileInferenceHostRuntimeReceiptStore, InferenceHostRecoveryRequiredError, InferenceHostRunnerError, defaultSleep, abortError, defaultRegisterSignalHandlers, safeInteger, exactObjectKeys, validIso, validateAttemptReceipt, validateRuntimeReceipt, sha256, stableOperationId, buildAttemptStartRequest, isoAt, providerWeeklyQuotaFromRateLimits, finitePositiveOption, validateRunnerOptions, assertLocalCredentialIdentity, retryableRemoteError, remoteRetryAfterMs, controlPlaneFatal, defaultValidateOutput, objectRecord, positiveUtf8ByteLimit, assertCompilableOutputSchema, parseOutputContract, membershipFailureDisposition, safeFailureCode, attemptStartRetryFallbackMs, exactJson2, runnerIdentityMismatch, assertAdvertisementResult, assertHostHeartbeatResult, assertClaimResult, assertStartResult, assertJobHeartbeatResult, assertTerminalResult, classifyFailure, ambiguousHeartbeatTransport, reportedTokenUsage, reportedUsage, InferenceHostRunner;
|
|
29692
29766
|
var init_runner = __esm({
|
|
29693
29767
|
"lib/inference-host/runner.ts"() {
|
|
29694
29768
|
"use strict";
|
|
@@ -29712,6 +29786,7 @@ var init_runner = __esm({
|
|
|
29712
29786
|
MIN_SLEEP_MS = 10;
|
|
29713
29787
|
DEFAULT_CODEX_ACCOUNT_COOLDOWN_MS = 5 * 60 * 1e3;
|
|
29714
29788
|
MIN_CLAIM_START_WINDOW_MS = 5e3;
|
|
29789
|
+
MAX_ATTEMPT_START_RETRY_DELAY_MS = 15e3;
|
|
29715
29790
|
UNBOUNDED_AVAILABLE_SLOTS = Number.MAX_SAFE_INTEGER;
|
|
29716
29791
|
buildInferenceAdvertisedModels = (capabilities, adapterRuntimeVersion, adapter = "codex", structuredOutput = true, sameAttemptRecovery = adapter === "codex") => {
|
|
29717
29792
|
const visible = capabilities.filter((capability) => !capability.hidden);
|
|
@@ -30247,6 +30322,10 @@ var init_runner = __esm({
|
|
|
30247
30322
|
const normalized = value.trim().toLowerCase().replace(/[^a-z0-9._-]+/gu, "_").slice(0, 96);
|
|
30248
30323
|
return /^[a-z0-9]/u.test(normalized) ? normalized : fallback;
|
|
30249
30324
|
};
|
|
30325
|
+
attemptStartRetryFallbackMs = (retryCount) => Math.min(
|
|
30326
|
+
1e3 * 2 ** Math.min(Math.max(0, retryCount - 1), 4),
|
|
30327
|
+
MAX_ATTEMPT_START_RETRY_DELAY_MS
|
|
30328
|
+
);
|
|
30250
30329
|
exactJson2 = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
30251
30330
|
runnerIdentityMismatch = (operation) => {
|
|
30252
30331
|
throw new InferenceHostRunnerError(
|
|
@@ -30707,6 +30786,7 @@ var init_runner = __esm({
|
|
|
30707
30786
|
let pendingClaimPromotions = 0;
|
|
30708
30787
|
let onceClaimed = false;
|
|
30709
30788
|
const recoveryQueue = [];
|
|
30789
|
+
const attemptStartRetryCounts = /* @__PURE__ */ new Map();
|
|
30710
30790
|
const launchClaim = (claim, recovery, claimRequest) => {
|
|
30711
30791
|
if (!recovery) {
|
|
30712
30792
|
claimed += 1;
|
|
@@ -30719,6 +30799,10 @@ var init_runner = __esm({
|
|
|
30719
30799
|
claim.attempt_index,
|
|
30720
30800
|
claim.input_sha256
|
|
30721
30801
|
]);
|
|
30802
|
+
const nextStartRetryCount = Math.min(
|
|
30803
|
+
(attemptStartRetryCounts.get(attemptId) ?? 0) + 1,
|
|
30804
|
+
Number.MAX_SAFE_INTEGER
|
|
30805
|
+
);
|
|
30722
30806
|
const controller = new AbortController();
|
|
30723
30807
|
attemptControllers.set(attemptId, controller);
|
|
30724
30808
|
let claimPromotionSettled = claimRequest === void 0;
|
|
@@ -30783,13 +30867,27 @@ var init_runner = __esm({
|
|
|
30783
30867
|
active_attempts: active.size
|
|
30784
30868
|
});
|
|
30785
30869
|
},
|
|
30870
|
+
startRetryCount: nextStartRetryCount,
|
|
30871
|
+
onAttemptStartRetry: (observation) => {
|
|
30872
|
+
attemptStartRetryCounts.set(attemptId, observation.retry_count);
|
|
30873
|
+
emitDiagnostic("attempt_start_retry_scheduled", {
|
|
30874
|
+
...observation,
|
|
30875
|
+
job_id: claim.job_id,
|
|
30876
|
+
attempt_id: attemptId,
|
|
30877
|
+
active_attempts: active.size
|
|
30878
|
+
});
|
|
30879
|
+
},
|
|
30786
30880
|
resumeReceipt: recovery,
|
|
30787
30881
|
claimRequest,
|
|
30788
30882
|
onClaimPersisted: settleClaimPromotion
|
|
30789
30883
|
}).then((outcome) => {
|
|
30790
|
-
if (outcome === "completed")
|
|
30791
|
-
|
|
30792
|
-
|
|
30884
|
+
if (outcome === "completed") {
|
|
30885
|
+
attemptStartRetryCounts.delete(attemptId);
|
|
30886
|
+
completed += 1;
|
|
30887
|
+
} else if (outcome === "failed") {
|
|
30888
|
+
attemptStartRetryCounts.delete(attemptId);
|
|
30889
|
+
failed += 1;
|
|
30890
|
+
} else {
|
|
30793
30891
|
const recovery2 = receipt.attempts[attemptId];
|
|
30794
30892
|
if (recovery2?.phase !== "claimed") {
|
|
30795
30893
|
throw new InferenceHostRecoveryRequiredError(
|
|
@@ -30799,6 +30897,7 @@ var init_runner = __esm({
|
|
|
30799
30897
|
retryRecovery = recovery2;
|
|
30800
30898
|
}
|
|
30801
30899
|
}).catch((error48) => {
|
|
30900
|
+
attemptStartRetryCounts.delete(attemptId);
|
|
30802
30901
|
failed += 1;
|
|
30803
30902
|
const recovery2 = receipt.attempts[attemptId];
|
|
30804
30903
|
if (recovery2?.phase === "terminal_pending") {
|
|
@@ -30811,22 +30910,19 @@ var init_runner = __esm({
|
|
|
30811
30910
|
attemptControllers.delete(attemptId);
|
|
30812
30911
|
if (retryRecovery) {
|
|
30813
30912
|
recoveryQueue.push(retryRecovery);
|
|
30814
|
-
emitDiagnostic("attempt_start_retry_scheduled", {
|
|
30815
|
-
job_id: claim.job_id,
|
|
30816
|
-
attempt_id: attemptId,
|
|
30817
|
-
active_attempts: active.size
|
|
30818
|
-
});
|
|
30819
30913
|
}
|
|
30820
30914
|
});
|
|
30821
30915
|
active.set(attemptId, promise2);
|
|
30822
|
-
|
|
30823
|
-
|
|
30824
|
-
|
|
30825
|
-
|
|
30826
|
-
|
|
30827
|
-
|
|
30828
|
-
|
|
30829
|
-
|
|
30916
|
+
if (!recovery) {
|
|
30917
|
+
emitDiagnostic("attempt_started", {
|
|
30918
|
+
job_id: claim.job_id,
|
|
30919
|
+
attempt_id: attemptId,
|
|
30920
|
+
attempt_index: claim.attempt_index,
|
|
30921
|
+
requested_model: claim.requested_model,
|
|
30922
|
+
requested_reasoning_effort: claim.requested_reasoning_effort,
|
|
30923
|
+
active_attempts: active.size
|
|
30924
|
+
});
|
|
30925
|
+
}
|
|
30830
30926
|
return attemptId;
|
|
30831
30927
|
};
|
|
30832
30928
|
const removeRecoveredAttempt = async (attemptId) => {
|
|
@@ -31233,10 +31329,28 @@ var init_runner = __esm({
|
|
|
31233
31329
|
MIN_SLEEP_MS,
|
|
31234
31330
|
attemptDeadlineAtMs - now() - MIN_CLAIM_START_WINDOW_MS
|
|
31235
31331
|
);
|
|
31236
|
-
|
|
31237
|
-
Math.
|
|
31238
|
-
|
|
31332
|
+
const retryCount = Math.min(
|
|
31333
|
+
Math.max(1, options.startRetryCount),
|
|
31334
|
+
Number.MAX_SAFE_INTEGER
|
|
31335
|
+
);
|
|
31336
|
+
const retryDelayMs = Math.min(
|
|
31337
|
+
remoteRetryAfterMs(error48, attemptStartRetryFallbackMs(retryCount)),
|
|
31338
|
+
remainingMs
|
|
31239
31339
|
);
|
|
31340
|
+
const rawErrorCode = error48 && typeof error48 === "object" && "code" in error48 ? String(error48.code) : "start_acknowledgement_failed";
|
|
31341
|
+
options.onAttemptStartRetry?.({
|
|
31342
|
+
failure_stage: "job_start_acknowledgement",
|
|
31343
|
+
error_code: safeFailureCode(rawErrorCode, "start_acknowledgement_failed"),
|
|
31344
|
+
http_status_code: error48 instanceof ExternalInferenceMcpError ? error48.httpStatusCode : null,
|
|
31345
|
+
retryable: retryableRemoteError(error48),
|
|
31346
|
+
definitively_not_applied: Boolean(
|
|
31347
|
+
error48 && typeof error48 === "object" && "definitivelyNotApplied" in error48 && error48.definitivelyNotApplied === true
|
|
31348
|
+
),
|
|
31349
|
+
retry_after_ms: error48 instanceof ExternalInferenceMcpError ? error48.retryAfterMs : null,
|
|
31350
|
+
retry_count: retryCount,
|
|
31351
|
+
next_delay_ms: retryDelayMs
|
|
31352
|
+
});
|
|
31353
|
+
await options.sleep(retryDelayMs, signal);
|
|
31240
31354
|
return "retry_claimed";
|
|
31241
31355
|
}
|
|
31242
31356
|
assertStartResult(startRequest, startResult);
|
|
@@ -32954,8 +33068,8 @@ ${result2.stderr}`)) {
|
|
|
32954
33068
|
return !nextWorker || !sameWorker(record2.worker, nextWorker);
|
|
32955
33069
|
});
|
|
32956
33070
|
for (const record2 of retiring) {
|
|
32957
|
-
await updateRecord(record2, "draining");
|
|
32958
33071
|
record2.controller.abort();
|
|
33072
|
+
await updateRecord(record2, "draining");
|
|
32959
33073
|
}
|
|
32960
33074
|
const settled = await Promise.allSettled(retiring.map((record2) => record2.promise));
|
|
32961
33075
|
const failedDrain = settled.find(
|
|
@@ -32989,8 +33103,8 @@ ${result2.stderr}`)) {
|
|
|
32989
33103
|
const drainWorkers = async () => {
|
|
32990
33104
|
const draining = [...workers.values()];
|
|
32991
33105
|
for (const record2 of draining) {
|
|
32992
|
-
await updateRecord(record2, "draining");
|
|
32993
33106
|
record2.controller.abort();
|
|
33107
|
+
await updateRecord(record2, "draining");
|
|
32994
33108
|
}
|
|
32995
33109
|
const settled = await Promise.allSettled(draining.map((record2) => record2.promise));
|
|
32996
33110
|
const failedDrain = settled.find(
|