@andrewting19/oracle 0.9.7 → 0.9.9

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.
@@ -12,7 +12,6 @@ import { CHATGPT_URL } from "../browser/constants.js";
12
12
  import { getCliVersion } from "../version.js";
13
13
  import { cleanupStaleProfileState, readDevToolsPort, verifyDevToolsReachable, writeChromePid, writeDevToolsActivePort, } from "../browser/profileState.js";
14
14
  import { normalizeChatgptUrl } from "../browser/utils.js";
15
- import { launchChrome, connectToChrome } from "../browser/chromeLifecycle.js";
16
15
  async function findAvailablePort() {
17
16
  return await new Promise((resolve, reject) => {
18
17
  const srv = net.createServer();
@@ -274,13 +273,37 @@ export async function serveRemote(options = {}) {
274
273
  if (!preferManualLogin) {
275
274
  try {
276
275
  const userDataDir = await mkdtemp(path.join(os.tmpdir(), "oracle-serve-chrome-"));
277
- const chrome = await launchChrome({ headless: true }, userDataDir, console.log);
276
+ // Launch headed Chrome with --no-startup-window: no visible window, no focus stealing,
277
+ // but NOT headless (avoids Cloudflare fingerprinting). CDP creates tabs as needed.
278
+ const { launch: launchChromeRaw } = await import("chrome-launcher");
279
+ const chrome = await launchChromeRaw({
280
+ chromeFlags: [
281
+ "--no-startup-window",
282
+ "--no-first-run",
283
+ "--disable-background-networking",
284
+ "--disable-sync",
285
+ "--disable-translate",
286
+ "--disable-default-apps",
287
+ "--disable-hang-monitor",
288
+ "--disable-popup-blocking",
289
+ "--disable-features=TranslateUI,AutomationControlled",
290
+ "--mute-audio",
291
+ "--window-size=1280,720",
292
+ "--password-store=basic",
293
+ "--use-mock-keychain",
294
+ ],
295
+ userDataDir,
296
+ handleSIGINT: false,
297
+ });
278
298
  sharedChrome = { host: "127.0.0.1", port: chrome.port };
279
- console.log(`Shared Chrome launched headless (pid ${chrome.pid}, port ${chrome.port}). Concurrent runs will use isolated tabs.`);
299
+ console.log(`Shared Chrome launched (pid ${chrome.pid}, port ${chrome.port}, no-startup-window). Concurrent runs will use isolated tabs.`);
280
300
  // Sync ChatGPT cookies into the shared Chrome so all tabs are authenticated.
301
+ // With --no-startup-window, there are no targets. Create a temp tab to inject cookies.
281
302
  try {
282
303
  const { syncCookies } = await import("../browser/cookies.js");
283
- const client = await connectToChrome(chrome.port, console.log);
304
+ const CDP = (await import("chrome-remote-interface")).default;
305
+ const tempTarget = await CDP.New({ host: "127.0.0.1", port: chrome.port, url: "about:blank" });
306
+ const client = await CDP({ host: "127.0.0.1", port: chrome.port, target: tempTarget.id });
284
307
  const { Network } = client;
285
308
  await Network.enable({});
286
309
  const syncLogger = ((msg) => { if (msg)
@@ -291,6 +314,7 @@ export async function serveRemote(options = {}) {
291
314
  });
292
315
  console.log(`Synced ${count} ChatGPT cookies into shared Chrome.`);
293
316
  await client.close();
317
+ await CDP.Close({ host: "127.0.0.1", port: chrome.port, id: tempTarget.id });
294
318
  }
295
319
  catch (cookieErr) {
296
320
  const msg = cookieErr instanceof Error ? cookieErr.message : String(cookieErr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrewting19/oracle",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "CLI wrapper around OpenAI Responses API with GPT-5.4 Pro, GPT-5.4, GPT-5.2, GPT-5.1, and GPT-5.1 Codex high reasoning modes.",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/steipete/oracle#readme",