@andrewting19/oracle 0.9.2 → 0.9.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.
@@ -12,6 +12,7 @@ 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 } from "../browser/chromeLifecycle.js";
15
16
  async function findAvailablePort() {
16
17
  return await new Promise((resolve, reject) => {
17
18
  const srv = net.createServer();
@@ -151,6 +152,10 @@ export async function createRemoteServer(options = {}, deps = {}) {
151
152
  else {
152
153
  payload.browserConfig = {};
153
154
  }
155
+ // Route through shared Chrome instance (each run gets its own isolated tab).
156
+ if (options.sharedChrome) {
157
+ payload.browserConfig.remoteChrome = options.sharedChrome;
158
+ }
154
159
  // Enforce manual-login profile when cookie sync is unavailable (e.g., Windows/WSL).
155
160
  if (options.manualLoginDefault) {
156
161
  payload.browserConfig.manualLogin = true;
@@ -264,10 +269,38 @@ export async function serveRemote(options = {}) {
264
269
  else {
265
270
  console.log(`Detected ${cookies.length} ChatGPT cookies on this host; runs will reuse this session.`);
266
271
  }
272
+ // Launch a shared Chrome instance for concurrent tab-based runs.
273
+ let sharedChrome;
274
+ if (!preferManualLogin) {
275
+ try {
276
+ const userDataDir = await mkdtemp(path.join(os.tmpdir(), "oracle-serve-chrome-"));
277
+ const chrome = await launchChrome({ headless: false, hideWindow: true }, userDataDir, console.log);
278
+ sharedChrome = { host: "127.0.0.1", port: chrome.port };
279
+ console.log(`Shared Chrome launched (pid ${chrome.pid}, port ${chrome.port}). Concurrent runs will use isolated tabs.`);
280
+ // Clean up Chrome on process exit
281
+ const killChrome = async () => {
282
+ try {
283
+ await chrome.kill();
284
+ }
285
+ catch { }
286
+ try {
287
+ await rm(userDataDir, { recursive: true, force: true });
288
+ }
289
+ catch { }
290
+ };
291
+ process.on("SIGINT", () => void killChrome());
292
+ process.on("SIGTERM", () => void killChrome());
293
+ }
294
+ catch (error) {
295
+ const message = error instanceof Error ? error.message : String(error);
296
+ console.log(`Warning: failed to launch shared Chrome (${message}). Runs will each launch their own Chrome.`);
297
+ }
298
+ }
267
299
  const server = await createRemoteServer({
268
300
  ...options,
269
301
  manualLoginDefault: preferManualLogin,
270
302
  manualLoginProfileDir: manualProfileDir,
303
+ sharedChrome,
271
304
  });
272
305
  await new Promise((resolve) => {
273
306
  const shutdown = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrewting19/oracle",
3
- "version": "0.9.2",
3
+ "version": "0.9.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",