refactor: remove two dead files never wired to any consumer

- worktree-session-state.js: planned extraction for worktree originalCwd
  state; worktree-command.js kept its own module-level var and never
  imported this file. Dead since creation in 47c806d73.

- auto-runtime-state.js: planned extraction of isAutoActive/isAutoPaused
  and AutoSession wrapper; auto.js already exports all the same functions.
  No file in the codebase imported auto-runtime-state.js.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Mikael Hugo 2026-05-11 14:16:09 +02:00
parent e18a0001bb
commit 5be5d6d438
2 changed files with 0 additions and 73 deletions

View file

@ -1,42 +0,0 @@
// SF autonomous mode runtime state
import { AutoSession } from "./auto/session.js";
import {
isDeterministicPolicyError,
isQueuedUserMessageSkip,
isToolInvocationError,
markToolEnd as markTrackedToolEnd,
markToolStart as markTrackedToolStart,
} from "./auto-tool-tracking.js";
export const autoSession = new AutoSession();
export function getAutoRuntimeSnapshot() {
return {
active: autoSession.active,
paused: autoSession.paused,
currentUnit: autoSession.currentUnit
? { ...autoSession.currentUnit }
: null,
basePath: autoSession.basePath,
};
}
export function isAutoActive() {
return autoSession.active;
}
export function isAutoPaused() {
return autoSession.paused;
}
export function markToolStart(toolCallId, toolName) {
markTrackedToolStart(toolCallId, autoSession.active, toolName);
}
export function markToolEnd(toolCallId) {
markTrackedToolEnd(toolCallId);
}
export function recordToolInvocationError(toolName, errorMsg) {
if (!autoSession.active) return;
if (
isToolInvocationError(errorMsg) ||
isQueuedUserMessageSkip(errorMsg) ||
isDeterministicPolicyError(errorMsg)
) {
autoSession.lastToolInvocationError = `${toolName}: ${errorMsg}`;
}
}

View file

@ -1,31 +0,0 @@
// SF worktree session state
let originalCwd = null;
export function getWorktreeOriginalCwd() {
return originalCwd;
}
export function setWorktreeOriginalCwd(cwd) {
originalCwd = cwd;
}
export function clearWorktreeOriginalCwd() {
originalCwd = null;
}
export function ensureWorktreeOriginalCwdFromPath(cwd = process.cwd()) {
if (originalCwd) return originalCwd;
const marker = `${/\\/.test(cwd) ? "\\" : "/"}.sf${/\\/.test(cwd) ? "\\" : "/"}worktrees${/\\/.test(cwd) ? "\\" : "/"}`;
const markerIdx = cwd.indexOf(marker);
if (markerIdx !== -1) {
originalCwd = cwd.slice(0, markerIdx);
}
return originalCwd;
}
export function getActiveWorktreeName() {
if (!originalCwd) return null;
const cwd = process.cwd();
const wtDir =
`${originalCwd.replace(/[\\/]+$/, "")}/.sf/worktrees`.replaceAll("\\", "/");
const normalizedCwd = cwd.replaceAll("\\", "/");
if (!normalizedCwd.startsWith(`${wtDir}/`)) return null;
const rel = normalizedCwd.slice(wtDir.length + 1);
const name = rel.split("/")[0];
return name || null;
}