@reconcrap/boss-recommend-mcp 2.0.39 → 2.0.40
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
|
@@ -92,10 +92,28 @@ export async function findRecommendJobTrigger(client, frameNodeId) {
|
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
export async function waitForRecommendJobTrigger(client, frameNodeId, {
|
|
96
|
+
timeoutMs = 8000,
|
|
97
|
+
intervalMs = 250
|
|
98
|
+
} = {}) {
|
|
99
|
+
const started = Date.now();
|
|
100
|
+
while (Date.now() - started <= timeoutMs) {
|
|
101
|
+
const trigger = await findRecommendJobTrigger(client, frameNodeId);
|
|
102
|
+
if (trigger) return trigger;
|
|
103
|
+
await sleep(intervalMs);
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
95
108
|
export async function openRecommendJobDropdown(client, frameNodeId, {
|
|
96
|
-
timeoutMs = 4000
|
|
109
|
+
timeoutMs = 4000,
|
|
110
|
+
triggerTimeoutMs = Math.max(8000, timeoutMs),
|
|
111
|
+
triggerIntervalMs = 250
|
|
97
112
|
} = {}) {
|
|
98
|
-
const trigger = await
|
|
113
|
+
const trigger = await waitForRecommendJobTrigger(client, frameNodeId, {
|
|
114
|
+
timeoutMs: triggerTimeoutMs,
|
|
115
|
+
intervalMs: triggerIntervalMs
|
|
116
|
+
});
|
|
99
117
|
if (!trigger) {
|
|
100
118
|
throw new Error("Recommend job trigger was not found");
|
|
101
119
|
}
|
|
@@ -166,7 +184,8 @@ export async function closeRecommendJobDropdown(client) {
|
|
|
166
184
|
|
|
167
185
|
export async function selectRecommendJob(client, frameNodeId, {
|
|
168
186
|
jobLabel = "",
|
|
169
|
-
settleMs = 6000
|
|
187
|
+
settleMs = 6000,
|
|
188
|
+
dropdownTimeoutMs = Math.max(8000, settleMs)
|
|
170
189
|
} = {}) {
|
|
171
190
|
const target = normalizeText(jobLabel);
|
|
172
191
|
if (!target) {
|
|
@@ -178,7 +197,10 @@ export async function selectRecommendJob(client, frameNodeId, {
|
|
|
178
197
|
};
|
|
179
198
|
}
|
|
180
199
|
|
|
181
|
-
const opened = await openRecommendJobDropdown(client, frameNodeId
|
|
200
|
+
const opened = await openRecommendJobDropdown(client, frameNodeId, {
|
|
201
|
+
timeoutMs: dropdownTimeoutMs,
|
|
202
|
+
triggerTimeoutMs: dropdownTimeoutMs
|
|
203
|
+
});
|
|
182
204
|
const options = opened.options.length
|
|
183
205
|
? opened.options
|
|
184
206
|
: await listRecommendJobOptions(client, frameNodeId, { openDropdown: false });
|
|
@@ -180,9 +180,11 @@ async function applyRefreshMethod(client, method, {
|
|
|
180
180
|
throw new Error("Recommend iframe was not ready after refresh reload");
|
|
181
181
|
}
|
|
182
182
|
if (jobLabel) {
|
|
183
|
+
const jobDropdownTimeoutMs = reloadSettleMs > 10000 ? 15000 : 12000;
|
|
183
184
|
jobSelection = await selectRecommendJob(client, currentRootState.iframe.documentNodeId, {
|
|
184
185
|
jobLabel,
|
|
185
|
-
settleMs: reloadSettleMs > 10000 ? 12000 : 6000
|
|
186
|
+
settleMs: reloadSettleMs > 10000 ? 12000 : 6000,
|
|
187
|
+
dropdownTimeoutMs: jobDropdownTimeoutMs
|
|
186
188
|
});
|
|
187
189
|
if (!jobSelection.selected) {
|
|
188
190
|
throw new Error(`Requested recommend job was not selected after refresh reload: ${jobSelection.reason}`);
|