File size: 21,530 Bytes
1f82251
a8f5a2f
 
 
 
 
 
 
 
92ed407
 
 
 
 
 
 
 
a8f5a2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d2880ff
 
0e56f1a
 
 
 
a8f5a2f
 
 
 
 
 
 
 
 
d2880ff
a8f5a2f
 
 
 
 
 
 
 
92ed407
d2880ff
a8f5a2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0d56bc3
a8f5a2f
 
 
 
 
 
 
 
 
 
 
 
 
 
fbefec9
 
 
 
 
 
 
d83db09
fbefec9
 
 
a8f5a2f
 
 
7b2f9d8
 
 
d2880ff
 
7b2f9d8
 
d2880ff
0d56bc3
a8f5a2f
 
 
 
 
 
 
0d56bc3
 
a8f5a2f
 
 
 
 
 
 
 
 
 
92ed407
a8f5a2f
 
d2880ff
a8f5a2f
 
 
 
 
 
 
 
 
 
 
7b2f9d8
 
 
 
d2880ff
7b2f9d8
 
a8f5a2f
 
 
 
 
 
 
 
 
 
ff322b9
 
 
 
a8f5a2f
 
 
 
 
 
 
 
 
92ed407
 
 
 
 
 
 
a8f5a2f
 
 
 
 
 
 
 
 
 
 
 
 
 
d2880ff
0e56f1a
 
 
 
40a5fbc
0e56f1a
40a5fbc
0e56f1a
 
 
40a5fbc
 
d2880ff
 
7b2f9d8
d2880ff
 
7b2f9d8
 
d2880ff
 
0e56f1a
d2880ff
 
46d9e41
0e56f1a
 
 
 
d2880ff
 
 
 
 
 
 
 
7b2f9d8
d2880ff
46d9e41
7b2f9d8
d2880ff
7b2f9d8
d2880ff
7b2f9d8
 
 
d2880ff
 
7b2f9d8
 
 
 
a8f5a2f
 
1f82251
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>LocalWebAgent</title>
  <meta name="description" content="An AI agent (LFM3-1.7B on WebGPU) operating a real Linux machine (CheerpX), entirely in your browser and offline.">
  <meta name="color-scheme" content="dark light">
  <link rel="icon" href="icon.svg" type="image/svg+xml">
  <link rel="manifest" href="manifest.webmanifest">
  <meta name="theme-color" content="#fafafa" media="(prefers-color-scheme: light)">
  <meta name="theme-color" content="#0c0c0e" media="(prefers-color-scheme: dark)">
  <link rel="apple-touch-icon" href="icons/apple-touch-icon.png">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-title" content="LocalWebAgent">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <link rel="preload" href="vendor/fonts/inter-latin.woff2" as="font" type="font/woff2" crossorigin>
  <link rel="stylesheet" href="vendor/xterm/xterm.css">
  <link rel="stylesheet" href="css/app.css">
