@loucompanion/forge-bridge 0.1.4-dev.86fc5d1208e6 → 0.1.4-dev.894bcbd53d64
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 +144 -3
- package/dist/bridge/bridge-chat-provider-command.d.ts +19 -0
- package/dist/bridge/bridge-chat-provider-command.js +132 -0
- package/dist/bridge/bridge-chat.types.d.ts +10 -0
- package/dist/bridge/bridge-chat.types.js +16 -1
- package/dist/bridge/bridge-state-file.d.ts +161 -0
- package/dist/bridge/bridge-state-file.js +376 -0
- package/dist/bridge/bridge-state-io.d.ts +11 -0
- package/dist/bridge/bridge-state-io.js +50 -0
- package/dist/bridge/bridge-state-lock.d.ts +11 -0
- package/dist/bridge/bridge-state-lock.js +102 -0
- package/dist/bridge/bridge-state-unpublished.d.ts +17 -0
- package/dist/bridge/bridge-state-unpublished.js +111 -0
- package/dist/bridge/bridge.base.d.ts +9 -0
- package/dist/bridge/bridge.service.d.ts +101 -15
- package/dist/bridge/bridge.service.js +472 -345
- package/dist/bridge/bridge.types.d.ts +27 -0
- package/dist/bridge/dispatch-result-outbox.d.ts +11 -1
- package/dist/bridge/dispatch-result-outbox.js +31 -6
- package/dist/bridge/in-flight-registry.d.ts +62 -0
- package/dist/bridge/in-flight-registry.js +207 -0
- package/dist/bridge/local-yield-flag.d.ts +6 -0
- package/dist/bridge/local-yield-flag.js +34 -0
- package/dist/bridge/readiness-result-outbox.d.ts +5 -1
- package/dist/bridge/readiness-result-outbox.js +20 -0
- package/dist/bridge/runner-host-capabilities.d.ts +5 -0
- package/dist/bridge/runner-host-capabilities.js +17 -0
- package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
- package/dist/bridge/sandbox-resource-accounting.js +150 -0
- package/dist/bridge/test-postgres-capability.d.ts +14 -0
- package/dist/bridge/test-postgres-capability.js +120 -0
- package/dist/cleanup/cleanup-wip.d.ts +12 -0
- package/dist/cleanup/cleanup-wip.js +66 -0
- package/dist/cleanup/cleanup.service.d.ts +20 -1
- package/dist/cleanup/cleanup.service.js +150 -169
- package/dist/cleanup/cleanup.types.d.ts +6 -0
- package/dist/cleanup/forge-owned-paths.d.ts +9 -0
- package/dist/cleanup/forge-owned-paths.js +53 -0
- package/dist/cleanup/host-runtime-ledger.d.ts +7 -0
- package/dist/cleanup/host-runtime-ledger.js +130 -0
- package/dist/cleanup/managed-branch-sweep.d.ts +27 -0
- package/dist/cleanup/managed-branch-sweep.js +111 -0
- package/dist/cli/cli.help.js +74 -12
- package/dist/cli/cli.service.d.ts +19 -10
- package/dist/cli/cli.service.js +152 -187
- package/dist/cli/idle-status.d.ts +84 -0
- package/dist/cli/idle-status.js +181 -0
- package/dist/cli/local-config.d.ts +6 -0
- package/dist/cli/local-config.js +32 -4
- package/dist/cli/provider-cli-detection.d.ts +10 -0
- package/dist/cli/provider-cli-detection.js +160 -0
- package/dist/runtime/aspnet-runtime-prebuild.d.ts +20 -0
- package/dist/runtime/aspnet-runtime-prebuild.js +184 -18
- package/dist/runtime/attempt-database-broker.d.ts +1 -1
- package/dist/runtime/attempt-node-runtime-launcher.js +9 -0
- package/dist/runtime/attempt-process-supervisor.d.ts +21 -0
- package/dist/runtime/attempt-process-supervisor.js +62 -6
- package/dist/runtime/docker-engine-probe.d.ts +5 -0
- package/dist/runtime/docker-engine-probe.js +7 -0
- package/dist/runtime/dotnet-build-outputs.d.ts +107 -0
- package/dist/runtime/dotnet-build-outputs.js +402 -0
- package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
- package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
- package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
- package/dist/runtime/ephemeral-test-postgres.js +303 -0
- 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-facts.d.ts +36 -0
- package/dist/runtime/host-facts.js +95 -0
- package/dist/runtime/host-load-admission.d.ts +67 -0
- package/dist/runtime/host-load-admission.js +99 -0
- package/dist/runtime/host-load-child-environment.d.ts +27 -0
- package/dist/runtime/host-load-child-environment.js +76 -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 +52 -0
- package/dist/runtime/host-load-governor-config.js +83 -0
- package/dist/runtime/host-load-governor.d.ts +186 -0
- package/dist/runtime/host-load-governor.js +632 -0
- package/dist/runtime/host-load-ledger-lock.d.ts +69 -0
- package/dist/runtime/host-load-ledger-lock.js +187 -0
- package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
- package/dist/runtime/host-load-runtime-settings.js +80 -0
- package/dist/runtime/host-load-sampler.d.ts +156 -0
- package/dist/runtime/host-load-sampler.js +298 -0
- package/dist/runtime/host-load-step-class.d.ts +70 -0
- package/dist/runtime/host-load-step-class.js +161 -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-test-slot.d.ts +43 -0
- package/dist/runtime/host-load-test-slot.js +81 -0
- package/dist/runtime/host-load-token-ledger.d.ts +200 -0
- package/dist/runtime/host-load-token-ledger.js +453 -0
- package/dist/runtime/host-load-windows-cpu.d.ts +34 -0
- package/dist/runtime/host-load-windows-cpu.js +85 -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 +16 -0
- package/dist/runtime/host-runtime-contract.js +35 -2
- package/dist/runtime/host-runtime-lease.d.ts +74 -4
- package/dist/runtime/host-runtime-lease.js +343 -67
- package/dist/runtime/host-runtime-promotion.d.ts +23 -0
- package/dist/runtime/host-runtime-promotion.js +48 -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 +596 -0
- package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
- package/dist/runtime/native-test-postgres-fallback.js +60 -8
- 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 +18 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +61 -55
- package/dist/runtime/runner-settings.d.ts +104 -0
- package/dist/runtime/runner-settings.js +236 -0
- package/dist/runtime/supervised-runtime-build-guard.d.ts +45 -0
- package/dist/runtime/supervised-runtime-build-guard.js +112 -0
- package/dist/sandbox/host-capacity-broker.d.ts +115 -0
- package/dist/sandbox/host-capacity-broker.js +336 -0
- package/dist/sandbox/managed-branch.d.ts +13 -0
- package/dist/sandbox/managed-branch.js +90 -0
- package/dist/sandbox/provider-auth/codex.js +11 -11
- package/dist/sandbox/runtime.d.ts +10 -1
- package/dist/sandbox/runtime.js +47 -8
- package/dist/sandbox/sandbox-cgroups.d.ts +14 -0
- package/dist/sandbox/sandbox-cgroups.js +42 -0
- package/dist/session/architect-waits.d.ts +2 -0
- package/dist/session/architect-waits.js +138 -0
- package/dist/session/managed-attempt-tools.d.ts +27 -7
- package/dist/session/managed-attempt-tools.js +406 -123
- package/dist/session/managed-build-coordinator.d.ts +17 -1
- package/dist/session/managed-build-coordinator.js +14 -1
- package/dist/session/managed-build-receipt.d.ts +5 -0
- package/dist/session/managed-build-receipt.js +8 -3
- package/dist/session/managed-command-host-load.d.ts +47 -0
- package/dist/session/managed-command-host-load.js +83 -0
- package/dist/session/mcp-argument-coercion.d.ts +23 -0
- package/dist/session/mcp-argument-coercion.js +121 -0
- package/dist/session/phase-completion.artifacts.d.ts +7 -0
- package/dist/session/phase-completion.artifacts.js +100 -26
- package/dist/session/phase-completion.command-validation.d.ts +7 -0
- package/dist/session/phase-completion.command-validation.js +77 -0
- package/dist/session/phase-completion.d.ts +12 -0
- package/dist/session/phase-completion.helpers.js +13 -12
- package/dist/session/phase-completion.js +5 -0
- package/dist/session/phase-completion.mcp-args.d.ts +9 -0
- package/dist/session/phase-completion.mcp-args.js +156 -0
- package/dist/session/phase-completion.prompts.js +6 -1
- package/dist/session/phase-completion.runtime.d.ts +5 -11
- package/dist/session/phase-completion.runtime.js +111 -230
- package/dist/session/phase-completion.schema-parts.d.ts +19 -0
- package/dist/session/phase-completion.schema-parts.js +188 -0
- package/dist/session/phase-completion.schemas.d.ts +3 -3
- package/dist/session/phase-completion.schemas.js +208 -231
- package/dist/session/phase-completion.validation.d.ts +2 -3
- package/dist/session/phase-completion.validation.js +49 -93
- 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-native-postgres.d.ts +30 -0
- package/dist/session/pre-publication-native-postgres.js +111 -0
- package/dist/session/pre-publication-pass.d.ts +61 -0
- package/dist/session/pre-publication-pass.js +148 -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 +12 -0
- package/dist/session/pre-publication-step-execution.js +50 -0
- package/dist/session/pre-publication-validation.d.ts +37 -21
- package/dist/session/pre-publication-validation.js +228 -219
- package/dist/session/provider-cli/claude-background-work.d.ts +67 -0
- package/dist/session/provider-cli/claude-background-work.js +181 -0
- package/dist/session/provider-cli/host-build-lock.d.ts +18 -0
- package/dist/session/provider-cli/host-build-lock.js +30 -0
- package/dist/session/provider-cli/pre-publication-repair.d.ts +56 -0
- package/dist/session/provider-cli/pre-publication-repair.js +276 -0
- 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.child-environment.d.ts +7 -0
- package/dist/session/provider-cli/provider-cli.child-environment.js +75 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.d.ts +3 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.js +37 -0
- 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 +46 -31
- package/dist/session/provider-cli/provider-cli.process.js +286 -403
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +10 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +87 -32
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +8 -0
- package/dist/session/provider-cli/provider-cli.runtime.js +29 -1
- package/dist/session/provider-cli/provider-cli.service.d.ts +7 -1
- package/dist/session/provider-cli/provider-cli.service.js +207 -192
- package/dist/session/provider-cli/provider-cli.types.d.ts +30 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.d.ts +10 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.js +151 -0
- package/dist/session/provider-cli/provider-cli.windows-launch.d.ts +23 -0
- package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -0
- package/dist/session/provider-cli/provider-in-flight-work.d.ts +10 -0
- package/dist/session/provider-cli/provider-in-flight-work.js +92 -0
- package/dist/session/provider-cli/provider-output-pipes.d.ts +30 -0
- package/dist/session/provider-cli/provider-output-pipes.js +67 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +8 -0
- package/dist/session/provider-cli/provider-output-state.js +15 -0
- package/dist/session/provider-cli/provider-user-config-isolation.d.ts +69 -0
- package/dist/session/provider-cli/provider-user-config-isolation.js +164 -0
- package/dist/session/publishable-worktree-changes.d.ts +54 -0
- package/dist/session/publishable-worktree-changes.js +193 -0
- package/dist/session/qa-sidecar-validation.d.ts +6 -0
- package/dist/session/qa-sidecar-validation.js +28 -0
- package/dist/session/sandbox-host-capacity-gate.d.ts +51 -0
- package/dist/session/sandbox-host-capacity-gate.js +257 -0
- package/dist/session/session-redaction.js +31 -181
- package/dist/session/session.base.d.ts +9 -1
- package/dist/session/session.service.d.ts +11 -2
- package/dist/session/session.service.js +189 -69
- package/dist/session/session.types.d.ts +3 -0
- package/dist/session/session.types.js +15 -3
- package/dist/session/sidecar-json-shape.d.ts +31 -0
- package/dist/session/sidecar-json-shape.js +217 -0
- package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
- package/dist/session/workspace-runtime-fingerprint.js +138 -0
- package/dist/shared/fs/file-identity.d.ts +10 -0
- package/dist/shared/fs/file-identity.js +15 -0
- package/dist/shared/fs/replace-file.d.ts +7 -0
- package/dist/shared/fs/replace-file.js +33 -0
- package/dist/shared/process/host-process-recovery.d.ts +14 -3
- package/dist/shared/process/host-process-recovery.js +23 -3
- package/dist/shared/process/host-process-supervisor.d.ts +14 -1
- package/dist/shared/process/host-process-supervisor.js +67 -15
- 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/process/windows-app-execution-alias.d.ts +19 -0
- package/dist/shared/process/windows-app-execution-alias.js +45 -0
- package/dist/shared/process/windows-launch.d.ts +18 -0
- package/dist/shared/process/windows-launch.js +68 -0
- package/dist/shared/provider-capabilities.js +14 -7
- 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/orphan-relink.d.ts +19 -0
- package/dist/worktree/orphan-relink.js +106 -0
- package/dist/worktree/wip-git.d.ts +33 -0
- package/dist/worktree/wip-git.js +122 -0
- package/dist/worktree/wip-refs.d.ts +62 -0
- package/dist/worktree/wip-refs.js +119 -0
- package/dist/worktree/wip-restore.d.ts +38 -0
- package/dist/worktree/wip-restore.js +190 -0
- package/dist/worktree/wip-snapshot.d.ts +50 -0
- package/dist/worktree/wip-snapshot.js +268 -0
- package/dist/worktree/worktree-inputs.d.ts +8 -0
- package/dist/worktree/worktree-inputs.js +134 -0
- package/dist/worktree/worktree-origin-sync.d.ts +34 -0
- package/dist/worktree/worktree-origin-sync.js +127 -0
- package/dist/worktree/worktree-wip-events.d.ts +18 -0
- package/dist/worktree/worktree-wip-events.js +98 -0
- package/dist/worktree/worktree-wip.d.ts +50 -0
- package/dist/worktree/worktree-wip.js +185 -0
- package/dist/worktree/worktree.base.d.ts +7 -1
- package/dist/worktree/worktree.service.d.ts +36 -5
- package/dist/worktree/worktree.service.js +124 -155
- package/dist/worktree/worktree.types.d.ts +38 -0
- package/package.json +2 -2
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// Linux Pressure Stall Information (PSI) parsing shared by the host load sampler.
|
|
2
|
+
// Format (system-wide /proc/pressure/<resource> and cgroup v2 <resource>.pressure):
|
|
3
|
+
// some avg10=0.12 avg60=0.34 avg300=0.56 total=123456
|
|
4
|
+
// full avg10=0.00 avg60=0.00 avg300=0.00 total=0
|
|
5
|
+
const pressureLinePattern = /^(some|full)\s+(.*)$/u;
|
|
6
|
+
/**
|
|
7
|
+
* Parses one PSI file. Returns null when the content has no well-formed
|
|
8
|
+
* `some`/`full` line, so callers can report PSI as unavailable instead of
|
|
9
|
+
* publishing zeros for a file they could not interpret.
|
|
10
|
+
*/
|
|
11
|
+
export function parsePressureStall(content) {
|
|
12
|
+
let some = null;
|
|
13
|
+
let full = null;
|
|
14
|
+
for (const rawLine of content.split(/\r?\n/u)) {
|
|
15
|
+
const match = pressureLinePattern.exec(rawLine.trim());
|
|
16
|
+
if (!match)
|
|
17
|
+
continue;
|
|
18
|
+
const averages = parseAverages(match[2]);
|
|
19
|
+
if (!averages)
|
|
20
|
+
continue;
|
|
21
|
+
if (match[1] === "some")
|
|
22
|
+
some = averages;
|
|
23
|
+
else
|
|
24
|
+
full = averages;
|
|
25
|
+
}
|
|
26
|
+
return some || full ? { some, full } : null;
|
|
27
|
+
}
|
|
28
|
+
const pressureFieldPattern = /^(avg10|avg60|avg300|total)=(\d+(?:\.\d+)?)$/u;
|
|
29
|
+
/** A PSI line must carry exactly avg10, avg60, avg300 and an integer total; anything else is malformed. */
|
|
30
|
+
function parseAverages(fields) {
|
|
31
|
+
const values = new Map();
|
|
32
|
+
for (const field of fields.trim().split(/\s+/u)) {
|
|
33
|
+
const match = pressureFieldPattern.exec(field);
|
|
34
|
+
if (!match || values.has(match[1]))
|
|
35
|
+
return null;
|
|
36
|
+
values.set(match[1], Number(match[2]));
|
|
37
|
+
}
|
|
38
|
+
const avg10 = values.get("avg10");
|
|
39
|
+
const avg60 = values.get("avg60");
|
|
40
|
+
const avg300 = values.get("avg300");
|
|
41
|
+
const total = values.get("total");
|
|
42
|
+
if (avg10 === undefined || avg60 === undefined || avg300 === undefined
|
|
43
|
+
|| total === undefined || !Number.isSafeInteger(total))
|
|
44
|
+
return null;
|
|
45
|
+
return { avg10: clampPercent(avg10), avg60: clampPercent(avg60), avg300: clampPercent(avg300) };
|
|
46
|
+
}
|
|
47
|
+
function clampPercent(value) {
|
|
48
|
+
return Math.min(100, Math.max(0, value));
|
|
49
|
+
}
|
|
50
|
+
/** Reads `usage_usec` from a cgroup v2 `cpu.stat` file. */
|
|
51
|
+
export function parseCgroupCpuUsageUsec(content) {
|
|
52
|
+
const match = /^usage_usec\s+(\d+)\s*$/mu.exec(content);
|
|
53
|
+
if (!match)
|
|
54
|
+
return null;
|
|
55
|
+
const value = Number(match[1]);
|
|
56
|
+
return Number.isSafeInteger(value) ? value : null;
|
|
57
|
+
}
|
|
58
|
+
/** Reads anonymous (RSS-like, excludes page cache) bytes from cgroup v2 `memory.stat`. */
|
|
59
|
+
export function parseCgroupMemoryAnonBytes(content) {
|
|
60
|
+
const match = /^anon\s+(\d+)\s*$/mu.exec(content);
|
|
61
|
+
if (!match)
|
|
62
|
+
return null;
|
|
63
|
+
const value = Number(match[1]);
|
|
64
|
+
return Number.isSafeInteger(value) ? value : null;
|
|
65
|
+
}
|
|
66
|
+
/** Reads a single non-negative integer file such as cgroup v2 `memory.current`. */
|
|
67
|
+
export function parseNonNegativeInteger(content) {
|
|
68
|
+
const trimmed = content.trim();
|
|
69
|
+
if (!/^\d+$/u.test(trimmed))
|
|
70
|
+
return null;
|
|
71
|
+
const value = Number(trimmed);
|
|
72
|
+
return Number.isSafeInteger(value) ? value : null;
|
|
73
|
+
}
|
|
74
|
+
/** Reads `MemAvailable` (bytes) from /proc/meminfo. */
|
|
75
|
+
export function parseMemAvailableBytes(content) {
|
|
76
|
+
const match = /^MemAvailable:\s+(\d+)\s*kB\s*$/mu.exec(content);
|
|
77
|
+
if (!match)
|
|
78
|
+
return null;
|
|
79
|
+
const value = Number(match[1]) * 1024;
|
|
80
|
+
return Number.isSafeInteger(value) ? value : null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Resolves the unified (cgroup v2) hierarchy path from /proc/self/cgroup.
|
|
84
|
+
* Returns null on pure cgroup v1 hosts (no `0::` entry) and for the root cgroup.
|
|
85
|
+
*/
|
|
86
|
+
export function parseUnifiedCgroupPath(content) {
|
|
87
|
+
for (const rawLine of content.split(/\r?\n/u)) {
|
|
88
|
+
const line = rawLine.trim();
|
|
89
|
+
if (!line.startsWith("0::"))
|
|
90
|
+
continue;
|
|
91
|
+
const cgroupPath = line.slice(3).trim();
|
|
92
|
+
if (!cgroupPath.startsWith("/") || cgroupPath === "/")
|
|
93
|
+
return null;
|
|
94
|
+
if (cgroupPath.split("/").some(segment => segment === ".."))
|
|
95
|
+
return null;
|
|
96
|
+
return cgroupPath;
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* This process's cgroup v2 path from `/proc/self/cgroup`, including the root
|
|
102
|
+
* `/` (a container's own cgroup under a cgroup namespace); null for cgroup v1
|
|
103
|
+
* or a malformed entry. `parseUnifiedCgroupPath` excludes the root, because the
|
|
104
|
+
* root is never the bridge's own unit; memory limits apply there all the same.
|
|
105
|
+
*/
|
|
106
|
+
export function parseUnifiedCgroupMembership(content) {
|
|
107
|
+
for (const rawLine of content.split(/\r?\n/u)) {
|
|
108
|
+
const line = rawLine.trim();
|
|
109
|
+
if (!line.startsWith("0::"))
|
|
110
|
+
continue;
|
|
111
|
+
const cgroupPath = line.slice(3).trim();
|
|
112
|
+
if (!cgroupPath.startsWith("/"))
|
|
113
|
+
return null;
|
|
114
|
+
if (cgroupPath.split("/").some(segment => segment === ".."))
|
|
115
|
+
return null;
|
|
116
|
+
return cgroupPath;
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
/** The leaf cgroup name, e.g. `forge-bridge.service`. */
|
|
121
|
+
export function cgroupLeafName(cgroupPath) {
|
|
122
|
+
return cgroupPath.split("/").filter(Boolean).at(-1) ?? null;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Whether the bridge's cgroup is dedicated to it, so its usage can later be
|
|
126
|
+
* subtracted from system pressure as "Forge's own load". Only a systemd
|
|
127
|
+
* `.service` qualifies by default, or exactly the unit an operator names via
|
|
128
|
+
* FORGE_BRIDGE_CGROUP_UNIT. A `.scope` is rejected: a bridge started from a
|
|
129
|
+
* terminal, SSH session or desktop app shares `session-N.scope` /
|
|
130
|
+
* `app-*.scope` with unrelated work (possibly the owner's game).
|
|
131
|
+
* Container cgroups (e.g. `docker-<id>.scope`) are not treated as dedicated yet.
|
|
132
|
+
*/
|
|
133
|
+
export function isDedicatedBridgeUnit(unit, configuredUnit) {
|
|
134
|
+
const configured = configuredUnit?.trim();
|
|
135
|
+
if (configured)
|
|
136
|
+
return unit === configured;
|
|
137
|
+
// `app-*` services are desktop-launched apps (XDG naming); `user@N` is the whole user manager.
|
|
138
|
+
return /^[^@\s]+(@[^\s]+)?\.service$/u.test(unit)
|
|
139
|
+
&& !/^app-/u.test(unit)
|
|
140
|
+
&& !/^user@\d+\.service$/u.test(unit);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Reads the aggregate `cpu` line of /proc/stat. Busy time is user + nice +
|
|
144
|
+
* system + irq + softirq + steal (guest time is already inside user/nice);
|
|
145
|
+
* idle and iowait are not busy. Both counters are additive CPU time, so a
|
|
146
|
+
* cgroup's `cpu.stat` usage over the same window can be subtracted from them.
|
|
147
|
+
*/
|
|
148
|
+
export function parseProcStatCpuTotals(content) {
|
|
149
|
+
let aggregate = null;
|
|
150
|
+
let cpuCount = 0;
|
|
151
|
+
for (const rawLine of content.split(/\r?\n/u)) {
|
|
152
|
+
const fields = rawLine.trim().split(/\s+/u);
|
|
153
|
+
if (fields[0] === "cpu") {
|
|
154
|
+
const values = fields.slice(1, 9).map(Number);
|
|
155
|
+
if (values.length < 8 || values.some(value => !Number.isSafeInteger(value) || value < 0))
|
|
156
|
+
return null;
|
|
157
|
+
aggregate = values;
|
|
158
|
+
}
|
|
159
|
+
else if (/^cpu\d+$/u.test(fields[0] ?? "")) {
|
|
160
|
+
cpuCount += 1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (!aggregate || cpuCount === 0)
|
|
164
|
+
return null;
|
|
165
|
+
const [user, nice, system, idle, iowait, irq, softirq, steal] = aggregate;
|
|
166
|
+
const busyTicks = user + nice + system + irq + softirq + steal;
|
|
167
|
+
return { busyTicks, totalTicks: busyTicks + idle + iowait, cpuCount };
|
|
168
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type HostRuntimeRequirements } from "./host-runtime-requirements.js";
|
|
1
2
|
export declare const hostRuntimeContractPath = ".forge/forge.runtime.yml";
|
|
2
3
|
export declare const hostRuntimeTestPostgresAdminEnvironment = "FORGE_TEST_POSTGRES_ADMIN_CONNECTION_STRING";
|
|
3
4
|
export declare const hostRuntimeLegacyTestPostgresEnvironment = "FORGE_TEST_POSTGRES_CONNECTION_STRING";
|
|
5
|
+
export declare const hostRuntimeTestPostgresProvisionerEnvironment = "FORGE_TEST_POSTGRES_PROVISIONER_CONNECTION_STRING";
|
|
4
6
|
export type RequestedHostConcurrency = "serial" | "parallel" | "disabled";
|
|
5
7
|
export type HostRuntimePortAdapter = "node" | "vite" | "next" | "aspnetcore";
|
|
6
8
|
export interface HostRuntimeLaunchConfig {
|
|
@@ -31,6 +33,8 @@ export interface HostRuntimeContract {
|
|
|
31
33
|
readonly browserProfile: "isolated";
|
|
32
34
|
readonly singletonResources: readonly string[];
|
|
33
35
|
};
|
|
36
|
+
/** Decision 0013 placement requirements; absent or null when the contract declares none. */
|
|
37
|
+
readonly requires?: HostRuntimeRequirements | null;
|
|
34
38
|
}
|
|
35
39
|
export interface LoadedHostRuntimeContract {
|
|
36
40
|
readonly contract: HostRuntimeContract;
|
|
@@ -53,6 +57,18 @@ export interface HostRuntimeDirectoryEntry {
|
|
|
53
57
|
/** Returns one identity-bound directory inventory for runtime discovery. */
|
|
54
58
|
export type HostRuntimeDirectorySnapshot = (target: string) => Promise<readonly HostRuntimeDirectoryEntry[]>;
|
|
55
59
|
export declare function loadHostRuntimeContract(worktreePath: string, snapshot?: HostRuntimeSourceSnapshot, directorySnapshot?: HostRuntimeDirectorySnapshot): Promise<LoadedHostRuntimeContract>;
|
|
60
|
+
/** A managed attempt's own API master key: 32 random bytes, base64-encoded, as Security:MasterKey expects. */
|
|
61
|
+
export declare function newAttemptApiMasterKey(): string;
|
|
62
|
+
/**
|
|
63
|
+
* The environment a managed attempt's ASP.NET API launches with. When neither the launch profile
|
|
64
|
+
* nor the runtime contract configures Security__MasterKey or Security__MasterKeyFile, the API gets
|
|
65
|
+
* the attempt's own key. Otherwise ASP.NET Development falls back to the host user's dotnet
|
|
66
|
+
* user-secrets: the host's own key where they exist, and a failed secret write wherever they do not.
|
|
67
|
+
* The caller keeps one key for the attempt's whole life, so a restart against the same attempt
|
|
68
|
+
* database can still decrypt what was stored before it. The key is a secret: it is for the API
|
|
69
|
+
* process only, never for the environment handed to checks or providers.
|
|
70
|
+
*/
|
|
71
|
+
export declare function withAttemptApiMasterKey(port: HostRuntimePortConfig, environment: Readonly<Record<string, string>>, attemptMasterKey: string): Readonly<Record<string, string>>;
|
|
56
72
|
export declare function defaultHostRuntimeContract(): HostRuntimeContract;
|
|
57
73
|
export declare function validateHostRuntimeContract(source: string): HostRuntimeContract;
|
|
58
74
|
export declare function hostPortEnvironment(config: HostRuntimePortConfig, hostIp: "127.0.0.1", hostPort: number): Readonly<Record<string, string>>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
1
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
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;
|
|
12
15
|
// Every discovery scan stops after this many directory entries. A monorepo needs a few
|
|
@@ -45,7 +48,7 @@ const ignoredDiscoveryDirectories = new Set([
|
|
|
45
48
|
"vendor",
|
|
46
49
|
"venv",
|
|
47
50
|
]);
|
|
48
|
-
const topLevelKeys = new Set(["schemaVersion", "runtime"]);
|
|
51
|
+
const topLevelKeys = new Set(["schemaVersion", "runtime", "requires", "costHints"]);
|
|
49
52
|
const runtimeKeys = new Set(["hostConcurrency", "ports", "playwright", "browserProfile", "singletonResources"]);
|
|
50
53
|
const portKeys = new Set(["adapter", "launch", "env", "baseUrlEnv", "format"]);
|
|
51
54
|
const launchKeys = new Set(["command", "args", "workingDirectory", "environment"]);
|
|
@@ -422,6 +425,34 @@ function safeAspNetLaunchEnvironment(name, value) {
|
|
|
422
425
|
"TMPDIR",
|
|
423
426
|
]).has(normalized);
|
|
424
427
|
}
|
|
428
|
+
// The settings an ASP.NET API reads its secret-store master key from (Security:MasterKey wins).
|
|
429
|
+
const aspNetMasterKeySettings = ["security__masterkey", "security__masterkeyfile"];
|
|
430
|
+
/** A managed attempt's own API master key: 32 random bytes, base64-encoded, as Security:MasterKey expects. */
|
|
431
|
+
export function newAttemptApiMasterKey() {
|
|
432
|
+
return randomBytes(32).toString("base64");
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* The environment a managed attempt's ASP.NET API launches with. When neither the launch profile
|
|
436
|
+
* nor the runtime contract configures Security__MasterKey or Security__MasterKeyFile, the API gets
|
|
437
|
+
* the attempt's own key. Otherwise ASP.NET Development falls back to the host user's dotnet
|
|
438
|
+
* user-secrets: the host's own key where they exist, and a failed secret write wherever they do not.
|
|
439
|
+
* The caller keeps one key for the attempt's whole life, so a restart against the same attempt
|
|
440
|
+
* database can still decrypt what was stored before it. The key is a secret: it is for the API
|
|
441
|
+
* process only, never for the environment handed to checks or providers.
|
|
442
|
+
*/
|
|
443
|
+
export function withAttemptApiMasterKey(port, environment, attemptMasterKey) {
|
|
444
|
+
if (port.adapter !== "aspnetcore")
|
|
445
|
+
return environment;
|
|
446
|
+
const masterKeySetting = (name) => aspNetMasterKeySettings.includes(name.toLowerCase());
|
|
447
|
+
if (Object.entries(environment).some(([name, value]) => masterKeySetting(name) && value.trim().length > 0)) {
|
|
448
|
+
return environment;
|
|
449
|
+
}
|
|
450
|
+
// A blank setting configures nothing; drop it so the attempt's key is the only one.
|
|
451
|
+
return {
|
|
452
|
+
...Object.fromEntries(Object.entries(environment).filter(([name]) => !masterKeySetting(name))),
|
|
453
|
+
Security__MasterKey: attemptMasterKey,
|
|
454
|
+
};
|
|
455
|
+
}
|
|
425
456
|
async function findFiles(root, accepts, maximumDepth, maximumEntries, snapshot) {
|
|
426
457
|
const results = [];
|
|
427
458
|
let examined = 0;
|
|
@@ -547,6 +578,7 @@ export function validateHostRuntimeContract(source) {
|
|
|
547
578
|
throw new Error("runtime_contract_invalid: runtime.browserProfile must be isolated.");
|
|
548
579
|
}
|
|
549
580
|
const ports = parsePorts(runtime.ports);
|
|
581
|
+
const requires = parseHostRuntimeRequirements(root.requires, root.costHints);
|
|
550
582
|
return {
|
|
551
583
|
schemaVersion: 1,
|
|
552
584
|
runtime: {
|
|
@@ -556,6 +588,7 @@ export function validateHostRuntimeContract(source) {
|
|
|
556
588
|
browserProfile,
|
|
557
589
|
singletonResources: parseSingletonResources(runtime.singletonResources),
|
|
558
590
|
},
|
|
591
|
+
...(requires ? { requires } : {}),
|
|
559
592
|
};
|
|
560
593
|
}
|
|
561
594
|
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";
|
|
@@ -12,6 +13,9 @@ import { type MemoryAdmissionDiagnostics } from "./memory-capacity.js";
|
|
|
12
13
|
import { PlaywrightHostRuntimeAdapter } from "./playwright-host-runtime-adapter.js";
|
|
13
14
|
import { HostParallelPromotionStore } from "./host-runtime-promotion.js";
|
|
14
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";
|
|
18
|
+
import type { RunnerHostDefaults } from "./runner-settings.js";
|
|
15
19
|
export interface HostRuntimeLeaseStart {
|
|
16
20
|
readonly lease: RuntimeIsolationLease;
|
|
17
21
|
readonly environment: Readonly<Record<string, string>>;
|
|
@@ -25,7 +29,7 @@ export interface HostRuntimeAdmissionCheckpoint {
|
|
|
25
29
|
}
|
|
26
30
|
export type HostRuntimeAdmissionCheckpointHandler = (checkpoint: HostRuntimeAdmissionCheckpoint) => void | Promise<void>;
|
|
27
31
|
export interface HostRuntimeProjectCheckpoint {
|
|
28
|
-
readonly code: "host_runtime_build_started" | "host_runtime_build_cached" | "host_runtime_build_completed" | "host_runtime_database_provisioned";
|
|
32
|
+
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" | "host_runtime_contract_readmitted";
|
|
29
33
|
readonly message: string;
|
|
30
34
|
readonly data?: Readonly<Record<string, unknown>>;
|
|
31
35
|
}
|
|
@@ -92,10 +96,21 @@ export interface HostNodeRuntimeLaunch<T> extends NodeRuntimeAdapterLaunch<T> {
|
|
|
92
96
|
readonly runtimeLease: RuntimeIsolationLease;
|
|
93
97
|
}
|
|
94
98
|
export interface HostRuntimeLeaseRuntime {
|
|
99
|
+
setRequirementsCheck?(check: HostRequirementsCheck | null): void;
|
|
100
|
+
/** Decision 0014: today's max attempts and memory reserve defaults, before env bounds. */
|
|
101
|
+
capacityLimitDefaults?(): RunnerHostDefaults;
|
|
102
|
+
/** Decision 0014: the effective max attempts and memory reserve, from the next attempt admission. */
|
|
103
|
+
applyCapacityLimits?(limits: HostCapacityLimits): void;
|
|
95
104
|
acquirePreparation?(dispatch: RunOnceDispatchPacket, signal?: AbortSignal): Promise<readonly string[]>;
|
|
96
105
|
acquire(dispatch: RunOnceDispatchPacket, signal?: AbortSignal): Promise<readonly string[]>;
|
|
97
106
|
start(dispatch: RunOnceDispatchPacket, worktreePath: string, signal?: AbortSignal, onAdmissionCheckpoint?: HostRuntimeAdmissionCheckpointHandler): Promise<HostRuntimeLeaseStart>;
|
|
98
107
|
startConfiguredProject(dispatchAttemptId: string, fencingToken: string, signal?: AbortSignal, onProjectCheckpoint?: HostRuntimeProjectCheckpointHandler): Promise<HostRuntimeLeaseStart>;
|
|
108
|
+
/**
|
|
109
|
+
* Stops the attempt's configured project processes, releases their ports, and
|
|
110
|
+
* starts them again (rebuilding when sources changed) so the stack serves the
|
|
111
|
+
* current workspace. Returns the environment with the newly assigned URLs.
|
|
112
|
+
*/
|
|
113
|
+
restartConfiguredProject?(dispatchAttemptId: string, fencingToken: string, signal?: AbortSignal, onProjectCheckpoint?: HostRuntimeProjectCheckpointHandler): Promise<HostRuntimeLeaseStart>;
|
|
99
114
|
updateLease(dispatchAttemptId: string, fencingToken: string, expiresAt: string): Promise<void>;
|
|
100
115
|
providerProcessRunner?(dispatchAttemptId: string, fencingToken: string): ProviderProcessRunner | null;
|
|
101
116
|
providerMemoryTelemetry?(dispatchAttemptId: string, fencingToken: string): AttemptProcessTreeMemoryTelemetry | null;
|
|
@@ -104,7 +119,10 @@ export interface HostRuntimeLeaseRuntime {
|
|
|
104
119
|
hasForegroundDemand?(): boolean;
|
|
105
120
|
reap?(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport>;
|
|
106
121
|
snapshot?(): HostRuntimeCapacitySnapshot;
|
|
122
|
+
/** Variables that let the completion MCP server share this host's load governor. */
|
|
123
|
+
hostLoadChildEnvironment?(): Readonly<Record<string, string>>;
|
|
107
124
|
}
|
|
125
|
+
export type HostRuntimeAdmissionPriority = "foreground" | "background";
|
|
108
126
|
export interface HostCapacityResourceSample {
|
|
109
127
|
readonly totalMemoryBytes: number;
|
|
110
128
|
readonly availableMemoryBytes: number;
|
|
@@ -140,10 +158,26 @@ export declare class HostRuntimeLeaseManager implements HostRuntimeLeaseRuntime
|
|
|
140
158
|
private workspaceAvailableBytes;
|
|
141
159
|
private readonly portBroker;
|
|
142
160
|
private readonly nodeAdapter;
|
|
143
|
-
|
|
161
|
+
/** Rebuilt by applyCapacityLimits (decision 0014); every admission reads the current one. */
|
|
162
|
+
private capacityConfiguration;
|
|
144
163
|
private readonly memoryAvailability;
|
|
145
164
|
private readonly executionRoot;
|
|
146
|
-
|
|
165
|
+
/** Host-wide admission for heavy steps (decisions 0013, 0018): the host test slot, and the budget when on. */
|
|
166
|
+
readonly hostLoadGovernor: HostLoadGovernor;
|
|
167
|
+
private requirementsCheck;
|
|
168
|
+
/** Installs the decision 0013 accept-time requirements recheck for host attempts. */
|
|
169
|
+
setRequirementsCheck(check: HostRequirementsCheck | null): void;
|
|
170
|
+
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);
|
|
171
|
+
/** Today's defaults for the limits the server can push, before any env bound (decision 0014). */
|
|
172
|
+
capacityLimitDefaults(): RunnerHostDefaults;
|
|
173
|
+
/**
|
|
174
|
+
* Decision 0014: the bridge's effective max attempts and memory reserve. They
|
|
175
|
+
* apply from the next attempt admission; admitted attempts keep their
|
|
176
|
+
* reservations and are never preempted, even when the new limit is lower than
|
|
177
|
+
* what already runs. The idle reserve follows the reserve as at startup.
|
|
178
|
+
*/
|
|
179
|
+
applyCapacityLimits(limits: HostCapacityLimits): void;
|
|
180
|
+
hostLoadChildEnvironment(): Readonly<Record<string, string>>;
|
|
147
181
|
reap(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport>;
|
|
148
182
|
snapshot(): HostRuntimeCapacitySnapshot;
|
|
149
183
|
hasForegroundDemand(): boolean;
|
|
@@ -165,6 +199,24 @@ export declare class HostRuntimeLeaseManager implements HostRuntimeLeaseRuntime
|
|
|
165
199
|
start(dispatch: RunOnceDispatchPacket, worktreePath: string, signal?: AbortSignal, onAdmissionCheckpoint?: HostRuntimeAdmissionCheckpointHandler): Promise<HostRuntimeLeaseStart>;
|
|
166
200
|
updateLease(dispatchAttemptId: string, fencingToken: string, expiresAt: string): Promise<void>;
|
|
167
201
|
startConfiguredProject(dispatchAttemptId: string, fencingToken: string, signal?: AbortSignal, onProjectCheckpoint?: HostRuntimeProjectCheckpointHandler): Promise<HostRuntimeLeaseStart>;
|
|
202
|
+
/**
|
|
203
|
+
* Launches the configured project. Only the first launch, from the admitted commit's clean
|
|
204
|
+
* source, may record parallel-safety proof: a restart serves the workspace after the provider
|
|
205
|
+
* edited it, and a proof observed there would be stored under the admitted commit and could
|
|
206
|
+
* move this or a later attempt at that commit into shared admission for source it never ran.
|
|
207
|
+
*/
|
|
208
|
+
private launchConfiguredProject;
|
|
209
|
+
/**
|
|
210
|
+
* Relaunches the configured project so it serves the current workspace. Every
|
|
211
|
+
* configured process stops (the API port changes, so the dev server's proxy target
|
|
212
|
+
* must change with it), its port reservation is released and dropped from the
|
|
213
|
+
* persisted lease, and the regular start path runs again, including the ASP.NET
|
|
214
|
+
* prebuild, whose receipt rebuilds only when the sources changed.
|
|
215
|
+
*/
|
|
216
|
+
restartConfiguredProject(dispatchAttemptId: string, fencingToken: string, signal?: AbortSignal, onProjectCheckpoint?: HostRuntimeProjectCheckpointHandler): Promise<HostRuntimeLeaseStart>;
|
|
217
|
+
private runConfiguredProjectRestart;
|
|
218
|
+
/** Stops configured project processes in reverse launch order and releases their ports. */
|
|
219
|
+
private stopConfiguredProject;
|
|
168
220
|
providerProcessRunner(dispatchAttemptId: string, fencingToken: string): ProviderProcessRunner | null;
|
|
169
221
|
private markCapacityReservationRunning;
|
|
170
222
|
providerMemoryTelemetry(dispatchAttemptId: string, fencingToken: string): AttemptProcessTreeMemoryTelemetry | null;
|
|
@@ -215,3 +267,21 @@ export declare class HostRuntimeCapacityRequestImpossibleError extends Error {
|
|
|
215
267
|
}
|
|
216
268
|
export declare function hostRuntimeEventResources(lease: RuntimeIsolationLease, runtimeContract?: LoadedHostRuntimeContract, executionClass?: HostRuntimeExecutionClass): Record<string, unknown>;
|
|
217
269
|
export declare function hostRuntimeSingletonKeys(dispatch: RunOnceDispatchPacket): readonly string[];
|
|
270
|
+
/**
|
|
271
|
+
* Every environment key `hostRuntimeEnvironment` and the Playwright overlay derive from the
|
|
272
|
+
* configured project's assigned ports. They name a live stack, so they are withheld while the
|
|
273
|
+
* stack is down: after its ports are released another attempt may be assigned them.
|
|
274
|
+
*/
|
|
275
|
+
export declare function hostRuntimeStackEnvironmentKeys(runtimeContract: LoadedHostRuntimeContract): readonly string[];
|
|
276
|
+
export declare function runtimeAdmissionPriority(dispatch: RunOnceDispatchPacket): HostRuntimeAdmissionPriority;
|
|
277
|
+
/** The pushed attempt limits (decision 0014), already resolved against host env bounds. */
|
|
278
|
+
export interface HostCapacityLimits {
|
|
279
|
+
readonly maxConcurrentAttempts: number;
|
|
280
|
+
readonly memoryReserveBytes: number;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Today's max attempts and adaptive memory reserve for this host, before
|
|
284
|
+
* FORGE_HOST_MAX_CONCURRENT_ATTEMPTS and FORGE_HOST_MEMORY_RESERVE_BYTES
|
|
285
|
+
* (decision 0014 treats those as bounds on the server's values).
|
|
286
|
+
*/
|
|
287
|
+
export declare function hostCapacityLimitDefaults(capacityResourceSample?: HostCapacityResourceSample): RunnerHostDefaults;
|