Skip to content

Commit 44bab37

Browse files
committed
perf: no need to pass env ref
1 parent 8168254 commit 44bab37

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/agents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type AgentName =
1616
| "goose"
1717
| "pi";
1818

19-
type EnvCheck = string | ((env: Record<string, string | undefined>) => boolean);
19+
type EnvCheck = string | (() => boolean);
2020

2121
type InternalAgent = [agentName: AgentName, envChecks: EnvCheck[]];
2222

@@ -48,7 +48,7 @@ const agents: InternalAgent[] = [
4848
];
4949

5050
function envMatcher(envKey: string, regex: RegExp) {
51-
return (env: Record<string, string | undefined>) => {
51+
return () => {
5252
const value = env[envKey];
5353
return value ? regex.test(value) : false;
5454
};
@@ -78,7 +78,7 @@ export function detectAgent(): AgentInfo {
7878
}
7979
for (const [name, checks] of agents) {
8080
for (const check of checks) {
81-
if (typeof check === "string" ? env[check] : check(env)) {
81+
if (typeof check === "string" ? env[check] : check()) {
8282
return { name };
8383
}
8484
}

0 commit comments

Comments
 (0)