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