Skip to content

Commit 1b8d647

Browse files
ndemiancclaude
andcommitted
Atom++ AI: right-sidebar chat, Codex-style composer, smooth streaming, dmg packaging
- Move AI chat from activity bar to the secondary (right) side bar so Explorer and chat are visible at once; editor stays centered. Add Cmd+Alt+I to focus chat. - Open the chat by default on first launch (globalState-guarded), then defer to VS Code's per-workspace layout persistence. - Redesign the chat composer to match a modern AI editor: context chips with language badges, big input, mode/model/settings toolbar, round send/stop. - Smooth typewriter streaming: buffer deltas and reveal at a steady, self-balancing pace instead of dumping network chunks. Stop flushes; errors reuse the bubble. - Neutralize residual Microsoft voiceWsUrl in the branding overlay. - Add scripts/make-dmg.sh: ad-hoc sign + wrap Atom++.app into a single distributable .dmg. Ignore *.dmg. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4ffe13b commit 1b8d647

6 files changed

Lines changed: 319 additions & 47 deletions

File tree

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
/VSCode-linux-*/
88
/VSCode-win32-*/
99

10+
# Distributable disk images (produced by scripts/make-dmg.sh)
11+
/*.dmg
12+
1013
# Node / OS noise
1114
node_modules/
1215
.DS_Store

‎branding/product.overlay.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
"enableTelemetry": false,
3131
"telemetryOptOutUrl": "",
32+
"voiceWsUrl": "",
3233
"aiConfig": {
3334
"ariaKey": ""
3435
},

‎extensions/atom-ai/extension.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class ChatViewProvider {
220220
case 'newChat': newChat(); break;
221221
case 'setKey': await promptForKey(); break;
222222
case 'pickModel': await pickModel(); break;
223+
case 'openSettings': vscode.commands.executeCommand('workbench.action.openSettings', '@ext:atompp.atom-ai'); break;
223224
}
224225
});
225226
}
@@ -275,6 +276,14 @@ function activate(context) {
275276
if (!key && !silent) { key = await promptForKey(); }
276277
return key;
277278
});
279+
280+
// AI-first: reveal the chat (in the secondary side bar) on first launch. We do this once
281+
// and then defer to VS Code's own per-workspace layout persistence, so if the user later
282+
// closes the panel we don't keep forcing it back open.
283+
if (!context.globalState.get('atompp.ai.didAutoOpen')) {
284+
context.globalState.update('atompp.ai.didAutoOpen', true);
285+
setTimeout(() => { vscode.commands.executeCommand('atomAi.chat.focus'); }, 600);
286+
}
278287
}
279288

280289
function deactivate() { if (abort) { abort.abort(); } }

‎extensions/atom-ai/media/chat.html‎

Lines changed: 233 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,194 @@
55
<meta http-equiv="Content-Security-Policy" content="__CSP__">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<style>
8-
:root { color-scheme: light dark; }
9-
body { margin:0; padding:0; font-family: var(--vscode-font-family); font-size: var(--vscode-font-size); color: var(--vscode-foreground); background: transparent; display:flex; flex-direction:column; height:100vh; }
10-
#log { flex:1; overflow-y:auto; padding:10px; display:flex; flex-direction:column; gap:10px; }
11-
.msg { padding:8px 10px; border-radius:8px; white-space:pre-wrap; word-wrap:break-word; line-height:1.45; }
12-
.user { background: var(--vscode-input-background); border:1px solid var(--vscode-input-border, transparent); }
13-
.assistant { background: var(--vscode-editorWidget-background, rgba(127,127,127,.08)); }
14-
.role { font-size:11px; opacity:.6; margin-bottom:4px; text-transform:uppercase; letter-spacing:.04em; }
8+
:root {
9+
color-scheme: light dark;
10+
--radius: 12px;
11+
--pill-radius: 999px;
12+
--border: var(--vscode-input-border, var(--vscode-panel-border, rgba(127,127,127,.28)));
13+
--muted: var(--vscode-descriptionForeground, rgba(127,127,127,.85));
14+
--field-bg: var(--vscode-input-background, rgba(127,127,127,.06));
15+
--accent: var(--vscode-focusBorder, #4c8dff);
16+
}
17+
* { box-sizing: border-box; }
18+
body {
19+
margin: 0; padding: 0;
20+
font-family: var(--vscode-font-family);
21+
font-size: var(--vscode-font-size);
22+
color: var(--vscode-foreground);
23+
background: transparent;
24+
display: flex; flex-direction: column; height: 100vh;
25+
}
26+
27+
/* ---- conversation log ---- */
28+
#log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
29+
.msg { white-space: pre-wrap; word-wrap: break-word; line-height: 1.5; }
30+
.msg .role { font-size: 11px; opacity: .55; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em; }
31+
.msg.user .body { background: var(--field-bg); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; }
32+
.msg.assistant .body { padding: 1px 2px; }
1533
.err { color: var(--vscode-errorForeground); }
16-
pre { background: var(--vscode-textCodeBlock-background, rgba(127,127,127,.15)); padding:8px; border-radius:6px; overflow-x:auto; }
17-
code { font-family: var(--vscode-editor-font-family, monospace); }
18-
#empty { opacity:.6; padding:18px; text-align:center; }
19-
#ctx { margin:0 10px; }
20-
.chip { display:inline-flex; align-items:center; gap:6px; font-size:11px; padding:3px 8px; border-radius:10px; background: var(--vscode-badge-background); color: var(--vscode-badge-foreground); }
21-
#bar { border-top:1px solid var(--vscode-panel-border, rgba(127,127,127,.25)); padding:8px; display:flex; flex-direction:column; gap:6px; }
22-
#row { display:flex; gap:6px; align-items:flex-end; }
23-
textarea { flex:1; resize:none; min-height:34px; max-height:140px; padding:7px 9px; border-radius:6px; color: var(--vscode-input-foreground); background: var(--vscode-input-background); border:1px solid var(--vscode-input-border, var(--vscode-contrastBorder, #8884)); font-family:inherit; font-size:inherit; box-sizing:border-box; }
24-
button { cursor:pointer; border:none; border-radius:6px; padding:7px 12px; color: var(--vscode-button-foreground); background: var(--vscode-button-background); }
25-
button:hover { background: var(--vscode-button-hoverBackground); }
26-
button.secondary { color: var(--vscode-button-secondaryForeground); background: var(--vscode-button-secondaryBackground); }
27-
#meta { display:flex; justify-content:space-between; align-items:center; font-size:11px; opacity:.7; }
28-
#meta a { color: var(--vscode-textLink-foreground); cursor:pointer; }
34+
pre { background: var(--vscode-textCodeBlock-background, rgba(127,127,127,.15)); padding: 9px 10px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
35+
code { font-family: var(--vscode-editor-font-family, ui-monospace, monospace); font-size: .92em; }
36+
#empty { margin: auto; max-width: 280px; text-align: center; opacity: .65; line-height: 1.55; padding: 20px; }
37+
#empty .big { font-size: 1.15em; opacity: .9; margin-bottom: 6px; }
38+
39+
/* ---- composer ---- */
40+
#composer {
41+
margin: 8px; padding: 8px 8px 6px;
42+
border: 1px solid var(--border); border-radius: var(--radius);
43+
background: var(--field-bg);
44+
display: flex; flex-direction: column; gap: 7px;
45+
transition: border-color .12s ease, box-shadow .12s ease;
46+
}
47+
#composer.focused { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
48+
49+
#chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
50+
.chip {
51+
display: inline-flex; align-items: center; gap: 5px;
52+
font-size: 11px; line-height: 1; padding: 4px 8px;
53+
border-radius: var(--pill-radius);
54+
border: 1px solid var(--border); background: var(--vscode-badge-background, rgba(127,127,127,.12));
55+
color: var(--vscode-foreground); max-width: 100%;
56+
}
57+
.chip .name { font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
58+
.chip .badge {
59+
font-family: var(--vscode-editor-font-family, ui-monospace, monospace);
60+
font-size: 9px; font-weight: 700; letter-spacing: .03em;
61+
padding: 2px 4px; border-radius: 4px;
62+
background: var(--accent); color: #fff; opacity: .9;
63+
}
64+
.addchip {
65+
display: inline-flex; align-items: center; gap: 5px;
66+
font-size: 11px; line-height: 1; padding: 4px 9px; cursor: pointer;
67+
border-radius: var(--pill-radius);
68+
border: 1px dashed var(--border); background: transparent; color: var(--muted);
69+
}
70+
.addchip:hover { color: var(--vscode-foreground); border-color: var(--accent); }
71+
.addchip .plus { font-size: 13px; line-height: 1; }
72+
73+
textarea#input {
74+
width: 100%; resize: none; min-height: 46px; max-height: 200px;
75+
padding: 4px 4px; border: none; outline: none;
76+
color: var(--vscode-input-foreground, var(--vscode-foreground));
77+
background: transparent; font-family: inherit; font-size: 13px; line-height: 1.45;
78+
}
79+
textarea#input::placeholder { color: var(--muted); opacity: .8; }
80+
81+
#toolbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
82+
#toolbar .left { display: flex; align-items: center; gap: 4px; min-width: 0; }
83+
.tbtn {
84+
display: inline-flex; align-items: center; justify-content: center;
85+
width: 26px; height: 26px; cursor: pointer;
86+
border: none; border-radius: 7px; background: transparent; color: var(--muted);
87+
font-size: 15px; line-height: 1;
88+
}
89+
.tbtn:hover { background: var(--vscode-toolbar-hoverBackground, rgba(127,127,127,.18)); color: var(--vscode-foreground); }
90+
.pill {
91+
display: inline-flex; align-items: center; gap: 5px;
92+
font-size: 12px; line-height: 1; padding: 5px 9px; border-radius: 7px;
93+
color: var(--vscode-foreground); cursor: pointer; user-select: none;
94+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
95+
}
96+
.pill:hover { background: var(--vscode-toolbar-hoverBackground, rgba(127,127,127,.18)); }
97+
.pill.static { cursor: default; }
98+
.pill.static:hover { background: transparent; }
99+
.pill .mono { font-family: var(--vscode-editor-font-family, ui-monospace, monospace); opacity: .7; }
100+
.pill .caret { opacity: .5; font-size: 10px; }
101+
.sep { width: 1px; height: 16px; background: var(--border); margin: 0 2px; flex: 0 0 auto; }
102+
103+
#send {
104+
display: inline-flex; align-items: center; justify-content: center;
105+
width: 30px; height: 30px; flex: 0 0 auto; cursor: pointer;
106+
border: none; border-radius: 8px;
107+
background: var(--vscode-button-background); color: var(--vscode-button-foreground);
108+
font-size: 15px; line-height: 1;
109+
}
110+
#send:hover { background: var(--vscode-button-hoverBackground); }
111+
#send.stop { background: var(--vscode-button-secondaryBackground, rgba(127,127,127,.3)); color: var(--vscode-button-secondaryForeground, var(--vscode-foreground)); }
112+
113+
/* ---- status footer ---- */
114+
#status {
115+
display: flex; align-items: center; gap: 10px;
116+
padding: 5px 14px 8px; font-size: 11px; color: var(--muted);
117+
}
118+
#status .item { display: inline-flex; align-items: center; gap: 4px; }
29119
</style>
30120
</head>
31121
<body>
32-
<div id="log"><div id="empty">Ask Atom++ AI about your code.<br>Use <b>Add selection</b> (or ⌥⌘A) to send the selected code as context.</div></div>
33-
<div id="ctx"></div>
34-
<div id="bar">
35-
<div id="meta"><a id="model" title="Click to change model">…</a><span><a id="addsel">Add selection</a> · <a id="new">New chat</a></span></div>
36-
<div id="row">
37-
<textarea id="input" placeholder="Message Atom++ AI… (Enter to send, Shift+Enter for newline)"></textarea>
38-
<button id="send">Send</button>
39-
<button id="stop" class="secondary" style="display:none">Stop</button>
122+
<div id="log">
123+
<div id="empty">
124+
<div class="big">Atom++ AI</div>
125+
Ask about your code, or describe what to build.<br>
126+
The open file is sent as context. Add a selection with <b>+</b> or ⌥⌘A.
127+
</div>
128+
</div>
129+
130+
<div id="composer">
131+
<div id="chips"></div>
132+
<textarea id="input" rows="2" placeholder="Describe what to build"></textarea>
133+
<div id="toolbar">
134+
<div class="left">
135+
<button class="tbtn" id="attach" title="Add selected code as context (⌥⌘A)">+</button>
136+
<span class="sep"></span>
137+
<span class="pill static" id="mode" title="Chat mode. Agent mode is coming in M4.">
138+
<span class="mono">&lt;/&gt;</span> Chat
139+
</span>
140+
<span class="pill" id="model" title="Click to change model">Auto <span class="caret">▾</span></span>
141+
<button class="tbtn" id="settings" title="Atom++ AI settings">&#9776;</button>
142+
</div>
143+
<button id="send" title="Send (Enter)">&#8629;</button>
40144
</div>
41145
</div>
146+
147+
<div id="status">
148+
<span class="item" id="st-local" title="Requests go directly from your machine to the provider — no Atom++ backend.">🖥 Local</span>
149+
<span class="item" id="st-key" title="Bring your own API key, stored in your OS keychain.">🛡 Direct · BYO key</span>
150+
</div>
151+
42152
<script nonce="__NONCE__">
43153
const vscode = acquireVsCodeApi();
44154
const log = document.getElementById('log');
45155
const input = document.getElementById('input');
46156
const sendBtn = document.getElementById('send');
47-
const stopBtn = document.getElementById('stop');
48-
const ctxEl = document.getElementById('ctx');
157+
const chipsEl = document.getElementById('chips');
158+
const composer = document.getElementById('composer');
49159
const FENCE = String.fromCharCode(96, 96, 96);
50160
const TICK = String.fromCharCode(96);
51161
let current = null;
52-
let raw = '';
162+
let shown = ''; // text revealed in the bubble so far
163+
let pending = ''; // received from the model but not yet revealed (typewriter buffer)
164+
let animating = false; // is the rAF reveal loop running
165+
let doneSignaled = false;// model finished; finalize once the buffer drains
166+
let flushAll = false; // dump the whole buffer at once (on stop)
167+
let streaming = false;
53168
let activeFileLabel = null;
54169
let selLabel = null;
55170

56171
function esc(s){ return s.replace(/[&<>]/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;'}[c])); }
172+
173+
// "name.ext · 12 lines" -> badge from extension (JS, TS, PY…), capped at 3 chars.
174+
function badgeFor(label){
175+
const name = (label || '').split('·')[0].trim();
176+
const dot = name.lastIndexOf('.');
177+
if (dot < 0 || dot === name.length - 1) { return 'TXT'; }
178+
return name.slice(dot + 1).toUpperCase().slice(0, 3);
179+
}
180+
function fileChip(label){
181+
return '<span class="chip" title="' + esc(label) + ' — sent as context">' +
182+
'<span class="badge">' + esc(badgeFor(label)) + '</span>' +
183+
'<span class="name">' + esc(label.split('·')[0].trim()) + '</span></span>';
184+
}
185+
function selChip(label){
186+
return '<span class="chip" title="Selected code, sent as context">📎 <span class="name">' + esc(label) + '</span></span>';
187+
}
57188
function renderChips(){
58-
let h = '';
59-
if (activeFileLabel){ h += '<span class="chip" title="The open file is sent to the AI as context">📄 ' + esc(activeFileLabel) + '</span> '; }
60-
if (selLabel){ h += '<span class="chip">📎 ' + esc(selLabel) + '</span>'; }
61-
ctxEl.innerHTML = h;
189+
let h = '<button class="addchip" id="addctx" title="Add selected code as context (⌥⌘A)"><span class="plus">+</span> Add context</button>';
190+
if (activeFileLabel) { h += fileChip(activeFileLabel); }
191+
if (selLabel) { h += selChip(selLabel); }
192+
chipsEl.innerHTML = h;
193+
document.getElementById('addctx').onclick = () => vscode.postMessage({ type: 'addSelection' });
62194
}
195+
63196
function render(md){
64197
const parts = md.split(FENCE);
65198
let out = '';
@@ -81,31 +214,85 @@
81214
d.innerHTML = '<div class="role">' + (role === 'user' ? 'You' : 'Atom++ AI') + '</div><div class="body">' + html + '</div>';
82215
log.appendChild(d); log.scrollTop = log.scrollHeight; return d.querySelector('.body');
83216
}
217+
218+
// Typewriter reveal: deltas land in `pending`; this loop moves them into `shown`
219+
// at a steady pace so output flows in naturally instead of dumping in blocks.
220+
// It self-balances — a big backlog (fast model) is drained faster so it never lags far behind.
221+
function pump(){
222+
if (pending.length === 0){
223+
animating = false;
224+
if (doneSignaled){ doneSignaled = false; current = null; setStreaming(false); }
225+
return;
226+
}
227+
const backlog = pending.length;
228+
const take = flushAll ? backlog : Math.min(backlog, Math.max(3, Math.ceil(backlog / 20)));
229+
shown += pending.slice(0, take);
230+
pending = pending.slice(take);
231+
if (current){ current.innerHTML = render(shown); log.scrollTop = log.scrollHeight; }
232+
requestAnimationFrame(pump);
233+
}
234+
function ensurePump(){ if (!animating){ animating = true; requestAnimationFrame(pump); } }
235+
236+
function setStreaming(on){
237+
streaming = on;
238+
sendBtn.classList.toggle('stop', on);
239+
sendBtn.innerHTML = on ? '&#9632;' : '&#8629;'; // ■ while streaming, ↵ otherwise
240+
sendBtn.title = on ? 'Stop' : 'Send (Enter)';
241+
}
84242
function doSend(){
243+
if (streaming) { flushAll = true; ensurePump(); vscode.postMessage({ type: 'stop' }); return; }
85244
const t = input.value.trim(); if (!t) return;
86-
add('user', render(t)); input.value = ''; input.style.height = '34px';
245+
add('user', render(t)); input.value = ''; auto();
87246
vscode.postMessage({ type: 'send', text: t });
88247
}
248+
89249
sendBtn.onclick = doSend;
90-
stopBtn.onclick = () => vscode.postMessage({ type: 'stop' });
91-
document.getElementById('addsel').onclick = () => vscode.postMessage({ type: 'addSelection' });
92-
document.getElementById('new').onclick = () => vscode.postMessage({ type: 'newChat' });
250+
document.getElementById('attach').onclick = () => vscode.postMessage({ type: 'addSelection' });
93251
document.getElementById('model').onclick = () => vscode.postMessage({ type: 'pickModel' });
252+
document.getElementById('settings').onclick = () => vscode.postMessage({ type: 'openSettings' });
253+
94254
input.addEventListener('keydown', e => { if (e.key === 'Enter' && !e.shiftKey){ e.preventDefault(); doSend(); } });
95-
input.addEventListener('input', () => { input.style.height = '34px'; input.style.height = Math.min(input.scrollHeight, 140) + 'px'; });
255+
function auto(){ input.style.height = 'auto'; input.style.height = Math.min(input.scrollHeight, 200) + 'px'; }
256+
input.addEventListener('input', auto);
257+
input.addEventListener('focus', () => composer.classList.add('focused'));
258+
input.addEventListener('blur', () => composer.classList.remove('focused'));
96259

97260
window.addEventListener('message', ev => {
98261
const m = ev.data;
99-
if (m.type === 'config'){ document.getElementById('model').textContent = (m.provider === 'claude' ? 'Claude' : 'Ollama') + ' · ' + m.model + ' ▾'; }
100-
else if (m.type === 'assistantStart'){ raw = ''; current = add('assistant', ''); sendBtn.style.display = 'none'; stopBtn.style.display = ''; }
101-
else if (m.type === 'assistantDelta'){ raw += m.text; if (current){ current.innerHTML = render(raw); log.scrollTop = log.scrollHeight; } }
102-
else if (m.type === 'assistantDone'){ current = null; sendBtn.style.display = ''; stopBtn.style.display = 'none'; }
103-
else if (m.type === 'assistantError'){ add('assistant', '<span class="err">' + esc(m.message) + '</span>'); sendBtn.style.display = ''; stopBtn.style.display = 'none'; current = null; }
262+
if (m.type === 'config'){
263+
const label = m.provider === 'claude' ? prettyModel(m.model) : m.model;
264+
const mEl = document.getElementById('model');
265+
mEl.innerHTML = esc(label) + ' <span class="caret">▾</span>';
266+
mEl.title = (m.provider === 'claude' ? 'Claude' : 'Ollama') + ' · ' + m.model + ' — click to change';
267+
}
268+
else if (m.type === 'assistantStart'){ shown = ''; pending = ''; doneSignaled = false; flushAll = false; current = add('assistant', ''); setStreaming(true); }
269+
else if (m.type === 'assistantDelta'){ pending += m.text; ensurePump(); }
270+
else if (m.type === 'assistantDone'){ doneSignaled = true; ensurePump(); }
271+
else if (m.type === 'assistantError'){
272+
pending = ''; flushAll = false; doneSignaled = false;
273+
const html = '<span class="err">' + esc(m.message) + '</span>';
274+
if (current){ current.innerHTML = html; } else { add('assistant', html); }
275+
current = null; setStreaming(false);
276+
}
104277
else if (m.type === 'activeFile'){ activeFileLabel = m.label; renderChips(); }
105278
else if (m.type === 'context'){ selLabel = m.label; renderChips(); }
106279
else if (m.type === 'clearContext'){ selLabel = null; renderChips(); }
107-
else if (m.type === 'reset'){ log.innerHTML = '<div id="empty">New chat started.</div>'; selLabel = null; renderChips(); current = null; sendBtn.style.display = ''; stopBtn.style.display = 'none'; }
280+
else if (m.type === 'reset'){
281+
log.innerHTML = '<div id="empty"><div class="big">New chat</div>Ask about your code, or describe what to build.</div>';
282+
selLabel = null; renderChips();
283+
pending = ''; shown = ''; doneSignaled = false; flushAll = false; current = null; setStreaming(false);
284+
}
108285
});
286+
287+
function prettyModel(id){
288+
if (!id) return 'Auto';
289+
if (id.indexOf('opus') >= 0) return 'Opus 4.8';
290+
if (id.indexOf('sonnet') >= 0) return 'Sonnet 4.6';
291+
if (id.indexOf('haiku') >= 0) return 'Haiku 4.5';
292+
return id;
293+
}
294+
295+
renderChips();
109296
vscode.postMessage({ type: 'ready' });
110297
</script>
111298
</body>

0 commit comments

Comments
 (0)