@causyne/agent 1.20.71 → 1.20.73

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@causyne/agent",
3
- "version": "1.20.71",
3
+ "version": "1.20.73",
4
4
  "description": "Agentic AI for software, tools, and computer workflows",
5
5
  "main": "bin/causyne.js",
6
6
  "type": "module",
Binary file
@@ -94,14 +94,22 @@ export async function exchangeCodeForApiKey(code, codeVerifier, fetchFn = fetch)
94
94
  return apiKey;
95
95
  }
96
96
  /**
97
- * Retrieve the Causyne Agent emblem logo as a binary buffer if available.
97
+ * Retrieve the Causyne Agent emblem logo encoded as Base64.
98
98
  */
99
99
  export function getLogoBuffer() {
100
100
  try {
101
101
  const currentDir = path.dirname(fileURLToPath(import.meta.url));
102
- const assetPath = path.resolve(currentDir, '../assets/logo.png');
103
- if (fs.existsSync(assetPath)) {
104
- return fs.readFileSync(assetPath);
102
+ const candidates = [
103
+ path.resolve(currentDir, '../assets/logo.png'),
104
+ path.resolve(currentDir, '../../assets/logo.png'),
105
+ path.resolve(currentDir, '../../../public/assets/logo-200.png'),
106
+ path.resolve(process.cwd(), 'src/assets/logo.png'),
107
+ path.resolve(process.cwd(), 'assets/logo.png')
108
+ ];
109
+ for (const candidate of candidates) {
110
+ if (fs.existsSync(candidate)) {
111
+ return fs.readFileSync(candidate);
112
+ }
105
113
  }
106
114
  }
107
115
  catch {
@@ -117,60 +125,69 @@ export function getLogoBase64() {
117
125
  return buf ? buf.toString('base64') : '';
118
126
  }
119
127
  /**
120
- * Render a professional branded HTML response page for OpenRouter OAuth callbacks.
128
+ * Render a professional branded HTML response page for OpenRouter OAuth callbacks
129
+ * following the exact visual style and design language of causyne.com.
121
130
  */
122
131
  export function renderAuthPage(options) {
123
132
  const isSuccess = options.status === 'success';
124
133
  const base64Logo = getLogoBase64();
125
134
  const logoSrc = base64Logo ? `data:image/png;base64,${base64Logo}` : '/logo.png';
126
135
  const badgeHtml = isSuccess
127
- ? '<div style="display:inline-flex;align-items:center;gap:8px;' +
128
- 'background:rgba(46,160,67,0.15);border:1px solid #2ea043;color:#3fb950;' +
129
- 'padding:6px 18px;border-radius:24px;font-size:13px;font-weight:600;margin-bottom:20px;">' +
136
+ ? '<div style="display:inline-flex;align-items:center;gap:6px;' +
137
+ 'background:rgba(157,240,40,0.12);border:1px solid rgba(157,240,40,0.35);color:#9df028;' +
138
+ 'padding:5px 14px;border-radius:4px;font-size:12px;font-family:\'SF Mono\',Menlo,monospace;font-weight:600;margin-bottom:20px;">' +
130
139
  '✓ Connected Successfully</div>'
131
- : '<div style="display:inline-flex;align-items:center;gap:8px;' +
132
- 'background:rgba(239,68,68,0.15);border:1px solid #ef4444;color:#f87171;' +
133
- 'padding:6px 18px;border-radius:24px;font-size:13px;font-weight:600;margin-bottom:20px;">' +
140
+ : '<div style="display:inline-flex;align-items:center;gap:6px;' +
141
+ 'background:rgba(239,83,80,0.12);border:1px solid rgba(239,83,80,0.35);color:#ef5350;' +
142
+ 'padding:5px 14px;border-radius:4px;font-size:12px;font-family:\'SF Mono\',Menlo,monospace;font-weight:600;margin-bottom:20px;">' +
134
143
  '✕ Authorization Failed</div>';
135
144
  const title = options.title || (isSuccess ? 'OpenRouter Account Authorized' : 'Authorization Error');
136
145
  const defaultMsg = isSuccess
137
- ? 'Your OpenRouter account has been connected to Causyne Agent. You can now close this tab and return to your terminal.'
146
+ ? 'Your OpenRouter account is now authorized and connected to Causyne Agent. You can close this window and return to your terminal.'
138
147
  : 'The authorization flow could not be completed.';
139
148
  const message = options.message || defaultMsg;
140
149
  const contentBox = isSuccess
141
- ? '<div style="background:rgba(255,255,255,0.03);border:1px solid rgba(255,255,255,0.08);' +
142
- 'border-radius:10px;padding:14px 18px;margin-bottom:28px;text-align:left;font-family:monospace;' +
143
- 'font-size:13px;color:#cbd5e1;">' +
144
- '<div style="display:flex;justify-content:space-between;margin-bottom:8px;">' +
145
- '<span style="color:#64748b;">Active Model</span>' +
150
+ ? '<div style="background:#191c19;border:1px solid rgba(255,255,255,0.07);' +
151
+ 'border-radius:6px;padding:14px 18px;margin-bottom:24px;text-align:left;font-family:\'SF Mono\',Menlo,Monaco,Consolas,monospace;' +
152
+ 'font-size:12px;line-height:1.7;color:#e4e8e0;">' +
153
+ '<div style="display:flex;justify-content:space-between;margin-bottom:6px;">' +
154
+ '<span style="color:#9da697;">Provider</span>' +
155
+ '<span style="color:#e4e8e0;font-weight:600;">OpenRouter</span>' +
156
+ '</div>' +
157
+ '<div style="display:flex;justify-content:space-between;margin-bottom:6px;">' +
158
+ '<span style="color:#9da697;">Active Model</span>' +
146
159
  `<span style="color:#9df028;font-weight:600;">${options.model || OPENROUTER_FREE_MODEL}</span>` +
147
160
  '</div>' +
148
161
  '<div style="display:flex;justify-content:space-between;">' +
149
- '<span style="color:#64748b;">Privacy Guard</span>' +
150
- '<span style="color:#38bdf8;">provider.data_collection = &quot;deny&quot;</span>' +
162
+ '<span style="color:#9da697;">Privacy Guard</span>' +
163
+ '<span style="color:#9da697;">provider.data_collection = &quot;deny&quot;</span>' +
151
164
  '</div>' +
152
165
  '</div>'
153
- : '<div style="background:rgba(239,68,68,0.08);border:1px solid rgba(239,68,68,0.25);' +
154
- 'border-radius:10px;padding:14px;color:#fca5a5;font-size:13px;line-height:1.5;margin-bottom:20px;' +
155
- `text-align:left;">${options.errorDetail || 'An unexpected error occurred during authorization.'}</div>` +
156
- '<div style="background:rgba(255,255,255,0.03);border:1px solid rgba(255,255,255,0.08);' +
157
- 'border-radius:10px;padding:16px;margin-bottom:24px;text-align:left;">' +
158
- '<div style="color:#ffffff;font-size:13px;font-weight:600;margin-bottom:8px;">Recommended Solutions:</div>' +
159
- '<ol style="color:#94a3b8;font-size:13px;line-height:1.6;margin:0;padding-left:18px;">' +
160
- '<li>Return to your terminal and select OpenRouter in the FREE tab again to retry.</li>' +
161
- '<li>Or create a free API key at <a href="https://openrouter.ai/keys" target="_blank" ' +
162
- 'style="color:#38bdf8;text-decoration:none;">openrouter.ai/keys</a> and configure it via:</li>' +
166
+ : '<div style="background:#191c19;border:1px solid rgba(239,83,80,0.25);' +
167
+ 'border-radius:6px;padding:14px;color:#fca5a5;font-size:13px;line-height:1.6;margin-bottom:20px;' +
168
+ `text-align:left;font-family:\'SF Mono\',Menlo,monospace;">${options.errorDetail || 'An unexpected error occurred during authorization.'}</div>` +
169
+ '<div style="background:#191c19;border:1px solid rgba(255,255,255,0.07);' +
170
+ 'border-radius:6px;padding:16px;margin-bottom:24px;text-align:left;font-size:13px;">' +
171
+ '<div style="color:#e4e8e0;font-weight:600;margin-bottom:8px;">Recommended Solutions:</div>' +
172
+ '<ol style="color:#9da697;line-height:1.6;margin:0;padding-left:18px;">' +
173
+ '<li>Return to your terminal and select OpenRouter in the FREE tab to retry.</li>' +
174
+ '<li>Or obtain a free API key at <a href="https://openrouter.ai/keys" target="_blank" ' +
175
+ 'style="color:#9df028;text-decoration:none;">openrouter.ai/keys</a> and connect directly via:</li>' +
163
176
  '</ol>' +
164
- '<pre style="background:#05070a;color:#9df028;padding:10px 14px;border-radius:6px;font-family:monospace;' +
165
- 'font-size:12px;margin-top:10px;overflow-x:auto;">causyne config set providerKeys.openrouter &lt;your-key&gt;</pre>' +
177
+ '<pre style="background:#141714;color:#9df028;padding:10px 14px;border-radius:4px;font-family:\'SF Mono\',Menlo,monospace;' +
178
+ 'font-size:12px;margin-top:10px;border:1px solid rgba(255,255,255,0.07);overflow-x:auto;">causyne config set providerKeys.openrouter &lt;your-key&gt;</pre>' +
166
179
  '</div>';
167
180
  const actionButton = isSuccess
168
- ? '<button onclick="window.close()" style="background:#9df028;color:#080b11;border:none;' +
169
- 'padding:12px 28px;border-radius:8px;font-size:14px;font-weight:700;cursor:pointer;font-family:inherit;">' +
181
+ ? '<button id="return-btn" onclick="returnToTerminal()" style="background:#9df028;color:#141714;border:none;' +
182
+ 'padding:11px 26px;border-radius:4px;font-size:13px;font-weight:700;cursor:pointer;' +
183
+ 'font-family:\'SF Mono\',Menlo,monospace;letter-spacing:0.5px;transition:background 0.15s ease;">' +
170
184
  'Return to Terminal</button>' +
171
- '<div style="font-size:12px;color:#64748b;margin-top:14px;">You can safely close this browser window.</div>'
172
- : '<button onclick="window.close()" style="background:#334155;color:#f8fafc;border:none;' +
173
- 'padding:10px 24px;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;">' +
185
+ '<div id="return-hint" style="font-size:12px;color:#60685b;margin-top:14px;line-height:1.5;">' +
186
+ 'Authentication complete. You can close this browser tab (⌘W / Ctrl+W) and switch back to your terminal.' +
187
+ '</div>'
188
+ : '<button onclick="window.close()" style="background:#202421;color:#e4e8e0;border:1px solid rgba(255,255,255,0.15);' +
189
+ 'padding:10px 22px;border-radius:4px;font-size:13px;font-weight:600;cursor:pointer;' +
190
+ 'font-family:\'SF Mono\',Menlo,monospace;">' +
174
191
  'Close Window</button>';
175
192
  return `<!DOCTYPE html>
176
193
  <html lang="en">
@@ -179,11 +196,11 @@ export function renderAuthPage(options) {
179
196
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
180
197
  <title>Causyne Agent Connected Successfully</title>
181
198
  <style>
182
- * { box-sizing: border-box; margin: 0; padding: 0; }
199
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
183
200
  body {
184
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
185
- background: #080b11 radial-gradient(circle at 50% 20%, #152238 0%, #080b11 75%);
186
- color: #c9d1d9;
201
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
202
+ background-color: #141714;
203
+ color: #e4e8e0;
187
204
  min-height: 100vh;
188
205
  display: flex;
189
206
  align-items: center;
@@ -191,7 +208,7 @@ export function renderAuthPage(options) {
191
208
  padding: 24px;
192
209
  }
193
210
  .container {
194
- max-width: 540px;
211
+ max-width: 500px;
195
212
  width: 100%;
196
213
  text-align: center;
197
214
  }
@@ -199,53 +216,75 @@ export function renderAuthPage(options) {
199
216
  display: flex;
200
217
  align-items: center;
201
218
  justify-content: center;
202
- gap: 16px;
203
- margin-bottom: 28px;
219
+ gap: 14px;
220
+ margin-bottom: 24px;
204
221
  }
205
222
  .logo {
206
- width: 52px;
207
- height: 52px;
223
+ width: 40px;
224
+ height: 40px;
208
225
  object-fit: contain;
209
- border-radius: 12px;
210
- filter: drop-shadow(0 4px 16px rgba(157, 240, 40, 0.3));
211
226
  }
212
227
  .brand-title {
213
- font-family: "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
214
- font-size: 24px;
228
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
229
+ font-size: 20px;
215
230
  font-weight: 800;
216
231
  letter-spacing: 1.5px;
217
- color: #ffffff;
232
+ color: #e4e8e0;
218
233
  line-height: 1.2;
234
+ text-align: left;
219
235
  }
220
236
  .brand-subtitle {
237
+ font-family: 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
221
238
  font-size: 11px;
222
- color: #8a99a8;
223
- letter-spacing: 1px;
224
- text-transform: uppercase;
239
+ color: #9da697;
240
+ letter-spacing: 0.5px;
225
241
  margin-top: 2px;
226
242
  text-align: left;
227
243
  }
244
+ .brand-slogan {
245
+ font-family: 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
246
+ font-size: 11px;
247
+ color: #60685b;
248
+ margin-top: 1px;
249
+ text-align: left;
250
+ }
228
251
  .card {
229
- background: rgba(18, 25, 38, 0.95);
230
- border: 1px solid rgba(157, 240, 40, 0.22);
231
- border-radius: 16px;
232
- padding: 36px 32px;
233
- box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
234
- backdrop-filter: blur(16px);
252
+ background: #202421;
253
+ border: 1px solid rgba(255, 255, 255, 0.08);
254
+ border-radius: 8px;
255
+ padding: 32px 28px;
235
256
  }
236
257
  h1 {
237
- color: #ffffff;
238
- font-size: 21px;
258
+ color: #e4e8e0;
259
+ font-size: 19px;
239
260
  font-weight: 700;
240
- margin-bottom: 12px;
261
+ margin-bottom: 10px;
262
+ letter-spacing: -0.2px;
241
263
  }
242
264
  p {
243
- color: #94a3b8;
244
- font-size: 14px;
265
+ color: #9da697;
266
+ font-size: 13px;
245
267
  line-height: 1.6;
246
- margin-bottom: 24px;
268
+ margin-bottom: 22px;
247
269
  }
248
270
  </style>
271
+ <script>
272
+ function returnToTerminal() {
273
+ try {
274
+ window.open('', '_self', '');
275
+ window.close();
276
+ } catch (e) {}
277
+ var btn = document.getElementById('return-btn');
278
+ if (btn) {
279
+ btn.textContent = '✓ Ready! Switch to Terminal';
280
+ btn.style.background = '#8ea954';
281
+ }
282
+ var hint = document.getElementById('return-hint');
283
+ if (hint) {
284
+ hint.innerHTML = '<span style="color:#B5D66A;font-weight:600;">Authentication complete!</span> Switch back to your terminal window (Cmd+Tab / Alt+Tab). You can close this tab (Cmd+W / Ctrl+W).';
285
+ }
286
+ }
287
+ </script>
249
288
  </head>
250
289
  <body>
251
290
  <div class="container">
@@ -253,7 +292,8 @@ export function renderAuthPage(options) {
253
292
  <img src="${logoSrc}" alt="Causyne Agent Logo" class="logo" />
254
293
  <div>
255
294
  <div class="brand-title">CAUSYNE <span style="color:#9df028;">AGENT</span></div>
256
- <div class="brand-subtitle">Autonomous AI Harness</div>
295
+ <div class="brand-subtitle">Agentic AI Harness</div>
296
+ <div class="brand-slogan">From intention to meaningful progress.</div>
257
297
  </div>
258
298
  </div>
259
299
  <div class="card">
@@ -449,10 +489,30 @@ export function disconnectOpenRouter(store = { loadConfig, saveConfig }) {
449
489
  };
450
490
  delete providerKeys['openrouter'];
451
491
  currentConfig.providerKeys = providerKeys;
492
+ if (process.env.OPENROUTER_API_KEY) {
493
+ delete process.env.OPENROUTER_API_KEY;
494
+ }
452
495
  if (currentConfig.provider === 'openrouter') {
453
- currentConfig.provider = 'deepseek';
454
- currentConfig.model = 'deepseek-chat';
455
- currentConfig.apiKey = providerKeys['deepseek'] || '';
496
+ if (providerKeys['deepseek']) {
497
+ currentConfig.provider = 'deepseek';
498
+ currentConfig.model = 'deepseek-chat';
499
+ currentConfig.apiKey = providerKeys['deepseek'];
500
+ }
501
+ else if (providerKeys['anthropic']) {
502
+ currentConfig.provider = 'anthropic';
503
+ currentConfig.model = 'claude-3-7-sonnet';
504
+ currentConfig.apiKey = providerKeys['anthropic'];
505
+ }
506
+ else if (providerKeys['openai']) {
507
+ currentConfig.provider = 'openai';
508
+ currentConfig.model = 'gpt-4o';
509
+ currentConfig.apiKey = providerKeys['openai'];
510
+ }
511
+ else {
512
+ currentConfig.provider = 'antigravity';
513
+ currentConfig.model = 'Gemini 3.8 Flash (Low)';
514
+ currentConfig.apiKey = '';
515
+ }
456
516
  }
457
517
  store.saveConfig(currentConfig);
458
518
  return currentConfig;
@@ -129,14 +129,22 @@ export async function exchangeCodeForApiKey(
129
129
  }
130
130
 
131
131
  /**
132
- * Retrieve the Causyne Agent emblem logo as a binary buffer if available.
132
+ * Retrieve the Causyne Agent emblem logo encoded as Base64.
133
133
  */
134
134
  export function getLogoBuffer(): Buffer | null {
135
135
  try {
136
136
  const currentDir = path.dirname(fileURLToPath(import.meta.url));
137
- const assetPath = path.resolve(currentDir, '../assets/logo.png');
138
- if (fs.existsSync(assetPath)) {
139
- return fs.readFileSync(assetPath);
137
+ const candidates = [
138
+ path.resolve(currentDir, '../assets/logo.png'),
139
+ path.resolve(currentDir, '../../assets/logo.png'),
140
+ path.resolve(currentDir, '../../../public/assets/logo-200.png'),
141
+ path.resolve(process.cwd(), 'src/assets/logo.png'),
142
+ path.resolve(process.cwd(), 'assets/logo.png')
143
+ ];
144
+ for (const candidate of candidates) {
145
+ if (fs.existsSync(candidate)) {
146
+ return fs.readFileSync(candidate);
147
+ }
140
148
  }
141
149
  } catch {
142
150
  // Ignore read errors
@@ -161,7 +169,8 @@ export interface RenderAuthPageOptions {
161
169
  }
162
170
 
163
171
  /**
164
- * Render a professional branded HTML response page for OpenRouter OAuth callbacks.
172
+ * Render a professional branded HTML response page for OpenRouter OAuth callbacks
173
+ * following the exact visual style and design language of causyne.com.
165
174
  */
166
175
  export function renderAuthPage(options: RenderAuthPageOptions): string {
167
176
  const isSuccess = options.status === 'success';
@@ -169,56 +178,64 @@ export function renderAuthPage(options: RenderAuthPageOptions): string {
169
178
  const logoSrc = base64Logo ? `data:image/png;base64,${base64Logo}` : '/logo.png';
170
179
 
171
180
  const badgeHtml = isSuccess
172
- ? '<div style="display:inline-flex;align-items:center;gap:8px;' +
173
- 'background:rgba(46,160,67,0.15);border:1px solid #2ea043;color:#3fb950;' +
174
- 'padding:6px 18px;border-radius:24px;font-size:13px;font-weight:600;margin-bottom:20px;">' +
181
+ ? '<div style="display:inline-flex;align-items:center;gap:6px;' +
182
+ 'background:rgba(157,240,40,0.12);border:1px solid rgba(157,240,40,0.35);color:#9df028;' +
183
+ 'padding:5px 14px;border-radius:4px;font-size:12px;font-family:\'SF Mono\',Menlo,monospace;font-weight:600;margin-bottom:20px;">' +
175
184
  '✓ Connected Successfully</div>'
176
- : '<div style="display:inline-flex;align-items:center;gap:8px;' +
177
- 'background:rgba(239,68,68,0.15);border:1px solid #ef4444;color:#f87171;' +
178
- 'padding:6px 18px;border-radius:24px;font-size:13px;font-weight:600;margin-bottom:20px;">' +
185
+ : '<div style="display:inline-flex;align-items:center;gap:6px;' +
186
+ 'background:rgba(239,83,80,0.12);border:1px solid rgba(239,83,80,0.35);color:#ef5350;' +
187
+ 'padding:5px 14px;border-radius:4px;font-size:12px;font-family:\'SF Mono\',Menlo,monospace;font-weight:600;margin-bottom:20px;">' +
179
188
  '✕ Authorization Failed</div>';
180
189
 
181
190
  const title = options.title || (isSuccess ? 'OpenRouter Account Authorized' : 'Authorization Error');
182
191
  const defaultMsg = isSuccess
183
- ? 'Your OpenRouter account has been connected to Causyne Agent. You can now close this tab and return to your terminal.'
192
+ ? 'Your OpenRouter account is now authorized and connected to Causyne Agent. You can close this window and return to your terminal.'
184
193
  : 'The authorization flow could not be completed.';
185
194
  const message = options.message || defaultMsg;
186
195
 
187
196
  const contentBox = isSuccess
188
- ? '<div style="background:rgba(255,255,255,0.03);border:1px solid rgba(255,255,255,0.08);' +
189
- 'border-radius:10px;padding:14px 18px;margin-bottom:28px;text-align:left;font-family:monospace;' +
190
- 'font-size:13px;color:#cbd5e1;">' +
191
- '<div style="display:flex;justify-content:space-between;margin-bottom:8px;">' +
192
- '<span style="color:#64748b;">Active Model</span>' +
197
+ ? '<div style="background:#191c19;border:1px solid rgba(255,255,255,0.07);' +
198
+ 'border-radius:6px;padding:14px 18px;margin-bottom:24px;text-align:left;font-family:\'SF Mono\',Menlo,Monaco,Consolas,monospace;' +
199
+ 'font-size:12px;line-height:1.7;color:#e4e8e0;">' +
200
+ '<div style="display:flex;justify-content:space-between;margin-bottom:6px;">' +
201
+ '<span style="color:#9da697;">Provider</span>' +
202
+ '<span style="color:#e4e8e0;font-weight:600;">OpenRouter</span>' +
203
+ '</div>' +
204
+ '<div style="display:flex;justify-content:space-between;margin-bottom:6px;">' +
205
+ '<span style="color:#9da697;">Active Model</span>' +
193
206
  `<span style="color:#9df028;font-weight:600;">${options.model || OPENROUTER_FREE_MODEL}</span>` +
194
207
  '</div>' +
195
208
  '<div style="display:flex;justify-content:space-between;">' +
196
- '<span style="color:#64748b;">Privacy Guard</span>' +
197
- '<span style="color:#38bdf8;">provider.data_collection = &quot;deny&quot;</span>' +
209
+ '<span style="color:#9da697;">Privacy Guard</span>' +
210
+ '<span style="color:#9da697;">provider.data_collection = &quot;deny&quot;</span>' +
198
211
  '</div>' +
199
212
  '</div>'
200
- : '<div style="background:rgba(239,68,68,0.08);border:1px solid rgba(239,68,68,0.25);' +
201
- 'border-radius:10px;padding:14px;color:#fca5a5;font-size:13px;line-height:1.5;margin-bottom:20px;' +
202
- `text-align:left;">${options.errorDetail || 'An unexpected error occurred during authorization.'}</div>` +
203
- '<div style="background:rgba(255,255,255,0.03);border:1px solid rgba(255,255,255,0.08);' +
204
- 'border-radius:10px;padding:16px;margin-bottom:24px;text-align:left;">' +
205
- '<div style="color:#ffffff;font-size:13px;font-weight:600;margin-bottom:8px;">Recommended Solutions:</div>' +
206
- '<ol style="color:#94a3b8;font-size:13px;line-height:1.6;margin:0;padding-left:18px;">' +
207
- '<li>Return to your terminal and select OpenRouter in the FREE tab again to retry.</li>' +
208
- '<li>Or create a free API key at <a href="https://openrouter.ai/keys" target="_blank" ' +
209
- 'style="color:#38bdf8;text-decoration:none;">openrouter.ai/keys</a> and configure it via:</li>' +
213
+ : '<div style="background:#191c19;border:1px solid rgba(239,83,80,0.25);' +
214
+ 'border-radius:6px;padding:14px;color:#fca5a5;font-size:13px;line-height:1.6;margin-bottom:20px;' +
215
+ `text-align:left;font-family:\'SF Mono\',Menlo,monospace;">${options.errorDetail || 'An unexpected error occurred during authorization.'}</div>` +
216
+ '<div style="background:#191c19;border:1px solid rgba(255,255,255,0.07);' +
217
+ 'border-radius:6px;padding:16px;margin-bottom:24px;text-align:left;font-size:13px;">' +
218
+ '<div style="color:#e4e8e0;font-weight:600;margin-bottom:8px;">Recommended Solutions:</div>' +
219
+ '<ol style="color:#9da697;line-height:1.6;margin:0;padding-left:18px;">' +
220
+ '<li>Return to your terminal and select OpenRouter in the FREE tab to retry.</li>' +
221
+ '<li>Or obtain a free API key at <a href="https://openrouter.ai/keys" target="_blank" ' +
222
+ 'style="color:#9df028;text-decoration:none;">openrouter.ai/keys</a> and connect directly via:</li>' +
210
223
  '</ol>' +
211
- '<pre style="background:#05070a;color:#9df028;padding:10px 14px;border-radius:6px;font-family:monospace;' +
212
- 'font-size:12px;margin-top:10px;overflow-x:auto;">causyne config set providerKeys.openrouter &lt;your-key&gt;</pre>' +
224
+ '<pre style="background:#141714;color:#9df028;padding:10px 14px;border-radius:4px;font-family:\'SF Mono\',Menlo,monospace;' +
225
+ 'font-size:12px;margin-top:10px;border:1px solid rgba(255,255,255,0.07);overflow-x:auto;">causyne config set providerKeys.openrouter &lt;your-key&gt;</pre>' +
213
226
  '</div>';
214
227
 
215
228
  const actionButton = isSuccess
216
- ? '<button onclick="window.close()" style="background:#9df028;color:#080b11;border:none;' +
217
- 'padding:12px 28px;border-radius:8px;font-size:14px;font-weight:700;cursor:pointer;font-family:inherit;">' +
229
+ ? '<button id="return-btn" onclick="returnToTerminal()" style="background:#9df028;color:#141714;border:none;' +
230
+ 'padding:11px 26px;border-radius:4px;font-size:13px;font-weight:700;cursor:pointer;' +
231
+ 'font-family:\'SF Mono\',Menlo,monospace;letter-spacing:0.5px;transition:background 0.15s ease;">' +
218
232
  'Return to Terminal</button>' +
219
- '<div style="font-size:12px;color:#64748b;margin-top:14px;">You can safely close this browser window.</div>'
220
- : '<button onclick="window.close()" style="background:#334155;color:#f8fafc;border:none;' +
221
- 'padding:10px 24px;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;">' +
233
+ '<div id="return-hint" style="font-size:12px;color:#60685b;margin-top:14px;line-height:1.5;">' +
234
+ 'Authentication complete. You can close this browser tab (⌘W / Ctrl+W) and switch back to your terminal.' +
235
+ '</div>'
236
+ : '<button onclick="window.close()" style="background:#202421;color:#e4e8e0;border:1px solid rgba(255,255,255,0.15);' +
237
+ 'padding:10px 22px;border-radius:4px;font-size:13px;font-weight:600;cursor:pointer;' +
238
+ 'font-family:\'SF Mono\',Menlo,monospace;">' +
222
239
  'Close Window</button>';
223
240
 
224
241
  return `<!DOCTYPE html>
@@ -228,11 +245,11 @@ export function renderAuthPage(options: RenderAuthPageOptions): string {
228
245
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
229
246
  <title>Causyne Agent Connected Successfully</title>
230
247
  <style>
231
- * { box-sizing: border-box; margin: 0; padding: 0; }
248
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
232
249
  body {
233
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
234
- background: #080b11 radial-gradient(circle at 50% 20%, #152238 0%, #080b11 75%);
235
- color: #c9d1d9;
250
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
251
+ background-color: #141714;
252
+ color: #e4e8e0;
236
253
  min-height: 100vh;
237
254
  display: flex;
238
255
  align-items: center;
@@ -240,7 +257,7 @@ export function renderAuthPage(options: RenderAuthPageOptions): string {
240
257
  padding: 24px;
241
258
  }
242
259
  .container {
243
- max-width: 540px;
260
+ max-width: 500px;
244
261
  width: 100%;
245
262
  text-align: center;
246
263
  }
@@ -248,53 +265,75 @@ export function renderAuthPage(options: RenderAuthPageOptions): string {
248
265
  display: flex;
249
266
  align-items: center;
250
267
  justify-content: center;
251
- gap: 16px;
252
- margin-bottom: 28px;
268
+ gap: 14px;
269
+ margin-bottom: 24px;
253
270
  }
254
271
  .logo {
255
- width: 52px;
256
- height: 52px;
272
+ width: 40px;
273
+ height: 40px;
257
274
  object-fit: contain;
258
- border-radius: 12px;
259
- filter: drop-shadow(0 4px 16px rgba(157, 240, 40, 0.3));
260
275
  }
261
276
  .brand-title {
262
- font-family: "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
263
- font-size: 24px;
277
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
278
+ font-size: 20px;
264
279
  font-weight: 800;
265
280
  letter-spacing: 1.5px;
266
- color: #ffffff;
281
+ color: #e4e8e0;
267
282
  line-height: 1.2;
283
+ text-align: left;
268
284
  }
269
285
  .brand-subtitle {
286
+ font-family: 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
270
287
  font-size: 11px;
271
- color: #8a99a8;
272
- letter-spacing: 1px;
273
- text-transform: uppercase;
288
+ color: #9da697;
289
+ letter-spacing: 0.5px;
274
290
  margin-top: 2px;
275
291
  text-align: left;
276
292
  }
293
+ .brand-slogan {
294
+ font-family: 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
295
+ font-size: 11px;
296
+ color: #60685b;
297
+ margin-top: 1px;
298
+ text-align: left;
299
+ }
277
300
  .card {
278
- background: rgba(18, 25, 38, 0.95);
279
- border: 1px solid rgba(157, 240, 40, 0.22);
280
- border-radius: 16px;
281
- padding: 36px 32px;
282
- box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
283
- backdrop-filter: blur(16px);
301
+ background: #202421;
302
+ border: 1px solid rgba(255, 255, 255, 0.08);
303
+ border-radius: 8px;
304
+ padding: 32px 28px;
284
305
  }
285
306
  h1 {
286
- color: #ffffff;
287
- font-size: 21px;
307
+ color: #e4e8e0;
308
+ font-size: 19px;
288
309
  font-weight: 700;
289
- margin-bottom: 12px;
310
+ margin-bottom: 10px;
311
+ letter-spacing: -0.2px;
290
312
  }
291
313
  p {
292
- color: #94a3b8;
293
- font-size: 14px;
314
+ color: #9da697;
315
+ font-size: 13px;
294
316
  line-height: 1.6;
295
- margin-bottom: 24px;
317
+ margin-bottom: 22px;
296
318
  }
297
319
  </style>
320
+ <script>
321
+ function returnToTerminal() {
322
+ try {
323
+ window.open('', '_self', '');
324
+ window.close();
325
+ } catch (e) {}
326
+ var btn = document.getElementById('return-btn');
327
+ if (btn) {
328
+ btn.textContent = '✓ Ready! Switch to Terminal';
329
+ btn.style.background = '#8ea954';
330
+ }
331
+ var hint = document.getElementById('return-hint');
332
+ if (hint) {
333
+ hint.innerHTML = '<span style="color:#B5D66A;font-weight:600;">Authentication complete!</span> Switch back to your terminal window (Cmd+Tab / Alt+Tab). You can close this tab (Cmd+W / Ctrl+W).';
334
+ }
335
+ }
336
+ </script>
298
337
  </head>
299
338
  <body>
300
339
  <div class="container">
@@ -302,7 +341,8 @@ export function renderAuthPage(options: RenderAuthPageOptions): string {
302
341
  <img src="${logoSrc}" alt="Causyne Agent Logo" class="logo" />
303
342
  <div>
304
343
  <div class="brand-title">CAUSYNE <span style="color:#9df028;">AGENT</span></div>
305
- <div class="brand-subtitle">Autonomous AI Harness</div>
344
+ <div class="brand-subtitle">Agentic AI Harness</div>
345
+ <div class="brand-slogan">From intention to meaningful progress.</div>
306
346
  </div>
307
347
  </div>
308
348
  <div class="card">
@@ -531,7 +571,9 @@ export function saveOpenRouterKey(
531
571
  /**
532
572
  * Disconnect OpenRouter credentials from local vault.
533
573
  */
534
- export function disconnectOpenRouter(store: { loadConfig(): any; saveConfig(cfg: any): void } = { loadConfig, saveConfig }): Record<string, any> {
574
+ export function disconnectOpenRouter(
575
+ store: { loadConfig(): any; saveConfig(cfg: any): void } = { loadConfig, saveConfig }
576
+ ): Record<string, any> {
535
577
  const currentConfig = store.loadConfig() || {};
536
578
  const providerKeys = {
537
579
  ...(currentConfig.providerKeys && typeof currentConfig.providerKeys === 'object' ? currentConfig.providerKeys : {})
@@ -540,10 +582,28 @@ export function disconnectOpenRouter(store: { loadConfig(): any; saveConfig(cfg:
540
582
  delete providerKeys['openrouter'];
541
583
  currentConfig.providerKeys = providerKeys;
542
584
 
585
+ if (process.env.OPENROUTER_API_KEY) {
586
+ delete process.env.OPENROUTER_API_KEY;
587
+ }
588
+
543
589
  if (currentConfig.provider === 'openrouter') {
544
- currentConfig.provider = 'deepseek';
545
- currentConfig.model = 'deepseek-chat';
546
- currentConfig.apiKey = providerKeys['deepseek'] || '';
590
+ if (providerKeys['deepseek']) {
591
+ currentConfig.provider = 'deepseek';
592
+ currentConfig.model = 'deepseek-chat';
593
+ currentConfig.apiKey = providerKeys['deepseek'];
594
+ } else if (providerKeys['anthropic']) {
595
+ currentConfig.provider = 'anthropic';
596
+ currentConfig.model = 'claude-3-7-sonnet';
597
+ currentConfig.apiKey = providerKeys['anthropic'];
598
+ } else if (providerKeys['openai']) {
599
+ currentConfig.provider = 'openai';
600
+ currentConfig.model = 'gpt-4o';
601
+ currentConfig.apiKey = providerKeys['openai'];
602
+ } else {
603
+ currentConfig.provider = 'antigravity';
604
+ currentConfig.model = 'Gemini 3.8 Flash (Low)';
605
+ currentConfig.apiKey = '';
606
+ }
547
607
  }
548
608
 
549
609
  store.saveConfig(currentConfig);