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/bridge-mode.js
CHANGED
@@ -345,8 +345,8 @@ var ScriptPlayer = class {
|
|
345
345
|
var import_js_yaml = __toESM(require("js-yaml"));
|
346
346
|
|
347
347
|
// src/yaml/utils.ts
|
348
|
-
var import_utils2 = require("misoai-shared/utils");
|
349
348
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
349
|
+
var import_utils2 = require("misoai-shared/utils");
|
350
350
|
function interpolateEnvVars(content) {
|
351
351
|
return content.replace(/\$\{([^}]+)\}/g, (_, envVar) => {
|
352
352
|
const value = process.env[envVar.trim()];
|
@@ -492,13 +492,13 @@ function paramStr(task) {
|
|
492
492
|
}
|
493
493
|
|
494
494
|
// src/common/utils.ts
|
495
|
+
var import_dayjs = __toESM(require("dayjs"));
|
495
496
|
var import_ai_model = require("misoai-core/ai-model");
|
496
497
|
var import_utils3 = require("misoai-core/utils");
|
497
498
|
var import_env = require("misoai-shared/env");
|
498
499
|
var import_extractor = require("misoai-shared/extractor");
|
499
500
|
var import_img = require("misoai-shared/img");
|
500
501
|
var import_utils4 = require("misoai-shared/utils");
|
501
|
-
var import_dayjs = __toESM(require("dayjs"));
|
502
502
|
|
503
503
|
// src/web-element.ts
|
504
504
|
var WebElementInfo = class {
|
@@ -639,8 +639,12 @@ var WorkflowMemory = class {
|
|
639
639
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
640
640
|
workflow.memory = [...memory];
|
641
641
|
workflow.metadata.totalSteps = workflow.steps.length;
|
642
|
-
workflow.metadata.completedSteps = workflow.steps.filter(
|
643
|
-
|
642
|
+
workflow.metadata.completedSteps = workflow.steps.filter(
|
643
|
+
(s) => s.status === "completed"
|
644
|
+
).length;
|
645
|
+
workflow.metadata.failedSteps = workflow.steps.filter(
|
646
|
+
(s) => s.status === "failed"
|
647
|
+
).length;
|
644
648
|
this.workflows.set(workflowId, workflow);
|
645
649
|
this.enforceRetentionPolicy();
|
646
650
|
}
|
@@ -651,7 +655,9 @@ var WorkflowMemory = class {
|
|
651
655
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
652
656
|
workflow.context = { ...workflow.context, ...context };
|
653
657
|
if (context.currentStep) {
|
654
|
-
const existingStep = workflow.steps.find(
|
658
|
+
const existingStep = workflow.steps.find(
|
659
|
+
(s) => s.stepName === context.currentStep
|
660
|
+
);
|
655
661
|
if (!existingStep) {
|
656
662
|
workflow.steps.push({
|
657
663
|
stepId: `step_${workflow.steps.length + 1}`,
|
@@ -696,7 +702,9 @@ var WorkflowMemory = class {
|
|
696
702
|
enforceRetentionPolicy() {
|
697
703
|
const maxWorkflows = 10;
|
698
704
|
if (this.workflows.size > maxWorkflows) {
|
699
|
-
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
705
|
+
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
706
|
+
([, a], [, b]) => (b.metadata.endTime || b.metadata.startTime) - (a.metadata.endTime || a.metadata.startTime)
|
707
|
+
);
|
700
708
|
const toDelete = sortedWorkflows.slice(maxWorkflows);
|
701
709
|
toDelete.forEach(([workflowId]) => this.workflows.delete(workflowId));
|
702
710
|
}
|
@@ -1435,7 +1443,9 @@ var PageTaskExecutor = class {
|
|
1435
1443
|
*/
|
1436
1444
|
getPersistentExecutor() {
|
1437
1445
|
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1438
|
-
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1446
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1447
|
+
this.sessionContext.workflowId
|
1448
|
+
);
|
1439
1449
|
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1440
1450
|
onTaskStart: this.onTaskStartCallback,
|
1441
1451
|
initialMemory: previousMemory
|
@@ -1464,7 +1474,9 @@ var PageTaskExecutor = class {
|
|
1464
1474
|
if (this.persistentExecutor) {
|
1465
1475
|
this.persistentExecutor.clearMemory();
|
1466
1476
|
}
|
1467
|
-
this.workflowMemory.clearWorkflow(
|
1477
|
+
this.workflowMemory.clearWorkflow(
|
1478
|
+
this.sessionContext.workflowId || "default"
|
1479
|
+
);
|
1468
1480
|
}
|
1469
1481
|
/**
|
1470
1482
|
* Mevcut hafızayı döndürür
|
@@ -1476,7 +1488,9 @@ var PageTaskExecutor = class {
|
|
1476
1488
|
* İş akışı hafızasını döndürür
|
1477
1489
|
*/
|
1478
1490
|
getWorkflowMemory() {
|
1479
|
-
return this.workflowMemory.getWorkflowData(
|
1491
|
+
return this.workflowMemory.getWorkflowData(
|
1492
|
+
this.sessionContext.workflowId || "default"
|
1493
|
+
);
|
1480
1494
|
}
|
1481
1495
|
/**
|
1482
1496
|
* Hafıza istatistiklerini döndürür
|
@@ -1484,7 +1498,13 @@ var PageTaskExecutor = class {
|
|
1484
1498
|
getMemoryStats() {
|
1485
1499
|
return this.persistentExecutor?.getMemoryStats() || {
|
1486
1500
|
totalItems: 0,
|
1487
|
-
analytics: {
|
1501
|
+
analytics: {
|
1502
|
+
totalTasks: 0,
|
1503
|
+
memoryHits: 0,
|
1504
|
+
memoryMisses: 0,
|
1505
|
+
averageMemorySize: 0,
|
1506
|
+
memoryEffectiveness: 0
|
1507
|
+
},
|
1488
1508
|
config: this.memoryConfig
|
1489
1509
|
};
|
1490
1510
|
}
|
@@ -1520,11 +1540,14 @@ var PageTaskExecutor = class {
|
|
1520
1540
|
let taskExecutor;
|
1521
1541
|
if (useMemory) {
|
1522
1542
|
taskExecutor = this.getPersistentExecutor();
|
1523
|
-
this.workflowMemory.updateWorkflowContext(
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1543
|
+
this.workflowMemory.updateWorkflowContext(
|
1544
|
+
{
|
1545
|
+
currentStep: title,
|
1546
|
+
pageInfo: this.sessionContext.pageInfo,
|
1547
|
+
timestamp: Date.now()
|
1548
|
+
},
|
1549
|
+
this.sessionContext.workflowId || "default"
|
1550
|
+
);
|
1528
1551
|
} else {
|
1529
1552
|
taskExecutor = new import_misoai_core.Executor(title, {
|
1530
1553
|
onTaskStart: this.onTaskStartCallback
|
@@ -1822,9 +1845,15 @@ var PageTaskExecutor = class {
|
|
1822
1845
|
}
|
1823
1846
|
async waitFor(assertion, opt) {
|
1824
1847
|
const description = `waitFor: ${assertion}`;
|
1825
|
-
const
|
1826
|
-
|
1827
|
-
|
1848
|
+
const useMemory = true;
|
1849
|
+
let taskExecutor;
|
1850
|
+
if (useMemory) {
|
1851
|
+
taskExecutor = this.getPersistentExecutor();
|
1852
|
+
} else {
|
1853
|
+
taskExecutor = new import_misoai_core.Executor(taskTitleStr("WaitFor", description), {
|
1854
|
+
onTaskStart: this.onTaskStartCallback
|
1855
|
+
});
|
1856
|
+
}
|
1828
1857
|
const { timeoutMs, checkIntervalMs } = opt;
|
1829
1858
|
(0, import_utils6.assert)(assertion, "No assertion for waitFor");
|
1830
1859
|
(0, import_utils6.assert)(timeoutMs, "No timeoutMs for waitFor");
|
@@ -1879,6 +1908,25 @@ var PageTaskExecutor = class {
|
|
1879
1908
|
`waitFor timeout: ${errorThought}`
|
1880
1909
|
);
|
1881
1910
|
}
|
1911
|
+
/**
|
1912
|
+
* Hafızaya yeni bir öğe ekler
|
1913
|
+
*/
|
1914
|
+
addToMemory(memoryItem) {
|
1915
|
+
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1916
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1917
|
+
this.sessionContext.workflowId
|
1918
|
+
);
|
1919
|
+
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1920
|
+
onTaskStart: this.onTaskStartCallback,
|
1921
|
+
initialMemory: previousMemory
|
1922
|
+
});
|
1923
|
+
}
|
1924
|
+
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1925
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation(
|
1926
|
+
"add",
|
1927
|
+
memoryItem
|
1928
|
+
);
|
1929
|
+
}
|
1882
1930
|
};
|
1883
1931
|
|
1884
1932
|
// src/common/plan-builder.ts
|
@@ -1966,14 +2014,14 @@ function buildPlans(type, locateParam, param) {
|
|
1966
2014
|
var import_node_assert = __toESM(require("assert"));
|
1967
2015
|
var import_node_fs2 = require("fs");
|
1968
2016
|
var import_node_path2 = require("path");
|
2017
|
+
var import_js_yaml3 = __toESM(require("js-yaml"));
|
1969
2018
|
var import_common2 = require("misoai-shared/common");
|
1970
2019
|
var import_logger3 = require("misoai-shared/logger");
|
1971
2020
|
var import_utils9 = require("misoai-shared/utils");
|
1972
|
-
var import_js_yaml3 = __toESM(require("js-yaml"));
|
1973
2021
|
var import_semver = __toESM(require("semver"));
|
1974
2022
|
|
1975
2023
|
// package.json
|
1976
|
-
var version = "1.
|
2024
|
+
var version = "1.6.1";
|
1977
2025
|
|
1978
2026
|
// src/common/task-cache.ts
|
1979
2027
|
var debug3 = (0, import_logger3.getDebug)("cache");
|
@@ -2184,7 +2232,10 @@ var PageAgent = class {
|
|
2184
2232
|
}
|
2185
2233
|
this.taskExecutor = new PageTaskExecutor(this.page, this.insight, {
|
2186
2234
|
taskCache: this.taskCache,
|
2187
|
-
onTaskStart: this.callbackOnTaskStartTip.bind(this)
|
2235
|
+
onTaskStart: this.callbackOnTaskStartTip.bind(this),
|
2236
|
+
memoryConfig: opts?.memoryConfig,
|
2237
|
+
sessionId: opts?.sessionId,
|
2238
|
+
workflowId: opts?.workflowId
|
2188
2239
|
});
|
2189
2240
|
this.dump = this.resetDump();
|
2190
2241
|
this.reportFileName = reportFileName(
|
@@ -2265,22 +2316,28 @@ var PageAgent = class {
|
|
2265
2316
|
const allThoughts = executor.tasks.filter((task) => task.thought).map((task) => task.thought);
|
2266
2317
|
const allLocates = executor.tasks.filter((task) => task.locate).map((task) => task.locate);
|
2267
2318
|
const allPlans = executor.tasks.filter((task) => task.param?.plans).map((task) => task.param?.plans);
|
2268
|
-
const planningTasks = executor.tasks.filter(
|
2269
|
-
|
2319
|
+
const planningTasks = executor.tasks.filter(
|
2320
|
+
(task) => task.type === "Planning"
|
2321
|
+
);
|
2322
|
+
const insightTasks = executor.tasks.filter(
|
2323
|
+
(task) => task.type === "Insight"
|
2324
|
+
);
|
2270
2325
|
const actionTasks = executor.tasks.filter((task) => task.type === "Action");
|
2271
2326
|
const planning = planningTasks.length > 0 ? {
|
2272
2327
|
type: "Planning",
|
2273
|
-
description:
|
2328
|
+
description: "Planning for task execution",
|
2274
2329
|
steps: planningTasks.map((task) => task.thought || "Planning step")
|
2275
2330
|
} : void 0;
|
2276
2331
|
const insight = insightTasks.length > 0 ? {
|
2277
2332
|
type: "Insight",
|
2278
|
-
description:
|
2279
|
-
elements: insightTasks.map(
|
2333
|
+
description: "Insight for task execution",
|
2334
|
+
elements: insightTasks.map(
|
2335
|
+
(task) => task.thought || "Insight element"
|
2336
|
+
)
|
2280
2337
|
} : void 0;
|
2281
2338
|
const action = actionTasks.length > 0 ? {
|
2282
2339
|
type: "Action",
|
2283
|
-
description:
|
2340
|
+
description: "Action for task execution",
|
2284
2341
|
result: lastTask?.output
|
2285
2342
|
} : void 0;
|
2286
2343
|
const actionDetails = executor.tasks.map((task) => ({
|
@@ -2614,7 +2671,10 @@ ${memoryContext}` : void 0;
|
|
2614
2671
|
}
|
2615
2672
|
const memoryContext = this.getMemoryAsContext();
|
2616
2673
|
const assertionWithContext = currentUrl ? `For the page at URL "${currentUrl}", ${assertion}` : assertion;
|
2617
|
-
const { output, executor } = await this.taskExecutor.assert(
|
2674
|
+
const { output, executor } = await this.taskExecutor.assert(
|
2675
|
+
assertionWithContext,
|
2676
|
+
memoryContext
|
2677
|
+
);
|
2618
2678
|
const metadata = this.afterTaskRunning(executor, true);
|
2619
2679
|
if (output && opt?.keepRawResponse) {
|
2620
2680
|
return {
|
@@ -2635,6 +2695,7 @@ ${reasonMsg}`);
|
|
2635
2695
|
}
|
2636
2696
|
async aiCaptcha(options) {
|
2637
2697
|
const { deepThink = false, autoDetectComplexity = true } = options || {};
|
2698
|
+
const memoryContext = this.getMemoryAsContext();
|
2638
2699
|
let shouldUseDeepThink = deepThink;
|
2639
2700
|
if (autoDetectComplexity && !deepThink) {
|
2640
2701
|
const context = await this.getUIContext();
|
@@ -2652,7 +2713,10 @@ A complex CAPTCHA typically has one or more of these characteristics:
|
|
2652
2713
|
Return only "complex" or "simple" based on your analysis.
|
2653
2714
|
`;
|
2654
2715
|
const complexityMsgs = [
|
2655
|
-
{
|
2716
|
+
{
|
2717
|
+
role: "system",
|
2718
|
+
content: "You are an AI assistant that analyzes screenshots to determine CAPTCHA complexity."
|
2719
|
+
},
|
2656
2720
|
{
|
2657
2721
|
role: "user",
|
2658
2722
|
content: [
|
@@ -2676,7 +2740,12 @@ Return only "complex" or "simple" based on your analysis.
|
|
2676
2740
|
);
|
2677
2741
|
const responseText = typeof complexityResult.content === "string" ? complexityResult.content.toLowerCase() : JSON.stringify(complexityResult.content).toLowerCase();
|
2678
2742
|
shouldUseDeepThink = responseText.includes("complex");
|
2679
|
-
debug4(
|
2743
|
+
debug4(
|
2744
|
+
"CAPTCHA complexity analysis:",
|
2745
|
+
responseText,
|
2746
|
+
"Using deep think:",
|
2747
|
+
shouldUseDeepThink
|
2748
|
+
);
|
2680
2749
|
} catch (error) {
|
2681
2750
|
debug4("Failed to analyze CAPTCHA complexity:", error);
|
2682
2751
|
}
|
@@ -2693,7 +2762,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2693
2762
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2694
2763
|
} else if (action.type === "input" && action.value) {
|
2695
2764
|
if (action.target) {
|
2696
|
-
await this.aiInput(action.value, action.target, {
|
2765
|
+
await this.aiInput(action.value, action.target, {
|
2766
|
+
deepThink: shouldUseDeepThink
|
2767
|
+
});
|
2697
2768
|
}
|
2698
2769
|
} else if (action.type === "verify" && action.target) {
|
2699
2770
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
@@ -2705,7 +2776,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2705
2776
|
if (action.coordinates) {
|
2706
2777
|
const x = action.coordinates[0];
|
2707
2778
|
const y = action.coordinates[1];
|
2708
|
-
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2779
|
+
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2780
|
+
deepThink: shouldUseDeepThink
|
2781
|
+
});
|
2709
2782
|
} else if (action.target) {
|
2710
2783
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2711
2784
|
}
|
@@ -2715,6 +2788,26 @@ Return only "complex" or "simple" based on your analysis.
|
|
2715
2788
|
}
|
2716
2789
|
}
|
2717
2790
|
await new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
2791
|
+
const captchaMemoryItem = {
|
2792
|
+
id: `captcha_${Date.now()}`,
|
2793
|
+
timestamp: Date.now(),
|
2794
|
+
taskType: "Action",
|
2795
|
+
summary: `Solved ${captchaResult.captchaType} CAPTCHA: ${captchaResult.thought}`,
|
2796
|
+
context: {
|
2797
|
+
url: await this.page.url?.() || "",
|
2798
|
+
captchaType: captchaResult.captchaType,
|
2799
|
+
actions: captchaResult.actions,
|
2800
|
+
deepThink: actualDeepThink
|
2801
|
+
},
|
2802
|
+
metadata: {
|
2803
|
+
executionTime: Date.now() - Date.now(),
|
2804
|
+
// Will be updated
|
2805
|
+
success: true,
|
2806
|
+
confidence: 0.9
|
2807
|
+
},
|
2808
|
+
tags: ["captcha", "action", captchaResult.captchaType]
|
2809
|
+
};
|
2810
|
+
this.taskExecutor.addToMemory(captchaMemoryItem);
|
2718
2811
|
const metadata = {
|
2719
2812
|
status: "finished",
|
2720
2813
|
usage,
|
@@ -2731,10 +2824,15 @@ Return only "complex" or "simple" based on your analysis.
|
|
2731
2824
|
}
|
2732
2825
|
async aiWaitFor(assertion, opt) {
|
2733
2826
|
const startTime = Date.now();
|
2734
|
-
const
|
2827
|
+
const memoryContext = this.getMemoryAsContext();
|
2828
|
+
const assertionWithContext = memoryContext ? `${assertion}
|
2829
|
+
|
2830
|
+
Previous workflow steps:
|
2831
|
+
${memoryContext}` : assertion;
|
2832
|
+
const { executor } = await this.taskExecutor.waitFor(assertionWithContext, {
|
2735
2833
|
timeoutMs: opt?.timeoutMs || 15 * 1e3,
|
2736
2834
|
checkIntervalMs: opt?.checkIntervalMs || 3 * 1e3,
|
2737
|
-
assertion
|
2835
|
+
assertion: assertionWithContext
|
2738
2836
|
});
|
2739
2837
|
const metadata = {
|
2740
2838
|
status: executor.isInErrorState() ? "failed" : "finished",
|
@@ -2832,25 +2930,27 @@ ${errors}`);
|
|
2832
2930
|
const executionDump = {
|
2833
2931
|
name: screenshotTitle,
|
2834
2932
|
description: content,
|
2835
|
-
tasks: [
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2933
|
+
tasks: [
|
2934
|
+
{
|
2935
|
+
type: "Screenshot",
|
2936
|
+
subType: "log",
|
2937
|
+
status: "finished",
|
2938
|
+
executor: null,
|
2939
|
+
param: {
|
2940
|
+
title: screenshotTitle,
|
2941
|
+
content
|
2942
|
+
},
|
2943
|
+
output: {
|
2944
|
+
screenshot
|
2945
|
+
},
|
2946
|
+
thought: `Logged screenshot: ${screenshotTitle}`,
|
2947
|
+
timing: {
|
2948
|
+
start: Date.now(),
|
2949
|
+
end: Date.now(),
|
2950
|
+
cost: 0
|
2951
|
+
}
|
2852
2952
|
}
|
2853
|
-
|
2953
|
+
],
|
2854
2954
|
sdkVersion: "1.0.0",
|
2855
2955
|
logTime: Date.now(),
|
2856
2956
|
model_name: "screenshot"
|
@@ -2902,7 +3002,9 @@ ${errors}`);
|
|
2902
3002
|
totalTasks: stats.analytics.totalTasks,
|
2903
3003
|
memoryHits: stats.analytics.memoryHits,
|
2904
3004
|
memoryMisses: stats.analytics.memoryMisses,
|
2905
|
-
memoryEffectiveness: Math.round(
|
3005
|
+
memoryEffectiveness: Math.round(
|
3006
|
+
stats.analytics.memoryEffectiveness * 100
|
3007
|
+
),
|
2906
3008
|
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
2907
3009
|
},
|
2908
3010
|
config: stats.config,
|
@@ -2966,7 +3068,9 @@ ${errors}`);
|
|
2966
3068
|
calculateSuccessRate(memory) {
|
2967
3069
|
if (memory.length === 0)
|
2968
3070
|
return 0;
|
2969
|
-
const successCount = memory.filter(
|
3071
|
+
const successCount = memory.filter(
|
3072
|
+
(item) => item.metadata?.success !== false
|
3073
|
+
).length;
|
2970
3074
|
return Math.round(successCount / memory.length * 100);
|
2971
3075
|
}
|
2972
3076
|
calculateAverageExecutionTime(memory) {
|
@@ -3105,7 +3209,7 @@ var BridgeServer = class {
|
|
3105
3209
|
this.socket = socket;
|
3106
3210
|
const clientVersion = socket.handshake.query.version;
|
3107
3211
|
(0, import_utils16.logMsg)(
|
3108
|
-
`Bridge connected, cli-side version v${"1.
|
3212
|
+
`Bridge connected, cli-side version v${"1.6.1"}, browser-side version v${clientVersion}`
|
3109
3213
|
);
|
3110
3214
|
socket.on("bridge-call-response" /* CallResponse */, (params) => {
|
3111
3215
|
const id = params.id;
|
@@ -3136,7 +3240,7 @@ var BridgeServer = class {
|
|
3136
3240
|
setTimeout(() => {
|
3137
3241
|
this.onConnect?.();
|
3138
3242
|
const payload = {
|
3139
|
-
version: "1.
|
3243
|
+
version: "1.6.1"
|
3140
3244
|
};
|
3141
3245
|
socket.emit("bridge-connected" /* Connected */, payload);
|
3142
3246
|
Promise.resolve().then(() => {
|