Speed up downloads by combining multiple network connections in parallel
TypeScript bandwidth-aggregationcross-platformdesktop-appdownloaderdownloadmanagerlinuxmacosmulticonnectionparallel-downloadswindows
Split the overloaded "merge" vocabulary into combine vs. assemble
prashantgeekc9ff92755bf3
diff --git a/src/main/download/downloadManager.ts b/src/main/download/downloadManager.tsindex 401b9d1..476fd35 100644--- a/src/main/download/downloadManager.ts+++ b/src/main/download/downloadManager.ts@@ -31,7 +31,7 @@ import { isResourceUnchanged } from './probe'import {createSimSession,downloadChunkSimulated,- getSimMergeSpeed,+ getSimAssembleSpeed,isSimulatedUrl,unregisterSimSession} from './simDownload'@@ -163,8 +163,8 @@ function delay(ms: number, signal: AbortSignal): Promise<void> {})}-/** Plain, unabortable wait — used only to throttle a simulated download's merge step to a- * configured speed (see reassemble()). Merging isn't cancellable, so there's nothing to race. */+/** Plain, unabortable wait — used only to throttle a simulated download's assemble step to a+ * configured speed (see reassemble()). Assembling isn't cancellable, so there's nothing to race. */function sleep(ms: number): Promise<void> {return new Promise((resolve) => setTimeout(resolve, ms))}@@ -271,14 +271,14 @@ export class DownloadManager {const state = persisted.stateconst blocks = state.blocksif (!blocks) return- // 'merging' means every block was already 'completed' and only the reassembly step+ // 'assembling' means every block was already 'completed' and only the reassembly step// was interrupted — resuming re-enters runChunksToCompletion with nothing left to// download, so it goes straight back into reassemble() rather than needing its own// restart path.- if (state.status === 'downloading' || state.status === 'merging') {+ if (state.status === 'downloading' || state.status === 'assembling') {state.status = 'paused'state.pausedAt = persisted.savedAt || Date.now()- state.mergedBytes = 0+ state.assembledBytes = 0}state.speedBytesPerSec = 0for (const chunk of state.chunks) {@@ -341,7 +341,7 @@ export class DownloadManager {/*** Dev-tool entry point: "downloads" a file that's already on disk through the exact same* pipeline a real download uses — chunking, the block grid, pause/resume, retries, the- * merging phase, reassembly — so every feature can be exercised on demand instead of needing+ * assembling phase, reassembly — so every feature can be exercised on demand instead of needing* a real multi-network setup and a slow, flaky remote server to provoke retries and errors.* Only `chunkDownloader`'s HTTP transfer is swapped out (see simDownload.ts); everything else* in DownloadManager is unaware this isn't a real network transfer.@@ -355,7 +355,7 @@ export class DownloadManager {const { url, interfaces, totalBytes } = await createSimSession(payload.sourceFilePath,payload.networks,- payload.mergeSpeedBytesPerSec || null+ payload.assembleSpeedBytesPerSec || null)const requestPayload: StartDownloadRequest = {@@ -699,8 +699,8 @@ export class DownloadManager {return}- runtime.state.status = 'merging'- runtime.state.mergedBytes = 0+ runtime.state.status = 'assembling'+ runtime.state.assembledBytes = 0runtime.state.speedBytesPerSec = 0this.pushUpdate(runtime)@@ -947,10 +947,10 @@ export class DownloadManager {const output = createWriteStream(runtime.state.destinationPath)let bytesWritten = 0- // Set only for a dev-tool simulated download that asked for a slowed-down merge — real+ // Set only for a dev-tool simulated download that asked for a slowed-down assemble — real// downloads always reassemble at full disk speed. Throttling here (rather than faking it in- // the renderer) exercises the exact same mergedBytes/IPC path a real merge uses.- const mergeSpeedBytesPerSec = getSimMergeSpeed(runtime.requestPayload.url)+ // the renderer) exercises the exact same assembledBytes/IPC path a real assemble uses.+ const assembleSpeedBytesPerSec = getSimAssembleSpeed(runtime.requestPayload.url)// Attached before the first write, and kept for the stream's whole life:// destroying the output after a failed check can surface an in-flight@@ -976,13 +976,14 @@ export class DownloadManager {if (outputErrors.length > 0) throw outputErrors[0]bytesWritten += actualBytes- if (mergeSpeedBytesPerSec) {- await sleep(Math.max(1, (actualBytes / mergeSpeedBytesPerSec) * 1000))+ if (assembleSpeedBytesPerSec) {+ await sleep(Math.max(1, (actualBytes / assembleSpeedBytesPerSec) * 1000))}- // Reported per part rather than per underlying write so the merge visualization advances- // in the same units the block grid already shows — one step per chunk, not a byte stream.- runtime.state.mergedBytes = bytesWritten+ // Reported per part rather than per underlying write so the assembling visualization+ // advances in the same units the block grid already shows — one step per chunk, not a+ // byte stream.+ runtime.state.assembledBytes = bytesWrittenthis.scheduleUpdate(runtime)}diff --git a/src/main/download/simDownload.ts b/src/main/download/simDownload.tsindex 32630bd..60ef6b1 100644--- a/src/main/download/simDownload.ts+++ b/src/main/download/simDownload.ts@@ -18,22 +18,22 @@ interface SimSession {sourcePath: string/** Keyed by the synthetic NetworkInterfaceInfo.id assigned to each simulated network. */networks: Map<string, SimulatedNetworkConfig>- /** bytes/sec to throttle reassembly to, or null to merge at full disk speed. */- mergeSpeedBytesPerSec: number | null+ /** bytes/sec to throttle reassembly to, or null to assemble at full disk speed. */+ assembleSpeedBytesPerSec: number | null}const sessions = new Map<string, SimSession>()/** Registers one dev-tool "virtual download" run and returns the `plexo-sim://<token>` url to* use as its `StartDownloadRequest.url` — everything downstream (blocks, chunks, persistence,- * the merging phase) is unaware this isn't a real network transfer. */+ * the assembling phase) is unaware this isn't a real network transfer. */function registerSimSession(sourcePath: string,networks: Map<string, SimulatedNetworkConfig>,- mergeSpeedBytesPerSec: number | null+ assembleSpeedBytesPerSec: number | null): string {const token = randomUUID()- sessions.set(token, { sourcePath, networks, mergeSpeedBytesPerSec })+ sessions.set(token, { sourcePath, networks, assembleSpeedBytesPerSec })return token}@@ -43,11 +43,11 @@ export function unregisterSimSession(url: string): void {}/** How slowly `DownloadManager.reassemble()` should stitch this simulated download's part- * files together, or null when it isn't simulated (or wasn't given a merge speed) and should- * run at full disk speed as usual. */-export function getSimMergeSpeed(url: string): number | null {+ * files together, or null when it isn't simulated (or wasn't given an assemble speed) and+ * should run at full disk speed as usual. */+export function getSimAssembleSpeed(url: string): number | null {if (!isSimulatedUrl(url)) return null- return sessions.get(url.slice(SIM_URL_PREFIX.length))?.mergeSpeedBytesPerSec ?? null+ return sessions.get(url.slice(SIM_URL_PREFIX.length))?.assembleSpeedBytesPerSec ?? null}/** Builds the synthetic interfaces + registers the sim session a `StartDownloadRequest` needs@@ -55,7 +55,7 @@ export function getSimMergeSpeed(url: string): number | null {export async function createSimSession(sourceFilePath: string,networkConfigs: SimulatedNetworkConfig[],- mergeSpeedBytesPerSec: number | null+ assembleSpeedBytesPerSec: number | null): Promise<{ url: string; interfaces: NetworkInterfaceInfo[]; totalBytes: number }> {const fileStat = await stat(sourceFilePath)const networks = new Map<string, SimulatedNetworkConfig>()@@ -71,7 +71,7 @@ export async function createSimSession(}})- const token = registerSimSession(sourceFilePath, networks, mergeSpeedBytesPerSec)+ const token = registerSimSession(sourceFilePath, networks, assembleSpeedBytesPerSec)return { url: `${SIM_URL_PREFIX}${token}`, interfaces, totalBytes: fileStat.size }}diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex 58d685b..0e22017 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -50,7 +50,7 @@ function App(): React.JSX.Element {if (currentDownload.status === 'downloading') {screen = <DownloadingScreen download={currentDownload} />titleBarStatus = {- kind: 'merged',+ kind: 'combined',networkCount: groupChunksByInterface(currentDownload.chunks).length}} else if (currentDownload.status === 'paused') {@@ -59,9 +59,9 @@ function App(): React.JSX.Element {kind: 'paused',networkCount: groupChunksByInterface(currentDownload.chunks).length}- } else if (currentDownload.status === 'merging') {+ } else if (currentDownload.status === 'assembling') {screen = <DownloadingScreen download={currentDownload} />- titleBarStatus = { kind: 'merging' }+ titleBarStatus = { kind: 'assembling' }} else if (currentDownload.status === 'completed') {screen = <CompleteScreen download={currentDownload} onNewDownload={handleNewDownload} />} else {diff --git a/src/renderer/src/components/BlockGrid.tsx b/src/renderer/src/components/BlockGrid.tsxindex e19e18e..1b038b8 100644--- a/src/renderer/src/components/BlockGrid.tsx+++ b/src/renderer/src/components/BlockGrid.tsx@@ -35,11 +35,11 @@ const GRID_INSET_PX = 3const UNATTRIBUTED_SOLID = 'var(--text-tertiary)'const UNATTRIBUTED_BG = 'var(--track-bg)'-// Merged bytes are deliberately not painted in any network's color: once a chunk is stitched+// Assembled bytes are deliberately not painted in any network's color: once a chunk is stitched// onto disk it isn't "that network's work" anymore so much as "already part of the file", and a// dedicated neutral tone is what makes the sweep across the grid read as progress rather than as// chunks quietly losing their color for no reason.-const MERGED_SOLID = 'var(--text)'+const ASSEMBLED_SOLID = 'var(--text)'/** One network's share of a cell's downloaded bytes. */interface CellSegment {@@ -154,10 +154,10 @@ interface BlockGridProps {* network fetched each chunk to showing reassembly progress instead: a wipe, in the same* part-file order `reassemble()` actually writes in, that fades a square once its bytes are* safely on disk and pulses whichever one is being appended right now. Without this the grid- * would freeze solid the moment the last byte downloads, and a merge on a large file can take+ * would freeze solid the moment the last byte downloads, and assembling a large file can take* long enough that a frozen grid reads as hung rather than finishing up. */- merging?: boolean- mergedBytes?: number+ assembling?: boolean+ assembledBytes?: number}export function BlockGrid({@@ -167,8 +167,8 @@ export function BlockGrid({knownSize,remainingBytes,isPaused = false,- merging = false,- mergedBytes = 0+ assembling = false,+ assembledBytes = 0}: BlockGridProps): React.JSX.Element {const [gridWidth, setGridWidth] = useState(0)const [hoveredIndex, setHoveredIndex] = useState<number | null>(null)@@ -214,9 +214,9 @@ export function BlockGrid({// appears on an active block — and a tooltip advertises nothing to hover in the first place.const hoveredCell = hoveredIndex !== null ? cells[hoveredIndex] : undefinedlet readout: string- if (merging) {+ if (assembling) {const totalBytes = cells.reduce((sum, cell) => sum + cell.totalBytes, 0)- readout = `Merging into file · ${formatBytes(mergedBytes)} / ${formatBytes(totalBytes)}`+ readout = `Assembling into file · ${formatBytes(assembledBytes)} / ${formatBytes(totalBytes)}`} else if (hoveredCell) {const where =describeContributors(hoveredCell, visualByInterfaceId) ??@@ -228,9 +228,9 @@ export function BlockGrid({}// Cumulative byte offset per cell, in the exact order reassemble() appends part files —- // computed once here rather than per-cell so each square's merge state is a simple- // range comparison against `mergedBytes` below.- const mergeOffsets = cells.reduce<{ offsets: number[]; total: number }>(+ // computed once here rather than per-cell so each square's assembly state is a simple+ // range comparison against `assembledBytes` below.+ const assembleOffsets = cells.reduce<{ offsets: number[]; total: number }>((acc, cell) => {acc.offsets.push(acc.total)acc.total += cell.totalBytes@@ -285,7 +285,7 @@ export function BlockGrid({</div>)})}- {merging && (+ {assembling && (<divstyle={{display: 'flex',@@ -300,11 +300,11 @@ export function BlockGrid({width: 7,height: 7,borderRadius: '50%',- background: MERGED_SOLID,+ background: ASSEMBLED_SOLID,flexShrink: 0}}/>- <span style={{ color: 'var(--text)', fontWeight: 600 }}>Merged</span>+ <span style={{ color: 'var(--text)', fontWeight: 600 }}>Assembled</span></div>)}{cells.length > 0 && chunkBytes > 0 && (@@ -375,28 +375,28 @@ export function BlockGrid({}let animation: string | undefined- if (merging) {- const start = mergeOffsets[index]+ if (assembling) {+ const start = assembleOffsets[index]const end = start + cell.totalBytes- if (end <= mergedBytes) {+ if (end <= assembledBytes) {// Already appended to the destination file — turns neutral rather than just- // fading, so "merged" is a distinct state you can read at a glance, not a+ // fading, so "assembled" is a distinct state you can read at a glance, not a// guess at how dim is dim enough.- fillColor = MERGED_SOLID+ fillColor = ASSEMBLED_SOLIDborder = 'none'boxShadow = 'none'opacity = 0.85- } else if (start < mergedBytes) {+ } else if (start < assembledBytes) {// The one part file being streamed onto disk right now — turning neutral too,// with a pulse so the "write head" position is obvious.- fillColor = MERGED_SOLID- border = `1px solid ${MERGED_SOLID}`- boxShadow = `0 0 7px ${MERGED_SOLID}`+ fillColor = ASSEMBLED_SOLID+ border = `1px solid ${ASSEMBLED_SOLID}`+ boxShadow = `0 0 7px ${ASSEMBLED_SOLID}`opacity = 1animation = 'plexo-glow 0.9s ease-in-out infinite'} else {// Completed but not yet its turn to be appended — stays in its network's color- // a little dimmed, to signal "waiting its turn" rather than "already merged".+ // a little dimmed, to signal "waiting its turn" rather than "already assembled".border = 'none'boxShadow = 'none'opacity = 0.75@@ -408,11 +408,11 @@ export function BlockGrid({(cell.interfaceId ? 'Assigned' : 'Pending')// Numbered to match the "Chunk #N" badges the streams table shows for each active// connection, so a hovered square maps onto a specific stream's work.- const title = merging+ const title = assembling? `Chunk #${cell.chunkNumber} · ${- mergeOffsets[index] + cell.totalBytes <= mergedBytes+ assembleOffsets[index] + cell.totalBytes <= assembledBytes? 'written to file'- : mergeOffsets[index] < mergedBytes+ : assembleOffsets[index] < assembledBytes? 'writing to file…': 'queued to write'}`diff --git a/src/renderer/src/components/MergeDiagram.tsx b/src/renderer/src/components/CombineDiagram.tsxsimilarity index 74%rename from src/renderer/src/components/MergeDiagram.tsxrename to src/renderer/src/components/CombineDiagram.tsxindex 9b3c0a5..40b76ab 100644--- a/src/renderer/src/components/MergeDiagram.tsx+++ b/src/renderer/src/components/CombineDiagram.tsx@@ -5,32 +5,32 @@ const ROW_HEIGHT = 36const LABEL_X = 68const DOT_X = 76const CURVE_START_X = 82-const MERGE_X = 146+const COMBINE_X = 146const STREAM_END_X = 188const WIDTH = 196-export interface MergeDiagramNetwork {+export interface CombineDiagramNetwork {solid: stringlabel: stringspeedBytesPerSec?: number}-/** Draws the bonded-links-into-one-stream diagram: individual networks with their- * real-time speed on the left, converging into a single merged stream pointing+/** Draws the multiple-links-into-one-stream diagram: individual networks with their+ * real-time speed on the left, converging into a single combined stream pointing* directly to the final total speed on the right. */-export function MergeDiagram({+export function CombineDiagram({networks,muted = false,paused = false,- merging = false+ assembling = false}: {- networks: MergeDiagramNetwork[]+ networks: CombineDiagramNetwork[]muted?: booleanpaused?: boolean/** The part files are all complete and being stitched into the destination — the individual- * network feeds have nothing left to send, so their dashed lines stop while the merged stream- * pulses to show the reassembly step is still actively running rather than stalled. */- merging?: boolean+ * network feeds have nothing left to send, so their dashed lines stop while the combined+ * stream pulses to show the reassembly step is still actively running rather than stalled. */+ assembling?: boolean}): React.JSX.Element {const height = Math.max(78, networks.length * ROW_HEIGHT + 10)const midY = height / 2@@ -47,15 +47,15 @@ export function MergeDiagram({return (<pathkey={network.label + index}- d={`M${CURVE_START_X},${y.toFixed(1)} C${CURVE_START_X + 36},${y.toFixed(1)} ${MERGE_X - 26},${midY.toFixed(1)} ${MERGE_X},${midY.toFixed(1)}`}+ d={`M${CURVE_START_X},${y.toFixed(1)} C${CURVE_START_X + 36},${y.toFixed(1)} ${COMBINE_X - 26},${midY.toFixed(1)} ${COMBINE_X},${midY.toFixed(1)}`}stroke={color}strokeDasharray="6 8"- // Merging means the network feeds themselves are done — nothing left in flight on- // these lines — so they go still like a paused download rather than pretending to- // still be streaming.- opacity={paused || merging ? 0.55 : 1}+ // Assembling means the network feeds themselves are done — nothing left in flight+ // on these lines — so they go still like a paused download rather than pretending+ // to still be streaming.+ opacity={paused || assembling ? 0.55 : 1}style={- muted || paused || merging+ muted || paused || assembling? undefined: { animation: `plexo-dash ${1.1 + index * 0.2}s linear infinite` }}@@ -63,13 +63,13 @@ export function MergeDiagram({)})}<path- d={`M${MERGE_X},${midY} L${STREAM_END_X},${midY}`}+ d={`M${COMBINE_X},${midY} L${STREAM_END_X},${midY}`}stroke={muted ? 'var(--icon-muted)' : paused ? 'var(--text-secondary)' : 'var(--node-accent)'}strokeWidth={6.5}opacity={paused ? 0.6 : 1}- style={merging ? { animation: 'plexo-glow 1s ease-in-out infinite' } : undefined}+ style={assembling ? { animation: 'plexo-glow 1s ease-in-out infinite' } : undefined}/></g><polygon@@ -78,7 +78,7 @@ export function MergeDiagram({opacity={paused ? 0.6 : 1}/><circle- cx={MERGE_X}+ cx={COMBINE_X}cy={midY}r={9.5}fill="none"@@ -88,7 +88,7 @@ export function MergeDiagram({strokeDasharray={muted ? '3 4' : undefined}/><circle- cx={MERGE_X}+ cx={COMBINE_X}cy={midY}r={3.5}fill={muted ? 'var(--icon-muted)' : 'var(--node-accent)'}@@ -142,14 +142,18 @@ export function MergeDiagram({y={midY - 11}textAnchor="end"fill={- paused ? 'var(--color-usb)' : merging ? 'var(--color-ethernet)' : 'var(--text-tertiary)'+ paused+ ? 'var(--color-usb)'+ : assembling+ ? 'var(--color-ethernet)'+ : 'var(--text-tertiary)'}style={{- font: `${paused || merging ? '600' : '500'} 8.5px ${FONT_MONO}`,+ font: `${paused || assembling ? '600' : '500'} 8.5px ${FONT_MONO}`,letterSpacing: '0.12em'}}>- {paused ? 'PAUSED' : merging ? 'WRITING…' : 'MERGED'}+ {paused ? 'PAUSED' : assembling ? 'ASSEMBLING…' : 'COMBINED'}</text>)}</svg>diff --git a/src/renderer/src/components/DevToolsPanel.tsx b/src/renderer/src/components/DevToolsPanel.tsxindex 50f3e32..54a8a20 100644--- a/src/renderer/src/components/DevToolsPanel.tsx+++ b/src/renderer/src/components/DevToolsPanel.tsx@@ -17,7 +17,7 @@ const PRESET_CONNECTIONS = [1, 2, 4, 8] as constconst MAX_SIM_NETWORKS = 4const MBPS_TO_BYTES_PER_SEC = (1024 * 1024) / 8const MB_TO_BYTES_PER_SEC = 1024 * 1024-const DEFAULT_MERGE_SPEED_MBPS = 6+const DEFAULT_ASSEMBLE_SPEED_MBPS = 6interface SimNetworkDraft {key: number@@ -54,7 +54,7 @@ const rowInputStyle: React.CSSProperties = {/*** Dev-only panel that exercises the whole download pipeline against a file already on disk —- * chunking across fake networks, the block grid, retries/errors, pause/resume, merging,+ * chunking across fake networks, the block grid, retries/errors, pause/resume, assembling,* completion — without needing a real multi-network setup or a slow, flaky server to provoke* the states that are otherwise hard to reproduce on demand. Only rendered when* `useAppStore.isDev` is true (see App.tsx), so it never reaches a packaged build's UI.@@ -69,8 +69,8 @@ export function DevToolsPanel(): React.JSX.Element | null {const [destinationDir, setDestinationDir] = useState('')const [networks, setNetworks] = useState<SimNetworkDraft[]>(DEFAULT_NETWORKS)const [connectionsPerNetwork, setConnectionsPerNetwork] = useState(2)- const [slowMerge, setSlowMerge] = useState(true)- const [mergeSpeedMBps, setMergeSpeedMBps] = useState(DEFAULT_MERGE_SPEED_MBPS)+ const [slowAssemble, setSlowAssemble] = useState(true)+ const [assembleSpeedMBps, setAssembleSpeedMBps] = useState(DEFAULT_ASSEMBLE_SPEED_MBPS)const [starting, setStarting] = useState(false)const [error, setError] = useState<string | null>(null)@@ -123,8 +123,8 @@ export function DevToolsPanel(): React.JSX.Element | null {networks: simulatedNetworks,chunkCount: networks.length * connectionsPerNetwork,connectionsPerNetwork,- mergeSpeedBytesPerSec: slowMerge- ? Math.max(1, Math.round(mergeSpeedMBps * MB_TO_BYTES_PER_SEC))+ assembleSpeedBytesPerSec: slowAssemble+ ? Math.max(1, Math.round(assembleSpeedMBps * MB_TO_BYTES_PER_SEC)): undefined})setOpen(false)@@ -217,8 +217,8 @@ export function DevToolsPanel(): React.JSX.Element | null {</div><div style={{ font: `11.5px/1.4 ${FONT_UI}`, color: 'var(--text-tertiary)' }}>Pick a file already on disk to "download" it through the real pipeline —- chunking, the block grid, pause/resume, retries, merging — against fake networks you- control.+ chunking, the block grid, pause/resume, retries, assembling — against fake networks+ you control.</div><div style={{ display: 'flex', flexDirection: 'column', gap: 5 }}>@@ -457,17 +457,17 @@ export function DevToolsPanel(): React.JSX.Element | null {><inputtype="checkbox"- checked={slowMerge}- onChange={(event) => setSlowMerge(event.target.checked)}+ checked={slowAssemble}+ onChange={(event) => setSlowAssemble(event.target.checked)}/>- Simulate the merging step+ Simulate the assembling step</label><div style={{ font: `10.5px/1.4 ${FONT_UI}`, color: 'var(--text-tertiary)' }}>Reassembly normally finishes in a blink — this throttles it so the- "merging" screen (the block grid sweep, the pulsing merge line) stays on- screen long enough to actually watch.+ "assembling" screen (the block grid sweep, the pulsing combine line) stays+ on screen long enough to actually watch.</div>- {slowMerge && (+ {slowAssemble && (<labelstyle={{display: 'flex',@@ -477,13 +477,13 @@ export function DevToolsPanel(): React.JSX.Element | null {color: 'var(--text-tertiary)'}}>- Merge speed+ Assemble speed<inputtype="number"min={1}max={500}- value={mergeSpeedMBps}- onChange={(event) => setMergeSpeedMBps(Number(event.target.value) || 1)}+ value={assembleSpeedMBps}+ onChange={(event) => setAssembleSpeedMBps(Number(event.target.value) || 1)}style={{ ...rowInputStyle, width: 56 }}/>MB/sdiff --git a/src/renderer/src/components/TitleBar.tsx b/src/renderer/src/components/TitleBar.tsxindex cd7bf1b..00ae6f9 100644--- a/src/renderer/src/components/TitleBar.tsx+++ b/src/renderer/src/components/TitleBar.tsx@@ -3,8 +3,8 @@ import { ThemeToggle } from './ThemeToggle'export type TitleBarStatus =| { kind: 'none' }- | { kind: 'merged'; networkCount: number }- | { kind: 'merging' }+ | { kind: 'combined'; networkCount: number }+ | { kind: 'assembling' }| { kind: 'paused'; networkCount: number }| { kind: 'offline' }@@ -40,7 +40,7 @@ export function TitleBar({ status }: { status: TitleBarStatus }): React.JSX.ElemPlexo</div><div style={{ flex: 1 }} />- {status.kind === 'merged' && (+ {status.kind === 'combined' && (<div style={pillStyle('positive')}><divstyle={{@@ -51,11 +51,11 @@ export function TitleBar({ status }: { status: TitleBarStatus }): React.JSX.Elemanimation: 'plexo-glow 2s ease-in-out infinite'}}/>- {status.networkCount} {status.networkCount === 1 ? 'network' : 'networks'} merged+ {status.networkCount} {status.networkCount === 1 ? 'network' : 'networks'} combined</div>)}- {status.kind === 'merging' && (- <div style={pillStyle('merging')}>+ {status.kind === 'assembling' && (+ <div style={pillStyle('assembling')}><divstyle={{width: 6,@@ -65,7 +65,7 @@ export function TitleBar({ status }: { status: TitleBarStatus }): React.JSX.Elemanimation: 'plexo-glow 1s ease-in-out infinite'}}/>- Merging chunks…+ Assembling file…</div>)}{status.kind === 'paused' && (diff --git a/src/renderer/src/screens/DownloadingScreen.tsx b/src/renderer/src/screens/DownloadingScreen.tsxindex 2ce6d84..1f1fcd7 100644--- a/src/renderer/src/screens/DownloadingScreen.tsx+++ b/src/renderer/src/screens/DownloadingScreen.tsx@@ -1,7 +1,7 @@import type { DownloadState } from '@shared/types'import { useEffect, useState } from 'react'import { BlockGrid } from '../components/BlockGrid'-import { MergeDiagram } from '../components/MergeDiagram'+import { CombineDiagram } from '../components/CombineDiagram'import { NetworkRow } from '../components/NetworkRow'import { ThroughputChart } from '../components/ThroughputChart'import { useNetworkPolling } from '../hooks/useNetworkPolling'@@ -34,7 +34,7 @@ import {// The hero band is always this exact dark panel from the design, regardless of the app's own// light/dark theme — scoping the theme variables it reads (--text, --border, ...) to these-// literal values keeps its own children (labels, the merge diagram, the chart) legible no+// literal values keeps its own children (labels, the combine diagram, the chart) legible no// matter which OS appearance the rest of the window is following.const heroScopeStyle: React.CSSProperties = {padding: '18px 20px',@@ -52,9 +52,9 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Reconst peakSpeedBytesPerSec = useAppStore((store) => store.peakSpeedBytesPerSec)const networkPreferences = useAppStore((store) => store.networkPreferences)const isPaused = download.status === 'paused'- const isMerging = download.status === 'merging'+ const isAssembling = download.status === 'assembling'const percent = formatPercent(download.bytesDownloaded, download.totalBytes)- const mergePercent = formatPercent(download.mergedBytes ?? 0, download.totalBytes)+ const assemblePercent = formatPercent(download.assembledBytes ?? 0, download.totalBytes)const knownSize = download.totalBytes > 0const [now, setNow] = useState(() => Date.now())@@ -65,8 +65,8 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re}, [isPaused])useEffect(() => {- if (isMerging) {- document.title = `Plexo — Merging (${mergePercent}%)`+ if (isAssembling) {+ document.title = `Plexo — Assembling (${assemblePercent}%)`} else if (isPaused) {document.title = knownSize ? `Plexo — Paused (${percent}%)` : 'Plexo — Paused'} else {@@ -75,7 +75,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Rereturn () => {document.title = 'Plexo'}- }, [percent, mergePercent, knownSize, isPaused, isMerging])+ }, [percent, assemblePercent, knownSize, isPaused, isAssembling])const totalPausedMs =(download.totalPausedMs || 0) +@@ -174,14 +174,14 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re><div style={heroScopeStyle}><div style={{ display: 'flex', alignItems: 'center', gap: 14 }}>- <MergeDiagram+ <CombineDiagramnetworks={groups.map((group, index) => ({solid: visuals[index].solid,label: visuals[index].name,- speedBytesPerSec: isPaused || isMerging ? 0 : group.speedBytesPerSec+ speedBytesPerSec: isPaused || isAssembling ? 0 : group.speedBytesPerSec}))}paused={isPaused}- merging={isMerging}+ assembling={isAssembling}/><div@@ -193,7 +193,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): ReflexShrink: 0}}>- {isMerging ? (+ {isAssembling ? (<><divstyle={{@@ -202,7 +202,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Recolor: 'var(--text-tertiary)'}}>- MERGING+ ASSEMBLING</div><div style={{ display: 'flex', alignItems: 'baseline', gap: 7 }}><div@@ -213,7 +213,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): RefontVariantNumeric: 'tabular-nums'}}>- {mergePercent}+ {assemblePercent}</div><div style={{ font: `500 12px/1 ${FONT_MONO}`, color: 'var(--text-tertiary)' }}>%@@ -226,7 +226,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): RemarginTop: 2}}>- Writing chunks to disk — almost done+ Assembling the final file — almost done</div></>) : (@@ -343,7 +343,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Restyle={{flex: 1,minWidth: 0,- opacity: isPaused || isMerging ? 0.45 : 1,+ opacity: isPaused || isAssembling ? 0.45 : 1,transition: 'opacity 0.2s'}}>@@ -355,7 +355,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re}}>THROUGHPUT ·{' '}- {isMerging ? 'MERGING' : isPaused ? 'PAUSED' : `LAST ${speedHistory.length}S`}+ {isAssembling ? 'ASSEMBLING' : isPaused ? 'PAUSED' : `LAST ${speedHistory.length}S`}</div><ThroughputChartorder={groups.map((g, i) => ({@@ -430,7 +430,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re<span style={{ color: 'var(--text)', fontWeight: 600 }}>{percent}%</span></>)}- {!isPaused && !isMerging && knownSize && effectiveSpeed > 0 && (+ {!isPaused && !isAssembling && knownSize && effectiveSpeed > 0 && (<><span style={{ opacity: 0.35 }}>·</span><span style={{ color: 'var(--text-secondary)' }}>@@ -453,7 +453,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): RePAUSED</span>)}- {isMerging && (+ {isAssembling && (<spanstyle={{font: `600 9.5px/1 ${FONT_MONO}`,@@ -465,7 +465,7 @@ export function DownloadingScreen({ download }: { download: DownloadState }): ReborderRadius: 3.5}}>- MERGING+ ASSEMBLING</span>)}</div>@@ -479,8 +479,8 @@ export function DownloadingScreen({ download }: { download: DownloadState }): ReknownSize={knownSize}remainingBytes={remainingBytes}isPaused={isPaused}- merging={isMerging}- mergedBytes={download.mergedBytes ?? 0}+ assembling={isAssembling}+ assembledBytes={download.assembledBytes ?? 0}/></div>@@ -495,8 +495,8 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re><div style={sectionHeaderLabelStyle}>Networks</div><div style={sectionHeaderMetaStyle}>- {groups.length} merged · {download.chunks.length} streams ·{' '}- {isMerging ? 'writing to disk' : isPaused ? 'paused' : `${activeGroups.length} active`}+ {groups.length} combined · {download.chunks.length} streams ·{' '}+ {isAssembling ? 'assembling' : isPaused ? 'paused' : `${activeGroups.length} active`}</div></div><div style={networkTableHeaderStyle}>@@ -557,10 +557,11 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re<buttontype="button"onClick={handlePauseResume}- disabled={isMerging}+ disabled={isAssembling}+ title={isAssembling ? "Can't pause while assembling the file" : undefined}style={{...(isPaused ? primaryButtonStyle : secondaryButtonStyle),- ...(isMerging && { opacity: 0.5, cursor: 'not-allowed' })+ ...(isAssembling && { opacity: 0.5, cursor: 'not-allowed' })}}>{isPaused ? 'Resume' : 'Pause'}@@ -568,10 +569,11 @@ export function DownloadingScreen({ download }: { download: DownloadState }): Re<buttontype="button"onClick={handleCancel}- disabled={isMerging}+ disabled={isAssembling}+ title={isAssembling ? "Can't cancel while assembling the file" : undefined}style={{...dangerButtonStyle,- ...(isMerging && { opacity: 0.5, cursor: 'not-allowed' })+ ...(isAssembling && { opacity: 0.5, cursor: 'not-allowed' })}}>Canceldiff --git a/src/renderer/src/screens/NoConnectionsScreen.tsx b/src/renderer/src/screens/NoConnectionsScreen.tsxindex f577b45..6c0f5e5 100644--- a/src/renderer/src/screens/NoConnectionsScreen.tsx+++ b/src/renderer/src/screens/NoConnectionsScreen.tsx@@ -1,4 +1,4 @@-import { MergeDiagram } from '../components/MergeDiagram'+import { CombineDiagram } from '../components/CombineDiagram'import { useNetworkPolling } from '../hooks/useNetworkPolling'import { useAppStore } from '../store/useAppStore'import { FONT_MONO, FONT_UI, disabledPrimaryButtonStyle, secondaryButtonStyle } from '../theme'@@ -31,9 +31,9 @@ export function NoConnectionsScreen(): React.JSX.Element {gap: 16}}>- <MergeDiagram networks={PLACEHOLDER_NETWORKS} muted />+ <CombineDiagram networks={PLACEHOLDER_NETWORKS} muted /><div style={{ font: `700 16px/1.2 ${FONT_UI}`, color: 'var(--text)' }}>- No networks to merge+ No networks to combine</div><divstyle={{diff --git a/src/renderer/src/theme.ts b/src/renderer/src/theme.tsindex f28ac7e..ed064f6 100644--- a/src/renderer/src/theme.ts+++ b/src/renderer/src/theme.ts@@ -54,7 +54,7 @@ export const accentChipStyle: React.CSSProperties = {}const PILL_TOKENS: Record<- 'positive' | 'negative' | 'paused' | 'merging',+ 'positive' | 'negative' | 'paused' | 'assembling',{ bg: string; border: string; text: string }> = {positive: {@@ -72,7 +72,7 @@ const PILL_TOKENS: Record<border: 'var(--color-usb-border)',text: 'var(--color-usb-text)'},- merging: {+ assembling: {bg: 'var(--color-ethernet-bg)',border: 'var(--color-ethernet-border)',text: 'var(--color-ethernet-text)'@@ -80,7 +80,7 @@ const PILL_TOKENS: Record<}export function pillStyle(- kind: 'positive' | 'negative' | 'paused' | 'merging'+ kind: 'positive' | 'negative' | 'paused' | 'assembling'): React.CSSProperties {const tokens = PILL_TOKENS[kind]return {diff --git a/src/shared/types.ts b/src/shared/types.tsindex 9cbdc43..4f3a9e9 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -28,7 +28,7 @@ export interface ProbeResult {}export type DownloadStatus =- 'downloading' | 'merging' | 'paused' | 'completed' | 'error' | 'cancelled'+ 'downloading' | 'assembling' | 'paused' | 'completed' | 'error' | 'cancelled'export type ChunkStatus ='pending' | 'downloading' | 'retrying' | 'paused' | 'completed' | 'error' | 'cancelled'@@ -89,10 +89,10 @@ export interface DownloadState {pausedAt?: numbertotalPausedMs?: numbercompletedAt?: number- /** Bytes written to the destination file so far while `status` is 'merging' — the part files- * are already all complete at that point, so this tracks the sequential reassembly step+ /** Bytes written to the destination file so far while `status` is 'assembling' — the part+ * files are already all complete at that point, so this tracks the sequential reassembly step* rather than the network transfer. */- mergedBytes?: number+ assembledBytes?: number}/** User customization for one physical network, keyed by NetworkInterfaceInfo.id — lets a@@ -109,7 +109,7 @@ export type NetworkPreferences = Record<string, NetworkPreference>/** One fake network in a dev-tool "virtual download" — see SimulatedNetworkConfig callers in* main/download/simDownload.ts. Lets a developer exercise the multi-network UI (the block grid,- * per-network speed/throughput, retries, errors, merging) against a file already on disk,+ * per-network speed/throughput, retries, errors, assembling) against a file already on disk,* without needing a real flaky connection or a slow remote server to test against. */export interface SimulatedNetworkConfig {kind: NetworkInterfaceKind@@ -128,11 +128,11 @@ export interface StartSimulatedDownloadRequest {networks: SimulatedNetworkConfig[]chunkCount: numberconnectionsPerNetwork?: number- /** Throttles the reassembly step to this many bytes/sec, so the 'merging' phase's UI (the- * block grid sweep, the merge diagram) stays visible long enough to watch even on a small- * file that would otherwise reassemble in a single tick. Omitted or 0 merges at full disk+ /** Throttles the reassembly step to this many bytes/sec, so the 'assembling' phase's UI (the+ * block grid sweep, the combine diagram) stays visible long enough to watch even on a small+ * file that would otherwise reassemble in a single tick. Omitted or 0 assembles at full disk* speed, same as a real download. */- mergeSpeedBytesPerSec?: number+ assembleSpeedBytesPerSec?: number}export interface StartDownloadRequest {