Download packages/coding-agent/src/core/settings-diagnostics.ts from SaylorTwift/pi: direct link, hf CLI and curl.
- Browser
- Download file 986 Bytes
-
https://huggingface.co/SaylorTwift/pi/resolve/main/packages/coding-agent/src/core/settings-diagnostics.ts
- Command line
-
hf download hf://SaylorTwift/pi/packages/coding-agent/src/core/settings-diagnostics.ts
-
curl -L -o settings-diagnostics.ts https://huggingface.co/SaylorTwift/pi/resolve/main/packages/coding-agent/src/core/settings-diagnostics.ts
986 Bytes
| import type { AgentSessionRuntimeDiagnostic } from "./agent-session-services.ts"; | |
| import type { SettingsManager } from "./settings-manager.ts"; | |
| export function collectSettingsDiagnostics(settingsManager: SettingsManager): AgentSessionRuntimeDiagnostic[] { | |
| return settingsManager.drainErrors().map(({ scope, path, error }) => ({ | |
| type: "warning", | |
| message: path ? `Invalid settings file ${path}: ${error.message}` : `Invalid ${scope} settings: ${error.message}`, | |
| })); | |
| } | |
| /** | |
| * Remove duplicate type/message diagnostics while preserving their first occurrence. | |
| * Startup and runtime settings managers can report the same file error. | |
| */ | |
| export function deduplicateDiagnostics( | |
| diagnostics: readonly AgentSessionRuntimeDiagnostic[], | |
| ): AgentSessionRuntimeDiagnostic[] { | |
| const seen = new Set<string>(); | |
| return diagnostics.filter((diagnostic) => { | |
| const key = `${diagnostic.type}\0${diagnostic.message}`; | |
| if (seen.has(key)) return false; | |
| seen.add(key); | |
| return true; | |
| }); | |
| } | |