misoai-web 1.6.0 → 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 +105 -50
- 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 +107 -52
- package/dist/es/bridge-mode.js.map +1 -1
- package/dist/es/chrome-extension.js +106 -51
- package/dist/es/chrome-extension.js.map +1 -1
- package/dist/es/index.js +106 -51
- package/dist/es/index.js.map +1 -1
- package/dist/es/midscene-playground.js +108 -53
- 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 +105 -50
- 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 +106 -51
- package/dist/es/playwright.js.map +1 -1
- package/dist/es/puppeteer-agent-launcher.js +105 -50
- package/dist/es/puppeteer-agent-launcher.js.map +1 -1
- package/dist/es/puppeteer.js +105 -50
- 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 +105 -50
- 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 +107 -52
- package/dist/lib/bridge-mode.js.map +1 -1
- package/dist/lib/chrome-extension.js +106 -51
- package/dist/lib/chrome-extension.js.map +1 -1
- package/dist/lib/index.js +106 -51
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/midscene-playground.js +108 -53
- 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 +105 -50
- 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 +106 -51
- package/dist/lib/playwright.js.map +1 -1
- package/dist/lib/puppeteer-agent-launcher.js +105 -50
- package/dist/lib/puppeteer-agent-launcher.js.map +1 -1
- package/dist/lib/puppeteer.js +105 -50
- 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/index.d.ts +1 -1
- package/dist/types/playwright.d.ts +1 -1
- package/package.json +18 -54
@@ -60,13 +60,13 @@ __export(chrome_extension_exports, {
|
|
60
60
|
module.exports = __toCommonJS(chrome_extension_exports);
|
61
61
|
|
62
62
|
// src/common/utils.ts
|
63
|
+
var import_dayjs = __toESM(require("dayjs"));
|
63
64
|
var import_ai_model = require("misoai-core/ai-model");
|
64
65
|
var import_utils = require("misoai-core/utils");
|
65
66
|
var import_env = require("misoai-shared/env");
|
66
67
|
var import_extractor = require("misoai-shared/extractor");
|
67
68
|
var import_img = require("misoai-shared/img");
|
68
69
|
var import_utils2 = require("misoai-shared/utils");
|
69
|
-
var import_dayjs = __toESM(require("dayjs"));
|
70
70
|
|
71
71
|
// src/web-element.ts
|
72
72
|
var WebElementInfo = class {
|
@@ -485,8 +485,8 @@ var ScriptPlayer = class {
|
|
485
485
|
var import_js_yaml = __toESM(require("js-yaml"));
|
486
486
|
|
487
487
|
// src/yaml/utils.ts
|
488
|
-
var import_utils4 = require("misoai-shared/utils");
|
489
488
|
var import_js_yaml2 = __toESM(require("js-yaml"));
|
489
|
+
var import_utils4 = require("misoai-shared/utils");
|
490
490
|
function interpolateEnvVars(content) {
|
491
491
|
return content.replace(/\$\{([^}]+)\}/g, (_, envVar) => {
|
492
492
|
const value = process.env[envVar.trim()];
|
@@ -685,8 +685,12 @@ var WorkflowMemory = class {
|
|
685
685
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
686
686
|
workflow.memory = [...memory];
|
687
687
|
workflow.metadata.totalSteps = workflow.steps.length;
|
688
|
-
workflow.metadata.completedSteps = workflow.steps.filter(
|
689
|
-
|
688
|
+
workflow.metadata.completedSteps = workflow.steps.filter(
|
689
|
+
(s) => s.status === "completed"
|
690
|
+
).length;
|
691
|
+
workflow.metadata.failedSteps = workflow.steps.filter(
|
692
|
+
(s) => s.status === "failed"
|
693
|
+
).length;
|
690
694
|
this.workflows.set(workflowId, workflow);
|
691
695
|
this.enforceRetentionPolicy();
|
692
696
|
}
|
@@ -697,7 +701,9 @@ var WorkflowMemory = class {
|
|
697
701
|
const workflow = this.workflows.get(workflowId) || this.createEmptyWorkflowData(workflowId);
|
698
702
|
workflow.context = { ...workflow.context, ...context };
|
699
703
|
if (context.currentStep) {
|
700
|
-
const existingStep = workflow.steps.find(
|
704
|
+
const existingStep = workflow.steps.find(
|
705
|
+
(s) => s.stepName === context.currentStep
|
706
|
+
);
|
701
707
|
if (!existingStep) {
|
702
708
|
workflow.steps.push({
|
703
709
|
stepId: `step_${workflow.steps.length + 1}`,
|
@@ -742,7 +748,9 @@ var WorkflowMemory = class {
|
|
742
748
|
enforceRetentionPolicy() {
|
743
749
|
const maxWorkflows = 10;
|
744
750
|
if (this.workflows.size > maxWorkflows) {
|
745
|
-
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
751
|
+
const sortedWorkflows = Array.from(this.workflows.entries()).sort(
|
752
|
+
([, a], [, b]) => (b.metadata.endTime || b.metadata.startTime) - (a.metadata.endTime || a.metadata.startTime)
|
753
|
+
);
|
746
754
|
const toDelete = sortedWorkflows.slice(maxWorkflows);
|
747
755
|
toDelete.forEach(([workflowId]) => this.workflows.delete(workflowId));
|
748
756
|
}
|
@@ -1481,7 +1489,9 @@ var PageTaskExecutor = class {
|
|
1481
1489
|
*/
|
1482
1490
|
getPersistentExecutor() {
|
1483
1491
|
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1484
|
-
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1492
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1493
|
+
this.sessionContext.workflowId
|
1494
|
+
);
|
1485
1495
|
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1486
1496
|
onTaskStart: this.onTaskStartCallback,
|
1487
1497
|
initialMemory: previousMemory
|
@@ -1510,7 +1520,9 @@ var PageTaskExecutor = class {
|
|
1510
1520
|
if (this.persistentExecutor) {
|
1511
1521
|
this.persistentExecutor.clearMemory();
|
1512
1522
|
}
|
1513
|
-
this.workflowMemory.clearWorkflow(
|
1523
|
+
this.workflowMemory.clearWorkflow(
|
1524
|
+
this.sessionContext.workflowId || "default"
|
1525
|
+
);
|
1514
1526
|
}
|
1515
1527
|
/**
|
1516
1528
|
* Mevcut hafızayı döndürür
|
@@ -1522,7 +1534,9 @@ var PageTaskExecutor = class {
|
|
1522
1534
|
* İş akışı hafızasını döndürür
|
1523
1535
|
*/
|
1524
1536
|
getWorkflowMemory() {
|
1525
|
-
return this.workflowMemory.getWorkflowData(
|
1537
|
+
return this.workflowMemory.getWorkflowData(
|
1538
|
+
this.sessionContext.workflowId || "default"
|
1539
|
+
);
|
1526
1540
|
}
|
1527
1541
|
/**
|
1528
1542
|
* Hafıza istatistiklerini döndürür
|
@@ -1530,7 +1544,13 @@ var PageTaskExecutor = class {
|
|
1530
1544
|
getMemoryStats() {
|
1531
1545
|
return this.persistentExecutor?.getMemoryStats() || {
|
1532
1546
|
totalItems: 0,
|
1533
|
-
analytics: {
|
1547
|
+
analytics: {
|
1548
|
+
totalTasks: 0,
|
1549
|
+
memoryHits: 0,
|
1550
|
+
memoryMisses: 0,
|
1551
|
+
averageMemorySize: 0,
|
1552
|
+
memoryEffectiveness: 0
|
1553
|
+
},
|
1534
1554
|
config: this.memoryConfig
|
1535
1555
|
};
|
1536
1556
|
}
|
@@ -1566,11 +1586,14 @@ var PageTaskExecutor = class {
|
|
1566
1586
|
let taskExecutor;
|
1567
1587
|
if (useMemory) {
|
1568
1588
|
taskExecutor = this.getPersistentExecutor();
|
1569
|
-
this.workflowMemory.updateWorkflowContext(
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1589
|
+
this.workflowMemory.updateWorkflowContext(
|
1590
|
+
{
|
1591
|
+
currentStep: title,
|
1592
|
+
pageInfo: this.sessionContext.pageInfo,
|
1593
|
+
timestamp: Date.now()
|
1594
|
+
},
|
1595
|
+
this.sessionContext.workflowId || "default"
|
1596
|
+
);
|
1574
1597
|
} else {
|
1575
1598
|
taskExecutor = new import_misoai_core.Executor(title, {
|
1576
1599
|
onTaskStart: this.onTaskStartCallback
|
@@ -1936,14 +1959,19 @@ var PageTaskExecutor = class {
|
|
1936
1959
|
*/
|
1937
1960
|
addToMemory(memoryItem) {
|
1938
1961
|
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1939
|
-
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1962
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1963
|
+
this.sessionContext.workflowId
|
1964
|
+
);
|
1940
1965
|
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1941
1966
|
onTaskStart: this.onTaskStartCallback,
|
1942
1967
|
initialMemory: previousMemory
|
1943
1968
|
});
|
1944
1969
|
}
|
1945
1970
|
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1946
|
-
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation(
|
1971
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation(
|
1972
|
+
"add",
|
1973
|
+
memoryItem
|
1974
|
+
);
|
1947
1975
|
}
|
1948
1976
|
};
|
1949
1977
|
|
@@ -2032,14 +2060,14 @@ function buildPlans(type, locateParam, param) {
|
|
2032
2060
|
var import_node_assert = __toESM(require("assert"));
|
2033
2061
|
var import_node_fs2 = require("fs");
|
2034
2062
|
var import_node_path2 = require("path");
|
2063
|
+
var import_js_yaml3 = __toESM(require("js-yaml"));
|
2035
2064
|
var import_common2 = require("misoai-shared/common");
|
2036
2065
|
var import_logger3 = require("misoai-shared/logger");
|
2037
2066
|
var import_utils9 = require("misoai-shared/utils");
|
2038
|
-
var import_js_yaml3 = __toESM(require("js-yaml"));
|
2039
2067
|
var import_semver = __toESM(require("semver"));
|
2040
2068
|
|
2041
2069
|
// package.json
|
2042
|
-
var version = "1.6.
|
2070
|
+
var version = "1.6.1";
|
2043
2071
|
|
2044
2072
|
// src/common/task-cache.ts
|
2045
2073
|
var debug3 = (0, import_logger3.getDebug)("cache");
|
@@ -2334,22 +2362,28 @@ var PageAgent = class {
|
|
2334
2362
|
const allThoughts = executor.tasks.filter((task) => task.thought).map((task) => task.thought);
|
2335
2363
|
const allLocates = executor.tasks.filter((task) => task.locate).map((task) => task.locate);
|
2336
2364
|
const allPlans = executor.tasks.filter((task) => task.param?.plans).map((task) => task.param?.plans);
|
2337
|
-
const planningTasks = executor.tasks.filter(
|
2338
|
-
|
2365
|
+
const planningTasks = executor.tasks.filter(
|
2366
|
+
(task) => task.type === "Planning"
|
2367
|
+
);
|
2368
|
+
const insightTasks = executor.tasks.filter(
|
2369
|
+
(task) => task.type === "Insight"
|
2370
|
+
);
|
2339
2371
|
const actionTasks = executor.tasks.filter((task) => task.type === "Action");
|
2340
2372
|
const planning = planningTasks.length > 0 ? {
|
2341
2373
|
type: "Planning",
|
2342
|
-
description:
|
2374
|
+
description: "Planning for task execution",
|
2343
2375
|
steps: planningTasks.map((task) => task.thought || "Planning step")
|
2344
2376
|
} : void 0;
|
2345
2377
|
const insight = insightTasks.length > 0 ? {
|
2346
2378
|
type: "Insight",
|
2347
|
-
description:
|
2348
|
-
elements: insightTasks.map(
|
2379
|
+
description: "Insight for task execution",
|
2380
|
+
elements: insightTasks.map(
|
2381
|
+
(task) => task.thought || "Insight element"
|
2382
|
+
)
|
2349
2383
|
} : void 0;
|
2350
2384
|
const action = actionTasks.length > 0 ? {
|
2351
2385
|
type: "Action",
|
2352
|
-
description:
|
2386
|
+
description: "Action for task execution",
|
2353
2387
|
result: lastTask?.output
|
2354
2388
|
} : void 0;
|
2355
2389
|
const actionDetails = executor.tasks.map((task) => ({
|
@@ -2683,7 +2717,10 @@ ${memoryContext}` : void 0;
|
|
2683
2717
|
}
|
2684
2718
|
const memoryContext = this.getMemoryAsContext();
|
2685
2719
|
const assertionWithContext = currentUrl ? `For the page at URL "${currentUrl}", ${assertion}` : assertion;
|
2686
|
-
const { output, executor } = await this.taskExecutor.assert(
|
2720
|
+
const { output, executor } = await this.taskExecutor.assert(
|
2721
|
+
assertionWithContext,
|
2722
|
+
memoryContext
|
2723
|
+
);
|
2687
2724
|
const metadata = this.afterTaskRunning(executor, true);
|
2688
2725
|
if (output && opt?.keepRawResponse) {
|
2689
2726
|
return {
|
@@ -2722,7 +2759,10 @@ A complex CAPTCHA typically has one or more of these characteristics:
|
|
2722
2759
|
Return only "complex" or "simple" based on your analysis.
|
2723
2760
|
`;
|
2724
2761
|
const complexityMsgs = [
|
2725
|
-
{
|
2762
|
+
{
|
2763
|
+
role: "system",
|
2764
|
+
content: "You are an AI assistant that analyzes screenshots to determine CAPTCHA complexity."
|
2765
|
+
},
|
2726
2766
|
{
|
2727
2767
|
role: "user",
|
2728
2768
|
content: [
|
@@ -2746,7 +2786,12 @@ Return only "complex" or "simple" based on your analysis.
|
|
2746
2786
|
);
|
2747
2787
|
const responseText = typeof complexityResult.content === "string" ? complexityResult.content.toLowerCase() : JSON.stringify(complexityResult.content).toLowerCase();
|
2748
2788
|
shouldUseDeepThink = responseText.includes("complex");
|
2749
|
-
debug4(
|
2789
|
+
debug4(
|
2790
|
+
"CAPTCHA complexity analysis:",
|
2791
|
+
responseText,
|
2792
|
+
"Using deep think:",
|
2793
|
+
shouldUseDeepThink
|
2794
|
+
);
|
2750
2795
|
} catch (error) {
|
2751
2796
|
debug4("Failed to analyze CAPTCHA complexity:", error);
|
2752
2797
|
}
|
@@ -2763,7 +2808,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2763
2808
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2764
2809
|
} else if (action.type === "input" && action.value) {
|
2765
2810
|
if (action.target) {
|
2766
|
-
await this.aiInput(action.value, action.target, {
|
2811
|
+
await this.aiInput(action.value, action.target, {
|
2812
|
+
deepThink: shouldUseDeepThink
|
2813
|
+
});
|
2767
2814
|
}
|
2768
2815
|
} else if (action.type === "verify" && action.target) {
|
2769
2816
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
@@ -2775,7 +2822,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2775
2822
|
if (action.coordinates) {
|
2776
2823
|
const x = action.coordinates[0];
|
2777
2824
|
const y = action.coordinates[1];
|
2778
|
-
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2825
|
+
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2826
|
+
deepThink: shouldUseDeepThink
|
2827
|
+
});
|
2779
2828
|
} else if (action.target) {
|
2780
2829
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2781
2830
|
}
|
@@ -2927,25 +2976,27 @@ ${errors}`);
|
|
2927
2976
|
const executionDump = {
|
2928
2977
|
name: screenshotTitle,
|
2929
2978
|
description: content,
|
2930
|
-
tasks: [
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2979
|
+
tasks: [
|
2980
|
+
{
|
2981
|
+
type: "Screenshot",
|
2982
|
+
subType: "log",
|
2983
|
+
status: "finished",
|
2984
|
+
executor: null,
|
2985
|
+
param: {
|
2986
|
+
title: screenshotTitle,
|
2987
|
+
content
|
2988
|
+
},
|
2989
|
+
output: {
|
2990
|
+
screenshot
|
2991
|
+
},
|
2992
|
+
thought: `Logged screenshot: ${screenshotTitle}`,
|
2993
|
+
timing: {
|
2994
|
+
start: Date.now(),
|
2995
|
+
end: Date.now(),
|
2996
|
+
cost: 0
|
2997
|
+
}
|
2947
2998
|
}
|
2948
|
-
|
2999
|
+
],
|
2949
3000
|
sdkVersion: "1.0.0",
|
2950
3001
|
logTime: Date.now(),
|
2951
3002
|
model_name: "screenshot"
|
@@ -2997,7 +3048,9 @@ ${errors}`);
|
|
2997
3048
|
totalTasks: stats.analytics.totalTasks,
|
2998
3049
|
memoryHits: stats.analytics.memoryHits,
|
2999
3050
|
memoryMisses: stats.analytics.memoryMisses,
|
3000
|
-
memoryEffectiveness: Math.round(
|
3051
|
+
memoryEffectiveness: Math.round(
|
3052
|
+
stats.analytics.memoryEffectiveness * 100
|
3053
|
+
),
|
3001
3054
|
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
3002
3055
|
},
|
3003
3056
|
config: stats.config,
|
@@ -3061,7 +3114,9 @@ ${errors}`);
|
|
3061
3114
|
calculateSuccessRate(memory) {
|
3062
3115
|
if (memory.length === 0)
|
3063
3116
|
return 0;
|
3064
|
-
const successCount = memory.filter(
|
3117
|
+
const successCount = memory.filter(
|
3118
|
+
(item) => item.metadata?.success !== false
|
3119
|
+
).length;
|
3065
3120
|
return Math.round(successCount / memory.length * 100);
|
3066
3121
|
}
|
3067
3122
|
calculateAverageExecutionTime(memory) {
|
@@ -3305,7 +3360,7 @@ function sleep2(ms) {
|
|
3305
3360
|
var ChromeExtensionProxyPage = class {
|
3306
3361
|
constructor(forceSameTabNavigation) {
|
3307
3362
|
this.pageType = "chrome-extension-proxy";
|
3308
|
-
this.version = "1.6.
|
3363
|
+
this.version = "1.6.1";
|
3309
3364
|
this.activeTabId = null;
|
3310
3365
|
this.tabIdOfDebuggerAttached = null;
|
3311
3366
|
this.attachingDebugger = null;
|