Skip to content

Commit f9db676

Browse files
committed
refactor: remove redundant type casts in agent-session and browser tool
Three redundant 'as boolean' casts on settings.get() return values: - agent-session.ts: settings.get('advisor.enabled') as boolean - browser.ts: settings.get('browser.cmux') as boolean | undefined - browser.ts: settings.get('browser.headless') as boolean SettingValue<P> already resolves to boolean for these paths (they have type: 'boolean' with a non-undefined default in the schema), making the casts unnecessary.
1 parent af2e53e commit f9db676

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/coding-agent/src/session/agent-session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,7 @@ export class AgentSession {
17341734
},
17351735
});
17361736

1737-
this.#advisorEnabled = this.settings.get("advisor.enabled") as boolean;
1737+
this.#advisorEnabled = this.settings.get("advisor.enabled");
17381738
if (this.#advisorEnabled) this.#buildAdvisorRuntime();
17391739

17401740
// Always subscribe to agent events for internal handling

packages/coding-agent/src/tools/browser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ function resolveBrowserKind(params: BrowserParams, session: ToolSession): Browse
8181
return { kind: "spawned", path: exe };
8282
}
8383
const cmuxKind = resolveCmuxKind({
84-
settingEnabled: session.settings.get("browser.cmux") as boolean | undefined,
84+
settingEnabled: session.settings.get("browser.cmux"),
8585
});
8686
if (cmuxKind) {
8787
return cmuxKind;
8888
}
89-
const headless = session.settings.get("browser.headless") as boolean;
89+
const headless = session.settings.get("browser.headless");
9090
return { kind: "headless", headless };
9191
}
9292

0 commit comments

Comments
 (0)