misoai-web 1.5.9 → 1.6.1
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/dist/es/agent.js +158 -54
- package/dist/es/agent.js.map +1 -1
- package/dist/es/bridge-mode-browser.js +3 -3
- package/dist/es/bridge-mode-browser.js.map +1 -1
- package/dist/es/bridge-mode.js +160 -56
- package/dist/es/bridge-mode.js.map +1 -1
- package/dist/es/chrome-extension.js +159 -55
- package/dist/es/chrome-extension.js.map +1 -1
- package/dist/es/index.js +159 -55
- package/dist/es/index.js.map +1 -1
- package/dist/es/midscene-playground.js +161 -57
- package/dist/es/midscene-playground.js.map +1 -1
- package/dist/es/midscene-server.js +4 -4
- package/dist/es/midscene-server.js.map +1 -1
- package/dist/es/playground.js +158 -54
- package/dist/es/playground.js.map +1 -1
- package/dist/es/playwright-report.js +1 -1
- package/dist/es/playwright-report.js.map +1 -1
- package/dist/es/playwright.js +159 -55
- package/dist/es/playwright.js.map +1 -1
- package/dist/es/puppeteer-agent-launcher.js +158 -54
- package/dist/es/puppeteer-agent-launcher.js.map +1 -1
- package/dist/es/puppeteer.js +158 -54
- package/dist/es/puppeteer.js.map +1 -1
- package/dist/es/utils.js +1 -1
- package/dist/es/utils.js.map +1 -1
- package/dist/es/yaml.js +1 -1
- package/dist/es/yaml.js.map +1 -1
- package/dist/lib/agent.js +158 -54
- package/dist/lib/agent.js.map +1 -1
- package/dist/lib/bridge-mode-browser.js +3 -3
- package/dist/lib/bridge-mode-browser.js.map +1 -1
- package/dist/lib/bridge-mode.js +160 -56
- package/dist/lib/bridge-mode.js.map +1 -1
- package/dist/lib/chrome-extension.js +159 -55
- package/dist/lib/chrome-extension.js.map +1 -1
- package/dist/lib/index.js +159 -55
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/midscene-playground.js +161 -57
- package/dist/lib/midscene-playground.js.map +1 -1
- package/dist/lib/midscene-server.js +4 -4
- package/dist/lib/midscene-server.js.map +1 -1
- package/dist/lib/playground.js +158 -54
- package/dist/lib/playground.js.map +1 -1
- package/dist/lib/playwright-report.js +1 -1
- package/dist/lib/playwright-report.js.map +1 -1
- package/dist/lib/playwright.js +159 -55
- package/dist/lib/playwright.js.map +1 -1
- package/dist/lib/puppeteer-agent-launcher.js +158 -54
- package/dist/lib/puppeteer-agent-launcher.js.map +1 -1
- package/dist/lib/puppeteer.js +158 -54
- package/dist/lib/puppeteer.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/yaml.js +1 -1
- package/dist/lib/yaml.js.map +1 -1
- package/dist/types/agent.d.ts +8 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/playwright.d.ts +1 -1
- package/package.json +18 -54
package/dist/es/index.js
CHANGED
@@ -306,8 +306,8 @@ var ScriptPlayer = class {
|
|
306
306
|
import yaml from "js-yaml";
|
307
307
|
|
308
308
|
// src/yaml/utils.ts
|
309
|
-
import { assert as assert2 } from "misoai-shared/utils";
|
310
309
|
import yaml2 from "js-yaml";
|
310
|
+
import { assert as assert2 } from "misoai-shared/utils";
|
311
311
|
function interpolateEnvVars(content) {
|
312
312
|
return content.replace(/\$\{([^}]+)\}/g, (_, envVar) => {
|
313
313
|
const value = process.env[envVar.trim()];
|
@@ -468,6 +468,7 @@ function paramStr(task) {
|
|
468
468
|
}
|
469
469
|
|
470
470
|
// src/common/utils.ts
|
471
|
+
import dayjs from "dayjs";
|
471
472
|
import { elementByPositionWithElementInfo } from "misoai-core/ai-model";
|
472
473
|
import { uploadTestInfoToServer } from "misoai-core/utils";
|
473
474
|
import { MIDSCENE_REPORT_TAG_NAME, getAIConfig } from "misoai-shared/env";
|
@@ -479,7 +480,6 @@ import {
|
|
479
480
|
} from "misoai-shared/extractor";
|
480
481
|
import { resizeImgBase64 } from "misoai-shared/img";
|
481
482
|
import { assert as assert3, logMsg, uuid } from "misoai-shared/utils";
|
482
|
-
import dayjs from "dayjs";
|
483
483
|
|
484
484
|
// src/web-element.ts
|
485
485
|
var WebElementInfo = class {
|
@@ -648,8 +648,12 @@ var WorkflowMemory = class {
|
|
648
648
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
649
649
|
workflow.memory = [...memory];
|
650
650
|
workflow.metadata.totalSteps = workflow.steps.length;
|
651
|
-
workflow.metadata.completedSteps = workflow.steps.filter(
|
652
|
-
|
651
|
+
workflow.metadata.completedSteps = workflow.steps.filter(
|
652
|
+
(s) => s.status === "completed"
|
653
|
+
).length;
|
654
|
+
workflow.metadata.failedSteps = workflow.steps.filter(
|
655
|
+
(s) => s.status === "failed"
|
656
|
+
).length;
|
653
657
|
this.workflows.set(workflowId, workflow);
|
654
658
|
this.enforceRetentionPolicy();
|
655
659
|
}
|
@@ -660,7 +664,9 @@ var WorkflowMemory = class {
|
|
660
664
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
661
665
|
workflow.context = { ...workflow.context, ...context };
|
662
666
|
if (context.currentStep) {
|
663
|
-
const existingStep = workflow.steps.find(
|
667
|
+
const existingStep = workflow.steps.find(
|
668
|
+
(s) => s.stepName === context.currentStep
|
669
|
+
);
|
664
670
|
if (!existingStep) {
|
665
671
|
workflow.steps.push({
|
666
672
|
stepId: `step_${workflow.steps.length + 1}`,
|
@@ -705,7 +711,9 @@ var WorkflowMemory = class {
|
|
705
711
|
enforceRetentionPolicy() {
|
706
712
|
const maxWorkflows = 10;
|
707
713
|
if (this.workflows.size > maxWorkflows) {
|
708
|
-
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
714
|
+
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
715
|
+
([, a], [, b]) => (b.metadata.endTime || b.metadata.startTime) - (a.metadata.endTime || a.metadata.startTime)
|
716
|
+
);
|
709
717
|
const toDelete = sortedWorkflows.slice(maxWorkflows);
|
710
718
|
toDelete.forEach(([workflowId]) => this.workflows.delete(workflowId));
|
711
719
|
}
|
@@ -1444,7 +1452,9 @@ var PageTaskExecutor = class {
|
|
1444
1452
|
*/
|
1445
1453
|
getPersistentExecutor() {
|
1446
1454
|
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1447
|
-
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1455
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1456
|
+
this.sessionContext.workflowId
|
1457
|
+
);
|
1448
1458
|
this.persistentExecutor = new Executor("Persistent Task Executor", {
|
1449
1459
|
onTaskStart: this.onTaskStartCallback,
|
1450
1460
|
initialMemory: previousMemory
|
@@ -1473,7 +1483,9 @@ var PageTaskExecutor = class {
|
|
1473
1483
|
if (this.persistentExecutor) {
|
1474
1484
|
this.persistentExecutor.clearMemory();
|
1475
1485
|
}
|
1476
|
-
this.workflowMemory.clearWorkflow(
|
1486
|
+
this.workflowMemory.clearWorkflow(
|
1487
|
+
this.sessionContext.workflowId || "default"
|
1488
|
+
);
|
1477
1489
|
}
|
1478
1490
|
/**
|
1479
1491
|
* Mevcut hafızayı döndürür
|
@@ -1485,7 +1497,9 @@ var PageTaskExecutor = class {
|
|
1485
1497
|
* İş akışı hafızasını döndürür
|
1486
1498
|
*/
|
1487
1499
|
getWorkflowMemory() {
|
1488
|
-
return this.workflowMemory.getWorkflowData(
|
1500
|
+
return this.workflowMemory.getWorkflowData(
|
1501
|
+
this.sessionContext.workflowId || "default"
|
1502
|
+
);
|
1489
1503
|
}
|
1490
1504
|
/**
|
1491
1505
|
* Hafıza istatistiklerini döndürür
|
@@ -1493,7 +1507,13 @@ var PageTaskExecutor = class {
|
|
1493
1507
|
getMemoryStats() {
|
1494
1508
|
return this.persistentExecutor?.getMemoryStats() || {
|
1495
1509
|
totalItems: 0,
|
1496
|
-
analytics: {
|
1510
|
+
analytics: {
|
1511
|
+
totalTasks: 0,
|
1512
|
+
memoryHits: 0,
|
1513
|
+
memoryMisses: 0,
|
1514
|
+
averageMemorySize: 0,
|
1515
|
+
memoryEffectiveness: 0
|
1516
|
+
},
|
1497
1517
|
config: this.memoryConfig
|
1498
1518
|
};
|
1499
1519
|
}
|
@@ -1529,11 +1549,14 @@ var PageTaskExecutor = class {
|
|
1529
1549
|
let taskExecutor;
|
1530
1550
|
if (useMemory) {
|
1531
1551
|
taskExecutor = this.getPersistentExecutor();
|
1532
|
-
this.workflowMemory.updateWorkflowContext(
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1552
|
+
this.workflowMemory.updateWorkflowContext(
|
1553
|
+
{
|
1554
|
+
currentStep: title,
|
1555
|
+
pageInfo: this.sessionContext.pageInfo,
|
1556
|
+
timestamp: Date.now()
|
1557
|
+
},
|
1558
|
+
this.sessionContext.workflowId || "default"
|
1559
|
+
);
|
1537
1560
|
} else {
|
1538
1561
|
taskExecutor = new Executor(title, {
|
1539
1562
|
onTaskStart: this.onTaskStartCallback
|
@@ -1831,9 +1854,15 @@ var PageTaskExecutor = class {
|
|
1831
1854
|
}
|
1832
1855
|
async waitFor(assertion, opt) {
|
1833
1856
|
const description = `waitFor: ${assertion}`;
|
1834
|
-
const
|
1835
|
-
|
1836
|
-
|
1857
|
+
const useMemory = true;
|
1858
|
+
let taskExecutor;
|
1859
|
+
if (useMemory) {
|
1860
|
+
taskExecutor = this.getPersistentExecutor();
|
1861
|
+
} else {
|
1862
|
+
taskExecutor = new Executor(taskTitleStr("WaitFor", description), {
|
1863
|
+
onTaskStart: this.onTaskStartCallback
|
1864
|
+
});
|
1865
|
+
}
|
1837
1866
|
const { timeoutMs, checkIntervalMs } = opt;
|
1838
1867
|
assert4(assertion, "No assertion for waitFor");
|
1839
1868
|
assert4(timeoutMs, "No timeoutMs for waitFor");
|
@@ -1888,6 +1917,25 @@ var PageTaskExecutor = class {
|
|
1888
1917
|
`waitFor timeout: ${errorThought}`
|
1889
1918
|
);
|
1890
1919
|
}
|
1920
|
+
/**
|
1921
|
+
* Hafızaya yeni bir öğe ekler
|
1922
|
+
*/
|
1923
|
+
addToMemory(memoryItem) {
|
1924
|
+
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1925
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1926
|
+
this.sessionContext.workflowId
|
1927
|
+
);
|
1928
|
+
this.persistentExecutor = new Executor("Persistent Task Executor", {
|
1929
|
+
onTaskStart: this.onTaskStartCallback,
|
1930
|
+
initialMemory: previousMemory
|
1931
|
+
});
|
1932
|
+
}
|
1933
|
+
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1934
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation(
|
1935
|
+
"add",
|
1936
|
+
memoryItem
|
1937
|
+
);
|
1938
|
+
}
|
1891
1939
|
};
|
1892
1940
|
|
1893
1941
|
// src/common/plan-builder.ts
|
@@ -1975,14 +2023,14 @@ function buildPlans(type, locateParam, param) {
|
|
1975
2023
|
import assert6 from "assert";
|
1976
2024
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, writeFileSync as writeFileSync2 } from "fs";
|
1977
2025
|
import { dirname as dirname2, join as join2 } from "path";
|
2026
|
+
import yaml3 from "js-yaml";
|
1978
2027
|
import { getMidsceneRunSubDir as getMidsceneRunSubDir2 } from "misoai-shared/common";
|
1979
2028
|
import { getDebug as getDebug3 } from "misoai-shared/logger";
|
1980
2029
|
import { ifInBrowser as ifInBrowser2 } from "misoai-shared/utils";
|
1981
|
-
import yaml3 from "js-yaml";
|
1982
2030
|
import semver from "semver";
|
1983
2031
|
|
1984
2032
|
// package.json
|
1985
|
-
var version = "1.
|
2033
|
+
var version = "1.6.1";
|
1986
2034
|
|
1987
2035
|
// src/common/task-cache.ts
|
1988
2036
|
var debug3 = getDebug3("cache");
|
@@ -2193,7 +2241,10 @@ var PageAgent = class {
|
|
2193
2241
|
}
|
2194
2242
|
this.taskExecutor = new PageTaskExecutor(this.page, this.insight, {
|
2195
2243
|
taskCache: this.taskCache,
|
2196
|
-
onTaskStart: this.callbackOnTaskStartTip.bind(this)
|
2244
|
+
onTaskStart: this.callbackOnTaskStartTip.bind(this),
|
2245
|
+
memoryConfig: opts?.memoryConfig,
|
2246
|
+
sessionId: opts?.sessionId,
|
2247
|
+
workflowId: opts?.workflowId
|
2197
2248
|
});
|
2198
2249
|
this.dump = this.resetDump();
|
2199
2250
|
this.reportFileName = reportFileName(
|
@@ -2274,22 +2325,28 @@ var PageAgent = class {
|
|
2274
2325
|
const allThoughts = executor.tasks.filter((task) => task.thought).map((task) => task.thought);
|
2275
2326
|
const allLocates = executor.tasks.filter((task) => task.locate).map((task) => task.locate);
|
2276
2327
|
const allPlans = executor.tasks.filter((task) => task.param?.plans).map((task) => task.param?.plans);
|
2277
|
-
const planningTasks = executor.tasks.filter(
|
2278
|
-
|
2328
|
+
const planningTasks = executor.tasks.filter(
|
2329
|
+
(task) => task.type === "Planning"
|
2330
|
+
);
|
2331
|
+
const insightTasks = executor.tasks.filter(
|
2332
|
+
(task) => task.type === "Insight"
|
2333
|
+
);
|
2279
2334
|
const actionTasks = executor.tasks.filter((task) => task.type === "Action");
|
2280
2335
|
const planning = planningTasks.length > 0 ? {
|
2281
2336
|
type: "Planning",
|
2282
|
-
description:
|
2337
|
+
description: "Planning for task execution",
|
2283
2338
|
steps: planningTasks.map((task) => task.thought || "Planning step")
|
2284
2339
|
} : void 0;
|
2285
2340
|
const insight = insightTasks.length > 0 ? {
|
2286
2341
|
type: "Insight",
|
2287
|
-
description:
|
2288
|
-
elements: insightTasks.map(
|
2342
|
+
description: "Insight for task execution",
|
2343
|
+
elements: insightTasks.map(
|
2344
|
+
(task) => task.thought || "Insight element"
|
2345
|
+
)
|
2289
2346
|
} : void 0;
|
2290
2347
|
const action = actionTasks.length > 0 ? {
|
2291
2348
|
type: "Action",
|
2292
|
-
description:
|
2349
|
+
description: "Action for task execution",
|
2293
2350
|
result: lastTask?.output
|
2294
2351
|
} : void 0;
|
2295
2352
|
const actionDetails = executor.tasks.map((task) => ({
|
@@ -2623,7 +2680,10 @@ ${memoryContext}` : void 0;
|
|
2623
2680
|
}
|
2624
2681
|
const memoryContext = this.getMemoryAsContext();
|
2625
2682
|
const assertionWithContext = currentUrl ? `For the page at URL "${currentUrl}", ${assertion}` : assertion;
|
2626
|
-
const { output, executor } = await this.taskExecutor.assert(
|
2683
|
+
const { output, executor } = await this.taskExecutor.assert(
|
2684
|
+
assertionWithContext,
|
2685
|
+
memoryContext
|
2686
|
+
);
|
2627
2687
|
const metadata = this.afterTaskRunning(executor, true);
|
2628
2688
|
if (output && opt?.keepRawResponse) {
|
2629
2689
|
return {
|
@@ -2644,6 +2704,7 @@ ${reasonMsg}`);
|
|
2644
2704
|
}
|
2645
2705
|
async aiCaptcha(options) {
|
2646
2706
|
const { deepThink = false, autoDetectComplexity = true } = options || {};
|
2707
|
+
const memoryContext = this.getMemoryAsContext();
|
2647
2708
|
let shouldUseDeepThink = deepThink;
|
2648
2709
|
if (autoDetectComplexity && !deepThink) {
|
2649
2710
|
const context = await this.getUIContext();
|
@@ -2661,7 +2722,10 @@ A complex CAPTCHA typically has one or more of these characteristics:
|
|
2661
2722
|
Return only "complex" or "simple" based on your analysis.
|
2662
2723
|
`;
|
2663
2724
|
const complexityMsgs = [
|
2664
|
-
{
|
2725
|
+
{
|
2726
|
+
role: "system",
|
2727
|
+
content: "You are an AI assistant that analyzes screenshots to determine CAPTCHA complexity."
|
2728
|
+
},
|
2665
2729
|
{
|
2666
2730
|
role: "user",
|
2667
2731
|
content: [
|
@@ -2685,7 +2749,12 @@ Return only "complex" or "simple" based on your analysis.
|
|
2685
2749
|
);
|
2686
2750
|
const responseText = typeof complexityResult.content === "string" ? complexityResult.content.toLowerCase() : JSON.stringify(complexityResult.content).toLowerCase();
|
2687
2751
|
shouldUseDeepThink = responseText.includes("complex");
|
2688
|
-
debug4(
|
2752
|
+
debug4(
|
2753
|
+
"CAPTCHA complexity analysis:",
|
2754
|
+
responseText,
|
2755
|
+
"Using deep think:",
|
2756
|
+
shouldUseDeepThink
|
2757
|
+
);
|
2689
2758
|
} catch (error) {
|
2690
2759
|
debug4("Failed to analyze CAPTCHA complexity:", error);
|
2691
2760
|
}
|
@@ -2702,7 +2771,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2702
2771
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2703
2772
|
} else if (action.type === "input" && action.value) {
|
2704
2773
|
if (action.target) {
|
2705
|
-
await this.aiInput(action.value, action.target, {
|
2774
|
+
await this.aiInput(action.value, action.target, {
|
2775
|
+
deepThink: shouldUseDeepThink
|
2776
|
+
});
|
2706
2777
|
}
|
2707
2778
|
} else if (action.type === "verify" && action.target) {
|
2708
2779
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
@@ -2714,7 +2785,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2714
2785
|
if (action.coordinates) {
|
2715
2786
|
const x = action.coordinates[0];
|
2716
2787
|
const y = action.coordinates[1];
|
2717
|
-
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2788
|
+
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2789
|
+
deepThink: shouldUseDeepThink
|
2790
|
+
});
|
2718
2791
|
} else if (action.target) {
|
2719
2792
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2720
2793
|
}
|
@@ -2724,6 +2797,26 @@ Return only "complex" or "simple" based on your analysis.
|
|
2724
2797
|
}
|
2725
2798
|
}
|
2726
2799
|
await new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
2800
|
+
const captchaMemoryItem = {
|
2801
|
+
id: `captcha_${Date.now()}`,
|
2802
|
+
timestamp: Date.now(),
|
2803
|
+
taskType: "Action",
|
2804
|
+
summary: `Solved ${captchaResult.captchaType} CAPTCHA: ${captchaResult.thought}`,
|
2805
|
+
context: {
|
2806
|
+
url: await this.page.url?.() || "",
|
2807
|
+
captchaType: captchaResult.captchaType,
|
2808
|
+
actions: captchaResult.actions,
|
2809
|
+
deepThink: actualDeepThink
|
2810
|
+
},
|
2811
|
+
metadata: {
|
2812
|
+
executionTime: Date.now() - Date.now(),
|
2813
|
+
// Will be updated
|
2814
|
+
success: true,
|
2815
|
+
confidence: 0.9
|
2816
|
+
},
|
2817
|
+
tags: ["captcha", "action", captchaResult.captchaType]
|
2818
|
+
};
|
2819
|
+
this.taskExecutor.addToMemory(captchaMemoryItem);
|
2727
2820
|
const metadata = {
|
2728
2821
|
status: "finished",
|
2729
2822
|
usage,
|
@@ -2740,10 +2833,15 @@ Return only "complex" or "simple" based on your analysis.
|
|
2740
2833
|
}
|
2741
2834
|
async aiWaitFor(assertion, opt) {
|
2742
2835
|
const startTime = Date.now();
|
2743
|
-
const
|
2836
|
+
const memoryContext = this.getMemoryAsContext();
|
2837
|
+
const assertionWithContext = memoryContext ? `${assertion}
|
2838
|
+
|
2839
|
+
Previous workflow steps:
|
2840
|
+
${memoryContext}` : assertion;
|
2841
|
+
const { executor } = await this.taskExecutor.waitFor(assertionWithContext, {
|
2744
2842
|
timeoutMs: opt?.timeoutMs || 15 * 1e3,
|
2745
2843
|
checkIntervalMs: opt?.checkIntervalMs || 3 * 1e3,
|
2746
|
-
assertion
|
2844
|
+
assertion: assertionWithContext
|
2747
2845
|
});
|
2748
2846
|
const metadata = {
|
2749
2847
|
status: executor.isInErrorState() ? "failed" : "finished",
|
@@ -2841,25 +2939,27 @@ ${errors}`);
|
|
2841
2939
|
const executionDump = {
|
2842
2940
|
name: screenshotTitle,
|
2843
2941
|
description: content,
|
2844
|
-
tasks: [
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2942
|
+
tasks: [
|
2943
|
+
{
|
2944
|
+
type: "Screenshot",
|
2945
|
+
subType: "log",
|
2946
|
+
status: "finished",
|
2947
|
+
executor: null,
|
2948
|
+
param: {
|
2949
|
+
title: screenshotTitle,
|
2950
|
+
content
|
2951
|
+
},
|
2952
|
+
output: {
|
2953
|
+
screenshot
|
2954
|
+
},
|
2955
|
+
thought: `Logged screenshot: ${screenshotTitle}`,
|
2956
|
+
timing: {
|
2957
|
+
start: Date.now(),
|
2958
|
+
end: Date.now(),
|
2959
|
+
cost: 0
|
2960
|
+
}
|
2861
2961
|
}
|
2862
|
-
|
2962
|
+
],
|
2863
2963
|
sdkVersion: "1.0.0",
|
2864
2964
|
logTime: Date.now(),
|
2865
2965
|
model_name: "screenshot"
|
@@ -2911,7 +3011,9 @@ ${errors}`);
|
|
2911
3011
|
totalTasks: stats.analytics.totalTasks,
|
2912
3012
|
memoryHits: stats.analytics.memoryHits,
|
2913
3013
|
memoryMisses: stats.analytics.memoryMisses,
|
2914
|
-
memoryEffectiveness: Math.round(
|
3014
|
+
memoryEffectiveness: Math.round(
|
3015
|
+
stats.analytics.memoryEffectiveness * 100
|
3016
|
+
),
|
2915
3017
|
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
2916
3018
|
},
|
2917
3019
|
config: stats.config,
|
@@ -2975,7 +3077,9 @@ ${errors}`);
|
|
2975
3077
|
calculateSuccessRate(memory) {
|
2976
3078
|
if (memory.length === 0)
|
2977
3079
|
return 0;
|
2978
|
-
const successCount = memory.filter(
|
3080
|
+
const successCount = memory.filter(
|
3081
|
+
(item) => item.metadata?.success !== false
|
3082
|
+
).length;
|
2979
3083
|
return Math.round(successCount / memory.length * 100);
|
2980
3084
|
}
|
2981
3085
|
calculateAverageExecutionTime(memory) {
|
@@ -3296,8 +3400,8 @@ var WebPage = class extends Page {
|
|
3296
3400
|
|
3297
3401
|
// src/playwright/ai-fixture.ts
|
3298
3402
|
import { randomUUID } from "crypto";
|
3299
|
-
import { getDebug as getDebug6 } from "misoai-shared/logger";
|
3300
3403
|
import { test } from "@playwright/test";
|
3404
|
+
import { getDebug as getDebug6 } from "misoai-shared/logger";
|
3301
3405
|
var debugPage2 = getDebug6("web:playwright:ai-fixture");
|
3302
3406
|
var groupAndCaseForTest = (testInfo) => {
|
3303
3407
|
let taskFile;
|