diff --git a/packages/ai/src/agent/agent-loop.ts b/packages/ai/src/agent/agent-loop.ts index d51876f1..876e5e93 100644 --- a/packages/ai/src/agent/agent-loop.ts +++ b/packages/ai/src/agent/agent-loop.ts @@ -61,7 +61,7 @@ export function agentLoop( queuedMessages = []; } - console.log("agent-loop: ", [...currentContext.messages]); + // console.log("agent-loop: ", [...currentContext.messages]); // Stream assistant response const message = await streamAssistantResponse(currentContext, config, signal, stream, streamFn); diff --git a/packages/web-ui/src/components/SandboxedIframe.ts b/packages/web-ui/src/components/SandboxedIframe.ts index fba7b7d8..211570f6 100644 --- a/packages/web-ui/src/components/SandboxedIframe.ts +++ b/packages/web-ui/src/components/SandboxedIframe.ts @@ -25,6 +25,16 @@ export interface SandboxResult { */ export type SandboxUrlProvider = () => string; +/** + * Configuration for prepareHtmlDocument + */ +export interface PrepareHtmlOptions { + /** True if this is an HTML artifact (inject into existing HTML), false if REPL (wrap in HTML) */ + isHtmlArtifact: boolean; + /** True if this is a standalone download (no runtime bridge, no navigation interceptor) */ + isStandalone?: boolean; +} + /** * Escape HTML special sequences in code to prevent premature tag closure * @param code Code that will be injected into `; } } diff --git a/packages/web-ui/src/tools/artifacts/HtmlArtifact.ts b/packages/web-ui/src/tools/artifacts/HtmlArtifact.ts index 3022bac3..81f5370f 100644 --- a/packages/web-ui/src/tools/artifacts/HtmlArtifact.ts +++ b/packages/web-ui/src/tools/artifacts/HtmlArtifact.ts @@ -48,7 +48,10 @@ export class HtmlArtifact extends ArtifactElement { const sandbox = this.sandboxIframeRef.value; const sandboxId = `artifact-${this.filename}`; const downloadContent = - sandbox?.prepareHtmlDocument(sandboxId, this._content, this.runtimeProviders || [], true) || this._content; + sandbox?.prepareHtmlDocument(sandboxId, this._content, this.runtimeProviders || [], { + isHtmlArtifact: true, + isStandalone: true, // Skip runtime bridge and navigation interceptor for standalone downloads + }) || this._content; return html`