@vtxmacro/cli 2026.10.39 → 2026.10.40
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-mcp.js +1 -1
- package/bin/vtx-service-bootstrap.js +1 -1
- package/bin/vtx.js +198 -12
- package/package.json +1 -1
package/bin/vtx-mcp.js
CHANGED
|
@@ -43,7 +43,7 @@ var init_define_VTX_PI_MODEL_POLICY = __esm({
|
|
|
43
43
|
var agent_cli_release_default;
|
|
44
44
|
var init_agent_cli_release = __esm({
|
|
45
45
|
"agent-cli-release.json"() {
|
|
46
|
-
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
46
|
+
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.40", codex_package_name: "@openai/codex", codex_version: "0.155.0", copilot_sdk_package_name: "@github/copilot-sdk", copilot_sdk_version: "1.0.0-beta.8", copilot_cli_package_name: "@github/copilot", copilot_cli_version: "1.0.80", deepseek_harness_version: "0.1.1-rc.2", deepseek_harness_packages: ["@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-loop", "@deepseek-ai/dsh-agent-spine-demo", "@deepseek-ai/dsh-anonymous-user-id", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-attachment", "@deepseek-ai/dsh-brand", "@deepseek-ai/dsh-code-runtime", "@deepseek-ai/dsh-credentials", "@deepseek-ai/dsh-fs", "@deepseek-ai/dsh-goal", "@deepseek-ai/dsh-goal-round-driver", "@deepseek-ai/dsh-home-paths", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-jobs", "@deepseek-ai/dsh-jobs-local", "@deepseek-ai/dsh-launch-environment", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-deepseek", "@deepseek-ai/dsh-llm-retry", "@deepseek-ai/dsh-output-retention", "@deepseek-ai/dsh-sandbox", "@deepseek-ai/dsh-sandbox-policy", "@deepseek-ai/dsh-scope", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-session-checkpoint-policy", "@deepseek-ai/dsh-session-persistence", "@deepseek-ai/dsh-session-persistence-jsonl", "@deepseek-ai/dsh-session-projection", "@deepseek-ai/dsh-session-title", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-shell", "@deepseek-ai/dsh-shell-env", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-skill-filesystem", "@deepseek-ai/dsh-subprocess", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-timeout", "@deepseek-ai/dsh-tool-bash", "@deepseek-ai/dsh-tool-goal", "@deepseek-ai/dsh-tool-jobs", "@deepseek-ai/dsh-tool-skill", "@deepseek-ai/dsh-tools", "@deepseek-ai/dsh-typert-protocol", "@deepseek-ai/dsh-user-approval"], deepseek_cordis_package_name: "@deepseek-ai/cordis", deepseek_cordis_version: "4.0.1", deepseek_support_packages: { "@deepseek-ai/cordis-plugin-timer": "1.1.3" }, platforms: { "linux-x64": { package_name: "@openai/codex-linux-x64", target: "x86_64-unknown-linux-musl", binary_name: "codex", sha256: "660e159a49e823ac8e5986cb238f73158ce4b957d40d9292f8de90862644b501" }, "win32-x64": { package_name: "@openai/codex-win32-x64", target: "x86_64-pc-windows-msvc", binary_name: "codex.exe", sha256: "e4c11374bd9de8ad5c3b7617fd4654bb7839901edb0863f9930666863c7a021b" } }, pi_coding_agent_package_name: "@earendil-works/pi-coding-agent", pi_ai_package_name: "@earendil-works/pi-ai", pi_version: "0.85.1", pi_support_packages: ["@earendil-works/pi-agent-core", "@earendil-works/pi-telemetry", "@earendil-works/pi-tui", "@earendil-works/chord"], grok_version: "1.0.30", grok_platforms: { "linux-x64": { package_name: "@xai-official/grok-linux-x64", binary_name: "grok", sha256: "504dd6546ab991b75d36698242875ce461489cd1f8cd84285873cb55bd5c7d54" }, "win32-x64": { package_name: "@xai-official/grok-win32-x64", binary_name: "grok.exe", sha256: "48736d1a4342a801ea26d0ecde4c516b653f791399065adaa55973f83abd8867" } } };
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -14,7 +14,7 @@ import { dirname as dirname4, relative as relative4, resolve as resolve4 } from
|
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
|
|
16
16
|
// agent-cli-release.json
|
|
17
|
-
var agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
17
|
+
var agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.40", codex_package_name: "@openai/codex", codex_version: "0.155.0", copilot_sdk_package_name: "@github/copilot-sdk", copilot_sdk_version: "1.0.0-beta.8", copilot_cli_package_name: "@github/copilot", copilot_cli_version: "1.0.80", deepseek_harness_version: "0.1.1-rc.2", deepseek_harness_packages: ["@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-loop", "@deepseek-ai/dsh-agent-spine-demo", "@deepseek-ai/dsh-anonymous-user-id", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-attachment", "@deepseek-ai/dsh-brand", "@deepseek-ai/dsh-code-runtime", "@deepseek-ai/dsh-credentials", "@deepseek-ai/dsh-fs", "@deepseek-ai/dsh-goal", "@deepseek-ai/dsh-goal-round-driver", "@deepseek-ai/dsh-home-paths", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-jobs", "@deepseek-ai/dsh-jobs-local", "@deepseek-ai/dsh-launch-environment", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-deepseek", "@deepseek-ai/dsh-llm-retry", "@deepseek-ai/dsh-output-retention", "@deepseek-ai/dsh-sandbox", "@deepseek-ai/dsh-sandbox-policy", "@deepseek-ai/dsh-scope", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-session-checkpoint-policy", "@deepseek-ai/dsh-session-persistence", "@deepseek-ai/dsh-session-persistence-jsonl", "@deepseek-ai/dsh-session-projection", "@deepseek-ai/dsh-session-title", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-shell", "@deepseek-ai/dsh-shell-env", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-skill-filesystem", "@deepseek-ai/dsh-subprocess", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-timeout", "@deepseek-ai/dsh-tool-bash", "@deepseek-ai/dsh-tool-goal", "@deepseek-ai/dsh-tool-jobs", "@deepseek-ai/dsh-tool-skill", "@deepseek-ai/dsh-tools", "@deepseek-ai/dsh-typert-protocol", "@deepseek-ai/dsh-user-approval"], deepseek_cordis_package_name: "@deepseek-ai/cordis", deepseek_cordis_version: "4.0.1", deepseek_support_packages: { "@deepseek-ai/cordis-plugin-timer": "1.1.3" }, platforms: { "linux-x64": { package_name: "@openai/codex-linux-x64", target: "x86_64-unknown-linux-musl", binary_name: "codex", sha256: "660e159a49e823ac8e5986cb238f73158ce4b957d40d9292f8de90862644b501" }, "win32-x64": { package_name: "@openai/codex-win32-x64", target: "x86_64-pc-windows-msvc", binary_name: "codex.exe", sha256: "e4c11374bd9de8ad5c3b7617fd4654bb7839901edb0863f9930666863c7a021b" } }, pi_coding_agent_package_name: "@earendil-works/pi-coding-agent", pi_ai_package_name: "@earendil-works/pi-ai", pi_version: "0.85.1", pi_support_packages: ["@earendil-works/pi-agent-core", "@earendil-works/pi-telemetry", "@earendil-works/pi-tui", "@earendil-works/chord"], grok_version: "1.0.30", grok_platforms: { "linux-x64": { package_name: "@xai-official/grok-linux-x64", binary_name: "grok", sha256: "504dd6546ab991b75d36698242875ce461489cd1f8cd84285873cb55bd5c7d54" }, "win32-x64": { package_name: "@xai-official/grok-win32-x64", binary_name: "grok.exe", sha256: "48736d1a4342a801ea26d0ecde4c516b653f791399065adaa55973f83abd8867" } } };
|
|
18
18
|
|
|
19
19
|
// lib/runtime-policy.generated.json
|
|
20
20
|
var runtime_policy_generated_default = {
|
package/bin/vtx.js
CHANGED
|
@@ -122,7 +122,7 @@ var init_routing = __esm({
|
|
|
122
122
|
var agent_cli_release_default;
|
|
123
123
|
var init_agent_cli_release = __esm({
|
|
124
124
|
"agent-cli-release.json"() {
|
|
125
|
-
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
125
|
+
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.40", codex_package_name: "@openai/codex", codex_version: "0.155.0", copilot_sdk_package_name: "@github/copilot-sdk", copilot_sdk_version: "1.0.0-beta.8", copilot_cli_package_name: "@github/copilot", copilot_cli_version: "1.0.80", deepseek_harness_version: "0.1.1-rc.2", deepseek_harness_packages: ["@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-loop", "@deepseek-ai/dsh-agent-spine-demo", "@deepseek-ai/dsh-anonymous-user-id", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-attachment", "@deepseek-ai/dsh-brand", "@deepseek-ai/dsh-code-runtime", "@deepseek-ai/dsh-credentials", "@deepseek-ai/dsh-fs", "@deepseek-ai/dsh-goal", "@deepseek-ai/dsh-goal-round-driver", "@deepseek-ai/dsh-home-paths", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-jobs", "@deepseek-ai/dsh-jobs-local", "@deepseek-ai/dsh-launch-environment", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-deepseek", "@deepseek-ai/dsh-llm-retry", "@deepseek-ai/dsh-output-retention", "@deepseek-ai/dsh-sandbox", "@deepseek-ai/dsh-sandbox-policy", "@deepseek-ai/dsh-scope", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-session-checkpoint-policy", "@deepseek-ai/dsh-session-persistence", "@deepseek-ai/dsh-session-persistence-jsonl", "@deepseek-ai/dsh-session-projection", "@deepseek-ai/dsh-session-title", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-shell", "@deepseek-ai/dsh-shell-env", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-skill-filesystem", "@deepseek-ai/dsh-subprocess", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-timeout", "@deepseek-ai/dsh-tool-bash", "@deepseek-ai/dsh-tool-goal", "@deepseek-ai/dsh-tool-jobs", "@deepseek-ai/dsh-tool-skill", "@deepseek-ai/dsh-tools", "@deepseek-ai/dsh-typert-protocol", "@deepseek-ai/dsh-user-approval"], deepseek_cordis_package_name: "@deepseek-ai/cordis", deepseek_cordis_version: "4.0.1", deepseek_support_packages: { "@deepseek-ai/cordis-plugin-timer": "1.1.3" }, platforms: { "linux-x64": { package_name: "@openai/codex-linux-x64", target: "x86_64-unknown-linux-musl", binary_name: "codex", sha256: "660e159a49e823ac8e5986cb238f73158ce4b957d40d9292f8de90862644b501" }, "win32-x64": { package_name: "@openai/codex-win32-x64", target: "x86_64-pc-windows-msvc", binary_name: "codex.exe", sha256: "e4c11374bd9de8ad5c3b7617fd4654bb7839901edb0863f9930666863c7a021b" } }, pi_coding_agent_package_name: "@earendil-works/pi-coding-agent", pi_ai_package_name: "@earendil-works/pi-ai", pi_version: "0.85.1", pi_support_packages: ["@earendil-works/pi-agent-core", "@earendil-works/pi-telemetry", "@earendil-works/pi-tui", "@earendil-works/chord"], grok_version: "1.0.30", grok_platforms: { "linux-x64": { package_name: "@xai-official/grok-linux-x64", binary_name: "grok", sha256: "504dd6546ab991b75d36698242875ce461489cd1f8cd84285873cb55bd5c7d54" }, "win32-x64": { package_name: "@xai-official/grok-win32-x64", binary_name: "grok.exe", sha256: "48736d1a4342a801ea26d0ecde4c516b653f791399065adaa55973f83abd8867" } } };
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
|
|
@@ -60286,7 +60286,7 @@ var init_hyperliquid_public_capacity = __esm({
|
|
|
60286
60286
|
adaptivePublicCapacity = (input) => {
|
|
60287
60287
|
const { nowMs: nowMs2, policy: policy2 } = input;
|
|
60288
60288
|
const current = publicDemandBucketIndex(nowMs2, policy2.bucketMs);
|
|
60289
|
-
const oldest =
|
|
60289
|
+
const oldest = publicDemandBucketIndex(nowMs2 - policy2.horizonMs, policy2.bucketMs);
|
|
60290
60290
|
const inHorizon = input.buckets.map((bucket) => ({ ...bucket, index: Math.min(bucket.index, current) })).filter((bucket) => bucket.index >= oldest);
|
|
60291
60291
|
const peak = (from, of) => inHorizon.filter((bucket) => bucket.index >= from).reduce((most, bucket) => Math.max(most, of(bucket)), 0);
|
|
60292
60292
|
const peakHigher = peak(oldest, (bucket) => bucket.higherPeak);
|
|
@@ -60314,7 +60314,7 @@ var init_hyperliquid_public_capacity = __esm({
|
|
|
60314
60314
|
});
|
|
60315
60315
|
|
|
60316
60316
|
// lib/runtime/hyperliquid-public-read.ts
|
|
60317
|
-
var policy, weights, recoveryPolicy, budgets, unpersistedBudgets, cache, pending2, PREFIX, priorityRank, createHyperliquidPublicPriorityScope, promoteHyperliquidPublicPriority, hostTransport, hyperliquidPrivateInfoHeldOff, abortError2, checkAbort, wait, waitUnlessPromoted, storage, loadBudget, saveBudget, withBudgetLock, HyperliquidPublicReadError, getHyperliquidPublicReadBudget, cooldownError, recoveryWaitError, ranks, mostUrgentRank, lastRank, capacityPolicy, isHeldBack, reservationRank, classBoundaries, everyone, slotOf, windowWeights, foldDemand, demandFor, heldBackDecision, fallbackDelayMs, admit, rowWeightedCharge, settleRowWeightedReservation, cooldown, finishHyperliquidRecoveryRequest, assertHyperliquidRecoveryDispatch, validateHyperliquidRecoveryDispatch, cacheTtlMs, eligibleCache, reserveHyperliquidPublicReads, releaseHyperliquidPublicReadReservation, admitHyperliquidExchangeRequest, recordHyperliquidExchangeResponse, readHyperliquidPublicInfo;
|
|
60317
|
+
var policy, weights, recoveryPolicy, budgets, unpersistedBudgets, cache, pending2, PREFIX, priorityRank, createHyperliquidPublicPriorityScope, promoteHyperliquidPublicPriority, hostTransport, hyperliquidPrivateInfoHeldOff, abortError2, checkAbort, wait, waitUnlessPromoted, storage, loadBudget, saveBudget, withBudgetLock, HyperliquidPublicReadError, getHyperliquidPublicReadBudget, cooldownError, recoveryWaitError, ranks, mostUrgentRank, lastRank, capacityPolicy, READERS_KEY, memoryReaders, unwrittenReaders, validSchedule, readTradingReaders, noteTradingReader, noteHyperliquidTradingRuntime, noteHyperliquidUnscheduledTradingRead, hyperliquidDemandWindowMs, greatestCommonDivisor, heldDemand, isHeldBack, reservationRank, classBoundaries, everyone, slotOf, windowWeights, foldDemand, demandFor, heldBackDecision, fallbackDelayMs, admit, rowWeightedCharge, settleRowWeightedReservation, cooldown, finishHyperliquidRecoveryRequest, assertHyperliquidRecoveryDispatch, validateHyperliquidRecoveryDispatch, cacheTtlMs, eligibleCache, reserveHyperliquidPublicReads, releaseHyperliquidPublicReadReservation, admitHyperliquidExchangeRequest, recordHyperliquidExchangeResponse, readHyperliquidPublicInfo;
|
|
60318
60318
|
var init_hyperliquid_public_read = __esm({
|
|
60319
60319
|
"lib/runtime/hyperliquid-public-read.ts"() {
|
|
60320
60320
|
"use strict";
|
|
@@ -60477,6 +60477,81 @@ var init_hyperliquid_public_read = __esm({
|
|
|
60477
60477
|
minWeight: policy.capacity_min_weight,
|
|
60478
60478
|
recoveryPerMinute: policy.capacity_recovery_weight_per_minute
|
|
60479
60479
|
};
|
|
60480
|
+
READERS_KEY = "vtx:hl-trading-readers:v1";
|
|
60481
|
+
memoryReaders = [];
|
|
60482
|
+
unwrittenReaders = /* @__PURE__ */ new Map();
|
|
60483
|
+
validSchedule = (schedule) => Number.isFinite(schedule.loopMs) && schedule.loopMs > 0 && Number.isFinite(schedule.cycleMs) && schedule.cycleMs >= 0 && Number.isFinite(schedule.startedAt) && (schedule.firstCycleEndedAt == null || Number.isFinite(schedule.firstCycleEndedAt)) && (schedule.offCadenceAt == null || Number.isFinite(schedule.offCadenceAt));
|
|
60484
|
+
readTradingReaders = (now) => {
|
|
60485
|
+
let readers = memoryReaders;
|
|
60486
|
+
try {
|
|
60487
|
+
const stored = JSON.parse(storage()?.getItem(READERS_KEY) ?? "null");
|
|
60488
|
+
if (Array.isArray(stored) && stored.every((reader) => typeof reader?.id === "string" && Number.isFinite(reader.until) && Number.isFinite(reader.notedAt) && (reader.schedule === void 0 || typeof reader.schedule === "object" && reader.schedule !== null && validSchedule(reader.schedule)))) {
|
|
60489
|
+
readers = stored.filter((reader) => {
|
|
60490
|
+
const own = unwrittenReaders.get(reader.id);
|
|
60491
|
+
return own === void 0 || own !== null && reader.notedAt > own.notedAt;
|
|
60492
|
+
});
|
|
60493
|
+
for (const [id2, own] of unwrittenReaders) {
|
|
60494
|
+
if (own && !readers.some((reader) => reader.id === id2)) readers.push(own);
|
|
60495
|
+
}
|
|
60496
|
+
}
|
|
60497
|
+
} catch {
|
|
60498
|
+
}
|
|
60499
|
+
return readers.filter((reader) => reader.until > now);
|
|
60500
|
+
};
|
|
60501
|
+
noteTradingReader = async (id2, entry) => {
|
|
60502
|
+
if (hostTransport) return;
|
|
60503
|
+
await withBudgetLock(READERS_KEY, void 0, () => {
|
|
60504
|
+
const now = Date.now();
|
|
60505
|
+
const added = entry ? entry(now) : null;
|
|
60506
|
+
const readers = readTradingReaders(now).filter((reader) => reader.id !== id2);
|
|
60507
|
+
if (added) readers.push(added);
|
|
60508
|
+
memoryReaders = readers;
|
|
60509
|
+
try {
|
|
60510
|
+
const target = storage();
|
|
60511
|
+
if (!target) return;
|
|
60512
|
+
target.setItem(READERS_KEY, JSON.stringify(readers));
|
|
60513
|
+
unwrittenReaders.clear();
|
|
60514
|
+
} catch {
|
|
60515
|
+
unwrittenReaders.set(id2, added);
|
|
60516
|
+
}
|
|
60517
|
+
});
|
|
60518
|
+
};
|
|
60519
|
+
noteHyperliquidTradingRuntime = (id2, schedule) => noteTradingReader(
|
|
60520
|
+
id2,
|
|
60521
|
+
schedule && ((now) => ({ id: id2, schedule, notedAt: now, until: now + schedule.loopMs + schedule.cycleMs + capacityPolicy.horizonMs }))
|
|
60522
|
+
);
|
|
60523
|
+
noteHyperliquidUnscheduledTradingRead = (id2) => noteTradingReader(
|
|
60524
|
+
id2,
|
|
60525
|
+
(now) => ({ id: id2, notedAt: now, until: now + capacityPolicy.horizonMs })
|
|
60526
|
+
);
|
|
60527
|
+
hyperliquidDemandWindowMs = () => capacityPolicy.windowMs;
|
|
60528
|
+
greatestCommonDivisor = (left, right) => {
|
|
60529
|
+
let [a, b3] = [left, right];
|
|
60530
|
+
while (b3 !== 0) [a, b3] = [b3, a % b3];
|
|
60531
|
+
return a;
|
|
60532
|
+
};
|
|
60533
|
+
heldDemand = (buckets, now, readers) => {
|
|
60534
|
+
const schedules = readers.flatMap((reader) => reader.schedule ? [reader.schedule] : []);
|
|
60535
|
+
if (schedules.length === 0 || schedules.length < readers.length) return buckets;
|
|
60536
|
+
let linedUpMs = schedules[0].loopMs;
|
|
60537
|
+
for (const { loopMs } of schedules) {
|
|
60538
|
+
linedUpMs = linedUpMs / greatestCommonDivisor(linedUpMs, loopMs) * loopMs;
|
|
60539
|
+
if (linedUpMs >= capacityPolicy.horizonMs) return buckets;
|
|
60540
|
+
}
|
|
60541
|
+
const releaseAfterMs = linedUpMs + Math.max(...schedules.map((schedule) => schedule.loopMs)) + Math.max(...schedules.map((schedule) => schedule.cycleMs)) + capacityPolicy.windowMs;
|
|
60542
|
+
if (releaseAfterMs >= capacityPolicy.horizonMs) return buckets;
|
|
60543
|
+
const offCadenceAt = Math.max(0, ...schedules.map((schedule) => schedule.offCadenceAt ?? 0));
|
|
60544
|
+
const startups = schedules.map((schedule) => ({
|
|
60545
|
+
from: schedule.startedAt,
|
|
60546
|
+
to: Math.min(schedule.firstCycleEndedAt ?? now, schedule.startedAt + schedule.loopMs + schedule.cycleMs)
|
|
60547
|
+
}));
|
|
60548
|
+
return buckets.filter((bucket) => {
|
|
60549
|
+
const bucketStart = bucket.index * capacityPolicy.bucketMs;
|
|
60550
|
+
const bucketEnd = bucketStart + capacityPolicy.bucketMs;
|
|
60551
|
+
const startup = startups.some(({ from, to }) => from < bucketEnd && to > bucketStart - capacityPolicy.windowMs);
|
|
60552
|
+
return !startup || now < Math.max(bucketEnd, offCadenceAt) + releaseAfterMs;
|
|
60553
|
+
});
|
|
60554
|
+
};
|
|
60480
60555
|
isHeldBack = (rank) => rank >= priorityRank("ui");
|
|
60481
60556
|
reservationRank = (entry) => entry.rank ?? mostUrgentRank;
|
|
60482
60557
|
classBoundaries = Array.from({ length: lastRank - mostUrgentRank + 1 }, (_unused, offset) => mostUrgentRank + 1 + offset);
|
|
@@ -60495,7 +60570,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
60495
60570
|
foldDemand = (budget, now) => {
|
|
60496
60571
|
const foldUpTo = now - capacityPolicy.windowMs;
|
|
60497
60572
|
const foldedUpTo = Math.min(budget.folded ?? 0, foldUpTo);
|
|
60498
|
-
const oldest = publicDemandBucketIndex(now
|
|
60573
|
+
const oldest = publicDemandBucketIndex(now - capacityPolicy.horizonMs, capacityPolicy.bucketMs);
|
|
60499
60574
|
const demand = (budget.demand ?? []).filter((entry) => entry[0] >= oldest);
|
|
60500
60575
|
for (const reservation of budget.reservations) {
|
|
60501
60576
|
if (reservation.at <= foldedUpTo || reservation.at > foldUpTo) continue;
|
|
@@ -60528,14 +60603,13 @@ var init_hyperliquid_public_read = __esm({
|
|
|
60528
60603
|
const live = budget.reservations.filter((entry) => entry.at > now - capacityPolicy.windowMs);
|
|
60529
60604
|
const total = live.reduce((sum, entry) => sum + entry.weight, 0);
|
|
60530
60605
|
const rankAndBelow = (fromRank) => live.filter((entry) => reservationRank(entry) >= fromRank).reduce((sum, entry) => sum + entry.weight, 0);
|
|
60606
|
+
const readers = readTradingReaders(now);
|
|
60531
60607
|
const above = (fromRank) => {
|
|
60532
|
-
const
|
|
60533
|
-
|
|
60534
|
-
|
|
60535
|
-
|
|
60536
|
-
|
|
60537
|
-
});
|
|
60538
|
-
return { capacity: Math.min(computed.capacity, policy.max_weight), peakHigher: computed.peakHigher };
|
|
60608
|
+
const buckets = demandFor(budget, fromRank, now);
|
|
60609
|
+
const lastFailureMs = budget.lastFailure ?? 0;
|
|
60610
|
+
const computed = adaptivePublicCapacity({ nowMs: now, lastFailureMs, buckets, policy: capacityPolicy });
|
|
60611
|
+
const held = adaptivePublicCapacity({ nowMs: now, lastFailureMs, buckets: heldDemand(buckets, now, readers), policy: capacityPolicy });
|
|
60612
|
+
return { capacity: Math.min(computed.capacity, policy.max_weight), peakHigher: held.peakHigher };
|
|
60539
60613
|
};
|
|
60540
60614
|
const own = above(rank);
|
|
60541
60615
|
const uiRank = priorityRank("ui");
|
|
@@ -110187,6 +110261,7 @@ var init_runtime_execution = __esm({
|
|
|
110187
110261
|
}
|
|
110188
110262
|
const ownGroups = groups.filter((group) => group.pendingEntry != null && group.walletAddress === walletAddress.toLowerCase());
|
|
110189
110263
|
if (ownGroups.length === 0) return [];
|
|
110264
|
+
input.beforeRead?.();
|
|
110190
110265
|
const sizeDecimals = await resolveExchangeSizeDecimals(symbol2, input.config, "trading_reconcile");
|
|
110191
110266
|
const request = {
|
|
110192
110267
|
mutationAuthority: "manual_session",
|
|
@@ -112581,6 +112656,7 @@ var init_server_protection_sweep = __esm({
|
|
|
112581
112656
|
init_runtime_policy_generated2();
|
|
112582
112657
|
init_protective_cutover();
|
|
112583
112658
|
init_protective_evidence();
|
|
112659
|
+
init_hyperliquid_public_read();
|
|
112584
112660
|
sweepServerOwnedProtectionOnce = async (input) => {
|
|
112585
112661
|
const authority = input.authority;
|
|
112586
112662
|
const listed = await listClientProtectiveActions(
|
|
@@ -112609,6 +112685,7 @@ var init_server_protection_sweep = __esm({
|
|
|
112609
112685
|
})) {
|
|
112610
112686
|
return evidenceSweepAt(null);
|
|
112611
112687
|
}
|
|
112688
|
+
void noteHyperliquidUnscheduledTradingRead(`server-owned-protection:${input.profileId}`).catch(() => void 0);
|
|
112612
112689
|
const config2 = await getLLMConfig(void 0, Number(input.profileId), input.signal);
|
|
112613
112690
|
const result = await syncServerOwnedProtection({
|
|
112614
112691
|
profileId: input.profileId,
|
|
@@ -128676,7 +128753,7 @@ ${reviewOutputContract}`;
|
|
|
128676
128753
|
});
|
|
128677
128754
|
|
|
128678
128755
|
// lib/runtime/engine.ts
|
|
128679
|
-
var DEVICE_DIAGNOSTICS3, FALLBACK_ERROR_MAX_CHARS, localAnalysis, getExchangeFailureDiagnostics, getRuntimeFallbackAttempts, sentInvocationAttemptCount, boundRuntimeFallbackAttempts, isProviderFailureDiagnosticsCandidate, getEventBoundProviderLabel, getEventBoundProviderTraceId, CLIENT_RUNTIME_POLICY, getRecentProviderFailureDiagnostics, getClientRuntimeErrorProvenance, getRuntimeProviderSetupDiagnostics, buildProviderSetupErrorDiagnosticFields, buildClientRuntimeErrorProvenanceDiagnosticFields, buildRuntimeRequestErrorDiagnosticFields, getCycleErrorModelCalls, isReturnedModelCall, hasEventBoundProviderFailureEvidence, endsWithNeverSentAttempt, classifyRuntimeErrorStage, buildHyperliquidPublicReadDiagnosticFields, buildRuntimeErrorDiagnostics, positiveNumber, resolveRuntimeEngineOptions, withServerPositionEvents, CLIENT_KILLSWITCH_BLOCK_STORAGE_PREFIX, getClientKillswitchBlockStorageKey, isClientRuntimeKillswitchBlocked, persistClientRuntimeKillswitchBlock, clearClientRuntimeKillswitchBlock, hashRuntimeDebugText2, createRuntimeUuid2, getRuntimeContractIdentityToken, getRuntimeStatusContractIdentityToken, getRuntimeContractBindingTokenFromCycleResult, getRuntimeContractBindingTupleToken, getRuntimeStatusContractBindingTupleToken, isTransientRuntimeConflictError, createRuntimeStartCancelledError, isRuntimeContractMismatchError, isClientExecutionModeMismatchError, isClientRuntimeSessionStoppedError, isClientRuntimeLeaseAuthError, isClientRuntimeReleasedError, deriveFailedStartCleanupOwnershipLossReason, isRuntimeAbortError, isExplicitClientExecutionMode, createStopAbortError, isRuntimeContractIdentityAdvancedAbort, CLIENT_RUNTIME_NO_DECISION_RECOVERY_REASON, sanitizeSettingsSnapshotForFallback, preflightClientRuntime, ClientExecutionEngine, createStoppedRuntimeSnapshot, ClientRuntimeRegistry, botEngine;
|
|
128756
|
+
var DEVICE_DIAGNOSTICS3, FALLBACK_ERROR_MAX_CHARS, localAnalysis, getExchangeFailureDiagnostics, getRuntimeFallbackAttempts, sentInvocationAttemptCount, boundRuntimeFallbackAttempts, isProviderFailureDiagnosticsCandidate, getEventBoundProviderLabel, getEventBoundProviderTraceId, CLIENT_RUNTIME_POLICY, getRecentProviderFailureDiagnostics, getClientRuntimeErrorProvenance, getRuntimeProviderSetupDiagnostics, buildProviderSetupErrorDiagnosticFields, buildClientRuntimeErrorProvenanceDiagnosticFields, buildRuntimeRequestErrorDiagnosticFields, getCycleErrorModelCalls, isReturnedModelCall, hasEventBoundProviderFailureEvidence, endsWithNeverSentAttempt, classifyRuntimeErrorStage, buildHyperliquidPublicReadDiagnosticFields, buildRuntimeErrorDiagnostics, positiveNumber, resolveRuntimeEngineOptions, withServerPositionEvents, CLIENT_KILLSWITCH_BLOCK_STORAGE_PREFIX, getClientKillswitchBlockStorageKey, isClientRuntimeKillswitchBlocked, persistClientRuntimeKillswitchBlock, clearClientRuntimeKillswitchBlock, hashRuntimeDebugText2, createRuntimeUuid2, getRuntimeContractIdentityToken, getRuntimeStatusContractIdentityToken, getRuntimeContractBindingTokenFromCycleResult, getRuntimeContractBindingTupleToken, getRuntimeStatusContractBindingTupleToken, isTransientRuntimeConflictError, createRuntimeStartCancelledError, isRuntimeContractMismatchError, isClientExecutionModeMismatchError, isClientRuntimeSessionStoppedError, isClientRuntimeLeaseAuthError, isClientRuntimeReleasedError, deriveFailedStartCleanupOwnershipLossReason, isRuntimeAbortError, isExplicitClientExecutionMode, createStopAbortError, isRuntimeContractIdentityAdvancedAbort, CLIENT_RUNTIME_NO_DECISION_RECOVERY_REASON, sanitizeSettingsSnapshotForFallback, preflightClientRuntime, onCadenceGridPoint, ClientExecutionEngine, createStoppedRuntimeSnapshot, ClientRuntimeRegistry, botEngine;
|
|
128680
128757
|
var init_engine = __esm({
|
|
128681
128758
|
"lib/runtime/engine.ts"() {
|
|
128682
128759
|
"use strict";
|
|
@@ -128685,6 +128762,7 @@ var init_engine = __esm({
|
|
|
128685
128762
|
init_define_VTX_GROK_POLICY();
|
|
128686
128763
|
init_define_VTX_PI_MODEL_POLICY();
|
|
128687
128764
|
init_protective_cutover();
|
|
128765
|
+
init_hyperliquid_public_read();
|
|
128688
128766
|
init_runtime_policy_generated2();
|
|
128689
128767
|
init_constants();
|
|
128690
128768
|
init_periodic_schedule();
|
|
@@ -129308,6 +129386,10 @@ var init_engine = __esm({
|
|
|
129308
129386
|
requireProviderSecret
|
|
129309
129387
|
};
|
|
129310
129388
|
};
|
|
129389
|
+
onCadenceGridPoint = (atMs, pointMs, loopMs, toleranceMs) => {
|
|
129390
|
+
const offsetMs = Math.abs(atMs - pointMs);
|
|
129391
|
+
return offsetMs <= toleranceMs && offsetMs < Math.abs(atMs - pointMs - loopMs) && offsetMs < Math.abs(atMs - pointMs + loopMs);
|
|
129392
|
+
};
|
|
129311
129393
|
ClientExecutionEngine = class {
|
|
129312
129394
|
constructor() {
|
|
129313
129395
|
this._state = "stopped";
|
|
@@ -129350,6 +129432,20 @@ var init_engine = __esm({
|
|
|
129350
129432
|
this._heartbeatOfflineAfterMs = null;
|
|
129351
129433
|
this._analysisDefaultTimeoutSeconds = null;
|
|
129352
129434
|
this._analysisStaleAfterMs = null;
|
|
129435
|
+
// When this runtime last started (attached a grant), when its first cycle since ended, and
|
|
129436
|
+
// whether its cycles follow Agent instructions (which no loop schedules) rather than its loop.
|
|
129437
|
+
this._startedAtMs = null;
|
|
129438
|
+
this._firstCycleEndedAtMs = null;
|
|
129439
|
+
this._agentDrivenCycles = false;
|
|
129440
|
+
// The latest slot this runtime missed, whether it has no next run, and the
|
|
129441
|
+
// grid its on-cadence runs follow (see _armExecutionLoopTimer).
|
|
129442
|
+
this._lastOffCadenceAtMs = null;
|
|
129443
|
+
this._noNextRun = false;
|
|
129444
|
+
this._cadenceGridMs = null;
|
|
129445
|
+
this._cadenceLoopMs = null;
|
|
129446
|
+
this._cadenceRunMs = null;
|
|
129447
|
+
this._cadencePendingMs = null;
|
|
129448
|
+
this._cycleStartedByTimer = false;
|
|
129353
129449
|
this._settlementRequestTimeoutMs = null;
|
|
129354
129450
|
this._lastSuccessfulHeartbeatAtMs = null;
|
|
129355
129451
|
this._analysisRequestId = null;
|
|
@@ -130227,8 +130323,13 @@ var init_engine = __esm({
|
|
|
130227
130323
|
this._initializeNextRunAnchor();
|
|
130228
130324
|
}
|
|
130229
130325
|
if (this._nextRunAtMs == null && !options?.suppressNextRunProjection && options?.delayOverrideMs == null) {
|
|
130326
|
+
this._noNextRun = true;
|
|
130327
|
+
this._cadenceGridMs = null;
|
|
130328
|
+
this._cadencePendingMs = null;
|
|
130329
|
+
this._noteTradingRuntime();
|
|
130230
130330
|
return;
|
|
130231
130331
|
}
|
|
130332
|
+
this._noNextRun = false;
|
|
130232
130333
|
const rawDelayOverrideMs = options?.delayOverrideMs;
|
|
130233
130334
|
const parsedDelayOverrideMs = Number(rawDelayOverrideMs);
|
|
130234
130335
|
const hasDelayOverride = rawDelayOverrideMs !== null && rawDelayOverrideMs !== void 0 && Number.isFinite(parsedDelayOverrideMs) && parsedDelayOverrideMs >= 0;
|
|
@@ -130236,6 +130337,30 @@ var init_engine = __esm({
|
|
|
130236
130337
|
const timerReason = options?.reason || "scheduled";
|
|
130237
130338
|
const armedAtMs = Date.now();
|
|
130238
130339
|
const expectedFireAtMs = armedAtMs + delayMs;
|
|
130340
|
+
if (this._agentDrivenCycles) {
|
|
130341
|
+
this._cadenceGridMs = null;
|
|
130342
|
+
this._cadencePendingMs = null;
|
|
130343
|
+
} else if (!timerReason.endsWith("_retry")) {
|
|
130344
|
+
const loopMs = this._loopIntervalMs;
|
|
130345
|
+
const toleranceMs = hyperliquidDemandWindowMs();
|
|
130346
|
+
const gridPointMs = this._cadenceGridMs == null ? null : this._cadenceRunMs == null ? this._cadenceGridMs : this._cadenceRunMs + loopMs;
|
|
130347
|
+
const continuesCadence = gridPointMs != null && this._cadenceLoopMs === loopMs && onCadenceGridPoint(expectedFireAtMs, gridPointMs, loopMs, toleranceMs);
|
|
130348
|
+
if (timerReason === "ai_schedule_paused" || !continuesCadence) {
|
|
130349
|
+
const leftGridMs = this._cadenceRunMs ?? this._cadenceGridMs;
|
|
130350
|
+
const leftLoopMs = this._cadenceLoopMs;
|
|
130351
|
+
const lastLeftSlotMs = leftGridMs != null && leftLoopMs != null && expectedFireAtMs > leftGridMs ? leftGridMs + (Math.ceil((expectedFireAtMs - leftGridMs) / leftLoopMs) - 1) * leftLoopMs : expectedFireAtMs - loopMs;
|
|
130352
|
+
this._lastOffCadenceAtMs = Math.max(this._lastOffCadenceAtMs ?? 0, expectedFireAtMs - loopMs, lastLeftSlotMs);
|
|
130353
|
+
}
|
|
130354
|
+
if (continuesCadence) {
|
|
130355
|
+
this._cadencePendingMs = gridPointMs;
|
|
130356
|
+
} else {
|
|
130357
|
+
this._cadenceGridMs = expectedFireAtMs;
|
|
130358
|
+
this._cadenceLoopMs = loopMs;
|
|
130359
|
+
this._cadenceRunMs = null;
|
|
130360
|
+
this._cadencePendingMs = expectedFireAtMs;
|
|
130361
|
+
}
|
|
130362
|
+
}
|
|
130363
|
+
this._noteTradingRuntime();
|
|
130239
130364
|
const quietAgentPollTimer = timerReason === "agent_instruction_poll" || timerReason === "ai_schedule_paused";
|
|
130240
130365
|
if (!quietAgentPollTimer) this._emitLoopBoundaryTelemetry("client_timer_armed", `reason=${options?.reason || "scheduled"} delay_ms=${delayMs}`, {
|
|
130241
130366
|
reason: timerReason,
|
|
@@ -130289,6 +130414,10 @@ var init_engine = __esm({
|
|
|
130289
130414
|
});
|
|
130290
130415
|
return;
|
|
130291
130416
|
}
|
|
130417
|
+
if (actualFireAtMs - expectedFireAtMs > hyperliquidDemandWindowMs()) {
|
|
130418
|
+
this._lastOffCadenceAtMs = Math.max(this._lastOffCadenceAtMs ?? 0, actualFireAtMs);
|
|
130419
|
+
this._noteTradingRuntime();
|
|
130420
|
+
}
|
|
130292
130421
|
if (this._periodicSchedule && !hasDelayOverride && !options?.suppressNextRunProjection) {
|
|
130293
130422
|
const slot = this._periodicNextSlot(actualFireAtMs, true);
|
|
130294
130423
|
if (slot == null || slot > actualFireAtMs) {
|
|
@@ -130307,6 +130436,7 @@ var init_engine = __esm({
|
|
|
130307
130436
|
...timerPayload
|
|
130308
130437
|
});
|
|
130309
130438
|
}
|
|
130439
|
+
this._cycleStartedByTimer = true;
|
|
130310
130440
|
void this._runExecutionLoop();
|
|
130311
130441
|
}, delayMs);
|
|
130312
130442
|
}
|
|
@@ -130459,6 +130589,16 @@ var init_engine = __esm({
|
|
|
130459
130589
|
}
|
|
130460
130590
|
const startController = new AbortController();
|
|
130461
130591
|
this._startAbortController = startController;
|
|
130592
|
+
void noteHyperliquidUnscheduledTradingRead(this._tradingRuntimeKey(profileId)).catch(() => void 0);
|
|
130593
|
+
this._startedAtMs = Date.now();
|
|
130594
|
+
this._firstCycleEndedAtMs = null;
|
|
130595
|
+
this._agentDrivenCycles = false;
|
|
130596
|
+
this._lastOffCadenceAtMs = null;
|
|
130597
|
+
this._noNextRun = false;
|
|
130598
|
+
this._cadenceGridMs = null;
|
|
130599
|
+
this._cadenceLoopMs = null;
|
|
130600
|
+
this._cadenceRunMs = null;
|
|
130601
|
+
this._cadencePendingMs = null;
|
|
130462
130602
|
const attachTask = this._attachInternal(profileId, grant, options, startController);
|
|
130463
130603
|
this._startPromise = attachTask;
|
|
130464
130604
|
try {
|
|
@@ -130467,6 +130607,9 @@ var init_engine = __esm({
|
|
|
130467
130607
|
if (!startController.signal.aborted && this._lifecycleGeneration === lifecycleGenerationAtRequest && getSanitizedRuntimeErrorMessage(error48) !== AI_RUNTIME_START_CANCELLED_MESSAGE) {
|
|
130468
130608
|
this.noteStartupFailure(profileId, grantedMode, error48);
|
|
130469
130609
|
}
|
|
130610
|
+
if (this._profileId !== profileId || this._state !== "running") {
|
|
130611
|
+
void noteHyperliquidTradingRuntime(this._tradingRuntimeKey(profileId), null).catch(() => void 0);
|
|
130612
|
+
}
|
|
130470
130613
|
throw error48;
|
|
130471
130614
|
} finally {
|
|
130472
130615
|
if (this._startPromise === attachTask) {
|
|
@@ -131753,6 +131896,21 @@ var init_engine = __esm({
|
|
|
131753
131896
|
this._analysisRequestId = requestId;
|
|
131754
131897
|
this._analysisStartedAtMs = Number.isFinite(runStartedAtMs) ? runStartedAtMs : Date.now();
|
|
131755
131898
|
this._lastAnalysisStartedAtMs = this._analysisStartedAtMs;
|
|
131899
|
+
const startedByTimer = this._cycleStartedByTimer;
|
|
131900
|
+
this._cycleStartedByTimer = false;
|
|
131901
|
+
this._noteTradingRuntime();
|
|
131902
|
+
const pendingMs = this._cadencePendingMs;
|
|
131903
|
+
const cadenceLoopMs = this._cadenceLoopMs;
|
|
131904
|
+
if (startedByTimer && pendingMs != null && cadenceLoopMs != null) {
|
|
131905
|
+
const startedAtMs = this._analysisStartedAtMs;
|
|
131906
|
+
if (onCadenceGridPoint(startedAtMs, pendingMs, cadenceLoopMs, hyperliquidDemandWindowMs())) {
|
|
131907
|
+
this._cadenceRunMs = pendingMs;
|
|
131908
|
+
} else {
|
|
131909
|
+
const missedMs = startedAtMs > pendingMs ? pendingMs + (Math.ceil((startedAtMs - pendingMs) / cadenceLoopMs) - 1) * cadenceLoopMs : startedAtMs;
|
|
131910
|
+
this._lastOffCadenceAtMs = Math.max(this._lastOffCadenceAtMs ?? 0, missedMs);
|
|
131911
|
+
this._noteTradingRuntime();
|
|
131912
|
+
}
|
|
131913
|
+
}
|
|
131756
131914
|
this._analysisAbortReason = null;
|
|
131757
131915
|
const analysisAbortController = new AbortController();
|
|
131758
131916
|
this._analysisAbortController = analysisAbortController;
|
|
@@ -131776,6 +131934,7 @@ var init_engine = __esm({
|
|
|
131776
131934
|
let executedExchangeOrderInCycle = false;
|
|
131777
131935
|
let pendingExternalInferenceBindings = [];
|
|
131778
131936
|
let agentPollDelayMs = null;
|
|
131937
|
+
let cycleAgentDriven = null;
|
|
131779
131938
|
let aiSchedulePauseMs = null;
|
|
131780
131939
|
let aiSchedulePauseHasNext = false;
|
|
131781
131940
|
let providerRetryDelayMs = null;
|
|
@@ -132059,6 +132218,7 @@ var init_engine = __esm({
|
|
|
132059
132218
|
cycleOutcome = "skipped";
|
|
132060
132219
|
cycleReason = "agent_instruction_poll_empty";
|
|
132061
132220
|
agentPollDelayMs = error48.retryAfterMs;
|
|
132221
|
+
cycleAgentDriven = true;
|
|
132062
132222
|
this._lastRunAt = previousLastRunAt;
|
|
132063
132223
|
this._nextRunAtMs = previousNextRunAtMs;
|
|
132064
132224
|
this._lastError = null;
|
|
@@ -132136,6 +132296,7 @@ var init_engine = __esm({
|
|
|
132136
132296
|
modelSource: result.model_source ?? result.provider
|
|
132137
132297
|
};
|
|
132138
132298
|
agentPollDelayMs = result.agentPollRetryAfterMs ?? null;
|
|
132299
|
+
cycleAgentDriven = result.externalAgentInstruction != null;
|
|
132139
132300
|
pendingExternalInferenceBindings = [...result.externalInferenceBindings ?? []];
|
|
132140
132301
|
if (analysisAbortController.signal.aborted || this._isStopping || this._analysisRequestId !== requestId) {
|
|
132141
132302
|
if (!this._isStopping && this._state !== "stopped" && !decisionSubmitted) {
|
|
@@ -133122,6 +133283,8 @@ var init_engine = __esm({
|
|
|
133122
133283
|
const windowEndWake = aiSchedulePauseMs === null && agentPollDelayMs === null && providerRetryWake === null && windowEndsAtMs != null && windowEndsAtMs > Date.now() && (nextWorkAtMs == null || windowEndsAtMs < nextWorkAtMs) ? windowEndsAtMs - Date.now() : null;
|
|
133123
133284
|
this._aiScheduleCheckPending = windowEndWake !== null;
|
|
133124
133285
|
const manualRunWake = this._manualRunRequested ? 0 : null;
|
|
133286
|
+
this._firstCycleEndedAtMs ??= Date.now();
|
|
133287
|
+
if (cycleAgentDriven !== null) this._agentDrivenCycles = cycleAgentDriven;
|
|
133125
133288
|
this._armExecutionLoopTimer({
|
|
133126
133289
|
alignToNextRun: agentPollDelayMs === null,
|
|
133127
133290
|
delayOverrideMs: manualRunWake ?? aiSchedulePauseMs ?? agentPollDelayMs ?? providerRetryWake ?? windowEndWake,
|
|
@@ -134368,9 +134531,32 @@ var init_engine = __esm({
|
|
|
134368
134531
|
return null;
|
|
134369
134532
|
}
|
|
134370
134533
|
}
|
|
134534
|
+
// One entry per engine instance: a tab that hands a profile over never removes the new owner's.
|
|
134535
|
+
_tradingRuntimeKey(profileId) {
|
|
134536
|
+
return `${profileId}:${this._instanceId}`;
|
|
134537
|
+
}
|
|
134538
|
+
/**
|
|
134539
|
+
* What the device's read admission counts on (hyperliquid-public-read.ts
|
|
134540
|
+
* heldDemand): this runtime's schedule once its first cycle shows it follows
|
|
134541
|
+
* its loop; until then, while Agent instructions drive its cycles, and while
|
|
134542
|
+
* it has no next run, an unscheduled reader.
|
|
134543
|
+
*/
|
|
134544
|
+
_noteTradingRuntime() {
|
|
134545
|
+
if (!this._profileId) return;
|
|
134546
|
+
const key = this._tradingRuntimeKey(this._profileId);
|
|
134547
|
+
const noted = this._loopIntervalMs != null && this._startedAtMs != null && this._analysisStaleAfterMs != null && this._firstCycleEndedAtMs != null && !this._agentDrivenCycles && !this._noNextRun ? noteHyperliquidTradingRuntime(key, {
|
|
134548
|
+
loopMs: this._loopIntervalMs,
|
|
134549
|
+
cycleMs: this._analysisStaleAfterMs,
|
|
134550
|
+
startedAt: this._startedAtMs,
|
|
134551
|
+
firstCycleEndedAt: this._firstCycleEndedAtMs,
|
|
134552
|
+
offCadenceAt: this._lastOffCadenceAtMs
|
|
134553
|
+
}) : noteHyperliquidUnscheduledTradingRead(key);
|
|
134554
|
+
void noted.catch(() => void 0);
|
|
134555
|
+
}
|
|
134371
134556
|
_resetRuntimeState(options) {
|
|
134372
134557
|
this._clearExecutionLoopTimer();
|
|
134373
134558
|
this._clearClientKillswitchMonitor();
|
|
134559
|
+
if (this._profileId) void noteHyperliquidTradingRuntime(this._tradingRuntimeKey(this._profileId), null).catch(() => void 0);
|
|
134374
134560
|
this._profileId = null;
|
|
134375
134561
|
this._sessionId = null;
|
|
134376
134562
|
this._deviceSecrets = null;
|