misoai-web 1.6.0 → 1.6.2
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 +108 -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 +110 -52
- package/dist/es/bridge-mode.js.map +1 -1
- package/dist/es/chrome-extension.js +109 -51
- package/dist/es/chrome-extension.js.map +1 -1
- package/dist/es/index.js +425 -68
- package/dist/es/index.js.map +1 -1
- package/dist/es/midscene-playground.js +111 -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 +108 -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 +425 -68
- package/dist/es/playwright.js.map +1 -1
- package/dist/es/puppeteer-agent-launcher.js +424 -67
- package/dist/es/puppeteer-agent-launcher.js.map +1 -1
- package/dist/es/puppeteer.js +424 -67
- 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 +108 -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 +110 -52
- package/dist/lib/bridge-mode.js.map +1 -1
- package/dist/lib/chrome-extension.js +109 -51
- package/dist/lib/chrome-extension.js.map +1 -1
- package/dist/lib/index.js +425 -68
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/midscene-playground.js +111 -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 +108 -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 +425 -68
- package/dist/lib/playwright.js.map +1 -1
- package/dist/lib/puppeteer-agent-launcher.js +424 -67
- package/dist/lib/puppeteer-agent-launcher.js.map +1 -1
- package/dist/lib/puppeteer.js +424 -67
- 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 +1 -1
- package/dist/types/bridge-mode-browser.d.ts +2 -2
- package/dist/types/bridge-mode.d.ts +2 -2
- package/dist/types/{browser-9b472ffb.d.ts → browser-f205f69d.d.ts} +1 -1
- package/dist/types/chrome-extension.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/midscene-server.d.ts +1 -1
- package/dist/types/{page-ed0ecb44.d.ts → page-c5452809.d.ts} +45 -0
- package/dist/types/playground.d.ts +2 -2
- package/dist/types/playwright.d.ts +2 -2
- package/dist/types/puppeteer-agent-launcher.d.ts +1 -1
- package/dist/types/puppeteer.d.ts +2 -2
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/yaml.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
|
}
|
@@ -1309,6 +1317,7 @@ var PageTaskExecutor = class {
|
|
1309
1317
|
actions: [],
|
1310
1318
|
more_actions_needed_by_instruction: false,
|
1311
1319
|
log: "",
|
1320
|
+
summary: "Loaded YAML workflow configuration",
|
1312
1321
|
yamlString
|
1313
1322
|
},
|
1314
1323
|
cache: {
|
@@ -1410,6 +1419,7 @@ var PageTaskExecutor = class {
|
|
1410
1419
|
actions: finalActions,
|
1411
1420
|
more_actions_needed_by_instruction,
|
1412
1421
|
log: log2,
|
1422
|
+
summary: planResult.summary || "Generated action plan from user instruction",
|
1413
1423
|
yamlFlow: planResult.yamlFlow
|
1414
1424
|
},
|
1415
1425
|
cache: {
|
@@ -1465,6 +1475,7 @@ var PageTaskExecutor = class {
|
|
1465
1475
|
actionType: actions[0].type,
|
1466
1476
|
more_actions_needed_by_instruction: true,
|
1467
1477
|
log: "",
|
1478
|
+
summary: action_summary || "Generated VLM action plan",
|
1468
1479
|
yamlFlow: planResult.yamlFlow
|
1469
1480
|
},
|
1470
1481
|
cache: {
|
@@ -1481,7 +1492,9 @@ var PageTaskExecutor = class {
|
|
1481
1492
|
*/
|
1482
1493
|
getPersistentExecutor() {
|
1483
1494
|
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1484
|
-
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1495
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1496
|
+
this.sessionContext.workflowId
|
1497
|
+
);
|
1485
1498
|
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1486
1499
|
onTaskStart: this.onTaskStartCallback,
|
1487
1500
|
initialMemory: previousMemory
|
@@ -1510,7 +1523,9 @@ var PageTaskExecutor = class {
|
|
1510
1523
|
if (this.persistentExecutor) {
|
1511
1524
|
this.persistentExecutor.clearMemory();
|
1512
1525
|
}
|
1513
|
-
this.workflowMemory.clearWorkflow(
|
1526
|
+
this.workflowMemory.clearWorkflow(
|
1527
|
+
this.sessionContext.workflowId || "default"
|
1528
|
+
);
|
1514
1529
|
}
|
1515
1530
|
/**
|
1516
1531
|
* Mevcut hafızayı döndürür
|
@@ -1522,7 +1537,9 @@ var PageTaskExecutor = class {
|
|
1522
1537
|
* İş akışı hafızasını döndürür
|
1523
1538
|
*/
|
1524
1539
|
getWorkflowMemory() {
|
1525
|
-
return this.workflowMemory.getWorkflowData(
|
1540
|
+
return this.workflowMemory.getWorkflowData(
|
1541
|
+
this.sessionContext.workflowId || "default"
|
1542
|
+
);
|
1526
1543
|
}
|
1527
1544
|
/**
|
1528
1545
|
* Hafıza istatistiklerini döndürür
|
@@ -1530,7 +1547,13 @@ var PageTaskExecutor = class {
|
|
1530
1547
|
getMemoryStats() {
|
1531
1548
|
return this.persistentExecutor?.getMemoryStats() || {
|
1532
1549
|
totalItems: 0,
|
1533
|
-
analytics: {
|
1550
|
+
analytics: {
|
1551
|
+
totalTasks: 0,
|
1552
|
+
memoryHits: 0,
|
1553
|
+
memoryMisses: 0,
|
1554
|
+
averageMemorySize: 0,
|
1555
|
+
memoryEffectiveness: 0
|
1556
|
+
},
|
1534
1557
|
config: this.memoryConfig
|
1535
1558
|
};
|
1536
1559
|
}
|
@@ -1566,11 +1589,14 @@ var PageTaskExecutor = class {
|
|
1566
1589
|
let taskExecutor;
|
1567
1590
|
if (useMemory) {
|
1568
1591
|
taskExecutor = this.getPersistentExecutor();
|
1569
|
-
this.workflowMemory.updateWorkflowContext(
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1592
|
+
this.workflowMemory.updateWorkflowContext(
|
1593
|
+
{
|
1594
|
+
currentStep: title,
|
1595
|
+
pageInfo: this.sessionContext.pageInfo,
|
1596
|
+
timestamp: Date.now()
|
1597
|
+
},
|
1598
|
+
this.sessionContext.workflowId || "default"
|
1599
|
+
);
|
1574
1600
|
} else {
|
1575
1601
|
taskExecutor = new import_misoai_core.Executor(title, {
|
1576
1602
|
onTaskStart: this.onTaskStartCallback
|
@@ -1936,14 +1962,19 @@ var PageTaskExecutor = class {
|
|
1936
1962
|
*/
|
1937
1963
|
addToMemory(memoryItem) {
|
1938
1964
|
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1939
|
-
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1965
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(
|
1966
|
+
this.sessionContext.workflowId
|
1967
|
+
);
|
1940
1968
|
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1941
1969
|
onTaskStart: this.onTaskStartCallback,
|
1942
1970
|
initialMemory: previousMemory
|
1943
1971
|
});
|
1944
1972
|
}
|
1945
1973
|
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1946
|
-
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation(
|
1974
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation(
|
1975
|
+
"add",
|
1976
|
+
memoryItem
|
1977
|
+
);
|
1947
1978
|
}
|
1948
1979
|
};
|
1949
1980
|
|
@@ -2032,14 +2063,14 @@ function buildPlans(type, locateParam, param) {
|
|
2032
2063
|
var import_node_assert = __toESM(require("assert"));
|
2033
2064
|
var import_node_fs2 = require("fs");
|
2034
2065
|
var import_node_path2 = require("path");
|
2066
|
+
var import_js_yaml3 = __toESM(require("js-yaml"));
|
2035
2067
|
var import_common2 = require("misoai-shared/common");
|
2036
2068
|
var import_logger3 = require("misoai-shared/logger");
|
2037
2069
|
var import_utils9 = require("misoai-shared/utils");
|
2038
|
-
var import_js_yaml3 = __toESM(require("js-yaml"));
|
2039
2070
|
var import_semver = __toESM(require("semver"));
|
2040
2071
|
|
2041
2072
|
// package.json
|
2042
|
-
var version = "1.6.
|
2073
|
+
var version = "1.6.2";
|
2043
2074
|
|
2044
2075
|
// src/common/task-cache.ts
|
2045
2076
|
var debug3 = (0, import_logger3.getDebug)("cache");
|
@@ -2334,22 +2365,28 @@ var PageAgent = class {
|
|
2334
2365
|
const allThoughts = executor.tasks.filter((task) => task.thought).map((task) => task.thought);
|
2335
2366
|
const allLocates = executor.tasks.filter((task) => task.locate).map((task) => task.locate);
|
2336
2367
|
const allPlans = executor.tasks.filter((task) => task.param?.plans).map((task) => task.param?.plans);
|
2337
|
-
const planningTasks = executor.tasks.filter(
|
2338
|
-
|
2368
|
+
const planningTasks = executor.tasks.filter(
|
2369
|
+
(task) => task.type === "Planning"
|
2370
|
+
);
|
2371
|
+
const insightTasks = executor.tasks.filter(
|
2372
|
+
(task) => task.type === "Insight"
|
2373
|
+
);
|
2339
2374
|
const actionTasks = executor.tasks.filter((task) => task.type === "Action");
|
2340
2375
|
const planning = planningTasks.length > 0 ? {
|
2341
2376
|
type: "Planning",
|
2342
|
-
description:
|
2377
|
+
description: "Planning for task execution",
|
2343
2378
|
steps: planningTasks.map((task) => task.thought || "Planning step")
|
2344
2379
|
} : void 0;
|
2345
2380
|
const insight = insightTasks.length > 0 ? {
|
2346
2381
|
type: "Insight",
|
2347
|
-
description:
|
2348
|
-
elements: insightTasks.map(
|
2382
|
+
description: "Insight for task execution",
|
2383
|
+
elements: insightTasks.map(
|
2384
|
+
(task) => task.thought || "Insight element"
|
2385
|
+
)
|
2349
2386
|
} : void 0;
|
2350
2387
|
const action = actionTasks.length > 0 ? {
|
2351
2388
|
type: "Action",
|
2352
|
-
description:
|
2389
|
+
description: "Action for task execution",
|
2353
2390
|
result: lastTask?.output
|
2354
2391
|
} : void 0;
|
2355
2392
|
const actionDetails = executor.tasks.map((task) => ({
|
@@ -2683,7 +2720,10 @@ ${memoryContext}` : void 0;
|
|
2683
2720
|
}
|
2684
2721
|
const memoryContext = this.getMemoryAsContext();
|
2685
2722
|
const assertionWithContext = currentUrl ? `For the page at URL "${currentUrl}", ${assertion}` : assertion;
|
2686
|
-
const { output, executor } = await this.taskExecutor.assert(
|
2723
|
+
const { output, executor } = await this.taskExecutor.assert(
|
2724
|
+
assertionWithContext,
|
2725
|
+
memoryContext
|
2726
|
+
);
|
2687
2727
|
const metadata = this.afterTaskRunning(executor, true);
|
2688
2728
|
if (output && opt?.keepRawResponse) {
|
2689
2729
|
return {
|
@@ -2722,7 +2762,10 @@ A complex CAPTCHA typically has one or more of these characteristics:
|
|
2722
2762
|
Return only "complex" or "simple" based on your analysis.
|
2723
2763
|
`;
|
2724
2764
|
const complexityMsgs = [
|
2725
|
-
{
|
2765
|
+
{
|
2766
|
+
role: "system",
|
2767
|
+
content: "You are an AI assistant that analyzes screenshots to determine CAPTCHA complexity."
|
2768
|
+
},
|
2726
2769
|
{
|
2727
2770
|
role: "user",
|
2728
2771
|
content: [
|
@@ -2746,7 +2789,12 @@ Return only "complex" or "simple" based on your analysis.
|
|
2746
2789
|
);
|
2747
2790
|
const responseText = typeof complexityResult.content === "string" ? complexityResult.content.toLowerCase() : JSON.stringify(complexityResult.content).toLowerCase();
|
2748
2791
|
shouldUseDeepThink = responseText.includes("complex");
|
2749
|
-
debug4(
|
2792
|
+
debug4(
|
2793
|
+
"CAPTCHA complexity analysis:",
|
2794
|
+
responseText,
|
2795
|
+
"Using deep think:",
|
2796
|
+
shouldUseDeepThink
|
2797
|
+
);
|
2750
2798
|
} catch (error) {
|
2751
2799
|
debug4("Failed to analyze CAPTCHA complexity:", error);
|
2752
2800
|
}
|
@@ -2763,7 +2811,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2763
2811
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2764
2812
|
} else if (action.type === "input" && action.value) {
|
2765
2813
|
if (action.target) {
|
2766
|
-
await this.aiInput(action.value, action.target, {
|
2814
|
+
await this.aiInput(action.value, action.target, {
|
2815
|
+
deepThink: shouldUseDeepThink
|
2816
|
+
});
|
2767
2817
|
}
|
2768
2818
|
} else if (action.type === "verify" && action.target) {
|
2769
2819
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
@@ -2775,7 +2825,9 @@ Return only "complex" or "simple" based on your analysis.
|
|
2775
2825
|
if (action.coordinates) {
|
2776
2826
|
const x = action.coordinates[0];
|
2777
2827
|
const y = action.coordinates[1];
|
2778
|
-
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2828
|
+
await this.aiTap(`element at coordinates (${x}, ${y})`, {
|
2829
|
+
deepThink: shouldUseDeepThink
|
2830
|
+
});
|
2779
2831
|
} else if (action.target) {
|
2780
2832
|
await this.aiTap(action.target, { deepThink: shouldUseDeepThink });
|
2781
2833
|
}
|
@@ -2927,25 +2979,27 @@ ${errors}`);
|
|
2927
2979
|
const executionDump = {
|
2928
2980
|
name: screenshotTitle,
|
2929
2981
|
description: content,
|
2930
|
-
tasks: [
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2982
|
+
tasks: [
|
2983
|
+
{
|
2984
|
+
type: "Screenshot",
|
2985
|
+
subType: "log",
|
2986
|
+
status: "finished",
|
2987
|
+
executor: null,
|
2988
|
+
param: {
|
2989
|
+
title: screenshotTitle,
|
2990
|
+
content
|
2991
|
+
},
|
2992
|
+
output: {
|
2993
|
+
screenshot
|
2994
|
+
},
|
2995
|
+
thought: `Logged screenshot: ${screenshotTitle}`,
|
2996
|
+
timing: {
|
2997
|
+
start: Date.now(),
|
2998
|
+
end: Date.now(),
|
2999
|
+
cost: 0
|
3000
|
+
}
|
2947
3001
|
}
|
2948
|
-
|
3002
|
+
],
|
2949
3003
|
sdkVersion: "1.0.0",
|
2950
3004
|
logTime: Date.now(),
|
2951
3005
|
model_name: "screenshot"
|
@@ -2997,7 +3051,9 @@ ${errors}`);
|
|
2997
3051
|
totalTasks: stats.analytics.totalTasks,
|
2998
3052
|
memoryHits: stats.analytics.memoryHits,
|
2999
3053
|
memoryMisses: stats.analytics.memoryMisses,
|
3000
|
-
memoryEffectiveness: Math.round(
|
3054
|
+
memoryEffectiveness: Math.round(
|
3055
|
+
stats.analytics.memoryEffectiveness * 100
|
3056
|
+
),
|
3001
3057
|
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
3002
3058
|
},
|
3003
3059
|
config: stats.config,
|
@@ -3061,7 +3117,9 @@ ${errors}`);
|
|
3061
3117
|
calculateSuccessRate(memory) {
|
3062
3118
|
if (memory.length === 0)
|
3063
3119
|
return 0;
|
3064
|
-
const successCount = memory.filter(
|
3120
|
+
const successCount = memory.filter(
|
3121
|
+
(item) => item.metadata?.success !== false
|
3122
|
+
).length;
|
3065
3123
|
return Math.round(successCount / memory.length * 100);
|
3066
3124
|
}
|
3067
3125
|
calculateAverageExecutionTime(memory) {
|
@@ -3305,7 +3363,7 @@ function sleep2(ms) {
|
|
3305
3363
|
var ChromeExtensionProxyPage = class {
|
3306
3364
|
constructor(forceSameTabNavigation) {
|
3307
3365
|
this.pageType = "chrome-extension-proxy";
|
3308
|
-
this.version = "1.6.
|
3366
|
+
this.version = "1.6.2";
|
3309
3367
|
this.activeTabId = null;
|
3310
3368
|
this.tabIdOfDebuggerAttached = null;
|
3311
3369
|
this.attachingDebugger = null;
|