@andrewting19/oracle 0.10.2 → 0.10.3

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.
@@ -158,14 +158,24 @@ async function connectToNewTarget(host, port, url, logger, messages, rootSession
158
158
  try {
159
159
  let target;
160
160
  if (rootSession) {
161
- // Hidden target: not in tab strip, no window, no focus steal.
161
+ // Try hidden target (no tab strip, no window), fall back to background+focus:false.
162
162
  // Lifetime tied to rootSession (kept alive by the serve).
163
- const result = await rootSession.Target.createTarget({
164
- url,
165
- hidden: true,
166
- background: true,
167
- });
168
- target = { id: result.targetId };
163
+ try {
164
+ const result = await rootSession.Target.createTarget({
165
+ url,
166
+ hidden: true,
167
+ background: true,
168
+ });
169
+ target = { id: result.targetId };
170
+ }
171
+ catch {
172
+ const result = await rootSession.Target.createTarget({
173
+ url,
174
+ background: true,
175
+ focus: false,
176
+ });
177
+ target = { id: result.targetId };
178
+ }
169
179
  }
170
180
  else {
171
181
  // No root session: try background + focus:false, fallback to CDP.New()
@@ -290,6 +290,7 @@ export async function serveRemote(options = {}) {
290
290
  "--disable-hang-monitor",
291
291
  "--disable-popup-blocking",
292
292
  "--disable-features=TranslateUI,AutomationControlled",
293
+ "--remote-allow-origins=*",
293
294
  "--mute-audio",
294
295
  "--window-size=1280,720",
295
296
  "--password-store=basic",
@@ -313,15 +314,30 @@ export async function serveRemote(options = {}) {
313
314
  console.log(`Root CDP session connecting to ${browserWsUrl}`);
314
315
  const rootSession = await CDP({ target: browserWsUrl });
315
316
  sharedRootSession = rootSession;
316
- // Sync ChatGPT cookies into the shared Chrome via a hidden target.
317
+ // Sync ChatGPT cookies into the shared Chrome via a background target.
318
+ // Try hidden first (no tab strip / no window), fall back to background+focus:false.
317
319
  try {
318
320
  const { syncCookies } = await import("../browser/cookies.js");
319
- const { targetId } = await rootSession.Target.createTarget({
320
- url: "about:blank",
321
- hidden: true,
322
- background: true,
323
- });
324
- const syncClient = await CDP({ host: "127.0.0.1", port: chrome.port, target: targetId });
321
+ let syncTargetId;
322
+ try {
323
+ const result = await rootSession.Target.createTarget({
324
+ url: "about:blank",
325
+ hidden: true,
326
+ background: true,
327
+ });
328
+ syncTargetId = result.targetId;
329
+ console.log("Cookie sync: created hidden target.");
330
+ }
331
+ catch {
332
+ const result = await rootSession.Target.createTarget({
333
+ url: "about:blank",
334
+ background: true,
335
+ focus: false,
336
+ });
337
+ syncTargetId = result.targetId;
338
+ console.log("Cookie sync: hidden targets unavailable, using background+focus:false.");
339
+ }
340
+ const syncClient = await CDP({ host: "127.0.0.1", port: chrome.port, target: syncTargetId });
325
341
  const { Network } = syncClient;
326
342
  await Network.enable({});
327
343
  const syncLogger = ((msg) => { if (msg)
@@ -332,7 +348,7 @@ export async function serveRemote(options = {}) {
332
348
  });
333
349
  console.log(`Synced ${count} ChatGPT cookies into shared Chrome.`);
334
350
  await syncClient.close();
335
- await rootSession.Target.closeTarget({ targetId });
351
+ await rootSession.Target.closeTarget({ targetId: syncTargetId });
336
352
  }
337
353
  catch (cookieErr) {
338
354
  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.10.2",
3
+ "version": "0.10.3",
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",