@vtxmacro/cli 2026.9.20 → 2026.9.22
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/bin/vtx-service-bootstrap.js +1 -1
- package/bin/vtx.js +163 -53
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ import { fileURLToPath } from "node:url";
|
|
|
16
16
|
// agent-cli-release.json
|
|
17
17
|
var agent_cli_release_default = {
|
|
18
18
|
package_name: "@vtxmacro/cli",
|
|
19
|
-
package_version: "2026.9.
|
|
19
|
+
package_version: "2026.9.22",
|
|
20
20
|
codex_package_name: "@openai/codex",
|
|
21
21
|
codex_version: "0.153.3",
|
|
22
22
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
package/bin/vtx.js
CHANGED
|
@@ -69,7 +69,7 @@ var init_agent_cli_release = __esm({
|
|
|
69
69
|
"agent-cli-release.json"() {
|
|
70
70
|
agent_cli_release_default = {
|
|
71
71
|
package_name: "@vtxmacro/cli",
|
|
72
|
-
package_version: "2026.9.
|
|
72
|
+
package_version: "2026.9.22",
|
|
73
73
|
codex_package_name: "@openai/codex",
|
|
74
74
|
codex_version: "0.153.3",
|
|
75
75
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -17958,13 +17958,27 @@ async function acquireInferenceHostProcessLock(path, dependencies = {}) {
|
|
|
17958
17958
|
}
|
|
17959
17959
|
};
|
|
17960
17960
|
}
|
|
17961
|
-
var loadInferenceAgentDataRequestTimeoutMs, 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, WINDOWS_PRIVATE_FILE_REPLACE_ERROR_CODES;
|
|
17961
|
+
var loadInferenceReceiptDurabilityTimeoutMs, loadInferenceAgentDataRequestTimeoutMs, 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, WINDOWS_PRIVATE_FILE_REPLACE_ERROR_CODES;
|
|
17962
17962
|
var init_config = __esm({
|
|
17963
17963
|
"lib/inference-host/config.ts"() {
|
|
17964
17964
|
"use strict";
|
|
17965
17965
|
init_define_VTX_EXO_POLICY();
|
|
17966
17966
|
init_define_VTX_PI_MODEL_POLICY();
|
|
17967
17967
|
init_dist();
|
|
17968
|
+
loadInferenceReceiptDurabilityTimeoutMs = async () => {
|
|
17969
|
+
let configured;
|
|
17970
|
+
if (true) {
|
|
17971
|
+
configured = 5e3;
|
|
17972
|
+
} else {
|
|
17973
|
+
const config2 = parse4(await readFile(resolve(dirname(fileURLToPath(import.meta.url)), "../../../config.toml"), "utf8"));
|
|
17974
|
+
const inference = config2.external_inference;
|
|
17975
|
+
configured = Number(inference?.receipt_durability_timeout_seconds) * 1e3;
|
|
17976
|
+
}
|
|
17977
|
+
if (!Number.isSafeInteger(configured) || Number(configured) < 1) {
|
|
17978
|
+
throw new Error("Inference receipt durability timeout is missing or invalid.");
|
|
17979
|
+
}
|
|
17980
|
+
return Number(configured);
|
|
17981
|
+
};
|
|
17968
17982
|
loadInferenceAgentDataRequestTimeoutMs = async () => {
|
|
17969
17983
|
let configured;
|
|
17970
17984
|
if (true) {
|
|
@@ -35774,6 +35788,11 @@ var init_runner = __esm({
|
|
|
35774
35788
|
DEFAULT_ATTEMPT_HEARTBEAT_MS,
|
|
35775
35789
|
"Attempt heartbeat interval"
|
|
35776
35790
|
),
|
|
35791
|
+
receiptDurabilityTimeoutMs: finitePositiveOption(
|
|
35792
|
+
options.receiptDurabilityTimeoutMs,
|
|
35793
|
+
options.receiptDurabilityTimeoutMs,
|
|
35794
|
+
"Receipt durability timeout"
|
|
35795
|
+
),
|
|
35777
35796
|
drainTimeoutMs: finitePositiveOption(
|
|
35778
35797
|
options.drainTimeoutMs,
|
|
35779
35798
|
DEFAULT_DRAIN_TIMEOUT_MS,
|
|
@@ -36093,7 +36112,10 @@ var init_runner = __esm({
|
|
|
36093
36112
|
this.options = options;
|
|
36094
36113
|
}
|
|
36095
36114
|
async run() {
|
|
36096
|
-
const settings = validateRunnerOptions(
|
|
36115
|
+
const settings = validateRunnerOptions({
|
|
36116
|
+
...this.options,
|
|
36117
|
+
receiptDurabilityTimeoutMs: this.options.receiptDurabilityTimeoutMs ?? await loadInferenceReceiptDurabilityTimeoutMs()
|
|
36118
|
+
});
|
|
36097
36119
|
const now = this.dependencies.now ?? Date.now;
|
|
36098
36120
|
const sleep4 = this.dependencies.sleep ?? defaultSleep;
|
|
36099
36121
|
const lock2 = await this.dependencies.acquireProcessLock();
|
|
@@ -36117,6 +36139,7 @@ var init_runner = __esm({
|
|
|
36117
36139
|
let providerDispatchWatchdogDrainRequested = false;
|
|
36118
36140
|
const agentAbort = new AbortController();
|
|
36119
36141
|
let agentLoop = Promise.resolve();
|
|
36142
|
+
let modelCatalogRefresh = null;
|
|
36120
36143
|
let wakeDrain;
|
|
36121
36144
|
const drainSignal = new Promise((resolve10) => {
|
|
36122
36145
|
wakeDrain = resolve10;
|
|
@@ -36539,6 +36562,7 @@ var init_runner = __esm({
|
|
|
36539
36562
|
}
|
|
36540
36563
|
};
|
|
36541
36564
|
let advertisementHandoff = null;
|
|
36565
|
+
const claimPreparation = { unsent: null };
|
|
36542
36566
|
const publishAdvertisement = async (health, forceAdvance, retryRemote = true, allowDefinitiveReseed = true) => {
|
|
36543
36567
|
let advertisement = receipt.pending_advertisement;
|
|
36544
36568
|
if (!advertisement) {
|
|
@@ -36756,6 +36780,45 @@ var init_runner = __esm({
|
|
|
36756
36780
|
return gapMs;
|
|
36757
36781
|
};
|
|
36758
36782
|
let nextAdvertisementAttemptAt = 0;
|
|
36783
|
+
let renewalYieldedToClaim = false;
|
|
36784
|
+
let catalogRefreshGeneration = null;
|
|
36785
|
+
const refreshModelCatalog = () => {
|
|
36786
|
+
if (modelCatalogRefresh || !this.dependencies.codexAdapter.readModelCapabilities || receipt.pending_advertisement || catalogRefreshGeneration === receipt.advertisement_generation) return;
|
|
36787
|
+
catalogRefreshGeneration = receipt.advertisement_generation;
|
|
36788
|
+
modelCatalogRefresh = (async () => {
|
|
36789
|
+
try {
|
|
36790
|
+
const capabilities = await this.dependencies.codexAdapter.readModelCapabilities(
|
|
36791
|
+
Date.now() + Math.max(1, Math.floor(settings.advertisementRefreshLeadMs / 2)),
|
|
36792
|
+
agentAbort.signal
|
|
36793
|
+
);
|
|
36794
|
+
if (agentAbort.signal.aborted) return;
|
|
36795
|
+
const refreshedModels = buildInferenceAdvertisedModels(
|
|
36796
|
+
capabilities,
|
|
36797
|
+
this.options.adapterRuntimeVersion,
|
|
36798
|
+
settings.adapterId,
|
|
36799
|
+
this.options.structuredOutput ?? settings.adapterId === "codex",
|
|
36800
|
+
settings.sameAttemptRecovery,
|
|
36801
|
+
settings.agentRuntime ? ["provider", "agent"] : ["provider"]
|
|
36802
|
+
);
|
|
36803
|
+
const changed = !exactJson2(settings.advertisedModels, refreshedModels);
|
|
36804
|
+
settings.advertisedModels = refreshedModels;
|
|
36805
|
+
emitDiagnostic("model_catalog_refreshed", {
|
|
36806
|
+
model_count: refreshedModels.length,
|
|
36807
|
+
changed,
|
|
36808
|
+
active_attempts: active.size
|
|
36809
|
+
});
|
|
36810
|
+
} catch (error48) {
|
|
36811
|
+
if (agentAbort.signal.aborted) return;
|
|
36812
|
+
emitDiagnostic("model_catalog_refresh_failed", {
|
|
36813
|
+
failure_category: error48 instanceof CodexAppServerError ? error48.category : "adapter",
|
|
36814
|
+
failure_code: error48 instanceof CodexAppServerError ? error48.code : "model_catalog_refresh_failed",
|
|
36815
|
+
retained_model_count: settings.advertisedModels.length
|
|
36816
|
+
});
|
|
36817
|
+
} finally {
|
|
36818
|
+
modelCatalogRefresh = null;
|
|
36819
|
+
}
|
|
36820
|
+
})();
|
|
36821
|
+
};
|
|
36759
36822
|
let nextProviderRateLimitRefreshAt = now() + settings.providerRateLimitRefreshMs;
|
|
36760
36823
|
let nextClaimAt = now();
|
|
36761
36824
|
let pendingClaimPromotions = 0;
|
|
@@ -36797,6 +36860,7 @@ var init_runner = __esm({
|
|
|
36797
36860
|
schema_version: "external_inference_job_claim_v1",
|
|
36798
36861
|
...claimRequestBase
|
|
36799
36862
|
};
|
|
36863
|
+
claimPreparation.unsent = pendingClaimRequest;
|
|
36800
36864
|
return {
|
|
36801
36865
|
...current,
|
|
36802
36866
|
claim_sequence: claimSequence,
|
|
@@ -36965,6 +37029,7 @@ var init_runner = __esm({
|
|
|
36965
37029
|
retryExact,
|
|
36966
37030
|
signal: controller.signal,
|
|
36967
37031
|
attemptHeartbeatMs: settings.attemptHeartbeatMs,
|
|
37032
|
+
receiptDurabilityTimeoutMs: settings.receiptDurabilityTimeoutMs,
|
|
36968
37033
|
sleep: sleep4,
|
|
36969
37034
|
now,
|
|
36970
37035
|
onProviderCooldown: ({ retryAtMs, reason, rateLimits }) => {
|
|
@@ -37032,9 +37097,9 @@ var init_runner = __esm({
|
|
|
37032
37097
|
active_attempts: active.size
|
|
37033
37098
|
});
|
|
37034
37099
|
},
|
|
37035
|
-
onProviderDispatchRecoveryRequired: () => {
|
|
37100
|
+
onProviderDispatchRecoveryRequired: (reason = "provider_dispatch_watchdog_expired") => {
|
|
37036
37101
|
providerDispatchWatchdogDrainRequested = true;
|
|
37037
|
-
requestDrain(
|
|
37102
|
+
requestDrain(reason);
|
|
37038
37103
|
},
|
|
37039
37104
|
startRetryCount: nextStartRetryCount,
|
|
37040
37105
|
onAttemptStartRetry: (observation) => {
|
|
@@ -37271,39 +37336,20 @@ var init_runner = __esm({
|
|
|
37271
37336
|
}
|
|
37272
37337
|
}
|
|
37273
37338
|
const expiresAt = receipt.advertisement_expires_at ? Date.parse(receipt.advertisement_expires_at) : 0;
|
|
37274
|
-
|
|
37339
|
+
const renewalDue = currentTime >= nextAdvertisementAttemptAt && expiresAt - currentTime <= settings.advertisementRefreshLeadMs;
|
|
37340
|
+
if (renewalDue) refreshModelCatalog();
|
|
37341
|
+
const yieldRenewalToClaim = renewalDue && !renewalYieldedToClaim && !receipt.pending_advertisement && expiresAt > now() && recoveryQueue.length === 0 && (!this.options.once || !onceClaimed) && (settings.maxConcurrency === null || active.size < settings.maxConcurrency) && pendingClaimPromotions === 0 && now() >= Math.max(
|
|
37342
|
+
nextClaimAt,
|
|
37343
|
+
claimAvailabilityBackoff?.untilMs ?? 0,
|
|
37344
|
+
providerRetryAtMs ?? 0,
|
|
37345
|
+
providerFailureRetryAtMs
|
|
37346
|
+
);
|
|
37347
|
+
if (yieldRenewalToClaim) renewalYieldedToClaim = true;
|
|
37348
|
+
if (renewalDue && !yieldRenewalToClaim) {
|
|
37275
37349
|
try {
|
|
37276
|
-
if (!receipt.pending_advertisement && this.dependencies.codexAdapter.readModelCapabilities) {
|
|
37277
|
-
try {
|
|
37278
|
-
const capabilities = await this.dependencies.codexAdapter.readModelCapabilities(
|
|
37279
|
-
Date.now() + Math.max(1, Math.floor(settings.advertisementRefreshLeadMs / 2)),
|
|
37280
|
-
this.options.signal
|
|
37281
|
-
);
|
|
37282
|
-
const refreshedModels = buildInferenceAdvertisedModels(
|
|
37283
|
-
capabilities,
|
|
37284
|
-
this.options.adapterRuntimeVersion,
|
|
37285
|
-
settings.adapterId,
|
|
37286
|
-
this.options.structuredOutput ?? settings.adapterId === "codex",
|
|
37287
|
-
settings.sameAttemptRecovery,
|
|
37288
|
-
settings.agentRuntime ? ["provider", "agent"] : ["provider"]
|
|
37289
|
-
);
|
|
37290
|
-
const changed = !exactJson2(settings.advertisedModels, refreshedModels);
|
|
37291
|
-
settings.advertisedModels = refreshedModels;
|
|
37292
|
-
emitDiagnostic("model_catalog_refreshed", {
|
|
37293
|
-
model_count: refreshedModels.length,
|
|
37294
|
-
changed,
|
|
37295
|
-
active_attempts: active.size
|
|
37296
|
-
});
|
|
37297
|
-
} catch (error48) {
|
|
37298
|
-
emitDiagnostic("model_catalog_refresh_failed", {
|
|
37299
|
-
failure_category: error48 instanceof CodexAppServerError ? error48.category : "adapter",
|
|
37300
|
-
failure_code: error48 instanceof CodexAppServerError ? error48.code : "model_catalog_refresh_failed",
|
|
37301
|
-
retained_model_count: settings.advertisedModels.length
|
|
37302
|
-
});
|
|
37303
|
-
}
|
|
37304
|
-
}
|
|
37305
37350
|
await publishAdvertisement("healthy", true, false);
|
|
37306
37351
|
nextAdvertisementAttemptAt = 0;
|
|
37352
|
+
renewalYieldedToClaim = false;
|
|
37307
37353
|
} catch (error48) {
|
|
37308
37354
|
if (controlPlaneFatal(error48)) {
|
|
37309
37355
|
requestDrain("authority_lost");
|
|
@@ -37321,23 +37367,38 @@ var init_runner = __esm({
|
|
|
37321
37367
|
const recovery = recoveryQueue.shift();
|
|
37322
37368
|
launchClaim(recovery.claim, recovery);
|
|
37323
37369
|
}
|
|
37324
|
-
|
|
37370
|
+
let claimOpportunities = 0;
|
|
37371
|
+
while (!drainRequested && (!yieldRenewalToClaim || claimOpportunities === 0) && recoveryQueue.length === 0 && (!this.options.once || !onceClaimed) && (settings.maxConcurrency === null || active.size < settings.maxConcurrency) && pendingClaimPromotions === 0 && now() >= Math.max(
|
|
37325
37372
|
nextClaimAt,
|
|
37326
37373
|
claimAvailabilityBackoff?.untilMs ?? 0,
|
|
37327
37374
|
providerRetryAtMs ?? 0,
|
|
37328
37375
|
providerFailureRetryAtMs
|
|
37329
37376
|
)) {
|
|
37377
|
+
if (receipt.pending_claim_request === claimPreparation.unsent && claimPreparation.unsent !== null && claimPreparation.unsent.advertisement_generation !== receipt.advertisement_generation) {
|
|
37378
|
+
await mutateReceipt((current) => preparePendingClaim({
|
|
37379
|
+
...current,
|
|
37380
|
+
pending_claim_request: null
|
|
37381
|
+
}));
|
|
37382
|
+
}
|
|
37383
|
+
const knownUnsent = receipt.pending_claim_request === null || receipt.pending_claim_request === claimPreparation.unsent;
|
|
37384
|
+
if (knownUnsent && Date.parse(receipt.advertisement_expires_at ?? "") <= now()) break;
|
|
37330
37385
|
if (!receipt.pending_claim_request) {
|
|
37331
37386
|
await mutateReceipt(preparePendingClaim);
|
|
37332
37387
|
}
|
|
37333
37388
|
const request = receipt.pending_claim_request;
|
|
37389
|
+
if (request === claimPreparation.unsent && Date.parse(receipt.advertisement_expires_at ?? "") <= now()) break;
|
|
37334
37390
|
let claim;
|
|
37335
37391
|
const claimCallStartedAtMs = now();
|
|
37336
37392
|
try {
|
|
37393
|
+
claimOpportunities += 1;
|
|
37394
|
+
if (claimPreparation.unsent === request) claimPreparation.unsent = null;
|
|
37337
37395
|
claim = await mcp.callTool(
|
|
37338
37396
|
"inference.job.claim",
|
|
37339
37397
|
request,
|
|
37340
|
-
{
|
|
37398
|
+
{
|
|
37399
|
+
signal: this.options.signal,
|
|
37400
|
+
...yieldRenewalToClaim ? { deadlineAtMs: expiresAt } : {}
|
|
37401
|
+
}
|
|
37341
37402
|
);
|
|
37342
37403
|
assertClaimResult(request, claim);
|
|
37343
37404
|
} catch (error48) {
|
|
@@ -37562,6 +37623,7 @@ var init_runner = __esm({
|
|
|
37562
37623
|
now() + settings.hostHeartbeatMs,
|
|
37563
37624
|
Math.max(now() + MIN_SLEEP_MS, advertisementDueAt)
|
|
37564
37625
|
);
|
|
37626
|
+
if (yieldRenewalToClaim) continue;
|
|
37565
37627
|
await Promise.race([
|
|
37566
37628
|
sleep4(Math.max(MIN_SLEEP_MS, wakeAt - now())),
|
|
37567
37629
|
drainSignal,
|
|
@@ -37611,6 +37673,7 @@ var init_runner = __esm({
|
|
|
37611
37673
|
agentAbort.abort();
|
|
37612
37674
|
const agentCleanup = Promise.allSettled([
|
|
37613
37675
|
agentLoop,
|
|
37676
|
+
modelCatalogRefresh,
|
|
37614
37677
|
Promise.resolve().then(async () => {
|
|
37615
37678
|
await settings.agentRuntime?.adapter.close();
|
|
37616
37679
|
})
|
|
@@ -37738,14 +37801,35 @@ var init_runner = __esm({
|
|
|
37738
37801
|
attemptAbort.abort();
|
|
37739
37802
|
}, Math.max(MIN_SLEEP_MS, deadlineAtMs - now()));
|
|
37740
37803
|
};
|
|
37741
|
-
|
|
37742
|
-
|
|
37743
|
-
|
|
37744
|
-
|
|
37745
|
-
|
|
37746
|
-
|
|
37747
|
-
|
|
37748
|
-
|
|
37804
|
+
let receiptDurabilityUnhealthy = false;
|
|
37805
|
+
const awaitPreProviderDurability = async (operation) => {
|
|
37806
|
+
let timer;
|
|
37807
|
+
try {
|
|
37808
|
+
return await Promise.race([
|
|
37809
|
+
operation,
|
|
37810
|
+
new Promise((_resolve, reject) => {
|
|
37811
|
+
timer = setTimeout(() => {
|
|
37812
|
+
receiptDurabilityUnhealthy = true;
|
|
37813
|
+
options.onProviderDispatchRecoveryRequired?.("receipt_durability_timeout");
|
|
37814
|
+
reject(new InferenceHostRecoveryRequiredError(
|
|
37815
|
+
"Provider dispatch stopped because durable receipt storage did not settle."
|
|
37816
|
+
));
|
|
37817
|
+
}, options.receiptDurabilityTimeoutMs);
|
|
37818
|
+
})
|
|
37819
|
+
]);
|
|
37820
|
+
} finally {
|
|
37821
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
37822
|
+
}
|
|
37823
|
+
};
|
|
37824
|
+
const requireDispatchFreshness = () => {
|
|
37825
|
+
if (providerDispatchNotAfterMs === void 0 || !providerDispatchWatchdogExpired && now() < providerDispatchNotAfterMs) return;
|
|
37826
|
+
providerDispatchWatchdogExpired = true;
|
|
37827
|
+
attemptAbort.abort();
|
|
37828
|
+
throw new InferenceHostRunnerError(
|
|
37829
|
+
"server_account_context_expired_before_provider_dispatch",
|
|
37830
|
+
"The Server account context expired before provider dispatch."
|
|
37831
|
+
);
|
|
37832
|
+
};
|
|
37749
37833
|
const persistAttempt = async (changes, clearPendingClaim = false) => {
|
|
37750
37834
|
const nextAttemptReceipt = validateAttemptReceipt({
|
|
37751
37835
|
...attemptReceipt,
|
|
@@ -37865,12 +37949,21 @@ var init_runner = __esm({
|
|
|
37865
37949
|
membership_disposition: membershipFailureDisposition(failure2),
|
|
37866
37950
|
failed_at: isoAt(now())
|
|
37867
37951
|
});
|
|
37868
|
-
|
|
37952
|
+
const terminalDurability = persistAttempt({
|
|
37869
37953
|
phase: "terminal_pending",
|
|
37870
37954
|
dispatch_outcome: "not_dispatched",
|
|
37871
37955
|
terminal_operation_id: failureId,
|
|
37872
37956
|
terminal_request: failureRequest
|
|
37873
|
-
})
|
|
37957
|
+
});
|
|
37958
|
+
if (receiptDurabilityUnhealthy) {
|
|
37959
|
+
void terminalDurability.catch(() => void 0);
|
|
37960
|
+
} else {
|
|
37961
|
+
try {
|
|
37962
|
+
await awaitPreProviderDurability(terminalDurability);
|
|
37963
|
+
} catch (error48) {
|
|
37964
|
+
if (!receiptDurabilityUnhealthy) throw error48;
|
|
37965
|
+
}
|
|
37966
|
+
}
|
|
37874
37967
|
const evidenceDeadlineAtMs = Date.parse(jobInput.evidence_expires_at);
|
|
37875
37968
|
const failureResult = await retryExact(() => mcp.callTool(
|
|
37876
37969
|
"inference.job.fail",
|
|
@@ -37878,6 +37971,9 @@ var init_runner = __esm({
|
|
|
37878
37971
|
{ signal, deadlineAtMs: evidenceDeadlineAtMs }
|
|
37879
37972
|
), { signal, deadlineAtMs: evidenceDeadlineAtMs });
|
|
37880
37973
|
assertTerminalResult(failureRequest, failureResult);
|
|
37974
|
+
if (!receiptDurabilityUnhealthy) {
|
|
37975
|
+
await awaitPreProviderDurability(removeAttempt());
|
|
37976
|
+
}
|
|
37881
37977
|
options.onAttemptOutcome?.({
|
|
37882
37978
|
outcome: "failed",
|
|
37883
37979
|
failure_category: failureRequest.failure_category,
|
|
@@ -38018,6 +38114,7 @@ var init_runner = __esm({
|
|
|
38018
38114
|
}
|
|
38019
38115
|
}
|
|
38020
38116
|
if (attemptReceipt.phase !== "dispatched") {
|
|
38117
|
+
requireDispatchFreshness();
|
|
38021
38118
|
const providerDispatchable = inputValidationError === void 0 && outputContract !== null;
|
|
38022
38119
|
reportPreProviderStage("receipt_persistence");
|
|
38023
38120
|
await awaitPreProviderDurability(
|
|
@@ -38030,12 +38127,12 @@ var init_runner = __esm({
|
|
|
38030
38127
|
])
|
|
38031
38128
|
);
|
|
38032
38129
|
}
|
|
38130
|
+
if (options.resumeReceipt?.phase !== "dispatched") requireDispatchFreshness();
|
|
38033
38131
|
reportPreProviderStage("thread_setup");
|
|
38034
38132
|
} catch (error48) {
|
|
38035
38133
|
clearProviderDispatchWatchdog();
|
|
38036
38134
|
signal.removeEventListener("abort", relayAbort);
|
|
38037
38135
|
if (providerDispatchWatchdogExpired) {
|
|
38038
|
-
options.onProviderDispatchRecoveryRequired?.();
|
|
38039
38136
|
return terminalizeProviderDispatchWatchdog();
|
|
38040
38137
|
}
|
|
38041
38138
|
throw error48;
|
|
@@ -41458,6 +41555,7 @@ Durable service:
|
|
|
41458
41555
|
protocolVersion: EXTERNAL_INFERENCE_CONTRACT_VERSION,
|
|
41459
41556
|
adapterRuntimeVersion: INFERENCE_HOST_CLI_VERSION,
|
|
41460
41557
|
hostRuntimeVersion: INFERENCE_HOST_CLI_VERSION,
|
|
41558
|
+
receiptDurabilityTimeoutMs: await loadInferenceReceiptDurabilityTimeoutMs(),
|
|
41461
41559
|
maxConcurrency: options.maxConcurrency,
|
|
41462
41560
|
once: options.once,
|
|
41463
41561
|
emitDiagnosticEvent: options.emitDiagnosticEvent,
|
|
@@ -41528,6 +41626,7 @@ Durable service:
|
|
|
41528
41626
|
protocolVersion: EXTERNAL_INFERENCE_CONTRACT_VERSION,
|
|
41529
41627
|
adapterRuntimeVersion: options.preflight.runtimeVersion,
|
|
41530
41628
|
hostRuntimeVersion: INFERENCE_HOST_CLI_VERSION,
|
|
41629
|
+
receiptDurabilityTimeoutMs: await loadInferenceReceiptDurabilityTimeoutMs(),
|
|
41531
41630
|
maxConcurrency: options.maxConcurrency,
|
|
41532
41631
|
once: options.once,
|
|
41533
41632
|
emitDiagnosticEvent: options.emitDiagnosticEvent,
|
|
@@ -48034,9 +48133,13 @@ async function postClientRuntime(path, profileId, body, options) {
|
|
|
48034
48133
|
if (idempotencyKey) {
|
|
48035
48134
|
requestHeaders["X-Idempotency-Key"] = idempotencyKey;
|
|
48036
48135
|
}
|
|
48136
|
+
if (options?.reconcileOnly === true) {
|
|
48137
|
+
requestHeaders["X-Runtime-Reconcile-Only"] = "true";
|
|
48138
|
+
}
|
|
48037
48139
|
let lastNetworkError = null;
|
|
48038
48140
|
let missingRuntimeLeaseRecoveryAttempted = false;
|
|
48039
48141
|
let replacementLeaseRetryUsed = false;
|
|
48142
|
+
let lastRequestId = null;
|
|
48040
48143
|
const deadlineError = (attempt, cause) => annotateRuntimeRequestError(
|
|
48041
48144
|
Object.assign(
|
|
48042
48145
|
new Error("Client runtime decision persistence deadline exceeded after the AI run completed."),
|
|
@@ -48051,7 +48154,8 @@ async function postClientRuntime(path, profileId, body, options) {
|
|
|
48051
48154
|
keepalive,
|
|
48052
48155
|
hadRuntimeLeaseToken: Boolean(resolvedRuntimeLeaseToken),
|
|
48053
48156
|
deadlineAtMs,
|
|
48054
|
-
deadlineExceeded: true
|
|
48157
|
+
deadlineExceeded: true,
|
|
48158
|
+
requestId: lastRequestId
|
|
48055
48159
|
}
|
|
48056
48160
|
);
|
|
48057
48161
|
const waitBeforeRetry = async (delayMs, attempt, cause) => {
|
|
@@ -48090,12 +48194,13 @@ async function postClientRuntime(path, profileId, body, options) {
|
|
|
48090
48194
|
}, Math.max(1, attemptTimeoutMs));
|
|
48091
48195
|
requestSignal = timeoutController.signal;
|
|
48092
48196
|
}
|
|
48197
|
+
lastRequestId = path === "/runtime/decision" ? createIdempotencyKey("runtime-request") : null;
|
|
48093
48198
|
const trace = startRuntimeNetworkDebugTrace({
|
|
48094
48199
|
kind: "runtime",
|
|
48095
48200
|
label: "client_runtime_api",
|
|
48096
48201
|
method: "POST",
|
|
48097
48202
|
url: requestUrl,
|
|
48098
|
-
note: `path=${path} attempt=${attempt}/${maxAttempts}`
|
|
48203
|
+
note: `path=${path} attempt=${attempt}/${maxAttempts}${lastRequestId ? ` reconcile_only=${options?.reconcileOnly === true} request_id=${lastRequestId}` : ""}`
|
|
48099
48204
|
});
|
|
48100
48205
|
try {
|
|
48101
48206
|
response = await fetch(requestUrl, {
|
|
@@ -48103,7 +48208,10 @@ async function postClientRuntime(path, profileId, body, options) {
|
|
|
48103
48208
|
credentials: "include",
|
|
48104
48209
|
keepalive,
|
|
48105
48210
|
signal: requestSignal,
|
|
48106
|
-
headers: {
|
|
48211
|
+
headers: {
|
|
48212
|
+
...requestHeaders,
|
|
48213
|
+
...lastRequestId ? { "X-Request-ID": lastRequestId } : {}
|
|
48214
|
+
},
|
|
48107
48215
|
body
|
|
48108
48216
|
});
|
|
48109
48217
|
if (!response.ok) {
|
|
@@ -48184,7 +48292,8 @@ async function postClientRuntime(path, profileId, body, options) {
|
|
|
48184
48292
|
status: response?.status ?? null,
|
|
48185
48293
|
keepalive,
|
|
48186
48294
|
hadRuntimeLeaseToken: Boolean(resolvedRuntimeLeaseToken),
|
|
48187
|
-
deadlineAtMs
|
|
48295
|
+
deadlineAtMs,
|
|
48296
|
+
requestId: lastRequestId
|
|
48188
48297
|
});
|
|
48189
48298
|
}
|
|
48190
48299
|
await waitBeforeRetry(
|
|
@@ -48625,6 +48734,7 @@ var init_api2 = __esm({
|
|
|
48625
48734
|
target.runtimeRequestTransientNetwork = isTransientNetworkFetchError(error48);
|
|
48626
48735
|
target.runtimeRequestKeepalive = metadata.keepalive;
|
|
48627
48736
|
target.runtimeRequestHadLeaseToken = metadata.hadRuntimeLeaseToken;
|
|
48737
|
+
if (metadata.requestId !== void 0) target.runtimeRequestId = metadata.requestId;
|
|
48628
48738
|
if (metadata.deadlineAtMs !== void 0) {
|
|
48629
48739
|
target.runtimeRequestDeadlineAtMs = metadata.deadlineAtMs;
|
|
48630
48740
|
}
|
|
@@ -48799,7 +48909,7 @@ var init_api2 = __esm({
|
|
|
48799
48909
|
return true;
|
|
48800
48910
|
};
|
|
48801
48911
|
isRuntimeIdempotencyInProgressError = (status, message) => status === 409 && (message.toLowerCase().includes("duplicate request already in progress") || message.toLowerCase().includes("duplicate request in-flight"));
|
|
48802
|
-
isRetryableRuntimeConflictError = (status, error48) => status === 409 && error48.retryable === true && (error48.code === "profile_runtime_contract_busy" || error48.code === "runtime_decision_finalizing" || error48.code === "runtime_trade_sync_finalizing");
|
|
48912
|
+
isRetryableRuntimeConflictError = (status, error48) => status === 409 && error48.retryable === true && (error48.code === "profile_runtime_contract_busy" || error48.code === "runtime_decision_finalizing" || error48.code === "runtime_trade_sync_finalizing" || error48.code === "runtime_decision_unconfirmed");
|
|
48803
48913
|
resolveClientRuntimeRetryDelayMs = (attempt, retryAfterHeader) => {
|
|
48804
48914
|
const retryAfterMs = parseRuntimeRetryAfterMs(retryAfterHeader);
|
|
48805
48915
|
if (retryAfterMs != null) {
|