mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 10:03:27 +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
|
|
@ -140,7 +140,7 @@ export class ArtifactsRuntimeProvider implements SandboxRuntimeProvider {
|
|||
return;
|
||||
}
|
||||
|
||||
const { action, filename, content, mimeType } = message;
|
||||
const { action, filename, content } = message;
|
||||
|
||||
try {
|
||||
switch (action) {
|
||||
|
|
|
|||
|
|
@ -40,18 +40,18 @@ export class AttachmentsRuntimeProvider implements SandboxRuntimeProvider {
|
|||
|
||||
(window as any).readTextAttachment = (attachmentId: string) => {
|
||||
const a = ((window as any).attachments || []).find((x: any) => x.id === attachmentId);
|
||||
if (!a) throw new Error("Attachment not found: " + attachmentId);
|
||||
if (!a) throw new Error(`Attachment not found: ${attachmentId}`);
|
||||
if (a.extractedText) return a.extractedText;
|
||||
try {
|
||||
return atob(a.content);
|
||||
} catch {
|
||||
throw new Error("Failed to decode text content for: " + attachmentId);
|
||||
throw new Error(`Failed to decode text content for: ${attachmentId}`);
|
||||
}
|
||||
};
|
||||
|
||||
(window as any).readBinaryAttachment = (attachmentId: string) => {
|
||||
const a = ((window as any).attachments || []).find((x: any) => x.id === attachmentId);
|
||||
if (!a) throw new Error("Attachment not found: " + attachmentId);
|
||||
if (!a) throw new Error(`Attachment not found: ${attachmentId}`);
|
||||
const bin = atob(a.content);
|
||||
const bytes = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
|
||||
|
|
|
|||
|
|
@ -92,8 +92,7 @@ export class ConsoleRuntimeProvider implements SandboxRuntimeProvider {
|
|||
// Error handlers - track errors but don't log them
|
||||
// (they'll be shown via execution-error message)
|
||||
window.addEventListener("error", (e) => {
|
||||
const text =
|
||||
(e.error?.stack || e.message || String(e)) + " at line " + (e.lineno || "?") + ":" + (e.colno || "?");
|
||||
const text = `${e.error?.stack || e.message || String(e)} at line ${e.lineno || "?"}:${e.colno || "?"}`;
|
||||
|
||||
lastError = {
|
||||
message: e.error?.message || e.message || String(e),
|
||||
|
|
@ -102,7 +101,7 @@ export class ConsoleRuntimeProvider implements SandboxRuntimeProvider {
|
|||
});
|
||||
|
||||
window.addEventListener("unhandledrejection", (e) => {
|
||||
const text = "Unhandled promise rejection: " + (e.reason?.message || e.reason || "Unknown error");
|
||||
const text = `Unhandled promise rejection: ${e.reason?.message || e.reason || "Unknown error"}`;
|
||||
|
||||
lastError = {
|
||||
message: e.reason?.message || String(e.reason) || "Unhandled promise rejection",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue