Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

16.2 KB
Raw Blame
// Generated by scripts/connector-assets.mjs from src/lib/connectors/assets. Do not edit.
/** The Connectors page's files, served by page.ts. */
export const PAGE_FILES: Record<string, string> = {
 "index.html": "<!doctype html>\n<html lang=\"en\">\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Connectors · Harness</title>\n<link rel=\"stylesheet\" href=\"/style.css\">\n<script src=\"/page.js\" defer></script>\n<body>\n<main>\n  <header>\n    <h1>Connectors</h1>\n    <p class=\"intro\">Connect your agents to tools outside this computer: a tracker, a design tool, a web service.</p>\n  </header>\n  <div class=\"toolbar\">\n    <input id=\"search\" type=\"search\" placeholder=\"Search connectors\" autocomplete=\"off\" spellcheck=\"false\" aria-label=\"Search connectors\">\n    <button id=\"reload\" class=\"icon\" type=\"button\" title=\"Refresh\" aria-label=\"Refresh\">↻</button>\n    <button id=\"add\" class=\"primary\" type=\"button\">+ Add custom</button>\n  </div>\n  <div class=\"pills\" role=\"tablist\">\n    <button id=\"browse\" class=\"pill selected\" type=\"button\" role=\"tab\" aria-selected=\"true\">Browse</button>\n    <button id=\"connected\" class=\"pill\" type=\"button\" role=\"tab\" aria-selected=\"false\">Connected</button>\n  </div>\n  <p id=\"signed-out\" class=\"hint-line\" hidden>GitHub, Slack, Google and a few more sign in through your Harness account. Run <code>harness login</code>, then refresh to connect them.</p>\n  <p id=\"notice\" role=\"status\" aria-live=\"polite\"></p>\n  <div id=\"sections\"><p class=\"empty\">Loading connectors…</p></div>\n  <footer>Accounts are shared by every agent you run, on every computer signed in to your Harness account. Disconnecting stops Harness from using an account; revoke it in the service's settings to remove it at the service too.</footer>\n</main>\n<dialog id=\"custom-dialog\">\n  <form id=\"custom-form\">\n    <h2>Add custom</h2>\n    <p>A remote MCP server. If it asks you to sign in, Harness opens the service's sign-in page.</p>\n    <label for=\"custom-name\">Name</label>\n    <input id=\"custom-name\" required maxlength=\"64\" autocomplete=\"off\" spellcheck=\"false\">\n    <label for=\"custom-url\">Remote MCP server URL</label>\n    <input id=\"custom-url\" type=\"url\" required maxlength=\"2048\" placeholder=\"https://example.com/mcp\" autocomplete=\"off\" spellcheck=\"false\">\n    <details>\n      <summary>Advanced</summary>\n      <label for=\"custom-headers\">Headers (Name: value, one per line)</label>\n      <textarea id=\"custom-headers\" rows=\"3\" placeholder=\"Authorization: Bearer …\" spellcheck=\"false\"></textarea>\n    </details>\n    <p id=\"custom-error\" class=\"error\" role=\"status\" aria-live=\"polite\"></p>\n    <div class=\"actions\"><button type=\"button\" id=\"custom-cancel\">Cancel</button><button class=\"primary\" id=\"custom-save\" type=\"submit\">Continue</button></div>\n  </form>\n</dialog>\n<dialog id=\"confirm-dialog\">\n  <form id=\"confirm-form\">\n    <h2 id=\"confirm-title\">Disconnect</h2>\n    <p>Agents on this computer stop using this account. To revoke it everywhere, use the service's settings.</p>\n    <div class=\"actions\"><button type=\"button\" id=\"confirm-cancel\">Cancel</button><button class=\"danger\" type=\"submit\">Disconnect</button></div>\n  </form>\n</dialog>\n</body>\n</html>\n",
 "page.js": "\"use strict\";\nlet key = location.hash.slice(1) || sessionStorage.getItem(\"harness-connections\") || \"\";\nif (key) sessionStorage.setItem(\"harness-connections\", key);\nhistory.replaceState(null, \"\", location.pathname);\nconst $ = (selector) => document.querySelector(selector);\nconst sections = $(\"#sections\");\nconst notice = $(\"#notice\");\nconst search = $(\"#search\");\nlet items = [];\nlet view = \"browse\";\nconst pending = new Map();  // connector -> flow id\nlet noticeTimer = 0;\n// A notice goes away on its own, so a disconnect from earlier does not stand there for good.\nfunction say(text) {\n  notice.textContent = text;\n  clearTimeout(noticeTimer);\n  if (text) noticeTimer = setTimeout(() => {notice.textContent = \"\";}, 20000);\n}\n\nasync function request(path, body) {\n  const response = await fetch(path, {\n    method: body ? \"POST\" : \"GET\",\n    headers: {\"X-Harness-Connections\": key, ...(body ? {\"Content-Type\": \"application/json\"} : {})},\n    ...(body ? {body: JSON.stringify(body)} : {})\n  });\n  const result = await response.json();\n  if (!response.ok) throw new Error(result.error || \"Could not update this connection.\");\n  return result;\n}\nfunction node(tag, text, className) {\n  const element = document.createElement(tag);\n  if (text) element.textContent = text;\n  if (className) element.className = className;\n  return element;\n}\nfunction mark(item) {\n  if (item.icon) {\n    const image = node(\"img\", \"\", \"mark logo\");\n    image.src = item.icon;\n    image.alt = \"\";\n    return image;\n  }\n  const tile = node(\"span\", (item.name || \"?\").trim().charAt(0).toUpperCase(), \"mark\");\n  tile.style.background = item.color || \"#59634b\";\n  return tile;\n}\nfunction card(item) {\n  const connected = item.state === \"connected\";\n  const box = node(\"article\", \"\", \"card\" + (connected ? \" on\" : \"\"));\n  const head = node(\"div\", \"\", \"card-head\");\n  head.append(mark(item), node(\"h3\", item.name));\n  if (connected) head.append(node(\"span\", item.account || \"Signed in\", \"badge\"));\n  if (item.state === \"reconnect\") head.append(node(\"span\", \"Reconnect\", \"badge warn\"));\n  const actions = node(\"div\", \"\", \"card-actions\");\n  const waiting = pending.has(item.connector);\n  if (waiting) {\n    actions.append(node(\"span\", \"Waiting for sign-in…\", \"hint\"));\n  } else if (item.state !== \"not_connected\") {\n    if (item.state === \"reconnect\" && !item.custom) actions.append(button(\"Reconnect\", () => connect(item)));\n    actions.append(button(\"×\", () => confirmDisconnect(item), \"icon\", \"Disconnect \" + item.name));\n  } else if (item.reason) {\n    // Signs in through the Harness account: shown, but not yet connectable.\n    actions.append(node(\"span\", item.reason, \"hint\"));\n    const add = button(\"+\", () => {}, \"icon plus\", item.reason);\n    add.disabled = true;\n    actions.append(add);\n  } else {\n    actions.append(button(\"+\", () => connect(item), \"icon plus\", \"Connect \" + item.name));\n  }\n  head.append(actions);\n  box.append(head);\n  const about = connected && !item.tools ? item.description + \" Agents use it with harness connections call.\" : item.description;\n  box.append(node(\"p\", about, \"about\"));\n  return box;\n}\nfunction button(text, action, className, label) {\n  const element = node(\"button\", text, className);\n  element.type = \"button\";\n  if (label) {element.title = label; element.setAttribute(\"aria-label\", label);}\n  element.addEventListener(\"click\", action);\n  return element;\n}\nfunction render() {\n  const query = search.value.trim().toLowerCase();\n  const match = (item) => !query || (item.name + \" \" + item.description).toLowerCase().includes(query);\n  const on = items.filter((item) => item.state !== \"not_connected\" && match(item));\n  const off = items.filter((item) => item.state === \"not_connected\" && match(item));\n  sections.replaceChildren();\n  const group = (title, list, empty) => {\n    const section = node(\"section\", \"\", \"group\");\n    const heading = node(\"h2\", title + \" \");\n    heading.append(node(\"span\", String(list.length), \"count\"));\n    section.append(heading);\n    const grid = node(\"div\", \"\", \"grid\");\n    for (const item of list) grid.append(card(item));\n    if (!list.length) grid.append(node(\"p\", empty, \"empty\"));\n    section.append(grid);\n    sections.append(section);\n  };\n  group(\"Connected\", on, query ? \"No connected service matches.\" : \"Nothing connected yet. Choose a service below.\");\n  if (view === \"browse\") group(\"Available\", off, \"No service matches.\");\n}\nasync function refresh() {\n  const result = await request(\"/api/connections\");\n  items = result.connections.sort((a, b) => a.name.localeCompare(b.name));\n  $(\"#signed-out\").hidden = result.signed_in;\n  render();\n}\nasync function follow(item, flow) {\n  pending.set(item.connector, flow);\n  render();\n  try {\n    for (;;) {\n      await new Promise((done) => setTimeout(done, 1000));\n      const status = await request(\"/api/flows/\" + flow);\n      if (status.state === \"connected\") {say(item.name + \" connected. Your agents can use it now.\"); break;}\n      if (status.state === \"failed\") {say(item.name + \": \" + status.error); break;}\n    }\n  } catch (e) {say(e.message);}\n  pending.delete(item.connector);\n  await refresh().catch((e) => {say(e.message);});\n}\nfunction blankTab() {\n  const tab = window.open(\"about:blank\", \"_blank\");\n  // The service's page must not be able to reach back into this one.\n  if (tab) tab.opener = null;\n  return tab;\n}\nasync function connect(item) {\n  say(\"\");\n  // Open the tab inside the click, so the browser allows it; the address follows.\n  const tab = blankTab();\n  try {\n    const result = await request(\"/api/connect\", {connector: item.connector});\n    if (result.authorize_url && tab) tab.location.href = result.authorize_url;\n    else if (tab) tab.close();\n    if (result.authorize_url && !tab) say(\"Allow pop-ups for this page to sign in to \" + item.name + \".\");\n    await follow(item, result.flow);\n  } catch (e) {\n    if (tab) tab.close();\n    say(item.name + \": \" + e.message);\n  }\n}\nlet disconnecting = null;\nfunction confirmDisconnect(item) {\n  disconnecting = item;\n  $(\"#confirm-title\").textContent = \"Disconnect \" + item.name + \"?\";\n  $(\"#confirm-dialog\").showModal();\n}\n$(\"#confirm-cancel\").addEventListener(\"click\", () => $(\"#confirm-dialog\").close());\n$(\"#confirm-form\").addEventListener(\"submit\", async (event) => {\n  event.preventDefault();\n  $(\"#confirm-dialog\").close();\n  const item = disconnecting;\n  try {\n    await request(\"/api/disconnect\", {connector: item.connector});\n    say(item.name + \" disconnected.\");\n    await refresh();\n  } catch (e) {say(e.message);}\n});\nfunction headers(text) {\n  const result = {};\n  for (const line of text.split(\"\\n\").map((l) => l.trim()).filter(Boolean)) {\n    const at = line.indexOf(\":\");\n    if (at < 1) throw new Error(\"Write each header as Name: value.\");\n    result[line.slice(0, at).trim()] = line.slice(at + 1).trim();\n  }\n  return result;\n}\n$(\"#add\").addEventListener(\"click\", () => {\n  $(\"#custom-form\").reset();\n  $(\"#custom-error\").textContent = \"\";\n  $(\"#custom-dialog\").showModal();\n  $(\"#custom-name\").focus();\n});\n$(\"#custom-cancel\").addEventListener(\"click\", () => $(\"#custom-dialog\").close());\n$(\"#custom-form\").addEventListener(\"submit\", async (event) => {\n  event.preventDefault();\n  const save = $(\"#custom-save\");\n  const name = $(\"#custom-name\").value.trim();\n  let extra;\n  try {extra = headers($(\"#custom-headers\").value);} catch (e) {$(\"#custom-error\").textContent = e.message; return;}\n  const tab = Object.keys(extra).length ? null : blankTab();\n  save.disabled = true;\n  try {\n    const result = await request(\"/api/custom\", {name, url: $(\"#custom-url\").value.trim(), headers: extra});\n    $(\"#custom-dialog\").close();\n    if (result.flow) {\n      if (result.authorize_url && tab) tab.location.href = result.authorize_url;\n      else if (tab) tab.close();\n      await follow({connector: \"custom:\" + name, name}, result.flow);\n    } else {\n      if (tab) tab.close();\n      say(name + \" added. Your agents can use it now.\");\n      await refresh();\n    }\n  } catch (e) {\n    if (tab) tab.close();\n    $(\"#custom-error\").textContent = e.message;\n  } finally {save.disabled = false;}\n});\nfunction show(next) {\n  view = next;\n  for (const id of [\"browse\", \"connected\"]) {\n    $(\"#\" + id).classList.toggle(\"selected\", id === next);\n    $(\"#\" + id).setAttribute(\"aria-selected\", String(id === next));\n  }\n  render();\n}\n$(\"#browse\").addEventListener(\"click\", () => show(\"browse\"));\n$(\"#connected\").addEventListener(\"click\", () => show(\"connected\"));\n$(\"#reload\").addEventListener(\"click\", () => refresh().catch((e) => {say(e.message);}));\nsearch.addEventListener(\"input\", render);\nif (!key) say(\"Open “harness connections” from the terminal to manage your accounts.\");\nelse refresh().catch((e) => {say(e.message);});\n",
 "style.css": ":root{color-scheme:dark;font:15px/1.5 ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif;color:#e8e8e8;background:#141414}\n*{box-sizing:border-box}\nbody{margin:0}\nmain{max-width:1240px;margin:auto;padding:28px 24px 48px}\nheader{border-bottom:1px solid #2a2a2a;padding-bottom:14px;margin-bottom:18px}\nh1{font-size:26px;font-weight:700;margin:0 0 4px}.intro{margin:0;color:#a3a3a3}\n.toolbar{display:flex;gap:10px;align-items:center}\n#search{flex:1;min-width:0;height:38px;padding:0 14px;background:#1f1f1f;border:1px solid #2a2a2a;border-radius:8px;color:inherit;font:inherit}\nbutton,input,textarea{font:inherit}\nbutton{min-height:36px;border-radius:8px;border:1px solid #333;background:#1f1f1f;color:inherit;padding:6px 14px;cursor:pointer;white-space:nowrap}\nbutton:hover{border-color:#5b6bff}button:disabled{opacity:.5;cursor:wait}\n.plus:disabled{opacity:.35;cursor:not-allowed;border-color:#1d2450}\nbutton:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible{outline:2px solid #6b7bff;outline-offset:2px}\n.primary{background:#2f45d8;border-color:#3d55ff;color:#fff;font-weight:600}.primary:hover{background:#3a51ea}\n.danger{background:#5c1f1f;border-color:#8a2c2c;color:#fff}\n.icon{min-width:36px;padding:4px 10px}\n.pills{display:flex;gap:8px;margin:16px 0 4px}\n.pill{border-radius:8px;background:#1f1f1f;border-color:#1f1f1f;color:#bdbdbd;font-weight:600}\n.pill.selected{background:#2f45d8;border-color:#3d55ff;color:#fff}\n#notice{min-height:22px;color:#9fe0a8;margin:10px 0}\n.hint-line{margin:14px 0 0;color:#a3a3a3;font-size:14px}.hint-line code{color:#e8e8e8}\n.group h2{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:#a3a3a3;margin:18px 0 10px}\n.count{color:#6f6f6f;margin-left:4px}\n.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px}\n.card{background:#1f1f1f;border:1px solid #262626;border-radius:12px;padding:16px;min-height:118px}\n.card.on{border-color:#2d3a2d}\n.card-head{display:flex;align-items:center;gap:10px}\n.card-head h3{font-size:16px;margin:0;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.mark{flex:none;width:26px;height:26px;border-radius:6px;display:grid;place-items:center;color:#fff;font-weight:800;font-size:14px}\n.logo{object-fit:contain;background:#2a2a2a;padding:2px}\n.badge{font-size:12px;color:#9fb0ff;background:#1d2450;border-radius:6px;padding:1px 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:160px}\n.badge.warn{color:#ffd28a;background:#4a3511}\n.card-actions{margin-left:auto;display:flex;gap:6px;align-items:center}\n.plus{color:#8fa0ff;background:#1d2450;border-color:#1d2450;font-size:18px;line-height:1}\n.hint{font-size:12px;color:#8a8a8a;text-align:right}\n.about{margin:12px 0 0;color:#bdbdbd;font-size:14px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}\n.empty{color:#8a8a8a;margin:0}\nfooter{color:#7a7a7a;font-size:13px;border-top:1px solid #2a2a2a;margin-top:28px;padding-top:16px}\ndialog{width:min(520px,calc(100% - 32px));border:1px solid #333;border-radius:12px;background:#1b1b1b;color:inherit;padding:24px}\ndialog::backdrop{background:#000b}dialog h2{margin:0 0 6px;font-size:20px}dialog p{font-size:14px;color:#a3a3a3;margin:0}\nlabel{display:block;margin:16px 0 6px;font-size:14px}\ndialog input,textarea{width:100%;padding:10px 12px;background:#141414;color:inherit;border:1px solid #333;border-radius:8px}\ndetails{margin-top:14px}summary{cursor:pointer;color:#a3a3a3;font-size:14px}\n.actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}.error{color:#f1ac95;min-height:22px;margin-top:10px}\n@media(max-width:560px){main{padding:20px 16px}.toolbar{flex-wrap:wrap}#search{flex-basis:100%}.grid{grid-template-columns:1fr}}\n"
}