Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
0f4f31c
feat(downloads): share decimal sizes and fixed update progress (#577)
andersalm Nov 12, 2026
4a8237c
fix(update): validate the support plan before constructing its future
andersalm Nov 12, 2026
ab2a67d
test(downloads): prove payload totals and narrow Assistant progress
andersalm Nov 12, 2026
9202220
fix(update): call components admission directly
andersalm Nov 12, 2026
7cdf59b
test(assistant): use Home phone form factor for download layout
andersalm Nov 12, 2026
609e58c
test(chat): pin shared decimal size boundaries
andersalm Nov 12, 2026
9b3ca80
test(assistant): retain unknown-size model preparation
andersalm Nov 12, 2026
2a07329
test(update): cover byte fields and manifest-first planning
andersalm Nov 12, 2026
d2a1110
fix(library): clear completed upload announcements
andersalm Nov 12, 2026
2da70b0
test(chat): serve Home shared-file formatter in layout fixture
andersalm Nov 12, 2026
cffba15
test(shared-files): expect decimal kilobytes in Home checks
andersalm Nov 12, 2026
b15211a
fix(system): refresh active download progress each second
andersalm Nov 12, 2026
b676757
test(setup): apply decimal units to download summaries
andersalm Nov 12, 2026
4c069fe
test(setup): show decimal Browser image space estimates
andersalm Nov 12, 2026
0b0ef16
test(downloads): load complete capsule fixtures before capture
andersalm Nov 12, 2026
2225223
fix(chat): keep file names with decimal byte and terabyte labels
andersalm Nov 12, 2026
2c7d235
style(chat): format decimal post-name regression
andersalm Nov 12, 2026
ac4401a
test(downloads): verify the shared dark-theme contract
andersalm Nov 12, 2026
e646c9a
fix(assistant): keep model progress readable on dark surfaces
andersalm Nov 12, 2026
91ebfce
build(chat): regenerate decimal file-size browser artifacts
andersalm Nov 12, 2026
0d6fe4b
test(downloads): capture settled installed capsule states
andersalm Nov 12, 2026
93021d7
test(downloads): use complete DOM and phone capture states
andersalm Nov 12, 2026
5423aa0
test(downloads): confirm workspace saves and settled phone captures
andersalm Nov 12, 2026
9dace03
fix(update): separate unsized metadata from signed payload progress
andersalm Nov 12, 2026
2a590c9
test(update): reproduce round-two path and progress findings
andersalm Nov 12, 2026
a26c6ce
test(downloads): pin round-two size labels and asset versions
andersalm Nov 12, 2026
08ae9ed
fix(update): canonicalize the restarting update plan binary
andersalm Nov 12, 2026
d27142b
fix(update): keep advisory progress steady and coalesce disk writes
andersalm Nov 12, 2026
f7d00c0
fix(downloads): promote rounded units and label unknown sizes
andersalm Nov 12, 2026
dd1c0d9
fix(library): name each file in its upload progress label
andersalm Nov 12, 2026
6d94686
fix(downloads): refresh capsule assets and share Browser size labels
andersalm Nov 12, 2026
730f3b7
test(system): capture the held progress bar during metadata checks
andersalm Nov 12, 2026
e8ce2eb
fix(downloads): refresh vendored model progress dependencies
andersalm Nov 12, 2026
577312d
test(update): initialize progress in the retained-close fixture
andersalm Nov 12, 2026
93891d0
fix(library): keep unknown sizes explicit in file properties
andersalm Nov 12, 2026
a7329d8
fix(library): refresh the properties and list module versions
andersalm Nov 12, 2026
60ddd88
test(update): preserve private modes and Carrier idle bounds in progr…
andersalm Nov 12, 2026
06d7188
fix(update): reserve advisory writes for received body bytes
andersalm Nov 12, 2026
8d5fb41
build(chat): regenerate rounded decimal size browser artifacts
andersalm Nov 12, 2026
df6d9c7
test(update): keep progress until the terminal status is published
andersalm Nov 12, 2026
f3cf1a9
fix(update): retire progress after publishing the terminal phase
andersalm Nov 12, 2026
13be6f2
test(browser): apply shared decimal rounding to disk-space refusal
andersalm Nov 12, 2026
10aee70
fix(system): tidy the Home update card and show release notes (#577)
andersalm Nov 12, 2026
5bb5e83
fix(system): align update publisher and space download progress (#577)
andersalm Nov 12, 2026
773706e
test(update): reproduce round 4 progress and approval notes (#577)
andersalm Nov 13, 2026
b6d9105
fix(update): keep approval and download progress accurate (#577)
andersalm Nov 13, 2026
65b4a8c
Merge origin/develop into feat/577-download-progress
andersalm Nov 13, 2026
88ce105
test(system): bind retained progress to the public update identity (#…
andersalm Nov 13, 2026
d6d7347
fix(system): keep approval heading stable through controller polls (#…
andersalm Nov 13, 2026
c8b46d4
test(downloads): reproduce round-five progress review notes (#577)
andersalm Nov 13, 2026
3ec9889
fix(downloads): derive completion from true bytes and show GB precisi…
andersalm Nov 13, 2026
865a7d7
fix(system): accept an unknown total from the latest update poll (#577)
andersalm Nov 13, 2026
efb0b8e
fix(update): clear orphan progress writes after taking controller lea…
andersalm Nov 13, 2026
4822002
Merge remote-tracking branch 'origin/develop' into feat/577-download-…
andersalm Nov 13, 2026
88693cf
test(downloads): align existing precision and unknown-total assertion…
andersalm Nov 13, 2026
b7e851d
build(chat): ship the GB formatter from the Linux WASM build (#577)
andersalm Nov 13, 2026
86887ce
test(downloads): align Home and model size fixtures with GB precision…
andersalm Nov 13, 2026
24de925
fix(chat): preserve Community file post size format (#577)
andersalm Nov 13, 2026
77050dd
test(setup): isolate empty PATH fixture and align GB labels (#577)
andersalm Nov 13, 2026
2b34afa
test(chat): keep received post size in the develop message units (#577)
andersalm Nov 13, 2026
a2f8756
test(update): pin binary-first refusal and Community preview text (#577)
andersalm Nov 13, 2026
fba09e5
fix(update): verify Runtime before Terminal metadata and all payloads…
andersalm Nov 13, 2026
5c34954
test(setup): require the isolated child to run its exact test (#577)
andersalm Nov 13, 2026
ad39275
fix(chat): preview Community sizes in the post message format (#577)
andersalm Nov 13, 2026
0a2c545
build(chat): bind Community preview assets to their source (#577)
andersalm Nov 13, 2026
5cab6ff
Merge origin/develop into feat/577-download-progress
andersalm Nov 13, 2026
db97538
test(models): align installed journey with download progress label (#…
andersalm Nov 13, 2026
6bd92db
Merge remote-tracking branch 'origin/develop' into feat/577-download-…
andersalm Nov 13, 2026
31754bf
Merge remote-tracking branch 'origin/develop' into feat/577-download-…
andersalm Nov 13, 2026
144cb63
fix(models): keep the download announcement in the Marketplace dialog…
andersalm Nov 14, 2026
7bf5676
test(marketplace): check the model download announcement and its host…
andersalm Nov 14, 2026
21ac5c9
fix(models): open the download live region before its first text (#577)
andersalm Nov 14, 2026
58c3f37
test(marketplace): open the model detail live region empty before its…
andersalm Nov 14, 2026
8f45727
fix(chat): ask to post in Community with one line (#577)
andersalm Nov 14, 2026
6a77f79
build(chat): rebuild the post panel assets from their source (#577)
andersalm Nov 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions capsules/_shared/byte-format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Decimal file sizes. A transfer keeps the unit selected by its total.
const UNITS = ["B", "KB", "MB", "GB", "TB"];
const count = value => Number.isFinite(Number(value)) ? Math.max(0, Number(value)) : 0;
function rank(bytes, rounding = Math.round) {
let unit = 0;
while (unit < UNITS.length - 1 && (unit === 0 ? bytes >= 1000 : rounding(bytes * 10 / 1000 ** unit) >= 10000)) unit++;
return unit;
}
function inUnit(bytes, unit, rounding = Math.round) {
const precision = unit === 3 ? 100 : 10;
return `${unit ? (rounding(bytes * precision / 1000 ** unit) / precision).toFixed(unit === 3 ? 2 : 1) : Math.floor(bytes)} ${UNITS[unit]}`;
}
export function formatBytes(value, rounding = Math.round) {
if (value === null || value === undefined || value === "" || !Number.isFinite(Number(value)) || Number(value) < 0) return "Size unknown";
const bytes = count(value);
return inUnit(bytes, rank(bytes, rounding), rounding);
}
export function formatBytesOf(completed, total) {
const bytes = count(total), unit = rank(bytes);
const done = count(completed), size = inUnit(bytes, unit);
let received = inUnit(Math.min(done, bytes), unit);
// Reserve equal displayed counts for true byte completion at every unit.
if (done !== bytes && received === size) {
const precision = unit === 0 ? 1 : unit === 3 ? 100 : 10;
const step = 1000 ** unit / precision;
received = inUnit(Math.max(0, (Math.round(bytes / step) - 1) * step), unit);
}
return `${received} of ${size}`;
}
34 changes: 21 additions & 13 deletions capsules/_shared/model-management.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { formatBytes } from "./byte-format.js?v=download-progress-20261112";
import { createTransferProgress, announceTransferProgress } from "./transfer-progress.js?v=download-progress-20261112";
/* Shared model presentation. Runtime owns admission, execution and retention. */
(() => {

const CID = /^bafybei[a-z2-7]{52}$/;
const STATES = new Set(["capacity_pending", "reserved", "preparing", "verifying", "admission_pending", "admitted", "reclaimed", "failed", "uncertain", "cancelled", "expired"]);
const active = p => p && ["capacity_pending", "reserved", "preparing", "verifying", "admission_pending", "uncertain"].includes(p.state);
Expand Down Expand Up @@ -115,11 +117,6 @@
}
return entries.length === 1 ? entries[0] : null;
}
function formatBytes(bytes) {
const units = ["B", "KB", "MB", "GB", "TB"];
const rank = bytes ? Math.min(4, Math.floor(Math.log(bytes) / Math.log(1000))) : 0;
return `${(bytes / 1000 ** rank).toLocaleString(undefined, { maximumFractionDigits: rank ? 2 : 0 })} ${units[rank]}`;
}
// Waiting for space names how much this model still needs, so the user knows what to free.
const capacityText = p => p.failure_class === "cache_budget_unavailable"
? "Waiting for room in the local cache budget. Remove an unneeded model or increase the budget and it continues."
Expand All @@ -139,12 +136,15 @@
dispatch_ready: output.dispatch_ready, dispatch_unavailable_reason: output.dispatch_unavailable_reason,
offer_id: output.offer_id, preparation }, cid);
}
window.ElastosModelManagement = {
export const ElastosModelManagement = {
// Compact mode is the Marketplace detail: root is its Status list, so each
// fact is a list row led by a copy of itemMarker; the actions go to
// actionsRoot (the detail footer) and Refresh appears only when a read failed.
// The consumer owns announceRoot: the element that holds the live region
// outside the rows this view replaces, and outside structure it must match.
create({ root, capsule, token, buttonClass = "pc2-btn pc2-btn-secondary", primaryButtonClass = buttonClass,
cid: requiredCid = null, compact = false, onReadyOpen = null, actionsRoot = null, itemMarker = null }) {
cid: requiredCid = null, compact = false, onReadyOpen = null, actionsRoot = null, itemMarker = null,
announceRoot = root.parentElement }) {
let visible = false, closed = false, generation = 0, busy = false, timer, reader;
let selectedCid = requiredCid, choices = [], model = null, methods = new Map(), message = "", loading = false;
let unresolvedUse = null, reconcileRequired = false, refusal = "";
Expand All @@ -158,6 +158,9 @@
// The full view brings its own styles; compact rows use the host's list styles.
if (!compact) root.classList.add("model-management");
root.tabIndex = -1;
// A screen reader reads a live region that already exists when its text
// changes, so this view opens the region empty.
announceTransferProgress(announceRoot, null, null);
const show = () => visible && !closed && !document.hidden;
function stopRead() { clearTimeout(timer); reader?.abort(); reader = null; }
async function request(path, body, signal) {
Expand Down Expand Up @@ -409,11 +412,11 @@
row.append(fact(label));
if (compact) row.append(fact(`Download size: ${formatBytes(model.content_size_bytes)}`, "model-size"));
row.append(fact((compact ? COMPACT_MEMORY_FIT_TEXT : MEMORY_FIT_TEXT)[model.model_memory_fit], "model-memory-fit"));
announceTransferProgress(announceRoot, active(p) ? p.completed_bytes : null, p?.total_bytes, "Model download");
if (active(p)) {
const progress = element("progress"); progress.max = p.total_bytes || 1; progress.value = p.completed_bytes;
progress.setAttribute("aria-label", "Preparation progress");
const done = fact(`${formatBytes(p.completed_bytes)} of ${formatBytes(p.total_bytes)}`);
if (compact) { done.append(progress); row.append(done); } else row.append(progress, done);
const progress = createTransferProgress(p.completed_bytes, p.total_bytes, "Model download progress");
if (compact) { const item = fact(""); item.append(progress); row.append(item); }
else row.append(progress);
}
const controls = actionsRoot || element("div", "", "model-controls");
const useLabel = r.dispatch_unavailable_reason === "catalog_updated" ? "Use"
Expand Down Expand Up @@ -466,12 +469,15 @@
}
function setVisible(value) {
if (visible === value) return;
if (!value) announceTransferProgress(announceRoot, null, null);
visible = value; root.hidden = !value; ++generation; stopRead();
if (show()) void load();
}
const onVisibility = () => { ++generation; stopRead(); if (show()) void load(); };
function destroy() {
closed = true; ++generation; stopRead();
// A live region on a host that outlives this view keeps its last text.
announceTransferProgress(announceRoot, null, null);
document.removeEventListener("visibilitychange", onVisibility);
window.removeEventListener("pagehide", destroy);
}
Expand All @@ -480,4 +486,6 @@
return { setVisible, refresh: load, destroy };
},
};
})();

if (typeof window !== "undefined") window.ElastosModelManagement = ElastosModelManagement;
export { capacityText, parseRuntime, operationRuntime, failureText, catalogEntries, selectCatalogEntry, phaseOf, PHASE_TEXT, COMPACT_PHASE_TEXT, DISPATCH_UNAVAILABLE_TEXT };
18 changes: 11 additions & 7 deletions capsules/_shared/model-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,28 @@ export function catalogModels(catalog) {
typeof facts.admitted !== "boolean" || typeof facts.dispatch_ready !== "boolean" ||
(facts.dispatch_ready ? !facts.admitted || !text(facts.offer_id) : facts.offer_id !== null)) throw new Error("Model catalog unavailable");
return { cid: row.cid, title: row.title, offerId: facts.offer_id, ready: facts.dispatch_ready,
downloadPercent: downloadPercent(facts.preparation) };
downloadPercent: downloadPercent(facts.preparation),
download: downloadProgress(facts.preparation) };
});
}

// Runtime preparation states that are still fetching or checking model files.
const DOWNLOADING_STATES = new Set(["capacity_pending", "reserved", "preparing", "verifying", "admission_pending"]);

// Whole-percent download progress for a running preparation, otherwise null.
function downloadPercent(preparation) {
function downloadProgress(preparation) {
if (!preparation || !DOWNLOADING_STATES.has(preparation.state) || preparation.cancel_requested) return null;
const { completed_bytes: done, total_bytes: total } = preparation;
if (!Number.isSafeInteger(done) || !Number.isSafeInteger(total) || total <= 0) return 0;
return Math.min(100, Math.floor((Math.max(0, done) * 100) / total));
return { completed: preparation.completed_bytes, total: preparation.total_bytes };
}
// Retained for model-choice callers; the shared pattern owns the visible value.
function downloadPercent(preparation) {
const progress = downloadProgress(preparation);
if (!progress) return null;
return progress.total > 0 ? Math.min(100, Math.floor(Math.max(0, progress.completed) * 100 / progress.total)) : null;
}

// The model a running preparation is downloading, for when no model is ready yet.
export function downloadingModel(models) {
return models.find(row => !row.ready && row.downloadPercent !== null) || null;
return models.find(row => !row.ready && row.download !== null) || null;
}

export function selectedModelOffer(offers, offerId, selectedCid, models) {
Expand Down
8 changes: 8 additions & 0 deletions capsules/_shared/transfer-progress.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.transfer-progress { display: grid; gap: 6px; min-width: 0; width: 100%; }
.transfer-progress progress { width: 100%; height: 8px; accent-color: var(--el-accent); }
.transfer-progress span { color: var(--el-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.transfer-progress progress::-webkit-progress-bar { background: var(--el-hairline-strong); border-radius: 4px; }
.transfer-progress progress::-webkit-progress-value { background: var(--el-accent); border-radius: 4px; }
.transfer-progress progress::-moz-progress-bar { background: var(--el-accent); border-radius: 4px; }

.transfer-announcement { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
52 changes: 52 additions & 0 deletions capsules/_shared/transfer-progress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { formatBytes, formatBytesOf } from "./byte-format.js?v=download-progress-20261112";

// Completion comes from the true byte counts, independent of display precision.
function transferPercent(completed, total) {
return completed === total ? 100 : Math.min(99, Math.floor(Math.max(0, completed || 0) * 100 / total));
}

// Native progress supplies keyboard-independent, screen-reader progress semantics.
export function createTransferProgress(completed, total, label = "Download progress", doc = document) {
const root = doc.createElement("div");
root.className = "transfer-progress";
const bar = doc.createElement("progress");
bar.setAttribute("aria-label", label);
const detail = doc.createElement("span");
const known = Number.isFinite(total) && total > 0;
const done = Number.isFinite(completed) ? Math.max(0, completed) : 0;
if (known) {
bar.max = total;
const percent = transferPercent(done, total);
bar.value = percent === 100 ? total : Math.min(done, total);
detail.textContent = `${formatBytesOf(done, total)} · ${percent}%`;
bar.setAttribute("aria-valuetext", detail.textContent);
} else {
detail.textContent = done > 0 ? `${formatBytes(done)} received · Size unknown` : "Size unknown";
bar.setAttribute("aria-valuetext", detail.textContent);
}
root.append(bar, detail);
return root;
}

// Keep this region outside a consumer's replaced rows. Announce five-percent
// milestones; the visible numbers and native bar can update more often.
export function announceTransferProgress(host, completed, total, label = "Download") {
if (!host) return;
let live = host.querySelector(":scope > .transfer-announcement");
if (!live) {
live = host.ownerDocument.createElement("span");
live.className = "transfer-announcement";
live.setAttribute("role", "status");
live.setAttribute("aria-live", "polite");
live.setAttribute("aria-atomic", "true");
host.append(live);
}
const known = Number.isFinite(total) && total > 0;
const percent = known ? transferPercent(completed, total) : null;
const key = completed == null ? "" : `${label}:${total}:${known ? Math.floor(percent / 5) : "unknown"}`;
if (live.dataset.progressKey === key) return;
live.dataset.progressKey = key;
live.textContent = completed == null ? "" : known
? `${label}: ${formatBytesOf(completed, total)}, ${percent}%.`
: `${label} in progress. Total size is unknown.`;
}
9 changes: 1 addition & 8 deletions capsules/archive-manager/browser/archive-manager.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { formatBytes } from "./byte-format.js?v=download-progress-20261112";
import { createHomeNavigationClient } from "/apps/home/home-navigation-client.js";
const params = new URLSearchParams(window.location.search);
const homeToken = new URLSearchParams(window.location.hash.replace(/^#/, "")).get("home_token") || "";
Expand Down Expand Up @@ -634,14 +635,6 @@
return index > "localhost://".length ? clean.slice(0, index) : clean;
}

function formatBytes(value) {
if (value == null || Number.isNaN(Number(value))) return "size unknown";
const bytes = Number(value);
if (bytes < 1024) return `${bytes} B`;
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
}

function escapeHtml(value) {
return String(value || "")
.replace(/&/g, "&amp;")
Expand Down
29 changes: 29 additions & 0 deletions capsules/archive-manager/browser/byte-format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Decimal file sizes. A transfer keeps the unit selected by its total.
const UNITS = ["B", "KB", "MB", "GB", "TB"];
const count = value => Number.isFinite(Number(value)) ? Math.max(0, Number(value)) : 0;
function rank(bytes, rounding = Math.round) {
let unit = 0;
while (unit < UNITS.length - 1 && (unit === 0 ? bytes >= 1000 : rounding(bytes * 10 / 1000 ** unit) >= 10000)) unit++;
return unit;
}
function inUnit(bytes, unit, rounding = Math.round) {
const precision = unit === 3 ? 100 : 10;
return `${unit ? (rounding(bytes * precision / 1000 ** unit) / precision).toFixed(unit === 3 ? 2 : 1) : Math.floor(bytes)} ${UNITS[unit]}`;
}
export function formatBytes(value, rounding = Math.round) {
if (value === null || value === undefined || value === "" || !Number.isFinite(Number(value)) || Number(value) < 0) return "Size unknown";
const bytes = count(value);
return inUnit(bytes, rank(bytes, rounding), rounding);
}
export function formatBytesOf(completed, total) {
const bytes = count(total), unit = rank(bytes);
const done = count(completed), size = inUnit(bytes, unit);
let received = inUnit(Math.min(done, bytes), unit);
// Reserve equal displayed counts for true byte completion at every unit.
if (done !== bytes && received === size) {
const precision = unit === 0 ? 1 : unit === 3 ? 100 : 10;
const step = 1000 ** unit / precision;
received = inUnit(Math.max(0, (Math.round(bytes / step) - 1) * step), unit);
}
return `${received} of ${size}`;
}
2 changes: 1 addition & 1 deletion capsules/archive-manager/browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,6 @@ <h2>Extract</h2>
</section>
</main>

<script type="module" src="./archive-manager.js"></script>
<script type="module" src="./archive-manager.js?v=download-progress-20261112"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions capsules/assistant/browser/agent-harness.css
Original file line number Diff line number Diff line change
Expand Up @@ -3908,3 +3908,5 @@ html[data-agent-reasoning="off"] .agent-thinking {
:root[data-el-form-factor="phone"] :is(.agent-prompt-textarea, .agent-prompt-param input) {
font-size: 16px;
}

.agent-model-download { min-width: 0; margin-top: 4px; padding: 6px 8px; border-radius: 8px; background: var(--el-surface-raised); }
16 changes: 14 additions & 2 deletions capsules/assistant/browser/agent-harness.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createTransferProgress, announceTransferProgress } from "./transfer-progress.js?v=download-progress-20261112";
/* Agent Harness — Home drops, Shelf stays as composer hinge.
UI ≠ authority (Principle 16): never mints grants, never opens Carrier/
capsule ambient paths. Inference is the typed model contract or nothing. */
Expand All @@ -11,7 +12,7 @@ import {
getComposerDraft,
applyComposerDraft,
syncAgentSendButton,
} from "./agent-shelf.js";
} from "./agent-shelf.js?v=download-progress-20261112";
import {
shellState,
desktopObjects,
Expand Down Expand Up @@ -728,14 +729,25 @@ function syncModelTrigger() {
const content = liveContentModels().find(model => model.offerId === offer?.offerId);
const downloading = offer ? null : liveDownloadingModel();
const label = content?.title || offer?.label || liveInference.model ||
(downloading ? `${downloading.title} is downloading (${downloading.downloadPercent}%)` : "No model");
(downloading ? `${downloading.title} is downloading` : "No model");
if (name) {
name.textContent = label;
}
if (tier) {
tier.textContent = "";
tier.hidden = true;
}
announceTransferProgress(btn.parentElement, downloading?.download?.completed ?? null, downloading?.download?.total, "Model download");
const toolbar = btn.closest(".agent-composer-toolbar");
let progress = toolbar?.parentElement.querySelector(".agent-model-download");
if (downloading?.download) {
if (!progress) {
progress = document.createElement("div");
progress.className = "agent-model-download";
toolbar.after(progress);
}
progress.replaceChildren(createTransferProgress(downloading.download.completed, downloading.download.total, "Model download progress"));
} else progress?.remove();
btn.setAttribute("aria-label", offer ? `Model: ${label}` : "Choose a model");
btn.title = offer ? label : "Choose a model";
}
Expand Down
2 changes: 1 addition & 1 deletion capsules/assistant/browser/agent-sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import {
syncAgentSendButton,
composerInput as shelfComposerInput,
} from "./agent-shelf.js";
} from "./agent-shelf.js?v=download-progress-20261112";

/** @type {null | object} */
let ctx = null;
Expand Down
5 changes: 3 additions & 2 deletions capsules/assistant/browser/agent-shelf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { formatBytes } from "./byte-format.js?v=download-progress-20261112";
/* Agent composer — the pill Home's Shelf hands over to.
UI ≠ authority (Principle 16): the composer never mints grants or Carrier
authority. Home GUI owns the Shelf morph and the place; this module owns
Expand Down Expand Up @@ -329,10 +330,10 @@ function renderComposerAttachments() {
: file.kind === "text"
? "Text"
: file.text
? `text · ${Math.max(1, Math.round(String(file.text).length / 1024))} KB`
? `text · ${formatBytes(new TextEncoder().encode(String(file.text)).length)}`
: file.uri
? "desktop · reference"
: `${Math.max(1, Math.round((file.size || 0) / 1024))} KB`;
: `${formatBytes(file.size)}`;
main.querySelector(".agent-attach-chip-meta").textContent = meta;
const remove = document.createElement("button");
remove.type = "button";
Expand Down
2 changes: 1 addition & 1 deletion capsules/assistant/browser/agent-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
unresolvedModelTurn,
} from "./agent-live.js";
import { stampMessageNode, contentHash, newTurnId, createTurnManifest, turnStorePut, turnStorePatch, turnStoreGet, TurnState, cheapTurnSnapshot, resolveReasoningPolicy } from "./agent-context.js";
import { setAgentComposerProcessing } from "./agent-shelf.js";
import { setAgentComposerProcessing } from "./agent-shelf.js?v=download-progress-20261112";
import { renderHarnessPage } from "./agent-configure.js";
import { postToHome, openInboxFromAgent, openModelsFromAgent } from "./harness-host.js";
import {
Expand Down
2 changes: 1 addition & 1 deletion capsules/assistant/browser/assistant-modes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createAssistantApp, eligibleStudioOffers } from "./assistant.js";
import { getAgentWorkspaceSnapshot, setAssistantMode } from "./agent-harness.js";
import { getAgentWorkspaceSnapshot, setAssistantMode } from "./agent-harness.js?v=download-progress-20261112";
import { setAssistantWorkspaceField, getAssistantSession, ensureAssistantStudioSession, setAssistantSessionStudio, captureActiveSessionState, applyAssistantModeDraft } from "./agent-workspace.js";
import { getHomeGuiLaunchToken, persistAgentWorkspaceNow, flushAgentWorkspace, bindWorkspaceMergeGuard } from "./harness-host.js";
import { fetchModelOffers, unresolvedModelTurn } from "./agent-live.js";
Expand Down
Loading
Loading