Compare commits
4
Commits
vivace
...
harpsichord-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2d427691d | ||
|
|
50b862b1fa | ||
|
|
4668cf8ece | ||
|
|
638155de03 |
+53
-20
@@ -85,10 +85,10 @@ export function createStructuredConnection(
|
|||||||
<div class="structured-main">
|
<div class="structured-main">
|
||||||
<div class="structured-scroll">
|
<div class="structured-scroll">
|
||||||
<div class="structured-rows"></div>
|
<div class="structured-rows"></div>
|
||||||
</div>
|
<div class="structured-activity" role="status" aria-live="polite" hidden>
|
||||||
<div class="structured-activity" role="status" aria-live="polite" hidden>
|
<span class="structured-activity-pulse" aria-hidden="true"></span>
|
||||||
<span class="structured-activity-pulse" aria-hidden="true"></span>
|
<span class="structured-activity-text">Thinking</span>
|
||||||
<span class="structured-activity-text">Thinking</span>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form class="structured-composer">
|
<form class="structured-composer">
|
||||||
<button type="button" class="btn btn-ghost btn-icon structured-attach" aria-label="Attach files" title="Attach files (up to 20 MiB each)">
|
<button type="button" class="btn btn-ghost btn-icon structured-attach" aria-label="Attach files" title="Attach files (up to 20 MiB each)">
|
||||||
@@ -486,6 +486,7 @@ export function createStructuredConnection(
|
|||||||
const liveGroupIds = new Set([...groups.keys()]);
|
const liveGroupIds = new Set([...groups.keys()]);
|
||||||
for (const id of expandedGroupIds) if (!liveGroupIds.has(id)) expandedGroupIds.delete(id);
|
for (const id of expandedGroupIds) if (!liveGroupIds.has(id)) expandedGroupIds.delete(id);
|
||||||
|
|
||||||
|
const prevGroupEls = new Map(groupEls);
|
||||||
rowEls.clear();
|
rowEls.clear();
|
||||||
groupEls.clear();
|
groupEls.clear();
|
||||||
const children: HTMLElement[] = [];
|
const children: HTMLElement[] = [];
|
||||||
@@ -504,23 +505,37 @@ export function createStructuredConnection(
|
|||||||
rowEls.set(memberRow.id, memberEl);
|
rowEls.set(memberRow.id, memberEl);
|
||||||
return [memberEl];
|
return [memberEl];
|
||||||
});
|
});
|
||||||
const groupEl = buildToolGroup(
|
|
||||||
groupId,
|
// Reuse existing group element when possible — avoids tearing down
|
||||||
group.rows,
|
// and recreating the wrapper, which restarts CSS transitions (visible
|
||||||
memberEls,
|
// flash) and destroys keyboard/focus state.
|
||||||
expandedGroupIds.has(groupId),
|
const existing = prevGroupEls.get(groupId);
|
||||||
(expanded) => {
|
if (existing) {
|
||||||
if (expanded) expandedGroupIds.add(groupId);
|
const titleEl = existing.querySelector<HTMLElement>(".st-tool-group-title");
|
||||||
else expandedGroupIds.delete(groupId);
|
if (titleEl) titleEl.textContent = `${group.toolCount} tool calls`;
|
||||||
settleDisclosureLayout();
|
const inner = existing.querySelector<HTMLElement>(".st-disclosure-inner");
|
||||||
},
|
if (inner) inner.replaceChildren(...memberEls);
|
||||||
group.toolCount,
|
groupEls.set(groupId, existing);
|
||||||
);
|
children.push(existing);
|
||||||
if (group.rows.some((r) => enteringRowIds.has(r.id))) {
|
} else {
|
||||||
groupEl.classList.add("st-row-enter");
|
const groupEl = buildToolGroup(
|
||||||
|
groupId,
|
||||||
|
group.rows,
|
||||||
|
memberEls,
|
||||||
|
expandedGroupIds.has(groupId),
|
||||||
|
(expanded) => {
|
||||||
|
if (expanded) expandedGroupIds.add(groupId);
|
||||||
|
else expandedGroupIds.delete(groupId);
|
||||||
|
settleDisclosureLayout();
|
||||||
|
},
|
||||||
|
group.toolCount,
|
||||||
|
);
|
||||||
|
if (group.rows.some((r) => enteringRowIds.has(r.id))) {
|
||||||
|
groupEl.classList.add("st-row-enter");
|
||||||
|
}
|
||||||
|
groupEls.set(groupId, groupEl);
|
||||||
|
children.push(groupEl);
|
||||||
}
|
}
|
||||||
groupEls.set(groupId, groupEl);
|
|
||||||
children.push(groupEl);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Resolved approvals not absorbed into a tool group are hidden — the
|
// Resolved approvals not absorbed into a tool group are hidden — the
|
||||||
@@ -635,12 +650,14 @@ export function createStructuredConnection(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let configDirty = false;
|
||||||
function renderConfig(): void {
|
function renderConfig(): void {
|
||||||
const options = sessionConfigOptions();
|
const options = sessionConfigOptions();
|
||||||
configEl.hidden = options.length === 0;
|
configEl.hidden = options.length === 0;
|
||||||
if (options.length === 0) {
|
if (options.length === 0) {
|
||||||
configMenu.hidden = true;
|
configMenu.hidden = true;
|
||||||
configTrigger.setAttribute("aria-expanded", "false");
|
configTrigger.setAttribute("aria-expanded", "false");
|
||||||
|
configDirty = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ordered = [...options].sort((a, b) => {
|
const ordered = [...options].sort((a, b) => {
|
||||||
@@ -654,6 +671,15 @@ export function createStructuredConnection(
|
|||||||
configTrigger.title = summary;
|
configTrigger.title = summary;
|
||||||
configTrigger.setAttribute("aria-label", `Session settings. ${summary.replaceAll("\n", ". ")}`);
|
configTrigger.setAttribute("aria-label", `Session settings. ${summary.replaceAll("\n", ". ")}`);
|
||||||
configTrigger.disabled = configBusy;
|
configTrigger.disabled = configBusy;
|
||||||
|
|
||||||
|
// When the menu is open and the user is interacting (not mid-change),
|
||||||
|
// skip the DOM rebuild so open <select> dropdowns aren't destroyed.
|
||||||
|
// Mark dirty so the next open rebuilds with fresh data.
|
||||||
|
if (!configMenu.hidden && !configBusy) {
|
||||||
|
configDirty = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
configDirty = false;
|
||||||
configMenu.replaceChildren();
|
configMenu.replaceChildren();
|
||||||
for (const option of ordered) {
|
for (const option of ordered) {
|
||||||
const row = document.createElement("label");
|
const row = document.createElement("label");
|
||||||
@@ -717,6 +743,7 @@ export function createStructuredConnection(
|
|||||||
|
|
||||||
function renderActivity(): void {
|
function renderActivity(): void {
|
||||||
const active = state.turn.responding || state.turn.thinking || awaitingBeginGeneration !== null;
|
const active = state.turn.responding || state.turn.thinking || awaitingBeginGeneration !== null;
|
||||||
|
const wasHidden = activityEl.hidden;
|
||||||
activityEl.hidden = !active;
|
activityEl.hidden = !active;
|
||||||
if (!active) {
|
if (!active) {
|
||||||
optimisticTurnStartedAt = null;
|
optimisticTurnStartedAt = null;
|
||||||
@@ -739,6 +766,11 @@ export function createStructuredConnection(
|
|||||||
}
|
}
|
||||||
activityText.textContent = parts.join(" · ");
|
activityText.textContent = parts.join(" · ");
|
||||||
if (activityTimer === null) activityTimer = window.setInterval(renderActivity, 1_000);
|
if (activityTimer === null) activityTimer = window.setInterval(renderActivity, 1_000);
|
||||||
|
// Activity lives inside the scroll area; nudge scroll when it first appears.
|
||||||
|
if (wasHidden && followingBottom) {
|
||||||
|
beginTranscriptLayout(true);
|
||||||
|
finishTranscriptLayout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reconcileAwaitingBegin(): void {
|
function reconcileAwaitingBegin(): void {
|
||||||
@@ -779,6 +811,7 @@ export function createStructuredConnection(
|
|||||||
|
|
||||||
configTrigger.addEventListener("click", () => {
|
configTrigger.addEventListener("click", () => {
|
||||||
const opening = configMenu.hidden;
|
const opening = configMenu.hidden;
|
||||||
|
if (opening && configDirty) renderConfig();
|
||||||
configMenu.hidden = !opening;
|
configMenu.hidden = !opening;
|
||||||
configTrigger.setAttribute("aria-expanded", String(opening));
|
configTrigger.setAttribute("aria-expanded", String(opening));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2318,9 +2318,7 @@ input.leaf-rename:focus {
|
|||||||
gap: var(--sp-2);
|
gap: var(--sp-2);
|
||||||
min-height: 30px;
|
min-height: 30px;
|
||||||
padding: var(--sp-1) var(--sp-3);
|
padding: var(--sp-1) var(--sp-3);
|
||||||
border-top: 1px solid var(--border);
|
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
background: var(--surface-2);
|
|
||||||
font-size: var(--fs-11);
|
font-size: var(--fs-11);
|
||||||
font-variant-numeric: tabular-nums;
|
font-variant-numeric: tabular-nums;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user