@sidecar-ai/cli 0.1.0-alpha.12 → 0.1.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1430,7 +1430,8 @@ function renderWidgetHtml(title, javascript, css = "") {
1430
1430
  <style>
1431
1431
  :root { color-scheme: light dark; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
1432
1432
  html, body, #root { min-height: 100%; margin: 0; background: transparent; }
1433
- body { color: CanvasText; }
1433
+ html, body { overflow: auto; }
1434
+ body { color: CanvasText; min-width: 0; }
1434
1435
  * { box-sizing: border-box; }
1435
1436
  ${css}
1436
1437
  </style>
@@ -4424,6 +4425,7 @@ function renderDevHarnessHtml(state, options = {}) {
4424
4425
  }
4425
4426
  .message {
4426
4427
  display: grid;
4428
+ flex: 0 0 auto;
4427
4429
  gap: 8px;
4428
4430
  max-width: 100%;
4429
4431
  }
@@ -4515,6 +4517,7 @@ function renderDevHarnessHtml(state, options = {}) {
4515
4517
  background: var(--panel);
4516
4518
  border: 1px solid var(--border);
4517
4519
  border-radius: 14px;
4520
+ flex: 0 0 auto;
4518
4521
  overflow: hidden;
4519
4522
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
4520
4523
  margin: 8px 0;
@@ -4545,16 +4548,28 @@ function renderDevHarnessHtml(state, options = {}) {
4545
4548
  :root[data-sidecar-theme="dark"] .tool-head .status {
4546
4549
  background: rgba(255, 255, 255, 0.05);
4547
4550
  }
4548
- .tool-body { display: grid; gap: 10px; padding: 14px; background: var(--panel); }
4551
+ .tool-body {
4552
+ background: var(--panel);
4553
+ display: grid;
4554
+ gap: 10px;
4555
+ min-width: 0;
4556
+ padding: 14px;
4557
+ }
4549
4558
 
4550
- iframe {
4559
+ .tool-body iframe {
4551
4560
  background: var(--widget-bg);
4552
4561
  border: 1px solid var(--border);
4553
4562
  border-radius: 10px;
4554
- min-height: 380px;
4563
+ display: block;
4564
+ height: clamp(360px, 58dvh, 720px);
4565
+ min-height: 360px;
4566
+ overflow: auto;
4555
4567
  width: 100%;
4556
4568
  }
4557
- :root[data-sidecar-device="mobile"] iframe { min-height: 520px; }
4569
+ :root[data-sidecar-device="mobile"] .tool-body iframe {
4570
+ height: clamp(440px, 70dvh, 680px);
4571
+ min-height: 440px;
4572
+ }
4558
4573
 
4559
4574
  .composer {
4560
4575
  background: var(--bg);
@@ -5477,7 +5492,10 @@ async function streamChat(contentEl) {
5477
5492
  } else if (parsed.event === "tool_start") {
5478
5493
  appendToolStart(parsed.data);
5479
5494
  } else if (parsed.event === "tool_result") {
5480
- appendToolResult(parsed.data);
5495
+ const toolArticle = appendToolResult(parsed.data);
5496
+ if (parsed.data.tool?.resourceUri) {
5497
+ moveAssistantAfterToolUi(contentEl, toolArticle);
5498
+ }
5481
5499
  } else if (parsed.event === "error") {
5482
5500
  throw new Error(parsed.data.message || "Sidecar dev chat failed.");
5483
5501
  }
@@ -5547,6 +5565,17 @@ function renderAssistantError(element, message) {
5547
5565
  return text;
5548
5566
  }
5549
5567
 
5568
+ function moveAssistantAfterToolUi(contentEl, toolArticle) {
5569
+ const assistantArticle = contentEl.closest(".message");
5570
+ if (!assistantArticle || !toolArticle?.parentElement || assistantArticle === toolArticle) {
5571
+ return;
5572
+ }
5573
+ if (toolArticle.nextSibling === assistantArticle) {
5574
+ return;
5575
+ }
5576
+ messagesEl.insertBefore(assistantArticle, toolArticle.nextSibling);
5577
+ }
5578
+
5550
5579
  function appendToolStart(tool) {
5551
5580
  const article = document.createElement("article");
5552
5581
  article.className = "tool-card";
@@ -5554,6 +5583,7 @@ function appendToolStart(tool) {
5554
5583
  article.innerHTML = '<div class="tool-head"><div class="tool-title"></div><div class="status">Running</div></div><div class="tool-body"></div>';
5555
5584
  article.querySelector(".tool-title").textContent = tool.title || tool.name;
5556
5585
  messagesEl.append(article);
5586
+ return article;
5557
5587
  }
5558
5588
 
5559
5589
  function appendToolResult(event) {
@@ -5572,6 +5602,7 @@ function appendToolResult(event) {
5572
5602
  const iframe = document.createElement("iframe");
5573
5603
  iframe.src = "/__sidecar/dev/resource?uri=" + encodeURIComponent(event.tool.resourceUri);
5574
5604
  iframe.title = event.tool.title || event.tool.name;
5605
+ iframe.setAttribute("scrolling", "auto");
5575
5606
  frameContexts.set(iframe.contentWindow, {
5576
5607
  result: event.result,
5577
5608
  tool: event.tool,
@@ -5592,6 +5623,7 @@ function appendToolResult(event) {
5592
5623
  body.append(pre);
5593
5624
  }
5594
5625
  article.scrollIntoView({ block: "end" });
5626
+ return article;
5595
5627
  }
5596
5628
 
5597
5629
  function toolText(result) {