ask-pro 0.1.49 → 0.1.53
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.
package/README.md
CHANGED
|
@@ -71,7 +71,8 @@ Ask for a recoverable repo consult:
|
|
|
71
71
|
ask-pro --no-temporary --prompt-file question.md --files src --files tests
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
ask-pro selects `Latest`
|
|
74
|
+
ask-pro selects `Latest` when available, otherwise the highest numbered available
|
|
75
|
+
GPT model, with `Pro` intelligence. It has no repo or conversation
|
|
75
76
|
context unless you provide it, so keep the prompt and file bundle focused.
|
|
76
77
|
|
|
77
78
|
Request generated files only when needed; treat them as data and never execute
|
|
@@ -269,7 +269,7 @@ function buildModelSelectionExpression(targetModel, strategy) {
|
|
|
269
269
|
return { status: 'already-selected', label };
|
|
270
270
|
}
|
|
271
271
|
const buttonMatchesTarget = () => {
|
|
272
|
-
// The
|
|
272
|
+
// The composer pill cannot prove that the newest available model is selected.
|
|
273
273
|
if (normalizedTarget === 'latest') return false;
|
|
274
274
|
const normalizedLabel = normalize(getButtonLabel());
|
|
275
275
|
if (!normalizedLabel) return false;
|
|
@@ -446,14 +446,24 @@ function buildModelSelectionExpression(targetModel, strategy) {
|
|
|
446
446
|
testid.toLowerCase().includes('submenu') ||
|
|
447
447
|
option.getAttribute('data-has-submenu') !== null ||
|
|
448
448
|
option.getAttribute('aria-haspopup') === 'menu';
|
|
449
|
-
|
|
449
|
+
if (normalizedTarget === 'latest') {
|
|
450
|
+
const rect = option.getBoundingClientRect();
|
|
451
|
+
if (isSubmenu || rect.width <= 0 || rect.height <= 0 ||
|
|
452
|
+
option.getAttribute('aria-disabled') === 'true' || option.hasAttribute('disabled')) continue;
|
|
453
|
+
}
|
|
454
|
+
// Read the raw label: normalization removes decimal separators.
|
|
455
|
+
const modelVersion = normalizedTarget === 'latest'
|
|
456
|
+
? text.trim().match(/^gpt[-\\s]+(\\d+(?:\\.\\d+)*)(?![.\\d])/i)?.[1] ?? ''
|
|
457
|
+
: '';
|
|
458
|
+
const baseScore = modelVersion ? 500 : scoreOption(normalizedText, testid);
|
|
450
459
|
if (baseScore <= 0) {
|
|
451
460
|
continue;
|
|
452
461
|
}
|
|
453
462
|
const score = baseScore + (isSubmenu ? 0 : 1);
|
|
454
463
|
const label = getOptionLabel(option);
|
|
455
|
-
if (!bestMatch || score > bestMatch.score
|
|
456
|
-
|
|
464
|
+
if (!bestMatch || score > bestMatch.score ||
|
|
465
|
+
(score === bestMatch.score && modelVersion.localeCompare(bestMatch.modelVersion, 'en', { numeric: true }) > 0)) {
|
|
466
|
+
bestMatch = { node: option, label, score, testid, normalizedText, isSubmenu, modelVersion };
|
|
457
467
|
}
|
|
458
468
|
}
|
|
459
469
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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: `
|
|
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
package/skills/ask-pro/SKILL.md
CHANGED
|
@@ -58,7 +58,8 @@ When invoked:
|
|
|
58
58
|
`harvest` command when that is the next action.
|
|
59
59
|
8. Treat the answer as advisory; turn it into your own plan before editing code.
|
|
60
60
|
|
|
61
|
-
`ask-pro` selects `Latest
|
|
61
|
+
`ask-pro` selects `Latest` when available, otherwise the highest numbered available
|
|
62
|
+
GPT model, then `Pro` intelligence. Do not require a
|
|
62
63
|
different dated model label or a separate thinking-effort control in the prompt
|
|
63
64
|
or workflow.
|
|
64
65
|
|