Simplify ArtifactsRuntimeProvider constructor

- Take artifactsPanel and agent directly instead of 5 separate function parameters
- Define minimal ArtifactsPanelLike and AgentLike interfaces to avoid circular deps
- Update all call sites (ChatPanel, browser-javascript) to use simplified constructor
- Much cleaner and easier to use
This commit is contained in:
Mario Zechner 2025-10-09 23:37:14 +02:00
parent c0ad46fa01
commit 695bcf9b6f
2 changed files with 35 additions and 45 deletions

View file

@ -112,34 +112,7 @@ export class ChatPanel extends LitElement {
}
// Add artifacts provider (always available)
providers.push(
new ArtifactsRuntimeProvider(
() => this.artifactsPanel!.artifacts,
async (filename: string, content: string) => {
await this.artifactsPanel!.tool.execute("", {
command: "create",
filename,
content,
});
},
async (filename: string, content: string) => {
await this.artifactsPanel!.tool.execute("", {
command: "rewrite",
filename,
content,
});
},
async (filename: string) => {
await this.artifactsPanel!.tool.execute("", {
command: "delete",
filename,
});
},
(message: any) => {
this.agent!.appendMessage(message);
},
),
);
providers.push(new ArtifactsRuntimeProvider(this.artifactsPanel!, this.agent!));
return providers;
};