misoai-web 1.5.8 → 1.6.0
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 +159 -7
- package/dist/es/agent.js.map +1 -1
- package/dist/es/bridge-mode-browser.js +3 -3
- package/dist/es/bridge-mode.js +161 -9
- package/dist/es/bridge-mode.js.map +1 -1
- package/dist/es/chrome-extension.js +160 -8
- package/dist/es/chrome-extension.js.map +1 -1
- package/dist/es/index.js +159 -7
- package/dist/es/index.js.map +1 -1
- package/dist/es/midscene-playground.js +159 -7
- package/dist/es/midscene-playground.js.map +1 -1
- package/dist/es/playground.js +159 -7
- package/dist/es/playground.js.map +1 -1
- package/dist/es/playwright.js +159 -7
- package/dist/es/playwright.js.map +1 -1
- package/dist/es/puppeteer-agent-launcher.js +159 -7
- package/dist/es/puppeteer-agent-launcher.js.map +1 -1
- package/dist/es/puppeteer.js +159 -7
- package/dist/es/puppeteer.js.map +1 -1
- package/dist/lib/agent.js +159 -7
- package/dist/lib/agent.js.map +1 -1
- package/dist/lib/bridge-mode-browser.js +3 -3
- package/dist/lib/bridge-mode.js +161 -9
- package/dist/lib/bridge-mode.js.map +1 -1
- package/dist/lib/chrome-extension.js +160 -8
- package/dist/lib/chrome-extension.js.map +1 -1
- package/dist/lib/index.js +159 -7
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/midscene-playground.js +159 -7
- package/dist/lib/midscene-playground.js.map +1 -1
- package/dist/lib/playground.js +159 -7
- package/dist/lib/playground.js.map +1 -1
- package/dist/lib/playwright.js +159 -7
- package/dist/lib/playwright.js.map +1 -1
- package/dist/lib/puppeteer-agent-launcher.js +159 -7
- package/dist/lib/puppeteer-agent-launcher.js.map +1 -1
- package/dist/lib/puppeteer.js +159 -7
- package/dist/lib/puppeteer.js.map +1 -1
- package/dist/types/agent.d.ts +24 -2
- package/package.json +2 -2
@@ -1868,9 +1868,15 @@ var PageTaskExecutor = class {
|
|
1868
1868
|
}
|
1869
1869
|
async waitFor(assertion, opt) {
|
1870
1870
|
const description = `waitFor: ${assertion}`;
|
1871
|
-
const
|
1872
|
-
|
1873
|
-
|
1871
|
+
const useMemory = true;
|
1872
|
+
let taskExecutor;
|
1873
|
+
if (useMemory) {
|
1874
|
+
taskExecutor = this.getPersistentExecutor();
|
1875
|
+
} else {
|
1876
|
+
taskExecutor = new import_misoai_core.Executor(taskTitleStr("WaitFor", description), {
|
1877
|
+
onTaskStart: this.onTaskStartCallback
|
1878
|
+
});
|
1879
|
+
}
|
1874
1880
|
const { timeoutMs, checkIntervalMs } = opt;
|
1875
1881
|
(0, import_utils6.assert)(assertion, "No assertion for waitFor");
|
1876
1882
|
(0, import_utils6.assert)(timeoutMs, "No timeoutMs for waitFor");
|
@@ -1925,6 +1931,20 @@ var PageTaskExecutor = class {
|
|
1925
1931
|
`waitFor timeout: ${errorThought}`
|
1926
1932
|
);
|
1927
1933
|
}
|
1934
|
+
/**
|
1935
|
+
* Hafızaya yeni bir öğe ekler
|
1936
|
+
*/
|
1937
|
+
addToMemory(memoryItem) {
|
1938
|
+
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1939
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(this.sessionContext.workflowId);
|
1940
|
+
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1941
|
+
onTaskStart: this.onTaskStartCallback,
|
1942
|
+
initialMemory: previousMemory
|
1943
|
+
});
|
1944
|
+
}
|
1945
|
+
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1946
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation("add", memoryItem);
|
1947
|
+
}
|
1928
1948
|
};
|
1929
1949
|
|
1930
1950
|
// src/common/plan-builder.ts
|
@@ -2019,7 +2039,7 @@ var import_js_yaml3 = __toESM(require("js-yaml"));
|
|
2019
2039
|
var import_semver = __toESM(require("semver"));
|
2020
2040
|
|
2021
2041
|
// package.json
|
2022
|
-
var version = "1.
|
2042
|
+
var version = "1.6.0";
|
2023
2043
|
|
2024
2044
|
// src/common/task-cache.ts
|
2025
2045
|
var debug3 = (0, import_logger3.getDebug)("cache");
|
@@ -2230,7 +2250,10 @@ var PageAgent = class {
|
|
2230
2250
|
}
|
2231
2251
|
this.taskExecutor = new PageTaskExecutor(this.page, this.insight, {
|
2232
2252
|
taskCache: this.taskCache,
|
2233
|
-
onTaskStart: this.callbackOnTaskStartTip.bind(this)
|
2253
|
+
onTaskStart: this.callbackOnTaskStartTip.bind(this),
|
2254
|
+
memoryConfig: opts?.memoryConfig,
|
2255
|
+
sessionId: opts?.sessionId,
|
2256
|
+
workflowId: opts?.workflowId
|
2234
2257
|
});
|
2235
2258
|
this.dump = this.resetDump();
|
2236
2259
|
this.reportFileName = reportFileName(
|
@@ -2681,6 +2704,7 @@ ${reasonMsg}`);
|
|
2681
2704
|
}
|
2682
2705
|
async aiCaptcha(options) {
|
2683
2706
|
const { deepThink = false, autoDetectComplexity = true } = options || {};
|
2707
|
+
const memoryContext = this.getMemoryAsContext();
|
2684
2708
|
let shouldUseDeepThink = deepThink;
|
2685
2709
|
if (autoDetectComplexity && !deepThink) {
|
2686
2710
|
const context = await this.getUIContext();
|
@@ -2761,6 +2785,26 @@ Return only "complex" or "simple" based on your analysis.
|
|
2761
2785
|
}
|
2762
2786
|
}
|
2763
2787
|
await new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
2788
|
+
const captchaMemoryItem = {
|
2789
|
+
id: `captcha_${Date.now()}`,
|
2790
|
+
timestamp: Date.now(),
|
2791
|
+
taskType: "Action",
|
2792
|
+
summary: `Solved ${captchaResult.captchaType} CAPTCHA: ${captchaResult.thought}`,
|
2793
|
+
context: {
|
2794
|
+
url: await this.page.url?.() || "",
|
2795
|
+
captchaType: captchaResult.captchaType,
|
2796
|
+
actions: captchaResult.actions,
|
2797
|
+
deepThink: actualDeepThink
|
2798
|
+
},
|
2799
|
+
metadata: {
|
2800
|
+
executionTime: Date.now() - Date.now(),
|
2801
|
+
// Will be updated
|
2802
|
+
success: true,
|
2803
|
+
confidence: 0.9
|
2804
|
+
},
|
2805
|
+
tags: ["captcha", "action", captchaResult.captchaType]
|
2806
|
+
};
|
2807
|
+
this.taskExecutor.addToMemory(captchaMemoryItem);
|
2764
2808
|
const metadata = {
|
2765
2809
|
status: "finished",
|
2766
2810
|
usage,
|
@@ -2777,10 +2821,15 @@ Return only "complex" or "simple" based on your analysis.
|
|
2777
2821
|
}
|
2778
2822
|
async aiWaitFor(assertion, opt) {
|
2779
2823
|
const startTime = Date.now();
|
2780
|
-
const
|
2824
|
+
const memoryContext = this.getMemoryAsContext();
|
2825
|
+
const assertionWithContext = memoryContext ? `${assertion}
|
2826
|
+
|
2827
|
+
Previous workflow steps:
|
2828
|
+
${memoryContext}` : assertion;
|
2829
|
+
const { executor } = await this.taskExecutor.waitFor(assertionWithContext, {
|
2781
2830
|
timeoutMs: opt?.timeoutMs || 15 * 1e3,
|
2782
2831
|
checkIntervalMs: opt?.checkIntervalMs || 3 * 1e3,
|
2783
|
-
assertion
|
2832
|
+
assertion: assertionWithContext
|
2784
2833
|
});
|
2785
2834
|
const metadata = {
|
2786
2835
|
status: executor.isInErrorState() ? "failed" : "finished",
|
@@ -2936,6 +2985,109 @@ ${errors}`);
|
|
2936
2985
|
clearMemory() {
|
2937
2986
|
this.taskExecutor.clearMemory();
|
2938
2987
|
}
|
2988
|
+
/**
|
2989
|
+
* Test sonunda kullanım için detaylı hafıza raporu döndürür (JSON formatında)
|
2990
|
+
*/
|
2991
|
+
getMemoryReport() {
|
2992
|
+
const memory = this.getMemory();
|
2993
|
+
const stats = this.getMemoryStats();
|
2994
|
+
return {
|
2995
|
+
summary: {
|
2996
|
+
totalItems: memory.length,
|
2997
|
+
totalTasks: stats.analytics.totalTasks,
|
2998
|
+
memoryHits: stats.analytics.memoryHits,
|
2999
|
+
memoryMisses: stats.analytics.memoryMisses,
|
3000
|
+
memoryEffectiveness: Math.round(stats.analytics.memoryEffectiveness * 100),
|
3001
|
+
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
3002
|
+
},
|
3003
|
+
config: stats.config,
|
3004
|
+
items: memory.map((item) => ({
|
3005
|
+
id: item.id,
|
3006
|
+
timestamp: item.timestamp,
|
3007
|
+
taskType: item.taskType,
|
3008
|
+
summary: item.summary,
|
3009
|
+
context: item.context,
|
3010
|
+
metadata: item.metadata,
|
3011
|
+
tags: item.tags,
|
3012
|
+
relativeTime: this.formatRelativeTime(item.timestamp)
|
3013
|
+
})),
|
3014
|
+
analytics: {
|
3015
|
+
taskTypeDistribution: this.getTaskTypeDistribution(memory),
|
3016
|
+
successRate: this.calculateSuccessRate(memory),
|
3017
|
+
averageExecutionTime: this.calculateAverageExecutionTime(memory),
|
3018
|
+
dataExtractionCount: this.countDataExtractions(memory),
|
3019
|
+
workflowSteps: this.extractWorkflowSteps(memory)
|
3020
|
+
}
|
3021
|
+
};
|
3022
|
+
}
|
3023
|
+
/**
|
3024
|
+
* Test sonunda kullanım için basit hafıza özeti döndürür (JSON formatında)
|
3025
|
+
*/
|
3026
|
+
getMemorySummary() {
|
3027
|
+
const memory = this.getMemory();
|
3028
|
+
const stats = this.getMemoryStats();
|
3029
|
+
return {
|
3030
|
+
totalItems: memory.length,
|
3031
|
+
memoryEffectiveness: `${Math.round(stats.analytics.memoryEffectiveness * 100)}%`,
|
3032
|
+
taskTypes: this.getTaskTypeDistribution(memory),
|
3033
|
+
recentSteps: memory.slice(-5).map((item) => ({
|
3034
|
+
step: item.summary,
|
3035
|
+
type: item.taskType,
|
3036
|
+
success: item.metadata?.success || false,
|
3037
|
+
time: this.formatRelativeTime(item.timestamp)
|
3038
|
+
})),
|
3039
|
+
dataExtracted: this.getExtractedDataSummary(memory)
|
3040
|
+
};
|
3041
|
+
}
|
3042
|
+
formatRelativeTime(timestamp) {
|
3043
|
+
const now = Date.now();
|
3044
|
+
const diff = now - timestamp;
|
3045
|
+
const seconds = Math.floor(diff / 1e3);
|
3046
|
+
const minutes = Math.floor(seconds / 60);
|
3047
|
+
const hours = Math.floor(minutes / 60);
|
3048
|
+
if (hours > 0)
|
3049
|
+
return `${hours}h ${minutes % 60}m ago`;
|
3050
|
+
if (minutes > 0)
|
3051
|
+
return `${minutes}m ${seconds % 60}s ago`;
|
3052
|
+
return `${seconds}s ago`;
|
3053
|
+
}
|
3054
|
+
getTaskTypeDistribution(memory) {
|
3055
|
+
const distribution = {};
|
3056
|
+
memory.forEach((item) => {
|
3057
|
+
distribution[item.taskType] = (distribution[item.taskType] || 0) + 1;
|
3058
|
+
});
|
3059
|
+
return distribution;
|
3060
|
+
}
|
3061
|
+
calculateSuccessRate(memory) {
|
3062
|
+
if (memory.length === 0)
|
3063
|
+
return 0;
|
3064
|
+
const successCount = memory.filter((item) => item.metadata?.success !== false).length;
|
3065
|
+
return Math.round(successCount / memory.length * 100);
|
3066
|
+
}
|
3067
|
+
calculateAverageExecutionTime(memory) {
|
3068
|
+
const executionTimes = memory.map((item) => item.metadata?.executionTime).filter((time) => typeof time === "number");
|
3069
|
+
if (executionTimes.length === 0)
|
3070
|
+
return 0;
|
3071
|
+
const average = executionTimes.reduce((sum, time) => sum + time, 0) / executionTimes.length;
|
3072
|
+
return Math.round(average);
|
3073
|
+
}
|
3074
|
+
countDataExtractions(memory) {
|
3075
|
+
return memory.filter(
|
3076
|
+
(item) => item.context?.dataExtracted || item.taskType === "Insight" && item.summary.includes("Extracted")
|
3077
|
+
).length;
|
3078
|
+
}
|
3079
|
+
extractWorkflowSteps(memory) {
|
3080
|
+
return memory.map((item) => item.summary);
|
3081
|
+
}
|
3082
|
+
getExtractedDataSummary(memory) {
|
3083
|
+
const extractedData = {};
|
3084
|
+
memory.forEach((item, index) => {
|
3085
|
+
if (item.context?.dataExtracted) {
|
3086
|
+
extractedData[`step_${index + 1}`] = item.context.dataExtracted;
|
3087
|
+
}
|
3088
|
+
});
|
3089
|
+
return extractedData;
|
3090
|
+
}
|
2939
3091
|
};
|
2940
3092
|
|
2941
3093
|
// src/chrome-extension/agent.ts
|
@@ -3153,7 +3305,7 @@ function sleep2(ms) {
|
|
3153
3305
|
var ChromeExtensionProxyPage = class {
|
3154
3306
|
constructor(forceSameTabNavigation) {
|
3155
3307
|
this.pageType = "chrome-extension-proxy";
|
3156
|
-
this.version = "1.
|
3308
|
+
this.version = "1.6.0";
|
3157
3309
|
this.activeTabId = null;
|
3158
3310
|
this.tabIdOfDebuggerAttached = null;
|
3159
3311
|
this.attachingDebugger = null;
|