@loucompanion/forge-bridge 0.1.4-dev.9445952e33ba → 0.1.4-dev.9ddc336f8a9d
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 +1 -1
- package/dist/bridge/bridge.service.d.ts +12 -1
- package/dist/bridge/bridge.service.js +51 -5
- package/dist/bridge/bridge.types.d.ts +6 -0
- package/dist/bridge/dispatch-result-outbox.d.ts +11 -1
- package/dist/bridge/dispatch-result-outbox.js +31 -6
- package/dist/cli/cli.help.js +2 -2
- package/dist/runtime/attempt-process-supervisor.d.ts +24 -0
- package/dist/runtime/attempt-process-supervisor.js +77 -3
- package/dist/runtime/host-database-capability-boundary.d.ts +1 -1
- package/dist/runtime/host-database-capability-boundary.js +1 -0
- package/dist/runtime/host-diagnostics.js +4 -3
- package/dist/runtime/host-facts.d.ts +35 -0
- package/dist/runtime/host-facts.js +95 -0
- package/dist/runtime/host-load-sampler.d.ts +83 -0
- package/dist/runtime/host-load-sampler.js +164 -0
- package/dist/runtime/host-pressure-stall.d.ts +41 -0
- package/dist/runtime/host-pressure-stall.js +121 -0
- package/dist/runtime/host-runtime-contract.d.ts +1 -0
- package/dist/runtime/host-runtime-contract.js +2 -0
- package/dist/runtime/host-runtime-lease.js +55 -9
- package/dist/runtime/managed-command-teardown.d.ts +62 -0
- package/dist/runtime/managed-command-teardown.js +607 -0
- package/dist/runtime/node-host-runtime-adapter.js +5 -4
- package/dist/runtime/playwright-browser-cache.d.ts +39 -0
- package/dist/runtime/playwright-browser-cache.js +227 -0
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +11 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +48 -54
- package/dist/sandbox/repository-lock.js +3 -2
- package/dist/sandbox/runtime.js +5 -4
- package/dist/session/managed-attempt-tools.d.ts +25 -0
- package/dist/session/managed-attempt-tools.js +216 -18
- package/dist/session/managed-build-coordinator.d.ts +1 -1
- package/dist/session/managed-build-coordinator.js +8 -4
- package/dist/session/phase-completion.runtime.js +22 -17
- package/dist/session/pre-publication-process.d.ts +20 -0
- package/dist/session/pre-publication-process.js +97 -0
- package/dist/session/pre-publication-skipped-tests.d.ts +21 -0
- package/dist/session/pre-publication-skipped-tests.js +109 -0
- package/dist/session/pre-publication-validation.js +27 -57
- package/dist/session/provider-cli/provider-cli.process.d.ts +6 -1
- package/dist/session/provider-cli/provider-cli.process.js +198 -16
- package/dist/session/provider-cli/provider-cli.service.js +7 -3
- package/dist/session/provider-cli/provider-usage.d.ts +2 -1
- package/dist/shared/process/host-process-recovery.js +3 -2
- package/dist/shared/process/host-process-supervisor.js +5 -4
- package/dist/shared/time/monotonic.d.ts +1 -0
- package/dist/shared/time/monotonic.js +8 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/dependency-warmer.js +74 -0
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { execFileSync } from "node:child_process";
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { monotonicNowMs } from "../time/monotonic.js";
|
|
6
7
|
const windowsJobSupervisorPath = fileURLToPath(new URL("../../../runtime/windows-job-supervisor.ps1", import.meta.url));
|
|
7
8
|
export function resolveHostProcessSupervisedLaunch(request, resolvedCommand, resolvedArgs, platform = process.platform) {
|
|
8
9
|
const env = request.env;
|
|
@@ -277,8 +278,8 @@ function unixProcessGroupExists(processGroupId) {
|
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
280
|
async function waitForUnixProcessGroupExit(processGroupId, timeoutMs) {
|
|
280
|
-
const deadline =
|
|
281
|
-
while (
|
|
281
|
+
const deadline = monotonicNowMs() + timeoutMs;
|
|
282
|
+
while (monotonicNowMs() < deadline && unixProcessGroupExists(processGroupId)) {
|
|
282
283
|
await new Promise(resolve => setTimeout(resolve, 25));
|
|
283
284
|
}
|
|
284
285
|
}
|
|
@@ -307,8 +308,8 @@ function processExists(pid) {
|
|
|
307
308
|
}
|
|
308
309
|
}
|
|
309
310
|
async function waitForExactProcessExit(pid, identity, timeoutMs, platform) {
|
|
310
|
-
const deadline =
|
|
311
|
-
while (
|
|
311
|
+
const deadline = monotonicNowMs() + timeoutMs;
|
|
312
|
+
while (monotonicNowMs() < deadline && exactProcessExists(pid, identity, platform)) {
|
|
312
313
|
await new Promise(resolve => setTimeout(resolve, 25));
|
|
313
314
|
}
|
|
314
315
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function monotonicNowMs(): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Elapsed time and local deadlines use the monotonic clock. The wall clock can step:
|
|
2
|
+
// a WSL VM's clock is corrected in multi-second jumps, which would end a local wait
|
|
3
|
+
// early or count time that never passed. Timestamps that are persisted or compared
|
|
4
|
+
// across processes (lease expiry, receipts, file mtimes) stay on the wall clock.
|
|
5
|
+
// Read through the global so test fake timers that replace `performance` apply.
|
|
6
|
+
export function monotonicNowMs() {
|
|
7
|
+
return performance.now();
|
|
8
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const forgeBridgeVersion = "0.1.4-dev.
|
|
1
|
+
export declare const forgeBridgeVersion = "0.1.4-dev.9ddc336f8a9d";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const forgeBridgeVersion = "0.1.4-dev.
|
|
1
|
+
export const forgeBridgeVersion = "0.1.4-dev.9ddc336f8a9d";
|
|
@@ -36,6 +36,7 @@ const dependencyPreparationCoordinator = new RepositoryCoordinatorLock(defaultWo
|
|
|
36
36
|
export async function detectWarmPaths(repoRoot, warmPathOverrides = []) {
|
|
37
37
|
const entries = new Map();
|
|
38
38
|
await collectDetectedPaths(repoRoot, repoRoot, entries, 0);
|
|
39
|
+
await collectSolutionProjectRestores(repoRoot, entries);
|
|
39
40
|
for (const override of warmPathOverrides) {
|
|
40
41
|
const normalized = normalizeRelativePath(override);
|
|
41
42
|
if (!normalized) {
|
|
@@ -539,6 +540,79 @@ async function hasPythonMarker(dir) {
|
|
|
539
540
|
return (await pathExists(path.join(dir, "pyproject.toml")))
|
|
540
541
|
|| (await pathExists(path.join(dir, "requirements.txt")));
|
|
541
542
|
}
|
|
543
|
+
const solutionProjectPattern = /^Project\("\{[0-9A-Fa-f-]+\}"\)\s*=\s*"[^"]*"\s*,\s*"([^"]+\.(?:cs|fs|vb)proj)"/gimu;
|
|
544
|
+
const slnxProjectPattern = /<Project\b[^>]*\bPath\s*=\s*"([^"]+\.(?:cs|fs|vb)proj)"/giu;
|
|
545
|
+
const projectFilePattern = /\.(?:cs|fs|vb)proj$/iu;
|
|
546
|
+
const solutionFilePattern = /\.(?:sln|slnx|slnf)$/iu;
|
|
547
|
+
/**
|
|
548
|
+
* A worktree built from a never-built base checkout (a fresh runner clone has no bin/ or obj/)
|
|
549
|
+
* still needs its .NET projects restored, or the --no-restore runtime build fails with NETSDK1004.
|
|
550
|
+
* Restore exactly the projects the root solution(s) (.sln, .slnx, .slnf) list, or a lone root
|
|
551
|
+
* project when there is no solution. Other projects (fixtures, samples) keep the base-checkout
|
|
552
|
+
* output heuristic above.
|
|
553
|
+
*/
|
|
554
|
+
async function collectSolutionProjectRestores(repoRoot, entries) {
|
|
555
|
+
const rootNames = await fs.readdir(repoRoot).catch(() => []);
|
|
556
|
+
const solutions = rootNames.filter((name) => solutionFilePattern.test(name));
|
|
557
|
+
if (solutions.length === 0) {
|
|
558
|
+
const rootProjects = rootNames.filter((name) => name.toLowerCase().endsWith(".csproj"));
|
|
559
|
+
if (rootProjects.length === 1) {
|
|
560
|
+
addEntry(entries, repoRoot, "", "obj", "dotnet", "obj");
|
|
561
|
+
}
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
for (const solution of solutions) {
|
|
565
|
+
for (const listed of await readSolutionProjectPaths(repoRoot, solution)) {
|
|
566
|
+
const projectPath = path.posix.normalize(normalizeRelativePath(listed));
|
|
567
|
+
if (!projectPath || projectPath === ".." || projectPath.startsWith("../") || path.posix.isAbsolute(projectPath)) {
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
const absoluteProject = path.resolve(repoRoot, ...projectPath.split("/"));
|
|
571
|
+
if (!isSubPath(repoRoot, absoluteProject) || !(await pathExists(absoluteProject))) {
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
const projectDir = path.posix.dirname(projectPath);
|
|
575
|
+
// The fallback runs a bare `dotnet restore` in the project's directory. Beside the solution,
|
|
576
|
+
// or next to another project file, that restore is ambiguous (MSB1011); leave those layouts
|
|
577
|
+
// to the base-checkout output heuristic.
|
|
578
|
+
if (projectDir === "." || (await countProjectFiles(path.dirname(absoluteProject))) !== 1) {
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
addEntry(entries, repoRoot, projectDir, "obj", "dotnet", joinRelative(projectDir, "obj"));
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
/** Project paths a root solution lists, relative to the repo root (forward slashes). */
|
|
586
|
+
async function readSolutionProjectPaths(repoRoot, solution) {
|
|
587
|
+
const text = await fs.readFile(path.join(repoRoot, solution), "utf8").catch(() => "");
|
|
588
|
+
const lower = solution.toLowerCase();
|
|
589
|
+
if (lower.endsWith(".sln")) {
|
|
590
|
+
return [...text.matchAll(solutionProjectPattern)].map((match) => match[1].replace(/\\/g, "/"));
|
|
591
|
+
}
|
|
592
|
+
if (lower.endsWith(".slnx")) {
|
|
593
|
+
return [...text.matchAll(slnxProjectPattern)].map((match) => match[1].replace(/\\/g, "/"));
|
|
594
|
+
}
|
|
595
|
+
// .slnf: {"solution": {"path": "<solution>", "projects": [...]}}, projects relative to that solution.
|
|
596
|
+
let filter;
|
|
597
|
+
try {
|
|
598
|
+
filter = JSON.parse(text.replace(/^\uFEFF/u, ""));
|
|
599
|
+
}
|
|
600
|
+
catch {
|
|
601
|
+
return [];
|
|
602
|
+
}
|
|
603
|
+
const body = filter?.solution;
|
|
604
|
+
if (!body || typeof body.path !== "string" || !Array.isArray(body.projects)) {
|
|
605
|
+
return [];
|
|
606
|
+
}
|
|
607
|
+
const solutionDir = path.posix.dirname(body.path.replace(/\\/g, "/"));
|
|
608
|
+
return body.projects
|
|
609
|
+
.filter((project) => typeof project === "string" && projectFilePattern.test(project))
|
|
610
|
+
.map((project) => path.posix.join(solutionDir, project.replace(/\\/g, "/")));
|
|
611
|
+
}
|
|
612
|
+
async function countProjectFiles(dir) {
|
|
613
|
+
const names = await fs.readdir(dir).catch(() => []);
|
|
614
|
+
return names.filter((name) => projectFilePattern.test(name)).length;
|
|
615
|
+
}
|
|
542
616
|
async function hasDotNetMarker(dir) {
|
|
543
617
|
const entries = await fs.readdir(dir).catch(() => []);
|
|
544
618
|
return entries.some((name) => name.endsWith(".csproj") || name.endsWith(".sln"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loucompanion/forge-bridge",
|
|
3
|
-
"version": "0.1.4-dev.
|
|
3
|
+
"version": "0.1.4-dev.9ddc336f8a9d",
|
|
4
4
|
"description": "Forge runner bridge CLI for connecting local developer machines to Forge dispatch.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|