@loucompanion/forge-bridge 0.1.4-dev.e847c8c66ea9 → 0.1.4-dev.ec3460040366

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.
@@ -39,6 +39,7 @@ export declare class ForgeBridgeService implements BridgeService {
39
39
  private leaseWatchdogTimer;
40
40
  private sandboxMaintenanceTimer;
41
41
  private sandboxMaintenanceRunning;
42
+ private attemptSnapshotPending;
42
43
  private closed;
43
44
  private transportRecovery;
44
45
  private transportRecoveryGeneration;
@@ -69,6 +69,7 @@ export class ForgeBridgeService {
69
69
  leaseWatchdogTimer = null;
70
70
  sandboxMaintenanceTimer = null;
71
71
  sandboxMaintenanceRunning = false;
72
+ attemptSnapshotPending = null;
72
73
  closed = null;
73
74
  transportRecovery = null;
74
75
  transportRecoveryGeneration = 0;
@@ -1913,7 +1914,8 @@ export class ForgeBridgeService {
1913
1914
  startSandboxMaintenance() {
1914
1915
  this.stopSandboxMaintenance();
1915
1916
  this.sandboxMaintenanceTimer = setInterval(() => {
1916
- this.runSandboxMaintenance().catch(() => undefined);
1917
+ this.runSandboxMaintenance().catch(error => { if (isBridgeCallbackTimeout(error))
1918
+ logBridgeStatus(`Sandbox maintenance skipped this pass: ${errorMessage(error)}`); });
1917
1919
  }, 60_000);
1918
1920
  this.sandboxMaintenanceTimer.unref?.();
1919
1921
  }
@@ -1953,9 +1955,15 @@ export class ForgeBridgeService {
1953
1955
  const connection = this.connection;
1954
1956
  if (!connection)
1955
1957
  throw new Error("Bridge is not connected.");
1956
- const response = await connection.invoke("AttemptSnapshot", {
1957
- runnerInstanceId: this.config.runnerInstanceId
1958
- });
1958
+ // Bounded so it can't hold the maintenance guard; SignalR can't cancel it, so one unanswered call per connection and transport generation.
1959
+ const pending = { connection, generation: this.transportRecoveryGeneration };
1960
+ if (this.attemptSnapshotPending?.connection === connection && this.attemptSnapshotPending.generation === pending.generation)
1961
+ throw new Error("bridge_callback_timeout: AttemptSnapshot from an earlier pass is still unanswered.");
1962
+ this.attemptSnapshotPending = pending;
1963
+ const invocation = connection.invoke("AttemptSnapshot", { runnerInstanceId: this.config.runnerInstanceId });
1964
+ invocation.finally(() => { if (this.attemptSnapshotPending === pending)
1965
+ this.attemptSnapshotPending = null; }).catch(() => undefined);
1966
+ const response = await waitForCallbackAck(invocation, "AttemptSnapshot", positiveFiniteNumber(this.config.callbackAckTimeoutMs ?? 30_000, 30_000));
1959
1967
  if (!response.accepted) {
1960
1968
  throw new BridgeCallbackRejectedError(response.code ?? null, response.message ?? response.code ?? "Attempt snapshot was rejected.");
1961
1969
  }
@@ -2671,10 +2679,7 @@ function errorMessage(error) {
2671
2679
  return error instanceof Error ? error.message : String(error);
2672
2680
  }
2673
2681
  function formatDelay(ms) {
2674
- if (ms >= 1000 && ms % 1000 === 0) {
2675
- return `${ms / 1000}s`;
2676
- }
2677
- return `${ms}ms`;
2682
+ return ms >= 1000 && ms % 1000 === 0 ? `${ms / 1000}s` : `${ms}ms`;
2678
2683
  }
2679
2684
  async function waitForCallbackAck(callback, methodName, timeoutMs, signal) {
2680
2685
  let timeout = null;
@@ -7,9 +7,24 @@ export interface AspNetRuntimePrebuildPlan {
7
7
  readonly cwd: string;
8
8
  readonly environment: Readonly<Record<string, string>>;
9
9
  readonly projectPath: string;
10
+ /** Where the runtime's build output lands and what its receipt verifies: the project's `bin` unless the launch chooses an output. */
11
+ readonly outputDirectory: string;
10
12
  readonly worktreePath: string;
11
13
  readonly inputCommitSha: string;
12
14
  }
15
+ /**
16
+ * The configured launch arguments of a supervised project. An ASP.NET runtime gets its own
17
+ * build output (isolatedRuntimeOutputArguments): its prebuild and `dotnet run` both use it, so an
18
+ * agent's build of the same project writes the default output and never the running runtime's.
19
+ */
20
+ export declare function supervisedRuntimeLaunchArguments(port: {
21
+ readonly name: string;
22
+ readonly adapter: string | null;
23
+ readonly launch: {
24
+ readonly command: string;
25
+ readonly args: readonly string[];
26
+ };
27
+ }): readonly string[];
13
28
  export interface AspNetRuntimePrebuildResult {
14
29
  readonly cacheHit: boolean;
15
30
  readonly receiptPath: string;
@@ -5,6 +5,17 @@ import path from "node:path";
5
5
  import { ForgeFailureError } from "../session/session.types.js";
6
6
  import { redactText } from "../shared/redaction/redaction.js";
7
7
  import { replaceFile } from "../shared/fs/replace-file.js";
8
+ import { canonicalExistingPathSync, declaresDotnetOutput, isolatedRuntimeOutputArguments, parseDotnetOutputCommand, projectOutputRoot, projectReferenceIncludes, } from "./dotnet-build-outputs.js";
9
+ /**
10
+ * The configured launch arguments of a supervised project. An ASP.NET runtime gets its own
11
+ * build output (isolatedRuntimeOutputArguments): its prebuild and `dotnet run` both use it, so an
12
+ * agent's build of the same project writes the default output and never the running runtime's.
13
+ */
14
+ export function supervisedRuntimeLaunchArguments(port) {
15
+ return port.adapter === "aspnetcore"
16
+ ? isolatedRuntimeOutputArguments(port.launch.command, port.launch.args, port.name)
17
+ : port.launch.args;
18
+ }
8
19
  const inFlightPrebuilds = new Map();
9
20
  /** Runs one ASP.NET runtime build under the attempt's supervisor, logging only redacted output. */
10
21
  export async function executeAspNetRuntimeBuild(supervisor, logDirectory, plan, signal, exactSecrets = [],
@@ -79,18 +90,46 @@ export function createAspNetRuntimePrebuildPlan(options) {
79
90
  args: buildArgs,
80
91
  environment: buildEnvironmentContract(options.environment ?? {}),
81
92
  })).digest("hex")}`;
93
+ const outputDirectory = runtimeOutputDirectory(options, projectPath, projectDirectory, normalizedWorktree);
94
+ // A chosen output (the isolated OutDir, or the launch's own) keeps its own receipt, verifying only its own files.
95
+ const receiptName = outputDirectory === path.join(projectDirectory, "bin")
96
+ ? ".forge-runtime-build.json"
97
+ : `.forge-runtime-build.${createHash("sha256").update(path.relative(projectDirectory, outputDirectory).replaceAll("\\", "/")).digest("hex").slice(0, 12)}.json`;
82
98
  return {
83
99
  fingerprint,
84
- receiptPath: path.join(projectDirectory, "obj", ".forge-runtime-build.json"),
100
+ receiptPath: path.join(projectDirectory, "obj", receiptName),
85
101
  command: options.command,
86
102
  args: buildArgs,
87
103
  cwd: options.cwd,
88
104
  environment: options.environment ?? {},
89
105
  projectPath,
106
+ outputDirectory,
90
107
  worktreePath: normalizedWorktree,
91
108
  inputCommitSha: options.inputCommitSha,
92
109
  };
93
110
  }
111
+ /**
112
+ * Where the runtime's prebuild writes and its `dotnet run --no-build` reads: the launch's own
113
+ * output choice when it makes one (forwardBuildOptions passes it to the build unchanged), otherwise
114
+ * the project's `bin`. A choice the two commands cannot share, or one outside the worktree, is refused.
115
+ */
116
+ function runtimeOutputDirectory(options, projectPath, projectDirectory, worktreePath) {
117
+ const settings = parseDotnetOutputCommand(options.command, options.args, options.cwd, { holder: true })?.settings;
118
+ if (!settings || !declaresDotnetOutput(settings))
119
+ return path.join(projectDirectory, "bin");
120
+ if (settings.output) {
121
+ throw new Error("host_runtime_build_invalid: dotnet run has no --output option, so its prebuild and run could not share that "
122
+ + "directory. Choose the runtime's output with -p:OutDir=<dir>, -p:BaseOutputPath=<dir>, or --artifacts-path <dir> instead.");
123
+ }
124
+ const projectFile = path.extname(projectPath).toLowerCase() === ".csproj" ? projectPath : null;
125
+ const outputDirectory = projectOutputRoot(projectDirectory, projectFile, settings);
126
+ // By real location: a symlink or junction inside the worktree must not carry the output outside it.
127
+ const relative = path.relative(canonicalExistingPathSync(worktreePath), canonicalExistingPathSync(outputDirectory));
128
+ if (relative.startsWith("..") || path.isAbsolute(relative)) {
129
+ throw new Error(`host_runtime_build_invalid: the ASP.NET runtime's build output ${outputDirectory} must remain inside the managed worktree.`);
130
+ }
131
+ return outputDirectory;
132
+ }
94
133
  export async function ensureAspNetRuntimePrebuilt(plan, execute, signal) {
95
134
  const pending = inFlightPrebuilds.get(plan.receiptPath);
96
135
  if (pending)
@@ -203,9 +242,12 @@ function readOptionValue(args, option) {
203
242
  const argument = args[index];
204
243
  return argument.startsWith(`${option}=`) ? argument.slice(option.length + 1) : args[index + 1] ?? null;
205
244
  }
245
+ /** The launch's build-shaping options, output choices included, so the prebuild writes where the run reads. */
206
246
  function forwardBuildOptions(args) {
207
247
  const forwarded = [];
208
- const optionsWithValues = new Set(["-c", "--configuration", "-f", "--framework", "-r", "--runtime", "--arch", "--os"]);
248
+ const optionsWithValues = new Set([
249
+ "-c", "--configuration", "-f", "--framework", "-r", "--runtime", "--arch", "--os", "--artifacts-path",
250
+ ]);
209
251
  for (let index = 1; index < args.length; index += 1) {
210
252
  const argument = args[index];
211
253
  if (argument === "--")
@@ -224,9 +266,9 @@ function forwardBuildOptions(args) {
224
266
  }
225
267
  continue;
226
268
  }
269
+ // Every MSBuild property spelling: -p:, --property:, /p:, and the rest that dotnet accepts.
227
270
  if ([...optionsWithValues].some(option => argument.startsWith(`${option}=`))
228
- || argument.startsWith("-p:")
229
- || argument.startsWith("/p:")) {
271
+ || /^(?:-{1,2}|\/)(?:p|property):/iu.test(argument)) {
230
272
  forwarded.push(argument);
231
273
  }
232
274
  }
@@ -281,9 +323,13 @@ async function projectSourceDigest(plan, projectDirectory) {
281
323
  const worktree = path.resolve(plan.worktreePath);
282
324
  const directories = await projectSourceDirectories(plan, projectDirectory);
283
325
  const files = new Set();
326
+ // The runtime's own output is never source, even outside bin: a per-project output sits at the same place in every project.
327
+ const relativeOutput = path.relative(projectDirectory, plan.outputDirectory);
328
+ const perProjectOutput = relativeOutput !== "" && containedIn(projectDirectory, plan.outputDirectory);
284
329
  for (const directory of directories) {
285
330
  const collected = [];
286
- await collectInputFiles(directory, directory, collected);
331
+ const excluded = new Set([path.resolve(plan.outputDirectory), ...(perProjectOutput ? [path.join(directory, relativeOutput)] : [])]);
332
+ await collectInputFiles(directory, directory, collected, excluded);
287
333
  for (const file of collected)
288
334
  files.add(file);
289
335
  for (const buildFile of await ancestorBuildFiles(directory, worktree))
@@ -335,19 +381,6 @@ async function projectFilesIn(directory) {
335
381
  .filter(entry => entry.isFile() && msbuildProjectExtensions.has(path.extname(entry.name).toLowerCase()))
336
382
  .map(entry => path.join(directory, entry.name));
337
383
  }
338
- function projectReferenceIncludes(projectXml) {
339
- const withoutComments = projectXml.replaceAll(/<!--[\s\S]*?-->/gu, "");
340
- const includes = [];
341
- for (const match of withoutComments.matchAll(/<ProjectReference\b[^>]*?\bInclude\s*=\s*(?:"([^"]*)"|'([^']*)')/giu)) {
342
- const value = match[1] ?? match[2] ?? "";
343
- for (const part of value.split(";")) {
344
- const trimmed = part.trim();
345
- if (trimmed)
346
- includes.push(trimmed);
347
- }
348
- }
349
- return includes;
350
- }
351
384
  async function ancestorBuildFiles(directory, worktree) {
352
385
  const found = [];
353
386
  let current = path.resolve(directory);
@@ -370,13 +403,13 @@ function containedIn(root, candidate) {
370
403
  const relative = path.relative(root, candidate);
371
404
  return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
372
405
  }
373
- async function collectInputFiles(root, directory, files) {
406
+ async function collectInputFiles(root, directory, files, excluded) {
374
407
  const entries = await fs.readdir(directory, { withFileTypes: true }).catch(() => []);
375
408
  for (const entry of entries) {
376
409
  const absolute = path.join(directory, entry.name);
377
410
  if (entry.isDirectory()) {
378
- if (!["bin", "obj", "node_modules", ".git", "TestResults"].includes(entry.name)) {
379
- await collectInputFiles(root, absolute, files);
411
+ if (!["bin", "obj", "node_modules", ".git", "TestResults"].includes(entry.name) && !excluded.has(absolute)) {
412
+ await collectInputFiles(root, absolute, files, excluded);
380
413
  }
381
414
  }
382
415
  else if (entry.isFile()) {
@@ -388,9 +421,8 @@ async function collectAspNetBuildOutputs(plan) {
388
421
  const projectDirectory = path.extname(plan.projectPath).toLowerCase() === ".csproj"
389
422
  ? path.dirname(plan.projectPath)
390
423
  : plan.projectPath;
391
- const outputRoot = path.join(projectDirectory, "bin");
392
424
  const outputs = [];
393
- await collectOutputFiles(outputRoot, projectDirectory, outputs);
425
+ await collectOutputFiles(plan.outputDirectory, projectDirectory, outputs);
394
426
  return outputs.sort((left, right) => left.path.localeCompare(right.path));
395
427
  }
396
428
  async function collectOutputFiles(directory, projectDirectory, outputs) {
@@ -416,9 +448,10 @@ async function aspNetOutputsMatch(plan, outputs) {
416
448
  ? path.dirname(plan.projectPath)
417
449
  : plan.projectPath;
418
450
  for (const output of outputs) {
451
+ // Paths are relative to the project, and may leave it for a launch-chosen output, never the plan's output directory.
419
452
  const absolute = path.resolve(projectDirectory, output.path);
420
- const relative = path.relative(projectDirectory, absolute);
421
- if (relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
453
+ const relative = path.relative(plan.outputDirectory, absolute);
454
+ if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
422
455
  return false;
423
456
  const stat = await fs.stat(absolute).catch(() => null);
424
457
  if (!stat?.isFile() || stat.size !== output.size)
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  import { redactText } from "../shared/redaction/redaction.js";
5
5
  import { ForgeFailureError, sanitizeFailureError } from "../session/session.types.js";
6
6
  import { HostListenerInspector } from "./host-listener-inspector.js";
7
+ import { writeSupervisedRuntimeDescriptor } from "./supervised-runtime-build-guard.js";
7
8
  const diagnosticTailLength = 4_000;
8
9
  /** Launches one explicitly configured HTTP project beneath the attempt coordinator. */
9
10
  export class AttemptNodeRuntimeLauncher {
@@ -27,6 +28,14 @@ export class AttemptNodeRuntimeLauncher {
27
28
  const diagnostics = { exited: false, stdoutTail: "", stderrTail: "", outputRevision: 0 };
28
29
  let child;
29
30
  try {
31
+ // Recorded before the child starts, so a managed build can never see it running unrecorded.
32
+ await writeSupervisedRuntimeDescriptor(this.logDirectory, {
33
+ role: request.port.name,
34
+ childName,
35
+ command: request.command,
36
+ args: request.args,
37
+ cwd: request.cwd,
38
+ });
30
39
  child = await this.supervisor.startChildReady(childName, {
31
40
  command: request.command,
32
41
  args: request.args,
@@ -57,6 +57,8 @@ export interface AttemptProcessChildReadyOptions {
57
57
  readonly maxStartAttempts?: number;
58
58
  readonly retryDelayMs?: number;
59
59
  }
60
+ /** The attempt's durable child ledger; managed commands read it to find the attempt's running runtimes. */
61
+ export declare function attemptProcessSupervisorLedgerPath(logDirectory: string): string;
60
62
  /**
61
63
  * Owns the independently supervised process trees that belong to one host
62
64
  * dispatch attempt. Each named child gets a distinct Windows Job Object or
@@ -4,6 +4,10 @@ import path from "node:path";
4
4
  import { ForgeFailureError, sanitizeFailureError } from "../session/session.types.js";
5
5
  import { terminateAttemptManagedCommands, } from "./managed-command-teardown.js";
6
6
  import { monotonicNowMs } from "../shared/time/monotonic.js";
7
+ /** The attempt's durable child ledger; managed commands read it to find the attempt's running runtimes. */
8
+ export function attemptProcessSupervisorLedgerPath(logDirectory) {
9
+ return path.join(logDirectory, "attempt-process-supervisor.json");
10
+ }
7
11
  const terminalChildStatuses = new Set(["exited", "failed"]);
8
12
  const defaultMetadataReadyTimeoutMs = process.platform === "win32" ? 60_000 : 10_000;
9
13
  // Windows refuses to replace a file another process (a scanner or indexer) briefly holds
@@ -41,7 +45,7 @@ export class AttemptProcessSupervisor {
41
45
  this.replaceLedgerFile = options.replaceLedgerFile ?? ((temporaryPath, ledgerPath) => fs.rename(temporaryPath, ledgerPath));
42
46
  this.ledgerReplaceRetryMs = options.ledgerReplaceRetryMs ?? defaultLedgerReplaceRetryMs;
43
47
  this.managedCommandTeardownGraceMs = options.managedCommandTeardownGraceMs;
44
- this.ledgerPath = path.join(this.identity.logDirectory, "attempt-process-supervisor.json");
48
+ this.ledgerPath = attemptProcessSupervisorLedgerPath(this.identity.logDirectory);
45
49
  if (options.signal?.aborted) {
46
50
  this.status = "stopping";
47
51
  this.attemptController.abort(options.signal.reason);
@@ -109,17 +113,19 @@ export class AttemptProcessSupervisor {
109
113
  };
110
114
  this.records.push(record);
111
115
  this.currentByName.set(name, record);
112
- const result = this.runner.run(childRequest, handlers, combinedSignal);
113
- record.result = result;
114
- void result.then(value => this.settleChild(record, "exited", value.exitCode, undefined, value), error => this.settleChild(record, "failed", undefined, error));
116
+ // Durable before the process exists, so a ledger reader (the managed-build guard) never misses a child about to run.
115
117
  try {
116
118
  await this.persist();
117
119
  }
118
120
  catch (error) {
119
- controller.abort("Attempt process ledger could not be persisted.");
120
- await result.catch(() => undefined);
121
+ // Never spawned: the record settles as failed, with the reason the ledger could not be written.
122
+ Object.assign(record, { status: "failed", settledAt: new Date().toISOString() });
123
+ record.failure = boundedFailure(error, failureRedactionValues);
121
124
  throw error;
122
125
  }
126
+ const result = this.runner.run(childRequest, handlers, combinedSignal);
127
+ record.result = result;
128
+ void result.then(value => this.settleChild(record, "exited", value.exitCode, undefined, value), error => this.settleChild(record, "failed", undefined, error));
123
129
  const ready = this.observeChildReady(record);
124
130
  void ready.catch(() => undefined);
125
131
  return {
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Where a supervised ASP.NET runtime builds and runs from, relative to each project in its
3
+ * graph. Agent builds keep the default `bin/<Configuration>/<TargetFramework>/` output, so they
4
+ * never overwrite (or, on Windows, fail on the locks of) the files a running runtime executes.
5
+ */
6
+ export declare const supervisedRuntimeOutputRoot = "bin/forge-runtime";
7
+ export type DotnetPathPlatform = "win32" | "posix";
8
+ /** A directory option: CLI options are fixed for the whole graph, MSBuild properties resolve per project. */
9
+ export interface DotnetOutputLocation {
10
+ readonly path: string;
11
+ readonly perProject: boolean;
12
+ }
13
+ export interface DotnetOutputSettings {
14
+ readonly configuration: string;
15
+ readonly framework: string | null;
16
+ readonly runtime: string | null;
17
+ /** `-p:OutDir` or `-p:OutputPath`: MSBuild resolves a relative value against each project. */
18
+ readonly outDir: DotnetOutputLocation | null;
19
+ /** `-o`/`--output`: one directory for every project the command builds. */
20
+ readonly output: DotnetOutputLocation | null;
21
+ readonly baseOutputPath: DotnetOutputLocation | null;
22
+ readonly artifactsPath: DotnetOutputLocation | null;
23
+ }
24
+ /** A dotnet command that writes (or, for a runtime, executes from) project build output. */
25
+ export interface DotnetOutputCommand {
26
+ readonly verb: string;
27
+ readonly cwd: string;
28
+ /** Absolute target candidates (project, solution, or directory); empty means the working directory. */
29
+ readonly targets: readonly string[];
30
+ readonly settings: DotnetOutputSettings;
31
+ }
32
+ export interface DotnetProjectFiles {
33
+ readonly read: (file: string) => Promise<string | null>;
34
+ readonly list: (directory: string) => Promise<readonly string[] | null>;
35
+ /** The real location of a path (canonicalExistingPath); without it paths compare as written. */
36
+ readonly canonical?: (target: string) => Promise<string>;
37
+ }
38
+ export interface DotnetOutputCollision {
39
+ /** The project whose output both commands use. */
40
+ readonly project: string;
41
+ readonly outputDirectory: string;
42
+ }
43
+ /**
44
+ * Where a path really is, existing or not yet: its deepest existing ancestor resolved through every
45
+ * symlink and junction, with the rest appended. A lexical path alone lets a link alias another directory.
46
+ * A link whose target does not exist yet still leads to that target, so it is followed by its
47
+ * link text, never taken as its own location; a link loop fails with `path_link_unresolvable`.
48
+ */
49
+ export declare function canonicalExistingPath(target: string): Promise<string>;
50
+ /** canonicalExistingPath, for synchronous planning. */
51
+ export declare function canonicalExistingPathSync(target: string): string;
52
+ export declare const fileSystemProjectFiles: DotnetProjectFiles;
53
+ export declare function hostPathPlatform(): DotnetPathPlatform;
54
+ export declare function isDotnetExecutable(command: string, platform?: DotnetPathPlatform): boolean;
55
+ /**
56
+ * Reads a dotnet command's build-output intent: its verb, target candidates, and output
57
+ * settings. Returns null when the command writes no build output. With `holder`, the command is
58
+ * a running runtime's `dotnet run`: `--no-build` does not matter, it executes from the output.
59
+ */
60
+ export declare function parseDotnetOutputCommand(command: string, args: readonly string[], cwd: string, options?: {
61
+ readonly platform?: DotnetPathPlatform;
62
+ readonly holder?: boolean;
63
+ }): DotnetOutputCommand | null;
64
+ /** True when the arguments already choose where the build output goes. */
65
+ export declare function declaresDotnetOutput(settings: DotnetOutputSettings): boolean;
66
+ /** What the project file itself decides about its output layout. */
67
+ export interface DotnetProjectLayout {
68
+ /** The project sets `<TargetFrameworks>`: the artifacts layout then adds the framework to its pivot. */
69
+ readonly multiTargeted?: boolean;
70
+ }
71
+ /** True when a project file multi-targets (`<TargetFrameworks>`, even with one entry). */
72
+ export declare function isMultiTargetedProject(projectXml: string): boolean;
73
+ /**
74
+ * The directory a project's primary output lands in under these settings. An unknown target
75
+ * framework is the wildcard `*`, which matches any framework in sameOutputDirectory.
76
+ */
77
+ export declare function projectOutputDirectory(projectFile: string, settings: DotnetOutputSettings, platform?: DotnetPathPlatform, layout?: DotnetProjectLayout): string;
78
+ /**
79
+ * The one directory holding every build output of a project under these settings, whatever
80
+ * configuration or framework they leave open: what a runtime's build receipt verifies. Without
81
+ * the project file's name, an artifacts layout's root is its `bin`, above every project's folder.
82
+ */
83
+ export declare function projectOutputRoot(projectDirectory: string, projectFile: string | null, settings: DotnetOutputSettings, platform?: DotnetPathPlatform): string;
84
+ /**
85
+ * Compares two output directories segment by segment. `*` matches any run of characters inside
86
+ * one segment: `*` is any framework folder, and `debug_*` any framework pivot.
87
+ */
88
+ export declare function sameOutputDirectory(left: string, right: string, platform?: DotnetPathPlatform): boolean;
89
+ /** ProjectReference Include values of a project file, ignoring commented-out references. */
90
+ export declare function projectReferenceIncludes(projectXml: string): readonly string[];
91
+ /** Project paths a .sln or .slnx lists. */
92
+ export declare function solutionProjectPaths(solution: string, content: string): readonly string[];
93
+ /** Every project file a command builds: its targets, solution members, and their ProjectReference closure. */
94
+ export declare function dotnetCommandProjects(command: DotnetOutputCommand, files?: DotnetProjectFiles, platform?: DotnetPathPlatform): Promise<readonly string[]>;
95
+ /**
96
+ * The projects whose output a build (`writer`) would write while a runtime (`holder`) executes
97
+ * from that same output, in the runtime's graph order (its own project first).
98
+ */
99
+ export declare function findDotnetOutputCollisions(writer: DotnetOutputCommand, holder: DotnetOutputCommand, files?: DotnetProjectFiles, platform?: DotnetPathPlatform): Promise<readonly DotnetOutputCollision[]>;
100
+ /** A runtime role as a directory name: kept when it is already safe, otherwise a stable digest. */
101
+ export declare function runtimeOutputName(role: string): string;
102
+ /**
103
+ * Gives a supervised `dotnet run` its own build output, `bin/forge-runtime/<role>/` under each
104
+ * project, unless the configured arguments already choose one. The ASP.NET prebuild forwards the
105
+ * same property to its `dotnet build`, so the runtime builds and runs from that directory.
106
+ */
107
+ export declare function isolatedRuntimeOutputArguments(command: string, args: readonly string[], role: string, platform?: DotnetPathPlatform): readonly string[];