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
feat(console): upload a harness to the cloud
richard-epsilla0023f883948e
diff --git a/ui/src/app/(app)/harnesses/[id]/page.tsx b/ui/src/app/(app)/harnesses/[id]/page.tsxindex 2ba1c9ee..f71696fb 100644--- a/ui/src/app/(app)/harnesses/[id]/page.tsx+++ b/ui/src/app/(app)/harnesses/[id]/page.tsx@@ -15,6 +15,9 @@ import { CopyId } from '@/components/CopyId';import { SkillEditor, McpModal, McpRow } from '@/components/HarnessEditors';import { fetchTraceWindow, statsFor, p95Of, avgCreditsOf, type TraceCard } from '@/lib/revamp-data';import { SELF_HOSTED } from '@/lib/edition';+import { CloudUploadDialog } from '@/components/CloudUploadDialog';+import { statusOne, type CloudStatus } from '@/lib/cloud-upload';+import { timeAgo } from '@/lib/revamp-data';type Skill = CustomHarness['skills'][number];const isOwnSkill = (s: Skill) => Boolean((s.files && s.files.length) || (s as { content?: string }).content || s.blob);@@ -32,6 +35,8 @@ export default function HarnessSettingsPage() {const [editSkillIdx, setEditSkillIdx] = useState<number | null>(null);const [mcpModal, setMcpModal] = useState<{ idx: number | null } | null>(null);const [confirmDelete, setConfirmDelete] = useState(false);+ const [uploading, setUploading] = useState(false);+ const [cloud, setCloud] = useState<CloudStatus | null>(null);// Draft of a NEW skill being created in the SkillEditor popup (name edited in the same popup).const [newSkill, setNewSkill] = useState<{ name: string } | null>(null);const [cards, setCards] = useState<TraceCard[]>([]);@@ -91,6 +96,11 @@ export default function HarnessSettingsPage() {const name = oob ? oob.name : draft!.name;const readOnly = Boolean(oob);+ // The chip: absent until the first upload, then "Uploaded …" or "Changed since upload".+ useEffect(() => {+ if (!SELF_HOSTED || readOnly || !id) return;+ statusOne(id).then(setCloud).catch(() => setCloud(null));+ }, [id, readOnly, dirty]);const skills = draft?.skills || [];const ownSkills = skills.map((s, idx) => ({ s, idx })).filter(({ s }) => isOwnSkill(s));// Built-ins the harness has not replaced with one of its own. A built-in is implicit: the@@ -130,7 +140,20 @@ export default function HarnessSettingsPage() {<form className="settings-form" onSubmit={(e) => { e.preventDefault(); void save(); }}><div className="settings-form-head"><div><h2>Harness Settings</h2><p>Configure the instructions, capabilities, and execution limits inherited by every Task on this Harness.</p></div>- <div className="header-actions"><span className="save-state">{readOnly ? 'Built-in · read-only' : dirty ? 'Unsaved changes' : 'No unsaved changes'}</span></div>+ <div className="header-actions">+ <span className="save-state">{readOnly ? 'Built-in · read-only' : dirty ? 'Unsaved changes' : 'No unsaved changes'}</span>+ {SELF_HOSTED && !readOnly && cloud?.uploaded && (+ <span className={'cloud-chip' + (cloud.changed ? ' changed' : '')} title={cloud.target || ''}>+ <iconify-icon icon={cloud.changed ? 'tabler:cloud-up' : 'tabler:cloud-check'}></iconify-icon>+ {cloud.changed ? 'Changed since upload' : `Uploaded ${timeAgo(cloud.uploaded_at ?? null)}`}+ </span>+ )}+ {SELF_HOSTED && !readOnly && (+ <button className="button" type="button" disabled={dirty} title={dirty ? 'Save first' : ''} onClick={() => setUploading(true)}>+ <iconify-icon icon="tabler:cloud-upload"></iconify-icon>Upload to cloud+ </button>+ )}+ </div></div><section className="form-section">@@ -385,6 +408,14 @@ export default function HarnessSettingsPage() {setMcpModal(null);}} />)}+ {uploading && draft && (+ <CloudUploadDialog+ items={[{ id: draft.id, name: draft.name, uploaded: !!cloud?.uploaded,+ includes: ['instructions', draft.defaultModel, (draft.skills || []).length ? `${draft.skills.length} skill${draft.skills.length === 1 ? '' : 's'}` : '',+ (draft.mcpServers || []).length ? `${draft.mcpServers.length} MCP server${draft.mcpServers.length === 1 ? '' : 's'}` : ''].filter(Boolean).join(' · ') }]}+ onClose={() => setUploading(false)}+ onDone={() => { statusOne(draft.id).then(setCloud).catch(() => null); }} />+ )}{confirmDelete && draft && (<div className="modal-backdrop"><section className="modal" role="dialog" aria-modal="true" onClick={(e) => e.stopPropagation()}>diff --git a/ui/src/app/(app)/harnesses/page.tsx b/ui/src/app/(app)/harnesses/page.tsxindex c70a662f..6a75c5ea 100644--- a/ui/src/app/(app)/harnesses/page.tsx+++ b/ui/src/app/(app)/harnesses/page.tsx@@ -10,6 +10,8 @@ import { HarnessLogo } from '@/components/HarnessLogo';import { CopyId } from '@/components/CopyId';import { fetchHarnessRows, groupByHarness, timeAgo, p95Of, avgCreditsOf, type HarnessRow, type TraceCard } from '@/lib/revamp-data';import { SELF_HOSTED } from '@/lib/edition';+import { CloudUploadDialog } from '@/components/CloudUploadDialog';+import { statusAll, type CloudStatus } from '@/lib/cloud-upload';export default function HarnessesPage() {useModelCatalog(); // model list comes from the gateway, not a local copy@@ -20,6 +22,12 @@ export default function HarnessesPage() {const [baseFlt, setBaseFlt] = useState('all');const [healthFlt, setHealthFlt] = useState('all');const [adding, setAdding] = useState(false);+ // Select mode: checkboxes appear, a bar follows the selection, nothing else changes.+ const [selecting, setSelecting] = useState(false);+ const [picked, setPicked] = useState<Set<string>>(new Set());+ const [uploading, setUploading] = useState(false);+ const [cloud, setCloud] = useState<Record<string, CloudStatus>>({});+ useEffect(() => { if (SELF_HOSTED) statusAll().then((r) => setCloud(r.harnesses || {})).catch(() => null); }, [uploading]);const [name, setName] = useState('');const [base, setBase] = useState('codex');const [model, setModel] = useState('');@@ -77,7 +85,13 @@ export default function HarnessesPage() {<div className="page"><div className="page-header"><div><h1>Harnesses</h1><p>Create, monitor, and configure the reusable agents in this Workspace.</p></div>- <button className="button primary" type="button" onClick={() => { setName(''); setAdding(true); }}><iconify-icon icon="tabler:plus"></iconify-icon>Add Harness</button>+ <div className="header-actions">+ {SELF_HOSTED && (+ <button className="button" type="button" aria-pressed={selecting}+ onClick={() => { setSelecting(!selecting); setPicked(new Set()); }}>{selecting ? 'Done' : 'Select'}</button>+ )}+ <button className="button primary" type="button" onClick={() => { setName(''); setAdding(true); }}><iconify-icon icon="tabler:plus"></iconify-icon>Add Harness</button>+ </div></div><div className="toolbar"><div className="collection-tools">@@ -101,17 +115,35 @@ export default function HarnessesPage() {</div><div className="table-wrap"><table className="harness-inventory-table">- <thead><tr><th>Harness</th><th className="harness-desktop-col">Harness ID</th><th>Health</th><th className="harness-desktop-col">Base Harness</th><th className="harness-desktop-col">Tasks (7d)</th><th className="harness-desktop-col">Success</th><th className="harness-desktop-col">p95</th>{SELF_HOSTED ? null : <th className="harness-desktop-col">Credits / Task</th>}<th className="harness-desktop-col">Last activity</th><th aria-label="Open"></th></tr></thead>+ <thead><tr>{selecting && (+ <th className="select-col"><input type="checkbox" aria-label="Select all"+ checked={filtered.length > 0 && filtered.every((r) => r.kind === 'builtin' || picked.has(r.id))}+ onChange={(e) => setPicked(e.target.checked ? new Set(filtered.filter((r) => r.kind !== 'builtin').map((r) => r.id)) : new Set())} /></th>+ )}<th>Harness</th><th className="harness-desktop-col">Harness ID</th><th>Health</th><th className="harness-desktop-col">Base Harness</th><th className="harness-desktop-col">Tasks (7d)</th><th className="harness-desktop-col">Success</th><th className="harness-desktop-col">p95</th>{SELF_HOSTED ? null : <th className="harness-desktop-col">Credits / Task</th>}<th className="harness-desktop-col">Last activity</th><th aria-label="Open"></th></tr></thead><tbody>{filtered.map((r) => {const bad = isDegraded(r);const { id: baseId, name: baseName, model: modelName } = baseDisplay(r);return (<tr key={r.id} className="object-row" style={{ cursor: 'pointer' }}- onClick={() => router.push(`/harnesses/${encodeURIComponent(r.id)}`)}>+ onClick={() => {+ if (!selecting) { router.push(`/harnesses/${encodeURIComponent(r.id)}`); return; }+ if (r.kind === 'builtin') return;+ setPicked((p) => { const n = new Set(p); if (n.has(r.id)) n.delete(r.id); else n.add(r.id); return n; });+ }}>+ {selecting && (+ <td className="select-col" onClick={(e) => e.stopPropagation()}>+ {r.kind === 'builtin' ? null : (+ <input type="checkbox" aria-label={`Select ${r.name}`} checked={picked.has(r.id)}+ onChange={(e) => setPicked((p) => { const n = new Set(p); if (e.target.checked) n.add(r.id); else n.delete(r.id); return n; })} />+ )}+ </td>+ )}<td className="object-cell"><div className="object-title"><span className="object-icon"><iconify-icon icon={r.kind === 'builtin' ? 'tabler:box' : 'tabler:terminal-2'}></iconify-icon></span>- <div className="object-copy"><strong>{r.name}</strong><span>{r.kind === 'builtin' ? `Built-in · ${r.purpose}` : r.purpose}</span></div>+ <div className="object-copy"><strong>{r.name}</strong><span>{r.kind === 'builtin' ? `Built-in · ${r.purpose}` : r.purpose}{cloud[r.id]?.uploaded ? (+ <span className={'cloud-chip' + (cloud[r.id].changed ? ' changed' : '')} title={cloud[r.id].target || ''}> · <iconify-icon icon={cloud[r.id].changed ? 'tabler:cloud-up' : 'tabler:cloud-check'}></iconify-icon>{cloud[r.id].changed ? 'Changed since upload' : 'Uploaded'}</span>+ ) : null}</span></div></div></td><td className="harness-desktop-col" onClick={(e) => e.stopPropagation()}><CopyId value={r.id} /></td><td><span className={'status ' + (bad ? 'warning' : 'healthy')}>{bad ? 'Needs review' : 'Healthy'}</span></td>@@ -125,13 +157,29 @@ export default function HarnessesPage() {</tr>);})}- {rows && !filtered.length && <tr><td colSpan={10} className="session-empty">No harnesses match.</td></tr>}+ {rows && !filtered.length && <tr><td colSpan={selecting ? 11 : 10} className="session-empty">No harnesses match.</td></tr>}{!rows && <SkelRows rows={4} cols={10} first={200} />}</tbody></table></div>+ {selecting && picked.size > 0 && (+ <div className="select-bar">+ <strong>{picked.size} selected</strong>+ <button className="button primary" type="button" onClick={() => setUploading(true)}>+ <iconify-icon icon="tabler:cloud-upload"></iconify-icon>Upload {picked.size} to cloud+ </button>+ <button className="button" type="button" onClick={() => setPicked(new Set())}>Cancel</button>+ </div>+ )}</div>+ {uploading && (+ <CloudUploadDialog+ items={(rows || []).filter((r) => picked.has(r.id)).map((r) => ({ id: r.id, name: r.name, builtin: r.kind === 'builtin', uploaded: !!cloud[r.id]?.uploaded }))}+ onClose={() => { setUploading(false); }}+ onDone={() => { setPicked(new Set()); setSelecting(false); }} />+ )}+{adding && (<div className="modal-backdrop"><section className="modal" role="dialog" aria-modal="true" aria-labelledby="addHarnessTitle" onClick={(e) => e.stopPropagation()}>diff --git a/ui/src/app/(app)/settings/page.tsx b/ui/src/app/(app)/settings/page.tsxindex b4708abb..a5a20511 100644--- a/ui/src/app/(app)/settings/page.tsx+++ b/ui/src/app/(app)/settings/page.tsx@@ -6,6 +6,8 @@// 2026-07-22, a pure label with no runtime effect is noise, not a setting.)import { useEffect, useState } from 'react';import { useWorkspace } from '@/lib/workspace';+import { SELF_HOSTED } from '@/lib/edition';+import { CloudUploadCard } from '@/components/CloudUploadCard';export default function WorkspaceSettingsPage() {const { current, update, loading } = useWorkspace();@@ -52,6 +54,7 @@ export default function WorkspaceSettingsPage() {</div></section></form>+ {SELF_HOSTED && <CloudUploadCard />}</div></section>);diff --git a/ui/src/app/revamp.css b/ui/src/app/revamp.cssindex 1b1aae91..b9ca92c1 100644--- a/ui/src/app/revamp.css+++ b/ui/src/app/revamp.css@@ -1890,3 +1890,20 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }.invite-linkrow input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--line);border-radius: 9px; background: var(--surface-subtle); color: var(--ink); font-size: 12.5px; }.invite-copy { flex: 0 0 auto; width: auto !important; padding: 0 16px; }++ /* ── cloud upload: one dialog, a chip, a select bar ───────────────────────── */+ .cloud-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }+ .cloud-kv div { display: contents; }+ .cloud-kv dt { color: var(--muted); }+ .cloud-kv dd { margin: 0; color: var(--ink); }+ .cloud-keyrow { display: flex; gap: 8px; }+ .cloud-keyrow input { flex: 1; min-width: 0; }+ .cloud-rows td { padding: 10px 12px; }+ .cloud-note { color: var(--muted); font-size: 12px; }+ .cloud-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }+ .cloud-chip.changed { color: var(--ink); }+ .cloud-chip iconify-icon { font-size: 14px; }+ .select-bar { position: sticky; bottom: 12px; z-index: 3; display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel, #fff); box-shadow: 0 8px 24px rgba(0,0,0,.08); }+ .select-bar strong { margin-right: auto; }+ .select-col { width: 36px; }+ .select-col input { cursor: pointer; }diff --git a/ui/src/components/CloudUploadCard.tsx b/ui/src/components/CloudUploadCard.tsxnew file mode 100644index 00000000..7268e697--- /dev/null+++ b/ui/src/components/CloudUploadCard.tsx@@ -0,0 +1,62 @@+'use client';+// Settings: where uploads land. One key, one Test, one sentence of contract. Self-hosted only.+import { useEffect, useState } from 'react';+import { clearTarget, destination, getTarget, saveTarget, testTarget, type CloudTarget } from '@/lib/cloud-upload';++export function CloudUploadCard() {+ const [target, setTarget] = useState<CloudTarget | null>(null);+ const [key, setKey] = useState('');+ const [tested, setTested] = useState<string | null>(null);+ const [busy, setBusy] = useState(false);+ const [err, setErr] = useState<string | null>(null);+ const [savedTick, setSavedTick] = useState(false);++ useEffect(() => { getTarget().then(setTarget).catch(() => setTarget({ configured: false } as CloudTarget)); }, []);++ async function test() {+ setBusy(true); setErr(null);+ try { setTested(destination(await testTarget(key.trim() || undefined))); }+ catch (e) { setTested(null); setErr(e instanceof Error ? e.message : String(e)); }+ finally { setBusy(false); }+ }+ async function save(e: React.FormEvent) {+ e.preventDefault(); setBusy(true); setErr(null);+ try { setTarget(await saveTarget(key.trim())); setKey(''); setTested(null); setSavedTick(true); setTimeout(() => setSavedTick(false), 2000); }+ catch (er) { setErr(er instanceof Error ? er.message : String(er)); }+ finally { setBusy(false); }+ }+ async function disconnect() {+ setBusy(true); setErr(null);+ try { await clearTarget(); setTarget({ configured: false } as CloudTarget); setTested(null); }+ catch (er) { setErr(er instanceof Error ? er.message : String(er)); }+ finally { setBusy(false); }+ }++ const shown = tested || (target?.configured ? destination(target) : null);+ return (+ <form className="settings-form" onSubmit={save}>+ <div className="settings-form-head">+ <div><h2>Cloud upload</h2><p>Uploading replaces the cloud copy.</p></div>+ <div className="header-actions">+ <span className="save-state">{savedTick ? 'Saved' : target?.configured ? 'Connected' : 'Not connected'}</span>+ {target?.configured && <button className="button" type="button" disabled={busy} onClick={() => void disconnect()}>Disconnect</button>}+ <button className="button primary" type="submit" disabled={busy || !key.trim()}>{busy ? 'Saving…' : 'Save'}</button>+ </div>+ </div>+ <section className="form-section">+ <div><h3>Workspace API key</h3></div>+ <div className="field-stack">+ <div className="field"><label htmlFor="cloudKey">Key</label>+ <div className="cloud-keyrow">+ <input id="cloudKey" type="password" autoComplete="off" placeholder={target?.configured ? target.key_hint : 'sk-hr-'}+ value={key} onChange={(e) => { setKey(e.target.value); setTested(null); }} />+ <button className="button" type="button" disabled={busy || (!key.trim() && !target?.configured)} onClick={() => void test()}>Test</button>+ </div>+ {shown && <span className="field-help"><span className="status healthy">{shown}</span></span>}+ </div>+ {err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div>{err}</div></div>}+ </div>+ </section>+ </form>+ );+}diff --git a/ui/src/components/CloudUploadDialog.tsx b/ui/src/components/CloudUploadDialog.tsxnew file mode 100644index 00000000..d5dec41c--- /dev/null+++ b/ui/src/components/CloudUploadDialog.tsx@@ -0,0 +1,108 @@+'use client';+// One dialog for one harness or many. Without a saved key the key step is inlined on top, so the+// first upload is two clicks and every later one is one. Rows run independently on the server;+// each answers for itself here.+import { useEffect, useState } from 'react';+import { destination, getTarget, saveTarget, testTarget, uploadMany, type CloudTarget, type UploadRow } from '@/lib/cloud-upload';++export interface UploadItem { id: string; name: string; builtin?: boolean; includes?: string; uploaded?: boolean }++export function CloudUploadDialog({ items, onClose, onDone }: {+ items: UploadItem[]; onClose: () => void; onDone?: (rows: UploadRow[]) => void;+}) {+ const [target, setTarget] = useState<CloudTarget | null>(null);+ const [key, setKey] = useState('');+ const [tested, setTested] = useState<{ org_name: string; org: string; workspace_name: string; workspace: string } | null>(null);+ const [busy, setBusy] = useState(false);+ const [err, setErr] = useState<string | null>(null);+ const [rows, setRows] = useState<UploadRow[] | null>(null);++ useEffect(() => { getTarget().then(setTarget).catch(() => setTarget({ configured: false } as CloudTarget)); }, []);++ const eligible = items.filter((i) => !i.builtin);+ const single = items.length === 1;+ const needKey = target !== null && !target.configured;+ const dest = target?.configured ? destination(target) : tested ? destination(tested) : '';++ async function test() {+ setBusy(true); setErr(null);+ try { setTested(await testTarget(key.trim())); }+ catch (e) { setErr(e instanceof Error ? e.message : String(e)); setTested(null); }+ finally { setBusy(false); }+ }+ async function run() {+ setBusy(true); setErr(null);+ try {+ if (needKey) setTarget(await saveTarget(key.trim()));+ const r = await uploadMany(eligible.map((i) => i.id));+ setRows(r.results); onDone?.(r.results);+ } catch (e) { setErr(e instanceof Error ? e.message : String(e)); }+ finally { setBusy(false); }+ }++ const title = single ? `Upload "${items[0].name}"` : `Upload ${eligible.length} to cloud`;+ const canUpload = !busy && eligible.length > 0 && (!needKey || (key.trim().length > 0 && tested !== null));++ return (+ <div className="modal-backdrop" onClick={onClose}>+ <section className="modal" role="dialog" aria-modal="true" aria-labelledby="cloudUploadTitle" onClick={(e) => e.stopPropagation()}>+ <div className="modal-header">+ <div><h2 id="cloudUploadTitle">{title}</h2></div>+ <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={onClose}><iconify-icon icon="tabler:x"></iconify-icon></button>+ </div>+ <div className="modal-body">+ {target === null ? <p className="field-help">Loading</p> : rows ? (+ <div className="table-wrap cloud-rows"><table><tbody>+ {rows.map((r) => {+ const it = items.find((i) => i.id === r.id);+ return (<tr key={r.id}>+ <td><strong>{it?.name || r.name || r.id}</strong></td>+ <td>{r.ok ? (r.action === 'create' ? 'Created' : 'Replaced') : r.action === 'skip' ? 'Skipped' : 'Failed'}</td>+ <td className="cloud-note">{r.ok ? '' : r.error}</td>+ </tr>);+ })}+ </tbody></table></div>+ ) : (+ <div className="field-stack">+ {needKey && (+ <div className="field"><label htmlFor="cloudKey">Workspace API key</label>+ <div className="cloud-keyrow">+ <input id="cloudKey" type="password" autoComplete="off" placeholder="sk-hr-" value={key}+ onChange={(e) => { setKey(e.target.value); setTested(null); }} />+ <button className="button" type="button" disabled={busy || !key.trim()} onClick={() => void test()}>Test</button>+ </div>+ <span className="field-help">Get one in the cloud console under Keys, inside the workspace.</span>+ </div>+ )}+ <dl className="cloud-kv">+ <div><dt>To</dt><dd>{dest || '…'}</dd></div>+ {single ? (+ <div><dt>Includes</dt><dd>{items[0].includes || 'instructions'}</dd></div>+ ) : null}+ </dl>+ {!single && (+ <div className="table-wrap cloud-rows"><table><tbody>+ {items.map((i) => (<tr key={i.id}>+ <td><strong>{i.name}</strong></td>+ <td>{i.builtin ? 'Skip' : i.uploaded ? 'Replace' : 'Create'}</td>+ <td className="cloud-note">{i.builtin ? 'built-in' : ''}</td>+ </tr>))}+ </tbody></table></div>+ )}+ {single && items[0].uploaded && <span className="field-help">Replaces the cloud copy.</span>}+ {err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div>{err}</div></div>}+ </div>+ )}+ <div className="modal-actions">+ {rows ? <button className="button primary" type="button" onClick={onClose}>Done</button> : (<>+ <button className="button" type="button" onClick={onClose} disabled={busy}>Cancel</button>+ <button className="button primary" type="button" disabled={!canUpload} onClick={() => void run()}>+ {busy ? 'Uploading…' : single ? 'Upload' : `Upload ${eligible.length}`}+ </button>+ </>)}+ </div>+ </div>+ </section>+ </div>+ );+}diff --git a/ui/src/lib/cloud-upload.ts b/ui/src/lib/cloud-upload.tsnew file mode 100644index 00000000..5872afae--- /dev/null+++ b/ui/src/lib/cloud-upload.ts@@ -0,0 +1,24 @@+// Upload a local harness to a hosted workspace. One-way: this instance is the source of truth+// and the hosted copy is a deployment target; an upload replaces it. The key never reaches the+// browser after Save; the gateway does the upload. Self-hosted only.+import { gw } from '@/lib/harness';++export interface CloudTarget {+ configured: boolean; base_url: string; key_hint: string;+ org: string; org_name: string; workspace: string; workspace_name: string;+}+export interface CloudStatus { uploaded: boolean; uploaded_at?: number; target?: string; changed?: boolean }+export interface UploadRow { id: string; ok: boolean; action: 'create' | 'replace' | 'skip'; name?: string; error?: string }++export const destination = (t: { org?: string; org_name?: string; workspace?: string; workspace_name?: string }) =>+ `${t.org_name || t.org || ''} / ${t.workspace_name || t.workspace || ''}`;++export const getTarget = () => gw<CloudTarget>('GET', '/v1/cloud-upload/target');+export const testTarget = (api_key?: string) =>+ gw<{ ok: true; org: string; org_name: string; workspace: string; workspace_name: string }>('POST', '/v1/cloud-upload/target/test', api_key ? { api_key } : {});+export const saveTarget = (api_key: string) => gw<CloudTarget>('PUT', '/v1/cloud-upload/target', { api_key });+export const clearTarget = () => gw<{ configured: false }>('DELETE', '/v1/cloud-upload/target');+export const uploadOne = (id: string) => gw<UploadRow & { status: CloudStatus }>('POST', `/v1/harnesses/${encodeURIComponent(id)}/upload`);+export const uploadMany = (ids: string[]) => gw<{ results: UploadRow[]; target: CloudTarget }>('POST', '/v1/harnesses/upload', { ids });+export const statusOne = (id: string) => gw<CloudStatus>('GET', `/v1/harnesses/${encodeURIComponent(id)}/upload`);+export const statusAll = () => gw<{ harnesses: Record<string, CloudStatus> }>('GET', '/v1/cloud-upload/status');diff --git a/ui/src/lib/harness.ts b/ui/src/lib/harness.tsindex 2a46b8d6..900df65b 100644--- a/ui/src/lib/harness.ts+++ b/ui/src/lib/harness.ts@@ -248,7 +248,7 @@ function gwHeaders(): Record<string, string> {...workspaceHeaders() };}-async function gw<T>(method: string, path: string, body?: unknown): Promise<T> {+export async function gw<T>(method: string, path: string, body?: unknown): Promise<T> {const r = await harnessFetch(`/api/harness${path}`, {method, headers: gwHeaders(), cache: 'no-store',body: body === undefined ? undefined : JSON.stringify(body),