@sireai/optimus 0.1.15 → 0.1.16
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/optimus.js +15 -4
- package/dist/cli/optimus.js.map +1 -1
- package/dist/task-environment/cancellation/task-cleanup-service.d.ts +1 -0
- package/dist/task-environment/cancellation/task-cleanup-service.js +22 -1
- package/dist/task-environment/cancellation/task-cleanup-service.js.map +1 -1
- package/dist/task-environment/orchestration/execution-context-assembler.js +5 -3
- package/dist/task-environment/orchestration/execution-context-assembler.js.map +1 -1
- package/dist/task-environment/orchestration/task-orchestrator.d.ts +1 -0
- package/dist/task-environment/orchestration/task-orchestrator.js +37 -1
- package/dist/task-environment/orchestration/task-orchestrator.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/optimus.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { buildDefaultConfig, loadConfig } from "../config/load-config.js";
|
|
3
3
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
4
4
|
import { access, mkdir, readdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
5
|
-
import { basename, dirname, join, resolve } from "node:path";
|
|
5
|
+
import { basename, dirname, join, resolve, sep } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { execFile, spawn } from "node:child_process";
|
|
8
8
|
import { createInterface } from "node:readline/promises";
|
|
@@ -1731,15 +1731,25 @@ function inferArtifactDir(artifacts, bundle) {
|
|
|
1731
1731
|
}
|
|
1732
1732
|
return dirname(artifactPath);
|
|
1733
1733
|
}
|
|
1734
|
-
function inferTaskRootDir(artifactDir) {
|
|
1734
|
+
function inferTaskRootDir(artifactDir, fallbackTaskRootDir) {
|
|
1735
1735
|
if (!artifactDir) {
|
|
1736
|
-
return
|
|
1736
|
+
return fallbackTaskRootDir;
|
|
1737
|
+
}
|
|
1738
|
+
if (fallbackTaskRootDir) {
|
|
1739
|
+
const resolvedArtifactDir = resolve(artifactDir);
|
|
1740
|
+
const resolvedFallbackTaskRootDir = resolve(fallbackTaskRootDir);
|
|
1741
|
+
if (resolvedArtifactDir === resolvedFallbackTaskRootDir
|
|
1742
|
+
|| resolvedArtifactDir.startsWith(`${resolvedFallbackTaskRootDir}${sep}`)) {
|
|
1743
|
+
return resolve(artifactDir, "..", "..");
|
|
1744
|
+
}
|
|
1745
|
+
return resolvedFallbackTaskRootDir;
|
|
1737
1746
|
}
|
|
1738
1747
|
return resolve(artifactDir, "..", "..");
|
|
1739
1748
|
}
|
|
1740
1749
|
async function buildReplayExecutionContext(input) {
|
|
1741
1750
|
const artifactDir = inferArtifactDir(input.artifacts, input.deliveryBundle);
|
|
1742
|
-
const
|
|
1751
|
+
const fallbackTaskRootDir = join(input.config.storage.rootDir, "workspaces", input.taskId);
|
|
1752
|
+
const taskRootDir = inferTaskRootDir(artifactDir, fallbackTaskRootDir);
|
|
1743
1753
|
const sourceDir = input.deliveryBundle?.publication?.git?.repoDir?.trim()
|
|
1744
1754
|
|| input.latestRun?.addresses?.visibleRepoDir?.trim()
|
|
1745
1755
|
|| input.latestRun?.addresses?.workspaceDir?.trim();
|
|
@@ -2363,6 +2373,7 @@ async function main() {
|
|
|
2363
2373
|
const existingBundle = await store.getLatestTaskDeliveryBundle(taskId);
|
|
2364
2374
|
const latestRun = (await store.listTaskRuns()).filter((run) => run.taskId === taskId).at(-1) ?? null;
|
|
2365
2375
|
const replayContext = await buildReplayExecutionContext({
|
|
2376
|
+
taskId,
|
|
2366
2377
|
config,
|
|
2367
2378
|
taskType: task.taskType,
|
|
2368
2379
|
taskRepo: taskPackage.repo,
|