@loucompanion/forge-bridge 0.1.4-dev.bfa11ebe98c6 → 0.1.4-dev.d2d83bc81b6a

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.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/dist/bridge/bridge.service.d.ts +9 -0
  3. package/dist/bridge/bridge.service.js +42 -4
  4. package/dist/bridge/dispatch-result-outbox.d.ts +11 -1
  5. package/dist/bridge/dispatch-result-outbox.js +31 -6
  6. package/dist/cli/cli.help.js +2 -2
  7. package/dist/runtime/attempt-database-broker.d.ts +89 -0
  8. package/dist/runtime/attempt-database-broker.js +390 -0
  9. package/dist/runtime/attempt-process-supervisor.d.ts +24 -0
  10. package/dist/runtime/attempt-process-supervisor.js +77 -3
  11. package/dist/runtime/host-diagnostics.js +4 -3
  12. package/dist/runtime/host-runtime-contract.js +69 -10
  13. package/dist/runtime/host-runtime-lease.d.ts +4 -2
  14. package/dist/runtime/host-runtime-lease.js +108 -24
  15. package/dist/runtime/managed-command-teardown.d.ts +62 -0
  16. package/dist/runtime/managed-command-teardown.js +607 -0
  17. package/dist/runtime/node-host-runtime-adapter.js +5 -4
  18. package/dist/runtime/playwright-browser-cache.d.ts +39 -0
  19. package/dist/runtime/playwright-browser-cache.js +227 -0
  20. package/dist/runtime/playwright-host-runtime-adapter.d.ts +11 -0
  21. package/dist/runtime/playwright-host-runtime-adapter.js +48 -54
  22. package/dist/sandbox/repository-lock.js +3 -2
  23. package/dist/sandbox/runtime.js +5 -4
  24. package/dist/session/managed-attempt-tools.d.ts +25 -0
  25. package/dist/session/managed-attempt-tools.js +222 -20
  26. package/dist/session/managed-build-coordinator.d.ts +1 -1
  27. package/dist/session/managed-build-coordinator.js +8 -4
  28. package/dist/session/phase-completion.runtime.js +30 -18
  29. package/dist/session/pre-publication-process.d.ts +20 -0
  30. package/dist/session/pre-publication-process.js +96 -0
  31. package/dist/session/pre-publication-validation.js +9 -54
  32. package/dist/session/provider-cli/provider-cli.process.d.ts +6 -1
  33. package/dist/session/provider-cli/provider-cli.process.js +198 -16
  34. package/dist/session/provider-cli/provider-cli.runtime.d.ts +6 -0
  35. package/dist/session/provider-cli/provider-cli.runtime.js +14 -0
  36. package/dist/session/provider-cli/provider-cli.service.js +10 -5
  37. package/dist/session/provider-cli/provider-usage.d.ts +2 -1
  38. package/dist/shared/process/host-process-recovery.js +3 -2
  39. package/dist/shared/process/host-process-supervisor.js +5 -4
  40. package/dist/shared/time/monotonic.d.ts +1 -0
  41. package/dist/shared/time/monotonic.js +8 -0
  42. package/dist/version.d.ts +1 -1
  43. package/dist/version.js +1 -1
  44. package/dist/worktree/dependency-warmer.js +74 -0
  45. package/package.json +1 -1
@@ -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.bfa11ebe98c6",
3
+ "version": "0.1.4-dev.d2d83bc81b6a",
4
4
  "description": "Forge runner bridge CLI for connecting local developer machines to Forge dispatch.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",