@loucompanion/forge-bridge 0.1.4-dev.c2f22d1dd395 → 0.1.4-dev.ccffca94938b
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 +57 -2
- package/dist/bridge/bridge-chat-provider-command.d.ts +16 -0
- package/dist/bridge/bridge-chat-provider-command.js +137 -0
- package/dist/bridge/bridge-chat.types.d.ts +10 -0
- package/dist/bridge/bridge-chat.types.js +16 -1
- package/dist/bridge/bridge.base.d.ts +9 -0
- package/dist/bridge/bridge.service.d.ts +73 -2
- package/dist/bridge/bridge.service.js +312 -119
- package/dist/bridge/bridge.types.d.ts +16 -0
- package/dist/bridge/local-yield-flag.d.ts +6 -0
- package/dist/bridge/local-yield-flag.js +34 -0
- package/dist/bridge/runner-host-capabilities.d.ts +5 -0
- package/dist/bridge/runner-host-capabilities.js +17 -0
- package/dist/bridge/test-postgres-capability.d.ts +14 -0
- package/dist/bridge/test-postgres-capability.js +120 -0
- package/dist/cleanup/cleanup.service.d.ts +9 -0
- package/dist/cleanup/cleanup.service.js +72 -109
- package/dist/cleanup/cleanup.types.d.ts +4 -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 +5 -0
- package/dist/cleanup/host-runtime-ledger.js +109 -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 +18 -0
- package/dist/cli/cli.service.d.ts +16 -0
- package/dist/cli/cli.service.js +142 -16
- package/dist/cli/local-config.d.ts +4 -0
- package/dist/cli/local-config.js +26 -4
- package/dist/runtime/aspnet-runtime-prebuild.js +94 -6
- package/dist/runtime/host-facts.d.ts +2 -1
- 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 +184 -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 +185 -0
- package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
- package/dist/runtime/host-load-runtime-settings.js +78 -0
- package/dist/runtime/host-load-sampler.d.ts +75 -2
- package/dist/runtime/host-load-sampler.js +142 -8
- 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 +21 -1
- package/dist/runtime/host-pressure-stall.js +48 -1
- package/dist/runtime/host-runtime-contract.d.ts +3 -0
- package/dist/runtime/host-runtime-contract.js +4 -1
- package/dist/runtime/host-runtime-lease.d.ts +74 -4
- package/dist/runtime/host-runtime-lease.js +281 -11
- 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/playwright-host-runtime-adapter.d.ts +7 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +13 -1
- package/dist/runtime/runner-settings.d.ts +100 -0
- package/dist/runtime/runner-settings.js +214 -0
- package/dist/sandbox/host-capacity-broker.d.ts +113 -0
- package/dist/sandbox/host-capacity-broker.js +334 -0
- package/dist/sandbox/runtime.d.ts +10 -1
- package/dist/sandbox/runtime.js +45 -2
- 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 +2 -0
- package/dist/session/managed-attempt-tools.js +157 -39
- 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 +94 -25
- 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 +4 -0
- package/dist/session/phase-completion.helpers.js +13 -12
- package/dist/session/phase-completion.js +4 -0
- package/dist/session/phase-completion.prompts.js +6 -1
- package/dist/session/phase-completion.runtime.d.ts +5 -3
- package/dist/session/phase-completion.runtime.js +49 -19
- 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-pass.d.ts +61 -0
- package/dist/session/pre-publication-pass.js +148 -0
- package/dist/session/pre-publication-process.d.ts +3 -0
- package/dist/session/pre-publication-process.js +23 -11
- 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 +32 -20
- package/dist/session/pre-publication-validation.js +195 -158
- package/dist/session/provider-cli/claude-background-work.d.ts +66 -0
- package/dist/session/provider-cli/claude-background-work.js +180 -0
- package/dist/session/provider-cli/pre-publication-repair.d.ts +40 -0
- package/dist/session/provider-cli/pre-publication-repair.js +243 -0
- package/dist/session/provider-cli/provider-cli.artifacts.d.ts +2 -1
- package/dist/session/provider-cli/provider-cli.artifacts.js +20 -7
- package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
- package/dist/session/provider-cli/provider-cli.child-environment.js +73 -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 +39 -17
- package/dist/session/provider-cli/provider-cli.process.js +136 -345
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +7 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +65 -10
- package/dist/session/provider-cli/provider-cli.runtime.js +7 -0
- package/dist/session/provider-cli/provider-cli.service.d.ts +4 -1
- package/dist/session/provider-cli/provider-cli.service.js +142 -162
- 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-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/publishable-worktree-changes.d.ts +10 -1
- package/dist/session/publishable-worktree-changes.js +21 -5
- package/dist/session/sandbox-host-capacity-gate.d.ts +30 -0
- package/dist/session/sandbox-host-capacity-gate.js +238 -0
- package/dist/session/session.base.d.ts +9 -1
- package/dist/session/session.service.d.ts +9 -2
- package/dist/session/session.service.js +120 -5
- package/dist/session/session.types.d.ts +3 -0
- package/dist/session/session.types.js +12 -3
- package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
- package/dist/session/workspace-runtime-fingerprint.js +138 -0
- package/dist/shared/process/host-process-supervisor.d.ts +1 -0
- package/dist/shared/process/host-process-supervisor.js +1 -1
- 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 +5 -6
- 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 +46 -10
- package/dist/worktree/worktree.service.d.ts +10 -1
- package/dist/worktree/worktree.service.js +42 -2
- package/dist/worktree/worktree.types.d.ts +7 -0
- package/package.json +2 -2
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { GitClient } from "../shared/git/git.js";
|
|
2
|
+
import type { HostLoadStepGate } from "../runtime/host-load-governor.js";
|
|
2
3
|
import type { WorktreeLifecycleCoordinator, WorktreeService } from "./worktree.base.js";
|
|
3
4
|
import type { WorktreeHandle, WorktreePrepareRequest } from "./worktree.types.js";
|
|
4
5
|
export declare class GitWorktreeService implements WorktreeService {
|
|
5
6
|
private readonly git;
|
|
6
7
|
private readonly coordinator;
|
|
7
|
-
|
|
8
|
+
/** Gates dependency install fallbacks; inert unless the governor is on. */
|
|
9
|
+
private readonly hostLoadGate?;
|
|
10
|
+
/** Holds the host runtime lease ledger; branches of live leases are never swept on release. */
|
|
11
|
+
private readonly leaseStateRoot;
|
|
12
|
+
constructor(git?: GitClient, coordinator?: WorktreeLifecycleCoordinator,
|
|
13
|
+
/** Gates dependency install fallbacks; inert unless the governor is on. */
|
|
14
|
+
hostLoadGate?: HostLoadStepGate | undefined,
|
|
15
|
+
/** Holds the host runtime lease ledger; branches of live leases are never swept on release. */
|
|
16
|
+
leaseStateRoot?: string);
|
|
8
17
|
prepare(request: WorktreePrepareRequest): Promise<WorktreeHandle>;
|
|
9
18
|
private trackedForgePaths;
|
|
10
19
|
private registeredManagedWorktreePath;
|
|
@@ -3,18 +3,30 @@ import fs from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { RepositoryCoordinatorLock } from "../sandbox/repository-lock.js";
|
|
5
5
|
import { GitClient } from "../shared/git/git.js";
|
|
6
|
+
import { liveLeaseBranches, readHostRuntimeLeases } from "../cleanup/host-runtime-ledger.js";
|
|
7
|
+
import { deleteBranchIfUnused, isRuntimeReadinessBranch, sweepManagedBranches } from "../cleanup/managed-branch-sweep.js";
|
|
6
8
|
import { ensureDirectory, isSubPath, resolveExistingDirectoryPath, safeSegment } from "../shared/path/path.js";
|
|
7
9
|
import { filterArtifactsForLane, injectWorktreeArtifacts } from "./artifact-injector.js";
|
|
8
10
|
import { hydratePriorPhaseArtifacts } from "./prior-phase-artifact-hydrator.js";
|
|
9
11
|
import { materializeStoryQaReferences } from "./story-qa-reference-hydrator.js";
|
|
10
12
|
import { warmWorktreeDependencies } from "./dependency-warmer.js";
|
|
11
13
|
import { defaultWorktreeCoordinatorStateRoot, managedRepoRoot, resolveManagedWorktreeRoot, } from "./worktree-paths.js";
|
|
14
|
+
// Bounds the branch sweep that runs after each release, so one release never holds the repository lock long.
|
|
15
|
+
const releaseSweepLimit = 25;
|
|
12
16
|
export class GitWorktreeService {
|
|
13
17
|
git;
|
|
14
18
|
coordinator;
|
|
15
|
-
|
|
19
|
+
hostLoadGate;
|
|
20
|
+
leaseStateRoot;
|
|
21
|
+
constructor(git = new GitClient(), coordinator = new RepositoryCoordinatorLock(defaultWorktreeCoordinatorStateRoot()),
|
|
22
|
+
/** Gates dependency install fallbacks; inert unless the governor is on. */
|
|
23
|
+
hostLoadGate,
|
|
24
|
+
/** Holds the host runtime lease ledger; branches of live leases are never swept on release. */
|
|
25
|
+
leaseStateRoot = defaultWorktreeCoordinatorStateRoot()) {
|
|
16
26
|
this.git = git;
|
|
17
27
|
this.coordinator = coordinator;
|
|
28
|
+
this.hostLoadGate = hostLoadGate;
|
|
29
|
+
this.leaseStateRoot = leaseStateRoot;
|
|
18
30
|
}
|
|
19
31
|
async prepare(request) {
|
|
20
32
|
const allowedRoot = await ensureDirectory(request.allowedRepoRoot);
|
|
@@ -102,7 +114,15 @@ export class GitWorktreeService {
|
|
|
102
114
|
baseCheckoutPath: repoPath,
|
|
103
115
|
worktreePath: resolvedWorktreePath,
|
|
104
116
|
allowedRoot,
|
|
105
|
-
warmPathOverrides: request.warmPathOverrides
|
|
117
|
+
warmPathOverrides: request.warmPathOverrides,
|
|
118
|
+
hostLoad: this.hostLoadGate?.enabled
|
|
119
|
+
? {
|
|
120
|
+
gate: this.hostLoadGate,
|
|
121
|
+
dispatchAttemptId: request.hostLoadOwner?.dispatchAttemptId ?? null,
|
|
122
|
+
priority: request.hostLoadOwner?.priority ?? "foreground",
|
|
123
|
+
}
|
|
124
|
+
: undefined,
|
|
125
|
+
signal: request.signal,
|
|
106
126
|
})
|
|
107
127
|
: undefined;
|
|
108
128
|
return {
|
|
@@ -164,6 +184,26 @@ export class GitWorktreeService {
|
|
|
164
184
|
// directory is fully materialized (or after an external cleanup removes it).
|
|
165
185
|
// Always prune so those missing-directory registrations do not accumulate.
|
|
166
186
|
await this.git.run(handle.repoPath, ["worktree", "prune", "--expire", "now"]).catch(() => undefined);
|
|
187
|
+
// A readiness probe's branch goes with its worktree. Other Forge branches on this device
|
|
188
|
+
// whose work is already merged into the base go too; branches with unmerged work stay.
|
|
189
|
+
// A lease can be live while its worktree is briefly missing, so its branch is protected
|
|
190
|
+
// even when no worktree has it checked out. If the ledger can't be read, sweep nothing.
|
|
191
|
+
const protectedBranches = await readHostRuntimeLeases(this.leaseStateRoot)
|
|
192
|
+
.then(liveLeaseBranches)
|
|
193
|
+
.catch(() => null);
|
|
194
|
+
if (!protectedBranches)
|
|
195
|
+
return;
|
|
196
|
+
let budget = releaseSweepLimit;
|
|
197
|
+
if (isRuntimeReadinessBranch(handle.branchName) && !protectedBranches.has(handle.branchName)
|
|
198
|
+
&& await deleteBranchIfUnused(this.git, handle.repoPath, handle.branchName)) {
|
|
199
|
+
budget -= 1;
|
|
200
|
+
}
|
|
201
|
+
await sweepManagedBranches(this.git, handle.repoPath, {
|
|
202
|
+
baseBranch: handle.baseBranch,
|
|
203
|
+
includeMergedWorkBranches: true,
|
|
204
|
+
protectedBranches,
|
|
205
|
+
limit: budget,
|
|
206
|
+
}).catch(() => undefined);
|
|
167
207
|
});
|
|
168
208
|
}
|
|
169
209
|
async restoreOrphanedWorktree(input) {
|
|
@@ -21,6 +21,13 @@ export interface WorktreePrepareRequest {
|
|
|
21
21
|
readonly warmPathOverrides?: readonly string[];
|
|
22
22
|
readonly applicationRuntimeRequired?: boolean;
|
|
23
23
|
readonly preserveExistingState?: boolean;
|
|
24
|
+
/** The attempt dependency installs reserve host capacity for (decision 0013). */
|
|
25
|
+
readonly hostLoadOwner?: {
|
|
26
|
+
readonly dispatchAttemptId: string | null;
|
|
27
|
+
readonly priority: "foreground" | "background";
|
|
28
|
+
};
|
|
29
|
+
/** The attempt's cancellation: queued installs stop waiting and running ones are stopped. */
|
|
30
|
+
readonly signal?: AbortSignal;
|
|
24
31
|
}
|
|
25
32
|
export interface WorktreeHandle {
|
|
26
33
|
readonly repoPath: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loucompanion/forge-bridge",
|
|
3
|
-
"version": "0.1.4-dev.
|
|
3
|
+
"version": "0.1.4-dev.ccffca94938b",
|
|
4
4
|
"description": "Forge runner bridge CLI for connecting local developer machines to Forge dispatch.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"test:residue": "node scripts/run-owned-residue-gate.mjs",
|
|
44
44
|
"test:watch": "vitest",
|
|
45
45
|
"smoke:package": "tsc -p tsconfig.json && node scripts/smoke-package.mjs",
|
|
46
|
-
"lint": "eslint \"src/**/*.ts\" \"scripts/**/*.mjs\" \"vitest.config.ts\" \"vitest.setup.ts\""
|
|
46
|
+
"lint": "eslint \"src/**/*.ts\" \"scripts/**/*.mjs\" \"vitest.config.ts\" \"vitest.setup.ts\" && node ../../scripts/class-design/check-eslint-ratchet.mjs bridge"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@microsoft/signalr": "^8.0.17",
|