omnikey-cli 1.0.26 → 1.0.28

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.
@@ -170,7 +170,7 @@ async function fetchPlainHttp(url, log) {
170
170
  // sites use redirects, 302s, custom error pages, or soft-blocks
171
171
  // rather than a clean 401/403, so checking status codes alone is
172
172
  // unreliable. Fall through to the browser-session path instead.
173
- if (isSelfHostedMacOS && (0, browser_playwright_1.isBrowserOpenWithUrl)(url, log)) {
173
+ if (isSelfHostedWithBrowserSession && (await (0, browser_playwright_1.isBrowserOpenWithUrl)(url, log))) {
174
174
  return { html: null, authBlocked: true, finalUrl: url };
175
175
  }
176
176
  if (status === 401 || status === 403) {
@@ -192,19 +192,19 @@ async function fetchFromActiveTab(url, log) {
192
192
  log.info('web_fetch: falling back to active-tab extraction', { url });
193
193
  return (0, browser_playwright_1.fetchWithPlaywright)(url, log);
194
194
  }
195
- const isSelfHostedMacOS = config_1.config.isSelfHosted && config_1.config.terminalPlatform === 'macos';
195
+ const isSelfHostedWithBrowserSession = config_1.config.isSelfHosted;
196
196
  async function executeWebFetch(url, log) {
197
197
  log.info('Executing web_fetch tool', { url });
198
198
  // ── Step 1: plain HTTP request ────────────────────────────────────────────
199
199
  const { html, authBlocked, finalUrl } = await fetchPlainHttp(url, log);
200
200
  const plainText = html ? stripHtml(html) : '';
201
- if (!isSelfHostedMacOS) {
201
+ if (!isSelfHostedWithBrowserSession) {
202
202
  if (authBlocked) {
203
- log.warn('Error: page requires authentication. Run OmniKey in self-hosted mode on macOS to enable browser-session access.');
203
+ log.warn('Error: page requires authentication. Run OmniKey in self-hosted mode on macOS or Windows to enable browser-session access.');
204
204
  }
205
205
  return plainText.slice(0, exports.MAX_TOOL_CONTENT_CHARS) || 'No content retrieved';
206
206
  }
207
- // ── Step 2 (self-hosted macOS only): LLM auth check on plain response ─────
207
+ // ── Step 2 (self-hosted desktop): LLM auth check on plain response ────────
208
208
  let looksUnauthenticated = false;
209
209
  if (!authBlocked && plainText) {
210
210
  log.info('web_fetch: performing LLM auth check on plain HTTP response', { url });
@@ -214,7 +214,7 @@ async function executeWebFetch(url, log) {
214
214
  }
215
215
  looksUnauthenticated = true;
216
216
  }
217
- // ── Step 3 (self-hosted macOS only): active-tab extraction ───────────────
217
+ // ── Step 3 (self-hosted desktop): active-tab extraction ──────────────────
218
218
  // Only attempted when there is evidence authentication is required.
219
219
  const needsAuth = authBlocked || looksUnauthenticated;
220
220
  if (needsAuth) {
@@ -226,7 +226,15 @@ async function executeWebFetch(url, log) {
226
226
  }
227
227
  // All strategies exhausted.
228
228
  if (authBlocked) {
229
- log.warn('Error: page requires authentication. Open the page in Chrome and ensure "Allow JavaScript from Apple Events" is enabled (View → Developer → Allow JavaScript from Apple Events).');
229
+ if (config_1.config.terminalPlatform === 'macos') {
230
+ log.warn('Error: page requires authentication. Open the page in Chrome and ensure "Allow JavaScript from Apple Events" is enabled (View → Developer → Allow JavaScript from Apple Events).');
231
+ }
232
+ else if (config_1.config.terminalPlatform === 'windows') {
233
+ log.warn('Error: page requires authentication. To enable live browser-session access on Windows, ' +
234
+ 'launch Chrome with --remote-debugging-port=9222: right-click your Chrome shortcut → Properties, ' +
235
+ 'and append "--remote-debugging-port=9222" to the Target field, then restart Chrome. ' +
236
+ 'OmniKey will then read the authenticated tab directly.');
237
+ }
230
238
  }
231
239
  return plainText.slice(0, exports.MAX_TOOL_CONTENT_CHARS) || 'No content retrieved';
232
240
  }