Disallow and suppress unsafe assignment (#19736)

This commit is contained in:
Christian Gunderman
2026-02-20 22:28:55 +00:00
committed by GitHub
parent 3e786a161e
commit 981e9a978e
71 changed files with 149 additions and 22 deletions
@@ -27,6 +27,7 @@ export class AcknowledgedAgentsService {
const filePath = Storage.getAcknowledgedAgentsPath();
try {
const content = await fs.readFile(filePath, 'utf-8');
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
this.acknowledgedAgents = JSON.parse(content);
} catch (error: unknown) {
if (!isNodeError(error) || error.code !== 'ENOENT') {
@@ -54,6 +54,7 @@ export async function scheduleAgentTools(
} = options;
// Create a proxy/override of the config to provide the agent-specific tool registry.
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const agentConfig: Config = Object.create(config);
agentConfig.getToolRegistry = () => toolRegistry;
+2 -1
View File
@@ -34,6 +34,7 @@ import {
AgentStartEvent,
AgentFinishEvent,
RecoveryAttemptEvent,
LlmRole,
} from '../telemetry/types.js';
import type {
LocalAgentDefinition,
@@ -59,7 +60,6 @@ import { getVersion } from '../utils/version.js';
import { getToolCallContext } from '../utils/toolCallContext.js';
import { scheduleAgentTools } from './agent-scheduler.js';
import { DeadlineTimer } from '../utils/deadlineTimer.js';
import { LlmRole } from '../telemetry/types.js';
import { formatUserHintsForModel } from '../utils/fastAckHelper.js';
/** A callback function to report on agent activity. */
@@ -925,6 +925,7 @@ export class LocalAgentExecutor<TOutput extends z.ZodTypeAny> {
continue;
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const validatedOutput = validationResult.data;
if (this.definition.processOutput) {
submittedOutput = this.definition.processOutput(validatedOutput);
+1
View File
@@ -394,6 +394,7 @@ export class AgentRegistry {
}
// Use Object.create to preserve lazy getters on the definition object
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const merged: LocalAgentDefinition<TOutput> = Object.create(definition);
if (overrides.runConfig) {