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/agent.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 {
|
@@ -620,8 +620,12 @@ var WorkflowMemory = class {
|
|
620
620
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
621
621
|
workflow.memory = [...memory];
|
622
622
|
workflow.metadata.totalSteps = workflow.steps.length;
|
623
|
-
workflow.metadata.completedSteps = workflow.steps.filter(
|
624
|
-
|
623
|
+
workflow.metadata.completedSteps = workflow.steps.filter(
|
624
|
+
(s) => s.status === "completed"
|
625
|
+
).length;
|
626
|
+
workflow.metadata.failedSteps = workflow.steps.filter(
|
627
|
+
(s) => s.status === "failed"
|
628
|
+
).length;
|
625
629
|
this.workflows.set(workflowId, workflow);
|
626
630
|
this.enforceRetentionPolicy();
|
627
631
|
}
|
@@ -632,7 +636,9 @@ var WorkflowMemory = class {
|
|
632
636
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
633
637
|
workflow.context = { ...workflow.context, ...context };
|
634
638
|
if (context.currentStep) {
|
635
|
-
const existingStep = workflow.steps.find(
|
639
|
+
const existingStep = workflow.steps.find(
|
640
|
+
(s) => s.stepName === context.currentStep
|
641
|
+
);
|
636
642
|
if (!existingStep) {
|
637
643
|
workflow.steps.push({
|
638
644
|
stepId: `step_${workflow.steps.length + 1}`,
|
@@ -677,7 +683,9 @@ var WorkflowMemory = class {
|
|
677
683
|
enforceRetentionPolicy() {
|
678
684
|
const maxWorkflows = 10;
|
679
685
|
if (this.workflows.size > maxWorkflows) {
|
680
|
-
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
686
|
+
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
687
|
+
([, a], [, b]) => (b.metadata.endTime || b.metadata.startTime) - (a.metadata.endTime || a.metadata.startTime)
|
688
|
+
);
|
681
689
|
const toDelete = sortedWorkflows.slice(maxWorkflows);
|
682
690
|
toDelete.forEach(([workflowId]) => this.workflows.delete(workflowId));
|
683
691
|
}
|
@@ -1416,7 +1424,9 @@ var PageTaskExecutor = class {
|
|
1416
1424
|
*/
|
1417
1425
|
getPersistentExecutor() {
|
1418
1426
|
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1419
|
-
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1427
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1428
|
+
this.sessionContext.workflowId
|
1429
|
+
);
|
1420
1430
|
this.persistentExecutor = new Executor("Persistent Task Executor", {
|
1421
1431
|
onTaskStart: this.onTaskStartCallback,
|
1422
1432
|
initialMemory: previousMemory
|
@@ -1445,7 +1455,9 @@ var PageTaskExecutor = class {
|
|
1445
1455
|
if (this.persistentExecutor) {
|
1446
1456
|
this.persistentExecutor.clearMemory();
|
1447
1457
|
}
|
1448
|
-
this.workflowMemory.clearWorkflow(
|
1458
|
+
this.workflowMemory.clearWorkflow(
|
1459
|
+
this.sessionContext.workflowId || "default"
|
1460
|
+
);
|
1449
1461
|
}
|
1450
1462
|
/**
|
1451
1463
|
* Mevcut hafızayı döndürür
|
@@ -1457,7 +1469,9 @@ var PageTaskExecutor = class {
|
|
1457
1469
|
* İş akışı hafızasını döndürür
|
1458
1470
|
*/
|
1459
1471
|
getWorkflowMemory() {
|
1460
|
-
return this.workflowMemory.getWorkflowData(
|
1472
|
+
return this.workflowMemory.getWorkflowData(
|
1473
|
+
this.sessionContext.workflowId || "default"
|
1474
|
+
);
|
1461
1475
|
}
|
1462
1476
|
/**
|
1463
1477
|
* Hafıza istatistiklerini döndürür
|
@@ -1465,7 +1479,13 @@ var PageTaskExecutor = class {
|
|
1465
1479
|
getMemoryStats() {
|
1466
1480
|
return this.persistentExecutor?.getMemoryStats() || {
|
1467
1481
|
totalItems: 0,
|
1468
|
-
analytics: {
|
1482
|
+
analytics: {
|
1483
|
+
totalTasks: 0,
|
1484
|
+
memoryHits: 0,
|
1485
|
+
memoryMisses: 0,
|
1486
|
+
averageMemorySize: 0,
|
1487
|
+
memoryEffectiveness: 0
|
1488
|
+
},
|
1469
1489
|
config: this.memoryConfig
|
1470
1490
|
};
|
1471
1491
|
}
|
@@ -1501,11 +1521,14 @@ var PageTaskExecutor = class {
|
|
1501
1521
|
let taskExecutor;
|
1502
1522
|
if (useMemory) {
|
1503
1523
|
taskExecutor = this.getPersistentExecutor();
|
1504
|
-
this.workflowMemory.updateWorkflowContext(
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1524
|
+
this.workflowMemory.updateWorkflowContext(
|
1525
|
+
{
|
1526
|
+
currentStep: title,
|
1527
|
+
pageInfo: this.sessionContext.pageInfo,
|
1528
|
+
timestamp: Date.now()
|
1529
|
+
},
|
1530
|
+
this.sessionContext.workflowId || "default"
|
1531
|
+
);
|
1509
1532
|
} else {
|
1510
1533
|
taskExecutor = new Executor(title, {
|
1511
1534
|
onTaskStart: this.onTaskStartCallback
|
@@ -1803,9 +1826,15 @@ var PageTaskExecutor = class {
|
|
1803
1826
|
}
|
1804
1827
|
async waitFor(assertion, opt) {
|
1805
1828
|
const description = `waitFor: ${assertion}`;
|
1806
|
-
const
|
1807
|
-
|
1808
|
-
|
1829
|
+
const useMemory = true;
|
1830
|
+
let taskExecutor;
|
1831
|
+
if (useMemory) {
|
1832
|
+
taskExecutor = this.getPersistentExecutor();
|
1833
|
+
} else {
|
1834
|
+
taskExecutor = new Executor(taskTitleStr("WaitFor", description), {
|
1835
|
+
onTaskStart: this.onTaskStartCallback
|
1836
|
+
});
|
1837
|
+
}
|
1809
1838
|
const { timeoutMs, checkIntervalMs } = opt;
|
1810
1839
|
assert4(assertion, "No assertion for waitFor");
|
1811
1840
|
assert4(timeoutMs, "No timeoutMs for waitFor");
|
@@ -1860,6 +1889,25 @@ var PageTaskExecutor = class {
|
|
1860
1889
|
`waitFor timeout: ${errorThought}`
|
1861
1890
|
);
|
1862
1891
|
}
|
1892
|
+
/**
|
1893
|
+
* Hafızaya yeni bir öğe ekler
|
1894
|
+
*/
|
1895
|
+
addToMemory(memoryItem) {
|
1896
|
+
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1897
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1898
|
+
this.sessionContext.workflowId
|
1899
|
+
);
|
1900
|
+
this.persistentExecutor = new Executor("Persistent Task Executor", {
|
1901
|
+
onTaskStart: this.onTaskStartCallback,
|
1902
|
+
initialMemory: previousMemory
|
1903
|
+
});
|
1904
|
+
}
|
1905
|
+
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1906
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation(
|
1907
|
+
"add",
|
1908
|
+
memoryItem
|
1909
|
+
);
|
1910
|
+
}
|
1863
1911
|
};
|
1864
1912
|
|
1865
1913
|
// src/common/plan-builder.ts
|
@@ -1947,14 +1995,14 @@ function buildPlans(type, locateParam, param) {
|
|
1947
1995
|
import assert6 from "assert";
|
1948
1996
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, writeFileSync as writeFileSync2 } from "fs";
|
1949
1997
|
import { dirname as dirname2, join as join2 } from "path";
|
1998
|
+
import yaml3 from "js-yaml";
|
1950
1999
|
import { getMidsceneRunSubDir as getMidsceneRunSubDir2 } from "misoai-shared/common";
|
1951
2000
|
import { getDebug as getDebug3 } from "misoai-shared/logger";
|
1952
2001
|
import { ifInBrowser as ifInBrowser2 } from "misoai-shared/utils";
|
1953
|
-
import yaml3 from "js-yaml";
|
1954
2002
|
import semver from "semver";
|
1955
2003
|
|
1956
2004
|
// package.json
|
1957
|
-
var version = "1.
|
2005
|
+
var version = "1.6.1";
|
1958
2006
|
|
1959
2007
|
// src/common/task-cache.ts
|
1960
2008
|
var debug3 = getDebug3("cache");
|
@@ -2165,7 +2213,10 @@ var PageAgent = class {
|
|
2165
2213
|
}
|
2166
2214
|
this.taskExecutor = new PageTaskExecutor(this.page, this.insight, {
|
2167
2215
|
taskCache: this.taskCache,
|
2168
|
-
onTaskStart: this.callbackOnTaskStartTip.bind(this)
|
2216
|
+
onTaskStart: this.callbackOnTaskStartTip.bind(this),
|
2217
|
+
memoryConfig: opts?.memoryConfig,
|
2218
|
+
sessionId: opts?.sessionId,
|
2219
|
+
workflowId: opts?.workflowId
|
2169
2220
|
});
|
2170
2221
|
this.dump = this.resetDump();
|
2171
2222
|
this.reportFileName = reportFileName(
|
@@ -2246,22 +2297,28 @@ var PageAgent = class {
|
|
2246
2297
|
const allThoughts = executor.tasks.filter((task) => task.thought).map((task) => task.thought);
|
2247
2298
|
const allLocates = executor.tasks.filter((task) => task.locate).map((task) => task.locate);
|
2248
2299
|
const allPlans = executor.tasks.filter((task) => task.param?.plans).map((task) => task.param?.plans);
|
2249
|
-
const planningTasks = executor.tasks.filter(
|
2250
|
-
|
2300
|
+
const planningTasks = executor.tasks.filter(
|
2301
|
+
(task) => task.type === "Planning"
|
2302
|
+
);
|
2303
|
+
const insightTasks = executor.tasks.filter(
|
2304
|
+
(task) => task.type === "Insight"
|
2305
|
+
);
|
2251
2306
|
const actionTasks = executor.tasks.filter((task) => task.type === "Action");
|
2252
2307
|
const planning = planningTasks.length > 0 ? {
|
2253
2308
|
type: "Planning",
|
2254
|
-
description:
|
2309
|
+
description: "Planning for task execution",
|
2255
2310
|
steps: planningTasks.map((task) => task.thought || "Planning step")
|
2256
2311
|
} : void 0;
|
2257
2312
|
const insight = insightTasks.length > 0 ? {
|
2258
2313
|
type: "Insight",
|
2259
|
-
description:
|
2260
|
-
elements: insightTasks.map(
|
2314
|
+
description: "Insight for task execution",
|
2315
|
+
elements: insightTasks.map(
|
2316
|
+
(task) => task.thought || "Insight element"
|
2317
|
+
)
|
2261
2318
|
} : void 0;
|
2262
2319
|
const action = actionTasks.length > 0 ? {
|
2263
2320
|
type: "Action",
|
2264
|
-
description:
|
2321
|
+
description: "Action for task execution",
|
2265
2322
|
result: lastTask?.output
|
2266
2323
|
} : void 0;
|
2267
2324
|
const actionDetails = executor.tasks.map((task) => ({
|
@@ -2595,7 +2652,10 @@ ${memoryContext}` : void 0;
|
|
2595
2652
|
}
|
2596
2653
|
const memoryContext = this.getMemoryAsContext();
|
2597
2654
|
const assertionWithContext = currentUrl ? `For the page at URL "${currentUrl}", ${assertion}` : assertion;
|
2598
|
-
const { output, executor } = await this.taskExecutor.assert(
|
2655
|
+
const { output, executor } = await this.taskExecutor.assert(
|
2656
|
+
assertionWithContext,
|
2657
|
+
memoryContext
|
2658
|
+
);
|
2599
2659
|
const metadata = this.afterTaskRunning(executor, true);
|
2600
2660
|
if (output && opt?.keepRawResponse) {
|
2601
2661
|
return {
|
@@ -2616,6 +2676,7 @@ ${reasonMsg}`);
|
|
2616
2676
|
}
|
2617
2677
|
async aiCaptcha(options) {
|
2618
2678
|
const { deepThink = false, autoDetectComplexity = true } = options || {};
|
2679
|
+
const memoryContext = this.getMemoryAsContext();
|
2619
2680
|
let shouldUseDeepThink = deepThink;
|
2620
2681
|
if (autoDetectComplexity && !deepThink) {
|
2621
2682
|
const context = await this.getUIContext();
|
@@ -2633,7 +2694,10 @@ A complex CAPTCHA typically has one or more of these characteristics:
|
|
2633
2694
|
Return only "complex" or "simple" based on your analysis.
|
2634
2695
|
`;
|
2635
2696
|
const complexityMsgs = [
|
2636
|
-
{
|
2697
|
+
{
|
2698
|
+
role: "system",
|
2699
|
+
content: "You are an AI assistant that analyzes screenshots to determine CAPTCHA complexity."
|
2700
|
+
},
|
2637
2701
|
{
|
2638
2702
|
role: "user",
|
2639
2703
|
content: [
|
@@ -2657,7 +2721,12 @@ Return only "complex" or "simple" based on your analysis.
|
|
2657
2721
|
);
|
2658
2722
|
const responseText = typeof complexityResult.content === "string" ? complexityResult.content.toLowerCase() : JSON.stringify(complexityResult.content).toLowerCase();
|
2659
2723
|
shouldUseDeepThink = responseText.includes("complex");
|
2660
|
-
debug4(
|
2724
|
+
debug4(
|
2725
|
+
"CAPTCHA complexity analysis:",
|
2726
|
+
responseText,
|
2727
|
+
"Using deep think:",
|
2728
|
+
shouldUseDeepThink
|
2729
|
+
);
|
2661
2730
|
} catch (error) {
|
2662
2731
|
debug4("Failed to analyze CAPTCHA complexity:", error);
|
2663
2732
|
}
|
@@ -2674,7 +2743,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2674
2743
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2675
2744
|
} else if (action.type === "input" && action.value) {
|
2676
2745
|
if (action.target) {
|
2677
|
-
await this.aiInput(action.value, action.target, {
|
2746
|
+
await this.aiInput(action.value, action.target, {
|
2747
|
+
deepThink: shouldUseDeepThink
|
2748
|
+
});
|
2678
2749
|
}
|
2679
2750
|
} else if (action.type === "verify" && action.target) {
|
2680
2751
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
@@ -2686,7 +2757,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2686
2757
|
if (action.coordinates) {
|
2687
2758
|
const x = action.coordinates[0];
|
2688
2759
|
const y = action.coordinates[1];
|
2689
|
-
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2760
|
+
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2761
|
+
deepThink: shouldUseDeepThink
|
2762
|
+
});
|
2690
2763
|
} else if (action.target) {
|
2691
2764
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2692
2765
|
}
|
@@ -2696,6 +2769,26 @@ Return only "complex" or "simple" based on your analysis.
|
|
2696
2769
|
}
|
2697
2770
|
}
|
2698
2771
|
await new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
2772
|
+
const captchaMemoryItem = {
|
2773
|
+
id: `captcha_${Date.now()}`,
|
2774
|
+
timestamp: Date.now(),
|
2775
|
+
taskType: "Action",
|
2776
|
+
summary: `Solved ${captchaResult.captchaType} CAPTCHA: ${captchaResult.thought}`,
|
2777
|
+
context: {
|
2778
|
+
url: await this.page.url?.() || "",
|
2779
|
+
captchaType: captchaResult.captchaType,
|
2780
|
+
actions: captchaResult.actions,
|
2781
|
+
deepThink: actualDeepThink
|
2782
|
+
},
|
2783
|
+
metadata: {
|
2784
|
+
executionTime: Date.now() - Date.now(),
|
2785
|
+
// Will be updated
|
2786
|
+
success: true,
|
2787
|
+
confidence: 0.9
|
2788
|
+
},
|
2789
|
+
tags: ["captcha", "action", captchaResult.captchaType]
|
2790
|
+
};
|
2791
|
+
this.taskExecutor.addToMemory(captchaMemoryItem);
|
2699
2792
|
const metadata = {
|
2700
2793
|
status: "finished",
|
2701
2794
|
usage,
|
@@ -2712,10 +2805,15 @@ Return only "complex" or "simple" based on your analysis.
|
|
2712
2805
|
}
|
2713
2806
|
async aiWaitFor(assertion, opt) {
|
2714
2807
|
const startTime = Date.now();
|
2715
|
-
const
|
2808
|
+
const memoryContext = this.getMemoryAsContext();
|
2809
|
+
const assertionWithContext = memoryContext ? `${assertion}
|
2810
|
+
|
2811
|
+
Previous workflow steps:
|
2812
|
+
${memoryContext}` : assertion;
|
2813
|
+
const { executor } = await this.taskExecutor.waitFor(assertionWithContext, {
|
2716
2814
|
timeoutMs: opt?.timeoutMs || 15 * 1e3,
|
2717
2815
|
checkIntervalMs: opt?.checkIntervalMs || 3 * 1e3,
|
2718
|
-
assertion
|
2816
|
+
assertion: assertionWithContext
|
2719
2817
|
});
|
2720
2818
|
const metadata = {
|
2721
2819
|
status: executor.isInErrorState() ? "failed" : "finished",
|
@@ -2813,25 +2911,27 @@ ${errors}`);
|
|
2813
2911
|
const executionDump = {
|
2814
2912
|
name: screenshotTitle,
|
2815
2913
|
description: content,
|
2816
|
-
tasks: [
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2914
|
+
tasks: [
|
2915
|
+
{
|
2916
|
+
type: "Screenshot",
|
2917
|
+
subType: "log",
|
2918
|
+
status: "finished",
|
2919
|
+
executor: null,
|
2920
|
+
param: {
|
2921
|
+
title: screenshotTitle,
|
2922
|
+
content
|
2923
|
+
},
|
2924
|
+
output: {
|
2925
|
+
screenshot
|
2926
|
+
},
|
2927
|
+
thought: `Logged screenshot: ${screenshotTitle}`,
|
2928
|
+
timing: {
|
2929
|
+
start: Date.now(),
|
2930
|
+
end: Date.now(),
|
2931
|
+
cost: 0
|
2932
|
+
}
|
2833
2933
|
}
|
2834
|
-
|
2934
|
+
],
|
2835
2935
|
sdkVersion: "1.0.0",
|
2836
2936
|
logTime: Date.now(),
|
2837
2937
|
model_name: "screenshot"
|
@@ -2883,7 +2983,9 @@ ${errors}`);
|
|
2883
2983
|
totalTasks: stats.analytics.totalTasks,
|
2884
2984
|
memoryHits: stats.analytics.memoryHits,
|
2885
2985
|
memoryMisses: stats.analytics.memoryMisses,
|
2886
|
-
memoryEffectiveness: Math.round(
|
2986
|
+
memoryEffectiveness: Math.round(
|
2987
|
+
stats.analytics.memoryEffectiveness * 100
|
2988
|
+
),
|
2887
2989
|
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
2888
2990
|
},
|
2889
2991
|
config: stats.config,
|
@@ -2947,7 +3049,9 @@ ${errors}`);
|
|
2947
3049
|
calculateSuccessRate(memory) {
|
2948
3050
|
if (memory.length === 0)
|
2949
3051
|
return 0;
|
2950
|
-
const successCount = memory.filter(
|
3052
|
+
const successCount = memory.filter(
|
3053
|
+
(item) => item.metadata?.success !== false
|
3054
|
+
).length;
|
2951
3055
|
return Math.round(successCount / memory.length * 100);
|
2952
3056
|
}
|
2953
3057
|
calculateAverageExecutionTime(memory) {
|