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
@@ -23,13 +23,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
23
23
|
));
|
24
24
|
|
25
25
|
// src/common/utils.ts
|
26
|
+
var import_dayjs = __toESM(require("dayjs"));
|
26
27
|
var import_ai_model = require("misoai-core/ai-model");
|
27
28
|
var import_utils = require("misoai-core/utils");
|
28
29
|
var import_env = require("misoai-shared/env");
|
29
30
|
var import_extractor = require("misoai-shared/extractor");
|
30
31
|
var import_img = require("misoai-shared/img");
|
31
32
|
var import_utils2 = require("misoai-shared/utils");
|
32
|
-
var import_dayjs = __toESM(require("dayjs"));
|
33
33
|
|
34
34
|
// src/web-element.ts
|
35
35
|
var WebElementInfo = class {
|
@@ -448,8 +448,8 @@ var ScriptPlayer = class {
|
|
448
448
|
var import_js_yaml = __toESM(require("js-yaml"));
|
449
449
|
|
450
450
|
// src/yaml/utils.ts
|
451
|
-
var import_utils4 = require("misoai-shared/utils");
|
452
451
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
452
|
+
var import_utils4 = require("misoai-shared/utils");
|
453
453
|
function interpolateEnvVars(content) {
|
454
454
|
return content.replace(/\$\{([^}]+)\}/g, (_, envVar) => {
|
455
455
|
const value = process.env[envVar.trim()];
|
@@ -625,8 +625,12 @@ var WorkflowMemory = class {
|
|
625
625
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
626
626
|
workflow.memory = [...memory];
|
627
627
|
workflow.metadata.totalSteps = workflow.steps.length;
|
628
|
-
workflow.metadata.completedSteps = workflow.steps.filter(
|
629
|
-
|
628
|
+
workflow.metadata.completedSteps = workflow.steps.filter(
|
629
|
+
(s) => s.status === "completed"
|
630
|
+
).length;
|
631
|
+
workflow.metadata.failedSteps = workflow.steps.filter(
|
632
|
+
(s) => s.status === "failed"
|
633
|
+
).length;
|
630
634
|
this.workflows.set(workflowId, workflow);
|
631
635
|
this.enforceRetentionPolicy();
|
632
636
|
}
|
@@ -637,7 +641,9 @@ var WorkflowMemory = class {
|
|
637
641
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
638
642
|
workflow.context = { ...workflow.context, ...context };
|
639
643
|
if (context.currentStep) {
|
640
|
-
const existingStep = workflow.steps.find(
|
644
|
+
const existingStep = workflow.steps.find(
|
645
|
+
(s) => s.stepName === context.currentStep
|
646
|
+
);
|
641
647
|
if (!existingStep) {
|
642
648
|
workflow.steps.push({
|
643
649
|
stepId: `step_${workflow.steps.length + 1}`,
|
@@ -682,7 +688,9 @@ var WorkflowMemory = class {
|
|
682
688
|
enforceRetentionPolicy() {
|
683
689
|
const maxWorkflows = 10;
|
684
690
|
if (this.workflows.size > maxWorkflows) {
|
685
|
-
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
691
|
+
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
692
|
+
([, a], [, b]) => (b.metadata.endTime || b.metadata.startTime) - (a.metadata.endTime || a.metadata.startTime)
|
693
|
+
);
|
686
694
|
const toDelete = sortedWorkflows.slice(maxWorkflows);
|
687
695
|
toDelete.forEach(([workflowId]) => this.workflows.delete(workflowId));
|
688
696
|
}
|
@@ -1421,7 +1429,9 @@ var PageTaskExecutor = class {
|
|
1421
1429
|
*/
|
1422
1430
|
getPersistentExecutor() {
|
1423
1431
|
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1424
|
-
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1432
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1433
|
+
this.sessionContext.workflowId
|
1434
|
+
);
|
1425
1435
|
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1426
1436
|
onTaskStart: this.onTaskStartCallback,
|
1427
1437
|
initialMemory: previousMemory
|
@@ -1450,7 +1460,9 @@ var PageTaskExecutor = class {
|
|
1450
1460
|
if (this.persistentExecutor) {
|
1451
1461
|
this.persistentExecutor.clearMemory();
|
1452
1462
|
}
|
1453
|
-
this.workflowMemory.clearWorkflow(
|
1463
|
+
this.workflowMemory.clearWorkflow(
|
1464
|
+
this.sessionContext.workflowId || "default"
|
1465
|
+
);
|
1454
1466
|
}
|
1455
1467
|
/**
|
1456
1468
|
* Mevcut hafızayı döndürür
|
@@ -1462,7 +1474,9 @@ var PageTaskExecutor = class {
|
|
1462
1474
|
* İş akışı hafızasını döndürür
|
1463
1475
|
*/
|
1464
1476
|
getWorkflowMemory() {
|
1465
|
-
return this.workflowMemory.getWorkflowData(
|
1477
|
+
return this.workflowMemory.getWorkflowData(
|
1478
|
+
this.sessionContext.workflowId || "default"
|
1479
|
+
);
|
1466
1480
|
}
|
1467
1481
|
/**
|
1468
1482
|
* Hafıza istatistiklerini döndürür
|
@@ -1470,7 +1484,13 @@ var PageTaskExecutor = class {
|
|
1470
1484
|
getMemoryStats() {
|
1471
1485
|
return this.persistentExecutor?.getMemoryStats() || {
|
1472
1486
|
totalItems: 0,
|
1473
|
-
analytics: {
|
1487
|
+
analytics: {
|
1488
|
+
totalTasks: 0,
|
1489
|
+
memoryHits: 0,
|
1490
|
+
memoryMisses: 0,
|
1491
|
+
averageMemorySize: 0,
|
1492
|
+
memoryEffectiveness: 0
|
1493
|
+
},
|
1474
1494
|
config: this.memoryConfig
|
1475
1495
|
};
|
1476
1496
|
}
|
@@ -1506,11 +1526,14 @@ var PageTaskExecutor = class {
|
|
1506
1526
|
let taskExecutor;
|
1507
1527
|
if (useMemory) {
|
1508
1528
|
taskExecutor = this.getPersistentExecutor();
|
1509
|
-
this.workflowMemory.updateWorkflowContext(
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1529
|
+
this.workflowMemory.updateWorkflowContext(
|
1530
|
+
{
|
1531
|
+
currentStep: title,
|
1532
|
+
pageInfo: this.sessionContext.pageInfo,
|
1533
|
+
timestamp: Date.now()
|
1534
|
+
},
|
1535
|
+
this.sessionContext.workflowId || "default"
|
1536
|
+
);
|
1514
1537
|
} else {
|
1515
1538
|
taskExecutor = new import_misoai_core.Executor(title, {
|
1516
1539
|
onTaskStart: this.onTaskStartCallback
|
@@ -1808,9 +1831,15 @@ var PageTaskExecutor = class {
|
|
1808
1831
|
}
|
1809
1832
|
async waitFor(assertion, opt) {
|
1810
1833
|
const description = `waitFor: ${assertion}`;
|
1811
|
-
const
|
1812
|
-
|
1813
|
-
|
1834
|
+
const useMemory = true;
|
1835
|
+
let taskExecutor;
|
1836
|
+
if (useMemory) {
|
1837
|
+
taskExecutor = this.getPersistentExecutor();
|
1838
|
+
} else {
|
1839
|
+
taskExecutor = new import_misoai_core.Executor(taskTitleStr("WaitFor", description), {
|
1840
|
+
onTaskStart: this.onTaskStartCallback
|
1841
|
+
});
|
1842
|
+
}
|
1814
1843
|
const { timeoutMs, checkIntervalMs } = opt;
|
1815
1844
|
(0, import_utils6.assert)(assertion, "No assertion for waitFor");
|
1816
1845
|
(0, import_utils6.assert)(timeoutMs, "No timeoutMs for waitFor");
|
@@ -1865,6 +1894,25 @@ var PageTaskExecutor = class {
|
|
1865
1894
|
`waitFor timeout: ${errorThought}`
|
1866
1895
|
);
|
1867
1896
|
}
|
1897
|
+
/**
|
1898
|
+
* Hafızaya yeni bir öğe ekler
|
1899
|
+
*/
|
1900
|
+
addToMemory(memoryItem) {
|
1901
|
+
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1902
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1903
|
+
this.sessionContext.workflowId
|
1904
|
+
);
|
1905
|
+
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1906
|
+
onTaskStart: this.onTaskStartCallback,
|
1907
|
+
initialMemory: previousMemory
|
1908
|
+
});
|
1909
|
+
}
|
1910
|
+
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1911
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation(
|
1912
|
+
"add",
|
1913
|
+
memoryItem
|
1914
|
+
);
|
1915
|
+
}
|
1868
1916
|
};
|
1869
1917
|
|
1870
1918
|
// src/common/plan-builder.ts
|
@@ -1952,14 +2000,14 @@ function buildPlans(type, locateParam, param) {
|
|
1952
2000
|
var import_node_assert = __toESM(require("assert"));
|
1953
2001
|
var import_node_fs2 = require("fs");
|
1954
2002
|
var import_node_path2 = require("path");
|
2003
|
+
var import_js_yaml3 = __toESM(require("js-yaml"));
|
1955
2004
|
var import_common2 = require("misoai-shared/common");
|
1956
2005
|
var import_logger3 = require("misoai-shared/logger");
|
1957
2006
|
var import_utils9 = require("misoai-shared/utils");
|
1958
|
-
var import_js_yaml3 = __toESM(require("js-yaml"));
|
1959
2007
|
var import_semver = __toESM(require("semver"));
|
1960
2008
|
|
1961
2009
|
// package.json
|
1962
|
-
var version = "1.
|
2010
|
+
var version = "1.6.1";
|
1963
2011
|
|
1964
2012
|
// src/common/task-cache.ts
|
1965
2013
|
var debug3 = (0, import_logger3.getDebug)("cache");
|
@@ -2170,7 +2218,10 @@ var PageAgent = class {
|
|
2170
2218
|
}
|
2171
2219
|
this.taskExecutor = new PageTaskExecutor(this.page, this.insight, {
|
2172
2220
|
taskCache: this.taskCache,
|
2173
|
-
onTaskStart: this.callbackOnTaskStartTip.bind(this)
|
2221
|
+
onTaskStart: this.callbackOnTaskStartTip.bind(this),
|
2222
|
+
memoryConfig: opts?.memoryConfig,
|
2223
|
+
sessionId: opts?.sessionId,
|
2224
|
+
workflowId: opts?.workflowId
|
2174
2225
|
});
|
2175
2226
|
this.dump = this.resetDump();
|
2176
2227
|
this.reportFileName = reportFileName(
|
@@ -2251,22 +2302,28 @@ var PageAgent = class {
|
|
2251
2302
|
const allThoughts = executor.tasks.filter((task) => task.thought).map((task) => task.thought);
|
2252
2303
|
const allLocates = executor.tasks.filter((task) => task.locate).map((task) => task.locate);
|
2253
2304
|
const allPlans = executor.tasks.filter((task) => task.param?.plans).map((task) => task.param?.plans);
|
2254
|
-
const planningTasks = executor.tasks.filter(
|
2255
|
-
|
2305
|
+
const planningTasks = executor.tasks.filter(
|
2306
|
+
(task) => task.type === "Planning"
|
2307
|
+
);
|
2308
|
+
const insightTasks = executor.tasks.filter(
|
2309
|
+
(task) => task.type === "Insight"
|
2310
|
+
);
|
2256
2311
|
const actionTasks = executor.tasks.filter((task) => task.type === "Action");
|
2257
2312
|
const planning = planningTasks.length > 0 ? {
|
2258
2313
|
type: "Planning",
|
2259
|
-
description:
|
2314
|
+
description: "Planning for task execution",
|
2260
2315
|
steps: planningTasks.map((task) => task.thought || "Planning step")
|
2261
2316
|
} : void 0;
|
2262
2317
|
const insight = insightTasks.length > 0 ? {
|
2263
2318
|
type: "Insight",
|
2264
|
-
description:
|
2265
|
-
elements: insightTasks.map(
|
2319
|
+
description: "Insight for task execution",
|
2320
|
+
elements: insightTasks.map(
|
2321
|
+
(task) => task.thought || "Insight element"
|
2322
|
+
)
|
2266
2323
|
} : void 0;
|
2267
2324
|
const action = actionTasks.length > 0 ? {
|
2268
2325
|
type: "Action",
|
2269
|
-
description:
|
2326
|
+
description: "Action for task execution",
|
2270
2327
|
result: lastTask?.output
|
2271
2328
|
} : void 0;
|
2272
2329
|
const actionDetails = executor.tasks.map((task) => ({
|
@@ -2600,7 +2657,10 @@ ${memoryContext}` : void 0;
|
|
2600
2657
|
}
|
2601
2658
|
const memoryContext = this.getMemoryAsContext();
|
2602
2659
|
const assertionWithContext = currentUrl ? `For the page at URL "${currentUrl}", ${assertion}` : assertion;
|
2603
|
-
const { output, executor } = await this.taskExecutor.assert(
|
2660
|
+
const { output, executor } = await this.taskExecutor.assert(
|
2661
|
+
assertionWithContext,
|
2662
|
+
memoryContext
|
2663
|
+
);
|
2604
2664
|
const metadata = this.afterTaskRunning(executor, true);
|
2605
2665
|
if (output && opt?.keepRawResponse) {
|
2606
2666
|
return {
|
@@ -2621,6 +2681,7 @@ ${reasonMsg}`);
|
|
2621
2681
|
}
|
2622
2682
|
async aiCaptcha(options) {
|
2623
2683
|
const { deepThink = false, autoDetectComplexity = true } = options || {};
|
2684
|
+
const memoryContext = this.getMemoryAsContext();
|
2624
2685
|
let shouldUseDeepThink = deepThink;
|
2625
2686
|
if (autoDetectComplexity && !deepThink) {
|
2626
2687
|
const context = await this.getUIContext();
|
@@ -2638,7 +2699,10 @@ A complex CAPTCHA typically has one or more of these characteristics:
|
|
2638
2699
|
Return only "complex" or "simple" based on your analysis.
|
2639
2700
|
`;
|
2640
2701
|
const complexityMsgs = [
|
2641
|
-
{
|
2702
|
+
{
|
2703
|
+
role: "system",
|
2704
|
+
content: "You are an AI assistant that analyzes screenshots to determine CAPTCHA complexity."
|
2705
|
+
},
|
2642
2706
|
{
|
2643
2707
|
role: "user",
|
2644
2708
|
content: [
|
@@ -2662,7 +2726,12 @@ Return only "complex" or "simple" based on your analysis.
|
|
2662
2726
|
);
|
2663
2727
|
const responseText = typeof complexityResult.content === "string" ? complexityResult.content.toLowerCase() : JSON.stringify(complexityResult.content).toLowerCase();
|
2664
2728
|
shouldUseDeepThink = responseText.includes("complex");
|
2665
|
-
debug4(
|
2729
|
+
debug4(
|
2730
|
+
"CAPTCHA complexity analysis:",
|
2731
|
+
responseText,
|
2732
|
+
"Using deep think:",
|
2733
|
+
shouldUseDeepThink
|
2734
|
+
);
|
2666
2735
|
} catch (error) {
|
2667
2736
|
debug4("Failed to analyze CAPTCHA complexity:", error);
|
2668
2737
|
}
|
@@ -2679,7 +2748,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2679
2748
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2680
2749
|
} else if (action.type === "input" && action.value) {
|
2681
2750
|
if (action.target) {
|
2682
|
-
await this.aiInput(action.value, action.target, {
|
2751
|
+
await this.aiInput(action.value, action.target, {
|
2752
|
+
deepThink: shouldUseDeepThink
|
2753
|
+
});
|
2683
2754
|
}
|
2684
2755
|
} else if (action.type === "verify" && action.target) {
|
2685
2756
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
@@ -2691,7 +2762,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2691
2762
|
if (action.coordinates) {
|
2692
2763
|
const x = action.coordinates[0];
|
2693
2764
|
const y = action.coordinates[1];
|
2694
|
-
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2765
|
+
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2766
|
+
deepThink: shouldUseDeepThink
|
2767
|
+
});
|
2695
2768
|
} else if (action.target) {
|
2696
2769
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2697
2770
|
}
|
@@ -2701,6 +2774,26 @@ Return only "complex" or "simple" based on your analysis.
|
|
2701
2774
|
}
|
2702
2775
|
}
|
2703
2776
|
await new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
2777
|
+
const captchaMemoryItem = {
|
2778
|
+
id: `captcha_${Date.now()}`,
|
2779
|
+
timestamp: Date.now(),
|
2780
|
+
taskType: "Action",
|
2781
|
+
summary: `Solved ${captchaResult.captchaType} CAPTCHA: ${captchaResult.thought}`,
|
2782
|
+
context: {
|
2783
|
+
url: await this.page.url?.() || "",
|
2784
|
+
captchaType: captchaResult.captchaType,
|
2785
|
+
actions: captchaResult.actions,
|
2786
|
+
deepThink: actualDeepThink
|
2787
|
+
},
|
2788
|
+
metadata: {
|
2789
|
+
executionTime: Date.now() - Date.now(),
|
2790
|
+
// Will be updated
|
2791
|
+
success: true,
|
2792
|
+
confidence: 0.9
|
2793
|
+
},
|
2794
|
+
tags: ["captcha", "action", captchaResult.captchaType]
|
2795
|
+
};
|
2796
|
+
this.taskExecutor.addToMemory(captchaMemoryItem);
|
2704
2797
|
const metadata = {
|
2705
2798
|
status: "finished",
|
2706
2799
|
usage,
|
@@ -2717,10 +2810,15 @@ Return only "complex" or "simple" based on your analysis.
|
|
2717
2810
|
}
|
2718
2811
|
async aiWaitFor(assertion, opt) {
|
2719
2812
|
const startTime = Date.now();
|
2720
|
-
const
|
2813
|
+
const memoryContext = this.getMemoryAsContext();
|
2814
|
+
const assertionWithContext = memoryContext ? `${assertion}
|
2815
|
+
|
2816
|
+
Previous workflow steps:
|
2817
|
+
${memoryContext}` : assertion;
|
2818
|
+
const { executor } = await this.taskExecutor.waitFor(assertionWithContext, {
|
2721
2819
|
timeoutMs: opt?.timeoutMs || 15 * 1e3,
|
2722
2820
|
checkIntervalMs: opt?.checkIntervalMs || 3 * 1e3,
|
2723
|
-
assertion
|
2821
|
+
assertion: assertionWithContext
|
2724
2822
|
});
|
2725
2823
|
const metadata = {
|
2726
2824
|
status: executor.isInErrorState() ? "failed" : "finished",
|
@@ -2818,25 +2916,27 @@ ${errors}`);
|
|
2818
2916
|
const executionDump = {
|
2819
2917
|
name: screenshotTitle,
|
2820
2918
|
description: content,
|
2821
|
-
tasks: [
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2919
|
+
tasks: [
|
2920
|
+
{
|
2921
|
+
type: "Screenshot",
|
2922
|
+
subType: "log",
|
2923
|
+
status: "finished",
|
2924
|
+
executor: null,
|
2925
|
+
param: {
|
2926
|
+
title: screenshotTitle,
|
2927
|
+
content
|
2928
|
+
},
|
2929
|
+
output: {
|
2930
|
+
screenshot
|
2931
|
+
},
|
2932
|
+
thought: `Logged screenshot: ${screenshotTitle}`,
|
2933
|
+
timing: {
|
2934
|
+
start: Date.now(),
|
2935
|
+
end: Date.now(),
|
2936
|
+
cost: 0
|
2937
|
+
}
|
2838
2938
|
}
|
2839
|
-
|
2939
|
+
],
|
2840
2940
|
sdkVersion: "1.0.0",
|
2841
2941
|
logTime: Date.now(),
|
2842
2942
|
model_name: "screenshot"
|
@@ -2888,7 +2988,9 @@ ${errors}`);
|
|
2888
2988
|
totalTasks: stats.analytics.totalTasks,
|
2889
2989
|
memoryHits: stats.analytics.memoryHits,
|
2890
2990
|
memoryMisses: stats.analytics.memoryMisses,
|
2891
|
-
memoryEffectiveness: Math.round(
|
2991
|
+
memoryEffectiveness: Math.round(
|
2992
|
+
stats.analytics.memoryEffectiveness * 100
|
2993
|
+
),
|
2892
2994
|
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
2893
2995
|
},
|
2894
2996
|
config: stats.config,
|
@@ -2952,7 +3054,9 @@ ${errors}`);
|
|
2952
3054
|
calculateSuccessRate(memory) {
|
2953
3055
|
if (memory.length === 0)
|
2954
3056
|
return 0;
|
2955
|
-
const successCount = memory.filter(
|
3057
|
+
const successCount = memory.filter(
|
3058
|
+
(item) => item.metadata?.success !== false
|
3059
|
+
).length;
|
2956
3060
|
return Math.round(successCount / memory.length * 100);
|
2957
3061
|
}
|
2958
3062
|
calculateAverageExecutionTime(memory) {
|
@@ -3089,13 +3193,13 @@ var StaticPage = class {
|
|
3089
3193
|
var import_node_crypto = require("crypto");
|
3090
3194
|
var import_node_fs3 = require("fs");
|
3091
3195
|
var import_node_path3 = require("path");
|
3196
|
+
var import_cors = __toESM(require("cors"));
|
3197
|
+
var import_dotenv = __toESM(require("dotenv"));
|
3198
|
+
var import_express = __toESM(require("express"));
|
3092
3199
|
var import_utils18 = require("misoai-core/utils");
|
3093
3200
|
var import_constants3 = require("misoai-shared/constants");
|
3094
3201
|
var import_env3 = require("misoai-shared/env");
|
3095
3202
|
var import_utils19 = require("misoai-shared/utils");
|
3096
|
-
var import_cors = __toESM(require("cors"));
|
3097
|
-
var import_dotenv = __toESM(require("dotenv"));
|
3098
|
-
var import_express = __toESM(require("express"));
|
3099
3203
|
var defaultPort = import_constants3.PLAYGROUND_SERVER_PORT;
|
3100
3204
|
var errorHandler = (err, req, res, next) => {
|
3101
3205
|
console.error(err);
|