@reconcrap/boss-recommend-mcp 1.3.33 → 1.3.34
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/package.json
CHANGED
package/src/test-boss-chat.js
CHANGED
|
@@ -15,11 +15,12 @@ import {
|
|
|
15
15
|
} from "./boss-chat.js";
|
|
16
16
|
import { __testables as cliTestables } from "./cli.js";
|
|
17
17
|
import { __testables as indexTestables } from "./index.js";
|
|
18
|
-
import { BossChatApp } from "../vendor/boss-chat-cli/src/app.js";
|
|
19
|
-
import { __testables as vendorCliTestables } from "../vendor/boss-chat-cli/src/cli.js";
|
|
20
|
-
import { BossChatPage } from "../vendor/boss-chat-cli/src/browser/chat-page.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
18
|
+
import { BossChatApp } from "../vendor/boss-chat-cli/src/app.js";
|
|
19
|
+
import { __testables as vendorCliTestables } from "../vendor/boss-chat-cli/src/cli.js";
|
|
20
|
+
import { BossChatPage } from "../vendor/boss-chat-cli/src/browser/chat-page.js";
|
|
21
|
+
import { ChromeClient } from "../vendor/boss-chat-cli/src/services/chrome-client.js";
|
|
22
|
+
import { LlmClient, parseLlmJson, __testables as llmTestables } from "../vendor/boss-chat-cli/src/services/llm.js";
|
|
23
|
+
import { ReportStore } from "../vendor/boss-chat-cli/src/services/report-store.js";
|
|
23
24
|
import {
|
|
24
25
|
NETWORK_RESUME_IMAGE_MODE_GRACE_MS,
|
|
25
26
|
NETWORK_RESUME_RETRY_WAIT_MS,
|
|
@@ -609,6 +610,30 @@ async function testBossChatPageShouldFallbackToEscapeWhenClosingCandidateDetail(
|
|
|
609
610
|
assert.equal(result.method.includes("outside-click:left-gap"), true);
|
|
610
611
|
}
|
|
611
612
|
|
|
613
|
+
async function testChromeClientShouldInjectBrowserHelpersIntoCallFunction() {
|
|
614
|
+
function helper(value) {
|
|
615
|
+
return Number(value || 0) + 1;
|
|
616
|
+
}
|
|
617
|
+
function target(value) {
|
|
618
|
+
return helper(value) * 2;
|
|
619
|
+
}
|
|
620
|
+
target.helpers = [helper];
|
|
621
|
+
|
|
622
|
+
const client = new ChromeClient(9222);
|
|
623
|
+
let capturedExpression = "";
|
|
624
|
+
client.evaluate = async (expression) => {
|
|
625
|
+
capturedExpression = String(expression || "");
|
|
626
|
+
return "ok";
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
const result = await client.callFunction(target, 2);
|
|
630
|
+
|
|
631
|
+
assert.equal(result, "ok");
|
|
632
|
+
assert.equal(capturedExpression.includes("function helper"), true);
|
|
633
|
+
assert.equal(capturedExpression.includes("function target"), true);
|
|
634
|
+
assert.equal(capturedExpression.includes("return (helper(value) * 2)") || capturedExpression.includes("return helper(value) * 2"), true);
|
|
635
|
+
}
|
|
636
|
+
|
|
612
637
|
async function testBossChatPageShouldWaitForPanelsClosedInStrictConversationReady() {
|
|
613
638
|
const calls = [];
|
|
614
639
|
let stateIndex = 0;
|
|
@@ -2860,6 +2885,7 @@ async function main() {
|
|
|
2860
2885
|
await testBossChatPageShouldTreatBlankChatShellAsOnChatPage();
|
|
2861
2886
|
await testBossChatRecoverToChatIndexShouldForceNavigateAndWaitForCompleteLoad();
|
|
2862
2887
|
await testBossChatPageShouldFallbackToEscapeWhenClosingCandidateDetail();
|
|
2888
|
+
await testChromeClientShouldInjectBrowserHelpersIntoCallFunction();
|
|
2863
2889
|
await testBossChatPageShouldWaitForPanelsClosedInStrictConversationReady();
|
|
2864
2890
|
await testBossChatPageShouldSurfaceCandidateDetailOverlayAndContentState();
|
|
2865
2891
|
await testBossChatMcpToolsShouldValidateAndRoute();
|
|
@@ -1918,6 +1918,35 @@ function browserAnyPopupVisible() {
|
|
|
1918
1918
|
return { visible: wrappers.length > 0, count: wrappers.length };
|
|
1919
1919
|
}
|
|
1920
1920
|
|
|
1921
|
+
browserConversationReadyState.helpers = [
|
|
1922
|
+
browserIsResumeModalOpen,
|
|
1923
|
+
browserNormalizeVisibleText,
|
|
1924
|
+
browserIsVisibleElement,
|
|
1925
|
+
browserRectToJson,
|
|
1926
|
+
browserCollectCandidateDetailSnapshot,
|
|
1927
|
+
];
|
|
1928
|
+
|
|
1929
|
+
browserFindCandidateDetailOutsideClickPoint.helpers = [
|
|
1930
|
+
browserNormalizeVisibleText,
|
|
1931
|
+
browserIsVisibleElement,
|
|
1932
|
+
browserRectToJson,
|
|
1933
|
+
browserCollectCandidateDetailSnapshot,
|
|
1934
|
+
];
|
|
1935
|
+
|
|
1936
|
+
browserIsCandidateDetailOpen.helpers = [
|
|
1937
|
+
browserNormalizeVisibleText,
|
|
1938
|
+
browserIsVisibleElement,
|
|
1939
|
+
browserRectToJson,
|
|
1940
|
+
browserCollectCandidateDetailSnapshot,
|
|
1941
|
+
];
|
|
1942
|
+
|
|
1943
|
+
browserCloseCandidateDetailDomOnce.helpers = [
|
|
1944
|
+
browserNormalizeVisibleText,
|
|
1945
|
+
browserIsVisibleElement,
|
|
1946
|
+
browserRectToJson,
|
|
1947
|
+
browserCollectCandidateDetailSnapshot,
|
|
1948
|
+
];
|
|
1949
|
+
|
|
1921
1950
|
function browserSetEditorMessage(message) {
|
|
1922
1951
|
const normalize = (value) => String(value || '').replace(/\s+/g, ' ').trim();
|
|
1923
1952
|
const text = String(message || '').trim();
|
|
@@ -51,10 +51,14 @@ export class ChromeClient {
|
|
|
51
51
|
return result.result?.value;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
async callFunction(fn, arg = null) {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
async callFunction(fn, arg = null) {
|
|
55
|
+
const helpers = Array.isArray(fn?.helpers) ? fn.helpers : [];
|
|
56
|
+
const helperSource = helpers.map((helper) => helper.toString()).join(';\n');
|
|
57
|
+
const expression = helperSource
|
|
58
|
+
? `(() => { ${helperSource}; return (${fn.toString()})(${JSON.stringify(arg)}); })()`
|
|
59
|
+
: `(${fn.toString()})(${JSON.stringify(arg)})`;
|
|
60
|
+
return this.evaluate(expression);
|
|
61
|
+
}
|
|
58
62
|
|
|
59
63
|
async pressEnter() {
|
|
60
64
|
const payload = {
|