feat(FN-4624): complete Step 0 — preflight worktrunk settings surface

Fusion-Task-Id: FN-4624
Fusion-Task-Lineage: 854e6033-bc17-45be-8d04-18bcb66b31c4
This commit is contained in:
Fusion (runfusion.ai)
2026-05-15 19:39:02 -07:00
committed by gsxdsm
parent 2739259fea
commit 91238e7a08
3 changed files with 24 additions and 2 deletions

View File

@@ -165,6 +165,7 @@ export const DEFAULT_GLOBAL_SETTINGS = {
worktrunk: {
enabled: false,
binaryPath: undefined,
installedBinaryPath: undefined,
onFailure: "fail",
},
experimentalFeatures: {},
@@ -203,6 +204,7 @@ export const DEFAULT_PROJECT_SETTINGS = {
worktrunk: {
enabled: false,
binaryPath: undefined,
installedBinaryPath: undefined,
onFailure: "fail",
},
worktreesDir: undefined,

View File

@@ -1944,6 +1944,9 @@ export interface WorktrunkSettings {
* - "fallback-native": fall back to Fusion's built-in worktree-pool and
* emit a one-shot dashboard alert. */
onFailure?: WorktrunkOnFailure;
/** Cached install path discovered by the auto-install flow.
* Set by Fusion engine; not intended for manual edits. */
installedBinaryPath?: string;
}
export interface GlobalSettings {
@@ -4749,7 +4752,7 @@ export const AGENT_PERMISSION_POLICY_CATEGORY_TOOL_EXAMPLES: Record<
git_write: ["git commit", "git push", "git merge", "git branch -d", "git worktree add", "write", "edit"],
file_write_delete: ["write", "edit", "fn_task_attach"],
command_execution: ["bash (non-git)", "read", "find", "grep", "ls"],
network_api: ["fn_research_run (web/research)", "fn_web_fetch"],
network_api: ["fn_research_run (web/research)", "fn_web_fetch", "worktrunk_install"],
task_agent_mutation: [
"fn_task_create",
"fn_delegate_task",

View File

@@ -6,9 +6,10 @@ const WORKTRUNK_ON_FAILURE_VALUES: readonly WorktrunkOnFailure[] = [
] as const;
export const DEFAULT_WORKTRUNK_SETTINGS: Required<Pick<WorktrunkSettings, "enabled" | "onFailure">> &
Pick<WorktrunkSettings, "binaryPath"> = {
Pick<WorktrunkSettings, "binaryPath" | "installedBinaryPath"> = {
enabled: false,
binaryPath: undefined,
installedBinaryPath: undefined,
onFailure: "fail",
};
@@ -22,12 +23,17 @@ export function resolveWorktrunkSettings(
const enabled = projectValue?.enabled ?? globalValue?.enabled ?? DEFAULT_WORKTRUNK_SETTINGS.enabled;
const binaryPath =
projectValue?.binaryPath ?? globalValue?.binaryPath ?? DEFAULT_WORKTRUNK_SETTINGS.binaryPath;
const installedBinaryPath =
projectValue?.installedBinaryPath ??
globalValue?.installedBinaryPath ??
DEFAULT_WORKTRUNK_SETTINGS.installedBinaryPath;
const onFailure =
projectValue?.onFailure ?? globalValue?.onFailure ?? DEFAULT_WORKTRUNK_SETTINGS.onFailure;
return {
enabled,
...(binaryPath !== undefined ? { binaryPath } : {}),
...(installedBinaryPath !== undefined ? { installedBinaryPath } : {}),
onFailure,
};
}
@@ -70,5 +76,16 @@ export function validateWorktrunkSettings(value: unknown): WorktrunkSettings {
validated.onFailure = input.onFailure as WorktrunkOnFailure;
}
if (input.installedBinaryPath !== undefined) {
if (typeof input.installedBinaryPath !== "string") {
throw new Error("worktrunk.installedBinaryPath must be a string when set");
}
const trimmed = input.installedBinaryPath.trim();
if (trimmed.length === 0) {
throw new Error("worktrunk.installedBinaryPath cannot be empty");
}
validated.installedBinaryPath = trimmed;
}
return validated;
}