@tradejs/cli 3.1.29-beta.262 → 3.1.29-beta.264
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 +864 -1424
- package/dist/lib/runtimeEvidenceArtifacts.js +3 -416
- package/dist/lib/runtimeEvidenceCompositionSnapshots.js +42 -211
- package/dist/lib/runtimeEvidenceCompositions.js +33 -310
- package/dist/lib/runtimeEvidenceDeployment.js +3 -315
- package/dist/lib/runtimeEvidenceProducer.js +3 -77
- package/dist/lib/runtimeEvidenceSync.js +32 -299
- package/dist/lib/runtimeFeedbackArtifacts.js +3 -545
- package/dist/lib/runtimeFeedbackNotification.js +7 -195
- package/dist/lib/runtimeFeedbackReplay.js +26 -525
- package/dist/lib/runtimeFeedbackSync.js +26 -219
- package/dist/lib/runtimeScorecard.js +5 -163
- package/dist/scripts/backtest.js +6 -1
- package/dist/scripts/mcpWorker.js +273 -0
- package/dist/scripts/replay.js +14 -250
- package/dist/scripts/replayRunner.js +14 -250
- package/dist/scripts/runtimeEvidence.js +47 -597
- package/dist/scripts/runtimeEvidenceSync.js +29 -296
- package/dist/scripts/runtimeFeedbackNotify.js +10 -188
- package/dist/scripts/runtimeFeedbackReplay.js +29 -528
- package/dist/scripts/runtimeFeedbackSync.js +28 -221
- package/dist/scripts/runtimeScorecard.js +88 -503
- package/dist/scripts/signals.js +55 -224
- package/dist/scripts/signalsDaemon.js +55 -224
- package/package.json +7 -7
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -50,7 +51,7 @@ var import_time3 = require("@tradejs/core/time");
|
|
|
50
51
|
var import_logger4 = require("@tradejs/infra/logger");
|
|
51
52
|
var import_runtimeDeploymentEvents = require("@tradejs/infra/runtimeDeploymentEvents");
|
|
52
53
|
var import_runtimeHeartbeats = require("@tradejs/infra/runtimeHeartbeats");
|
|
53
|
-
var
|
|
54
|
+
var import_runtimeStrategies2 = require("@tradejs/node/runtimeStrategies");
|
|
54
55
|
|
|
55
56
|
// src/lib/marketData/windows.ts
|
|
56
57
|
var import_indicators = require("@tradejs/core/indicators");
|
|
@@ -2149,27 +2150,27 @@ var createCoinMarketCapFetchStats = () => ({
|
|
|
2149
2150
|
totalCredits: 0,
|
|
2150
2151
|
byPath: /* @__PURE__ */ new Map()
|
|
2151
2152
|
});
|
|
2152
|
-
var getCoinMarketCapPathLabel = (
|
|
2153
|
-
if (
|
|
2154
|
-
if (
|
|
2155
|
-
if (
|
|
2156
|
-
if (
|
|
2157
|
-
if (
|
|
2158
|
-
if (
|
|
2159
|
-
return
|
|
2160
|
-
};
|
|
2161
|
-
var recordCoinMarketCapFetchStats = (stats,
|
|
2153
|
+
var getCoinMarketCapPathLabel = (path2) => {
|
|
2154
|
+
if (path2.includes("global-metrics")) return "global";
|
|
2155
|
+
if (path2.includes("cryptocurrency/quotes")) return "reference";
|
|
2156
|
+
if (path2.includes("exchange/quotes")) return "exchangeLiquidity";
|
|
2157
|
+
if (path2.includes("fear-and-greed")) return "fearGreed";
|
|
2158
|
+
if (path2.includes("cmc100")) return "cmc100";
|
|
2159
|
+
if (path2.includes("cmc20")) return "cmc20";
|
|
2160
|
+
return path2;
|
|
2161
|
+
};
|
|
2162
|
+
var recordCoinMarketCapFetchStats = (stats, path2, creditCount) => {
|
|
2162
2163
|
if (!stats) return;
|
|
2163
|
-
const existing = stats.byPath.get(
|
|
2164
|
+
const existing = stats.byPath.get(path2) ?? { requests: 0, credits: 0 };
|
|
2164
2165
|
existing.requests += 1;
|
|
2165
2166
|
existing.credits += creditCount ?? 0;
|
|
2166
2167
|
stats.requests += 1;
|
|
2167
2168
|
stats.totalCredits += creditCount ?? 0;
|
|
2168
|
-
stats.byPath.set(
|
|
2169
|
+
stats.byPath.set(path2, existing);
|
|
2169
2170
|
};
|
|
2170
2171
|
var formatCoinMarketCapFetchStats = (stats) => {
|
|
2171
2172
|
const byPath = [...stats.byPath.entries()].map(
|
|
2172
|
-
([
|
|
2173
|
+
([path2, item]) => `${getCoinMarketCapPathLabel(path2)}=${item.requests}req/${item.credits}cr`
|
|
2173
2174
|
).join(" ");
|
|
2174
2175
|
return `apiRequests=${stats.requests} apiCredits=${stats.totalCredits}${byPath ? ` ${byPath}` : ""}`;
|
|
2175
2176
|
};
|
|
@@ -4996,187 +4997,17 @@ var buildConfiguredSignalsScopes = ({
|
|
|
4996
4997
|
};
|
|
4997
4998
|
|
|
4998
4999
|
// src/lib/runtimeEvidenceCompositionSnapshots.ts
|
|
4999
|
-
var
|
|
5000
|
-
var
|
|
5001
|
-
var
|
|
5000
|
+
var import_node_crypto2 = require("crypto");
|
|
5001
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
5002
|
+
var import_node_path = __toESM(require("path"));
|
|
5002
5003
|
|
|
5003
5004
|
// src/lib/runtimeEvidenceDeployment.ts
|
|
5004
|
-
var
|
|
5005
|
-
|
|
5006
|
-
var isNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0;
|
|
5007
|
-
var isPackageVersionMap = (value) => isRecord(value) && Object.keys(value).length > 0 && Object.entries(value).every(
|
|
5008
|
-
([name, version]) => name.startsWith("@tradejs/") && isNonEmptyString(version)
|
|
5009
|
-
);
|
|
5010
|
-
var INTERVALS = /* @__PURE__ */ new Set([
|
|
5011
|
-
"1",
|
|
5012
|
-
"3",
|
|
5013
|
-
"5",
|
|
5014
|
-
"15",
|
|
5015
|
-
"30",
|
|
5016
|
-
"60",
|
|
5017
|
-
"120",
|
|
5018
|
-
"240",
|
|
5019
|
-
"360",
|
|
5020
|
-
"720",
|
|
5021
|
-
"D",
|
|
5022
|
-
"W",
|
|
5023
|
-
"M"
|
|
5024
|
-
]);
|
|
5025
|
-
var UNIVERSES = /* @__PURE__ */ new Set(["crypto", "tradfi"]);
|
|
5026
|
-
var isRuntimeStrategySelection = (value) => value === void 0 || isRecord(value) && Object.keys(value).length === 1 && Object.keys(value).every((key) => key === "tickers") && Array.isArray(value.tickers) && value.tickers.length > 0 && value.tickers.every((ticker) => isNonEmptyString(ticker));
|
|
5027
|
-
var parseRuntimeEvidenceDeploymentSnapshot = (value) => {
|
|
5028
|
-
if (!isRecord(value) || value.schemaVersion !== 2 || !isNonEmptyString(value.id) || !isNonEmptyString(value.deploymentCompositionId) || !/^dc1:[a-f0-9]{16}$/.test(value.deploymentCompositionId) || !isNonEmptyString(value.label) || !isNonEmptyString(value.connectorName) || !isNonEmptyString(value.provider) || !isNonEmptyString(value.accountId) || typeof value.enabled !== "boolean" || !Array.isArray(value.strategies)) {
|
|
5029
|
-
throw new Error(
|
|
5030
|
-
"Runtime evidence deployment snapshot is missing or invalid"
|
|
5031
|
-
);
|
|
5032
|
-
}
|
|
5033
|
-
const strategies = value.strategies.map((candidate) => {
|
|
5034
|
-
if (!isRecord(candidate) || !isNonEmptyString(candidate.strategyName) || !isNonEmptyString(candidate.strategyRevision) || !/^sr1:[a-f0-9]{16}$/.test(candidate.strategyRevision) || typeof candidate.enabled !== "boolean" || !["active", "entries_paused"].includes(String(candidate.controlState)) || !INTERVALS.has(String(candidate.interval)) || !UNIVERSES.has(String(candidate.universe)) || !isNonEmptyString(candidate.strategyPackage) || !isNonEmptyString(candidate.strategyPackageVersion) || !isPackageVersionMap(candidate.strategyDependencyVersions) || !isNonEmptyString(candidate.runtimePackageVersion) || !isRecord(candidate.strategyConfig) || !isRuntimeStrategySelection(candidate.selection)) {
|
|
5035
|
-
throw new Error(
|
|
5036
|
-
"Runtime evidence deployment strategy snapshot is invalid"
|
|
5037
|
-
);
|
|
5038
|
-
}
|
|
5039
|
-
if (String(candidate.strategyConfig.INTERVAL) !== String(candidate.interval) || String(candidate.strategyConfig.UNIVERSE) !== String(candidate.universe)) {
|
|
5040
|
-
throw new Error(
|
|
5041
|
-
`Runtime evidence strategy config does not match its scope: ${candidate.strategyName}`
|
|
5042
|
-
);
|
|
5043
|
-
}
|
|
5044
|
-
if (candidate.accountId != null && (!isNonEmptyString(candidate.accountId) || candidate.accountId !== value.accountId)) {
|
|
5045
|
-
throw new Error(
|
|
5046
|
-
`Runtime evidence strategy account does not match deployment: ${candidate.strategyName}`
|
|
5047
|
-
);
|
|
5048
|
-
}
|
|
5049
|
-
return candidate;
|
|
5050
|
-
});
|
|
5051
|
-
const identities = /* @__PURE__ */ new Set();
|
|
5052
|
-
for (const strategy of strategies) {
|
|
5053
|
-
if (identities.has(strategy.strategyName)) {
|
|
5054
|
-
throw new Error(
|
|
5055
|
-
`Duplicate runtime evidence strategy: ${strategy.strategyName}`
|
|
5056
|
-
);
|
|
5057
|
-
}
|
|
5058
|
-
identities.add(strategy.strategyName);
|
|
5059
|
-
}
|
|
5060
|
-
return {
|
|
5061
|
-
...value,
|
|
5062
|
-
strategies
|
|
5063
|
-
};
|
|
5064
|
-
};
|
|
5065
|
-
var resolveRuntimeEvidenceDeploymentSnapshot = async ({
|
|
5066
|
-
userName,
|
|
5067
|
-
projectRoot,
|
|
5068
|
-
deploymentId
|
|
5069
|
-
}) => {
|
|
5070
|
-
const [deployment, strategies] = await Promise.all([
|
|
5071
|
-
(0, import_runtimeStrategies2.getRuntimeDeployment)({ userName, projectRoot, deploymentId }),
|
|
5072
|
-
(0, import_runtimeStrategies2.loadResolvedRuntimeStrategies)({ userName, projectRoot, deploymentId })
|
|
5073
|
-
]);
|
|
5074
|
-
if (!deployment) {
|
|
5075
|
-
throw new Error(`Runtime deployment not found: ${deploymentId}`);
|
|
5076
|
-
}
|
|
5077
|
-
return {
|
|
5078
|
-
schemaVersion: 2,
|
|
5079
|
-
id: deployment.id,
|
|
5080
|
-
deploymentCompositionId: deployment.deploymentCompositionId,
|
|
5081
|
-
label: deployment.label,
|
|
5082
|
-
connectorName: deployment.connectorName,
|
|
5083
|
-
provider: deployment.provider,
|
|
5084
|
-
accountId: deployment.accountId,
|
|
5085
|
-
enabled: deployment.enabled,
|
|
5086
|
-
strategies: strategies.map(
|
|
5087
|
-
({
|
|
5088
|
-
strategyName,
|
|
5089
|
-
strategyRevision,
|
|
5090
|
-
enabled,
|
|
5091
|
-
controlState,
|
|
5092
|
-
interval,
|
|
5093
|
-
universe,
|
|
5094
|
-
accountId,
|
|
5095
|
-
strategyPackage,
|
|
5096
|
-
strategyPackageVersion,
|
|
5097
|
-
strategyDependencyVersions,
|
|
5098
|
-
runtimePackageVersion,
|
|
5099
|
-
strategyConfig,
|
|
5100
|
-
selection
|
|
5101
|
-
}) => ({
|
|
5102
|
-
strategyName,
|
|
5103
|
-
strategyRevision,
|
|
5104
|
-
enabled,
|
|
5105
|
-
controlState,
|
|
5106
|
-
interval,
|
|
5107
|
-
universe,
|
|
5108
|
-
...accountId ? { accountId } : {},
|
|
5109
|
-
strategyPackage,
|
|
5110
|
-
strategyPackageVersion,
|
|
5111
|
-
strategyDependencyVersions,
|
|
5112
|
-
runtimePackageVersion,
|
|
5113
|
-
strategyConfig,
|
|
5114
|
-
...selection ? { selection } : {}
|
|
5115
|
-
})
|
|
5116
|
-
),
|
|
5117
|
-
...deployment.assetClasses ? { assetClasses: [...deployment.assetClasses] } : {},
|
|
5118
|
-
...deployment.tickers ? { tickers: [...deployment.tickers] } : {}
|
|
5119
|
-
};
|
|
5120
|
-
};
|
|
5005
|
+
var runtimeEvidenceDeployment_exports = {};
|
|
5006
|
+
__reExport(runtimeEvidenceDeployment_exports, require("@tradejs/node/diagnostics"));
|
|
5121
5007
|
|
|
5122
5008
|
// src/lib/runtimeEvidenceProducer.ts
|
|
5123
|
-
var
|
|
5124
|
-
|
|
5125
|
-
var import_node_path = __toESM(require("path"));
|
|
5126
|
-
var isRecord2 = (value) => value != null && typeof value === "object" && !Array.isArray(value);
|
|
5127
|
-
var sha256 = (value) => (0, import_node_crypto2.createHash)("sha256").update(value).digest("hex");
|
|
5128
|
-
var parseRuntimeEvidenceProducer = (value) => {
|
|
5129
|
-
const producer = isRecord2(value) ? value : null;
|
|
5130
|
-
const runtimePackageManifest = isRecord2(producer?.runtimePackageManifest) ? producer.runtimePackageManifest : null;
|
|
5131
|
-
if (producer?.schemaVersion !== 1 || typeof producer.projectSha !== "string" || !/^[a-f0-9]{40}$/.test(producer.projectSha) || typeof producer.imageDigest !== "string" || !/^sha256:[a-f0-9]{64}$/.test(producer.imageDigest) || runtimePackageManifest?.file !== "runtime-package-manifest.json" || typeof runtimePackageManifest.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(runtimePackageManifest.sha256)) {
|
|
5132
|
-
throw new Error("Runtime evidence producer image identity is invalid");
|
|
5133
|
-
}
|
|
5134
|
-
return producer;
|
|
5135
|
-
};
|
|
5136
|
-
var resolveRuntimeEvidenceProducer = async ({
|
|
5137
|
-
projectRoot,
|
|
5138
|
-
required
|
|
5139
|
-
}) => {
|
|
5140
|
-
const projectSha = String(process.env.TRADEJS_PROJECT_SHA ?? "").trim();
|
|
5141
|
-
const imageDigest = String(
|
|
5142
|
-
process.env.TRADEJS_PROJECT_IMAGE_DIGEST ?? ""
|
|
5143
|
-
).trim();
|
|
5144
|
-
if (!projectSha && !imageDigest && !required) {
|
|
5145
|
-
return null;
|
|
5146
|
-
}
|
|
5147
|
-
if (!/^[a-f0-9]{40}$/.test(projectSha)) {
|
|
5148
|
-
throw new Error(
|
|
5149
|
-
"TRADEJS_PROJECT_SHA must be a full lowercase Git SHA before publishing runtime evidence"
|
|
5150
|
-
);
|
|
5151
|
-
}
|
|
5152
|
-
if (!/^sha256:[a-f0-9]{64}$/.test(imageDigest)) {
|
|
5153
|
-
throw new Error(
|
|
5154
|
-
"TRADEJS_PROJECT_IMAGE_DIGEST must be an immutable sha256 digest before publishing runtime evidence"
|
|
5155
|
-
);
|
|
5156
|
-
}
|
|
5157
|
-
const manifestPath = import_node_path.default.join(projectRoot, "runtime-package-manifest.json");
|
|
5158
|
-
let manifest;
|
|
5159
|
-
try {
|
|
5160
|
-
manifest = await import_promises.default.readFile(manifestPath);
|
|
5161
|
-
} catch (error) {
|
|
5162
|
-
if (!required && error.code === "ENOENT") {
|
|
5163
|
-
return null;
|
|
5164
|
-
}
|
|
5165
|
-
throw new Error(
|
|
5166
|
-
`Runtime package manifest is required for runtime evidence: ${manifestPath}`,
|
|
5167
|
-
{ cause: error }
|
|
5168
|
-
);
|
|
5169
|
-
}
|
|
5170
|
-
return {
|
|
5171
|
-
schemaVersion: 1,
|
|
5172
|
-
projectSha,
|
|
5173
|
-
imageDigest,
|
|
5174
|
-
runtimePackageManifest: {
|
|
5175
|
-
file: "runtime-package-manifest.json",
|
|
5176
|
-
sha256: sha256(manifest)
|
|
5177
|
-
}
|
|
5178
|
-
};
|
|
5179
|
-
};
|
|
5009
|
+
var runtimeEvidenceProducer_exports = {};
|
|
5010
|
+
__reExport(runtimeEvidenceProducer_exports, require("@tradejs/node/diagnostics"));
|
|
5180
5011
|
|
|
5181
5012
|
// src/lib/runtimeEvidenceCompositionSnapshots.ts
|
|
5182
5013
|
var SNAPSHOT_FILE = "snapshot.json";
|
|
@@ -5196,8 +5027,8 @@ var createRuntimeEvidenceCompositionSnapshotRecorder = ({
|
|
|
5196
5027
|
}
|
|
5197
5028
|
};
|
|
5198
5029
|
};
|
|
5199
|
-
var
|
|
5200
|
-
var
|
|
5030
|
+
var isRecord = (value) => value != null && typeof value === "object" && !Array.isArray(value);
|
|
5031
|
+
var sha256 = (value) => (0, import_node_crypto2.createHash)("sha256").update(value).digest("hex");
|
|
5201
5032
|
var safeSegment = (value, label) => {
|
|
5202
5033
|
const normalized = value.trim();
|
|
5203
5034
|
if (!normalized || !/^[a-zA-Z0-9._:-]+$/.test(normalized)) {
|
|
@@ -5210,8 +5041,8 @@ var isExistingDestinationError = (error) => {
|
|
|
5210
5041
|
return code === "EEXIST" || code === "ENOTEMPTY";
|
|
5211
5042
|
};
|
|
5212
5043
|
var parseManifest = (value) => {
|
|
5213
|
-
const manifest =
|
|
5214
|
-
const payload =
|
|
5044
|
+
const manifest = isRecord(value) ? value : null;
|
|
5045
|
+
const payload = isRecord(manifest?.payload) ? manifest.payload : null;
|
|
5215
5046
|
if (manifest?.schemaVersion !== 1 || manifest.reportType !== "runtime-evidence-composition-snapshot" || typeof manifest.createdAt !== "number" || typeof manifest.userName !== "string" || typeof manifest.deploymentId !== "string" || typeof manifest.deploymentCompositionId !== "string" || payload?.file !== SNAPSHOT_FILE || typeof payload.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(payload.sha256) || typeof payload.bytes !== "number") {
|
|
5216
5047
|
throw new Error("Invalid runtime evidence composition snapshot manifest");
|
|
5217
5048
|
}
|
|
@@ -5219,28 +5050,28 @@ var parseManifest = (value) => {
|
|
|
5219
5050
|
};
|
|
5220
5051
|
var verifyRuntimeEvidenceCompositionSnapshot = async (bundleDir) => {
|
|
5221
5052
|
const [manifestText, payload, completeText] = await Promise.all([
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5053
|
+
import_promises.default.readFile(import_node_path.default.join(bundleDir, MANIFEST_FILE), "utf8"),
|
|
5054
|
+
import_promises.default.readFile(import_node_path.default.join(bundleDir, SNAPSHOT_FILE)),
|
|
5055
|
+
import_promises.default.readFile(import_node_path.default.join(bundleDir, COMPLETE_FILE), "utf8")
|
|
5225
5056
|
]);
|
|
5226
5057
|
const manifest = parseManifest(JSON.parse(manifestText));
|
|
5227
5058
|
if (completeText.trim() !== manifest.deploymentCompositionId) {
|
|
5228
5059
|
throw new Error(`Invalid completion marker in ${bundleDir}`);
|
|
5229
5060
|
}
|
|
5230
|
-
if (payload.byteLength !== manifest.payload.bytes ||
|
|
5061
|
+
if (payload.byteLength !== manifest.payload.bytes || sha256(payload) !== manifest.payload.sha256) {
|
|
5231
5062
|
throw new Error(
|
|
5232
5063
|
`Runtime evidence snapshot checksum mismatch in ${bundleDir}`
|
|
5233
5064
|
);
|
|
5234
5065
|
}
|
|
5235
5066
|
const value = JSON.parse(payload.toString("utf8"));
|
|
5236
|
-
const record =
|
|
5067
|
+
const record = isRecord(value) ? value : null;
|
|
5237
5068
|
if (record?.schemaVersion !== 1 || record.reportType !== "runtime-evidence-composition-snapshot" || record.userName !== manifest.userName) {
|
|
5238
5069
|
throw new Error(
|
|
5239
5070
|
`Invalid runtime evidence snapshot payload in ${bundleDir}`
|
|
5240
5071
|
);
|
|
5241
5072
|
}
|
|
5242
|
-
const deployment = parseRuntimeEvidenceDeploymentSnapshot(record.deployment);
|
|
5243
|
-
const producer = parseRuntimeEvidenceProducer(record.producer);
|
|
5073
|
+
const deployment = (0, runtimeEvidenceDeployment_exports.parseRuntimeEvidenceDeploymentSnapshot)(record.deployment);
|
|
5074
|
+
const producer = (0, runtimeEvidenceProducer_exports.parseRuntimeEvidenceProducer)(record.producer);
|
|
5244
5075
|
if (deployment.id !== manifest.deploymentId || deployment.deploymentCompositionId !== manifest.deploymentCompositionId) {
|
|
5245
5076
|
throw new Error(
|
|
5246
5077
|
`Runtime evidence snapshot identity mismatch in ${bundleDir}`
|
|
@@ -5280,43 +5111,43 @@ var publishRuntimeEvidenceCompositionSnapshot = async ({
|
|
|
5280
5111
|
deploymentCompositionId: compositionId,
|
|
5281
5112
|
payload: {
|
|
5282
5113
|
file: SNAPSHOT_FILE,
|
|
5283
|
-
sha256:
|
|
5114
|
+
sha256: sha256(payload),
|
|
5284
5115
|
bytes: Buffer.byteLength(payload)
|
|
5285
5116
|
}
|
|
5286
5117
|
};
|
|
5287
|
-
const snapshotsRoot =
|
|
5288
|
-
const bundleDir =
|
|
5289
|
-
const temporaryDir =
|
|
5118
|
+
const snapshotsRoot = import_node_path.default.join(evidenceRoot, "snapshots", deploymentId);
|
|
5119
|
+
const bundleDir = import_node_path.default.join(snapshotsRoot, compositionId);
|
|
5120
|
+
const temporaryDir = import_node_path.default.join(
|
|
5290
5121
|
evidenceRoot,
|
|
5291
5122
|
"incoming",
|
|
5292
|
-
`snapshot-${compositionId}.tmp-${(0,
|
|
5123
|
+
`snapshot-${compositionId}.tmp-${(0, import_node_crypto2.randomUUID)()}`
|
|
5293
5124
|
);
|
|
5294
|
-
await
|
|
5125
|
+
await import_promises.default.mkdir(temporaryDir, { recursive: true });
|
|
5295
5126
|
try {
|
|
5296
5127
|
await Promise.all([
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5128
|
+
import_promises.default.writeFile(import_node_path.default.join(temporaryDir, SNAPSHOT_FILE), payload, "utf8"),
|
|
5129
|
+
import_promises.default.writeFile(
|
|
5130
|
+
import_node_path.default.join(temporaryDir, MANIFEST_FILE),
|
|
5300
5131
|
`${JSON.stringify(manifest, null, 2)}
|
|
5301
5132
|
`,
|
|
5302
5133
|
"utf8"
|
|
5303
5134
|
)
|
|
5304
5135
|
]);
|
|
5305
|
-
await
|
|
5306
|
-
|
|
5136
|
+
await import_promises.default.writeFile(
|
|
5137
|
+
import_node_path.default.join(temporaryDir, COMPLETE_FILE),
|
|
5307
5138
|
`${compositionId}
|
|
5308
5139
|
`,
|
|
5309
5140
|
"utf8"
|
|
5310
5141
|
);
|
|
5311
|
-
await
|
|
5142
|
+
await import_promises.default.mkdir(snapshotsRoot, { recursive: true });
|
|
5312
5143
|
try {
|
|
5313
|
-
await
|
|
5144
|
+
await import_promises.default.rename(temporaryDir, bundleDir);
|
|
5314
5145
|
} catch (error) {
|
|
5315
5146
|
if (!isExistingDestinationError(error)) throw error;
|
|
5316
|
-
await
|
|
5147
|
+
await import_promises.default.rm(temporaryDir, { recursive: true, force: true });
|
|
5317
5148
|
}
|
|
5318
5149
|
} catch (error) {
|
|
5319
|
-
await
|
|
5150
|
+
await import_promises.default.rm(temporaryDir, { recursive: true, force: true });
|
|
5320
5151
|
throw error;
|
|
5321
5152
|
}
|
|
5322
5153
|
const verified = await verifyRuntimeEvidenceCompositionSnapshot(bundleDir);
|
|
@@ -5334,12 +5165,12 @@ var captureRuntimeEvidenceCompositionSnapshot = async ({
|
|
|
5334
5165
|
expectedCompositionId
|
|
5335
5166
|
}) => {
|
|
5336
5167
|
const [deployment, producer] = await Promise.all([
|
|
5337
|
-
resolveRuntimeEvidenceDeploymentSnapshot({
|
|
5168
|
+
(0, runtimeEvidenceDeployment_exports.resolveRuntimeEvidenceDeploymentSnapshot)({
|
|
5338
5169
|
userName,
|
|
5339
5170
|
projectRoot,
|
|
5340
5171
|
deploymentId
|
|
5341
5172
|
}),
|
|
5342
|
-
resolveRuntimeEvidenceProducer({ projectRoot, required: true })
|
|
5173
|
+
(0, runtimeEvidenceProducer_exports.resolveRuntimeEvidenceProducer)({ projectRoot, required: true })
|
|
5343
5174
|
]);
|
|
5344
5175
|
if (!producer) {
|
|
5345
5176
|
throw new Error("Runtime evidence producer identity is required");
|
|
@@ -5350,7 +5181,7 @@ var captureRuntimeEvidenceCompositionSnapshot = async ({
|
|
|
5350
5181
|
);
|
|
5351
5182
|
}
|
|
5352
5183
|
await publishRuntimeEvidenceCompositionSnapshot({
|
|
5353
|
-
evidenceRoot:
|
|
5184
|
+
evidenceRoot: import_node_path.default.join(projectRoot, "data", "runtime-evidence"),
|
|
5354
5185
|
userName,
|
|
5355
5186
|
deployment,
|
|
5356
5187
|
producer
|
|
@@ -5432,7 +5263,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5432
5263
|
return connectorName;
|
|
5433
5264
|
};
|
|
5434
5265
|
const createSignalsSession2 = async (lifecycle, scope = {}) => {
|
|
5435
|
-
const deployment = config2.deploymentId ? await (0,
|
|
5266
|
+
const deployment = config2.deploymentId ? await (0, import_runtimeStrategies2.getRuntimeDeployment)({
|
|
5436
5267
|
userName: config2.userName,
|
|
5437
5268
|
projectRoot,
|
|
5438
5269
|
deploymentId: config2.deploymentId
|
|
@@ -5949,7 +5780,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5949
5780
|
if (!config2.deploymentId) {
|
|
5950
5781
|
throw new Error("Runtime deployment id is required");
|
|
5951
5782
|
}
|
|
5952
|
-
const configuredDeployment = await (0,
|
|
5783
|
+
const configuredDeployment = await (0, import_runtimeStrategies2.getRuntimeDeployment)({
|
|
5953
5784
|
userName: config2.userName,
|
|
5954
5785
|
projectRoot,
|
|
5955
5786
|
deploymentId: config2.deploymentId
|
|
@@ -5983,7 +5814,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5983
5814
|
throw new Error("Runtime deployment id is required");
|
|
5984
5815
|
}
|
|
5985
5816
|
const deploymentId = config2.deploymentId;
|
|
5986
|
-
const initialDeployment = await (0,
|
|
5817
|
+
const initialDeployment = await (0, import_runtimeStrategies2.getRuntimeDeployment)({
|
|
5987
5818
|
userName: config2.userName,
|
|
5988
5819
|
projectRoot,
|
|
5989
5820
|
deploymentId
|
|
@@ -6008,7 +5839,7 @@ var createSignalsRunner = (config2) => {
|
|
|
6008
5839
|
settleDelayMs: resolveNonNegativeInteger(config2.settleDelayMs, 5e3),
|
|
6009
5840
|
signal: abortController.signal,
|
|
6010
5841
|
runCycle: async () => {
|
|
6011
|
-
const currentDeployment = await (0,
|
|
5842
|
+
const currentDeployment = await (0, import_runtimeStrategies2.getRuntimeDeployment)({
|
|
6012
5843
|
userName: config2.userName,
|
|
6013
5844
|
projectRoot,
|
|
6014
5845
|
deploymentId
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradejs/cli",
|
|
3
|
-
"version": "3.1.29-beta.
|
|
3
|
+
"version": "3.1.29-beta.264",
|
|
4
4
|
"description": "Official CLI for the TradeJS TypeScript framework: infra setup, backtests, signals, bots, and ML workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tradejs",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"tradejs": "dist/cli.js"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@tradejs/connectors": "^3.1.29-beta.
|
|
41
|
-
"@tradejs/core": "^3.1.29-beta.
|
|
42
|
-
"@tradejs/indicators": "^3.1.29-beta.
|
|
43
|
-
"@tradejs/infra": "^3.1.29-beta.
|
|
44
|
-
"@tradejs/node": "^3.1.29-beta.
|
|
40
|
+
"@tradejs/connectors": "^3.1.29-beta.264",
|
|
41
|
+
"@tradejs/core": "^3.1.29-beta.264",
|
|
42
|
+
"@tradejs/indicators": "^3.1.29-beta.264",
|
|
43
|
+
"@tradejs/infra": "^3.1.29-beta.264",
|
|
44
|
+
"@tradejs/node": "^3.1.29-beta.264",
|
|
45
45
|
"@tradejs/strategy-kit": "3.0.6",
|
|
46
|
-
"@tradejs/types": "^3.1.29-beta.
|
|
46
|
+
"@tradejs/types": "^3.1.29-beta.264",
|
|
47
47
|
"args": "^5.0.3",
|
|
48
48
|
"bcryptjs": "^2.4.3",
|
|
49
49
|
"chalk": "4.1.2",
|