HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.
Python agent-apiagent-frameworkagent-harnessai-agentsai-infrastructurecoding-agentconformance-testingdeepseek-harnessharness-engineeringhermesllmopen-protocolopen-sourceopen-standardpi-coding-agentself-hosteduhpunified-apiunified-harness-protocolunified-interface
console: the environment page as the design draws it, and empty states that say what to do (#323)
github-actions[bot]d90bfe38dcc3
diff --git a/ui/src/app/(app)/environments/[id]/page.tsx b/ui/src/app/(app)/environments/[id]/page.tsxindex c4ecfad2..ed1bf968 100644--- a/ui/src/app/(app)/environments/[id]/page.tsx+++ b/ui/src/app/(app)/environments/[id]/page.tsx@@ -6,16 +6,27 @@// the Harnesses that read it, and the actions: build, import, rename, delete. Nothing here is// derived on the client; every count and status is the service's.import { useCallback, useEffect, useMemo, useRef, useState } from 'react';-import { useParams, useRouter } from 'next/navigation';+import { useParams } from 'next/navigation';import { SkelPage } from '@/components/Skel';+import { PrismAsync as SyntaxHL } from 'react-syntax-highlighter';+import oneLightTheme from 'react-syntax-highlighter/dist/esm/styles/prism/one-light';import {- activateEnvironmentVersion, buildEnvironment, deleteEnvironment, deleteEnvironmentPath, environmentHarnesses,+ activateEnvironmentVersion, buildEnvironment, deleteEnvironmentPath, environmentHarnesses,fmtBytes, getEnvironment, getEnvironmentBuild, importEnvironmentArchive, importEnvironmentGit, listEnvironmentFiles,- makeEnvironmentDir, readEnvironmentFile, updateEnvironment, writeEnvironmentFile,+ makeEnvironmentDir, readEnvironmentFile, writeEnvironmentFile,type Environment, type EnvironmentBuildRecord, type EnvironmentFileEntry,} from '@/lib/environments';const STATUS_LABEL: Record<Environment['status'], string> = { empty: 'Not built', building: 'Building', ready: 'Ready', failed: 'Build failed' };+/** The highlighter's language for a file, by extension; plain text for anything else. */+const LANG: Record<string, string> = {+ py: 'python', js: 'javascript', mjs: 'javascript', cjs: 'javascript', ts: 'typescript', tsx: 'tsx', jsx: 'jsx', json: 'json',+ yaml: 'yaml', yml: 'yaml', md: 'markdown', html: 'markup', htm: 'markup', xml: 'markup', svg: 'markup', css: 'css', scss: 'scss',+ sh: 'bash', bash: 'bash', zsh: 'bash', toml: 'toml', ini: 'ini', cfg: 'ini', env: 'bash', sql: 'sql', go: 'go', rs: 'rust',+ java: 'java', rb: 'ruby', php: 'php', c: 'c', h: 'c', cpp: 'cpp', hpp: 'cpp', cs: 'csharp', swift: 'swift', kt: 'kotlin',+ r: 'r', txt: 'text', csv: 'text', lock: 'text', dockerfile: 'docker', makefile: 'makefile',+};+const langOf = (path: string) => { const name = path.split('/').pop() || ''; const ext = name.includes('.') ? name.split('.').pop()!.toLowerCase() : name.toLowerCase(); return LANG[ext] || 'text'; };const STATUS_CLASS: Record<Environment['status'], string> = { empty: 'neutral', building: 'warn', ready: 'ok', failed: 'err' };type Node = { name: string; path: string; dir: boolean; bytes: number; children: Node[]; count: number };@@ -43,7 +54,6 @@ function treeOf(entries: EnvironmentFileEntry[]): Node[] {export default function EnvironmentPage() {const { id } = useParams<{ id: string }>();- const router = useRouter();const [env, setEnv] = useState<Environment | null>(null);const [entries, setEntries] = useState<EnvironmentFileEntry[] | null>(null);const [harnesses, setHarnesses] = useState<{ id: string; name: string; base: string }[]>([]);@@ -58,10 +68,8 @@ export default function EnvironmentPage() {const [busy, setBusy] = useState('');const [build, setBuild] = useState<EnvironmentBuildRecord | null>(null);const [showLog, setShowLog] = useState(false);- const [confirmDelete, setConfirmDelete] = useState(false);- const [renaming, setRenaming] = useState(false);- const [meta, setMeta] = useState({ name: '', description: '', entry: '' });const [gitOpen, setGitOpen] = useState(false);+ const [menu, setMenu] = useState<'import' | null>(null);const [git, setGit] = useState({ url: '', ref: '', replace: false });const [newPath, setNewPath] = useState<{ kind: 'file' | 'dir'; value: string } | null>(null);const uploadRef = useRef<HTMLInputElement>(null);@@ -70,11 +78,17 @@ export default function EnvironmentPage() {const reload = useCallback(async () => {try {const [e, t, h] = await Promise.all([getEnvironment(id), listEnvironmentFiles(id), environmentHarnesses(id).catch(() => [])]);- setEnv(e); setEntries(t.entries); setHarnesses(h); setMeta({ name: e.name, description: e.description, entry: e.entry });+ setEnv(e); setEntries(t.entries); setHarnesses(h);if (e.latestVersion) setBuild(await getEnvironmentBuild(id, e.latestVersion).catch(() => null));} catch (e) { setErr(e instanceof Error ? e.message : 'The environment could not be read.'); }}, [id]);useEffect(() => { void reload(); }, [reload]);+ useEffect(() => {+ if (!menu) return;+ const off = (ev: MouseEvent) => { if (!(ev.target as HTMLElement).closest('.env-menu-wrap')) setMenu(null); };+ window.addEventListener('mousedown', off);+ return () => window.removeEventListener('mousedown', off);+ }, [menu]);useEffect(() => {if (env?.status !== 'building') return;const t = setInterval(() => void reload(), 3000);@@ -118,8 +132,6 @@ export default function EnvironmentPage() {const remove = (p: string) => act('remove', async () => { await deleteEnvironmentPath(id, p); if (sel === p || sel.startsWith(p + '/')) setSel(''); if (openPath === p || openPath.startsWith(p + '/')) { setOpenPath(''); setFile(null); } });const startBuild = () => act('build', async () => { await buildEnvironment(id); setTab('packages'); setShowLog(true); });const activate = (n: number) => act('activate', () => activateEnvironmentVersion(id, n));- const saveMeta = () => act('rename', async () => { await updateEnvironment(id, meta); setRenaming(false); });- const destroy = () => act('delete', async () => { await deleteEnvironment(id); router.push('/environments'); });if (!env && !err) return <SkelPage />;@@ -140,7 +152,6 @@ export default function EnvironmentPage() {</div>);- const lines = editing === null && file?.text !== null && file?.text !== undefined ? file.text.split('\n') : [];return (<section className="view is-active collection-view" id="view-environment">@@ -148,44 +159,9 @@ export default function EnvironmentPage() {<a className="env-back" href="/environments"><iconify-icon icon="tabler:arrow-left"></iconify-icon>Environments</a>{env && (<div className="env-title-row">- {renaming ? (- <div className="env-rename">- <input value={meta.name} aria-label="Name" onChange={(ev) => setMeta({ ...meta, name: ev.target.value })} />- <input value={meta.description} placeholder="Description" aria-label="Description" onChange={(ev) => setMeta({ ...meta, description: ev.target.value })} />- <input value={meta.entry} placeholder="How it is run" aria-label="How it is run" onChange={(ev) => setMeta({ ...meta, entry: ev.target.value })} />- <button className="button primary small" type="button" disabled={busy === 'rename'} onClick={() => void saveMeta()}>Save</button>- <button className="button small" type="button" onClick={() => { setRenaming(false); setMeta({ name: env.name, description: env.description, entry: env.entry }); }}>Cancel</button>- </div>- ) : (- <h1>{env.name}</h1>- )}- <div className="env-actions">- <span className={'status ' + STATUS_CLASS[env.status]}>{STATUS_LABEL[env.status]}{env.version ? ` · v${env.version}` : ''}</span>- <button className="button primary" type="button" disabled={env.status === 'building' || busy === 'build' || !env.files.count}- title={!env.files.count ? 'Add files first' : 'Snapshot the files and install the packages they declare'} onClick={() => void startBuild()}>- <iconify-icon icon="tabler:hammer"></iconify-icon>{env.status === 'building' ? 'Building…' : env.version ? 'Rebuild' : 'Build'}</button>- <button className="button" type="button" onClick={() => archiveRef.current?.click()} disabled={busy === 'import'}><iconify-icon icon="tabler:file-zip"></iconify-icon>Import archive</button>- <input ref={archiveRef} type="file" hidden accept=".zip,.tar,.tgz,.tar.gz" onChange={(ev) => { void importArchive(ev.target.files); ev.target.value = ''; }} />- <button className="button" type="button" onClick={() => setGitOpen(true)}><iconify-icon icon="tabler:brand-git"></iconify-icon>Import from git</button>- <button className="button" type="button" onClick={() => setRenaming(true)}><iconify-icon icon="tabler:pencil"></iconify-icon>Rename</button>- {confirmDelete ? (- <span className="env-confirm">- <span>Delete every version and file?</span>- <button className="button danger small" type="button" disabled={busy === 'delete'} onClick={() => void destroy()}>Delete</button>- <button className="button small" type="button" onClick={() => setConfirmDelete(false)}>Keep</button>- </span>- ) : (- <button className="button" type="button" onClick={() => setConfirmDelete(true)}><iconify-icon icon="tabler:trash"></iconify-icon>Delete</button>- )}- </div>- </div>- )}- {env && (- <div className="env-facts">- <span><em>Path in every session</em><code>{env.mount}</code><span className="env-dim">read-only</span></span>- {env.entry && <span><em>Run with</em><code>{env.entry}</code></span>}- <span><em>Read by</em>{harnesses.length ? harnesses.map((h) => <a key={h.id} href={`/harnesses/${h.id}`}>{h.name}</a>) : <span className="env-dim">no Harness yet. Name it under a Harness's settings.</span>}</span>- {env.description && <span><em>About</em>{env.description}</span>}+ <h1>{env.name}</h1>+ <button className="button primary" type="button" disabled={editing === null || busy === 'save'} onClick={() => void saveFile()}>+ {busy === 'save' ? 'Saving\u2026' : 'Save changes'}</button></div>)}</div>@@ -208,6 +184,16 @@ export default function EnvironmentPage() {<button className="icon-button" type="button" title="New folder" aria-label="New folder" onClick={() => setNewPath({ kind: 'dir', value: '' })}><iconify-icon icon="tabler:folder-plus"></iconify-icon></button><button className="icon-button" type="button" title="Upload files" aria-label="Upload files" onClick={() => uploadRef.current?.click()}><iconify-icon icon="tabler:upload"></iconify-icon></button><input ref={uploadRef} type="file" hidden multiple onChange={(ev) => { void upload(ev.target.files); ev.target.value = ''; }} />+ <span className="env-menu-wrap">+ <button className="icon-button" type="button" title="Import a project" aria-label="Import a project" aria-haspopup="menu" aria-expanded={menu === 'import'} onClick={() => setMenu(menu === 'import' ? null : 'import')}><iconify-icon icon="tabler:folder-down"></iconify-icon></button>+ {menu === 'import' && (+ <div className="env-menu is-right" role="menu">+ <button type="button" role="menuitem" onClick={() => { setMenu(null); archiveRef.current?.click(); }}><iconify-icon icon="tabler:file-zip"></iconify-icon>Import an archive</button>+ <button type="button" role="menuitem" onClick={() => { setMenu(null); setGitOpen(true); }}><iconify-icon icon="tabler:brand-git"></iconify-icon>Import from git</button>+ </div>+ )}+ </span>+ <input ref={archiveRef} type="file" hidden accept=".zip,.tar,.tgz,.tar.gz" onChange={(ev) => { void importArchive(ev.target.files); ev.target.value = ''; }} /></div>{newPath && (<div className="env-newpath">@@ -226,27 +212,45 @@ export default function EnvironmentPage() {<span className="env-chev" /><iconify-icon icon="tabler:file"></iconify-icon><span className="env-node-name">{m.path}</span></div>)) : <div className="env-tree-empty">No file matches.</div>) : tree.length ? tree.map((n) => renderNode(n, 0)) : (- <div className="env-tree-empty">No files yet. Upload files, or import an archive or a git repository from the header.</div>+ <div className="env-tree-empty">No files yet.</div>)}</div></aside><div className="env-view">- {openPath && file ? (+ {!entries?.length && !needle ? (+ <div className="env-onboard is-files">+ <h2>Put the project in</h2>+ <p>The whole folder, as it is on your machine. Folders and relative paths are kept; a build installs its packages afterwards.</p>+ <div className="env-choices">+ <button type="button" className="env-choice" onClick={() => archiveRef.current?.click()}>+ <iconify-icon icon="tabler:file-zip"></iconify-icon><strong>Import an archive</strong><em>A zip or tar of the project folder.</em></button>+ <button type="button" className="env-choice" onClick={() => setGitOpen(true)}>+ <iconify-icon icon="tabler:brand-git"></iconify-icon><strong>Import from git</strong><em>A repository URL and a branch or tag.</em></button>+ <button type="button" className="env-choice" onClick={() => uploadRef.current?.click()}>+ <iconify-icon icon="tabler:upload"></iconify-icon><strong>Upload files</strong><em>Pick files; they land at the root.</em></button>+ </div>+ <span className="env-onboard-note">Or start from nothing with New file in the tree.</span>+ </div>+ ) : openPath && file ? (<><div className="env-view-head"><code>{openPath}</code>- <span className="env-dim">{fmtBytes(file.bytes)}</span>- {file.text !== null && (editing === null- ? <button className="button small" type="button" onClick={() => setEditing(file.text || '')}>Edit</button>- : <><button className="button primary small" type="button" disabled={busy === 'save'} onClick={() => void saveFile()}>Save</button>- <button className="button small" type="button" onClick={() => setEditing(null)}>Cancel</button></>)}+ <span className="env-dim">{fmtBytes(file.bytes)}{editing !== null ? ' \u00b7 edited' : ''}</span>+ {editing !== null && <button className="button small" type="button" onClick={() => setEditing(null)}>Discard</button>}</div>{file.text === null ? (<div className="env-binary">A binary file ({file.type}, {fmtBytes(file.bytes)}). It is in the environment as uploaded.</div>) : editing !== null ? (- <textarea className="env-editor" value={editing} spellCheck={false} onChange={(ev) => setEditing(ev.target.value)} />+ <textarea className="env-editor" value={editing} spellCheck={false} autoFocus onChange={(ev) => setEditing(ev.target.value)} />) : (- <pre className="env-code">{lines.map((l, i) => <span key={i} className="env-line"><span className="env-ln">{i + 1}</span><span className="env-lt">{l}</span></span>)}</pre>+ <div className="env-code" title="Click to edit" onClick={() => setEditing(file.text || '')}>+ <SyntaxHL language={langOf(openPath)} style={oneLightTheme} showLineNumbers+ customStyle={{ margin: 0, padding: '14px 0', background: 'transparent', fontSize: 12.5, lineHeight: 1.7, whiteSpace: 'pre', overflowX: 'auto' }}+ codeTagProps={{ style: { fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace' } }}+ lineNumberStyle={{ minWidth: 48, paddingRight: 16, textAlign: 'right', color: 'var(--line-strong)', userSelect: 'none' }}>+ {file.text || ' '}+ </SyntaxHL>+ </div>)}</>) : (@@ -258,14 +262,33 @@ export default function EnvironmentPage() {{tab === 'packages' && (<div className="env-packages">+ {env.status === 'empty' && !build ? (+ <div className="env-onboard is-packages">+ <h2>Nothing built yet</h2>+ <p>A build copies the files into a version and installs what they declare. Every Task then finds the packages installed, and nothing is installed again.</p>+ <dl className="env-manifests">+ <div><dt><code>requirements.txt</code> or <code>pyproject.toml</code></dt><dd>a Python virtualenv, first on PATH</dd></div>+ <div><dt><code>package.json</code></dt><dd>npm into node_modules, on NODE_PATH</dd></div>+ <div><dt><code>setup.sh</code></dt><dd>runs last, for anything the manifests cannot say</dd></div>+ </dl>+ <button className="button primary" type="button" disabled={busy === 'build' || !env.files.count} onClick={() => void startBuild()}>+ {env.files.count ? 'Build now' : 'Add files first'}</button>+ </div>+ ) : (<div className="env-pk-head">- {env.status === 'ready' && env.version- ? <span>Installed in version {env.version}, the one every session reads.</span>- : env.status === 'building' ? <span>Building version {env.latestVersion}…</span>- : env.status === 'failed' ? <span>The last build failed. Fix the manifests and build again.</span>- : <span>Nothing built yet. Add a <code>requirements.txt</code>, <code>pyproject.toml</code> or <code>package.json</code> (and a <code>setup.sh</code> for anything else), then build.</span>}- {build && <button className="button small" type="button" onClick={() => setShowLog((v) => !v)}>{showLog ? 'Hide build log' : 'Build log'}</button>}+ <span className={'env-status is-' + env.status}><i />{env.status === 'ready' && env.version+ ? `Version ${env.version} is what every session reads`+ : env.status === 'building' ? `Building version ${env.latestVersion}\u2026`+ : env.status === 'failed' ? 'The last build failed; fix the manifests and build again'+ : 'Nothing built yet'}</span>+ <span className="env-pk-actions">+ {build && <button className="button small" type="button" onClick={() => setShowLog((v) => !v)}>{showLog ? 'Hide build log' : 'Build log'}</button>}+ <button className="button primary small" type="button" disabled={env.status === 'building' || busy === 'build' || !env.files.count}+ title={!env.files.count ? 'Add files first' : 'Snapshot the files and install the packages they declare'} onClick={() => void startBuild()}>+ {env.status === 'building' ? 'Building\u2026' : env.version ? 'Rebuild' : 'Build'}</button>+ </span></div>+ )}{showLog && build && (<pre className="env-log">{`version ${build.version} · ${build.status}${build.error ? ' · ' + build.error : ''}\n${build.log || ''}`}</pre>)}diff --git a/ui/src/app/(app)/environments/page.tsx b/ui/src/app/(app)/environments/page.tsxindex e2f16674..9c264c95 100644--- a/ui/src/app/(app)/environments/page.tsx+++ b/ui/src/app/(app)/environments/page.tsx@@ -6,16 +6,26 @@import { useCallback, useEffect, useState } from 'react';import { useRouter } from 'next/navigation';import { SkelRows } from '@/components/Skel';-import { createEnvironment, fmtBytes, listEnvironments, type Environment } from '@/lib/environments';+import { createEnvironment, deleteEnvironment, listEnvironments, updateEnvironment, type Environment } from '@/lib/environments';-const STATUS_LABEL: Record<Environment['status'], string> = { empty: 'Not built', building: 'Building', ready: 'Ready', failed: 'Build failed' };-const STATUS_CLASS: Record<Environment['status'], string> = { empty: 'neutral', building: 'warn', ready: 'ok', failed: 'err' };+/** The packages column: what the active build installed, counted per manager, or the state that explains why there is none. */+function packagesLine(e: Environment): string {+ if (e.status === 'ready') {+ const by: Record<string, number> = {};+ for (const p of e.packages) by[p.manager] = (by[p.manager] || 0) + 1;+ const parts = Object.entries(by).map(([m, n]) => `${n} ${m}`);+ return parts.length ? parts.join(' \u00b7 ') : 'no packages';+ }+ return e.status === 'building' ? 'building\u2026' : e.status === 'failed' ? 'build failed' : 'not built yet';+}export default function EnvironmentsPage() {const router = useRouter();const [items, setItems] = useState<Environment[] | null>(null);const [err, setErr] = useState('');const [creating, setCreating] = useState(false);+ const [editing, setEditing] = useState<Environment | null>(null);+ const [confirm, setConfirm] = useState<string>('');const [form, setForm] = useState({ name: '', description: '', entry: '' });const [busy, setBusy] = useState(false);@@ -35,19 +45,31 @@ export default function EnvironmentsPage() {if (!form.name.trim()) return;setBusy(true); setErr('');try {- const e = await createEnvironment({ name: form.name.trim(), description: form.description.trim(), entry: form.entry.trim() });- setCreating(false); setForm({ name: '', description: '', entry: '' });- router.push(`/environments/${e.id}`);- } catch (e) { setErr(e instanceof Error ? e.message : 'The environment could not be created.'); }+ if (editing) {+ await updateEnvironment(editing.id, { name: form.name.trim(), description: form.description.trim(), entry: form.entry.trim() });+ setEditing(null); setForm({ name: '', description: '', entry: '' }); await reload();+ } else {+ const e = await createEnvironment({ name: form.name.trim(), description: form.description.trim(), entry: form.entry.trim() });+ setCreating(false); setForm({ name: '', description: '', entry: '' });+ router.push(`/environments/${e.id}`);+ }+ } catch (e) { setErr(e instanceof Error ? e.message : 'The environment could not be saved.'); }finally { setBusy(false); }};+ const remove = async (id: string) => {+ setBusy(true); setErr('');+ try { await deleteEnvironment(id); setConfirm(''); await reload(); }+ catch (e) { setErr(e instanceof Error ? e.message : 'The environment could not be deleted.'); }+ finally { setBusy(false); }+ };+ const openEdit = (e: Environment) => { setForm({ name: e.name, description: e.description, entry: e.entry }); setEditing(e); };return (<section className="view is-active collection-view" id="view-environments"><div className="page"><div className="page-header"><div><h1>Environments</h1>- <p>A project and its installed dependencies, built once and opened by every Task that uses it. Sessions read it at its own path and keep their outputs in their own workspace.</p>+ <p>Project files and packages that a harness opens in every session.</p></div><div className="page-actions"><button className="button primary" type="button" onClick={() => setCreating(true)}>@@ -60,36 +82,56 @@ export default function EnvironmentsPage() {{items === null && !err && <SkelRows rows={3} />}{items !== null && items.length === 0 && (- <div className="session-empty env-empty">- <iconify-icon icon="tabler:stack-2"></iconify-icon>- <strong>No environments yet</strong>- <span>Create one, import your project (an archive or a git repository), build it, and name it on a Harness. Every Task of that Harness then starts with the project in place and its packages installed.</span>+ <div className="env-onboard">+ <span className="env-onboard-mark"><iconify-icon icon="tabler:stack-2"></iconify-icon></span>+ <h2>Give your Tasks a ready project</h2>+ <p>An environment is a project and its installed packages, built once. Every Task that uses it starts with the project in place, at the same path, with nothing to install or upload.</p>+ <ol className="env-steps">+ <li><span>1</span><strong>Import the project</strong><em>An archive, a git repository, or files, folders kept.</em></li>+ <li><span>2</span><strong>Build it once</strong><em>Packages from requirements.txt and package.json are installed into it.</em></li>+ <li><span>3</span><strong>Name it on a Harness</strong><em>Every Task of that Harness reads it, read-only, beside its own workspace.</em></li>+ </ol>+ <button className="button primary" type="button" onClick={() => setCreating(true)}><iconify-icon icon="tabler:plus"></iconify-icon>New environment</button></div>)}{items !== null && items.length > 0 && (<div className="env-list">- <div className="env-row env-row-head"><span>Name</span><span>Status</span><span>Version</span><span>Files</span><span>Packages</span><span>Updated</span></div>+ <div className="env-row env-row-head"><span>Environment</span><span>Project files</span><span>Packages</span><span /></div>{items.map((e) => (- <a key={e.id} className="env-row" href={`/environments/${e.id}`}>- <span className="env-name"><iconify-icon icon="tabler:stack-2"></iconify-icon><span><strong>{e.name}</strong><em>{e.mount}</em></span></span>- <span><span className={'status ' + STATUS_CLASS[e.status]}>{STATUS_LABEL[e.status]}</span></span>- <span className="env-mono">{e.version ? `v${e.version}` : '—'}</span>- <span className="env-mono">{e.files.count}{e.files.bytes ? <em> {fmtBytes(e.files.bytes)}</em> : null}</span>- <span className="env-mono">{e.status === 'ready' ? e.packages.length : '—'}</span>- <span className="env-dim">{e.updatedAt ? new Date(e.updatedAt).toLocaleString() : ''}</span>- </a>+ <div key={e.id} className="env-row">+ <a className="env-name" href={`/environments/${e.id}`} title={e.description || e.mount}>{e.name}</a>+ <span className="env-mono">{e.files.count} {e.files.count === 1 ? 'file' : 'files'}</span>+ <span className="env-mono">{packagesLine(e)}</span>+ <span className="env-row-actions">+ {confirm === e.id ? (+ <>+ <span className="env-dim">Delete every version and file?</span>+ <button className="button danger small" type="button" disabled={busy} onClick={() => void remove(e.id)}>Delete</button>+ <button className="button small" type="button" onClick={() => setConfirm('')}>Keep</button>+ </>+ ) : (+ <>+ <button className="icon-button" type="button" aria-label={`Edit ${e.name}`} title="Name, description, how it is run" onClick={() => openEdit(e)}><iconify-icon icon="tabler:pencil"></iconify-icon></button>+ <button className="icon-button" type="button" aria-label={`Delete ${e.name}`} title="Delete" onClick={() => setConfirm(e.id)}><iconify-icon icon="tabler:trash"></iconify-icon></button>+ <a className="button small" href={`/environments/${e.id}`}>Open</a>+ </>+ )}+ </span>+ </div>))}</div>)}- {creating && (+ {(creating || editing) && (<div className="kit-overlay" role="dialog" aria-modal="true" aria-labelledby="env-new-title"- onMouseDown={(ev) => { if (ev.target === ev.currentTarget) setCreating(false); }}>+ onMouseDown={(ev) => { if (ev.target === ev.currentTarget) { setCreating(false); setEditing(null); } }}><div className="kit-dialog">- <button className="kit-dialog-x" type="button" onClick={() => setCreating(false)} aria-label="Close"><iconify-icon icon="tabler:x"></iconify-icon></button>- <h2 id="env-new-title">New environment</h2>- <p className="kit-dialog-sub">Name it after the project. Sessions will find it at a path made from the name; that path does not change afterwards.</p>+ <button className="kit-dialog-x" type="button" onClick={() => { setCreating(false); setEditing(null); }} aria-label="Close"><iconify-icon icon="tabler:x"></iconify-icon></button>+ <h2 id="env-new-title">{editing ? editing.name : 'New environment'}</h2>+ <p className="kit-dialog-sub">{editing+ ? <>Sessions keep finding it at <code>{editing.mount}</code>; the name, the description and how it is run can change.</>+ : 'Name it after the project. Sessions will find it at a path made from the name; that path does not change afterwards.'}</p><div className="kit-custom"><label className="kit-field"><span>Name</span><input value={form.name} placeholder="Content Studio" autoFocus onChange={(ev) => setForm({ ...form, name: ev.target.value })}@@ -97,13 +139,13 @@ export default function EnvironmentsPage() {<label className="kit-field"><span>Description</span><input value={form.description} placeholder="What the project does" onChange={(ev) => setForm({ ...form, description: ev.target.value })} /></label><label className="kit-field"><span>How it is run</span>- <input value={form.entry} placeholder="python3 run.py --episode <id>" onChange={(ev) => setForm({ ...form, entry: ev.target.value })} />- <span className="kit-choice-why">Optional. Told to the agent word for word, so it starts the project the way you do.</span></label>+ <input value={form.entry} placeholder="python3 run.py --episode <id>" onChange={(ev) => setForm({ ...form, entry: ev.target.value })} /></label>+ <p className="env-help">Optional. Told to the agent word for word, so it starts the project the way you do.</p></div><div className="kit-dialog-actions"><span className="kit-dialog-spacer" />- <button className="button" type="button" onClick={() => setCreating(false)}>Cancel</button>- <button className="button primary" type="button" disabled={busy || !form.name.trim()} onClick={() => void create()}>{busy ? 'Creating…' : 'Create'}</button>+ <button className="button" type="button" onClick={() => { setCreating(false); setEditing(null); }}>Cancel</button>+ <button className="button primary" type="button" disabled={busy || !form.name.trim()} onClick={() => void create()}>{busy ? (editing ? 'Saving\u2026' : 'Creating\u2026') : editing ? 'Save' : 'Create'}</button></div></div></div>diff --git a/ui/src/app/hr.css b/ui/src/app/hr.cssindex cc81a287..2d0434be 100644--- a/ui/src/app/hr.css+++ b/ui/src/app/hr.css@@ -1051,47 +1051,92 @@ body.hr-resizing iframe { pointer-events: none; }The shelf: one row per environment. The page: a white head (back link, name, status, actions,facts), then a card with two tabs; the files tab is a tree beside the open file. */.env-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }-.env-row { display: grid; grid-template-columns: minmax(200px, 2fr) 120px 80px 110px 90px minmax(120px, 1fr); align-items: center; gap: 12px;- padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 13.5px; }+.env-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(100px, 1fr) minmax(140px, 1.6fr) auto; align-items: center; gap: 12px;+ padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 13.5px; }.env-row:first-child { border-top: 0; }-.env-row-head { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-subtle); }-a.env-row:hover { background: var(--surface-subtle); }-.env-name { display: flex; align-items: center; gap: 10px; min-width: 0; }-.env-name iconify-icon { font-size: 18px; color: var(--muted); flex: none; }-.env-name > span { display: flex; flex-direction: column; min-width: 0; }-.env-name strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.env-name em { font-style: normal; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--muted); }+.env-row-head { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); background: var(--surface-subtle); padding-top: 9px; padding-bottom: 9px; }+.env-row:hover { background: color-mix(in srgb, var(--surface-subtle) 55%, transparent); }+.env-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+.env-name:hover { color: var(--accent); }+.env-row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }+.env-row-actions .button { margin-left: 6px; }+.env-row .env-mono { color: var(--muted); font-size: 12.5px; }.env-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }.env-mono em { font-style: normal; color: var(--muted); }.env-dim { color: var(--muted); font-size: 12.5px; }-.env-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 560px; }-.env-empty iconify-icon { font-size: 26px; color: var(--muted); }+/* Empty states: one column, centred, the hierarchy in size and weight; numbered steps, one accent action. */+.env-onboard { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; max-width: 560px; margin: 56px auto; padding: 0 16px; }+.env-onboard h2 { margin: 6px 0 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }+.env-onboard p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); text-wrap: pretty; }+.env-onboard .button { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; }+.env-onboard-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-subtle); color: var(--ink); font-size: 22px; }+.env-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; text-align: left; width: 100%; }+.env-steps li { display: flex; flex-direction: column; gap: 3px; }+.env-steps li span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--accent); }+.env-steps li strong { font-size: 13.5px; font-weight: 650; color: var(--ink); }+.env-steps li em { font-style: normal; font-size: 12.5px; line-height: 1.5; color: var(--muted); }+.env-onboard.is-files { margin: 64px auto; max-width: 620px; }+.env-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: 8px; }+.env-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font: inherit; text-align: left; color: var(--ink); }+.env-choice:hover { border-color: var(--line-strong); background: var(--surface-subtle); }+.env-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }+.env-choice iconify-icon { font-size: 20px; color: var(--ink); margin-bottom: 4px; }+.env-choice strong { font-size: 13.5px; font-weight: 650; }+.env-choice em { font-style: normal; font-size: 12.5px; line-height: 1.45; color: var(--muted); }+.env-onboard-note { font-size: 12.5px; color: var(--muted); }+.env-onboard.is-packages { margin: 40px auto; }+.env-manifests { margin: 8px 0 0; width: 100%; display: flex; flex-direction: column; text-align: left; border-top: 1px solid var(--line); }+.env-manifests > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }+.env-manifests dt { margin: 0; color: var(--ink); }+.env-manifests dt code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }+.env-manifests dd { margin: 0; color: var(--muted); }+@media (max-width: 720px) {+ .env-steps, .env-choices { grid-template-columns: minmax(0, 1fr); }+ .env-onboard, .env-onboard.is-files { margin: 32px auto; }+}@media (max-width: 900px) {- .env-row { grid-template-columns: minmax(160px, 2fr) 110px 70px; }- .env-row > :nth-child(n+4) { display: none; }+ .env-row { grid-template-columns: minmax(140px, 1.4fr) auto; }+ .env-row > :nth-child(2), .env-row > :nth-child(3) { display: none; }}-.env-head { padding: 22px 36px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }+.env-head { padding: 22px 36px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }.env-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-decoration: none; }.env-back:hover { color: var(--ink); }-.env-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 10px; }-.env-title-row h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }-.env-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }-.env-actions .button { display: inline-flex; align-items: center; gap: 6px; }-.env-confirm { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }+.env-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 8px; }+.env-title-row h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }+.env-actions { display: flex; align-items: center; gap: 8px; }+.env-actions .button { display: inline-flex; align-items: center; gap: 5px; }+.env-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-right: 4px; white-space: nowrap; }+.env-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }+.env-status.is-ready i { background: var(--green); }+.env-status.is-building i { background: var(--amber); }+.env-status.is-failed i { background: var(--red, #d04040); }+.env-menu-wrap { position: relative; display: inline-flex; }+.env-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;+ box-shadow: 0 12px 32px -12px rgba(15, 23, 42, .35); display: flex; flex-direction: column; }+.env-menu.is-right { left: auto; right: 0; }+.env-menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; text-align: left; }+.env-menu button:hover { background: var(--surface-subtle); }+.env-menu button iconify-icon { font-size: 15px; color: var(--muted); }+.env-menu button.is-danger, .env-menu button.is-danger iconify-icon { color: var(--red, #d04040); }+.env-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }+.env-sub code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--ink); background: var(--surface-subtle); padding: 2px 7px; border-radius: 6px; }+.env-sub a { color: var(--accent); text-decoration: none; }+.env-sep { width: 1px; height: 12px; background: var(--line); }+.env-confirm { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-subtle); font-size: 13px; color: var(--ink); }.env-rename { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; }.env-rename input { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; min-width: 160px; }-.env-facts { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-top: 14px; font-size: 13px; color: var(--ink); }-.env-facts > span { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }-.env-facts em { font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }-.env-facts code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-subtle); padding: 2px 7px; border-radius: 6px; }-.env-facts a { color: var(--accent); text-decoration: none; }+.env-help { margin: -4px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }.env-body { padding: 24px 36px 34px; }-.env-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }-.env-tabs { display: flex; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--line); }-.env-tab { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;+.env-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }+.env-card > .env-files, .env-card > .env-packages { border-top: 1px solid var(--line); }+.env-tabs { display: inline-flex; gap: 2px; margin: 12px 16px; padding: 4px; border-radius: 10px; background: var(--surface-subtle); }+.env-card > .env-tabs { align-self: flex-start; }+.env-tab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;font: inherit; font-size: 13.5px; font-weight: 600; color: var(--muted); }-.env-tab.is-on { background: var(--surface-subtle); color: var(--ink); }+.env-tab.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 0 0 1px var(--line); }+.env-tab span { color: var(--muted); }+.env-tab.is-on span { color: var(--accent); }.env-tab span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--accent); }.env-files { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 520px; }.env-tree-pane { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }@@ -1111,19 +1156,18 @@ a.env-row:hover { background: var(--surface-subtle); }.env-node-count { color: var(--muted); font-size: 11px; }.env-node-x { display: none; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 12px; }.env-node:hover .env-node-x { display: inline-flex; }-.env-tree-empty { padding: 16px 14px; color: var(--muted); font-family: inherit; font-size: 13px; line-height: 1.5; white-space: normal; }+.env-tree-empty { padding: 16px 14px; color: var(--muted); font-family: var(--font-sans, -apple-system, 'Inter', system-ui, sans-serif); font-size: 13px; line-height: 1.5; white-space: normal; }.env-view { display: flex; flex-direction: column; min-width: 0; }.env-view-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 12.5px; }.env-view-head code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }.env-view-empty { padding: 40px 16px; color: var(--muted); font-size: 13px; }.env-binary { padding: 24px 16px; color: var(--muted); font-size: 13px; }-.env-code { margin: 0; padding: 14px 0; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.7; color: var(--ink); }-.env-line { display: flex; }-.env-ln { flex: none; width: 48px; padding-right: 16px; text-align: right; color: var(--line-strong); user-select: none; }-.env-lt { white-space: pre; }+.env-code { flex: 1; min-width: 0; overflow: auto; cursor: text; }+.env-code pre { margin: 0 !important; }.env-editor { flex: 1; min-height: 480px; margin: 0; padding: 14px 16px; border: 0; outline: none; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.7; color: var(--ink); background: transparent; }.env-packages { padding: 16px; display: flex; flex-direction: column; gap: 14px; }.env-pk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }+.env-pk-actions { display: inline-flex; align-items: center; gap: 8px; }.env-pk-head code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }.env-log { margin: 0; padding: 12px 14px; max-height: 320px; overflow: auto; background: var(--surface-subtle); border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; color: var(--ink); }.env-table { width: 100%; border-collapse: collapse; font-size: 13px; }@@ -1135,6 +1179,7 @@ a.env-row:hover { background: var(--surface-subtle); }.env-err { color: var(--amber); font-size: 12.5px; }@media (max-width: 900px) {.env-head { padding: 18px 16px 14px; }+ .env-title-row h1 { font-size: 24px; }.env-body { padding: 16px 0 24px; }.env-files { grid-template-columns: minmax(0, 1fr); }.env-tree-pane { border-right: 0; border-bottom: 1px solid var(--line); max-height: 320px; }diff --git a/ui/src/components/HarnessSettings.tsx b/ui/src/components/HarnessSettings.tsxindex ebf42e52..1bff3d8a 100644--- a/ui/src/components/HarnessSettings.tsx+++ b/ui/src/components/HarnessSettings.tsx@@ -582,12 +582,12 @@ export function HarnessSettings({ id, embedded = false, onNavigate }: {</section><section className="form-section">- <div><h3>Project environment</h3><p>A project and its installed dependencies, built once on the Environments page. Every Task of this Harness then starts with it in place, read-only at its own path, and keeps its outputs in the Task's own workspace.</p></div>+ <div><h3>Workspace</h3><p>Project files and packages every Task opens in.</p></div><div className="field-stack"><div className="field"><label>Environment</label><select value={draft?.environment || ''} disabled={readOnly || environments === null} onChange={(e) => upd({ environment: e.target.value })}><option value="">None</option>- {(environments || []).map((en) => <option key={en.id} value={en.id}>{en.name}{en.status === 'ready' ? ` (v${en.version}, ${en.mount})` : ' (not built yet)'}</option>)}+ {(environments || []).map((en) => <option key={en.id} value={en.id}>{en.name} {en.files.count} {en.files.count === 1 ? 'file' : 'files'} \u00b7 {en.status === 'ready' ? `${en.packages.length} ${en.packages.length === 1 ? 'package' : 'packages'}` : 'not built yet'}</option>)}</select></div>{draft?.environment && (() => { const en = (environments || []).find((x) => x.id === draft.environment); return en ? (<span className="field-help">{en.status === 'ready'