@tradejs/cli 2.0.19 → 2.0.20

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.
@@ -82,6 +82,13 @@ var loadBacktestCheckpointResults = async ({
82
82
  }) => (0, import_redis.getHashJsonValues)(
83
83
  import_redis.redisKeys.backtestRunResults(userName, runId)
84
84
  );
85
+ var loadBacktestRunManifest = async ({
86
+ runId,
87
+ userName
88
+ }) => await (0, import_redis.getData)(
89
+ import_redis.redisKeys.backtestRun(userName, runId),
90
+ null
91
+ );
85
92
 
86
93
  // src/lib/aiExport.ts
87
94
  var resolveRunScopedAiChunks = async ({
@@ -96,6 +103,12 @@ var resolveRunScopedAiChunks = async ({
96
103
  if (!runId) {
97
104
  return null;
98
105
  }
106
+ const manifest = await loadBacktestRunManifest({ runId, userName });
107
+ if (manifest?.status === "running") {
108
+ throw new Error(
109
+ `AI export run "${runId}" is still running; wait for completion before merging its chunks`
110
+ );
111
+ }
99
112
  const chunkFiles = await (0, import_ai.listAiChunkFiles)({ strategyName, outDir, runId });
100
113
  if (!chunkFiles.length) {
101
114
  return {
@@ -115,7 +128,7 @@ var exportAiStrategy = async (params) => {
115
128
  const {
116
129
  outDir,
117
130
  strategyName,
118
- keepChunks,
131
+ keepChunks = true,
119
132
  requestedRunId,
120
133
  userName,
121
134
  now = Date.now
@@ -323,8 +336,8 @@ import_args.default.option(["o", "outDir"], "Dataset directory", "data/ai/export
323
336
  import_args.default.option(["s", "strategy"], "Strategy name", "");
324
337
  import_args.default.option(
325
338
  ["k", "keepChunks"],
326
- "Keep source chunk files after successful merge",
327
- false
339
+ "Keep source chunk files after successful merge (safe default for active writers)",
340
+ true
328
341
  );
329
342
  import_args.default.option(
330
343
  "partMonths",