@tradejs/cli 3.1.8-beta.207 → 3.1.8-beta.212

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/dist/cli.js CHANGED
@@ -2173,9 +2173,9 @@ var init_features = __esm({
2173
2173
  "targetsymbol",
2174
2174
  "universe"
2175
2175
  ]);
2176
- normalizeFeaturePath = (path37) => (Array.isArray(path37) ? path37 : path37.split(".")).filter(Boolean).map((segment) => segment.toLowerCase());
2177
- classifyAiPocketCoverageFeaturePath = (path37) => {
2178
- const segments = normalizeFeaturePath(path37);
2176
+ normalizeFeaturePath = (path36) => (Array.isArray(path36) ? path36 : path36.split(".")).filter(Boolean).map((segment) => segment.toLowerCase());
2177
+ classifyAiPocketCoverageFeaturePath = (path36) => {
2178
+ const segments = normalizeFeaturePath(path36);
2179
2179
  const normalizedPath = segments.join(".");
2180
2180
  if (segments.some(
2181
2181
  (segment) => segment.includes("cmc") || segment.includes("coinmarketcap")
@@ -2349,8 +2349,8 @@ var init_features = __esm({
2349
2349
  "volumeusd",
2350
2350
  "vwap"
2351
2351
  ]);
2352
- classifyAiPocketFeaturePath = (path37) => {
2353
- const segments = (Array.isArray(path37) ? path37 : path37.split(".")).filter(
2352
+ classifyAiPocketFeaturePath = (path36) => {
2353
+ const segments = (Array.isArray(path36) ? path36 : path36.split(".")).filter(
2354
2354
  Boolean
2355
2355
  );
2356
2356
  const normalized = segments.map((segment) => segment.toLowerCase());
@@ -10681,27 +10681,27 @@ var init_coinMarketCapContextBackfill = __esm({
10681
10681
  totalCredits: 0,
10682
10682
  byPath: /* @__PURE__ */ new Map()
10683
10683
  });
10684
- getCoinMarketCapPathLabel = (path37) => {
10685
- if (path37.includes("global-metrics")) return "global";
10686
- if (path37.includes("cryptocurrency/quotes")) return "reference";
10687
- if (path37.includes("exchange/quotes")) return "exchangeLiquidity";
10688
- if (path37.includes("fear-and-greed")) return "fearGreed";
10689
- if (path37.includes("cmc100")) return "cmc100";
10690
- if (path37.includes("cmc20")) return "cmc20";
10691
- return path37;
10692
- };
10693
- recordCoinMarketCapFetchStats = (stats, path37, creditCount) => {
10684
+ getCoinMarketCapPathLabel = (path36) => {
10685
+ if (path36.includes("global-metrics")) return "global";
10686
+ if (path36.includes("cryptocurrency/quotes")) return "reference";
10687
+ if (path36.includes("exchange/quotes")) return "exchangeLiquidity";
10688
+ if (path36.includes("fear-and-greed")) return "fearGreed";
10689
+ if (path36.includes("cmc100")) return "cmc100";
10690
+ if (path36.includes("cmc20")) return "cmc20";
10691
+ return path36;
10692
+ };
10693
+ recordCoinMarketCapFetchStats = (stats, path36, creditCount) => {
10694
10694
  if (!stats) return;
10695
- const existing = stats.byPath.get(path37) ?? { requests: 0, credits: 0 };
10695
+ const existing = stats.byPath.get(path36) ?? { requests: 0, credits: 0 };
10696
10696
  existing.requests += 1;
10697
10697
  existing.credits += creditCount ?? 0;
10698
10698
  stats.requests += 1;
10699
10699
  stats.totalCredits += creditCount ?? 0;
10700
- stats.byPath.set(path37, existing);
10700
+ stats.byPath.set(path36, existing);
10701
10701
  };
10702
10702
  formatCoinMarketCapFetchStats = (stats) => {
10703
10703
  const byPath = [...stats.byPath.entries()].map(
10704
- ([path37, item]) => `${getCoinMarketCapPathLabel(path37)}=${item.requests}req/${item.credits}cr`
10704
+ ([path36, item]) => `${getCoinMarketCapPathLabel(path36)}=${item.requests}req/${item.credits}cr`
10705
10705
  ).join(" ");
10706
10706
  return `apiRequests=${stats.requests} apiCredits=${stats.totalCredits}${byPath ? ` ${byPath}` : ""}`;
10707
10707
  };
@@ -13460,7 +13460,7 @@ var init_workerPool = __esm({
13460
13460
  });
13461
13461
 
13462
13462
  // src/lib/backtest/runnerCore.ts
13463
- var import_fs, import_path5, import_chalk14, import_backtest, import_constants8, import_time3, import_backtestArtifacts, import_redis6, import_runtimeDeployments, import_types4, formatWindowDays, getResultAmount, getResultNetProfit2, recordError, insertTopResult, updateTopResults, updateBestTickerResult, chunkTestSuiteBySymbol, mergePersistedTestSummaries, getLogsById, resolveResultArtifacts, setTestData, persistTestSummariesIndex, validateBacktestRuntimeDeployment, prepareRunEnvironment2, buildPreparedTestSuite, trackTopResult, buildRunIntroLines, resolveTesterWorker, executeTestSuite, printRunOutro;
13463
+ var import_fs, import_path5, import_chalk14, import_backtest, import_constants8, import_time3, import_backtestArtifacts, import_redis6, import_runtimeStrategies, import_types4, formatWindowDays, getResultAmount, getResultNetProfit2, recordError, insertTopResult, updateTopResults, updateBestTickerResult, chunkTestSuiteBySymbol, mergePersistedTestSummaries, getLogsById, resolveResultArtifacts, setTestData, persistTestSummariesIndex, validateBacktestRuntimeDeployment, prepareRunEnvironment2, buildPreparedTestSuite, trackTopResult, buildRunIntroLines, resolveTesterWorker, executeTestSuite, printRunOutro;
13464
13464
  var init_runnerCore = __esm({
13465
13465
  "src/lib/backtest/runnerCore.ts"() {
13466
13466
  "use strict";
@@ -13472,7 +13472,7 @@ var init_runnerCore = __esm({
13472
13472
  import_time3 = require("@tradejs/core/time");
13473
13473
  import_backtestArtifacts = require("@tradejs/infra/backtestArtifacts");
13474
13474
  import_redis6 = require("@tradejs/infra/redis");
13475
- import_runtimeDeployments = require("@tradejs/infra/runtimeDeployments");
13475
+ import_runtimeStrategies = require("@tradejs/node/runtimeStrategies");
13476
13476
  import_types4 = require("@tradejs/types");
13477
13477
  init_runFormatting();
13478
13478
  init_marketContextPrepare();
@@ -13680,7 +13680,11 @@ var init_runnerCore = __esm({
13680
13680
  };
13681
13681
  prepareRunEnvironment2 = async () => {
13682
13682
  const deployment = validateBacktestRuntimeDeployment({
13683
- deployment: flags5.deployment ? await (0, import_runtimeDeployments.getRuntimeDeployment)(userName, String(flags5.deployment)) : null,
13683
+ deployment: flags5.deployment ? await (0, import_runtimeStrategies.getRuntimeDeployment)({
13684
+ userName,
13685
+ projectRoot: projectRoot3,
13686
+ deploymentId: String(flags5.deployment)
13687
+ }) : null,
13684
13688
  deploymentId: typeof flags5.deployment === "string" ? flags5.deployment : void 0
13685
13689
  });
13686
13690
  const preparedRun = await prepareRunEnvironment({
@@ -23956,7 +23960,7 @@ var init_runtimeSignalsStorage = __esm({
23956
23960
  strategy: signal.strategy,
23957
23961
  timestamp: signal.timestamp,
23958
23962
  ...signal.runtimeConfigId && signal.runtimeConfigId !== "config" ? { runtimeConfigId: signal.runtimeConfigId } : {},
23959
- ...signal.runtimeReleaseVersion ? { runtimeReleaseVersion: signal.runtimeReleaseVersion } : {}
23963
+ ...signal.runtimeVersion ? { runtimeVersion: signal.runtimeVersion } : {}
23960
23964
  });
23961
23965
  shouldStoreRuntimeSignalDiagnostics = (signal) => signal.orderStatus === "completed" || signal.orderStatus === "failed";
23962
23966
  toStoredRuntimeSignal = (signal) => {
@@ -25225,20 +25229,20 @@ async function buildRuntimeLineage({
25225
25229
  projectRoot: projectRoot15,
25226
25230
  strategyName,
25227
25231
  compositionId,
25228
- releaseVersion,
25232
+ version,
25229
25233
  strategyPackageVersion,
25230
25234
  runtimePackageVersion,
25231
25235
  config: config2,
25232
25236
  runContext,
25233
25237
  env = process.env
25234
25238
  }) {
25235
- if (releaseVersion != null) {
25236
- if (!Number.isSafeInteger(releaseVersion) || releaseVersion <= 0) {
25237
- throw new Error(`Invalid runtime releaseVersion: ${releaseVersion}`);
25239
+ if (version != null) {
25240
+ if (!Number.isSafeInteger(version) || version <= 0) {
25241
+ throw new Error(`Invalid runtime strategy version: ${version}`);
25238
25242
  }
25239
25243
  return {
25240
25244
  schemaVersion: 2,
25241
- releaseVersion,
25245
+ version,
25242
25246
  strategyPackageVersion,
25243
25247
  runtimePackageVersion,
25244
25248
  maxLossValue: resolveRuntimeMaxLossValue(config2)
@@ -25465,7 +25469,7 @@ var init_runtimeLineage = __esm({
25465
25469
  gateFingerprintCache.set(cacheKey, result);
25466
25470
  return result;
25467
25471
  };
25468
- runtimeLineageKey = (lineage) => lineage.schemaVersion === 2 ? ["v2", lineage.releaseVersion].join(":") : [
25472
+ runtimeLineageKey = (lineage) => lineage.schemaVersion === 2 ? ["v2", lineage.version].join(":") : [
25469
25473
  lineage.schemaVersion,
25470
25474
  lineage.compositionId ?? "unbound-composition",
25471
25475
  lineage.gitSha ?? "unknown",
@@ -26881,8 +26885,8 @@ var init_strategyRelease = __esm({
26881
26885
  return false;
26882
26886
  }
26883
26887
  };
26884
- hasExactRuntimeTarget = (target) => Boolean(
26885
- target?.userName.trim() && target.deploymentId.trim() && target.accountId.trim() && target.strategyConfigName.trim()
26888
+ hasExactRuntimeTarget = (target, strategyName) => Boolean(
26889
+ target?.userName.trim() && target.deploymentId.trim() && target.accountId.trim() && target.strategyName.trim() === strategyName.trim() && Number.isSafeInteger(target.version) && target.version > 0
26886
26890
  );
26887
26891
  deriveStrategyReleaseResearchDecision = async (input) => {
26888
26892
  const blockers = [];
@@ -26967,13 +26971,14 @@ var init_strategyRelease = __esm({
26967
26971
  targetDirection: input.recentFailure?.direction ?? null,
26968
26972
  maxLossValue: 1,
26969
26973
  requiresRuntimeBinding: !hasExactRuntimeTarget(
26970
- input.forwardTest.runtimeTarget
26974
+ input.forwardTest.runtimeTarget,
26975
+ input.strategy
26971
26976
  ),
26972
26977
  blockers: ["FORWARD_NOT_AUTHORIZED"],
26973
26978
  summary: "The candidate is ready for a separately authorized micro-forward test at MAX_LOSS_VALUE=1."
26974
26979
  };
26975
26980
  }
26976
- if (!hasExactRuntimeTarget(input.forwardTest.runtimeTarget)) {
26981
+ if (!hasExactRuntimeTarget(input.forwardTest.runtimeTarget, input.strategy)) {
26977
26982
  return {
26978
26983
  strategy: input.strategy,
26979
26984
  action: "MICRO_FORWARD_READY",
@@ -26982,7 +26987,7 @@ var init_strategyRelease = __esm({
26982
26987
  maxLossValue: 1,
26983
26988
  requiresRuntimeBinding: true,
26984
26989
  blockers: [],
26985
- summary: "The portable micro-forward handoff is ready. Bind it on the runtime server to that server's deployment/account ids and verify canonical composition fingerprints there."
26990
+ summary: "The portable micro-forward handoff is ready. Commit its deployment, account binding, complete config, and explicit strategy version in TradeJS-Project."
26986
26991
  };
26987
26992
  }
26988
26993
  return {
@@ -28082,45 +28087,32 @@ var init_runtimeScorecard2 = __esm({
28082
28087
  }
28083
28088
  });
28084
28089
 
28085
- // src/scripts/runtimeConfig.ts
28086
- var runtimeConfig_exports = {};
28087
- __export(runtimeConfig_exports, {
28088
- RUNTIME_CONFIG_ACTIONS: () => RUNTIME_CONFIG_ACTIONS,
28089
- buildProvisionedRuntimeDeployment: () => buildProvisionedRuntimeDeployment,
28090
- isEquivalentRuntimeStrategyRelease: () => isEquivalentRuntimeStrategyRelease,
28090
+ // src/scripts/runtimeControl.ts
28091
+ var runtimeControl_exports = {};
28092
+ __export(runtimeControl_exports, {
28093
+ RUNTIME_CONTROL_ACTIONS: () => RUNTIME_CONTROL_ACTIONS,
28091
28094
  main: () => main37,
28092
- pointRuntimeDeploymentAtRelease: () => pointRuntimeDeploymentAtRelease,
28093
- resolveProvisionConnectorName: () => resolveProvisionConnectorName,
28094
- runtimeConfig: () => runtimeConfig
28095
+ runtimeControl: () => runtimeControl
28095
28096
  });
28096
- var import_config9, import_promises28, import_node_path23, import_node_util2, import_runtimeDeployments2, import_runtimeStrategyReleases, import_runtimeStrategies, import_strategies11, argv, RUNTIME_CONFIG_ACTIONS, action, option, hasFlag, required2, projectRoot12, userName2, OPERATIONAL_CONFIG_KEYS, resolveProvisionConnectorName, requireRuntimePackageIdentity, toReleaseConfig, publish, buildProvisionedRuntimeDeployment, isEquivalentRuntimeStrategyRelease, pointRuntimeDeploymentAtRelease, provision, rollout, updateControlState, rollback, verify, inspect, runtimeConfig, main37;
28097
- var init_runtimeConfig = __esm({
28098
- "src/scripts/runtimeConfig.ts"() {
28097
+ var import_config9, import_runtimeControls, import_runtimeStrategies2, argv, RUNTIME_CONTROL_ACTIONS, action, option, required2, projectRoot12, userName2, verify, inspect, updateControlState, runtimeControl, main37;
28098
+ var init_runtimeControl = __esm({
28099
+ "src/scripts/runtimeControl.ts"() {
28099
28100
  "use strict";
28100
28101
  import_config9 = require("dotenv/config");
28101
- import_promises28 = require("fs/promises");
28102
- import_node_path23 = __toESM(require("path"));
28103
- import_node_util2 = require("util");
28104
- import_runtimeDeployments2 = require("@tradejs/infra/runtimeDeployments");
28105
- import_runtimeStrategyReleases = require("@tradejs/infra/runtimeStrategyReleases");
28106
- import_runtimeStrategies = require("@tradejs/node/runtimeStrategies");
28107
- import_strategies11 = require("@tradejs/node/strategies");
28102
+ import_runtimeControls = require("@tradejs/infra/runtimeControls");
28103
+ import_runtimeStrategies2 = require("@tradejs/node/runtimeStrategies");
28108
28104
  argv = process.argv.slice(2);
28109
- RUNTIME_CONFIG_ACTIONS = [
28105
+ RUNTIME_CONTROL_ACTIONS = [
28110
28106
  "inspect",
28111
28107
  "verify",
28112
- "provision",
28113
- "rollout",
28114
28108
  "pause",
28115
- "resume",
28116
- "rollback"
28109
+ "resume"
28117
28110
  ];
28118
28111
  action = argv[0] ?? "inspect";
28119
28112
  option = (name) => {
28120
28113
  const index = argv.indexOf(`--${name}`);
28121
28114
  return index >= 0 ? argv[index + 1] : void 0;
28122
28115
  };
28123
- hasFlag = (name) => argv.includes(`--${name}`);
28124
28116
  required2 = (name) => {
28125
28117
  const value = String(option(name) ?? "").trim();
28126
28118
  if (!value) throw new Error(`--${name} is required`);
@@ -28128,319 +28120,34 @@ var init_runtimeConfig = __esm({
28128
28120
  };
28129
28121
  projectRoot12 = String(process.env.PROJECT_CWD || process.cwd()).trim() || process.cwd();
28130
28122
  userName2 = String(option("user") ?? process.env.USER_NAME ?? "root");
28131
- OPERATIONAL_CONFIG_KEYS = [
28132
- "ACCOUNT_ID",
28133
- "AI_REPLAY_ANALYSES",
28134
- "DEPLOYMENT_ID",
28135
- "ENABLE",
28136
- "ENV",
28137
- "MAKE_ORDERS",
28138
- "RECORD_RUNTIME_TRADES"
28139
- ];
28140
- resolveProvisionConnectorName = (value) => {
28141
- const connectorName = String(value ?? "").trim();
28142
- if (!connectorName) throw new Error("--connector is required");
28143
- return connectorName;
28144
- };
28145
- requireRuntimePackageIdentity = (strategyName, metadata) => {
28146
- if (!metadata.strategyPackage || !metadata.strategyPackageVersion || !metadata.runtimePackageVersion) {
28147
- throw new Error(
28148
- `Runtime package manifest is incomplete for ${strategyName}`
28149
- );
28150
- }
28151
- return {
28152
- strategyPackage: metadata.strategyPackage,
28153
- strategyPackageVersion: metadata.strategyPackageVersion,
28154
- runtimePackageVersion: metadata.runtimePackageVersion
28155
- };
28156
- };
28157
- toReleaseConfig = async (strategyName, sourceConfig) => {
28158
- const defaults = await (0, import_strategies11.getStrategyDefaults)(strategyName, projectRoot12) ?? {};
28159
- const config2 = { ...defaults, ...sourceConfig };
28160
- for (const key of OPERATIONAL_CONFIG_KEYS) delete config2[key];
28161
- return config2;
28162
- };
28163
- publish = async ({
28164
- strategyName,
28165
- sourceConfig
28166
- }) => {
28167
- const config2 = await toReleaseConfig(strategyName, sourceConfig);
28168
- const metadata = await (0, import_runtimeStrategies.getRuntimeStrategyPackageMetadata)({
28169
- strategyName,
28170
- projectRoot: projectRoot12
28171
- });
28172
- const packageIdentity = requireRuntimePackageIdentity(strategyName, metadata);
28173
- return (0, import_runtimeStrategyReleases.publishRuntimeStrategyRelease)({
28174
- userName: userName2,
28175
- strategyName,
28176
- config: config2,
28177
- ...packageIdentity,
28178
- createdBy: `cli:${userName2}`
28179
- });
28180
- };
28181
- buildProvisionedRuntimeDeployment = ({
28182
- deploymentId,
28183
- label,
28184
- connectorName,
28185
- provider,
28186
- accountId,
28187
- strategyName,
28188
- releaseVersion
28189
- }) => ({
28190
- id: deploymentId,
28191
- label,
28192
- connectorName,
28193
- provider,
28194
- accountId,
28195
- enabled: true,
28196
- strategies: [
28197
- {
28198
- strategyName,
28199
- releaseVersion,
28200
- controlState: "entries_paused"
28201
- }
28202
- ]
28203
- });
28204
- isEquivalentRuntimeStrategyRelease = ({
28205
- release,
28206
- config: config2,
28207
- strategyPackage,
28208
- strategyPackageVersion,
28209
- runtimePackageVersion
28210
- }) => Boolean(
28211
- release && (0, import_node_util2.isDeepStrictEqual)(release.config, config2) && release.strategyPackage === strategyPackage && release.strategyPackageVersion === strategyPackageVersion && release.runtimePackageVersion === runtimePackageVersion
28212
- );
28213
- pointRuntimeDeploymentAtRelease = ({
28214
- deployment,
28215
- strategyName,
28216
- releaseVersion
28217
- }) => ({
28218
- ...deployment,
28219
- strategies: deployment.strategies.map(
28220
- (strategy) => strategy.strategyName === strategyName ? {
28221
- strategyName,
28222
- releaseVersion,
28223
- controlState: "entries_paused"
28224
- } : strategy
28225
- )
28226
- });
28227
- provision = async () => {
28228
- const strategyName = required2("strategy");
28229
- const deploymentId = required2("deployment");
28230
- const accountId = required2("account");
28231
- const connectorName = resolveProvisionConnectorName(option("connector"));
28232
- const provider = option("provider") ?? connectorName;
28233
- const label = option("label") ?? deploymentId;
28234
- const configFile = import_node_path23.default.resolve(projectRoot12, required2("file"));
28235
- const sourceConfig = JSON.parse(
28236
- await (0, import_promises28.readFile)(configFile, "utf8")
28237
- );
28238
- const existingDeployment = await (0, import_runtimeDeployments2.getRuntimeDeployment)(userName2, deploymentId);
28239
- if (existingDeployment) {
28240
- throw new Error(
28241
- `Deployment already exists: ${deploymentId}; publish a release and switch its pointer instead`
28242
- );
28243
- }
28244
- const releaseConfig = await toReleaseConfig(strategyName, sourceConfig);
28245
- const previewDeployment = buildProvisionedRuntimeDeployment({
28246
- deploymentId,
28247
- label,
28248
- connectorName,
28249
- provider,
28250
- accountId,
28251
- strategyName,
28252
- releaseVersion: 1
28253
- });
28254
- if (!hasFlag("write")) {
28255
- console.log(
28256
- JSON.stringify(
28257
- {
28258
- dryRun: true,
28259
- releaseConfig,
28260
- deployment: {
28261
- ...previewDeployment,
28262
- strategies: previewDeployment.strategies.map((strategy) => ({
28263
- ...strategy,
28264
- releaseVersion: "<allocated on write>"
28265
- }))
28266
- }
28267
- },
28268
- null,
28269
- 2
28270
- )
28271
- );
28272
- return;
28273
- }
28274
- const release = await publish({ strategyName, sourceConfig });
28275
- const deployment = await (0, import_runtimeDeployments2.saveRuntimeDeployment)(
28276
- userName2,
28277
- buildProvisionedRuntimeDeployment({
28278
- deploymentId,
28279
- label,
28280
- connectorName,
28281
- provider,
28282
- accountId,
28283
- strategyName,
28284
- releaseVersion: release.releaseVersion
28285
- })
28286
- );
28287
- console.log(
28288
- JSON.stringify({ provisioned: true, release, deployment }, null, 2)
28289
- );
28290
- };
28291
- rollout = async () => {
28292
- const strategyName = required2("strategy");
28293
- const deploymentId = required2("deployment");
28294
- const configFile = import_node_path23.default.resolve(projectRoot12, required2("file"));
28295
- const [deployment, sourceConfig] = await Promise.all([
28296
- (0, import_runtimeDeployments2.getRuntimeDeployment)(userName2, deploymentId),
28297
- (0, import_promises28.readFile)(configFile, "utf8").then(
28298
- (value) => JSON.parse(value)
28299
- )
28300
- ]);
28301
- if (!deployment) throw new Error(`Deployment not found: ${deploymentId}`);
28302
- const reference = deployment.strategies.find(
28303
- (strategy) => strategy.strategyName === strategyName
28304
- );
28305
- if (!reference)
28306
- throw new Error(`${strategyName} is not bound to ${deploymentId}`);
28307
- const [config2, metadata, currentRelease] = await Promise.all([
28308
- toReleaseConfig(strategyName, sourceConfig),
28309
- (0, import_runtimeStrategies.getRuntimeStrategyPackageMetadata)({ strategyName, projectRoot: projectRoot12 }),
28310
- (0, import_runtimeStrategyReleases.getRuntimeStrategyRelease)(userName2, strategyName, reference.releaseVersion)
28311
- ]);
28312
- const packageIdentity = requireRuntimePackageIdentity(strategyName, metadata);
28313
- const unchanged = isEquivalentRuntimeStrategyRelease({
28314
- release: currentRelease,
28315
- config: config2,
28316
- ...packageIdentity
28317
- });
28318
- const preview = {
28319
- deploymentId,
28320
- strategyName,
28321
- currentReleaseVersion: reference.releaseVersion,
28322
- nextControlState: "entries_paused",
28323
- unchanged,
28324
- config: config2,
28325
- ...packageIdentity
28326
- };
28327
- if (!hasFlag("write")) {
28328
- console.log(JSON.stringify({ dryRun: true, ...preview }, null, 2));
28329
- return;
28330
- }
28331
- if (unchanged) {
28332
- console.log(
28333
- JSON.stringify(
28334
- {
28335
- rolledOut: false,
28336
- reason: "release_config_and_packages_unchanged",
28337
- release: currentRelease,
28338
- deployment
28339
- },
28340
- null,
28341
- 2
28342
- )
28343
- );
28344
- return;
28345
- }
28346
- const release = await (0, import_runtimeStrategyReleases.publishRuntimeStrategyRelease)({
28347
- userName: userName2,
28348
- strategyName,
28349
- config: config2,
28350
- ...packageIdentity,
28351
- createdBy: `cli:${userName2}`
28352
- });
28353
- const updatedDeployment = pointRuntimeDeploymentAtRelease({
28354
- deployment,
28355
- strategyName,
28356
- releaseVersion: release.releaseVersion
28357
- });
28358
- await (0, import_runtimeDeployments2.saveRuntimeDeployment)(userName2, updatedDeployment);
28359
- console.log(
28360
- JSON.stringify(
28361
- {
28362
- rolledOut: true,
28363
- release,
28364
- deployment: updatedDeployment
28365
- },
28366
- null,
28367
- 2
28368
- )
28369
- );
28370
- };
28371
- updateControlState = async (nextState) => {
28372
- const strategyName = required2("strategy");
28373
- const deploymentId = required2("deployment");
28374
- const deployment = await (0, import_runtimeDeployments2.getRuntimeDeployment)(userName2, deploymentId);
28375
- if (!deployment) throw new Error(`Deployment not found: ${deploymentId}`);
28376
- const reference = deployment.strategies.find(
28377
- (strategy) => strategy.strategyName === strategyName
28378
- );
28379
- if (!reference)
28380
- throw new Error(`${strategyName} is not bound to ${deploymentId}`);
28381
- const previousState = reference.controlState;
28382
- const updated = await (0, import_runtimeDeployments2.saveRuntimeDeployment)(userName2, {
28383
- ...deployment,
28384
- strategies: deployment.strategies.map(
28385
- (strategy) => strategy.strategyName === strategyName ? { ...strategy, controlState: nextState } : strategy
28386
- )
28387
- });
28388
- const event = previousState === nextState ? null : await (0, import_runtimeStrategyReleases.recordRuntimeStrategyControlEvent)({
28389
- userName: userName2,
28390
- deploymentId,
28391
- strategyName,
28392
- releaseVersion: reference.releaseVersion,
28393
- previousState,
28394
- nextState,
28395
- createdBy: `cli:${userName2}`
28396
- });
28397
- console.log(JSON.stringify({ deployment: updated, event }, null, 2));
28398
- };
28399
- rollback = async () => {
28400
- const strategyName = required2("strategy");
28401
- const deploymentId = required2("deployment");
28402
- const releaseVersion = Number(required2("release"));
28403
- if (!Number.isSafeInteger(releaseVersion) || releaseVersion <= 0) {
28404
- throw new Error("--release must be a positive integer");
28405
- }
28406
- const deployment = await (0, import_runtimeDeployments2.getRuntimeDeployment)(userName2, deploymentId);
28407
- if (!deployment) throw new Error(`Deployment not found: ${deploymentId}`);
28408
- const release = (await (0, import_runtimeStrategyReleases.listRuntimeStrategyReleases)(userName2, strategyName)).find((candidate) => candidate.releaseVersion === releaseVersion);
28409
- if (!release)
28410
- throw new Error(`Release not found: ${strategyName} v${releaseVersion}`);
28411
- const updated = await (0, import_runtimeDeployments2.saveRuntimeDeployment)(userName2, {
28412
- ...deployment,
28413
- strategies: deployment.strategies.map(
28414
- (strategy) => strategy.strategyName === strategyName ? {
28415
- strategyName,
28416
- releaseVersion,
28417
- controlState: "entries_paused"
28418
- } : strategy
28419
- )
28420
- });
28421
- console.log(JSON.stringify({ deployment: updated }, null, 2));
28422
- };
28423
28123
  verify = async () => {
28424
- const deployments = await (0, import_runtimeDeployments2.listRuntimeDeployments)(userName2);
28425
- const selected = option("deployment") ? deployments.filter((deployment) => deployment.id === option("deployment")) : deployments;
28124
+ const deployments = await (0, import_runtimeStrategies2.listRuntimeDeployments)({ userName: userName2, projectRoot: projectRoot12 });
28125
+ const requestedDeployment = option("deployment");
28126
+ const selected = requestedDeployment ? deployments.filter((deployment) => deployment.id === requestedDeployment) : deployments;
28127
+ if (requestedDeployment && !selected.length) {
28128
+ throw new Error(`Runtime deployment not found: ${requestedDeployment}`);
28129
+ }
28426
28130
  const results2 = [];
28427
28131
  for (const deployment of selected) {
28428
28132
  try {
28429
- const strategies = await (0, import_runtimeStrategies.loadResolvedRuntimeStrategies)({
28133
+ const strategies = await (0, import_runtimeStrategies2.loadResolvedRuntimeStrategies)({
28430
28134
  userName: userName2,
28431
28135
  projectRoot: projectRoot12,
28432
- deployment
28136
+ deploymentId: deployment.id
28433
28137
  });
28434
28138
  results2.push({
28435
28139
  deploymentId: deployment.id,
28436
28140
  ok: true,
28437
28141
  strategies: strategies.map((strategy) => ({
28438
28142
  strategyName: strategy.strategyName,
28439
- releaseVersion: strategy.releaseVersion,
28143
+ version: strategy.version,
28440
28144
  controlState: strategy.controlState,
28441
28145
  interval: strategy.interval,
28442
28146
  universe: strategy.universe,
28443
- accountId: strategy.accountId
28147
+ accountId: strategy.accountId,
28148
+ strategyPackage: strategy.strategyPackage,
28149
+ strategyPackageVersion: strategy.strategyPackageVersion,
28150
+ runtimePackageVersion: strategy.runtimePackageVersion
28444
28151
  }))
28445
28152
  });
28446
28153
  } catch (error) {
@@ -28455,24 +28162,86 @@ var init_runtimeConfig = __esm({
28455
28162
  if (results2.some((result) => !result.ok)) process.exitCode = 1;
28456
28163
  };
28457
28164
  inspect = async () => {
28458
- const strategyName = option("strategy");
28459
- const deployments = await (0, import_runtimeDeployments2.listRuntimeDeployments)(userName2);
28460
- const releases = strategyName ? await (0, import_runtimeStrategyReleases.listRuntimeStrategyReleases)(userName2, strategyName) : void 0;
28461
- console.log(JSON.stringify({ userName: userName2, deployments, releases }, null, 2));
28462
- };
28463
- runtimeConfig = async () => {
28464
- if (action === "provision") return provision();
28465
- if (action === "rollout") return rollout();
28165
+ const requestedDeployment = option("deployment");
28166
+ const requestedStrategy = option("strategy");
28167
+ const deployments = (await (0, import_runtimeStrategies2.listRuntimeDeployments)({ userName: userName2, projectRoot: projectRoot12 })).filter(
28168
+ (deployment) => !requestedDeployment || deployment.id === requestedDeployment
28169
+ ).map((deployment) => ({
28170
+ ...deployment,
28171
+ strategies: deployment.strategies.filter(
28172
+ (strategy) => !requestedStrategy || strategy.strategyName === requestedStrategy
28173
+ )
28174
+ }));
28175
+ console.log(JSON.stringify({ userName: userName2, deployments }, null, 2));
28176
+ };
28177
+ updateControlState = async (nextState) => {
28178
+ const deploymentId = required2("deployment");
28179
+ const strategyName = required2("strategy");
28180
+ const deployment = await (0, import_runtimeStrategies2.getRuntimeDeployment)({
28181
+ userName: userName2,
28182
+ projectRoot: projectRoot12,
28183
+ deploymentId
28184
+ });
28185
+ if (!deployment) {
28186
+ throw new Error(`Runtime deployment not found: ${deploymentId}`);
28187
+ }
28188
+ const reference = deployment.strategies.find(
28189
+ (strategy) => strategy.strategyName === strategyName
28190
+ );
28191
+ if (!reference) {
28192
+ throw new Error(`${strategyName} is not declared in ${deploymentId}`);
28193
+ }
28194
+ if (nextState === "active" && (!deployment.enabled || !reference.enabled)) {
28195
+ throw new Error(
28196
+ `${strategyName} is disabled in tradejs.config.ts and cannot be resumed manually`
28197
+ );
28198
+ }
28199
+ const previousState = reference.controlState;
28200
+ if (nextState === "entries_paused") {
28201
+ await (0, import_runtimeControls.pauseRuntimeStrategy)({
28202
+ userName: userName2,
28203
+ deploymentId,
28204
+ strategyName,
28205
+ updatedBy: `cli:${userName2}`
28206
+ });
28207
+ } else {
28208
+ await (0, import_runtimeControls.resumeRuntimeStrategy)({ userName: userName2, deploymentId, strategyName });
28209
+ }
28210
+ const updated = await (0, import_runtimeStrategies2.getRuntimeDeployment)({
28211
+ userName: userName2,
28212
+ projectRoot: projectRoot12,
28213
+ deploymentId
28214
+ });
28215
+ const updatedReference = updated?.strategies.find(
28216
+ (strategy) => strategy.strategyName === strategyName
28217
+ );
28218
+ const event = previousState === nextState ? null : await (0, import_runtimeControls.recordRuntimeStrategyControlEvent)({
28219
+ userName: userName2,
28220
+ deploymentId,
28221
+ strategyName,
28222
+ version: reference.version,
28223
+ previousState,
28224
+ nextState,
28225
+ createdBy: `cli:${userName2}`
28226
+ });
28227
+ console.log(
28228
+ JSON.stringify(
28229
+ { deployment: updated, strategy: updatedReference, event },
28230
+ null,
28231
+ 2
28232
+ )
28233
+ );
28234
+ };
28235
+ runtimeControl = async () => {
28466
28236
  if (action === "verify") return verify();
28467
28237
  if (action === "pause") return updateControlState("entries_paused");
28468
28238
  if (action === "resume") return updateControlState("active");
28469
- if (action === "rollback") return rollback();
28470
28239
  if (action === "inspect") return inspect();
28471
28240
  throw new Error(
28472
- `Usage: tradejs runtime-config ${RUNTIME_CONFIG_ACTIONS.join("|")}`
28241
+ `Usage: tradejs runtime-control ${RUNTIME_CONTROL_ACTIONS.join("|")}`
28473
28242
  );
28474
28243
  };
28475
- main37 = runtimeConfig;
28244
+ main37 = runtimeControl;
28476
28245
  }
28477
28246
  });
28478
28247
 
@@ -28482,14 +28251,14 @@ __export(strategyRelease_exports, {
28482
28251
  main: () => main38,
28483
28252
  runStrategyReleaseCommand: () => runStrategyReleaseCommand
28484
28253
  });
28485
- var import_promises29, import_node_fs5, import_node_readline2, import_node_path24, import_chalk42, valueAfter2, required3, writeJsonAtomic3, runStrategyReleaseCommand, printUsage2, main38;
28254
+ var import_promises28, import_node_fs5, import_node_readline2, import_node_path23, import_chalk42, valueAfter2, required3, writeJsonAtomic3, runStrategyReleaseCommand, printUsage2, main38;
28486
28255
  var init_strategyRelease2 = __esm({
28487
28256
  "src/scripts/strategyRelease.ts"() {
28488
28257
  "use strict";
28489
- import_promises29 = __toESM(require("fs/promises"));
28258
+ import_promises28 = __toESM(require("fs/promises"));
28490
28259
  import_node_fs5 = require("fs");
28491
28260
  import_node_readline2 = require("readline");
28492
- import_node_path24 = __toESM(require("path"));
28261
+ import_node_path23 = __toESM(require("path"));
28493
28262
  import_chalk42 = __toESM(require("chalk"));
28494
28263
  init_strategyRelease();
28495
28264
  valueAfter2 = (argv2, name) => {
@@ -28502,17 +28271,17 @@ var init_strategyRelease2 = __esm({
28502
28271
  };
28503
28272
  writeJsonAtomic3 = async (filePath, value) => {
28504
28273
  const temporaryPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
28505
- await import_promises29.default.mkdir(import_node_path24.default.dirname(filePath), { recursive: true });
28506
- await import_promises29.default.writeFile(
28274
+ await import_promises28.default.mkdir(import_node_path23.default.dirname(filePath), { recursive: true });
28275
+ await import_promises28.default.writeFile(
28507
28276
  temporaryPath,
28508
28277
  `${JSON.stringify(value, null, 2)}
28509
28278
  `,
28510
28279
  "utf8"
28511
28280
  );
28512
- await import_promises29.default.rename(temporaryPath, filePath);
28281
+ await import_promises28.default.rename(temporaryPath, filePath);
28513
28282
  };
28514
28283
  runStrategyReleaseCommand = async (options) => {
28515
- const inputPath = import_node_path24.default.resolve(options.inputPath);
28284
+ const inputPath = import_node_path23.default.resolve(options.inputPath);
28516
28285
  if (options.command === "verify") {
28517
28286
  const envelope = await verifyStrategyReleaseEnvelope(inputPath);
28518
28287
  return {
@@ -28550,7 +28319,7 @@ var init_strategyRelease2 = __esm({
28550
28319
  endTime,
28551
28320
  days: options.days?.length ? options.days : [7, 30, 90]
28552
28321
  });
28553
- const outputPath = import_node_path24.default.resolve(
28322
+ const outputPath = import_node_path23.default.resolve(
28554
28323
  options.outputPath ?? "output/strategy-monitoring-profile.json"
28555
28324
  );
28556
28325
  await writeJsonAtomic3(outputPath, profile);
@@ -28561,22 +28330,22 @@ var init_strategyRelease2 = __esm({
28561
28330
  profile
28562
28331
  };
28563
28332
  }
28564
- const input = JSON.parse(await import_promises29.default.readFile(inputPath, "utf8"));
28333
+ const input = JSON.parse(await import_promises28.default.readFile(inputPath, "utf8"));
28565
28334
  if (options.command === "decide") {
28566
28335
  const decision = await deriveStrategyReleaseResearchDecision(input);
28567
28336
  if (options.outputPath) {
28568
- await writeJsonAtomic3(import_node_path24.default.resolve(options.outputPath), decision);
28337
+ await writeJsonAtomic3(import_node_path23.default.resolve(options.outputPath), decision);
28569
28338
  }
28570
28339
  return {
28571
28340
  kind: "decided",
28572
28341
  ...decision,
28573
- outputPath: options.outputPath ? import_node_path24.default.resolve(options.outputPath) : null
28342
+ outputPath: options.outputPath ? import_node_path23.default.resolve(options.outputPath) : null
28574
28343
  };
28575
28344
  }
28576
28345
  if (options.command === "retention") {
28577
28346
  const plan = planStrategyEvidenceRetention(input);
28578
28347
  if (options.apply) {
28579
- await Promise.all(plan.delete.map((entry) => import_promises29.default.rm(entry.path)));
28348
+ await Promise.all(plan.delete.map((entry) => import_promises28.default.rm(entry.path)));
28580
28349
  }
28581
28350
  return {
28582
28351
  kind: "retention",
@@ -28589,12 +28358,12 @@ var init_strategyRelease2 = __esm({
28589
28358
  }
28590
28359
  if (options.command === "diagnose") {
28591
28360
  const diagnosis = buildStrategyLiveDiagnosis(input);
28592
- const outputPath = import_node_path24.default.resolve(
28361
+ const outputPath = import_node_path23.default.resolve(
28593
28362
  options.outputPath ?? "output/strategy-live-diagnosis.json"
28594
28363
  );
28595
28364
  await writeJsonAtomic3(outputPath, diagnosis);
28596
28365
  const published2 = options.rootDir ? await publishStrategyLiveDiagnosis({
28597
- rootDir: import_node_path24.default.resolve(options.rootDir),
28366
+ rootDir: import_node_path23.default.resolve(options.rootDir),
28598
28367
  diagnosis,
28599
28368
  sourceArtifacts: input.sourceArtifacts ?? []
28600
28369
  }) : null;
@@ -28611,7 +28380,7 @@ var init_strategyRelease2 = __esm({
28611
28380
  evidence: await collectReleaseEvidenceReferences(input.evidence ?? [])
28612
28381
  });
28613
28382
  const published = await publishStrategyRelease({
28614
- rootDir: import_node_path24.default.resolve(options.rootDir ?? "data/strategy-release"),
28383
+ rootDir: import_node_path23.default.resolve(options.rootDir ?? "data/strategy-release"),
28615
28384
  manifest
28616
28385
  });
28617
28386
  return {
@@ -28713,21 +28482,21 @@ var init_serverHealth = __esm({
28713
28482
  }
28714
28483
  return `${minutes}m`;
28715
28484
  };
28716
- readDiskUsage = (path37) => {
28485
+ readDiskUsage = (path36) => {
28717
28486
  try {
28718
- const stats = (0, import_node_fs6.statfsSync)(path37);
28487
+ const stats = (0, import_node_fs6.statfsSync)(path36);
28719
28488
  const totalBlocks = Number(stats.blocks ?? 0);
28720
28489
  const availableBlocks = Number(stats.bavail ?? 0);
28721
28490
  if (totalBlocks <= 0) {
28722
- return { path: path37, usedPct: null };
28491
+ return { path: path36, usedPct: null };
28723
28492
  }
28724
28493
  const usedPct = (totalBlocks - Math.max(0, availableBlocks)) / totalBlocks * 100;
28725
28494
  return {
28726
- path: path37,
28495
+ path: path36,
28727
28496
  usedPct: Number.isFinite(usedPct) ? usedPct : null
28728
28497
  };
28729
28498
  } catch {
28730
- return { path: path37, usedPct: null };
28499
+ return { path: path36, usedPct: null };
28731
28500
  }
28732
28501
  };
28733
28502
  parseMeminfoBytes = (value) => {
@@ -31386,11 +31155,11 @@ var init_hooks = __esm({
31386
31155
  });
31387
31156
 
31388
31157
  // src/lib/signals/runtimeStrategies.ts
31389
- var import_runtimeStrategies2;
31158
+ var import_runtimeStrategies3;
31390
31159
  var init_runtimeStrategies = __esm({
31391
31160
  "src/lib/signals/runtimeStrategies.ts"() {
31392
31161
  "use strict";
31393
- import_runtimeStrategies2 = require("@tradejs/node/runtimeStrategies");
31162
+ import_runtimeStrategies3 = require("@tradejs/node/runtimeStrategies");
31394
31163
  }
31395
31164
  });
31396
31165
 
@@ -31465,12 +31234,12 @@ var init_evaluations = __esm({
31465
31234
  symbol,
31466
31235
  timestamp,
31467
31236
  runtimeConfigId,
31468
- runtimeReleaseVersion
31469
- }) => runtimeReleaseVersion ? [strategyName, `v${runtimeReleaseVersion}`, symbol, timestamp].join(":") : runtimeConfigId && runtimeConfigId !== "config" ? [strategyName, runtimeConfigId, symbol, timestamp].join(":") : [strategyName, symbol, timestamp].join(":");
31237
+ runtimeVersion
31238
+ }) => runtimeVersion ? [strategyName, `v${runtimeVersion}`, symbol, timestamp].join(":") : runtimeConfigId && runtimeConfigId !== "config" ? [strategyName, runtimeConfigId, symbol, timestamp].join(":") : [strategyName, symbol, timestamp].join(":");
31470
31239
  buildLineageField = (scope) => [
31471
31240
  scope.strategy,
31472
31241
  scope.runtimeConfigId ?? "config",
31473
- scope.runtimeReleaseVersion ? `v${scope.runtimeReleaseVersion}` : "legacy",
31242
+ scope.runtimeVersion ? `v${scope.runtimeVersion}` : "legacy",
31474
31243
  scope.symbol,
31475
31244
  runtimeLineageKey(scope.lineage)
31476
31245
  ].join(":");
@@ -31510,7 +31279,7 @@ var init_evaluations = __esm({
31510
31279
  const lineageField = buildLineageField({
31511
31280
  strategy: evaluation.strategy,
31512
31281
  runtimeConfigId: evaluation.runtimeConfigId,
31513
- runtimeReleaseVersion: evaluation.runtimeReleaseVersion,
31282
+ runtimeVersion: evaluation.runtimeVersion,
31514
31283
  symbol: evaluation.symbol,
31515
31284
  lineage: evaluation.runtimeLineage
31516
31285
  });
@@ -31520,7 +31289,7 @@ var init_evaluations = __esm({
31520
31289
  strategy: evaluation.strategy,
31521
31290
  symbol: evaluation.symbol,
31522
31291
  runtimeConfigId: evaluation.runtimeConfigId,
31523
- runtimeReleaseVersion: evaluation.runtimeReleaseVersion,
31292
+ runtimeVersion: evaluation.runtimeVersion,
31524
31293
  lineage: evaluation.runtimeLineage,
31525
31294
  firstTimestamp: Math.min(
31526
31295
  existing?.firstTimestamp ?? evaluation.timestamp,
@@ -31885,7 +31654,7 @@ var init_klineFeed = __esm({
31885
31654
  config: config2,
31886
31655
  interval: interval4,
31887
31656
  universe,
31888
- publish: publish2 = publishMarketKlineEvent,
31657
+ publish = publishMarketKlineEvent,
31889
31658
  persist = async (rows) => {
31890
31659
  const intervalMinutes = Number(interval4);
31891
31660
  await (0, import_candles3.upsertCandles)(
@@ -31936,7 +31705,7 @@ var init_klineFeed = __esm({
31936
31705
  config: config2,
31937
31706
  onEvent: (event) => {
31938
31707
  if (event.interval !== interval4) return;
31939
- void publish2({
31708
+ void publish({
31940
31709
  provider: "bybit",
31941
31710
  universe,
31942
31711
  symbol: event.symbol,
@@ -32000,11 +31769,11 @@ var init_klineFeed = __esm({
32000
31769
  });
32001
31770
 
32002
31771
  // src/lib/signals/tickerEvaluator.ts
32003
- var import_strategies12, import_logger9, createSignalsTickerEvaluator;
31772
+ var import_strategies11, import_logger9, createSignalsTickerEvaluator;
32004
31773
  var init_tickerEvaluator = __esm({
32005
31774
  "src/lib/signals/tickerEvaluator.ts"() {
32006
31775
  "use strict";
32007
- import_strategies12 = require("@tradejs/node/strategies");
31776
+ import_strategies11 = require("@tradejs/node/strategies");
32008
31777
  import_logger9 = require("@tradejs/infra/logger");
32009
31778
  init_windows();
32010
31779
  init_runtimeLineage();
@@ -32069,7 +31838,7 @@ var init_tickerEvaluator = __esm({
32069
31838
  for (const runtimeStrategy of runtimeStrategies) {
32070
31839
  const {
32071
31840
  strategyName,
32072
- releaseVersion,
31841
+ version,
32073
31842
  controlState,
32074
31843
  strategyPackageVersion,
32075
31844
  runtimePackageVersion,
@@ -32077,8 +31846,8 @@ var init_tickerEvaluator = __esm({
32077
31846
  sourceStrategyConfig,
32078
31847
  strategyConfig
32079
31848
  } = runtimeStrategy;
32080
- const runtimeIdentity = `v${releaseVersion}`;
32081
- const runtimeConfig2 = buildRuntimeModeStrategyConfig({
31849
+ const runtimeIdentity = `v${version}`;
31850
+ const runtimeConfig = buildRuntimeModeStrategyConfig({
32082
31851
  strategyConfig,
32083
31852
  env: "CRON",
32084
31853
  interval: interval4,
@@ -32087,7 +31856,7 @@ var init_tickerEvaluator = __esm({
32087
31856
  const runtimeLineage = await buildRuntimeLineage({
32088
31857
  projectRoot: projectRoot15,
32089
31858
  strategyName,
32090
- releaseVersion,
31859
+ version,
32091
31860
  strategyPackageVersion,
32092
31861
  runtimePackageVersion,
32093
31862
  config: { strategyConfig },
@@ -32118,7 +31887,7 @@ var init_tickerEvaluator = __esm({
32118
31887
  evaluation = await lifecycle.evaluate({
32119
31888
  key: lifecycleKey,
32120
31889
  timestamp: lastCandle.timestamp,
32121
- config: { runtimeConfig: runtimeConfig2, sourceStrategyConfig },
31890
+ config: { runtimeConfig, sourceStrategyConfig },
32122
31891
  btcBinanceData,
32123
31892
  btcCoinbaseData,
32124
31893
  onRuntimeClose: (event) => runtimeCloseNotifications.push(event),
@@ -32130,7 +31899,7 @@ var init_tickerEvaluator = __esm({
32130
31899
  userName: userName3,
32131
31900
  connectorName,
32132
31901
  runtimeConfigId: runtimeIdentity,
32133
- runtimeReleaseVersion: releaseVersion,
31902
+ runtimeVersion: version,
32134
31903
  entriesPaused: controlState === "entries_paused",
32135
31904
  runtimeLineage,
32136
31905
  runtimeConfigSnapshot: {
@@ -32150,7 +31919,7 @@ var init_tickerEvaluator = __esm({
32150
31919
  ethData: universe === "crypto" ? previousEthData : [],
32151
31920
  btcBinanceData: lifecycleBtcBinanceData,
32152
31921
  btcCoinbaseData: lifecycleBtcCoinbaseData,
32153
- config: runtimeConfig2,
31922
+ config: runtimeConfig,
32154
31923
  ...persistStrategyState ? { sharedStrategyStateKey: lifecycleKey } : {},
32155
31924
  onRuntimeClose
32156
31925
  }),
@@ -32185,12 +31954,12 @@ var init_tickerEvaluator = __esm({
32185
31954
  symbol,
32186
31955
  timestamp: lastCandle.timestamp,
32187
31956
  runtimeConfigId: runtimeIdentity,
32188
- runtimeReleaseVersion: releaseVersion
31957
+ runtimeVersion: version
32189
31958
  }),
32190
31959
  userName: userName3,
32191
31960
  strategy: strategyName,
32192
31961
  runtimeConfigId: runtimeIdentity,
32193
- runtimeReleaseVersion: releaseVersion,
31962
+ runtimeVersion: version,
32194
31963
  runtimeLineage,
32195
31964
  symbol,
32196
31965
  interval: interval4,
@@ -32198,7 +31967,7 @@ var init_tickerEvaluator = __esm({
32198
31967
  assetClass: instrument?.assetClass,
32199
31968
  accountId,
32200
31969
  deploymentId,
32201
- policyProfileId: runtimeConfig2.POLICY_PROFILE_ID,
31970
+ policyProfileId: runtimeConfig.POLICY_PROFILE_ID,
32202
31971
  timestamp: lastCandle.timestamp,
32203
31972
  evaluatedAt: Date.now(),
32204
31973
  status: "skip",
@@ -32208,12 +31977,12 @@ var init_tickerEvaluator = __esm({
32208
31977
  }
32209
31978
  if (stats) stats.signals += 1;
32210
31979
  signal.runtimeConfigId = runtimeIdentity;
32211
- signal.runtimeReleaseVersion = releaseVersion;
31980
+ signal.runtimeVersion = version;
32212
31981
  signal.runtimeLineage = runtimeLineage;
32213
- if (releaseVersion && !signal.signalId.endsWith(`:v${releaseVersion}`)) {
32214
- signal.signalId = `${signal.signalId}:v${releaseVersion}`;
31982
+ if (version && !signal.signalId.endsWith(`:v${version}`)) {
31983
+ signal.signalId = `${signal.signalId}:v${version}`;
32215
31984
  }
32216
- await (0, import_strategies12.enrichSignalWithBinanceMarketContext)({ signal, env: "CRON" });
31985
+ await (0, import_strategies11.enrichSignalWithBinanceMarketContext)({ signal, env: "CRON" });
32217
31986
  if (signal.orderStatus === "skipped" && typeof signal.orderSkipReason === "string" && signal.orderSkipReason.trim()) {
32218
31987
  recordStrategyReason(
32219
31988
  strategyStats,
@@ -32230,12 +31999,12 @@ var init_tickerEvaluator = __esm({
32230
31999
  symbol,
32231
32000
  timestamp: lastCandle.timestamp,
32232
32001
  runtimeConfigId: runtimeIdentity,
32233
- runtimeReleaseVersion: releaseVersion
32002
+ runtimeVersion: version
32234
32003
  }),
32235
32004
  userName: userName3,
32236
32005
  strategy: strategyName,
32237
32006
  runtimeConfigId: runtimeIdentity,
32238
- runtimeReleaseVersion: releaseVersion,
32007
+ runtimeVersion: version,
32239
32008
  runtimeLineage,
32240
32009
  symbol,
32241
32010
  interval: interval4,
@@ -32268,7 +32037,7 @@ var init_configuredScopes = __esm({
32268
32037
  "src/lib/signals/configuredScopes.ts"() {
32269
32038
  "use strict";
32270
32039
  sorted = (values) => values ? [...values].sort() : [];
32271
- formatConfiguredStrategyIdentity = (strategy) => `${strategy.strategyName}@v${strategy.releaseVersion}[${strategy.controlState}]`;
32040
+ formatConfiguredStrategyIdentity = (strategy) => `${strategy.strategyName}@v${strategy.version}[${strategy.controlState}]`;
32272
32041
  buildConfiguredSignalsScopes = ({
32273
32042
  connectorName,
32274
32043
  deployment,
@@ -32314,7 +32083,7 @@ var init_configuredScopes = __esm({
32314
32083
  });
32315
32084
 
32316
32085
  // src/lib/signals/runner.ts
32317
- var import_progress11, import_chalk45, import_connectors16, import_cli12, import_async5, import_strategies13, import_constants16, import_time8, import_logger10, import_runtimeDeployments3, SLOW_SIGNALS_WARNING_MS, formatDuration3, resolvePositiveInteger2, resolveNonNegativeInteger, createSignalsRunner;
32086
+ var import_progress11, import_chalk45, import_connectors16, import_cli12, import_async5, import_strategies12, import_constants16, import_time8, import_logger10, import_runtimeHeartbeats, import_runtimeStrategies4, SLOW_SIGNALS_WARNING_MS, formatDuration3, resolvePositiveInteger2, resolveNonNegativeInteger, createSignalsRunner;
32318
32087
  var init_runner = __esm({
32319
32088
  "src/lib/signals/runner.ts"() {
32320
32089
  "use strict";
@@ -32323,11 +32092,12 @@ var init_runner = __esm({
32323
32092
  import_connectors16 = require("@tradejs/node/connectors");
32324
32093
  import_cli12 = require("@tradejs/node/cli");
32325
32094
  import_async5 = require("@tradejs/core/async");
32326
- import_strategies13 = require("@tradejs/core/strategies");
32095
+ import_strategies12 = require("@tradejs/core/strategies");
32327
32096
  import_constants16 = require("@tradejs/core/constants");
32328
32097
  import_time8 = require("@tradejs/core/time");
32329
32098
  import_logger10 = require("@tradejs/infra/logger");
32330
- import_runtimeDeployments3 = require("@tradejs/infra/runtimeDeployments");
32099
+ import_runtimeHeartbeats = require("@tradejs/infra/runtimeHeartbeats");
32100
+ import_runtimeStrategies4 = require("@tradejs/node/runtimeStrategies");
32331
32101
  init_windows();
32332
32102
  init_runFormatting();
32333
32103
  init_hooks();
@@ -32379,7 +32149,7 @@ var init_runner = __esm({
32379
32149
  const createDefaultSignalsLifecycle = (runtimeInterval = interval4) => createSignalsStrategyLifecycle({
32380
32150
  intervalMs: Number(runtimeInterval) * 6e4,
32381
32151
  maxLiveBars: resolveSignalsDaemonMaxLiveBars(runtimeInterval),
32382
- releaseState: import_strategies13.releaseStrategyReplayCache
32152
+ releaseState: import_strategies12.releaseStrategyReplayCache
32383
32153
  });
32384
32154
  const timeOperation3 = (label, operation) => timeOperation(
32385
32155
  label,
@@ -32403,13 +32173,14 @@ var init_runner = __esm({
32403
32173
  return connectorName;
32404
32174
  };
32405
32175
  const createSignalsSession2 = async (lifecycle, scope = {}) => {
32406
- const deployment = config2.deploymentId ? await (0, import_runtimeDeployments3.getRuntimeDeployment)(config2.userName, config2.deploymentId) : null;
32176
+ const deployment = config2.deploymentId ? await (0, import_runtimeStrategies4.getRuntimeDeployment)({
32177
+ userName: config2.userName,
32178
+ projectRoot: projectRoot15,
32179
+ deploymentId: config2.deploymentId
32180
+ }) : null;
32407
32181
  if (config2.deploymentId && !deployment) {
32408
32182
  throw new Error(`Runtime deployment not found: ${config2.deploymentId}`);
32409
32183
  }
32410
- if (deployment && !deployment.enabled) {
32411
- throw new Error(`Runtime deployment is disabled: ${deployment.id}`);
32412
- }
32413
32184
  const requestedRuntimeInterval = scope.interval ?? interval4;
32414
32185
  const runtimeInterval = requestedRuntimeInterval;
32415
32186
  const runtimeIntervalMs = Number(runtimeInterval) * 6e4;
@@ -32627,10 +32398,10 @@ var init_runner = __esm({
32627
32398
  const primaryEthByTimestamp = new Map(
32628
32399
  primaryEthClosedData.map((candle) => [candle.timestamp, candle])
32629
32400
  );
32630
- const runtimeStrategies = await (0, import_runtimeStrategies2.loadResolvedRuntimeStrategies)({
32401
+ const runtimeStrategies = await (0, import_runtimeStrategies3.loadResolvedRuntimeStrategies)({
32631
32402
  userName: config2.userName,
32632
32403
  projectRoot: projectRoot15,
32633
- deployment,
32404
+ deploymentId: deployment?.id ?? "",
32634
32405
  universe,
32635
32406
  accountId,
32636
32407
  interval: interval5
@@ -32647,7 +32418,7 @@ var init_runner = __esm({
32647
32418
  new Set(
32648
32419
  tickers.flatMap(
32649
32420
  (symbol) => runtimeStrategies.map(
32650
- ({ strategyName, releaseVersion }) => buildSignalsStrategyLifecycleKey({
32421
+ ({ strategyName, version }) => buildSignalsStrategyLifecycleKey({
32651
32422
  connectorName,
32652
32423
  universe: sessionUniverse,
32653
32424
  accountId,
@@ -32655,7 +32426,7 @@ var init_runner = __esm({
32655
32426
  symbol,
32656
32427
  interval: interval5,
32657
32428
  strategyName,
32658
- configId: `v${releaseVersion}`
32429
+ configId: `v${version}`
32659
32430
  })
32660
32431
  )
32661
32432
  )
@@ -32786,7 +32557,7 @@ var init_runner = __esm({
32786
32557
  }
32787
32558
  const durationMs = Date.now() - startedAt;
32788
32559
  if (activeSession?.deployment) {
32789
- await (0, import_runtimeDeployments3.saveRuntimeDeploymentHeartbeat)(config2.userName, {
32560
+ await (0, import_runtimeHeartbeats.saveRuntimeDeploymentHeartbeat)(config2.userName, {
32790
32561
  deploymentId: activeSession.deployment.id,
32791
32562
  status: getSignalsHeartbeatStatus({
32792
32563
  cycleStatus: status,
@@ -32841,10 +32612,10 @@ var init_runner = __esm({
32841
32612
  }
32842
32613
  };
32843
32614
  const loadConfiguredSignalsScopes = async (deployment) => {
32844
- const configuredStrategies = await (0, import_runtimeStrategies2.loadResolvedRuntimeStrategies)({
32615
+ const configuredStrategies = await (0, import_runtimeStrategies3.loadResolvedRuntimeStrategies)({
32845
32616
  userName: config2.userName,
32846
32617
  projectRoot: projectRoot15,
32847
- deployment
32618
+ deploymentId: deployment.id
32848
32619
  });
32849
32620
  const connectorName = await resolveSignalsConnectorName(
32850
32621
  deployment.connectorName
@@ -32864,10 +32635,11 @@ var init_runner = __esm({
32864
32635
  if (!config2.deploymentId) {
32865
32636
  throw new Error("Runtime deployment id is required");
32866
32637
  }
32867
- const configuredDeployment = await (0, import_runtimeDeployments3.getRuntimeDeployment)(
32868
- config2.userName,
32869
- config2.deploymentId
32870
- );
32638
+ const configuredDeployment = await (0, import_runtimeStrategies4.getRuntimeDeployment)({
32639
+ userName: config2.userName,
32640
+ projectRoot: projectRoot15,
32641
+ deploymentId: config2.deploymentId
32642
+ });
32871
32643
  if (!configuredDeployment) {
32872
32644
  throw new Error(`Runtime deployment not found: ${config2.deploymentId}`);
32873
32645
  }
@@ -32897,10 +32669,11 @@ var init_runner = __esm({
32897
32669
  throw new Error("Runtime deployment id is required");
32898
32670
  }
32899
32671
  const deploymentId = config2.deploymentId;
32900
- const initialDeployment = await (0, import_runtimeDeployments3.getRuntimeDeployment)(
32901
- config2.userName,
32672
+ const initialDeployment = await (0, import_runtimeStrategies4.getRuntimeDeployment)({
32673
+ userName: config2.userName,
32674
+ projectRoot: projectRoot15,
32902
32675
  deploymentId
32903
- );
32676
+ });
32904
32677
  if (!initialDeployment) {
32905
32678
  throw new Error(`Runtime deployment not found: ${deploymentId}`);
32906
32679
  }
@@ -32921,10 +32694,11 @@ var init_runner = __esm({
32921
32694
  settleDelayMs: resolveNonNegativeInteger(config2.settleDelayMs, 5e3),
32922
32695
  signal: abortController.signal,
32923
32696
  runCycle: async () => {
32924
- const currentDeployment = await (0, import_runtimeDeployments3.getRuntimeDeployment)(
32925
- config2.userName,
32697
+ const currentDeployment = await (0, import_runtimeStrategies4.getRuntimeDeployment)({
32698
+ userName: config2.userName,
32699
+ projectRoot: projectRoot15,
32926
32700
  deploymentId
32927
- );
32701
+ });
32928
32702
  if (!currentDeployment) {
32929
32703
  throw new Error(`Runtime deployment not found: ${deploymentId}`);
32930
32704
  }
@@ -33004,7 +32778,7 @@ var init_runner = __esm({
33004
32778
  await session.klineFeed?.close();
33005
32779
  session.lifecycle.clear();
33006
32780
  if (session.deployment) {
33007
- await (0, import_runtimeDeployments3.saveRuntimeDeploymentHeartbeat)(config2.userName, {
32781
+ await (0, import_runtimeHeartbeats.saveRuntimeDeploymentHeartbeat)(config2.userName, {
33008
32782
  deploymentId: session.deployment.id,
33009
32783
  status: "stopped",
33010
32784
  pid: process.pid,
@@ -33619,20 +33393,20 @@ var init_portfolioReplayConnector = __esm({
33619
33393
  });
33620
33394
 
33621
33395
  // src/lib/replay/historicalSignalsReplay.ts
33622
- var import_chalk46, import_progress12, import_backtest4, import_strategies14, import_time9, import_logger11, import_redis19, import_connectors17, import_cli13, import_strategies15, loadRuntimeStrategies, loadReferenceConnector, buildPreparedData, buildAfterSignalsContext, buildSymbolSharedReplayKey, runHistoricalSignalsReplay;
33396
+ var import_chalk46, import_progress12, import_backtest4, import_strategies13, import_time9, import_logger11, import_redis19, import_connectors17, import_cli13, import_strategies14, loadRuntimeStrategies, loadReferenceConnector, buildPreparedData, buildAfterSignalsContext, buildSymbolSharedReplayKey, runHistoricalSignalsReplay;
33623
33397
  var init_historicalSignalsReplay = __esm({
33624
33398
  "src/lib/replay/historicalSignalsReplay.ts"() {
33625
33399
  "use strict";
33626
33400
  import_chalk46 = __toESM(require("chalk"));
33627
33401
  import_progress12 = __toESM(require("progress"));
33628
33402
  import_backtest4 = require("@tradejs/core/backtest");
33629
- import_strategies14 = require("@tradejs/core/strategies");
33403
+ import_strategies13 = require("@tradejs/core/strategies");
33630
33404
  import_time9 = require("@tradejs/core/time");
33631
33405
  import_logger11 = require("@tradejs/infra/logger");
33632
33406
  import_redis19 = require("@tradejs/infra/redis");
33633
33407
  import_connectors17 = require("@tradejs/node/connectors");
33634
33408
  import_cli13 = require("@tradejs/node/cli");
33635
- import_strategies15 = require("@tradejs/node/strategies");
33409
+ import_strategies14 = require("@tradejs/node/strategies");
33636
33410
  init_cliConfig2();
33637
33411
  init_support();
33638
33412
  init_portfolioReplayConnector();
@@ -33642,7 +33416,7 @@ var init_historicalSignalsReplay = __esm({
33642
33416
  loadRuntimeStrategies = async (runtimeStrategies) => {
33643
33417
  const strategies = await Promise.all(
33644
33418
  runtimeStrategies.map(async ({ strategyName, strategyConfig }) => {
33645
- const strategyCreator = await (0, import_strategies15.getStrategyCreator)(
33419
+ const strategyCreator = await (0, import_strategies14.getStrategyCreator)(
33646
33420
  strategyName,
33647
33421
  replayProjectRoot
33648
33422
  );
@@ -33989,7 +33763,7 @@ var init_historicalSignalsReplay = __esm({
33989
33763
  );
33990
33764
  if (result && typeof result !== "string") {
33991
33765
  result.runtimeLineage = strategyRuntime.runtimeLineage;
33992
- await (0, import_strategies15.enrichSignalWithBinanceMarketContext)({
33766
+ await (0, import_strategies14.enrichSignalWithBinanceMarketContext)({
33993
33767
  signal: result,
33994
33768
  env: "PARITY"
33995
33769
  });
@@ -34013,8 +33787,8 @@ var init_historicalSignalsReplay = __esm({
34013
33787
  }
34014
33788
  } finally {
34015
33789
  for (const keyPrefix of sharedReplayKeyPrefixes) {
34016
- (0, import_strategies14.releaseStrategyIndicatorsReplayCache)(keyPrefix);
34017
- (0, import_strategies14.releaseStrategyReplayCache)(keyPrefix);
33790
+ (0, import_strategies13.releaseStrategyIndicatorsReplayCache)(keyPrefix);
33791
+ (0, import_strategies13.releaseStrategyReplayCache)(keyPrefix);
34018
33792
  }
34019
33793
  }
34020
33794
  const artifacts = replayConnector.getReplayArtifacts();
@@ -35233,12 +35007,12 @@ var init_runtimeParityDetails = __esm({
35233
35007
  });
35234
35008
 
35235
35009
  // src/lib/replay/runtimeEvidenceSource.ts
35236
- var import_promises30, import_node_path25, asRecord7, asFiniteNumber, unwrapRows2, buildRuntimeEvidenceLineageScopes, loadReplayRuntimeEvidenceSource;
35010
+ var import_promises29, import_node_path24, asRecord7, asFiniteNumber, unwrapRows2, buildRuntimeEvidenceLineageScopes, loadReplayRuntimeEvidenceSource;
35237
35011
  var init_runtimeEvidenceSource = __esm({
35238
35012
  "src/lib/replay/runtimeEvidenceSource.ts"() {
35239
35013
  "use strict";
35240
- import_promises30 = __toESM(require("fs/promises"));
35241
- import_node_path25 = __toESM(require("path"));
35014
+ import_promises29 = __toESM(require("fs/promises"));
35015
+ import_node_path24 = __toESM(require("path"));
35242
35016
  init_runtimeLineage();
35243
35017
  asRecord7 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
35244
35018
  asFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
@@ -35255,7 +35029,7 @@ var init_runtimeEvidenceSource = __esm({
35255
35029
  strategy,
35256
35030
  symbol,
35257
35031
  runtimeConfigId,
35258
- runtimeReleaseVersion,
35032
+ runtimeVersion,
35259
35033
  timestamp,
35260
35034
  lineage
35261
35035
  }) => {
@@ -35268,7 +35042,7 @@ var init_runtimeEvidenceSource = __esm({
35268
35042
  strategy,
35269
35043
  symbol,
35270
35044
  ...runtimeConfigId ? { runtimeConfigId } : {},
35271
- ...runtimeReleaseVersion ? { runtimeReleaseVersion } : {},
35045
+ ...runtimeVersion ? { runtimeVersion } : {},
35272
35046
  lineage,
35273
35047
  firstTimestamp: existing ? Math.min(existing.firstTimestamp, timestamp) : timestamp,
35274
35048
  lastTimestamp: existing ? Math.max(existing.lastTimestamp, timestamp) : timestamp
@@ -35279,7 +35053,7 @@ var init_runtimeEvidenceSource = __esm({
35279
35053
  strategy: signal.strategy,
35280
35054
  symbol: signal.symbol,
35281
35055
  runtimeConfigId: signal.runtimeConfigId,
35282
- runtimeReleaseVersion: signal.runtimeReleaseVersion,
35056
+ runtimeVersion: signal.runtimeVersion,
35283
35057
  timestamp: signal.timestamp,
35284
35058
  lineage: signal.runtimeLineage
35285
35059
  });
@@ -35289,7 +35063,7 @@ var init_runtimeEvidenceSource = __esm({
35289
35063
  strategy: evaluation.strategy,
35290
35064
  symbol: evaluation.symbol,
35291
35065
  runtimeConfigId: evaluation.runtimeConfigId,
35292
- runtimeReleaseVersion: evaluation.runtimeReleaseVersion,
35066
+ runtimeVersion: evaluation.runtimeVersion,
35293
35067
  timestamp: evaluation.timestamp,
35294
35068
  lineage: evaluation.runtimeLineage
35295
35069
  });
@@ -35304,9 +35078,9 @@ var init_runtimeEvidenceSource = __esm({
35304
35078
  expectedUserName,
35305
35079
  expectedWindow
35306
35080
  }) => {
35307
- const resolvedPath = import_node_path25.default.resolve(projectRoot15, filePath);
35081
+ const resolvedPath = import_node_path24.default.resolve(projectRoot15, filePath);
35308
35082
  const root = asRecord7(
35309
- JSON.parse(await import_promises30.default.readFile(resolvedPath, "utf8"))
35083
+ JSON.parse(await import_promises29.default.readFile(resolvedPath, "utf8"))
35310
35084
  );
35311
35085
  const runtime = asRecord7(root?.runtime) ?? root;
35312
35086
  if (!root || !runtime) {
@@ -36375,12 +36149,12 @@ var init_runtimeComparison = __esm({
36375
36149
  });
36376
36150
 
36377
36151
  // src/lib/replay/outputReport.ts
36378
- var import_promises31, import_node_path26, import_data4, formatMsk, formatNumber5, formatMoney2, formatPct, tableCell, createMarkdownTable2, entryStrategy, entryKey, buildDrilldownMap, buildPerTradeAnalysis, renderMatchedRows, renderRuntimeOnlyRows, renderOrderFailedRows, renderBacktestOnlyRows, renderStrategyRows, renderLineageRows, writeReplayOutputReport;
36152
+ var import_promises30, import_node_path25, import_data4, formatMsk, formatNumber5, formatMoney2, formatPct, tableCell, createMarkdownTable2, entryStrategy, entryKey, buildDrilldownMap, buildPerTradeAnalysis, renderMatchedRows, renderRuntimeOnlyRows, renderOrderFailedRows, renderBacktestOnlyRows, renderStrategyRows, renderLineageRows, writeReplayOutputReport;
36379
36153
  var init_outputReport = __esm({
36380
36154
  "src/lib/replay/outputReport.ts"() {
36381
36155
  "use strict";
36382
- import_promises31 = __toESM(require("fs/promises"));
36383
- import_node_path26 = __toESM(require("path"));
36156
+ import_promises30 = __toESM(require("fs/promises"));
36157
+ import_node_path25 = __toESM(require("path"));
36384
36158
  import_data4 = require("@tradejs/core/data");
36385
36159
  init_support();
36386
36160
  formatMsk = (timestamp) => typeof timestamp === "number" && Number.isFinite(timestamp) ? new Intl.DateTimeFormat("ru-RU", {
@@ -36631,7 +36405,7 @@ var init_outputReport = __esm({
36631
36405
  existing.gitShas.add("release-versioned");
36632
36406
  existing.dirty.add("n/a");
36633
36407
  existing.gates.add("release-versioned");
36634
- existing.configs.add(`v${record.lineage.releaseVersion}`);
36408
+ existing.configs.add(`v${record.lineage.version}`);
36635
36409
  existing.contexts.add(
36636
36410
  [
36637
36411
  record.lineage.strategyPackageVersion ?? "strategy:unknown",
@@ -36698,8 +36472,8 @@ var init_outputReport = __esm({
36698
36472
  strategySnapshot,
36699
36473
  runtimeComparison
36700
36474
  }) => {
36701
- const outputDir = import_node_path26.default.resolve(projectRoot15, "data/replay/output");
36702
- await import_promises31.default.mkdir(outputDir, { recursive: true });
36475
+ const outputDir = import_node_path25.default.resolve(projectRoot15, "data/replay/output");
36476
+ await import_promises30.default.mkdir(outputDir, { recursive: true });
36703
36477
  const perTradeAnalysis = buildPerTradeAnalysis(runtimeComparison);
36704
36478
  const report = {
36705
36479
  reportType: "replay-output",
@@ -36734,8 +36508,8 @@ var init_outputReport = __esm({
36734
36508
  runtimeComparison,
36735
36509
  perTradeAnalysis
36736
36510
  };
36737
- const markdownPath = import_node_path26.default.join(outputDir, `${timestamp}-replay-report.md`);
36738
- const jsonPath = import_node_path26.default.join(outputDir, `${timestamp}-replay-report.json`);
36511
+ const markdownPath = import_node_path25.default.join(outputDir, `${timestamp}-replay-report.md`);
36512
+ const jsonPath = import_node_path25.default.join(outputDir, `${timestamp}-replay-report.json`);
36739
36513
  const lines = [
36740
36514
  "# Replay Report",
36741
36515
  "",
@@ -36801,8 +36575,8 @@ var init_outputReport = __esm({
36801
36575
  ""
36802
36576
  ];
36803
36577
  await Promise.all([
36804
- import_promises31.default.writeFile(markdownPath, lines.join("\n"), "utf8"),
36805
- import_promises31.default.writeFile(jsonPath, `${(0, import_data4.toJson)(report, true)}
36578
+ import_promises30.default.writeFile(markdownPath, lines.join("\n"), "utf8"),
36579
+ import_promises30.default.writeFile(jsonPath, `${(0, import_data4.toJson)(report, true)}
36806
36580
  `, "utf8")
36807
36581
  ]);
36808
36582
  return {
@@ -37038,7 +36812,7 @@ __export(signalsSummary_exports, {
37038
36812
  main: () => main44,
37039
36813
  signalsSummary: () => signalsSummary
37040
36814
  });
37041
- var import_config13, import_args33, import_logger12, import_connectors18, import_runtimeDeployments4, flags30, projectRoot14, SUMMARY_TIMEZONE2, SUMMARY_TIMEZONE_LABEL2, escapeHtml6, formatMskDateTime3, formatSigned3, formatPnlMoneyText, formatWinRateText, resolveSummaryTitle, normalizeStatus, shouldAttachDebugReport, getSummaryDateParts, formatSummaryIsoDayKey, unescapeHtml, stripTelegramHtml, buildSignalsSummaryAttachment, appendReportAttachmentSummary, resolveSummaryConnectorName, groupRuntimeTradesByConnectorScope, syncRuntimeTradeScopes, createRuntimeSignalStats, mergeRuntimeSignalStats, buildSummaryPrelude, resolveTradeStatusEmoji, isTimestampInWindow, isRuntimeTradeClosedInWindow, buildSummaryMessages, signalsSummary, main44;
36815
+ var import_config13, import_args33, import_logger12, import_connectors18, import_runtimeStrategies6, flags30, projectRoot14, SUMMARY_TIMEZONE2, SUMMARY_TIMEZONE_LABEL2, escapeHtml6, formatMskDateTime3, formatSigned3, formatPnlMoneyText, formatWinRateText, resolveSummaryTitle, normalizeStatus, shouldAttachDebugReport, getSummaryDateParts, formatSummaryIsoDayKey, unescapeHtml, stripTelegramHtml, buildSignalsSummaryAttachment, appendReportAttachmentSummary, resolveSummaryConnectorName, groupRuntimeTradesByConnectorScope, syncRuntimeTradeScopes, createRuntimeSignalStats, mergeRuntimeSignalStats, buildSummaryPrelude, resolveTradeStatusEmoji, isTimestampInWindow, isRuntimeTradeClosedInWindow, buildSummaryMessages, signalsSummary, main44;
37042
36816
  var init_signalsSummary = __esm({
37043
36817
  "src/scripts/signalsSummary.ts"() {
37044
36818
  "use strict";
@@ -37052,7 +36826,7 @@ var init_signalsSummary = __esm({
37052
36826
  init_runtimeSignalsLoader();
37053
36827
  init_runtimeSignalsStorage();
37054
36828
  init_runtimeDebugEvidence();
37055
- import_runtimeDeployments4 = require("@tradejs/infra/runtimeDeployments");
36829
+ import_runtimeStrategies6 = require("@tradejs/node/runtimeStrategies");
37056
36830
  import_args33.default.option(["u", "user"], "Use user config", "root");
37057
36831
  import_args33.default.option(
37058
36832
  "connector",
@@ -37590,7 +37364,7 @@ none`
37590
37364
  loadRuntimeSignals(flags30.user, { startTime, endTime }),
37591
37365
  loadRuntimeSignalEvaluationStatsBuckets(flags30.user),
37592
37366
  loadRuntimeTrades(flags30.user),
37593
- (0, import_runtimeDeployments4.listRuntimeDeployments)(flags30.user)
37367
+ (0, import_runtimeStrategies6.listRuntimeDeployments)({ userName: flags30.user, projectRoot: projectRoot14 })
37594
37368
  ]);
37595
37369
  const {
37596
37370
  trades: syncedTrades,
@@ -37959,7 +37733,7 @@ var scriptLoaders = {
37959
37733
  "runtime-evidence": () => Promise.resolve().then(() => (init_runtimeEvidence(), runtimeEvidence_exports)),
37960
37734
  "runtime-evidence-sync": () => Promise.resolve().then(() => (init_runtimeEvidenceSync2(), runtimeEvidenceSync_exports)),
37961
37735
  "runtime-scorecard": () => Promise.resolve().then(() => (init_runtimeScorecard2(), runtimeScorecard_exports)),
37962
- "runtime-config": () => Promise.resolve().then(() => (init_runtimeConfig(), runtimeConfig_exports)),
37736
+ "runtime-control": () => Promise.resolve().then(() => (init_runtimeControl(), runtimeControl_exports)),
37963
37737
  "strategy-release": () => Promise.resolve().then(() => (init_strategyRelease2(), strategyRelease_exports)),
37964
37738
  "server-health": () => Promise.resolve().then(() => (init_serverHealth(), serverHealth_exports)),
37965
37739
  "runtime-parity": () => Promise.resolve().then(() => (init_runtimeParity2(), runtimeParity_exports)),