ask-pro 0.1.48 → 0.1.51

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.
@@ -471,7 +471,7 @@ function browserRuntimeMetadata(value) {
471
471
  return value !== null && typeof value === "object" ? value : {};
472
472
  }
473
473
  function isConversationUrl(value) {
474
- return /^https:\/\/chatgpt\.com\/c\/[a-z0-9-]+/i.test(value);
474
+ return /^https:\/\/chatgpt\.com\/c\/[a-z0-9-]+(?:[/?#]|$)/i.test(value);
475
475
  }
476
476
  function compactFields(fields) {
477
477
  return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));
@@ -1,4 +1,4 @@
1
- import { CLOUDFLARE_SCRIPT_SELECTOR, CLOUDFLARE_TITLE, INPUT_SELECTORS } from "../constants.js";
1
+ import { CLOUDFLARE_TITLE, INPUT_SELECTORS } from "../constants.js";
2
2
  import { delay } from "../utils.js";
3
3
  import { logDomFailure } from "../domDebug.js";
4
4
  import { BrowserAutomationError } from "../errors.js";
@@ -386,17 +386,18 @@ async function waitForPrompt(Runtime, timeoutMs) {
386
386
  return false;
387
387
  }
388
388
  async function isCloudflareInterstitial(Runtime) {
389
- const { result: titleResult } = await Runtime.evaluate({
390
- expression: "document.title",
391
- returnByValue: true,
392
- });
393
- const title = typeof titleResult.value === "string" ? titleResult.value : "";
394
- const challengeTitle = CLOUDFLARE_TITLE.toLowerCase();
395
- if (title.toLowerCase().includes(challengeTitle)) {
396
- return true;
397
- }
398
389
  const { result } = await Runtime.evaluate({
399
- expression: `Boolean(document.querySelector('${CLOUDFLARE_SCRIPT_SELECTOR}'))`,
390
+ expression: `(() => {
391
+ if (!document.title.toLowerCase().includes(${JSON.stringify(CLOUDFLARE_TITLE)})) return false;
392
+ const composers = document.querySelectorAll(${JSON.stringify(INPUT_SELECTORS.join(","))});
393
+ return !Array.from(composers).some((node) => {
394
+ if (node.hasAttribute('disabled') || node.closest('[hidden],[aria-hidden="true"],[inert]')) return false;
395
+ const style = getComputedStyle(node);
396
+ if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0') return false;
397
+ const rect = node.getBoundingClientRect();
398
+ return rect.width > 0 && rect.height > 0;
399
+ });
400
+ })()`,
400
401
  returnByValue: true,
401
402
  });
402
403
  return Boolean(result.value);
@@ -34,7 +34,6 @@ export const CONVERSATION_TURN_SELECTOR = 'article[data-testid^="conversation-tu
34
34
  "article[data-message-author-role], div[data-message-author-role], section[data-message-author-role], " +
35
35
  "article[data-turn], div[data-turn], section[data-turn]";
36
36
  export const ASSISTANT_ROLE_SELECTOR = '[data-message-author-role="assistant"], [data-turn="assistant"]';
37
- export const CLOUDFLARE_SCRIPT_SELECTOR = 'script[src*="/challenge-platform/"]';
38
37
  export const CLOUDFLARE_TITLE = "just a moment";
39
38
  export const PROMPT_PRIMARY_SELECTOR = "#prompt-textarea";
40
39
  export const PROMPT_FALLBACK_SELECTOR = 'textarea[name="prompt-textarea"]';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ask-pro",
3
- "version": "0.1.48",
3
+ "version": "0.1.51",
4
4
  "description": "Browser-backed ChatGPT Pro escalation for hard engineering questions.",
5
5
  "keywords": [
6
6
  "agents",