omni-notify-mcp 1.3.389 → 1.3.391

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -85,6 +85,7 @@ label{display:block;margin:10px 0 4px;color:var(--mut);font-size:14px}
85
85
  .listbar .notice{flex:1 1 100%;font-size:13px;color:var(--mut);white-space:normal;overflow-wrap:anywhere;margin:0}
86
86
  .listbar .notice.err{color:var(--bad)}
87
87
  .listbar .pick{max-width:none}
88
+ .phonesort{display:none}
88
89
  .bad{color:var(--bad)}
89
90
  .rowmeta{color:var(--mut);font-size:13px;white-space:normal;margin:1px 0}
90
91
  .idline{display:flex;align-items:center;gap:6px;min-width:0;margin:2px 0}
@@ -126,6 +127,39 @@ label{display:block;margin:10px 0 4px;color:var(--mut);font-size:14px}
126
127
  .pick select{font:inherit;font-size:14px;padding:6px;border:1px solid var(--line);border-radius:8px;background:var(--agent);color:var(--fg);min-width:0;flex:1 1 auto;max-width:180px}
127
128
  .pick input{flex:1 1 auto;min-width:0;max-width:240px;padding:6px}
128
129
  .pick small{flex:1 1 100%;color:var(--bad);font-size:12px;overflow-wrap:anywhere}
130
+ @media(max-width:480px) and (pointer:coarse){
131
+ header{flex:none;flex-wrap:nowrap;overflow-x:auto;gap:6px;padding:2px 8px;-webkit-overflow-scrolling:touch}
132
+ header>*{flex:none}
133
+ header h1{flex:0 1 auto;max-width:36vw}
134
+ header button,header a{display:inline-flex;align-items:center;min-height:40px;padding:0 10px;font-size:14px;white-space:nowrap}
135
+ button,select{min-height:40px}
136
+ input,select,textarea{font-size:16px}
137
+ input:not([type=checkbox]):not([type=radio]),select{min-height:40px}
138
+ .acts button,.listbar button,.tm .tmbar button{min-height:40px;font-size:14px}
139
+ .copyid{min-height:40px;display:inline-flex;align-items:center;padding:0 10px}
140
+ .system a{display:inline-block;min-height:40px;line-height:40px}
141
+ .conv,.conv thead,.conv tbody,.conv tr,.conv td,.conv th{display:block}
142
+ .conv{width:100%!important;table-layout:auto}
143
+ .conv colgroup{display:none}
144
+ .conv thead th:not(.checkcell){display:none}
145
+ .phonesort{display:flex;flex:1 1 100%;gap:8px;align-items:center}
146
+ .phonesort select{flex:1 1 auto;min-width:0}
147
+ .conv thead th.checkcell{display:flex;align-items:center;gap:8px;border:0;padding:0 8px}
148
+ .conv thead th.checkcell::after{content:"Select all";font-size:13px;color:var(--mut)}
149
+ .conv tbody tr{border:1px solid var(--line);border-radius:10px;margin:0 0 8px;padding:4px 8px}
150
+ .conv td,.conv td:last-child{display:flex;gap:8px;align-items:baseline;border:0;padding:2px 0;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}
151
+ .conv td[data-label]::before{content:attr(data-label);flex:0 0 84px;color:var(--mut);font-size:12px}
152
+ .conv td.actions::before{display:none}
153
+ .conv td.actions{display:block}
154
+ .conv td.checkcell{display:block;padding:4px 0}
155
+ .conv input[type=checkbox]{width:40px;height:40px}
156
+ .conv td.empty{display:block;text-align:center}
157
+ #notification-status{display:flex!important;flex-wrap:wrap;align-items:center;gap:0 8px;margin:4px 8px!important;padding:2px 8px!important}
158
+ #notification-status>p{flex:1 1 0;min-width:0;margin:2px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
159
+ #notification-status details{flex:none}#notification-status details[open]{flex:1 1 100%}#notification-status summary{display:flex;align-items:center;min-height:40px}
160
+ .pick,.pick select,.pick input{max-width:100%}
161
+ .pick{flex:1 1 100%}
162
+ }
129
163
  [hidden]{display:none!important}`;
130
164
  /** The sign-in half every page of the door shares (#2873): the kept session and its expiry, Logout, the sign-in screen and the
131
165
  * check of a kept session on load. The page around it defines `main`, `el(tag, cls, text)`, `show(name, heading)` and
@@ -164,7 +198,7 @@ async function signIn(notice) {
164
198
  function (text) { message.textContent = text; });
165
199
  }
166
200
  if (!door.enrolled || door.local) {
167
- var input = el("input"); input.type = "password"; input.autocomplete = "off";
201
+ var input = el("input"); input.type = "password"; input.autocomplete = "off"; input.autocapitalize = "none"; input.spellcheck = false; input.enterKeyHint = "go";
168
202
  var go = el("button", "go", "Sign in with token"); go.style.marginTop = "12px";
169
203
  var submit = function () { token = input.value.trim(); if (token) { keep(token); home(); } };
170
204
  go.onclick = submit;
@@ -365,7 +399,7 @@ async function listView() {
365
399
  return "";
366
400
  };
367
401
 
368
- var scroll = null, table = null, headRow = null, body = null, countEl = null, noticeEl = null, selectAll = null, emptyRow = null;
402
+ var scroll = null, table = null, headRow = null, body = null, countEl = null, noticeEl = null, selectAll = null, emptyRow = null, sortPick = null, sortDirBtn = null;
369
403
  /** Whether this row's stop slot has anything to act on — the ONE rule both the row's button and the batch button use, so a row the batch would not act on is never offered as one it would. */
370
404
  var stoppable = function (c) {
371
405
  return c.state !== "closed";
@@ -547,6 +581,7 @@ async function listView() {
547
581
  var mark = th.querySelector(".sortmark");
548
582
  if (mark !== null) mark.textContent = sort.key !== col.key ? "↕" : sort.dir > 0 ? "▲" : sort.dir < 0 ? "▼" : "↕";
549
583
  });
584
+ if (sortPick !== null) { sortPick.value = sort.key; sortDirBtn.textContent = sort.dir === 1 ? "▲ Ascending" : "▼ Descending"; sortDirBtn.setAttribute("aria-label", "Sort direction: " + (sort.dir === 1 ? "ascending" : "descending")); }
550
585
  var n = 0;
551
586
  shown.forEach(function (c) { if (picked[c.id]) n++; });
552
587
  countEl.textContent = n === 0 ? "Select conversations to act on them." : n + " selected";
@@ -602,6 +637,14 @@ async function listView() {
602
637
  var bar = el("div", "listbar");
603
638
  countEl = el("span", "count", "");
604
639
  bar.append(countEl, el("span", "spacer"));
640
+ var phoneSort = el("div", "phonesort");
641
+ sortPick = el("select"); sortPick.setAttribute("aria-label", "Sort conversations by");
642
+ cols.forEach(function (col) { if (!col.key || col.plain) return; var o = el("option", "", col.name); o.value = col.key; sortPick.append(o); });
643
+ sortPick.onchange = function () { sort = { key: sortPick.value, dir: sort.dir === 0 ? 1 : sort.dir }; render(); };
644
+ sortDirBtn = el("button", "", "");
645
+ sortDirBtn.onclick = function () { sort = { key: sort.key, dir: sort.dir === 1 ? -1 : 1 }; render(); };
646
+ phoneSort.append(sortPick, sortDirBtn);
647
+ bar.append(phoneSort);
605
648
  var mkButton = function (label, cls, key) {
606
649
  var b = el("button", cls, label);
607
650
  b.disabled = true;
@@ -144,7 +144,7 @@ function consentPage(req, res, status, client, params, mode, notice) {
144
144
  const html = `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
