@tradejs/cli 3.1.29-beta.261 → 3.1.29-beta.263
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/README.md +47 -8
- package/dist/cli.js +990 -1448
- package/dist/lib/aiPocketSearch.js +16 -0
- package/dist/lib/aiPocketSearchCli.js +3 -3
- package/dist/lib/jevMicroReferences.js +73 -0
- package/dist/lib/jevResearch.js +11 -0
- 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/aiPocketSearch.js +101 -23
- package/dist/scripts/backtest.js +10 -1
- package/dist/scripts/jev.js +11 -0
- 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 +9 -8
package/dist/scripts/signals.js
CHANGED
|
@@ -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-
|
|
@@ -52,7 +53,7 @@ var import_time3 = require("@tradejs/core/time");
|
|
|
52
53
|
var import_logger4 = require("@tradejs/infra/logger");
|
|
53
54
|
var import_runtimeDeploymentEvents = require("@tradejs/infra/runtimeDeploymentEvents");
|
|
54
55
|
var import_runtimeHeartbeats = require("@tradejs/infra/runtimeHeartbeats");
|
|
55
|
-
var
|
|
56
|
+
var import_runtimeStrategies2 = require("@tradejs/node/runtimeStrategies");
|
|
56
57
|
|
|
57
58
|
// src/lib/marketData/windows.ts
|
|
58
59
|
var import_indicators = require("@tradejs/core/indicators");
|
|
@@ -2151,27 +2152,27 @@ var createCoinMarketCapFetchStats = () => ({
|
|
|
2151
2152
|
totalCredits: 0,
|
|
2152
2153
|
byPath: /* @__PURE__ */ new Map()
|
|
2153
2154
|
});
|
|
2154
|
-
var getCoinMarketCapPathLabel = (
|
|
2155
|
-
if (
|
|
2156
|
-
if (
|
|
2157
|
-
if (
|
|
2158
|
-
if (
|
|
2159
|
-
if (
|
|
2160
|
-
if (
|
|
2161
|
-
return
|
|
2162
|
-
};
|
|
2163
|
-
var recordCoinMarketCapFetchStats = (stats,
|
|
2155
|
+
var getCoinMarketCapPathLabel = (path2) => {
|
|
2156
|
+
if (path2.includes("global-metrics")) return "global";
|
|
2157
|
+
if (path2.includes("cryptocurrency/quotes")) return "reference";
|
|
2158
|
+
if (path2.includes("exchange/quotes")) return "exchangeLiquidity";
|
|
2159
|
+
if (path2.includes("fear-and-greed")) return "fearGreed";
|
|
2160
|
+
if (path2.includes("cmc100")) return "cmc100";
|
|
2161
|
+
if (path2.includes("cmc20")) return "cmc20";
|
|
2162
|
+
return path2;
|
|
2163
|
+
};
|
|
2164
|
+
var recordCoinMarketCapFetchStats = (stats, path2, creditCount) => {
|
|
2164
2165
|
if (!stats) return;
|
|
2165
|
-
const existing = stats.byPath.get(
|
|
2166
|
+
const existing = stats.byPath.get(path2) ?? { requests: 0, credits: 0 };
|
|
2166
2167
|
existing.requests += 1;
|
|
2167
2168
|
existing.credits += creditCount ?? 0;
|
|
2168
2169
|
stats.requests += 1;
|
|
2169
2170
|
stats.totalCredits += creditCount ?? 0;
|
|
2170
|
-
stats.byPath.set(
|
|
2171
|
+
stats.byPath.set(path2, existing);
|
|
2171
2172
|
};
|
|
2172
2173
|
var formatCoinMarketCapFetchStats = (stats) => {
|
|
2173
2174
|
const byPath = [...stats.byPath.entries()].map(
|
|
2174
|
-
([
|
|
2175
|
+
([path2, item]) => `${getCoinMarketCapPathLabel(path2)}=${item.requests}req/${item.credits}cr`
|
|
2175
2176
|
).join(" ");
|
|
2176
2177
|
return `apiRequests=${stats.requests} apiCredits=${stats.totalCredits}${byPath ? ` ${byPath}` : ""}`;
|
|
2177
2178
|
};
|
|
@@ -4998,187 +4999,17 @@ var buildConfiguredSignalsScopes = ({
|
|
|
4998
4999
|
};
|
|
4999
5000
|
|
|
5000
5001
|
// src/lib/runtimeEvidenceCompositionSnapshots.ts
|
|
5001
|
-
var
|
|
5002
|
-
var
|
|
5003
|
-
var
|
|
5002
|
+
var import_node_crypto2 = require("crypto");
|
|
5003
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
5004
|
+
var import_node_path = __toESM(require("path"));
|
|
5004
5005
|
|
|
5005
5006
|
// src/lib/runtimeEvidenceDeployment.ts
|
|
5006
|
-
var
|
|
5007
|
-
|
|
5008
|
-
var isNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0;
|
|
5009
|
-
var isPackageVersionMap = (value) => isRecord(value) && Object.keys(value).length > 0 && Object.entries(value).every(
|
|
5010
|
-
([name, version]) => name.startsWith("@tradejs/") && isNonEmptyString(version)
|
|
5011
|
-
);
|
|
5012
|
-
var INTERVALS = /* @__PURE__ */ new Set([
|
|
5013
|
-
"1",
|
|
5014
|
-
"3",
|
|
5015
|
-
"5",
|
|
5016
|
-
"15",
|
|
5017
|
-
"30",
|
|
5018
|
-
"60",
|
|
5019
|
-
"120",
|
|
5020
|
-
"240",
|
|
5021
|
-
"360",
|
|
5022
|
-
"720",
|
|
5023
|
-
"D",
|
|
5024
|
-
"W",
|
|
5025
|
-
"M"
|
|
5026
|
-
]);
|
|
5027
|
-
var UNIVERSES = /* @__PURE__ */ new Set(["crypto", "tradfi"]);
|
|
5028
|
-
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));
|
|
5029
|
-
var parseRuntimeEvidenceDeploymentSnapshot = (value) => {
|
|
5030
|
-
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)) {
|
|
5031
|
-
throw new Error(
|
|
5032
|
-
"Runtime evidence deployment snapshot is missing or invalid"
|
|
5033
|
-
);
|
|
5034
|
-
}
|
|
5035
|
-
const strategies = value.strategies.map((candidate) => {
|
|
5036
|
-
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)) {
|
|
5037
|
-
throw new Error(
|
|
5038
|
-
"Runtime evidence deployment strategy snapshot is invalid"
|
|
5039
|
-
);
|
|
5040
|
-
}
|
|
5041
|
-
if (String(candidate.strategyConfig.INTERVAL) !== String(candidate.interval) || String(candidate.strategyConfig.UNIVERSE) !== String(candidate.universe)) {
|
|
5042
|
-
throw new Error(
|
|
5043
|
-
`Runtime evidence strategy config does not match its scope: ${candidate.strategyName}`
|
|
5044
|
-
);
|
|
5045
|
-
}
|
|
5046
|
-
if (candidate.accountId != null && (!isNonEmptyString(candidate.accountId) || candidate.accountId !== value.accountId)) {
|
|
5047
|
-
throw new Error(
|
|
5048
|
-
`Runtime evidence strategy account does not match deployment: ${candidate.strategyName}`
|
|
5049
|
-
);
|
|
5050
|
-
}
|
|
5051
|
-
return candidate;
|
|
5052
|
-
});
|
|
5053
|
-
const identities = /* @__PURE__ */ new Set();
|
|
5054
|
-
for (const strategy of strategies) {
|
|
5055
|
-
if (identities.has(strategy.strategyName)) {
|
|
5056
|
-
throw new Error(
|
|
5057
|
-
`Duplicate runtime evidence strategy: ${strategy.strategyName}`
|
|
5058
|
-
);
|
|
5059
|
-
}
|
|
5060
|
-
identities.add(strategy.strategyName);
|
|
5061
|
-
}
|
|
5062
|
-
return {
|
|
5063
|
-
...value,
|
|
5064
|
-
strategies
|
|
5065
|
-
};
|
|
5066
|
-
};
|
|
5067
|
-
var resolveRuntimeEvidenceDeploymentSnapshot = async ({
|
|
5068
|
-
userName,
|
|
5069
|
-
projectRoot,
|
|
5070
|
-
deploymentId
|
|
5071
|
-
}) => {
|
|
5072
|
-
const [deployment, strategies] = await Promise.all([
|
|
5073
|
-
(0, import_runtimeStrategies2.getRuntimeDeployment)({ userName, projectRoot, deploymentId }),
|
|
5074
|
-
(0, import_runtimeStrategies2.loadResolvedRuntimeStrategies)({ userName, projectRoot, deploymentId })
|
|
5075
|
-
]);
|
|
5076
|
-
if (!deployment) {
|
|
5077
|
-
throw new Error(`Runtime deployment not found: ${deploymentId}`);
|
|
5078
|
-
}
|
|
5079
|
-
return {
|
|
5080
|
-
schemaVersion: 2,
|
|
5081
|
-
id: deployment.id,
|
|
5082
|
-
deploymentCompositionId: deployment.deploymentCompositionId,
|
|
5083
|
-
label: deployment.label,
|
|
5084
|
-
connectorName: deployment.connectorName,
|
|
5085
|
-
provider: deployment.provider,
|
|
5086
|
-
accountId: deployment.accountId,
|
|
5087
|
-
enabled: deployment.enabled,
|
|
5088
|
-
strategies: strategies.map(
|
|
5089
|
-
({
|
|
5090
|
-
strategyName,
|
|
5091
|
-
strategyRevision,
|
|
5092
|
-
enabled,
|
|
5093
|
-
controlState,
|
|
5094
|
-
interval,
|
|
5095
|
-
universe,
|
|
5096
|
-
accountId,
|
|
5097
|
-
strategyPackage,
|
|
5098
|
-
strategyPackageVersion,
|
|
5099
|
-
strategyDependencyVersions,
|
|
5100
|
-
runtimePackageVersion,
|
|
5101
|
-
strategyConfig,
|
|
5102
|
-
selection
|
|
5103
|
-
}) => ({
|
|
5104
|
-
strategyName,
|
|
5105
|
-
strategyRevision,
|
|
5106
|
-
enabled,
|
|
5107
|
-
controlState,
|
|
5108
|
-
interval,
|
|
5109
|
-
universe,
|
|
5110
|
-
...accountId ? { accountId } : {},
|
|
5111
|
-
strategyPackage,
|
|
5112
|
-
strategyPackageVersion,
|
|
5113
|
-
strategyDependencyVersions,
|
|
5114
|
-
runtimePackageVersion,
|
|
5115
|
-
strategyConfig,
|
|
5116
|
-
...selection ? { selection } : {}
|
|
5117
|
-
})
|
|
5118
|
-
),
|
|
5119
|
-
...deployment.assetClasses ? { assetClasses: [...deployment.assetClasses] } : {},
|
|
5120
|
-
...deployment.tickers ? { tickers: [...deployment.tickers] } : {}
|
|
5121
|
-
};
|
|
5122
|
-
};
|
|
5007
|
+
var runtimeEvidenceDeployment_exports = {};
|
|
5008
|
+
__reExport(runtimeEvidenceDeployment_exports, require("@tradejs/node/diagnostics"));
|
|
5123
5009
|
|
|
5124
5010
|
// src/lib/runtimeEvidenceProducer.ts
|
|
5125
|
-
var
|
|
5126
|
-
|
|
5127
|
-
var import_node_path = __toESM(require("path"));
|
|
5128
|
-
var isRecord2 = (value) => value != null && typeof value === "object" && !Array.isArray(value);
|
|
5129
|
-
var sha256 = (value) => (0, import_node_crypto2.createHash)("sha256").update(value).digest("hex");
|
|
5130
|
-
var parseRuntimeEvidenceProducer = (value) => {
|
|
5131
|
-
const producer = isRecord2(value) ? value : null;
|
|
5132
|
-
const runtimePackageManifest = isRecord2(producer?.runtimePackageManifest) ? producer.runtimePackageManifest : null;
|
|
5133
|
-
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)) {
|
|
5134
|
-
throw new Error("Runtime evidence producer image identity is invalid");
|
|
5135
|
-
}
|
|
5136
|
-
return producer;
|
|
5137
|
-
};
|
|
5138
|
-
var resolveRuntimeEvidenceProducer = async ({
|
|
5139
|
-
projectRoot,
|
|
5140
|
-
required
|
|
5141
|
-
}) => {
|
|
5142
|
-
const projectSha = String(process.env.TRADEJS_PROJECT_SHA ?? "").trim();
|
|
5143
|
-
const imageDigest = String(
|
|
5144
|
-
process.env.TRADEJS_PROJECT_IMAGE_DIGEST ?? ""
|
|
5145
|
-
).trim();
|
|
5146
|
-
if (!projectSha && !imageDigest && !required) {
|
|
5147
|
-
return null;
|
|
5148
|
-
}
|
|
5149
|
-
if (!/^[a-f0-9]{40}$/.test(projectSha)) {
|
|
5150
|
-
throw new Error(
|
|
5151
|
-
"TRADEJS_PROJECT_SHA must be a full lowercase Git SHA before publishing runtime evidence"
|
|
5152
|
-
);
|
|
5153
|
-
}
|
|
5154
|
-
if (!/^sha256:[a-f0-9]{64}$/.test(imageDigest)) {
|
|
5155
|
-
throw new Error(
|
|
5156
|
-
"TRADEJS_PROJECT_IMAGE_DIGEST must be an immutable sha256 digest before publishing runtime evidence"
|
|
5157
|
-
);
|
|
5158
|
-
}
|
|
5159
|
-
const manifestPath = import_node_path.default.join(projectRoot, "runtime-package-manifest.json");
|
|
5160
|
-
let manifest;
|
|
5161
|
-
try {
|
|
5162
|
-
manifest = await import_promises.default.readFile(manifestPath);
|
|
5163
|
-
} catch (error) {
|
|
5164
|
-
if (!required && error.code === "ENOENT") {
|
|
5165
|
-
return null;
|
|
5166
|
-
}
|
|
5167
|
-
throw new Error(
|
|
5168
|
-
`Runtime package manifest is required for runtime evidence: ${manifestPath}`,
|
|
5169
|
-
{ cause: error }
|
|
5170
|
-
);
|
|
5171
|
-
}
|
|
5172
|
-
return {
|
|
5173
|
-
schemaVersion: 1,
|
|
5174
|
-
projectSha,
|
|
5175
|
-
imageDigest,
|
|
5176
|
-
runtimePackageManifest: {
|
|
5177
|
-
file: "runtime-package-manifest.json",
|
|
5178
|
-
sha256: sha256(manifest)
|
|
5179
|
-
}
|
|
5180
|
-
};
|
|
5181
|
-
};
|
|
5011
|
+
var runtimeEvidenceProducer_exports = {};
|
|
5012
|
+
__reExport(runtimeEvidenceProducer_exports, require("@tradejs/node/diagnostics"));
|
|
5182
5013
|
|
|
5183
5014
|
// src/lib/runtimeEvidenceCompositionSnapshots.ts
|
|
5184
5015
|
var SNAPSHOT_FILE = "snapshot.json";
|
|
@@ -5198,8 +5029,8 @@ var createRuntimeEvidenceCompositionSnapshotRecorder = ({
|
|
|
5198
5029
|
}
|
|
5199
5030
|
};
|
|
5200
5031
|
};
|
|
5201
|
-
var
|
|
5202
|
-
var
|
|
5032
|
+
var isRecord = (value) => value != null && typeof value === "object" && !Array.isArray(value);
|
|
5033
|
+
var sha256 = (value) => (0, import_node_crypto2.createHash)("sha256").update(value).digest("hex");
|
|
5203
5034
|
var safeSegment = (value, label) => {
|
|
5204
5035
|
const normalized = value.trim();
|
|
5205
5036
|
if (!normalized || !/^[a-zA-Z0-9._:-]+$/.test(normalized)) {
|
|
@@ -5212,8 +5043,8 @@ var isExistingDestinationError = (error) => {
|
|
|
5212
5043
|
return code === "EEXIST" || code === "ENOTEMPTY";
|
|
5213
5044
|
};
|
|
5214
5045
|
var parseManifest = (value) => {
|
|
5215
|
-
const manifest =
|
|
5216
|
-
const payload =
|
|
5046
|
+
const manifest = isRecord(value) ? value : null;
|
|
5047
|
+
const payload = isRecord(manifest?.payload) ? manifest.payload : null;
|
|
5217
5048
|
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") {
|
|
5218
5049
|
throw new Error("Invalid runtime evidence composition snapshot manifest");
|
|
5219
5050
|
}
|
|
@@ -5221,28 +5052,28 @@ var parseManifest = (value) => {
|
|
|
5221
5052
|
};
|
|
5222
5053
|
var verifyRuntimeEvidenceCompositionSnapshot = async (bundleDir) => {
|
|
5223
5054
|
const [manifestText, payload, completeText] = await Promise.all([
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5055
|
+
import_promises.default.readFile(import_node_path.default.join(bundleDir, MANIFEST_FILE), "utf8"),
|
|
5056
|
+
import_promises.default.readFile(import_node_path.default.join(bundleDir, SNAPSHOT_FILE)),
|
|
5057
|
+
import_promises.default.readFile(import_node_path.default.join(bundleDir, COMPLETE_FILE), "utf8")
|
|
5227
5058
|
]);
|
|
5228
5059
|
const manifest = parseManifest(JSON.parse(manifestText));
|
|
5229
5060
|
if (completeText.trim() !== manifest.deploymentCompositionId) {
|
|
5230
5061
|
throw new Error(`Invalid completion marker in ${bundleDir}`);
|
|
5231
5062
|
}
|
|
5232
|
-
if (payload.byteLength !== manifest.payload.bytes ||
|
|
5063
|
+
if (payload.byteLength !== manifest.payload.bytes || sha256(payload) !== manifest.payload.sha256) {
|
|
5233
5064
|
throw new Error(
|
|
5234
5065
|
`Runtime evidence snapshot checksum mismatch in ${bundleDir}`
|
|
5235
5066
|
);
|
|
5236
5067
|
}
|
|
5237
5068
|
const value = JSON.parse(payload.toString("utf8"));
|
|
5238
|
-
const record =
|
|
5069
|
+
const record = isRecord(value) ? value : null;
|
|
5239
5070
|
if (record?.schemaVersion !== 1 || record.reportType !== "runtime-evidence-composition-snapshot" || record.userName !== manifest.userName) {
|
|
5240
5071
|
throw new Error(
|
|
5241
5072
|
`Invalid runtime evidence snapshot payload in ${bundleDir}`
|
|
5242
5073
|
);
|
|
5243
5074
|
}
|
|
5244
|
-
const deployment = parseRuntimeEvidenceDeploymentSnapshot(record.deployment);
|
|
5245
|
-
const producer = parseRuntimeEvidenceProducer(record.producer);
|
|
5075
|
+
const deployment = (0, runtimeEvidenceDeployment_exports.parseRuntimeEvidenceDeploymentSnapshot)(record.deployment);
|
|
5076
|
+
const producer = (0, runtimeEvidenceProducer_exports.parseRuntimeEvidenceProducer)(record.producer);
|
|
5246
5077
|
if (deployment.id !== manifest.deploymentId || deployment.deploymentCompositionId !== manifest.deploymentCompositionId) {
|
|
5247
5078
|
throw new Error(
|
|
5248
5079
|
`Runtime evidence snapshot identity mismatch in ${bundleDir}`
|
|
@@ -5282,43 +5113,43 @@ var publishRuntimeEvidenceCompositionSnapshot = async ({
|
|
|
5282
5113
|
deploymentCompositionId: compositionId,
|
|
5283
5114
|
payload: {
|
|
5284
5115
|
file: SNAPSHOT_FILE,
|
|
5285
|
-
sha256:
|
|
5116
|
+
sha256: sha256(payload),
|
|
5286
5117
|
bytes: Buffer.byteLength(payload)
|
|
5287
5118
|
}
|
|
5288
5119
|
};
|
|
5289
|
-
const snapshotsRoot =
|
|
5290
|
-
const bundleDir =
|
|
5291
|
-
const temporaryDir =
|
|
5120
|
+
const snapshotsRoot = import_node_path.default.join(evidenceRoot, "snapshots", deploymentId);
|
|
5121
|
+
const bundleDir = import_node_path.default.join(snapshotsRoot, compositionId);
|
|
5122
|
+
const temporaryDir = import_node_path.default.join(
|
|
5292
5123
|
evidenceRoot,
|
|
5293
5124
|
"incoming",
|
|
5294
|
-
`snapshot-${compositionId}.tmp-${(0,
|
|
5125
|
+
`snapshot-${compositionId}.tmp-${(0, import_node_crypto2.randomUUID)()}`
|
|
5295
5126
|
);
|
|
5296
|
-
await
|
|
5127
|
+
await import_promises.default.mkdir(temporaryDir, { recursive: true });
|
|
5297
5128
|
try {
|
|
5298
5129
|
await Promise.all([
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5130
|
+
import_promises.default.writeFile(import_node_path.default.join(temporaryDir, SNAPSHOT_FILE), payload, "utf8"),
|
|
5131
|
+
import_promises.default.writeFile(
|
|
5132
|
+
import_node_path.default.join(temporaryDir, MANIFEST_FILE),
|
|
5302
5133
|
`${JSON.stringify(manifest, null, 2)}
|
|
5303
5134
|
`,
|
|
5304
5135
|
"utf8"
|
|
5305
5136
|
)
|
|
5306
5137
|
]);
|
|
5307
|
-
await
|
|
5308
|
-
|
|
5138
|
+
await import_promises.default.writeFile(
|
|
5139
|
+
import_node_path.default.join(temporaryDir, COMPLETE_FILE),
|
|
5309
5140
|
`${compositionId}
|
|
5310
5141
|
`,
|
|
5311
5142
|
"utf8"
|
|
5312
5143
|
);
|
|
5313
|
-
await
|
|
5144
|
+
await import_promises.default.mkdir(snapshotsRoot, { recursive: true });
|
|
5314
5145
|
try {
|
|
5315
|
-
await
|
|
5146
|
+
await import_promises.default.rename(temporaryDir, bundleDir);
|
|
5316
5147
|
} catch (error) {
|
|
5317
5148
|
if (!isExistingDestinationError(error)) throw error;
|
|
5318
|
-
await
|
|
5149
|
+
await import_promises.default.rm(temporaryDir, { recursive: true, force: true });
|
|
5319
5150
|
}
|
|
5320
5151
|
} catch (error) {
|
|
5321
|
-
await
|
|
5152
|
+
await import_promises.default.rm(temporaryDir, { recursive: true, force: true });
|
|
5322
5153
|
throw error;
|
|
5323
5154
|
}
|
|
5324
5155
|
const verified = await verifyRuntimeEvidenceCompositionSnapshot(bundleDir);
|
|
@@ -5336,12 +5167,12 @@ var captureRuntimeEvidenceCompositionSnapshot = async ({
|
|
|
5336
5167
|
expectedCompositionId
|
|
5337
5168
|
}) => {
|
|
5338
5169
|
const [deployment, producer] = await Promise.all([
|
|
5339
|
-
resolveRuntimeEvidenceDeploymentSnapshot({
|
|
5170
|
+
(0, runtimeEvidenceDeployment_exports.resolveRuntimeEvidenceDeploymentSnapshot)({
|
|
5340
5171
|
userName,
|
|
5341
5172
|
projectRoot,
|
|
5342
5173
|
deploymentId
|
|
5343
5174
|
}),
|
|
5344
|
-
resolveRuntimeEvidenceProducer({ projectRoot, required: true })
|
|
5175
|
+
(0, runtimeEvidenceProducer_exports.resolveRuntimeEvidenceProducer)({ projectRoot, required: true })
|
|
5345
5176
|
]);
|
|
5346
5177
|
if (!producer) {
|
|
5347
5178
|
throw new Error("Runtime evidence producer identity is required");
|
|
@@ -5352,7 +5183,7 @@ var captureRuntimeEvidenceCompositionSnapshot = async ({
|
|
|
5352
5183
|
);
|
|
5353
5184
|
}
|
|
5354
5185
|
await publishRuntimeEvidenceCompositionSnapshot({
|
|
5355
|
-
evidenceRoot:
|
|
5186
|
+
evidenceRoot: import_node_path.default.join(projectRoot, "data", "runtime-evidence"),
|
|
5356
5187
|
userName,
|
|
5357
5188
|
deployment,
|
|
5358
5189
|
producer
|
|
@@ -5434,7 +5265,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5434
5265
|
return connectorName;
|
|
5435
5266
|
};
|
|
5436
5267
|
const createSignalsSession2 = async (lifecycle, scope = {}) => {
|
|
5437
|
-
const deployment = config2.deploymentId ? await (0,
|
|
5268
|
+
const deployment = config2.deploymentId ? await (0, import_runtimeStrategies2.getRuntimeDeployment)({
|
|
5438
5269
|
userName: config2.userName,
|
|
5439
5270
|
projectRoot,
|
|
5440
5271
|
deploymentId: config2.deploymentId
|
|
@@ -5951,7 +5782,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5951
5782
|
if (!config2.deploymentId) {
|
|
5952
5783
|
throw new Error("Runtime deployment id is required");
|
|
5953
5784
|
}
|
|
5954
|
-
const configuredDeployment = await (0,
|
|
5785
|
+
const configuredDeployment = await (0, import_runtimeStrategies2.getRuntimeDeployment)({
|
|
5955
5786
|
userName: config2.userName,
|
|
5956
5787
|
projectRoot,
|
|
5957
5788
|
deploymentId: config2.deploymentId
|
|
@@ -5985,7 +5816,7 @@ var createSignalsRunner = (config2) => {
|
|
|
5985
5816
|
throw new Error("Runtime deployment id is required");
|
|
5986
5817
|
}
|
|
5987
5818
|
const deploymentId = config2.deploymentId;
|
|
5988
|
-
const initialDeployment = await (0,
|
|
5819
|
+
const initialDeployment = await (0, import_runtimeStrategies2.getRuntimeDeployment)({
|
|
5989
5820
|
userName: config2.userName,
|
|
5990
5821
|
projectRoot,
|
|
5991
5822
|
deploymentId
|
|
@@ -6010,7 +5841,7 @@ var createSignalsRunner = (config2) => {
|
|
|
6010
5841
|
settleDelayMs: resolveNonNegativeInteger(config2.settleDelayMs, 5e3),
|
|
6011
5842
|
signal: abortController.signal,
|
|
6012
5843
|
runCycle: async () => {
|
|
6013
|
-
const currentDeployment = await (0,
|
|
5844
|
+
const currentDeployment = await (0, import_runtimeStrategies2.getRuntimeDeployment)({
|
|
6014
5845
|
userName: config2.userName,
|
|
6015
5846
|
projectRoot,
|
|
6016
5847
|
deploymentId
|