sync: update from private repo (3385c80)
CI / build-and-test (push) Has been cancelled

This commit is contained in:
oss-sync
2026-06-08 05:00:15 +00:00
parent 38bd874366
commit ee062050e0
13 changed files with 295 additions and 44 deletions
+4 -4
View File
@@ -256,7 +256,7 @@ export { getSessionManager };
// 2. Task Session (kind='task'): タスクごとに分離された noVNC session。
// BrowseWeb / InteractiveBrowse が ctx.taskId をキーに取得・再利用する。
// タスク visibility に基づき認可される。LRU 退避 + idle GC 対象。
// 3. Headless 共有 (skip mode): config の captchaSolve != 'novnc' の場合、
// 3. Headless 共有 (headless mode): config の displayMode != 'novnc' の場合、
// または noVNC が立ち上げられない fallback 経路で使う single Browser。
let _headlessBrowser: Browser | null = null;
@@ -298,7 +298,7 @@ async function getHeadlessBrowser(): Promise<Browser> {
*/
export async function getCaptchaPoolBrowser(): Promise<Browser> {
const config = loadConfig();
if (config.browser?.captchaSolve === 'novnc') {
if (config.browser?.displayMode === 'novnc') {
const sm = getSessionManager();
if (sm) {
try {
@@ -325,7 +325,7 @@ export async function getCaptchaPoolBrowser(): Promise<Browser> {
*/
export async function getTaskSessionBrowser(ctx: ToolContext): Promise<Browser> {
const config = loadConfig();
if (config.browser?.captchaSolve === 'novnc' && ctx.taskId) {
if (config.browser?.displayMode === 'novnc' && ctx.taskId) {
const sm = getSessionManager();
if (sm) {
try {
@@ -557,7 +557,7 @@ async function getJobContext(
ctx: ToolContext,
): Promise<BrowserContext> {
const config = loadConfig();
if (config.browser?.captchaSolve === 'novnc' && ctx.taskId) {
if (config.browser?.displayMode === 'novnc' && ctx.taskId) {
const sm = getSessionManager();
if (sm) {
try {
+4 -5
View File
@@ -532,13 +532,12 @@ async function searchViaBrowser(
query: string,
limit: number,
pageTimeout: number,
captchaSolve: 'skip' | 'novnc' = 'skip',
useNovnc: boolean = false,
maxCaptchaPages: number = 5,
): Promise<{ results: SearchResult[]; captcha: boolean }> {
const url = engine.buildUrl(query, limit);
logger.debug(`[WebSearch] ${engine.name} browser search: url=${url}`);
const useNovnc = captchaSolve === 'novnc';
// WebSearch は CAPTCHA Pool の Browser を共有して使う。これにより admin が
// 一度 CAPTCHA を解けば Cookie が persistentContexts に残り、別タスクの
// WebSearch も同じ Cookie で続行できる (タスク隔離が必要な BrowseWeb と
@@ -640,7 +639,7 @@ async function executeWebSearch(
const { loadConfig } = await import('../../config.js');
const appConfig = loadConfig();
const captchaSolve = appConfig.browser?.captchaSolve ?? 'skip';
const useNovnc = (appConfig.browser?.displayMode ?? 'headless') === 'novnc';
const maxCaptchaPages = appConfig.browser?.maxCaptchaPages ?? 5;
// --- ブラウザ検索: Google → Brave → Yahoo の順に試行 ---
@@ -652,7 +651,7 @@ async function executeWebSearch(
const methodName = engine.name.toLowerCase();
try {
const { results, captcha } = await searchViaBrowser(engine, query, limit, pageTimeout, captchaSolve, maxCaptchaPages);
const { results, captcha } = await searchViaBrowser(engine, query, limit, pageTimeout, useNovnc, maxCaptchaPages);
if (captcha) {
lastBrowserError = `${engine.name} が CAPTCHA を要求しました`;
@@ -673,7 +672,7 @@ async function executeWebSearch(
resultCount: results.length, outcome: 'success', fallback: isFallback,
});
// 検索が通った = Pool は CAPTCHA を抜けている。フラグを下ろす
if (captchaSolve === 'novnc') markPoolCaptchaPending(false);
if (useNovnc) markPoolCaptchaPending(false);
return { output: formatted, isError: false };
}