145
145
  <title>BullseyeNotify sign-in</title>${ICON_HEAD}<style>body{font:16px system-ui,sans-serif;max-width:420px;margin:32px auto;padding:0 16px;background:#fff;color:#111}
146
146
  input{width:100%;padding:10px;font-size:16px;box-sizing:border-box}button{padding:10px 18px;font-size:16px;margin:12px 8px 0 0}
147
- .warn{color:#a40000}.notice{color:#a40000;font-weight:600}code{word-break:break-all}</style></head><body>
147
+ .warn{color:#a40000}.notice{color:#a40000;font-weight:600}code{word-break:break-all}@media(max-width:480px) and (pointer:coarse){button{min-height:44px}input{min-height:44px}}</style></head><body>
148
148
  <img src="/icon.png" width="64" height="64" alt="BullseyeNotify" style="border-radius:14px"><h2>Let ${escapeHtml(client.client_name ?? "an app")} start agents on this machine?</h2>
149
149
  <p>It will be able to start full-tool agents in any project folder here. After you approve, it returns to <code>${escapeHtml(redirect?.host ?? "")}</code>.</p>
150
150
  ${loopbackOnly ? `<p class="warn">This app only returns to a local address on the device that opened this page. Approve only if you started this sign-in yourself.</p>` : ""}
@@ -24,7 +24,7 @@ const STEPS_HTML = `
24
24
  <section id="s2"><h3><span class="mark"></span>2 · Create the tunnel in Cloudflare</h3>
25
25
  <ol><li>Click <b>Open Cloudflare Tunnels</b> and log in.</li><li>You land on <b>Networking › Tunnels</b>. Select <b>Create a tunnel</b>.</li><li>Name it, e.g. <code>bullseye-notify</code>, and select <b>Create Tunnel</b>.</li><li>Choose your operating system. Cloudflare shows an install command — <b>copy it, do not run it</b>: BN runs the connector itself.</li><li>Paste it below (the whole command, or just the long code starting <code>eyJ</code>) and select <b>Save token</b>.</li></ol>
26
26
  <div class="row"><button data-cmd="open" data-link="tunnels" title="Opens Networking › Tunnels in the Cloudflare dashboard">☁️ Open Cloudflare Tunnels</button></div>
27
- <textarea id="paste" class="f" rows="3" placeholder="Paste the install command or the eyJ… token"></textarea>
27
+ <textarea id="paste" class="f" rows="3" autocapitalize="none" autocorrect="off" spellcheck="false" placeholder="Paste the install command or the eyJ… token"></textarea>
28
28
  <div class="row"><button class="go" data-cmd="saveToken" id="b-token" title="Checks the token decodes to an account, a tunnel and a secret, saves it, and installs cloudflared if it is missing">💾 Save token</button></div>
29
29
  <div class="note"></div></section>
30
30
  <section id="s3"><h3><span class="mark"></span>3 · Install cloudflared</h3>
@@ -37,7 +37,7 @@ const STEPS_HTML = `
37
37
  <div class="note"></div></section>
38
38
  <section id="s5"><h3><span class="mark"></span>5 · Route your hostname to BN</h3>
39
39
  <ol><li>In Cloudflare open your tunnel's <b>Routes</b> tab, select <b>Add route</b>, then <b>Published application</b>.</li><li>Enter a subdomain, e.g. <code>bn</code>, and pick your domain.</li><li>In <b>Service URL</b> enter <code id="svc">—</code> <button data-cmd="copy" data-what="serviceUrl" id="b-svc" title="Copies the Service URL">📋 Copy</button></li><li>Select <b>Add route</b>, then type the full hostname here and select <b>Save hostname</b>.</li></ol>
40
- <div class="row"><input id="host" class="f" placeholder="bn.example.com"><button class="go" data-cmd="saveHostname" id="b-host" title="Saves the hostname the health check and the connector URL use">💾 Save hostname</button></div>
40
+ <div class="row"><input id="host" class="f" placeholder="bn.example.com" inputmode="url" autocapitalize="none" autocorrect="off" spellcheck="false" enterkeyhint="go"><button class="go" data-cmd="saveHostname" id="b-host" title="Saves the hostname the health check and the connector URL use">💾 Save hostname</button></div>
41
41
  <div class="note"></div></section>
42
42
  <section id="s6"><h3><span class="mark"></span>6 · Check it from the internet</h3>
43
43
  <p>BN asks your public hostname for its sign-in metadata and for <code>/mcp</code>, exactly as ChatGPT or claude.ai will.</p>
@@ -66,6 +66,16 @@ textarea{width:100%;box-sizing:border-box}
66
66
  #banner{border-left:4px solid #d4a72c;background:#fff8e1;padding:6px 10px;margin:0 0 12px}#banner:empty{display:none}
67
67
  #signin{display:none;margin:12px 0}#signin.show{display:block}
68
68
  code{background:#eef1f5;padding:0 4px;border-radius:3px;overflow-wrap:anywhere}
69
+ @media(max-width:480px) and (pointer:coarse){
70
+ nav{flex:none;overflow-x:auto;gap:4px;padding:2px 8px;-webkit-overflow-scrolling:touch}nav a{flex:none;display:inline-flex;align-items:center;min-height:40px;padding:0 8px;white-space:nowrap}
71
+ #bullseye-workspace{display:flex;align-items:center;min-height:40px}#bullseye-workspace select{min-height:40px;max-width:100%}
72
+ .wrap{padding:8px}.wrap table,.wrap tbody{display:block}.wrap tr{display:block;border-bottom:1px solid var(--line);padding:4px 0}.wrap tr.head{display:none}
73
+ .wrap th,.wrap td{display:block;border:0;padding:2px 4px}.wrap td.name{width:auto;white-space:normal}.wrap tr.group{border-bottom:0}
74
+ .wrap td>span{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.seg{display:flex;flex-wrap:wrap;gap:4px}.seg button{margin:0;padding:0 12px}
75
+ input.f{min-width:0;flex:1 1 12rem;min-height:40px;font-size:16px}textarea{font-size:16px}
76
+ .row button,.bar button{min-height:40px}.row code{flex:1 1 100%}
77
+ section{padding:8px}
78
+ }
69
79
  `;
70
80
  /** The sign-in every page of the service shares: the gateway token handed over once in the address fragment, else the one `/` stored in this browser (a passkey session or the token), else a box to type it. */
71
81
  const SIGN_IN = `
@@ -79,7 +89,7 @@ function el(tag, cls, text) { var n = document.createElement(tag); if (cls) n.cl
79
89
  function needSignIn(why) {
80
90
  var box = document.getElementById("signin"); box.className = "show"; box.textContent = "";
81
91
  box.append(el("p", "", why || "Sign in with the gateway token (agentGateway.token), or sign in on the conversation page first and come back."));
82
- var input = el("input", "f"); input.type = "password"; input.autocomplete = "off";
92
+ var input = el("input", "f"); input.type = "password"; input.autocomplete = "off"; input.autocapitalize = "none"; input.spellcheck = false; input.enterKeyHint = "go";
83
93
  var go = el("button", "", "Sign in");
84
94
  go.onclick = function () { token = input.value.trim(); try { localStorage.setItem(KEY, token); } catch (e) { token = token; } box.className = ""; start(); };
85
95
  box.append(input, go);
@@ -146,6 +156,7 @@ function control(row) {
146
156
  wrap.append(segd);
147
157
  } else {
148
158
  var input = el("input", "f"); input.type = row.kind === "secret" ? "password" : row.kind === "number" ? "number" : "text";
159
+ input.autocapitalize = "none"; input.spellcheck = false; input.enterKeyHint = "done";
149
160
  input.value = value === undefined ? "" : Array.isArray(value) ? value.join(", ") : String(value);
150
161
  input.placeholder = value === undefined ? "not set — server default" : "";
151
162
  input.onchange = function () { save(row.path, row.kind === "list" ? input.value.split(/[,\\n]/) : row.kind === "number" ? Number(input.value) : input.value, input); };
@@ -169,7 +180,7 @@ function draw(s) {
169
180
  if (s.conversation.unreadable) conv.append(el("span", "hint", "⚠️ The switch could not be read — " + s.conversation.unreadable + " Press On or Off to write it again."));
170
181
  else if (!s.conversation.enabled) conv.append(el("span", "hint", "The agent conversation is switched off. Press On to use it."));
171
182
  root.append(conv);
172
- var table = el("table"), head = el("tr"); head.append(el("th", "", "Setting"), el("th", "", "Value")); table.append(head);
183
+ var table = el("table"), head = el("tr", "head"); head.append(el("th", "", "Setting"), el("th", "", "Value")); table.append(head);
173
184
  s.groups.forEach(function (g) {
174
185
  var gr = el("tr", "group"), gc = el("td", "", g.title); gc.colSpan = 2; gr.append(gc); table.append(gr);
175
186
  if (g.guide) {
@@ -249,7 +249,7 @@ export function signInPage(res, title, body) {
249
249
  <style>:root{--bg:#fff;--fg:#111;--mut:#667;--line:#d8dce2;--go:#0b5fff;--bad:#a40000}@media(prefers-color-scheme:dark){:root{--bg:#14171c;--fg:#e8eaed;--mut:#9aa3b0;--line:#2b313b;--go:#2f6df0;--bad:#ff8a80}}
250
250
  body{font:16px system-ui,sans-serif;max-width:440px;margin:12px auto;padding:0 16px;background:var(--bg);color:var(--fg)}h2{font-size:19px;margin:0 0 8px}h3{font-size:15px;margin:16px 0 4px}input{font:inherit;width:100%;padding:10px;box-sizing:border-box;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--fg)}
251
251
  button{font:inherit;padding:10px 16px;margin:12px 8px 0 0;border:1px solid var(--go);border-radius:8px;background:var(--go);color:#fff}button.plain{background:none;color:var(--fg);border-color:var(--line)}
252
- .mut{color:var(--mut);font-size:14px}.err{color:var(--bad);font-weight:600}code{word-break:break-all}svg{width:240px;height:240px;background:#fff}li{margin:4px 0}a{color:var(--go)}</style></head><body>${body}</body></html>`;
252
+ .mut{color:var(--mut);font-size:14px}.err{color:var(--bad);font-weight:600}code{word-break:break-all}svg{width:240px;height:240px;background:#fff}li{margin:4px 0}a{color:var(--go)}@media(max-width:480px) and (pointer:coarse){a{display:inline-block;padding:10px 0}button{min-height:44px}}</style></head><body>${body}</body></html>`;
253
253
  res.writeHead(200, { ...PAGE_HEADERS, "content-length": String(Buffer.byteLength(html)) });
254
254
  res.end(html);
255
255
  }
@@ -153,8 +153,6 @@ export async function terminalRoute(req, url, readJson) {
153
153
  if (viewer !== undefined)
154
154
  scopedConversation(parts[2], viewer);
155
155
  const terminal = nativeTerminal(owner, parts[2]);
156
- if (parts.length === 4 && parts[3] === "history" && method === "GET")
157
- return { status: 200, body: await terminal.history() };
158
156
  if (parts.length === 3 && method === "DELETE")
159
157
  return { status: 200, body: await closeNativeTerminal(owner, parts[2]) };
160
158
  if (parts.length === 3 && method === "GET")
@@ -6,6 +6,7 @@ import { PASSKEY_SCRIPT } from "./passkeyDoor.js";
6
6
  import { PROVIDER_CHOICES } from "./conversationOwner.js";
7
7
  import { notificationStatusScript } from "./panelPage.js";
8
8
  import { ICON_HEAD } from "./iconDoor.js";
9
+ import { CLI_SCROLLBACK_LINES } from "../shared/conversation/nativeTerminal.js";
9
10
  const require = createRequire(import.meta.url);
10
11
  function asset(name, installed) {
11
12
  const packaged = new URL("../vendor/terminal/" + name, import.meta.url);
@@ -26,8 +27,7 @@ export function terminalHtml() {
26
27
  const css = asset("xterm.css", "@xterm/xterm/css/xterm.css");
27
28
  return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>BN native CLI</title>${ICON_HEAD}<style>${PAGE_STYLE}
28
29
  ${css}
29
- html,body{overscroll-behavior-y:none}
30
- .output-history{position:absolute;inset:0;z-index:3;background:#101217;display:flex;flex-direction:column;min-height:0;padding:8px}.output-history-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y}.output-history-frame{position:sticky;top:0;background:#101217;overflow:auto;overscroll-behavior:contain}.output-history .setup{flex:none}
30
+ html,body{overscroll-behavior-y:none;-webkit-text-size-adjust:100%;text-size-adjust:100%}
31
31
  body{height:100dvh;margin:0;display:flex;flex-direction:column}header{flex-wrap:wrap}main{flex:1;min-height:0;padding:12px;overflow:hidden}main.scroll{overflow-y:auto}#terminal{height:100%;width:100%}.setup{display:flex;gap:8px;flex-wrap:wrap}.setup select,.setup input{font:inherit;padding:8px}
32
32
  /* The one control that moves the view: the way back to the newest output after reading up through the scrollback. */
33
33
  button.latest{border-color:#3a4150;background:#1b202a;color:#d6dbe6}button.latest[hidden]{display:none}#status{color:var(--mut);padding:4px 12px;font-size:13px;overflow-wrap:anywhere}a{color:inherit}.origin{font-size:12px;border:1px solid var(--line);border-radius:4px;padding:0 6px;margin-left:6px;white-space:nowrap}main.cli-style{background:#101217;color:#d6dbe6;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}main.cli-style .origin{border-color:#3a4150;color:#d6dbe6}
@@ -53,6 +53,7 @@ main.cli-style .badge.history{color:#c3cad6;border-color:#3a4150;background:tran
53
53
  .line .tm table{border-collapse:collapse;width:100%}
54
54
  .line .tm td{padding:1px 4px;border-top:1px solid #2a303c;vertical-align:top;overflow-wrap:anywhere}
55
55
  main.cli-style p.system{color:var(--mut)}
56
+ @media(max-width:480px) and (pointer:coarse){header{flex-wrap:nowrap}main{padding:6px}.setup select,.setup input{flex:1 1 100%;min-height:40px}.setup.toolbar{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch}.setup.toolbar>*{flex:none}#status{padding:2px 8px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.origin{display:inline-flex;align-items:center;min-height:32px}}
56
57
  </style></head><body><header><button id="back" hidden>Back</button><h1 id="title">Conversations</h1><a href="/settings" style="color:inherit">⚙️ Settings</a><a href="/public-access" style="color:inherit">🌐 Public access</a><button id="newagent" hidden>+ New Agent</button><button id="convs" hidden title="Back to the live Conversations list">📋 Conversations</button><button id="logout" hidden>🚪 Logout</button></header>
57
58
  ${servingLine()}<div id="status" role="status" hidden></div><main id="main"></main>
58
59
  <script>${js}
@@ -62,7 +63,7 @@ ${SIGN_IN_SCRIPT}
62
63
  var main=document.getElementById("main"),note=document.getElementById("status"),title=document.getElementById("title");
63
64
  var btnBack=document.getElementById("back");
64
65
  var btnNew=document.getElementById("newagent"),btnConvs=document.getElementById("convs");
65
- var view=0,sent={},listResize=null,terminal,fitAddon,socket,reconnect,observer,arrival=null,historyCleanup=function(){};
66
+ var view=0,sent={},listResize=null,terminal,fitAddon,socket,reconnect,observer,arrival=null;
66
67
  var AGENTS = ${JSON.stringify(PROVIDER_CHOICES)};
67
68
  var storedStamp = ${storedStamp.toString()};
68
69
  // The panel that hosts this page (#2726) hands its token over once in the URL fragment, which no request and no
@@ -78,7 +79,6 @@ if(deepLink.get("view")&&deepLink.get("id")){arrival={view:deepLink.get("view"),
78
79
  function el(tag,cls,content){var node=document.createElement(tag);if(cls)node.className=cls;if(content!==undefined)node.textContent=content;return node;}
79
80
 
80
81
  function show(name,heading){
81
- historyCleanup();historyCleanup=function(){};
82
82
  view++;
83
83
  if(name!=="terminal"){clearTimeout(reconnect);if(socket){socket.onclose=null;socket.close();socket=null;}if(observer){observer.disconnect();observer=null;}if(terminal){terminal.dispose();terminal=null;}main.style.display="";main.style.flexDirection="";}
84
84
  title.textContent=heading;
@@ -181,7 +181,7 @@ function toList(){
181
181
  async function newAgentView(){
182
182
  var mine=show("new","New Agent");
183
183
  var setup=el("div","setup"),provider=el("select"),project=el("select"),model=el("input"),open=el("button","go","▶ New Agent");
184
- provider.setAttribute("aria-label","CLI provider");project.setAttribute("aria-label","Project");model.setAttribute("aria-label","Model");model.placeholder="Model (CLI default if empty)";
184
+ provider.setAttribute("aria-label","CLI provider");project.setAttribute("aria-label","Project");model.setAttribute("aria-label","Model");model.placeholder="Model (CLI default if empty)";model.autocapitalize="none";model.spellcheck=false;model.enterKeyHint="go";
185
185
  // Neither select forces a pick (#4157): no workspace runs the agent at the workspace root, where the rules of every project route each prompt, and no CLI runs the one whose subscription has room.
186
186
  var cliPlaceholder=el("option","","CLI with room (subscription first)"),folderPlaceholder=el("option","","Workspace root (any project)");
187
187
  cliPlaceholder.value="";folderPlaceholder.value="";provider.append(cliPlaceholder);project.append(folderPlaceholder);
@@ -208,10 +208,10 @@ async function newAgentView(){
208
208
  }
209
209
 
210
210
  async function cliAttach(id,origin){
211
- var mine=show("terminal","Native CLI · "+id),toolbar=el("div","setup"),back=el("button","","↩ Back"),reattach=el("button","","🔌 Reattach"),copy=el("button","","⧉ Copy selection"),latest=el("button","latest","↓ Newest"),outputHistory=el("button","","📜 Output history"),close=el("button","","⏹ Close CLI"),host=el("div");host.id="terminal";main.style.display="flex";main.style.flexDirection="column";host.style.flex="1";host.style.minHeight="0";toolbar.append(back,reattach,copy,latest,outputHistory,close,el("span","origin",origin));main.append(toolbar,host);
212
- terminal=new Terminal({cursorBlink:true,theme:{background:"#101217"},allowProposedApi:true});fitAddon=new FitAddon.FitAddon();terminal.loadAddon(fitAddon);
211
+ var mine=show("terminal","Native CLI · "+id),toolbar=el("div","setup toolbar"),back=el("button","","↩ Back"),reattach=el("button","","🔌 Reattach"),copy=el("button","","⧉ Copy selection"),latest=el("button","latest","↓ Newest"),close=el("button","","⏹ Close CLI"),host=el("div");host.id="terminal";main.style.display="flex";main.style.flexDirection="column";host.style.flex="1";host.style.minHeight="0";toolbar.append(back,reattach,copy,latest,close,el("span","origin",origin));main.append(toolbar,host);
212
+ terminal=new Terminal({cursorBlink:true,fontFamily:"ui-monospace,SFMono-Regular,Menlo,Consolas,Roboto Mono,DejaVu Sans Mono,monospace",scrollback:${CLI_SCROLLBACK_LINES},theme:{background:"#101217"},allowProposedApi:true});fitAddon=new FitAddon.FitAddon();terminal.loadAddon(fitAddon);
213
213
  terminal.loadAddon(new Unicode11Addon.Unicode11Addon());terminal.unicode.activeVersion="11";
214
- terminal.open(host);terminal.focus();var term=terminal;
214
+ terminal.open(host);terminal.textarea.enterKeyHint="send";terminal.focus();var term=terminal;
215
215
  // Reading back through the scrollback is the reader's own act, so it is never taken away from them: output arriving
216
216
  // while they are scrolled up leaves the view exactly where they put it, and ↓ Newest is the deliberate way back to the
217
217
  // newest line. The control is shown only when there is somewhere to go back to, so it is never a button that does
@@ -219,56 +219,18 @@ async function cliAttach(id,origin){
219
219
  var atNewest=function(){var b=term.buffer.active;return b.viewportY>=b.baseY;};
220
220
  var syncLatest=function(){latest.hidden=atNewest();};
221
221
  latest.onclick=function(){term.scrollToBottom();term.focus();syncLatest();};
222
- outputHistory.onclick=async function(){
223
- outputHistory.disabled=true;
224
- var request=new AbortController(),replayRequest=new AbortController(),pane=el("section","output-history"),tools=el("div","setup"),live=el("button","","↩ Live CLI"),older=el("button","","↑ Older output"),newer=el("button","","↓ Newer output"),caption=el("span","","Loading recorded output…"),scroll=el("div","output-history-scroll"),timeline=el("div"),frame=el("div","output-history-frame"),recordedTerminal;
225
- main.style.position="relative";tools.append(live,older,newer,caption);timeline.append(frame);scroll.append(timeline);pane.append(tools,scroll);main.append(pane);
226
- var closeHistory=function(){request.abort();replayRequest.abort();if(recordedTerminal)recordedTerminal.dispose();pane.remove();outputHistory.disabled=false;};
227
- historyCleanup=closeHistory;
228
- live.onclick=function(){closeHistory();historyCleanup=function(){};term.focus();};
229
- scroll.tabIndex=0;scroll.focus();
230
- try{
231
- var saved=await api("GET","/v1/terminals/"+id+"/history",undefined,request.signal);
232
- if(request.signal.aborted||mine!==view)return;
233
- var positions=[0].concat(saved.positions),selected=-1,drawing=Promise.resolve();
234
- recordedTerminal=new Terminal({cols:saved.cols,rows:saved.rows,disableStdin:true,screenReaderMode:true,scrollback:0,theme:{background:"#101217"},allowProposedApi:true});
235
- recordedTerminal.loadAddon(new Unicode11Addon.Unicode11Addon());recordedTerminal.unicode.activeVersion="11";recordedTerminal.open(frame);
236
- frame.style.height=scroll.clientHeight+"px";timeline.style.height=(scroll.clientHeight+(positions.length-1)*24)+"px";
237
- async function prefix(end,signal){
238
- if(end===0)return "";
239
- var response=await fetch("/v1/terminals/"+id+"/console?after=0",{headers:scoped({authorization:"Bearer "+token}),signal:signal});
240
- if(!response.ok)throw Error("Recorded output could not be read ("+response.status+").");
241
- var reader=response.body.getReader(),decoder=new TextDecoder(),pending="",parts=[];
242
- try{
243
- for(;;){var piece=await reader.read();if(piece.done)break;pending+=decoder.decode(piece.value,{stream:true});var split;
244
- while((split=pending.indexOf("\\n\\n"))!==-1){var line=pending.slice(0,split);pending=pending.slice(split+2);if(!line.startsWith("data: "))continue;var event=JSON.parse(line.slice(6));parts.push(event.text);if(event.seq>=end){var bytes=new TextEncoder().encode(parts.join(""));return new TextDecoder().decode(bytes.subarray(0,end));}}
245
- }
246
- return parts.join("");
247
- }finally{await reader.cancel();}
248
- }
249
- function draw(){
250
- var at=Math.min(positions.length-1,Math.max(0,Math.round(scroll.scrollTop/24)));
251
- if(at===selected)return;selected=at;older.disabled=at===0;newer.disabled=at===positions.length-1;caption.textContent="Scroll up for older output · "+at+" of "+(positions.length-1);
252
- frame.setAttribute("aria-busy","true");replayRequest.abort();replayRequest=new AbortController();var reading=replayRequest;
253
- drawing=drawing.then(async function(){if(request.signal.aborted||at!==selected)return;var data=at===positions.length-1?saved.snapshot:await prefix(positions[at],reading.signal);if(request.signal.aborted||at!==selected)return;recordedTerminal.reset();
254
- var write=function(text){return new Promise(function(done){recordedTerminal.write(text,done);});};
255
- if(at===positions.length-1){recordedTerminal.resize(saved.cols,saved.rows);await write(data);}
256
- else{
257
- var bytes=new TextEncoder().encode(data),offset=0,sizes=saved.sizes;recordedTerminal.resize(sizes[0].cols,sizes[0].rows);
258
- for(var size of sizes.slice(1)){if(size.at>=positions[at])break;await write(new TextDecoder().decode(bytes.subarray(offset,size.at)));if(request.signal.aborted||at!==selected)return;recordedTerminal.resize(size.cols,size.rows);offset=size.at;}
259
- await write(new TextDecoder().decode(bytes.subarray(offset)));
260
- }
261
- if(!request.signal.aborted&&at===selected)frame.setAttribute("aria-busy","false");}).catch(function(error){if(!reading.signal.aborted&&!request.signal.aborted){caption.textContent="History could not be read: "+error.message;frame.setAttribute("aria-busy","false");}});
262
- }
263
- scroll.onscroll=draw;
264
- function pan(x,y){if(Math.abs(x)>Math.abs(y)){frame.scrollLeft+=x;return;}var inside=y>0?frame.scrollTop<frame.scrollHeight-frame.clientHeight:frame.scrollTop>0;if(inside)frame.scrollTop+=y;else scroll.scrollTop+=y;}
265
- scroll.addEventListener("wheel",function(event){event.preventDefault();pan(event.deltaX,event.deltaY);},{passive:false,capture:true});
266
- var finger=0,fingerX=0;scroll.addEventListener("touchstart",function(event){finger=event.touches[0].clientY;fingerX=event.touches[0].clientX;},{passive:true});
267
- scroll.addEventListener("touchmove",function(event){event.preventDefault();var touch=event.touches[0];pan(fingerX-touch.clientX,finger-touch.clientY);finger=touch.clientY;fingerX=touch.clientX;},{passive:false,capture:true});
268
- older.onclick=function(){scroll.scrollTop-=24;draw();};newer.onclick=function(){scroll.scrollTop+=24;draw();};
269
- scroll.scrollTop=(positions.length-1)*24;draw();
270
- }catch(error){if(!request.signal.aborted)caption.textContent="History could not be read: "+error.message;}
271
- };
222
+ var swipeY=0,swipeX=0,swipeTravel=0;
223
+ host.addEventListener("touchstart",function(event){swipeY=event.touches[0].clientY;swipeX=event.touches[0].clientX;swipeTravel=0;},{passive:true,capture:true});
224
+ host.addEventListener("touchmove",function(event){
225
+ var touch=event.touches[0],dy=swipeY-touch.clientY,dx=swipeX-touch.clientX;swipeY=touch.clientY;swipeX=touch.clientX;
226
+ if(Math.abs(dx)>Math.abs(dy))return;
227
+ event.preventDefault();event.stopPropagation();swipeTravel+=dy;
228
+ while(Math.abs(swipeTravel)>=20){
229
+ var down=swipeTravel>0;swipeTravel-=down?20:-20;
230
+ if(term.modes.mouseTrackingMode==="none"){if(term.buffer.active.type==="alternate")ordered(id,"input",{data:(term.modes.applicationCursorKeysMode?"\\x1bO":"\\x1b[")+(down?"B":"A")});else term.scrollLines(down?1:-1);}
231
+ else ordered(id,"input",{data:"\\x1b[<"+(down?65:64)+";"+Math.ceil(term.cols/2)+";"+Math.ceil(term.rows/2)+"M"});
232
+ }
233
+ },{passive:false,capture:true});
272
234
  term.onScroll(syncLatest);
273
235
  term.onWriteParsed(syncLatest);
274
236
  // xterm turns every keystroke into the CLI's input, so Ctrl+C and Ctrl+V never reach the browser's own clipboard.
@@ -325,7 +287,7 @@ async function cliAttach(id,origin){
325
287
  term.options.disableStdin=true;
326
288
  var ws=new WebSocket((location.protocol==="https:"?"wss://":"ws://")+location.host+"/v1/terminals/"+id+"/ws",["bn-terminal","bn-bearer."+token]);socket=ws;
327
289
  var frames=Promise.resolve();
328
- ws.onopen=function(){if(mine!==view){ws.close();return;}term.options.disableStdin=false;fitAddon.fit();ordered(id,"resize",{cols:term.cols,rows:term.rows});if(!outputHistory.disabled)term.focus();};
290
+ ws.onopen=function(){if(mine!==view){ws.close();return;}term.options.disableStdin=false;fitAddon.fit();ordered(id,"resize",{cols:term.cols,rows:term.rows});term.focus();};
329
291
  ws.onmessage=function(event){frames=frames.then(async function(){if(mine!==view)return;var frame=JSON.parse(event.data);if(frame.files){fileNotice=frame.error||"Sent to CLI: "+frame.paths.join(" · ");note.textContent=fileNotice;return;}if(frame.error){note.textContent=frame.error;return;}if(frame.reset)term.reset();await new Promise(function(done){term.write(frame.data,done);});if(mine!==view)return;note.textContent=frame.provider+" · "+frame.project+(frame.ended?" · CLI ended":" · connected")+(frame.failure?" · "+frame.failure:"")+(fileNotice?" · "+fileNotice:"");}).catch(fail);};
330
292
  ws.onclose=function(event){if(mine!==view)return;term.options.disableStdin=true;if(event.code===1000){note.textContent="CLI ended.";return;}if(event.code===1008){note.textContent="Disconnected: "+event.reason+". Press Reattach or sign in again.";return;}note.textContent="Disconnected. Reattaching to the same CLI…";reconnect=setTimeout(connect,1000);};
331
293
  ws.onerror=function(){note.textContent="Terminal connection failed. Reconnecting…";};