</head>
<body>
  <svg width="0" height="0" style="position:absolute" aria-hidden="true">
    <defs>
      <symbol id="i-terminal" viewBox="0 0 24 24"><path d="m5 8 4 4-4 4M12 17h7"/></symbol>
      <symbol id="i-file-pen" viewBox="0 0 24 24"><path d="M12.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8l6 6v4.5"/><path d="M14 2v6h6M18.4 15.6a1.9 1.9 0 0 1 2.7 2.7L16 23.4l-3.4.6.6-3.4z"/></symbol>
      <symbol id="i-file" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6M8 13h8M8 17h5"/></symbol>
      <symbol id="i-chevron" viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></symbol>
      <symbol id="i-arrow-up" viewBox="0 0 24 24"><path d="M12 19V5M5 12l7-7 7 7"/></symbol>
      <symbol id="i-stop" viewBox="0 0 24 24"><rect x="7" y="7" width="10" height="10" rx="1.5" fill="currentColor" stroke="none"/></symbol>
      <symbol id="i-sliders" viewBox="0 0 24 24"><path d="M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6"/></symbol>
      <symbol id="i-new" viewBox="0 0 24 24"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4z"/></symbol>
      <symbol id="i-check" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></symbol>
      <symbol id="i-x" viewBox="0 0 24 24"><path d="M18 6 6 18M6 6l12 12"/></symbol>
      <symbol id="i-brain" viewBox="0 0 24 24"><path d="M12 5a3 3 0 0 0-5.9-.8A3 3 0 0 0 4 9.5a3 3 0 0 0 .5 5.4A3 3 0 0 0 9 19a3 3 0 0 0 3-2zM12 5a3 3 0 0 1 5.9-.8A3 3 0 0 1 20 9.5a3 3 0 0 1-.5 5.4A3 3 0 0 1 15 19a3 3 0 0 1-3-2zM12 5v12"/></symbol>
      <symbol id="i-shield" viewBox="0 0 24 24"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></symbol>
      <symbol id="i-interrupt" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="m15 9-6 6M9 9l6 6"/></symbol>
      <symbol id="i-eraser" viewBox="0 0 24 24"><path d="m7 21-4.3-4.3a1 1 0 0 1 0-1.4l10-10a1 1 0 0 1 1.4 0l5.6 5.6a1 1 0 0 1 0 1.4L11 21M22 21H7M5 11l9 9"/></symbol>
      <symbol id="i-folder" viewBox="0 0 24 24"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></symbol>
      <symbol id="i-folder-open" viewBox="0 0 24 24"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h7a2 2 0 0 1 2 2v1"/><path d="M3 7v10a2 2 0 0 0 2 2h12.5a2 2 0 0 0 1.9-1.4L21.5 12a1.5 1.5 0 0 0-1.4-2H8.4a2 2 0 0 0-1.9 1.4L4 19"/></symbol>
      <symbol id="i-image" viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="3"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21"/></symbol>
      <symbol id="i-globe" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/></symbol>
      <symbol id="i-file-code" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6M10 12.5 8 14.5l2 2M14 12.5l2 2-2 2"/></symbol>
      <symbol id="i-film" viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="3"/><path d="M7 3v18M17 3v18M3 8h4M3 16h4M17 8h4M17 16h4"/></symbol>
      <symbol id="i-music" viewBox="0 0 24 24"><path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/></symbol>
      <symbol id="i-eye" viewBox="0 0 24 24"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></symbol>
      <symbol id="i-home" viewBox="0 0 24 24"><path d="m3 10 9-7 9 7v10a2 2 0 0 1-2 2h-4v-7H9v7H5a2 2 0 0 1-2-2z"/></symbol>
      <symbol id="i-refresh" viewBox="0 0 24 24"><path d="M21 12a9 9 0 0 1-15.5 6.2L3 16M3 12a9 9 0 0 1 15.5-6.2L21 8M21 3v5h-5M3 21v-5h5"/></symbol>
      <symbol id="i-download" viewBox="0 0 24 24"><path d="M12 3v12M7 10l5 5 5-5M5 21h14"/></symbol>
      <symbol id="i-alert" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 8v4M12 16h.01"/></symbol>
      <symbol id="i-maximize" viewBox="0 0 24 24"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></symbol>
      <symbol id="i-minimize" viewBox="0 0 24 24"><path d="M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7"/></symbol>
      <symbol id="i-cpu" viewBox="0 0 24 24"><rect x="6" y="6" width="12" height="12" rx="2"/><path d="M9 2v4M15 2v4M9 18v4M15 18v4M2 9h4M2 15h4M18 9h4M18 15h4"/></symbol>
      <symbol id="i-plus" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></symbol>
      <symbol id="i-layers" viewBox="0 0 24 24"><path d="m12 2 10 5-10 5L2 7z"/><path d="m2 17 10 5 10-5M2 12l10 5 10-5"/></symbol>
      <symbol id="i-key" viewBox="0 0 24 24"><circle cx="7.5" cy="15.5" r="4.5"/><path d="m10.7 12.3 9.8-9.8M16 7l3 3M19 4l2 2"/></symbol>
      <symbol id="i-pencil" viewBox="0 0 24 24"><path d="M17 3a2.8 2.8 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z"/></symbol>
      <symbol id="i-trash" viewBox="0 0 24 24"><path d="M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6"/></symbol>
      <symbol id="i-open" viewBox="0 0 24 24"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></symbol>
    </defs>
  </svg>

  <header class="titlebar">
    <div class="brand">
      <img src="icon.svg" alt="" width="18" height="18">
      <span class="brand-name">LocalWebAgent</span>
      <span class="brand-sep">/</span>
      <button class="brand-model mono" id="model-name" type="button" title="Open the Model Manager">No model</button>
      <span class="brand-device mono" id="gpu-name">WebGPU</span>
    </div>
    <div class="status" role="status" aria-live="polite">
      <span class="status-item" data-status="model" data-state="idle"><i></i><span class="status-text">Model</span></span>
      <span class="status-item" data-status="vm" data-state="idle"><i></i><span class="status-text">Linux</span></span>
      <span class="status-item" data-status="offline" data-state="idle"><i></i><span class="status-text">Offline</span></span>
    </div>
    <div class="titlebar-actions">
      <button class="btn small install-btn" id="install-app" type="button" hidden title="Install LocalWebAgent as an app"><svg><use href="#i-download"/></svg><span>Install</span></button>
      <button class="icon-btn" id="open-models" title="Model Manager" aria-label="Model Manager"><svg><use href="#i-cpu"/></svg></button>
      <button class="icon-btn" id="new-chat" title="New conversation" aria-label="New conversation"><svg><use href="#i-new"/></svg></button>
      <button class="icon-btn" id="open-settings" title="Settings" aria-label="Settings"><svg><use href="#i-sliders"/></svg></button>
    </div>
  </header>

  <nav class="tabs" role="tablist">
    <button role="tab" data-tab="chat" aria-selected="true">Agent</button>
    <button role="tab" data-tab="term" aria-selected="false">Terminal</button>
    <button role="tab" data-tab="files" aria-selected="false">Files</button>
  </nav>

  <main class="workspace" id="workspace">
    <section class="pane chat" aria-label="Agent">
      <div class="scroller" id="scroller">
        <div class="thread" id="messages">
          <div class="empty" id="empty">
            <h1>Start a task</h1>
            <p>The agent plans and runs commands on a Debian machine inside this tab. The model and the computer both run on your device, offline.</p>
            <div class="examples-label">Examples</div>
            <div class="examples">
              <button class="example" data-suggest><svg><use href="#i-chevron"/></svg><span>Write a Python script that prints the first 20 prime numbers, then run it</span></button>
              <button class="example" data-suggest><svg><use href="#i-chevron"/></svg><span>Compile and run examples/hello.c</span></button>
              <button class="example" data-suggest><svg><use href="#i-chevron"/></svg><span>What CPU, kernel and Linux distribution is this machine running?</span></button>
              <button class="example" data-suggest><svg><use href="#i-chevron"/></svg><span>Create a SQLite database with 5 books and show the oldest one</span></button>
            </div>
          </div>
        </div>
      </div>

      <div class="composer-wrap">
        <form class="composer" id="composer">
          <textarea id="prompt" rows="1" placeholder="Loading..." disabled aria-label="Message"></textarea>
          <div class="composer-bar">
            <button type="button" class="toggle" id="tog-thinking" aria-pressed="true" title="Let the model reason before each step"><svg><use href="#i-brain"/></svg><span class="toggle-text">Reasoning</span></button>
            <button type="button" class="toggle" id="tog-confirm" aria-pressed="false" title="Ask before running each command"><svg><use href="#i-shield"/></svg><span class="toggle-text">Approve commands</span></button>
            <span class="spacer"></span>
            <span class="hint"><kbd>Enter</kbd> to send</span>
            <button class="send" id="send" type="submit" disabled aria-label="Send"><svg><use href="#i-arrow-up"/></svg></button>
            <button class="send stop" id="stop" type="button" hidden aria-label="Stop"><svg><use href="#i-stop"/></svg></button>
          </div>
        </form>
        <div class="meta"><span id="ctx"></span><span id="version"></span></div>
      </div>
    </section>

    <div class="splitter" id="splitter" role="separator" aria-orientation="vertical" aria-label="Resize panels" tabindex="0"></div>

    <section class="pane side" aria-label="Linux machine">
      <div class="side-head">
        <div class="seg" role="tablist" aria-label="Machine view">
          <button role="tab" data-view="term" aria-selected="true"><svg><use href="#i-terminal"/></svg>Terminal<span class="led" id="cpu-led" data-on="0" title="CPU activity"></span></button>
          <button role="tab" data-view="files" aria-selected="false"><svg><use href="#i-folder"/></svg>Files<span class="badge" id="files-badge" hidden></span></button>
        </div>
        <span class="side-meta mono">debian-12 · i386</span>
        <span class="spacer"></span>
        <span class="term-actions">
          <button class="mini-btn" id="term-clear" title="Clear the screen"><svg><use href="#i-eraser"/></svg></button>
          <button class="mini-btn labeled" id="ctrl-c" title="Interrupt the running program (Ctrl-C)"><svg><use href="#i-interrupt"/></svg><span>Interrupt</span></button>
        </span>
        <button class="mini-btn" id="side-max" title="Maximize" aria-pressed="false"><svg><use href="#i-maximize"/></svg></button>
      </div>
      <div class="side-body">
        <div class="view view-term"><div id="terminal"></div></div>
        <div class="view view-files files" id="files" hidden></div>
      </div>
    </section>
  </main>

  <div class="embed-gate" id="embed-gate" hidden>
    <div class="embed-gate-inner">
      <img src="icon.svg" alt="" width="64" height="64">
      <h1>Works better on its own page</h1>
      <p>LocalWebAgent runs a whole Linux machine and keeps your models and files in your browser. Inside the Hugging Face page it can't save them properly or sign you in, so open it on its own page.</p>
      <a class="btn primary embed-gate-btn" id="embed-gate-link" href="./" target="_blank" rel="noopener">Open LocalWebAgent</a>
      <p class="embed-gate-note">Opens in a new tab. Bookmark it for next time.</p>
      <p class="embed-gate-note" id="embed-gate-clean" role="status"></p>
    </div>
  </div>

  <div class="setup" id="setup" hidden>
    <div class="setup-inner">
      <div class="setup-brand"><img src="icon.svg" alt="" width="22" height="22"><span>LocalWebAgent</span></div>
      <div class="banner warn" id="mobile-banner" hidden>
        <svg><use href="#i-alert"/></svg>
        <div>
          <strong>Phones usually can't run local models.</strong>
          They need 0.5 to 3 GB of graphics memory, more than most phones give a browser tab. Linux installs fine either way. Afterwards, in the Model Manager, add an API model (Linux keeps running on your phone, only the model runs on the provider's servers) or try the small Qwen3.5 0.8B.
        </div>
      </div>
      <h2>Install the Linux machine</h2>
      <p class="lede">A real Debian computer running inside this browser tab. Install it once (about 440 MB) and it keeps working without an internet connection. Next you'll choose a language model in the Model Manager: download one that runs on your GPU, or connect an API.</p>

      <div class="section-label">Requirements</div>
      <ul class="checks" id="checks"></ul>

      <div class="section-label">Components</div>
      <div class="components">
        <div class="component" data-row="disk" data-state="todo">
          <div class="c-main"><span class="c-name">Debian 12 disk</span><span class="c-desc">Python with numpy, pandas and matplotlib, Node, C/C++ and 450+ packages</span></div>
          <div class="c-side"><span class="c-size mono" id="disk-size">442 MB</span><span class="row-state">Not installed</span></div>
          <progress max="1" value="0"></progress>
        </div>
        <div class="component" data-row="cx" data-state="todo">
          <div class="c-main"><span class="c-name">CheerpX</span><span class="c-desc">x86 virtual machine runtime by Leaning Technologies</span></div>
          <div class="c-side"><span class="c-size mono">4 MB</span><span class="row-state">Not installed</span></div>
          <progress max="1" value="0"></progress>
        </div>
      </div>

      <button class="btn primary block" id="install" disabled>Install</button>
      <button class="btn block secondary" id="setup-install-app" type="button" hidden><svg><use href="#i-download"/></svg>Also install LocalWebAgent as an app</button>
      <p class="note" id="setup-note"></p>
      <p class="fine">
        Language models are added afterwards and load straight from their Hugging Face repositories under their own licenses.
        <a href="https://cheerpx.io" target="_blank" rel="noopener">CheerpX</a> is free for personal and open-source use; it loads from Leaning Technologies' CDN and is cached by your browser.
      </p>
    </div>
  </div>

  <dialog id="settings" aria-labelledby="settings-title">
    <form method="dialog">
      <div class="dlg-head">
        <h2 id="settings-title">Settings</h2>
        <button class="icon-btn" value="close" aria-label="Close"><svg><use href="#i-x"/></svg></button>
      </div>
      <div class="dlg-section">
        <div class="section-label">Model</div>
        <div class="row-setting">
          <span><span class="rs-title">Language model</span><span class="rs-desc" id="set-model-desc"></span></span>
          <button type="button" class="btn" id="set-model">Model Manager</button>
        </div>
      </div>
      <div class="dlg-section">
        <div class="section-label">Agent</div>
        <label class="row-setting">
          <span><span class="rs-title">Reasoning</span><span class="rs-desc">Think before each step. Slower, more reliable on multi-step tasks.</span></span>
          <input type="checkbox" class="switch" id="set-thinking">
        </label>
        <label class="row-setting">
          <span><span class="rs-title">Approve commands</span><span class="rs-desc">Ask before running each command or writing a file.</span></span>
          <input type="checkbox" class="switch" id="set-confirm">
        </label>
        <label class="row-setting">
          <span><span class="rs-title">Context size (k tokens)</span><span class="rs-desc" id="set-context-desc"></span></span>
          <input type="number" class="num" id="set-context" min="4" max="256" step="1">
        </label>
        <label class="row-setting">
          <span><span class="rs-title">Max steps per task</span></span>
          <input type="number" class="num" id="set-steps" min="1" max="50">
        </label>
        <label class="row-setting">
          <span><span class="rs-title">Command timeout</span><span class="rs-desc">Seconds before a command is interrupted.</span></span>
          <input type="number" class="num" id="set-timeout" min="5" max="600">
        </label>
      </div>
      <div class="dlg-section">
        <div class="section-label">App</div>
        <div class="row-setting">
          <span><span class="rs-title">Install as an app</span><span class="rs-desc" id="set-install-desc">Opens in its own window, with an icon in your launcher, and works offline.</span></span>
          <button type="button" class="btn" id="set-install">Install</button>
        </div>
      </div>
      <div class="dlg-section">
        <div class="section-label">Data</div>
        <div class="row-setting">
          <span><span class="rs-title">Reset Linux files</span><span class="rs-desc">Erase everything created inside the machine.</span></span>
          <button type="button" class="btn" id="reset-vm">Reset</button>
        </div>
        <div class="row-setting">
          <span><span class="rs-title">Remove offline data</span><span class="rs-desc">Delete the model, disk and files from this browser.</span></span>
          <button type="button" class="btn danger" id="uninstall">Remove</button>
        </div>
      </div>
    </form>
  </dialog>

  <dialog id="mm" class="mm" aria-labelledby="mm-title">
    <div class="mm-head">
      <div>
        <h2 id="mm-title">Model Manager</h2>
        <p class="mm-sub">Choose the model that drives the agent. Linux always runs on this device.</p>
      </div>
      <button class="icon-btn" type="button" id="mm-close" aria-label="Close"><svg><use href="#i-x"/></svg></button>
    </div>
    <div class="mm-summary" id="mm-active"></div>
    <div class="mm-tabs" id="mm-tabs" role="tablist"></div>
    <div class="mm-panel" id="mm-panel" role="tabpanel"></div>
  </dialog>

  <dialog id="api-edit" class="api-edit" aria-labelledby="ae-title">
    <form id="ae-form" novalidate>
      <div class="dlg-head">
        <h2 id="ae-title">Add an API model</h2>
        <button class="icon-btn" type="button" id="ae-close" aria-label="Close"><svg><use href="#i-x"/></svg></button>
      </div>
      <div class="dlg-section">
        <div class="section-label">Provider</div>
        <div class="providers" id="ae-providers"></div>
        <div class="ae-chosen" id="ae-chosen"></div>
        <p class="ae-base-summary" id="ae-base-summary"><span class="mono" id="ae-base-shown"></span> <button type="button" class="linkish plain" id="ae-base-edit">Change URL</button></p>
        <label class="field" id="ae-base-row"><span class="field-label">Base URL</span><input id="ae-base" type="url" placeholder="https://api.example.com/v1" spellcheck="false" autocomplete="off"></label>
        <div class="ae-hf" id="ae-hf" hidden></div>
        <div class="field" id="ae-key-row">
          <span class="field-label-row"><label class="field-label" for="ae-key">API key</label><span class="ae-keylink" id="ae-keylink"></span></span>
          <input id="ae-key" type="password" spellcheck="false" autocomplete="off">
        </div>
        <div class="field">
          <span class="field-label">Model ID</span>
          <div class="field-inline">
            <input id="ae-model" list="ae-models" placeholder="As listed by the provider" spellcheck="false" autocomplete="off">
            <button type="button" class="btn" id="ae-load-models">Load list</button>
          </div>
          <datalist id="ae-models"></datalist>
        </div>
        <p class="field-hint">Pick a model that supports tool calling.</p>
        <label class="field"><span class="field-label">Name (optional)</span><input id="ae-name" placeholder="Shown in the Model Manager; defaults to the model ID" autocomplete="off"></label>
        <label class="row-setting" id="ae-remember-row">
          <span><span class="rs-title">Remember key on this device</span><span class="rs-desc">Saved in this browser. When off, the key is forgotten when you close the tab.</span></span>
          <input type="checkbox" class="switch" id="ae-remember">
        </label>
        <p class="note" id="ae-note" role="status"></p>
      </div>
      <div class="dlg-foot">
        <span class="spacer"></span>
        <button type="button" class="btn" id="ae-test">Test</button>
        <button type="submit" class="btn primary" id="ae-save">Add and use</button>
      </div>
    </form>
  </dialog>

  <script type="module" src="js/main.js"></script>
</body>
</html>