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/lib/index.js
CHANGED
@@ -349,8 +349,8 @@ var ScriptPlayer = class {
|
|
349
349
|
var import_js_yaml = __toESM(require("js-yaml"));
|
350
350
|
|
351
351
|
// src/yaml/utils.ts
|
352
|
-
var import_utils2 = require("misoai-shared/utils");
|
353
352
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
353
|
+
var import_utils2 = require("misoai-shared/utils");
|
354
354
|
function interpolateEnvVars(content) {
|
355
355
|
return content.replace(/\$\{([^}]+)\}/g, (_, envVar) => {
|
356
356
|
const value = process.env[envVar.trim()];
|
@@ -496,13 +496,13 @@ function paramStr(task) {
|
|
496
496
|
}
|
497
497
|
|
498
498
|
// src/common/utils.ts
|
499
|
+
var import_dayjs = __toESM(require("dayjs"));
|
499
500
|
var import_ai_model = require("misoai-core/ai-model");
|
500
501
|
var import_utils3 = require("misoai-core/utils");
|
501
502
|
var import_env = require("misoai-shared/env");
|
502
503
|
var import_extractor = require("misoai-shared/extractor");
|
503
504
|
var import_img = require("misoai-shared/img");
|
504
505
|
var import_utils4 = require("misoai-shared/utils");
|
505
|
-
var import_dayjs = __toESM(require("dayjs"));
|
506
506
|
|
507
507
|
// src/web-element.ts
|
508
508
|
var WebElementInfo = class {
|
@@ -671,8 +671,12 @@ var WorkflowMemory = class {
|
|
671
671
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
672
672
|
workflow.memory = [...memory];
|
673
673
|
workflow.metadata.totalSteps = workflow.steps.length;
|
674
|
-
workflow.metadata.completedSteps = workflow.steps.filter(
|
675
|
-
|
674
|
+
workflow.metadata.completedSteps = workflow.steps.filter(
|
675
|
+
(s) => s.status === "completed"
|
676
|
+
).length;
|
677
|
+
workflow.metadata.failedSteps = workflow.steps.filter(
|
678
|
+
(s) => s.status === "failed"
|
679
|
+
).length;
|
676
680
|
this.workflows.set(workflowId, workflow);
|
677
681
|
this.enforceRetentionPolicy();
|
678
682
|
}
|
@@ -683,7 +687,9 @@ var WorkflowMemory = class {
|
|
683
687
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
684
688
|
workflow.context = { ...workflow.context, ...context };
|
685
689
|
if (context.currentStep) {
|
686
|
-
const existingStep = workflow.steps.find(
|
690
|
+
const existingStep = workflow.steps.find(
|
691
|
+
(s) => s.stepName === context.currentStep
|
692
|
+
);
|
687
693
|
if (!existingStep) {
|
688
694
|
workflow.steps.push({
|
689
695
|
stepId: `step_${workflow.steps.length + 1}`,
|
@@ -728,7 +734,9 @@ var WorkflowMemory = class {
|
|
728
734
|
enforceRetentionPolicy() {
|
729
735
|
const maxWorkflows = 10;
|
730
736
|
if (this.workflows.size > maxWorkflows) {
|
731
|
-
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
737
|
+
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
738
|
+
([, a], [, b]) => (b.metadata.endTime || b.metadata.startTime) - (a.metadata.endTime || a.metadata.startTime)
|
739
|
+
);
|
732
740
|
const toDelete = sortedWorkflows.slice(maxWorkflows);
|
733
741
|
toDelete.forEach(([workflowId]) => this.workflows.delete(workflowId));
|
734
742
|
}
|
@@ -1467,7 +1475,9 @@ var PageTaskExecutor = class {
|
|
1467
1475
|
*/
|
1468
1476
|
getPersistentExecutor() {
|
1469
1477
|
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1470
|
-
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1478
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1479
|
+
this.sessionContext.workflowId
|
1480
|
+
);
|
1471
1481
|
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1472
1482
|
onTaskStart: this.onTaskStartCallback,
|
1473
1483
|
initialMemory: previousMemory
|
@@ -1496,7 +1506,9 @@ var PageTaskExecutor = class {
|
|
1496
1506
|
if (this.persistentExecutor) {
|
1497
1507
|
this.persistentExecutor.clearMemory();
|
1498
1508
|
}
|
1499
|
-
this.workflowMemory.clearWorkflow(
|
1509
|
+
this.workflowMemory.clearWorkflow(
|
1510
|
+
this.sessionContext.workflowId || "default"
|
1511
|
+
);
|
1500
1512
|
}
|
1501
1513
|
/**
|
1502
1514
|
* Mevcut hafızayı döndürür
|
@@ -1508,7 +1520,9 @@ var PageTaskExecutor = class {
|
|
1508
1520
|
* İş akışı hafızasını döndürür
|
1509
1521
|
*/
|
1510
1522
|
getWorkflowMemory() {
|
1511
|
-
return this.workflowMemory.getWorkflowData(
|
1523
|
+
return this.workflowMemory.getWorkflowData(
|
1524
|
+
this.sessionContext.workflowId || "default"
|
1525
|
+
);
|
1512
1526
|
}
|
1513
1527
|
/**
|
1514
1528
|
* Hafıza istatistiklerini döndürür
|
@@ -1516,7 +1530,13 @@ var PageTaskExecutor = class {
|
|
1516
1530
|
getMemoryStats() {
|
1517
1531
|
return this.persistentExecutor?.getMemoryStats() || {
|
1518
1532
|
totalItems: 0,
|
1519
|
-
analytics: {
|
1533
|
+
analytics: {
|
1534
|
+
totalTasks: 0,
|
1535
|
+
memoryHits: 0,
|
1536
|
+
memoryMisses: 0,
|
1537
|
+
averageMemorySize: 0,
|
1538
|
+
memoryEffectiveness: 0
|
1539
|
+
},
|
1520
1540
|
config: this.memoryConfig
|
1521
1541
|
};
|
1522
1542
|
}
|
@@ -1552,11 +1572,14 @@ var PageTaskExecutor = class {
|
|
1552
1572
|
let taskExecutor;
|
1553
1573
|
if (useMemory) {
|
1554
1574
|
taskExecutor = this.getPersistentExecutor();
|
1555
|
-
this.workflowMemory.updateWorkflowContext(
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1575
|
+
this.workflowMemory.updateWorkflowContext(
|
1576
|
+
{
|
1577
|
+
currentStep: title,
|
1578
|
+
pageInfo: this.sessionContext.pageInfo,
|
1579
|
+
timestamp: Date.now()
|
1580
|
+
},
|
1581
|
+
this.sessionContext.workflowId || "default"
|
1582
|
+
);
|
1560
1583
|
} else {
|
1561
1584
|
taskExecutor = new import_misoai_core.Executor(title, {
|
1562
1585
|
onTaskStart: this.onTaskStartCallback
|
@@ -1854,9 +1877,15 @@ var PageTaskExecutor = class {
|
|
1854
1877
|
}
|
1855
1878
|
async waitFor(assertion, opt) {
|
1856
1879
|
const description = `waitFor: ${assertion}`;
|
1857
|
-
const
|
1858
|
-
|
1859
|
-
|
1880
|
+
const useMemory = true;
|
1881
|
+
let taskExecutor;
|
1882
|
+
if (useMemory) {
|
1883
|
+
taskExecutor = this.getPersistentExecutor();
|
1884
|
+
} else {
|
1885
|
+
taskExecutor = new import_misoai_core.Executor(taskTitleStr("WaitFor", description), {
|
1886
|
+
onTaskStart: this.onTaskStartCallback
|
1887
|
+
});
|
1888
|
+
}
|
1860
1889
|
const { timeoutMs, checkIntervalMs } = opt;
|
1861
1890
|
(0, import_utils6.assert)(assertion, "No assertion for waitFor");
|
1862
1891
|
(0, import_utils6.assert)(timeoutMs, "No timeoutMs for waitFor");
|
@@ -1911,6 +1940,25 @@ var PageTaskExecutor = class {
|
|
1911
1940
|
`waitFor timeout: ${errorThought}`
|
1912
1941
|
);
|
1913
1942
|
}
|
1943
|
+
/**
|
1944
|
+
* Hafızaya yeni bir öğe ekler
|
1945
|
+
*/
|
1946
|
+
addToMemory(memoryItem) {
|
1947
|
+
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1948
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1949
|
+
this.sessionContext.workflowId
|
1950
|
+
);
|
1951
|
+
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1952
|
+
onTaskStart: this.onTaskStartCallback,
|
1953
|
+
initialMemory: previousMemory
|
1954
|
+
});
|
1955
|
+
}
|
1956
|
+
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1957
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation(
|
1958
|
+
"add",
|
1959
|
+
memoryItem
|
1960
|
+
);
|
1961
|
+
}
|
1914
1962
|
};
|
1915
1963
|
|
1916
1964
|
// src/common/plan-builder.ts
|
@@ -1998,14 +2046,14 @@ function buildPlans(type, locateParam, param) {
|
|
1998
2046
|
var import_node_assert = __toESM(require("assert"));
|
1999
2047
|
var import_node_fs2 = require("fs");
|
2000
2048
|
var import_node_path2 = require("path");
|
2049
|
+
var import_js_yaml3 = __toESM(require("js-yaml"));
|
2001
2050
|
var import_common2 = require("misoai-shared/common");
|
2002
2051
|
var import_logger3 = require("misoai-shared/logger");
|
2003
2052
|
var import_utils9 = require("misoai-shared/utils");
|
2004
|
-
var import_js_yaml3 = __toESM(require("js-yaml"));
|
2005
2053
|
var import_semver = __toESM(require("semver"));
|
2006
2054
|
|
2007
2055
|
// package.json
|
2008
|
-
var version = "1.
|
2056
|
+
var version = "1.6.1";
|
2009
2057
|
|
2010
2058
|
// src/common/task-cache.ts
|
2011
2059
|
var debug3 = (0, import_logger3.getDebug)("cache");
|
@@ -2216,7 +2264,10 @@ var PageAgent = class {
|
|
2216
2264
|
}
|
2217
2265
|
this.taskExecutor = new PageTaskExecutor(this.page, this.insight, {
|
2218
2266
|
taskCache: this.taskCache,
|
2219
|
-
onTaskStart: this.callbackOnTaskStartTip.bind(this)
|
2267
|
+
onTaskStart: this.callbackOnTaskStartTip.bind(this),
|
2268
|
+
memoryConfig: opts?.memoryConfig,
|
2269
|
+
sessionId: opts?.sessionId,
|
2270
|
+
workflowId: opts?.workflowId
|
2220
2271
|
});
|
2221
2272
|
this.dump = this.resetDump();
|
2222
2273
|
this.reportFileName = reportFileName(
|
@@ -2297,22 +2348,28 @@ var PageAgent = class {
|
|
2297
2348
|
const allThoughts = executor.tasks.filter((task) => task.thought).map((task) => task.thought);
|
2298
2349
|
const allLocates = executor.tasks.filter((task) => task.locate).map((task) => task.locate);
|
2299
2350
|
const allPlans = executor.tasks.filter((task) => task.param?.plans).map((task) => task.param?.plans);
|
2300
|
-
const planningTasks = executor.tasks.filter(
|
2301
|
-
|
2351
|
+
const planningTasks = executor.tasks.filter(
|
2352
|
+
(task) => task.type === "Planning"
|
2353
|
+
);
|
2354
|
+
const insightTasks = executor.tasks.filter(
|
2355
|
+
(task) => task.type === "Insight"
|
2356
|
+
);
|
2302
2357
|
const actionTasks = executor.tasks.filter((task) => task.type === "Action");
|
2303
2358
|
const planning = planningTasks.length > 0 ? {
|
2304
2359
|
type: "Planning",
|
2305
|
-
description:
|
2360
|
+
description: "Planning for task execution",
|
2306
2361
|
steps: planningTasks.map((task) => task.thought || "Planning step")
|
2307
2362
|
} : void 0;
|
2308
2363
|
const insight = insightTasks.length > 0 ? {
|
2309
2364
|
type: "Insight",
|
2310
|
-
description:
|
2311
|
-
elements: insightTasks.map(
|
2365
|
+
description: "Insight for task execution",
|
2366
|
+
elements: insightTasks.map(
|
2367
|
+
(task) => task.thought || "Insight element"
|
2368
|
+
)
|
2312
2369
|
} : void 0;
|
2313
2370
|
const action = actionTasks.length > 0 ? {
|
2314
2371
|
type: "Action",
|
2315
|
-
description:
|
2372
|
+
description: "Action for task execution",
|
2316
2373
|
result: lastTask?.output
|
2317
2374
|
} : void 0;
|
2318
2375
|
const actionDetails = executor.tasks.map((task) => ({
|
@@ -2646,7 +2703,10 @@ ${memoryContext}` : void 0;
|
|
2646
2703
|
}
|
2647
2704
|
const memoryContext = this.getMemoryAsContext();
|
2648
2705
|
const assertionWithContext = currentUrl ? `For the page at URL "${currentUrl}", ${assertion}` : assertion;
|
2649
|
-
const { output, executor } = await this.taskExecutor.assert(
|
2706
|
+
const { output, executor } = await this.taskExecutor.assert(
|
2707
|
+
assertionWithContext,
|
2708
|
+
memoryContext
|
2709
|
+
);
|
2650
2710
|
const metadata = this.afterTaskRunning(executor, true);
|
2651
2711
|
if (output && opt?.keepRawResponse) {
|
2652
2712
|
return {
|
@@ -2667,6 +2727,7 @@ ${reasonMsg}`);
|
|
2667
2727
|
}
|
2668
2728
|
async aiCaptcha(options) {
|
2669
2729
|
const { deepThink = false, autoDetectComplexity = true } = options || {};
|
2730
|
+
const memoryContext = this.getMemoryAsContext();
|
2670
2731
|
let shouldUseDeepThink = deepThink;
|
2671
2732
|
if (autoDetectComplexity && !deepThink) {
|
2672
2733
|
const context = await this.getUIContext();
|
@@ -2684,7 +2745,10 @@ A complex CAPTCHA typically has one or more of these characteristics:
|
|
2684
2745
|
Return only "complex" or "simple" based on your analysis.
|
2685
2746
|
`;
|
2686
2747
|
const complexityMsgs = [
|
2687
|
-
{
|
2748
|
+
{
|
2749
|
+
role: "system",
|
2750
|
+
content: "You are an AI assistant that analyzes screenshots to determine CAPTCHA complexity."
|
2751
|
+
},
|
2688
2752
|
{
|
2689
2753
|
role: "user",
|
2690
2754
|
content: [
|
@@ -2708,7 +2772,12 @@ Return only "complex" or "simple" based on your analysis.
|
|
2708
2772
|
);
|
2709
2773
|
const responseText = typeof complexityResult.content === "string" ? complexityResult.content.toLowerCase() : JSON.stringify(complexityResult.content).toLowerCase();
|
2710
2774
|
shouldUseDeepThink = responseText.includes("complex");
|
2711
|
-
debug4(
|
2775
|
+
debug4(
|
2776
|
+
"CAPTCHA complexity analysis:",
|
2777
|
+
responseText,
|
2778
|
+
"Using deep think:",
|
2779
|
+
shouldUseDeepThink
|
2780
|
+
);
|
2712
2781
|
} catch (error) {
|
2713
2782
|
debug4("Failed to analyze CAPTCHA complexity:", error);
|
2714
2783
|
}
|
@@ -2725,7 +2794,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2725
2794
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2726
2795
|
} else if (action.type === "input" && action.value) {
|
2727
2796
|
if (action.target) {
|
2728
|
-
await this.aiInput(action.value, action.target, {
|
2797
|
+
await this.aiInput(action.value, action.target, {
|
2798
|
+
deepThink: shouldUseDeepThink
|
2799
|
+
});
|
2729
2800
|
}
|
2730
2801
|
} else if (action.type === "verify" && action.target) {
|
2731
2802
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
@@ -2737,7 +2808,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2737
2808
|
if (action.coordinates) {
|
2738
2809
|
const x = action.coordinates[0];
|
2739
2810
|
const y = action.coordinates[1];
|
2740
|
-
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2811
|
+
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2812
|
+
deepThink: shouldUseDeepThink
|
2813
|
+
});
|
2741
2814
|
} else if (action.target) {
|
2742
2815
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2743
2816
|
}
|
@@ -2747,6 +2820,26 @@ Return only "complex" or "simple" based on your analysis.
|
|
2747
2820
|
}
|
2748
2821
|
}
|
2749
2822
|
await new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
2823
|
+
const captchaMemoryItem = {
|
2824
|
+
id: `captcha_${Date.now()}`,
|
2825
|
+
timestamp: Date.now(),
|
2826
|
+
taskType: "Action",
|
2827
|
+
summary: `Solved ${captchaResult.captchaType} CAPTCHA: ${captchaResult.thought}`,
|
2828
|
+
context: {
|
2829
|
+
url: await this.page.url?.() || "",
|
2830
|
+
captchaType: captchaResult.captchaType,
|
2831
|
+
actions: captchaResult.actions,
|
2832
|
+
deepThink: actualDeepThink
|
2833
|
+
},
|
2834
|
+
metadata: {
|
2835
|
+
executionTime: Date.now() - Date.now(),
|
2836
|
+
// Will be updated
|
2837
|
+
success: true,
|
2838
|
+
confidence: 0.9
|
2839
|
+
},
|
2840
|
+
tags: ["captcha", "action", captchaResult.captchaType]
|
2841
|
+
};
|
2842
|
+
this.taskExecutor.addToMemory(captchaMemoryItem);
|
2750
2843
|
const metadata = {
|
2751
2844
|
status: "finished",
|
2752
2845
|
usage,
|
@@ -2763,10 +2856,15 @@ Return only "complex" or "simple" based on your analysis.
|
|
2763
2856
|
}
|
2764
2857
|
async aiWaitFor(assertion, opt) {
|
2765
2858
|
const startTime = Date.now();
|
2766
|
-
const
|
2859
|
+
const memoryContext = this.getMemoryAsContext();
|
2860
|
+
const assertionWithContext = memoryContext ? `${assertion}
|
2861
|
+
|
2862
|
+
Previous workflow steps:
|
2863
|
+
${memoryContext}` : assertion;
|
2864
|
+
const { executor } = await this.taskExecutor.waitFor(assertionWithContext, {
|
2767
2865
|
timeoutMs: opt?.timeoutMs || 15 * 1e3,
|
2768
2866
|
checkIntervalMs: opt?.checkIntervalMs || 3 * 1e3,
|
2769
|
-
assertion
|
2867
|
+
assertion: assertionWithContext
|
2770
2868
|
});
|
2771
2869
|
const metadata = {
|
2772
2870
|
status: executor.isInErrorState() ? "failed" : "finished",
|
@@ -2864,25 +2962,27 @@ ${errors}`);
|
|
2864
2962
|
const executionDump = {
|
2865
2963
|
name: screenshotTitle,
|
2866
2964
|
description: content,
|
2867
|
-
tasks: [
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2880
|
-
|
2881
|
-
|
2882
|
-
|
2883
|
-
|
2965
|
+
tasks: [
|
2966
|
+
{
|
2967
|
+
type: "Screenshot",
|
2968
|
+
subType: "log",
|
2969
|
+
status: "finished",
|
2970
|
+
executor: null,
|
2971
|
+
param: {
|
2972
|
+
title: screenshotTitle,
|
2973
|
+
content
|
2974
|
+
},
|
2975
|
+
output: {
|
2976
|
+
screenshot
|
2977
|
+
},
|
2978
|
+
thought: `Logged screenshot: ${screenshotTitle}`,
|
2979
|
+
timing: {
|
2980
|
+
start: Date.now(),
|
2981
|
+
end: Date.now(),
|
2982
|
+
cost: 0
|
2983
|
+
}
|
2884
2984
|
}
|
2885
|
-
|
2985
|
+
],
|
2886
2986
|
sdkVersion: "1.0.0",
|
2887
2987
|
logTime: Date.now(),
|
2888
2988
|
model_name: "screenshot"
|
@@ -2934,7 +3034,9 @@ ${errors}`);
|
|
2934
3034
|
totalTasks: stats.analytics.totalTasks,
|
2935
3035
|
memoryHits: stats.analytics.memoryHits,
|
2936
3036
|
memoryMisses: stats.analytics.memoryMisses,
|
2937
|
-
memoryEffectiveness: Math.round(
|
3037
|
+
memoryEffectiveness: Math.round(
|
3038
|
+
stats.analytics.memoryEffectiveness * 100
|
3039
|
+
),
|
2938
3040
|
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
2939
3041
|
},
|
2940
3042
|
config: stats.config,
|
@@ -2998,7 +3100,9 @@ ${errors}`);
|
|
2998
3100
|
calculateSuccessRate(memory) {
|
2999
3101
|
if (memory.length === 0)
|
3000
3102
|
return 0;
|
3001
|
-
const successCount = memory.filter(
|
3103
|
+
const successCount = memory.filter(
|
3104
|
+
(item) => item.metadata?.success !== false
|
3105
|
+
).length;
|
3002
3106
|
return Math.round(successCount / memory.length * 100);
|
3003
3107
|
}
|
3004
3108
|
calculateAverageExecutionTime(memory) {
|
@@ -3316,8 +3420,8 @@ var WebPage = class extends Page {
|
|
3316
3420
|
|
3317
3421
|
// src/playwright/ai-fixture.ts
|
3318
3422
|
var import_node_crypto = require("crypto");
|
3319
|
-
var import_logger6 = require("misoai-shared/logger");
|
3320
3423
|
var import_test = require("@playwright/test");
|
3424
|
+
var import_logger6 = require("misoai-shared/logger");
|
3321
3425
|
var debugPage2 = (0, import_logger6.getDebug)("web:playwright:ai-fixture");
|
3322
3426
|
var groupAndCaseForTest = (testInfo) => {
|
3323
3427
|
let taskFile;
|