@loucompanion/forge-bridge 0.1.4-dev.bfa11ebe98c6 → 0.1.4-dev.c1ae24134918
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 +3 -3
- package/dist/bridge/bridge.service.d.ts +14 -1
- package/dist/bridge/bridge.service.js +81 -9
- package/dist/bridge/bridge.types.d.ts +11 -0
- package/dist/bridge/dispatch-result-outbox.d.ts +11 -1
- package/dist/bridge/dispatch-result-outbox.js +31 -6
- package/dist/bridge/runner-host-capabilities.d.ts +2 -0
- package/dist/bridge/runner-host-capabilities.js +4 -0
- package/dist/bridge/test-postgres-capability.d.ts +14 -0
- package/dist/bridge/test-postgres-capability.js +120 -0
- package/dist/cli/cli.help.js +2 -2
- package/dist/cli/cli.service.js +3 -1
- package/dist/runtime/attempt-database-broker.d.ts +89 -0
- package/dist/runtime/attempt-database-broker.js +390 -0
- 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-admission.d.ts +52 -0
- package/dist/runtime/host-load-admission.js +84 -0
- package/dist/runtime/host-load-child-environment.d.ts +22 -0
- package/dist/runtime/host-load-child-environment.js +65 -0
- package/dist/runtime/host-load-forge-cgroups.d.ts +49 -0
- package/dist/runtime/host-load-forge-cgroups.js +140 -0
- package/dist/runtime/host-load-governor-config.d.ts +34 -0
- package/dist/runtime/host-load-governor-config.js +46 -0
- package/dist/runtime/host-load-governor.d.ts +172 -0
- package/dist/runtime/host-load-governor.js +519 -0
- package/dist/runtime/host-load-ledger-lock.d.ts +69 -0
- package/dist/runtime/host-load-ledger-lock.js +185 -0
- package/dist/runtime/host-load-sampler.d.ts +126 -0
- package/dist/runtime/host-load-sampler.js +232 -0
- package/dist/runtime/host-load-step-class.d.ts +68 -0
- package/dist/runtime/host-load-step-class.js +106 -0
- package/dist/runtime/host-load-step-reaper.d.ts +27 -0
- package/dist/runtime/host-load-step-reaper.js +95 -0
- package/dist/runtime/host-load-step-run.d.ts +73 -0
- package/dist/runtime/host-load-step-run.js +102 -0
- package/dist/runtime/host-load-token-ledger.d.ts +174 -0
- package/dist/runtime/host-load-token-ledger.js +421 -0
- package/dist/runtime/host-pressure-stall.d.ts +61 -0
- package/dist/runtime/host-pressure-stall.js +168 -0
- package/dist/runtime/host-runtime-contract.d.ts +4 -0
- package/dist/runtime/host-runtime-contract.js +75 -11
- package/dist/runtime/host-runtime-lease.d.ts +19 -3
- package/dist/runtime/host-runtime-lease.js +188 -25
- package/dist/runtime/host-runtime-promotion.js +12 -0
- package/dist/runtime/host-runtime-requirements-check.d.ts +17 -0
- package/dist/runtime/host-runtime-requirements-check.js +29 -0
- package/dist/runtime/host-runtime-requirements.d.ts +36 -0
- package/dist/runtime/host-runtime-requirements.js +117 -0
- 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/host-capacity-broker.d.ts +107 -0
- package/dist/sandbox/host-capacity-broker.js +315 -0
- package/dist/sandbox/repository-lock.js +3 -2
- package/dist/sandbox/runtime.d.ts +10 -1
- package/dist/sandbox/runtime.js +50 -6
- package/dist/sandbox/sandbox-cgroups.d.ts +14 -0
- package/dist/sandbox/sandbox-cgroups.js +42 -0
- package/dist/session/managed-attempt-tools.d.ts +25 -0
- package/dist/session/managed-attempt-tools.js +330 -32
- package/dist/session/managed-build-coordinator.d.ts +1 -1
- package/dist/session/managed-build-coordinator.js +8 -4
- package/dist/session/managed-command-host-load.d.ts +45 -0
- package/dist/session/managed-command-host-load.js +82 -0
- package/dist/session/phase-completion.artifacts.js +4 -0
- package/dist/session/phase-completion.d.ts +2 -0
- package/dist/session/phase-completion.runtime.d.ts +1 -1
- package/dist/session/phase-completion.runtime.js +44 -24
- package/dist/session/pre-publication-host-load.d.ts +27 -0
- package/dist/session/pre-publication-host-load.js +111 -0
- package/dist/session/pre-publication-process.d.ts +23 -0
- package/dist/session/pre-publication-process.js +109 -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-step-execution.d.ts +11 -0
- package/dist/session/pre-publication-step-execution.js +49 -0
- package/dist/session/pre-publication-validation.d.ts +9 -9
- package/dist/session/pre-publication-validation.js +53 -113
- package/dist/session/provider-cli/provider-cli.artifacts.d.ts +2 -1
- package/dist/session/provider-cli/provider-cli.artifacts.js +21 -15
- package/dist/session/provider-cli/provider-cli.merge-integrity.d.ts +89 -0
- package/dist/session/provider-cli/provider-cli.merge-integrity.js +310 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +37 -1
- package/dist/session/provider-cli/provider-cli.process.js +299 -25
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +5 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +15 -0
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +6 -0
- package/dist/session/provider-cli/provider-cli.runtime.js +14 -0
- package/dist/session/provider-cli/provider-cli.service.js +144 -35
- package/dist/session/provider-cli/provider-cli.types.d.ts +4 -0
- package/dist/session/provider-cli/provider-in-flight-work.d.ts +6 -0
- package/dist/session/provider-cli/provider-in-flight-work.js +47 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +6 -0
- package/dist/session/provider-cli/provider-output-state.js +9 -0
- package/dist/session/provider-cli/provider-usage.d.ts +2 -1
- package/dist/session/publishable-worktree-changes.d.ts +54 -0
- package/dist/session/publishable-worktree-changes.js +193 -0
- package/dist/session/sandbox-host-capacity-gate.d.ts +30 -0
- package/dist/session/sandbox-host-capacity-gate.js +229 -0
- package/dist/session/session.base.d.ts +3 -0
- package/dist/session/session.service.d.ts +2 -0
- package/dist/session/session.service.js +21 -4
- package/dist/session/session.types.d.ts +3 -0
- package/dist/session/session.types.js +14 -2
- package/dist/shared/process/host-process-recovery.js +3 -2
- package/dist/shared/process/host-process-supervisor.d.ts +1 -0
- package/dist/shared/process/host-process-supervisor.js +6 -5
- package/dist/shared/process/process-tree.d.ts +52 -0
- package/dist/shared/process/process-tree.js +144 -0
- package/dist/shared/process/process.d.ts +67 -0
- package/dist/shared/process/process.js +213 -11
- 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.d.ts +25 -0
- package/dist/worktree/dependency-warmer.js +120 -10
- package/dist/worktree/worktree.service.d.ts +6 -1
- package/dist/worktree/worktree.service.js +14 -2
- package/dist/worktree/worktree.types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -4,23 +4,51 @@ import path from "node:path";
|
|
|
4
4
|
import { isAlias, parseDocument, visit } from "yaml";
|
|
5
5
|
import { readCanonicalSourceFile } from "./canonical-source-file.js";
|
|
6
6
|
import { isGeneratedOutputDirectoryName } from "./generated-output-reset.js";
|
|
7
|
+
import { parseHostRuntimeRequirements } from "./host-runtime-requirements.js";
|
|
7
8
|
export const hostRuntimeContractPath = ".forge/forge.runtime.yml";
|
|
8
9
|
export const hostRuntimeTestPostgresAdminEnvironment = "FORGE_TEST_POSTGRES_ADMIN_CONNECTION_STRING";
|
|
9
10
|
export const hostRuntimeLegacyTestPostgresEnvironment = "FORGE_TEST_POSTGRES_CONNECTION_STRING";
|
|
11
|
+
// Optional superuser login for operator-run .NET fixtures. Never reaches attempt, validation or provider processes.
|
|
12
|
+
export const hostRuntimeTestPostgresProvisionerEnvironment = "FORGE_TEST_POSTGRES_PROVISIONER_CONNECTION_STRING";
|
|
10
13
|
const maximumContractBytes = 64 * 1024;
|
|
11
14
|
const maximumDepth = 12;
|
|
15
|
+
// Every discovery scan stops after this many directory entries. A monorepo needs a few
|
|
16
|
+
// thousand; the bound only keeps a pathological tree from stalling attempt preparation.
|
|
17
|
+
const maximumDiscoveryEntries = 20_000;
|
|
18
|
+
/**
|
|
19
|
+
* A discovery scan reached its entry budget before seeing the whole tree, so what it did not
|
|
20
|
+
* find may still exist. Discovery must not treat that as absence: a partial runtime (for
|
|
21
|
+
* example a web app without its API) would send the attempt's traffic to the wrong server.
|
|
22
|
+
*/
|
|
23
|
+
class IncompleteRuntimeDiscoveryError extends Error {
|
|
24
|
+
}
|
|
25
|
+
// Dependency, build and editor folders never hold an application entrypoint, and counting
|
|
26
|
+
// them would exhaust the budget and serialize a repository for no reason.
|
|
12
27
|
const ignoredDiscoveryDirectories = new Set([
|
|
13
28
|
".forge",
|
|
14
29
|
".forge-designer",
|
|
15
30
|
".git",
|
|
31
|
+
".gradle",
|
|
32
|
+
".idea",
|
|
16
33
|
".local",
|
|
34
|
+
".next",
|
|
35
|
+
".pnpm",
|
|
36
|
+
".turbo",
|
|
37
|
+
".venv",
|
|
38
|
+
".vs",
|
|
39
|
+
".vscode",
|
|
40
|
+
".yarn",
|
|
17
41
|
"bin",
|
|
42
|
+
"build",
|
|
18
43
|
"coverage",
|
|
19
44
|
"dist",
|
|
20
45
|
"node_modules",
|
|
21
46
|
"obj",
|
|
47
|
+
"target",
|
|
48
|
+
"vendor",
|
|
49
|
+
"venv",
|
|
22
50
|
]);
|
|
23
|
-
const topLevelKeys = new Set(["schemaVersion", "runtime"]);
|
|
51
|
+
const topLevelKeys = new Set(["schemaVersion", "runtime", "requires", "costHints"]);
|
|
24
52
|
const runtimeKeys = new Set(["hostConcurrency", "ports", "playwright", "browserProfile", "singletonResources"]);
|
|
25
53
|
const portKeys = new Set(["adapter", "launch", "env", "baseUrlEnv", "format"]);
|
|
26
54
|
const launchKeys = new Set(["command", "args", "workingDirectory", "environment"]);
|
|
@@ -47,10 +75,19 @@ export async function loadHostRuntimeContract(worktreePath, snapshot, directoryS
|
|
|
47
75
|
}
|
|
48
76
|
async function discoverHostRuntimeContract(worktreePath, snapshot, directorySnapshot) {
|
|
49
77
|
const root = path.resolve(worktreePath);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
78
|
+
let nodeDiscovery;
|
|
79
|
+
let aspNetDiscovery;
|
|
80
|
+
try {
|
|
81
|
+
[nodeDiscovery, aspNetDiscovery] = await Promise.all([
|
|
82
|
+
discoverNodeRuntimes(root, snapshot, directorySnapshot),
|
|
83
|
+
discoverAspNetRuntimes(root, snapshot, directorySnapshot),
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (error instanceof IncompleteRuntimeDiscoveryError)
|
|
88
|
+
return incompleteRuntimeDiscovery();
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
54
91
|
if (nodeDiscovery.ambiguous || aspNetDiscovery.ambiguous) {
|
|
55
92
|
return ambiguousRuntimeDiscovery();
|
|
56
93
|
}
|
|
@@ -102,7 +139,7 @@ async function discoverHostRuntimeContract(worktreePath, snapshot, directorySnap
|
|
|
102
139
|
async function discoverNodeRuntimes(root, snapshot, directorySnapshot) {
|
|
103
140
|
const manifests = [...new Set([
|
|
104
141
|
path.join(root, "package.json"),
|
|
105
|
-
...await findFiles(root, file => path.basename(file).toLowerCase() === "package.json", 4,
|
|
142
|
+
...await findFiles(root, file => path.basename(file).toLowerCase() === "package.json", 4, maximumDiscoveryEntries, directorySnapshot),
|
|
106
143
|
])];
|
|
107
144
|
const candidates = (await Promise.all(manifests.map(async (manifestPath) => await discoverNodeRuntime(root, manifestPath, snapshot, directorySnapshot)))).filter((candidate) => candidate !== null);
|
|
108
145
|
return { candidates: candidates.length === 1 ? candidates : [], ambiguous: candidates.length > 1 };
|
|
@@ -138,7 +175,7 @@ async function discoverNodeRuntime(root, manifestPath, snapshot, directorySnapsh
|
|
|
138
175
|
...["playwright.config.ts", "playwright.config.js", "playwright.config.mjs", "playwright.config.cjs"]
|
|
139
176
|
.flatMap(file => [file, `e2e/${file}`, `tests/e2e/${file}`])
|
|
140
177
|
.map(async (candidate) => await optionalFileExists(path.join(root, candidate), snapshot) ? path.join(root, candidate) : null),
|
|
141
|
-
findFiles(root, file => /^playwright\.config\.(?:ts|js|mjs|cjs)$/iu.test(path.basename(file)), 4,
|
|
178
|
+
findFiles(root, file => /^playwright\.config\.(?:ts|js|mjs|cjs)$/iu.test(path.basename(file)), 4, maximumDiscoveryEntries, directorySnapshot),
|
|
142
179
|
])).flat().filter((value) => value !== null))]
|
|
143
180
|
.map(config => portableRelativePath(root, config));
|
|
144
181
|
const playwright = playwrightConfigs.length === 1
|
|
@@ -183,7 +220,9 @@ async function discoverNodeRuntime(root, manifestPath, snapshot, directorySnapsh
|
|
|
183
220
|
};
|
|
184
221
|
}
|
|
185
222
|
async function discoverAspNetRuntimes(root, snapshot, directorySnapshot) {
|
|
186
|
-
|
|
223
|
+
// Deep enough for nested solutions (src/<area>/<Project>/<Project>.csproj); the entry budget,
|
|
224
|
+
// not the depth, bounds the scan, and a scan that exceeds it is reported as incomplete.
|
|
225
|
+
const projects = await findFiles(root, file => file.toLowerCase().endsWith(".csproj"), 6, maximumDiscoveryEntries, directorySnapshot);
|
|
187
226
|
const webProjects = [];
|
|
188
227
|
for (const projectPath of projects) {
|
|
189
228
|
const source = await readBoundedOptionalFile(projectPath, 512 * 1024, snapshot);
|
|
@@ -277,6 +316,17 @@ function combineBrowserAndApiRuntime(browser, api) {
|
|
|
277
316
|
}),
|
|
278
317
|
};
|
|
279
318
|
}
|
|
319
|
+
function incompleteRuntimeDiscovery() {
|
|
320
|
+
return {
|
|
321
|
+
contract: defaultHostRuntimeContract(),
|
|
322
|
+
source: "default",
|
|
323
|
+
discovery: {
|
|
324
|
+
status: "ambiguous",
|
|
325
|
+
reasonCode: "runtime_discovery_incomplete",
|
|
326
|
+
summary: "Forge could not scan the whole repository within its discovery budget, so host application runs remain serialized.",
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
}
|
|
280
330
|
function ambiguousRuntimeDiscovery() {
|
|
281
331
|
return {
|
|
282
332
|
contract: defaultHostRuntimeContract(),
|
|
@@ -339,7 +389,13 @@ async function discoverAspNetLaunchProfile(root, projectRelativePath, snapshot)
|
|
|
339
389
|
return { name: null, source, environment: {} };
|
|
340
390
|
}
|
|
341
391
|
}
|
|
392
|
+
// A project's "forge-attempt" profile configures its API for managed attempts. The
|
|
393
|
+
// attempt's pre-publication checks then run against the same settings the project's own
|
|
394
|
+
// e2e suite uses, instead of the developer's "http" profile.
|
|
395
|
+
const attemptLaunchProfileName = "forge-attempt";
|
|
342
396
|
function aspNetProfilePriority(name) {
|
|
397
|
+
if (name.toLowerCase() === attemptLaunchProfileName)
|
|
398
|
+
return -1;
|
|
343
399
|
if (name.toLowerCase() === "http")
|
|
344
400
|
return 0;
|
|
345
401
|
if (name.toLowerCase() === "https")
|
|
@@ -373,7 +429,7 @@ async function findFiles(root, accepts, maximumDepth, maximumEntries, snapshot)
|
|
|
373
429
|
const results = [];
|
|
374
430
|
let examined = 0;
|
|
375
431
|
const directories = [{ directory: root, depth: 0 }];
|
|
376
|
-
while (directories.length > 0
|
|
432
|
+
while (directories.length > 0) {
|
|
377
433
|
const current = directories.shift();
|
|
378
434
|
if (current.depth > maximumDepth)
|
|
379
435
|
continue;
|
|
@@ -383,14 +439,20 @@ async function findFiles(root, accepts, maximumDepth, maximumEntries, snapshot)
|
|
|
383
439
|
name: entry.name,
|
|
384
440
|
isDirectory: entry.isDirectory(),
|
|
385
441
|
isFile: entry.isFile(),
|
|
386
|
-
}))).catch(() =>
|
|
442
|
+
}))).catch((error) => {
|
|
443
|
+
// A directory removed since it was listed holds nothing; one that cannot be read
|
|
444
|
+
// (permissions, open-file limits) may hold the entrypoint discovery is looking for.
|
|
445
|
+
if (isFileNotFound(error))
|
|
446
|
+
return [];
|
|
447
|
+
throw new IncompleteRuntimeDiscoveryError();
|
|
448
|
+
});
|
|
387
449
|
const orderedEntries = [...entries].sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
388
450
|
for (const entry of orderedEntries) {
|
|
389
451
|
if (entry.isDirectory
|
|
390
452
|
&& (ignoredDiscoveryDirectories.has(entry.name.toLowerCase()) || isGeneratedOutputDirectoryName(entry.name)))
|
|
391
453
|
continue;
|
|
392
454
|
if (examined++ >= maximumEntries)
|
|
393
|
-
|
|
455
|
+
throw new IncompleteRuntimeDiscoveryError();
|
|
394
456
|
const target = path.join(current.directory, entry.name);
|
|
395
457
|
if (entry.isDirectory)
|
|
396
458
|
directories.push({ directory: target, depth: current.depth + 1 });
|
|
@@ -488,6 +550,7 @@ export function validateHostRuntimeContract(source) {
|
|
|
488
550
|
throw new Error("runtime_contract_invalid: runtime.browserProfile must be isolated.");
|
|
489
551
|
}
|
|
490
552
|
const ports = parsePorts(runtime.ports);
|
|
553
|
+
const requires = parseHostRuntimeRequirements(root.requires, root.costHints);
|
|
491
554
|
return {
|
|
492
555
|
schemaVersion: 1,
|
|
493
556
|
runtime: {
|
|
@@ -497,6 +560,7 @@ export function validateHostRuntimeContract(source) {
|
|
|
497
560
|
browserProfile,
|
|
498
561
|
singletonResources: parseSingletonResources(runtime.singletonResources),
|
|
499
562
|
},
|
|
563
|
+
...(requires ? { requires } : {}),
|
|
500
564
|
};
|
|
501
565
|
}
|
|
502
566
|
function parsePlaywright(value, ports) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostRequirementsCheck } from "./host-runtime-requirements-check.js";
|
|
2
|
+
import { type RunOnceDispatchPacket } from "../session/session.types.js";
|
|
2
3
|
import { type ProviderProcessRunner } from "../session/provider-cli/provider-cli.process.js";
|
|
3
4
|
import { type RuntimeIsolationLease } from "./runtime-isolation-lease.js";
|
|
4
5
|
import { type LoadedHostRuntimeContract } from "./host-runtime-contract.js";
|
|
@@ -6,11 +7,14 @@ import { HostPortBroker } from "./host-port-broker.js";
|
|
|
6
7
|
import { NodeHostRuntimeAdapter, type NodeRuntimeAdapterLaunch, type NodeRuntimeCommand, type NodeRuntimeCommandLauncher } from "./node-host-runtime-adapter.js";
|
|
7
8
|
import type { AttemptProcessTreeMemoryTelemetry } from "./attempt-process-supervisor.js";
|
|
8
9
|
import { AttemptProcessSupervisorRegistry } from "./attempt-process-supervisor-registry.js";
|
|
10
|
+
import { type AttemptDatabaseBroker } from "./attempt-database-broker.js";
|
|
9
11
|
import { HostListenerInspector } from "./host-listener-inspector.js";
|
|
10
12
|
import { type MemoryAdmissionDiagnostics } from "./memory-capacity.js";
|
|
11
13
|
import { PlaywrightHostRuntimeAdapter } from "./playwright-host-runtime-adapter.js";
|
|
12
14
|
import { HostParallelPromotionStore } from "./host-runtime-promotion.js";
|
|
13
15
|
import { type HostProcessRecovery } from "../shared/process/host-process-recovery.js";
|
|
16
|
+
import { HostLoadGovernor } from "./host-load-governor.js";
|
|
17
|
+
import { type HostLoadGovernorSource } from "./host-load-sampler.js";
|
|
14
18
|
export interface HostRuntimeLeaseStart {
|
|
15
19
|
readonly lease: RuntimeIsolationLease;
|
|
16
20
|
readonly environment: Readonly<Record<string, string>>;
|
|
@@ -24,7 +28,7 @@ export interface HostRuntimeAdmissionCheckpoint {
|
|
|
24
28
|
}
|
|
25
29
|
export type HostRuntimeAdmissionCheckpointHandler = (checkpoint: HostRuntimeAdmissionCheckpoint) => void | Promise<void>;
|
|
26
30
|
export interface HostRuntimeProjectCheckpoint {
|
|
27
|
-
readonly code: "host_runtime_build_started" | "host_runtime_build_cached" | "host_runtime_build_completed";
|
|
31
|
+
readonly code: "host_runtime_build_started" | "host_runtime_build_waiting_for_host_capacity" | "host_runtime_build_cached" | "host_runtime_build_completed" | "host_runtime_database_provisioned";
|
|
28
32
|
readonly message: string;
|
|
29
33
|
readonly data?: Readonly<Record<string, unknown>>;
|
|
30
34
|
}
|
|
@@ -91,6 +95,7 @@ export interface HostNodeRuntimeLaunch<T> extends NodeRuntimeAdapterLaunch<T> {
|
|
|
91
95
|
readonly runtimeLease: RuntimeIsolationLease;
|
|
92
96
|
}
|
|
93
97
|
export interface HostRuntimeLeaseRuntime {
|
|
98
|
+
setRequirementsCheck?(check: HostRequirementsCheck | null): void;
|
|
94
99
|
acquirePreparation?(dispatch: RunOnceDispatchPacket, signal?: AbortSignal): Promise<readonly string[]>;
|
|
95
100
|
acquire(dispatch: RunOnceDispatchPacket, signal?: AbortSignal): Promise<readonly string[]>;
|
|
96
101
|
start(dispatch: RunOnceDispatchPacket, worktreePath: string, signal?: AbortSignal, onAdmissionCheckpoint?: HostRuntimeAdmissionCheckpointHandler): Promise<HostRuntimeLeaseStart>;
|
|
@@ -103,7 +108,10 @@ export interface HostRuntimeLeaseRuntime {
|
|
|
103
108
|
hasForegroundDemand?(): boolean;
|
|
104
109
|
reap?(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport>;
|
|
105
110
|
snapshot?(): HostRuntimeCapacitySnapshot;
|
|
111
|
+
/** Variables that let the completion MCP server share this host's load governor. */
|
|
112
|
+
hostLoadChildEnvironment?(): Readonly<Record<string, string>>;
|
|
106
113
|
}
|
|
114
|
+
export type HostRuntimeAdmissionPriority = "foreground" | "background";
|
|
107
115
|
export interface HostCapacityResourceSample {
|
|
108
116
|
readonly totalMemoryBytes: number;
|
|
109
117
|
readonly availableMemoryBytes: number;
|
|
@@ -119,6 +127,7 @@ export declare class HostRuntimeLeaseManager implements HostRuntimeLeaseRuntime
|
|
|
119
127
|
private readonly playwrightAdapter;
|
|
120
128
|
private readonly processRecovery;
|
|
121
129
|
private readonly capacityResourceSample?;
|
|
130
|
+
private readonly databaseBroker;
|
|
122
131
|
private readonly preparedReadiness;
|
|
123
132
|
private readonly active;
|
|
124
133
|
private readonly pendingRenewals;
|
|
@@ -141,7 +150,13 @@ export declare class HostRuntimeLeaseManager implements HostRuntimeLeaseRuntime
|
|
|
141
150
|
private readonly capacityConfiguration;
|
|
142
151
|
private readonly memoryAvailability;
|
|
143
152
|
private readonly executionRoot;
|
|
144
|
-
|
|
153
|
+
/** Host-wide admission for heavy steps (decision 0013); inert unless FORGE_HOST_LOAD_GOVERNOR=on. */
|
|
154
|
+
readonly hostLoadGovernor: HostLoadGovernor;
|
|
155
|
+
private requirementsCheck;
|
|
156
|
+
/** Installs the decision 0013 accept-time requirements recheck for host attempts. */
|
|
157
|
+
setRequirementsCheck(check: HostRequirementsCheck | null): void;
|
|
158
|
+
constructor(stateRoot: string, portBroker?: HostPortBroker, nodeAdapter?: NodeHostRuntimeAdapter, processSupervisors?: AttemptProcessSupervisorRegistry, processRunner?: ProviderProcessRunner, listenerInspector?: HostListenerInspector, promotionStore?: HostParallelPromotionStore, playwrightAdapter?: PlaywrightHostRuntimeAdapter, processRecovery?: HostProcessRecovery, capacityResourceSample?: HostCapacityResourceSample | undefined, executionRoot?: string, databaseBroker?: AttemptDatabaseBroker | null, hostLoad?: HostLoadGovernorSource | null);
|
|
159
|
+
hostLoadChildEnvironment(): Readonly<Record<string, string>>;
|
|
145
160
|
reap(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport>;
|
|
146
161
|
snapshot(): HostRuntimeCapacitySnapshot;
|
|
147
162
|
hasForegroundDemand(): boolean;
|
|
@@ -213,3 +228,4 @@ export declare class HostRuntimeCapacityRequestImpossibleError extends Error {
|
|
|
213
228
|
}
|
|
214
229
|
export declare function hostRuntimeEventResources(lease: RuntimeIsolationLease, runtimeContract?: LoadedHostRuntimeContract, executionClass?: HostRuntimeExecutionClass): Record<string, unknown>;
|
|
215
230
|
export declare function hostRuntimeSingletonKeys(dispatch: RunOnceDispatchPacket): readonly string[];
|
|
231
|
+
export declare function runtimeAdmissionPriority(dispatch: RunOnceDispatchPacket): HostRuntimeAdmissionPriority;
|