@loucompanion/forge-bridge 0.1.4-dev.f22f5e3d01fe → 0.2.1-dev.0fedbc5c9ef7
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 +89 -1
- package/dist/bridge/bridge-chat-giphy-look.d.ts +48 -0
- package/dist/bridge/bridge-chat-giphy-look.js +55 -0
- package/dist/bridge/bridge-chat-provider-command.d.ts +27 -3
- package/dist/bridge/bridge-chat-provider-command.js +131 -26
- package/dist/bridge/bridge-chat.types.d.ts +20 -0
- package/dist/bridge/bridge-chat.types.js +28 -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.service.d.ts +19 -12
- package/dist/bridge/bridge.service.js +155 -282
- package/dist/bridge/bridge.types.d.ts +5 -0
- package/dist/bridge/in-flight-registry.d.ts +62 -0
- package/dist/bridge/in-flight-registry.js +207 -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.js +14 -1
- package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
- package/dist/bridge/sandbox-resource-accounting.js +150 -0
- package/dist/bridge/windows-bash-resolution.d.ts +31 -0
- package/dist/bridge/windows-bash-resolution.js +153 -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 +11 -1
- package/dist/cleanup/cleanup.service.js +80 -62
- package/dist/cleanup/cleanup.types.d.ts +2 -0
- package/dist/cleanup/host-runtime-ledger.d.ts +2 -0
- package/dist/cleanup/host-runtime-ledger.js +30 -9
- package/dist/cli/cli.help.js +56 -12
- package/dist/cli/cli.service.d.ts +3 -10
- package/dist/cli/cli.service.js +10 -171
- package/dist/cli/idle-status.d.ts +84 -0
- package/dist/cli/idle-status.js +181 -0
- package/dist/cli/local-config.d.ts +2 -0
- package/dist/cli/local-config.js +7 -1
- 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 +104 -26
- package/dist/runtime/attempt-database-broker.d.ts +1 -1
- package/dist/runtime/attempt-node-runtime-launcher.d.ts +36 -0
- package/dist/runtime/attempt-node-runtime-launcher.js +169 -0
- package/dist/runtime/attempt-process-supervisor.d.ts +2 -0
- package/dist/runtime/attempt-process-supervisor.js +12 -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-listener-inspector.d.ts +26 -0
- package/dist/runtime/host-listener-inspector.js +84 -3
- package/dist/runtime/host-load-admission.d.ts +5 -0
- package/dist/runtime/host-load-governor-config.d.ts +10 -1
- package/dist/runtime/host-load-governor-config.js +4 -1
- package/dist/runtime/host-load-governor.d.ts +10 -1
- package/dist/runtime/host-load-governor.js +33 -3
- package/dist/runtime/host-load-ledger-lock.js +6 -4
- package/dist/runtime/host-load-runtime-settings.js +4 -2
- package/dist/runtime/host-load-sampler.d.ts +8 -1
- package/dist/runtime/host-load-sampler.js +14 -7
- package/dist/runtime/host-load-test-slot.js +7 -0
- package/dist/runtime/host-runtime-contract.d.ts +12 -0
- package/dist/runtime/host-runtime-contract.js +29 -1
- package/dist/runtime/host-runtime-lease.d.ts +28 -3
- package/dist/runtime/host-runtime-lease.js +140 -296
- package/dist/runtime/host-runtime-ledger-recovery.d.ts +20 -0
- package/dist/runtime/host-runtime-ledger-recovery.js +134 -0
- package/dist/runtime/host-runtime-promotion.d.ts +78 -2
- package/dist/runtime/host-runtime-promotion.js +307 -14
- package/dist/runtime/managed-command-teardown.js +5 -16
- package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
- package/dist/runtime/native-test-postgres-fallback.js +60 -8
- package/dist/runtime/prepared-runtime-identity.d.ts +4 -0
- package/dist/runtime/prepared-runtime-identity.js +130 -9
- package/dist/runtime/prepared-runtime-readiness.d.ts +13 -1
- package/dist/runtime/prepared-runtime-readiness.js +63 -16
- package/dist/runtime/runner-settings.d.ts +4 -0
- package/dist/runtime/runner-settings.js +22 -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 +3 -1
- package/dist/sandbox/host-capacity-broker.js +4 -2
- 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.js +3 -7
- package/dist/session/managed-attempt-tools.d.ts +0 -7
- package/dist/session/managed-attempt-tools.js +50 -82
- package/dist/session/managed-build-coordinator.d.ts +16 -0
- package/dist/session/managed-build-coordinator.js +10 -0
- package/dist/session/managed-build-receipt.d.ts +5 -0
- package/dist/session/managed-build-receipt.js +8 -3
- package/dist/session/phase-completion.artifacts.js +2 -1
- package/dist/session/phase-completion.d.ts +8 -0
- package/dist/session/phase-completion.js +1 -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.runtime.d.ts +0 -8
- package/dist/session/phase-completion.runtime.js +43 -197
- 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-process.js +10 -10
- package/dist/session/pre-publication-step-execution.d.ts +2 -1
- package/dist/session/pre-publication-step-execution.js +6 -5
- package/dist/session/pre-publication-validation.d.ts +7 -3
- package/dist/session/pre-publication-validation.js +32 -30
- package/dist/session/provider-cli/claude-background-work.d.ts +3 -2
- package/dist/session/provider-cli/claude-background-work.js +4 -3
- 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 +16 -0
- package/dist/session/provider-cli/pre-publication-repair.js +33 -0
- package/dist/session/provider-cli/provider-cli.child-environment.js +4 -2
- package/dist/session/provider-cli/provider-cli.merge-integrity.d.ts +6 -3
- package/dist/session/provider-cli/provider-cli.merge-integrity.js +28 -8
- package/dist/session/provider-cli/provider-cli.process.d.ts +2 -14
- package/dist/session/provider-cli/provider-cli.process.js +4 -94
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +3 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +27 -27
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +8 -0
- package/dist/session/provider-cli/provider-cli.runtime.js +23 -2
- package/dist/session/provider-cli/provider-cli.service.d.ts +4 -1
- package/dist/session/provider-cli/provider-cli.service.js +27 -43
- 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-user-config-isolation.d.ts +69 -0
- package/dist/session/provider-cli/provider-user-config-isolation.js +164 -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 +22 -1
- package/dist/session/sandbox-host-capacity-gate.js +35 -16
- package/dist/session/session-redaction.js +31 -181
- package/dist/session/session.service.d.ts +6 -0
- package/dist/session/session.service.js +131 -88
- package/dist/session/session.types.d.ts +1 -0
- package/dist/session/session.types.js +3 -3
- package/dist/session/sidecar-json-shape.d.ts +31 -0
- package/dist/session/sidecar-json-shape.js +217 -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 +13 -1
- package/dist/shared/process/host-process-supervisor.js +66 -14
- package/dist/shared/provider-capabilities.js +9 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/orphan-relink.d.ts +19 -0
- package/dist/worktree/orphan-relink.js +106 -0
- package/dist/worktree/wip-git.d.ts +42 -0
- package/dist/worktree/wip-git.js +139 -0
- package/dist/worktree/wip-refs.d.ts +77 -0
- package/dist/worktree/wip-refs.js +146 -0
- package/dist/worktree/wip-restore.d.ts +46 -0
- package/dist/worktree/wip-restore.js +280 -0
- package/dist/worktree/wip-snapshot.d.ts +53 -0
- package/dist/worktree/wip-snapshot.js +270 -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 +35 -0
- package/dist/worktree/worktree-origin-sync.js +128 -0
- package/dist/worktree/worktree-wip-events.d.ts +18 -0
- package/dist/worktree/worktree-wip-events.js +115 -0
- package/dist/worktree/worktree-wip.d.ts +51 -0
- package/dist/worktree/worktree-wip.js +190 -0
- package/dist/worktree/worktree.base.d.ts +7 -1
- package/dist/worktree/worktree.service.d.ts +27 -5
- package/dist/worktree/worktree.service.js +112 -181
- package/dist/worktree/worktree.types.d.ts +35 -0
- package/package.json +1 -1
- package/runtime/windows-listener-owner.ps1 +12 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { isSubPath, safeSegment } from "../shared/path/path.js";
|
|
4
|
+
import { filterArtifactsForLane, injectWorktreeArtifacts } from "./artifact-injector.js";
|
|
5
|
+
import { hydratePriorPhaseArtifacts } from "./prior-phase-artifact-hydrator.js";
|
|
6
|
+
import { materializeStoryQaReferences } from "./story-qa-reference-hydrator.js";
|
|
7
|
+
// What a prepared worktree is given before the provider starts, once its source is in place:
|
|
8
|
+
// the Story QA reference inputs, a clean artifact root for this run, the prior phases' artifacts,
|
|
9
|
+
// the QA rework packet and the lane's resolved artifacts.
|
|
10
|
+
/** Materializes the run's inputs into a prepared worktree (outside the repository lock). */
|
|
11
|
+
export async function materializeWorktreeInputs(worktreePath, request, git) {
|
|
12
|
+
// Reference inputs and an exact-tree local repair checkpoint must survive output cleanup.
|
|
13
|
+
await materializeStoryQaReferences(worktreePath, request, git);
|
|
14
|
+
if (!request.preserveExistingState) {
|
|
15
|
+
await clearRunArtifactRoots(worktreePath, request);
|
|
16
|
+
}
|
|
17
|
+
const hydratedPriorPhaseArtifactCount = await hydratePriorPhaseArtifacts(worktreePath, request.priorPhaseArtifacts);
|
|
18
|
+
const qaReworkPacketPath = await materializeQaReworkPacket(worktreePath, request);
|
|
19
|
+
const artifacts = filterArtifactsForLane(request.artifacts, request.lane, request.phase);
|
|
20
|
+
if (artifacts.length > 0) {
|
|
21
|
+
await injectWorktreeArtifacts(worktreePath, artifacts, await trackedForgePaths(git, worktreePath));
|
|
22
|
+
}
|
|
23
|
+
return { hydratedPriorPhaseArtifactCount, qaReworkPacketPath };
|
|
24
|
+
}
|
|
25
|
+
async function trackedForgePaths(git, worktreePath) {
|
|
26
|
+
const output = await git.run(worktreePath, ["ls-files", "-z", "--", ".forge"]);
|
|
27
|
+
return new Set(output.split("\0").filter(Boolean).map(value => value.replaceAll("\\", "/")));
|
|
28
|
+
}
|
|
29
|
+
export async function clearRunArtifactRoots(worktreePath, request) {
|
|
30
|
+
const roots = new Set();
|
|
31
|
+
roots.add(workItemArtifactRoot(worktreePath, request.workItem.id));
|
|
32
|
+
for (const artifact of request.priorPhaseArtifacts ?? []) {
|
|
33
|
+
roots.add(workItemArtifactRoot(worktreePath, artifact.workItemId));
|
|
34
|
+
}
|
|
35
|
+
const ownerType = normalizeOwnerType(request.ownerType);
|
|
36
|
+
const ownerId = request.ownerId?.trim();
|
|
37
|
+
if (ownerType && ownerId) {
|
|
38
|
+
roots.add(ownerArtifactRoot(worktreePath, ownerType, ownerId));
|
|
39
|
+
}
|
|
40
|
+
for (const root of roots) {
|
|
41
|
+
const resolvedRoot = path.resolve(root);
|
|
42
|
+
if (!isSubPath(worktreePath, resolvedRoot)) {
|
|
43
|
+
throw new Error(`Artifact root must stay under ${worktreePath}.`);
|
|
44
|
+
}
|
|
45
|
+
await ensureNoSymlinkPathSegments(worktreePath, resolvedRoot, "Artifact root must not traverse symlinked path segments.");
|
|
46
|
+
await fs.rm(resolvedRoot, { recursive: true, force: true });
|
|
47
|
+
await fs.mkdir(resolvedRoot, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function materializeQaReworkPacket(worktreePath, request) {
|
|
51
|
+
const qaRework = request.qaRework;
|
|
52
|
+
if (!qaRework) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const artifactRoot = artifactRootForRequest(worktreePath, request);
|
|
56
|
+
const packetFileName = qaReworkPacketFileName(qaRework.packetPath);
|
|
57
|
+
const packetPath = path.join(artifactRoot, packetFileName);
|
|
58
|
+
const paths = new Set([packetPath, path.join(artifactRoot, "qa-rework-packet.json")]);
|
|
59
|
+
const packetJson = qaRework.packetJson.endsWith("\n") ? qaRework.packetJson : `${qaRework.packetJson}\n`;
|
|
60
|
+
for (const target of paths) {
|
|
61
|
+
const resolvedTarget = path.resolve(target);
|
|
62
|
+
if (!isSubPath(worktreePath, resolvedTarget)) {
|
|
63
|
+
throw new Error(`QA rework packet path must stay under ${worktreePath}.`);
|
|
64
|
+
}
|
|
65
|
+
await ensureNoSymlinkPathSegments(worktreePath, path.dirname(resolvedTarget), "QA rework packet path must not traverse symlinked path segments.");
|
|
66
|
+
await fs.mkdir(path.dirname(resolvedTarget), { recursive: true });
|
|
67
|
+
await fs.writeFile(resolvedTarget, packetJson, "utf8");
|
|
68
|
+
}
|
|
69
|
+
return path.resolve(packetPath);
|
|
70
|
+
}
|
|
71
|
+
function artifactRootForRequest(worktreePath, request) {
|
|
72
|
+
const ownerType = normalizeOwnerType(request.ownerType);
|
|
73
|
+
const ownerId = request.ownerId?.trim();
|
|
74
|
+
if (ownerType && ownerId) {
|
|
75
|
+
return ownerArtifactRoot(worktreePath, ownerType, ownerId);
|
|
76
|
+
}
|
|
77
|
+
return workItemArtifactRoot(worktreePath, request.workItem.id);
|
|
78
|
+
}
|
|
79
|
+
function workItemArtifactRoot(worktreePath, workItemId) {
|
|
80
|
+
return path.join(worktreePath, ".forge", "work-items", safeSegment(workItemId, "work item id"), "artifacts");
|
|
81
|
+
}
|
|
82
|
+
function ownerArtifactRoot(worktreePath, ownerType, ownerId) {
|
|
83
|
+
return path.join(worktreePath, ".forge", ownerType === "story" ? "stories" : "work-items", safeSegment(ownerId, "owner id"), "artifacts");
|
|
84
|
+
}
|
|
85
|
+
function normalizeOwnerType(value) {
|
|
86
|
+
const normalized = (value ?? "").trim().toLowerCase().replace(/-/g, "_");
|
|
87
|
+
if (normalized === "story") {
|
|
88
|
+
return "story";
|
|
89
|
+
}
|
|
90
|
+
if (normalized === "work_item" || normalized === "workitem" || normalized === "work item") {
|
|
91
|
+
return "work_item";
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
function qaReworkPacketFileName(packetPath) {
|
|
96
|
+
const normalized = packetPath.trim().replace(/\\/g, "/");
|
|
97
|
+
const fileName = normalized.split("/").filter(Boolean).at(-1) ?? "";
|
|
98
|
+
return /^qa-rework-packet(?:\.attempt-\d+)?\.json$/i.test(fileName)
|
|
99
|
+
? fileName
|
|
100
|
+
: "qa-rework-packet.json";
|
|
101
|
+
}
|
|
102
|
+
async function ensureNoSymlinkPathSegments(root, targetPath, errorMessage) {
|
|
103
|
+
const resolvedRoot = path.resolve(root);
|
|
104
|
+
const resolvedTarget = path.resolve(targetPath);
|
|
105
|
+
const relative = path.relative(resolvedRoot, resolvedTarget);
|
|
106
|
+
if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
|
107
|
+
throw new Error(errorMessage);
|
|
108
|
+
}
|
|
109
|
+
let current = resolvedRoot;
|
|
110
|
+
const rootStat = await fs.lstat(current);
|
|
111
|
+
if (rootStat.isSymbolicLink()) {
|
|
112
|
+
throw new Error(errorMessage);
|
|
113
|
+
}
|
|
114
|
+
if (!relative) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
for (const segment of relative.split(path.sep)) {
|
|
118
|
+
if (!segment) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
current = path.join(current, segment);
|
|
122
|
+
const stat = await fs.lstat(current).catch((error) => {
|
|
123
|
+
if (error.code === "ENOENT")
|
|
124
|
+
return null;
|
|
125
|
+
throw error;
|
|
126
|
+
});
|
|
127
|
+
if (!stat) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (stat.isSymbolicLink()) {
|
|
131
|
+
throw new Error(errorMessage);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { GitClient } from "../shared/git/git.js";
|
|
2
|
+
import type { RunnerDispatchEvent } from "../session/session.types.js";
|
|
3
|
+
import type { OriginSync, WorktreeHandle } from "./worktree.types.js";
|
|
4
|
+
export type BridgeLog = (message: string) => void;
|
|
5
|
+
export declare const writeBridgeLog: BridgeLog;
|
|
6
|
+
export interface ReusedWorktreeSyncRequest {
|
|
7
|
+
readonly git: GitClient;
|
|
8
|
+
readonly worktreePath: string;
|
|
9
|
+
readonly branchName: string;
|
|
10
|
+
readonly sessionId?: string | null;
|
|
11
|
+
readonly lane: string;
|
|
12
|
+
readonly wipAttempt?: number | null;
|
|
13
|
+
readonly log: BridgeLog;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Brings a reused worktree that is only behind origin up to origin's head (see the rules above).
|
|
17
|
+
* Returns what moved, or undefined when nothing did. Throws when the worktree diverged from origin
|
|
18
|
+
* or its uncommitted work could not be saved: a failed prepare is better than a pass on stale code.
|
|
19
|
+
*/
|
|
20
|
+
export declare function syncReusedWorktreeToOrigin(request: ReusedWorktreeSyncRequest): Promise<OriginSync | undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* Logs what a new worktree starts from. When a local copy of the branch is re-pointed at its own
|
|
23
|
+
* origin head (guardBranchReset has already saved any commits only it had), says so and returns
|
|
24
|
+
* the move when the local copy was only behind.
|
|
25
|
+
*/
|
|
26
|
+
export declare function describeNewWorktreeStart(git: GitClient, repoPath: string, branchName: string, startPoint: string, log: BridgeLog): Promise<OriginSync | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* After a failed `git fetch origin`: refuses to go on when origin is known to have any of
|
|
29
|
+
* `branches` (it has a remote-tracking ref for it), since the local state may then be stale.
|
|
30
|
+
*/
|
|
31
|
+
export declare function refuseStaleFallbackAfterFetchFailure(git: GitClient, repoPath: string, branches: readonly string[], fetchError: unknown, log: BridgeLog): Promise<void>;
|
|
32
|
+
type Emit = (event: RunnerDispatchEvent) => Promise<void>;
|
|
33
|
+
/** Reports what prepare did to the worktree's source and saved WIP, before the provider starts. */
|
|
34
|
+
export declare function emitWorktreePreparedEvents(worktree: WorktreeHandle, emit: Emit): Promise<void>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { preserveWorktreeWip } from "./wip-snapshot.js";
|
|
2
|
+
import { emitWipRestoreEvent } from "./worktree-wip-events.js";
|
|
3
|
+
export const writeBridgeLog = message => {
|
|
4
|
+
process.stderr.write(`[${new Date().toISOString()}] ${message}\n`);
|
|
5
|
+
};
|
|
6
|
+
/** Compares a local commit with the remote-tracking head of `branchName`. */
|
|
7
|
+
async function compareWithOrigin(git, cwd, local, branchName) {
|
|
8
|
+
const origin = await revParse(git, cwd, `refs/remotes/origin/${branchName}^{commit}`);
|
|
9
|
+
if (!origin)
|
|
10
|
+
return { relation: "no_origin_branch", local, origin: null };
|
|
11
|
+
if (origin === local)
|
|
12
|
+
return { relation: "equal", local, origin };
|
|
13
|
+
if (await isAncestor(git, cwd, local, origin))
|
|
14
|
+
return { relation: "behind", local, origin };
|
|
15
|
+
if (await isAncestor(git, cwd, origin, local))
|
|
16
|
+
return { relation: "ahead", local, origin };
|
|
17
|
+
return { relation: "diverged", local, origin };
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Brings a reused worktree that is only behind origin up to origin's head (see the rules above).
|
|
21
|
+
* Returns what moved, or undefined when nothing did. Throws when the worktree diverged from origin
|
|
22
|
+
* or its uncommitted work could not be saved: a failed prepare is better than a pass on stale code.
|
|
23
|
+
*/
|
|
24
|
+
export async function syncReusedWorktreeToOrigin(request) {
|
|
25
|
+
const { git, worktreePath, branchName, log } = request;
|
|
26
|
+
const head = await revParse(git, worktreePath, "HEAD^{commit}");
|
|
27
|
+
if (!head)
|
|
28
|
+
throw new Error(`Reused worktree ${worktreePath} has no committed HEAD on '${branchName}'.`);
|
|
29
|
+
const comparison = await compareWithOrigin(git, worktreePath, head, branchName);
|
|
30
|
+
const where = `Reused worktree ${worktreePath} on '${branchName}'`;
|
|
31
|
+
if (comparison.relation === "diverged") {
|
|
32
|
+
const message = `${where} has diverged from origin: local HEAD ${head} and origin/${branchName} ${comparison.origin} `
|
|
33
|
+
+ "each have commits the other lacks. Forge will not reset it or pick a side; reconcile the branch, then retry.";
|
|
34
|
+
log(`Worktree prepare: ${message}`);
|
|
35
|
+
throw new Error(message);
|
|
36
|
+
}
|
|
37
|
+
if (comparison.relation !== "behind" || !comparison.origin) {
|
|
38
|
+
log(`Worktree prepare: ${where} kept at ${short(head)} (${describeKept(comparison, branchName)}).`);
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const snapshot = await preserveWorktreeWip({
|
|
42
|
+
worktreePath,
|
|
43
|
+
branchName,
|
|
44
|
+
reason: "pre_sync",
|
|
45
|
+
sessionId: request.sessionId,
|
|
46
|
+
lane: request.lane,
|
|
47
|
+
attempt: request.wipAttempt,
|
|
48
|
+
// It was based on the old head, so a later pass must never apply it on the new one by itself.
|
|
49
|
+
autoRestore: false,
|
|
50
|
+
}).catch((error) => {
|
|
51
|
+
throw new Error(`Refusing to move ${worktreePath} from ${head} to origin/${branchName} ${comparison.origin}: `
|
|
52
|
+
+ `its uncommitted work could not be saved to a WIP ref (${errorMessage(error)}).`, { cause: error });
|
|
53
|
+
});
|
|
54
|
+
await git.run(worktreePath, ["reset", "--hard", comparison.origin]);
|
|
55
|
+
await git.run(worktreePath, ["clean", "-fd"]);
|
|
56
|
+
const saved = snapshot.status === "clean" ? null : snapshot;
|
|
57
|
+
log(`Worktree prepare: ${where} was behind origin; synced from ${short(head)} to ${short(comparison.origin)}`
|
|
58
|
+
+ `${saved ? ` after saving its uncommitted work to ${saved.ref}` : " (it had no uncommitted work)"}.`);
|
|
59
|
+
return { from: head, to: comparison.origin, wipRef: saved?.ref ?? null };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Logs what a new worktree starts from. When a local copy of the branch is re-pointed at its own
|
|
63
|
+
* origin head (guardBranchReset has already saved any commits only it had), says so and returns
|
|
64
|
+
* the move when the local copy was only behind.
|
|
65
|
+
*/
|
|
66
|
+
export async function describeNewWorktreeStart(git, repoPath, branchName, startPoint, log) {
|
|
67
|
+
const target = await revParse(git, repoPath, `${startPoint}^{commit}`);
|
|
68
|
+
const local = await revParse(git, repoPath, `refs/heads/${branchName}^{commit}`);
|
|
69
|
+
const ownOrigin = startPoint === `refs/remotes/origin/${branchName}`;
|
|
70
|
+
const comparison = local && ownOrigin ? await compareWithOrigin(git, repoPath, local, branchName) : null;
|
|
71
|
+
const previous = local && local !== target ? `; the local branch was at ${short(local)}${comparison ? ` (${comparison.relation})` : ""}` : "";
|
|
72
|
+
log(`Worktree prepare: creating a worktree on '${branchName}' at ${startPoint} ${short(target)}${previous}.`);
|
|
73
|
+
return comparison?.relation === "behind" && comparison.origin
|
|
74
|
+
? { from: comparison.local, to: comparison.origin, wipRef: null }
|
|
75
|
+
: undefined;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* After a failed `git fetch origin`: refuses to go on when origin is known to have any of
|
|
79
|
+
* `branches` (it has a remote-tracking ref for it), since the local state may then be stale.
|
|
80
|
+
*/
|
|
81
|
+
export async function refuseStaleFallbackAfterFetchFailure(git, repoPath, branches, fetchError, log) {
|
|
82
|
+
for (const branch of new Set(branches)) {
|
|
83
|
+
const known = await revParse(git, repoPath, `refs/remotes/origin/${branch}^{commit}`);
|
|
84
|
+
if (!known)
|
|
85
|
+
continue;
|
|
86
|
+
const message = `Could not fetch origin (${errorMessage(fetchError)}), so '${branch}' may be stale here `
|
|
87
|
+
+ `(origin last seen at ${short(known)}). Refusing to prepare from possibly stale state; retry once origin is reachable.`;
|
|
88
|
+
log(`Worktree prepare: ${message}`);
|
|
89
|
+
throw new Error(message, { cause: fetchError });
|
|
90
|
+
}
|
|
91
|
+
log(`Worktree prepare: could not fetch origin (${errorMessage(fetchError)}); no remote-tracking ref exists for `
|
|
92
|
+
+ `${[...new Set(branches)].join(" or ")}, so the local branch is used.`);
|
|
93
|
+
}
|
|
94
|
+
/** Reports what prepare did to the worktree's source and saved WIP, before the provider starts. */
|
|
95
|
+
export async function emitWorktreePreparedEvents(worktree, emit) {
|
|
96
|
+
const sync = worktree.originSync;
|
|
97
|
+
if (sync) {
|
|
98
|
+
await emit({
|
|
99
|
+
role: "runner",
|
|
100
|
+
kind: "checkpoint",
|
|
101
|
+
content: `Synced ${worktree.branchName} from ${short(sync.from)} to origin's head ${short(sync.to)} before the provider started`
|
|
102
|
+
+ `${sync.wipRef ? `; its uncommitted work was saved to ${sync.wipRef} first.` : "."}`,
|
|
103
|
+
eventType: "worktree_synced_to_origin",
|
|
104
|
+
data: JSON.stringify({ ...sync, branchName: worktree.branchName, worktreePath: worktree.worktreePath }),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
await emitWipRestoreEvent(worktree, emit);
|
|
108
|
+
}
|
|
109
|
+
function describeKept(comparison, branchName) {
|
|
110
|
+
switch (comparison.relation) {
|
|
111
|
+
case "no_origin_branch": return `origin has no '${branchName}'`;
|
|
112
|
+
case "equal": return "already at origin's head";
|
|
113
|
+
default: return `ahead of origin/${branchName} ${short(comparison.origin)}; its unpublished commits are kept`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function revParse(git, cwd, rev) {
|
|
117
|
+
const value = (await git.run(cwd, ["rev-parse", "-q", "--verify", rev]).catch(() => "")).trim();
|
|
118
|
+
return value.length > 0 ? value : null;
|
|
119
|
+
}
|
|
120
|
+
async function isAncestor(git, cwd, ancestor, descendant) {
|
|
121
|
+
return await git.run(cwd, ["merge-base", "--is-ancestor", ancestor, descendant]).then(() => true, () => false);
|
|
122
|
+
}
|
|
123
|
+
function short(sha) {
|
|
124
|
+
return sha ? sha.slice(0, 12) : "(none)";
|
|
125
|
+
}
|
|
126
|
+
function errorMessage(error) {
|
|
127
|
+
return error instanceof Error ? error.message : String(error);
|
|
128
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RunnerDispatchEvent } from "../session/session.types.js";
|
|
2
|
+
import type { WorktreeService } from "./worktree.base.js";
|
|
3
|
+
import type { WipSessionOutcome, WorktreeHandle } from "./worktree.types.js";
|
|
4
|
+
type Emit = (event: RunnerDispatchEvent) => Promise<void>;
|
|
5
|
+
/** Reports what the prepare did with the story's saved WIP, before the provider starts. */
|
|
6
|
+
export declare function emitWipRestoreEvent(worktree: WorktreeHandle, emit: Emit): Promise<void>;
|
|
7
|
+
/** How a session ended, for the snapshot it leaves behind. */
|
|
8
|
+
export declare function sessionWipOutcome(signal: AbortSignal | undefined, events: readonly RunnerDispatchEvent[], succeeded: boolean): WipSessionOutcome;
|
|
9
|
+
/**
|
|
10
|
+
* Ends a session's use of its worktree: first saves its WIP (or retires the snapshot it started
|
|
11
|
+
* from) and reports that, then, as a separate step, releases the worktree unless the session
|
|
12
|
+
* paused or its WIP could not be saved. Nothing here throws over the session's own result or
|
|
13
|
+
* failure: a release that refuses to delete unsaved work, or that fails (a Windows process still
|
|
14
|
+
* holding a cwd in the worktree makes the rename fail), keeps the worktree on this runner and is
|
|
15
|
+
* reported as a cleanup failure.
|
|
16
|
+
*/
|
|
17
|
+
export declare function settleWorktree(worktrees: WorktreeService, worktree: WorktreeHandle, outcome: WipSessionOutcome, signal: AbortSignal | undefined, emit: Emit): Promise<void>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/** Reports what the prepare did with the story's saved WIP, before the provider starts. */
|
|
2
|
+
export async function emitWipRestoreEvent(worktree, emit) {
|
|
3
|
+
const outcome = worktree.wipRestore;
|
|
4
|
+
if (!outcome || outcome.status === "none")
|
|
5
|
+
return;
|
|
6
|
+
if (outcome.status === "restored" && outcome.reapplied) {
|
|
7
|
+
await emit(checkpoint("worktree_wip_restored", reappliedSummary(worktree.branchName, outcome, outcome.reapplied), outcome));
|
|
8
|
+
}
|
|
9
|
+
else if (outcome.status === "restored") {
|
|
10
|
+
await emit(checkpoint("worktree_wip_restored", `Restored uncommitted work saved in ${outcome.ref}${outcome.sourceSessionId ? ` by session ${outcome.sourceSessionId}` : ""} `
|
|
11
|
+
+ `(${outcome.changedPaths} path(s)${outcome.mergeInProgress ? ", with its merge still in progress" : ""}) onto ${worktree.branchName} before the provider started.`, outcome));
|
|
12
|
+
}
|
|
13
|
+
else if (outcome.status === "not_restored") {
|
|
14
|
+
await emit(checkpoint("worktree_wip_not_restored", `Did not restore the uncommitted work saved in ${outcome.ref}: ${outcome.reason === "branch_moved" ? "the story branch has moved since it was saved" : "it could not be applied"}. `
|
|
15
|
+
+ `${outcome.detail} This pass starts from a clean worktree; the ref is kept on origin.`, outcome));
|
|
16
|
+
}
|
|
17
|
+
else if (outcome.status === "skipped_dirty") {
|
|
18
|
+
await emit(checkpoint("worktree_wip_restore_skipped", `${worktree.branchName} already has uncommitted changes in its reattached worktree, so ${outcome.ref} was not applied on top of them.`, outcome));
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
await emit(checkpoint("worktree_wip_restore_unavailable", `Could not check origin for saved uncommitted work on ${worktree.branchName}: ${outcome.detail}`, outcome));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** The checkpoint for a snapshot re-applied across a branch move: clean, or with the paths left for the agent. */
|
|
25
|
+
function reappliedSummary(branchName, outcome, reapplied) {
|
|
26
|
+
const moved = `${branchName} had moved from ${reapplied.snapshotBaseHead.slice(0, 12)} to ${outcome.baseHead.slice(0, 12)} since it was saved`;
|
|
27
|
+
if (reapplied.conflictedPaths.length === 0) {
|
|
28
|
+
return `Re-applied the uncommitted work saved in ${outcome.ref} across a branch move (${moved}): a 3-way merge onto the new HEAD `
|
|
29
|
+
+ `was clean (${outcome.changedPaths} path(s)) and is restored before the provider started.`;
|
|
30
|
+
}
|
|
31
|
+
const listed = reapplied.conflictedPaths.slice(0, maxListedConflicts).join(", ");
|
|
32
|
+
const more = reapplied.conflictedPaths.length > maxListedConflicts ? ` and ${reapplied.conflictedPaths.length - maxListedConflicts} more` : "";
|
|
33
|
+
return `Re-applied the uncommitted work saved in ${outcome.ref} across a branch move with ${reapplied.conflictedPaths.length} conflict(s) `
|
|
34
|
+
+ `left for the agent to resolve: ${listed}${more}. ${moved}; the conflicted paths are unmerged with conflict markers, `
|
|
35
|
+
+ `Forge will not publish them unresolved, and the ref is kept on origin.`;
|
|
36
|
+
}
|
|
37
|
+
const maxListedConflicts = 20;
|
|
38
|
+
/** How a session ended, for the snapshot it leaves behind. */
|
|
39
|
+
export function sessionWipOutcome(signal, events, succeeded) {
|
|
40
|
+
if (succeeded)
|
|
41
|
+
return { reason: null };
|
|
42
|
+
if (signal?.aborted)
|
|
43
|
+
return { reason: isPauseRequested(signal) ? "session_paused" : "session_stopped" };
|
|
44
|
+
const repairLimit = events.some(event => event.eventType === "prepublication_repair_exhausted");
|
|
45
|
+
return { reason: repairLimit ? "repair_limit" : "session_failed" };
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Ends a session's use of its worktree: first saves its WIP (or retires the snapshot it started
|
|
49
|
+
* from) and reports that, then, as a separate step, releases the worktree unless the session
|
|
50
|
+
* paused or its WIP could not be saved. Nothing here throws over the session's own result or
|
|
51
|
+
* failure: a release that refuses to delete unsaved work, or that fails (a Windows process still
|
|
52
|
+
* holding a cwd in the worktree makes the rename fail), keeps the worktree on this runner and is
|
|
53
|
+
* reported as a cleanup failure.
|
|
54
|
+
*/
|
|
55
|
+
export async function settleWorktree(worktrees, worktree, outcome, signal, emit) {
|
|
56
|
+
const settlement = await worktrees.settleWip?.(worktree, outcome)
|
|
57
|
+
.catch((error) => ({ error: { code: "wip_snapshot_failed", message: messageOf(error) } }));
|
|
58
|
+
if (settlement)
|
|
59
|
+
await emitSettlement(worktree, outcome, settlement, emit).catch(() => undefined);
|
|
60
|
+
// A paused session keeps its worktree for the resume, exactly as before. So does a session whose
|
|
61
|
+
// work could not be saved: the release's own snapshot is never applied automatically, so letting
|
|
62
|
+
// it succeed after this one failed would delete the only copy a later pass would restore.
|
|
63
|
+
if (isPauseRequested(signal) || settlement?.error)
|
|
64
|
+
return;
|
|
65
|
+
try {
|
|
66
|
+
await worktrees.release(worktree);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (!(error instanceof Error) || error.name !== "WipPreservationError") {
|
|
70
|
+
await emit({
|
|
71
|
+
role: "runner",
|
|
72
|
+
kind: "error",
|
|
73
|
+
content: `Could not remove the worktree ${worktree.worktreePath} after the session (${messageOf(error)}); it stays on this runner.`,
|
|
74
|
+
eventType: "worktree_release_failed",
|
|
75
|
+
data: JSON.stringify({ stage: "release", worktreePath: worktree.worktreePath, message: messageOf(error) }),
|
|
76
|
+
}).catch(() => undefined);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
await emit({
|
|
80
|
+
role: "runner",
|
|
81
|
+
kind: "error",
|
|
82
|
+
content: `Kept the worktree ${worktree.worktreePath} on this runner instead of removing it: its uncommitted work could not be saved (${error.message}).`,
|
|
83
|
+
eventType: "worktree_wip_snapshot_failed",
|
|
84
|
+
data: JSON.stringify({ code: error.code ?? "wip_snapshot_failed", stage: "release", worktreePath: worktree.worktreePath }),
|
|
85
|
+
}).catch(() => undefined);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function emitSettlement(worktree, outcome, settlement, emit) {
|
|
89
|
+
const snapshot = settlement.snapshot;
|
|
90
|
+
if (snapshot && snapshot.status !== "clean") {
|
|
91
|
+
await emit(checkpoint("worktree_wip_saved", `Saved this session's uncommitted work (${snapshot.changedPaths} path(s)) to ${snapshot.ref}${snapshot.pushed ? " on origin" : " in the runner's repository (it has no origin)"} `
|
|
92
|
+
+ `before the session ended (${outcome.reason}). The next pass on ${worktree.branchName} restores it, re-applying it if the branch has moved.`, { ...snapshot, reason: outcome.reason, lane: worktree.lane ?? null }));
|
|
93
|
+
}
|
|
94
|
+
if (settlement.error) {
|
|
95
|
+
await emit({
|
|
96
|
+
role: "runner",
|
|
97
|
+
kind: "error",
|
|
98
|
+
content: `Could not save this session's uncommitted work to a WIP ref (${settlement.error.message}). Forge will not delete the worktree ${worktree.worktreePath}; the work stays on this runner only.`,
|
|
99
|
+
eventType: "worktree_wip_snapshot_failed",
|
|
100
|
+
data: JSON.stringify({ ...settlement.error, stage: "session_end", reason: outcome.reason, worktreePath: worktree.worktreePath }),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (settlement.retiredRef) {
|
|
104
|
+
await emit(checkpoint("worktree_wip_retired", `Deleted ${settlement.retiredRef}: the work restored from it is now ${outcome.reason ? "saved again by this session" : "published by this session"}.`, { ref: settlement.retiredRef }));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function isPauseRequested(signal) {
|
|
108
|
+
return signal?.aborted === true && String(signal.reason ?? "").trim().toLowerCase() === "session pause requested";
|
|
109
|
+
}
|
|
110
|
+
function checkpoint(eventType, content, data) {
|
|
111
|
+
return { role: "runner", kind: "checkpoint", content, eventType, data: JSON.stringify(data) };
|
|
112
|
+
}
|
|
113
|
+
function messageOf(error) {
|
|
114
|
+
return error instanceof Error ? error.message : String(error);
|
|
115
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { GitClient } from "../shared/git/git.js";
|
|
2
|
+
import { type WipRestoreOutcome } from "./wip-restore.js";
|
|
3
|
+
import { type WipSnapshotResult } from "./wip-snapshot.js";
|
|
4
|
+
import type { WipSessionOutcome, WipSettlement, WorktreeHandle } from "./worktree.types.js";
|
|
5
|
+
export { relinkOrphanedWorktree } from "./orphan-relink.js";
|
|
6
|
+
/**
|
|
7
|
+
* Saves uncommitted work before `git reset --hard` / `git clean` on an existing worktree; a later
|
|
8
|
+
* pass may apply it by itself only when it came from a publishing lane.
|
|
9
|
+
* Throws when it could not be saved: losing work is worse than a failed prepare.
|
|
10
|
+
*/
|
|
11
|
+
export declare function guardWorktreeReset(worktreePath: string, branchName: string, owner: {
|
|
12
|
+
readonly sessionId?: string | null;
|
|
13
|
+
readonly lane: string;
|
|
14
|
+
readonly wipAttempt?: number | null;
|
|
15
|
+
}): Promise<WipSnapshotResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Before a local branch is re-pointed at a new start point (`worktree add -B`), saves any commits
|
|
18
|
+
* on it that neither the start point nor origin has, as a `forge.wip.v1` snapshot like any other:
|
|
19
|
+
* its tree is the tip's, its first parent the tip (so the commits are `<ref>^1` and its ancestors),
|
|
20
|
+
* and it is never applied automatically. Throws when they could not be saved.
|
|
21
|
+
*/
|
|
22
|
+
export declare function guardBranchReset(git: GitClient, repoPath: string, branchName: string, startPoint: string): Promise<void>;
|
|
23
|
+
/** Puts the newest restorable snapshot back on a freshly prepared worktree of a publishing lane. */
|
|
24
|
+
export declare function restoreWorktreeWip(input: {
|
|
25
|
+
readonly worktreePath: string;
|
|
26
|
+
readonly repoPath: string;
|
|
27
|
+
readonly branchName: string;
|
|
28
|
+
readonly sessionId?: string | null;
|
|
29
|
+
readonly lane: string;
|
|
30
|
+
}): Promise<WipRestoreOutcome | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Saves a worktree that is about to be deleted. Its snapshot is never applied automatically (a
|
|
33
|
+
* session that ended without succeeding has already saved its own work under its id; what is
|
|
34
|
+
* left after a successful pass was deliberately not published). Throws when it could not be saved.
|
|
35
|
+
*/
|
|
36
|
+
export declare function guardWorktreeRelease(handle: WorktreeHandle): Promise<WipSnapshotResult>;
|
|
37
|
+
/** Forgets what this process saved for a worktree once it is gone. */
|
|
38
|
+
export declare function worktreeReleased(handle: WorktreeHandle): void;
|
|
39
|
+
/**
|
|
40
|
+
* At the end of a session: saves its uncommitted work unless it succeeded, and deletes the
|
|
41
|
+
* snapshot it started from once that work is safe elsewhere: saved again here, or (after a
|
|
42
|
+
* success) published, which is only certain when nothing is left uncommitted. Leftovers keep the
|
|
43
|
+
* ref; the release's own snapshot of them is never applied automatically.
|
|
44
|
+
* Never throws; a failure is reported in the result.
|
|
45
|
+
*/
|
|
46
|
+
export declare function settleSessionWip(handle: WorktreeHandle, outcome: WipSessionOutcome): Promise<WipSettlement>;
|
|
47
|
+
/**
|
|
48
|
+
* After a release: deletes the readiness probe's branch, and other Forge branches whose work is
|
|
49
|
+
* already on the base. Branches of live leases are kept; when the ledger can't be read, nothing is.
|
|
50
|
+
*/
|
|
51
|
+
export declare function sweepBranchesAfterRelease(git: GitClient, handle: WorktreeHandle, leaseStateRoot: string, limit: number): Promise<void>;
|