mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 05:03:26 +00:00
Enable more biome lints and fix things
This commit is contained in:
parent
9c18439c4d
commit
d5fd685901
57 changed files with 151 additions and 199 deletions
|
|
@ -420,7 +420,7 @@ export async function compact(
|
|||
generateTurnPrefixSummary(turnPrefixMessages, model, settings.reserveTokens, apiKey, signal),
|
||||
]);
|
||||
// Merge into single summary
|
||||
summary = historyResult + "\n\n---\n\n**Turn Context (split turn):**\n\n" + turnPrefixResult;
|
||||
summary = `${historyResult}\n\n---\n\n**Turn Context (split turn):**\n\n${turnPrefixResult}`;
|
||||
} else {
|
||||
// Just generate history summary
|
||||
summary = await generateSummary(
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ function escapeHtml(text: string): string {
|
|||
|
||||
function shortenPath(path: string): string {
|
||||
const home = homedir();
|
||||
return path.startsWith(home) ? "~" + path.slice(home.length) : path;
|
||||
return path.startsWith(home) ? `~${path.slice(home.length)}` : path;
|
||||
}
|
||||
|
||||
function replaceTabs(text: string): string {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export function isBashExecutionMessage(msg: AppMessage | Message): msg is BashEx
|
|||
export function bashExecutionToText(msg: BashExecutionMessage): string {
|
||||
let text = `Ran \`${msg.command}\`\n`;
|
||||
if (msg.output) {
|
||||
text += "```\n" + msg.output + "\n```";
|
||||
text += `\`\`\`\n${msg.output}\n\`\`\``;
|
||||
} else {
|
||||
text += "(no output)";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,8 +76,6 @@ const ModelsConfigSchema = Type.Object({
|
|||
});
|
||||
|
||||
type ModelsConfig = Static<typeof ModelsConfigSchema>;
|
||||
type ProviderConfig = Static<typeof ProviderConfigSchema>;
|
||||
type ModelDefinition = Static<typeof ModelDefinitionSchema>;
|
||||
|
||||
// Custom provider API key mappings (provider name -> apiKey config)
|
||||
const customProviderApiKeys: Map<string, string> = new Map();
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ export class SessionManager {
|
|||
private getSessionDirectory(): string {
|
||||
const cwd = process.cwd();
|
||||
// Replace all path separators and colons (for Windows drive letters) with dashes
|
||||
const safePath = "--" + cwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-") + "--";
|
||||
const safePath = `--${cwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
|
||||
|
||||
const configDir = getAgentDir();
|
||||
const sessionDir = join(configDir, "sessions", safePath);
|
||||
|
|
@ -325,9 +325,9 @@ export class SessionManager {
|
|||
|
||||
// Write to file only if enabled
|
||||
if (this.enabled) {
|
||||
appendFileSync(this.sessionFile, JSON.stringify(entry) + "\n");
|
||||
appendFileSync(this.sessionFile, `${JSON.stringify(entry)}\n`);
|
||||
for (const memEntry of this.inMemoryEntries.slice(1)) {
|
||||
appendFileSync(this.sessionFile, JSON.stringify(memEntry) + "\n");
|
||||
appendFileSync(this.sessionFile, `${JSON.stringify(memEntry)}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -346,7 +346,7 @@ export class SessionManager {
|
|||
this.inMemoryEntries.push(entry);
|
||||
// Write to file only if enabled
|
||||
if (this.enabled) {
|
||||
appendFileSync(this.sessionFile, JSON.stringify(entry) + "\n");
|
||||
appendFileSync(this.sessionFile, `${JSON.stringify(entry)}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -365,7 +365,7 @@ export class SessionManager {
|
|||
this.inMemoryEntries.push(entry);
|
||||
// Write to file only if enabled
|
||||
if (this.enabled) {
|
||||
appendFileSync(this.sessionFile, JSON.stringify(entry) + "\n");
|
||||
appendFileSync(this.sessionFile, `${JSON.stringify(entry)}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -385,7 +385,7 @@ export class SessionManager {
|
|||
this.inMemoryEntries.push(entry);
|
||||
// Write to file only if enabled
|
||||
if (this.enabled) {
|
||||
appendFileSync(this.sessionFile, JSON.stringify(entry) + "\n");
|
||||
appendFileSync(this.sessionFile, `${JSON.stringify(entry)}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -395,7 +395,7 @@ export class SessionManager {
|
|||
this.inMemoryEntries.push(entry);
|
||||
// Write to file only if enabled
|
||||
if (this.enabled) {
|
||||
appendFileSync(this.sessionFile, JSON.stringify(entry) + "\n");
|
||||
appendFileSync(this.sessionFile, `${JSON.stringify(entry)}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -625,7 +625,7 @@ export class SessionManager {
|
|||
thinkingLevel: state.thinkingLevel,
|
||||
branchedFrom: this.sessionFile,
|
||||
};
|
||||
appendFileSync(newSessionFile, JSON.stringify(entry) + "\n");
|
||||
appendFileSync(newSessionFile, `${JSON.stringify(entry)}\n`);
|
||||
|
||||
// Write messages up to and including the branch point (if >= 0)
|
||||
if (branchFromIndex >= 0) {
|
||||
|
|
@ -636,7 +636,7 @@ export class SessionManager {
|
|||
timestamp: new Date().toISOString(),
|
||||
message,
|
||||
};
|
||||
appendFileSync(newSessionFile, JSON.stringify(messageEntry) + "\n");
|
||||
appendFileSync(newSessionFile, `${JSON.stringify(messageEntry)}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -675,7 +675,7 @@ export class SessionManager {
|
|||
if (this.enabled) {
|
||||
// Write to file
|
||||
for (const entry of newEntries) {
|
||||
appendFileSync(newSessionFile, JSON.stringify(entry) + "\n");
|
||||
appendFileSync(newSessionFile, `${JSON.stringify(entry)}\n`);
|
||||
}
|
||||
return newSessionFile;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -153,12 +153,12 @@ function loadCommandsFromDir(dir: string, source: "user" | "project", subdir: st
|
|||
content,
|
||||
source: sourceStr,
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (_error) {
|
||||
// Silently skip files that can't be read
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (_error) {
|
||||
// Silently skip directories that can't be read
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ export const grepTool: AgentTool<typeof grepSchema> = {
|
|||
let searchStat: Stats;
|
||||
try {
|
||||
searchStat = statSync(searchPath);
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
settle(() => reject(new Error(`Path not found: ${searchPath}`)));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,6 @@ export const readTool: AgentTool<typeof readSchema> = {
|
|||
details = { truncation };
|
||||
} else if (userLimitedLines !== undefined && startLine + userLimitedLines < allLines.length) {
|
||||
// User specified limit, there's more content, but no truncation
|
||||
const endLineDisplay = startLineDisplay + userLimitedLines - 1;
|
||||
const remaining = allLines.length - (startLine + userLimitedLines);
|
||||
const nextOffset = startLine + userLimitedLines + 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -261,5 +261,5 @@ export function truncateLine(
|
|||
if (line.length <= maxChars) {
|
||||
return { text: line, wasTruncated: false };
|
||||
}
|
||||
return { text: line.slice(0, maxChars) + "... [truncated]", wasTruncated: true };
|
||||
return { text: `${line.slice(0, maxChars)}... [truncated]`, wasTruncated: true };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue