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
@@ -1850,9 +1850,15 @@ var PageTaskExecutor = class {
|
|
1850
1850
|
}
|
1851
1851
|
async waitFor(assertion, opt) {
|
1852
1852
|
const description = `waitFor: ${assertion}`;
|
1853
|
-
const
|
1854
|
-
|
1855
|
-
|
1853
|
+
const useMemory = true;
|
1854
|
+
let taskExecutor;
|
1855
|
+
if (useMemory) {
|
1856
|
+
taskExecutor = this.getPersistentExecutor();
|
1857
|
+
} else {
|
1858
|
+
taskExecutor = new Executor(taskTitleStr("WaitFor", description), {
|
1859
|
+
onTaskStart: this.onTaskStartCallback
|
1860
|
+
});
|
1861
|
+
}
|
1856
1862
|
const { timeoutMs, checkIntervalMs } = opt;
|
1857
1863
|
assert4(assertion, "No assertion for waitFor");
|
1858
1864
|
assert4(timeoutMs, "No timeoutMs for waitFor");
|
@@ -1907,6 +1913,20 @@ var PageTaskExecutor = class {
|
|
1907
1913
|
`waitFor timeout: ${errorThought}`
|
1908
1914
|
);
|
1909
1915
|
}
|
1916
|
+
/**
|
1917
|
+
* Hafızaya yeni bir öğe ekler
|
1918
|
+
*/
|
1919
|
+
addToMemory(memoryItem) {
|
1920
|
+
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1921
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(this.sessionContext.workflowId);
|
1922
|
+
this.persistentExecutor = new Executor("Persistent Task Executor", {
|
1923
|
+
onTaskStart: this.onTaskStartCallback,
|
1924
|
+
initialMemory: previousMemory
|
1925
|
+
});
|
1926
|
+
}
|
1927
|
+
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1928
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation("add", memoryItem);
|
1929
|
+
}
|
1910
1930
|
};
|
1911
1931
|
|
1912
1932
|
// src/common/plan-builder.ts
|
@@ -2001,7 +2021,7 @@ import yaml3 from "js-yaml";
|
|
2001
2021
|
import semver from "semver";
|
2002
2022
|
|
2003
2023
|
// package.json
|
2004
|
-
var version = "1.
|
2024
|
+
var version = "1.6.0";
|
2005
2025
|
|
2006
2026
|
// src/common/task-cache.ts
|
2007
2027
|
var debug3 = getDebug3("cache");
|
@@ -2212,7 +2232,10 @@ var PageAgent = class {
|
|
2212
2232
|
}
|
2213
2233
|
this.taskExecutor = new PageTaskExecutor(this.page, this.insight, {
|
2214
2234
|
taskCache: this.taskCache,
|
2215
|
-
onTaskStart: this.callbackOnTaskStartTip.bind(this)
|
2235
|
+
onTaskStart: this.callbackOnTaskStartTip.bind(this),
|
2236
|
+
memoryConfig: opts?.memoryConfig,
|
2237
|
+
sessionId: opts?.sessionId,
|
2238
|
+
workflowId: opts?.workflowId
|
2216
2239
|
});
|
2217
2240
|
this.dump = this.resetDump();
|
2218
2241
|
this.reportFileName = reportFileName(
|
@@ -2663,6 +2686,7 @@ ${reasonMsg}`);
|
|
2663
2686
|
}
|
2664
2687
|
async aiCaptcha(options) {
|
2665
2688
|
const { deepThink = false, autoDetectComplexity = true } = options || {};
|
2689
|
+
const memoryContext = this.getMemoryAsContext();
|
2666
2690
|
let shouldUseDeepThink = deepThink;
|
2667
2691
|
if (autoDetectComplexity && !deepThink) {
|
2668
2692
|
const context = await this.getUIContext();
|
@@ -2743,6 +2767,26 @@ Return only "complex" or "simple" based on your analysis.
|
|
2743
2767
|
}
|
2744
2768
|
}
|
2745
2769
|
await new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
2770
|
+
const captchaMemoryItem = {
|
2771
|
+
id: `captcha_${Date.now()}`,
|
2772
|
+
timestamp: Date.now(),
|
2773
|
+
taskType: "Action",
|
2774
|
+
summary: `Solved ${captchaResult.captchaType} CAPTCHA: ${captchaResult.thought}`,
|
2775
|
+
context: {
|
2776
|
+
url: await this.page.url?.() || "",
|
2777
|
+
captchaType: captchaResult.captchaType,
|
2778
|
+
actions: captchaResult.actions,
|
2779
|
+
deepThink: actualDeepThink
|
2780
|
+
},
|
2781
|
+
metadata: {
|
2782
|
+
executionTime: Date.now() - Date.now(),
|
2783
|
+
// Will be updated
|
2784
|
+
success: true,
|
2785
|
+
confidence: 0.9
|
2786
|
+
},
|
2787
|
+
tags: ["captcha", "action", captchaResult.captchaType]
|
2788
|
+
};
|
2789
|
+
this.taskExecutor.addToMemory(captchaMemoryItem);
|
2746
2790
|
const metadata = {
|
2747
2791
|
status: "finished",
|
2748
2792
|
usage,
|
@@ -2759,10 +2803,15 @@ Return only "complex" or "simple" based on your analysis.
|
|
2759
2803
|
}
|
2760
2804
|
async aiWaitFor(assertion, opt) {
|
2761
2805
|
const startTime = Date.now();
|
2762
|
-
const
|
2806
|
+
const memoryContext = this.getMemoryAsContext();
|
2807
|
+
const assertionWithContext = memoryContext ? `${assertion}
|
2808
|
+
|
2809
|
+
Previous workflow steps:
|
2810
|
+
${memoryContext}` : assertion;
|
2811
|
+
const { executor } = await this.taskExecutor.waitFor(assertionWithContext, {
|
2763
2812
|
timeoutMs: opt?.timeoutMs || 15 * 1e3,
|
2764
2813
|
checkIntervalMs: opt?.checkIntervalMs || 3 * 1e3,
|
2765
|
-
assertion
|
2814
|
+
assertion: assertionWithContext
|
2766
2815
|
});
|
2767
2816
|
const metadata = {
|
2768
2817
|
status: executor.isInErrorState() ? "failed" : "finished",
|
@@ -2918,6 +2967,109 @@ ${errors}`);
|
|
2918
2967
|
clearMemory() {
|
2919
2968
|
this.taskExecutor.clearMemory();
|
2920
2969
|
}
|
2970
|
+
/**
|
2971
|
+
* Test sonunda kullanım için detaylı hafıza raporu döndürür (JSON formatında)
|
2972
|
+
*/
|
2973
|
+
getMemoryReport() {
|
2974
|
+
const memory = this.getMemory();
|
2975
|
+
const stats = this.getMemoryStats();
|
2976
|
+
return {
|
2977
|
+
summary: {
|
2978
|
+
totalItems: memory.length,
|
2979
|
+
totalTasks: stats.analytics.totalTasks,
|
2980
|
+
memoryHits: stats.analytics.memoryHits,
|
2981
|
+
memoryMisses: stats.analytics.memoryMisses,
|
2982
|
+
memoryEffectiveness: Math.round(stats.analytics.memoryEffectiveness * 100),
|
2983
|
+
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
2984
|
+
},
|
2985
|
+
config: stats.config,
|
2986
|
+
items: memory.map((item) => ({
|
2987
|
+
id: item.id,
|
2988
|
+
timestamp: item.timestamp,
|
2989
|
+
taskType: item.taskType,
|
2990
|
+
summary: item.summary,
|
2991
|
+
context: item.context,
|
2992
|
+
metadata: item.metadata,
|
2993
|
+
tags: item.tags,
|
2994
|
+
relativeTime: this.formatRelativeTime(item.timestamp)
|
2995
|
+
})),
|
2996
|
+
analytics: {
|
2997
|
+
taskTypeDistribution: this.getTaskTypeDistribution(memory),
|
2998
|
+
successRate: this.calculateSuccessRate(memory),
|
2999
|
+
averageExecutionTime: this.calculateAverageExecutionTime(memory),
|
3000
|
+
dataExtractionCount: this.countDataExtractions(memory),
|
3001
|
+
workflowSteps: this.extractWorkflowSteps(memory)
|
3002
|
+
}
|
3003
|
+
};
|
3004
|
+
}
|
3005
|
+
/**
|
3006
|
+
* Test sonunda kullanım için basit hafıza özeti döndürür (JSON formatında)
|
3007
|
+
*/
|
3008
|
+
getMemorySummary() {
|
3009
|
+
const memory = this.getMemory();
|
3010
|
+
const stats = this.getMemoryStats();
|
3011
|
+
return {
|
3012
|
+
totalItems: memory.length,
|
3013
|
+
memoryEffectiveness: `${Math.round(stats.analytics.memoryEffectiveness * 100)}%`,
|
3014
|
+
taskTypes: this.getTaskTypeDistribution(memory),
|
3015
|
+
recentSteps: memory.slice(-5).map((item) => ({
|
3016
|
+
step: item.summary,
|
3017
|
+
type: item.taskType,
|
3018
|
+
success: item.metadata?.success || false,
|
3019
|
+
time: this.formatRelativeTime(item.timestamp)
|
3020
|
+
})),
|
3021
|
+
dataExtracted: this.getExtractedDataSummary(memory)
|
3022
|
+
};
|
3023
|
+
}
|
3024
|
+
formatRelativeTime(timestamp) {
|
3025
|
+
const now = Date.now();
|
3026
|
+
const diff = now - timestamp;
|
3027
|
+
const seconds = Math.floor(diff / 1e3);
|
3028
|
+
const minutes = Math.floor(seconds / 60);
|
3029
|
+
const hours = Math.floor(minutes / 60);
|
3030
|
+
if (hours > 0)
|
3031
|
+
return `${hours}h ${minutes % 60}m ago`;
|
3032
|
+
if (minutes > 0)
|
3033
|
+
return `${minutes}m ${seconds % 60}s ago`;
|
3034
|
+
return `${seconds}s ago`;
|
3035
|
+
}
|
3036
|
+
getTaskTypeDistribution(memory) {
|
3037
|
+
const distribution = {};
|
3038
|
+
memory.forEach((item) => {
|
3039
|
+
distribution[item.taskType] = (distribution[item.taskType] || 0) + 1;
|
3040
|
+
});
|
3041
|
+
return distribution;
|
3042
|
+
}
|
3043
|
+
calculateSuccessRate(memory) {
|
3044
|
+
if (memory.length === 0)
|
3045
|
+
return 0;
|
3046
|
+
const successCount = memory.filter((item) => item.metadata?.success !== false).length;
|
3047
|
+
return Math.round(successCount / memory.length * 100);
|
3048
|
+
}
|
3049
|
+
calculateAverageExecutionTime(memory) {
|
3050
|
+
const executionTimes = memory.map((item) => item.metadata?.executionTime).filter((time) => typeof time === "number");
|
3051
|
+
if (executionTimes.length === 0)
|
3052
|
+
return 0;
|
3053
|
+
const average = executionTimes.reduce((sum, time) => sum + time, 0) / executionTimes.length;
|
3054
|
+
return Math.round(average);
|
3055
|
+
}
|
3056
|
+
countDataExtractions(memory) {
|
3057
|
+
return memory.filter(
|
3058
|
+
(item) => item.context?.dataExtracted || item.taskType === "Insight" && item.summary.includes("Extracted")
|
3059
|
+
).length;
|
3060
|
+
}
|
3061
|
+
extractWorkflowSteps(memory) {
|
3062
|
+
return memory.map((item) => item.summary);
|
3063
|
+
}
|
3064
|
+
getExtractedDataSummary(memory) {
|
3065
|
+
const extractedData = {};
|
3066
|
+
memory.forEach((item, index) => {
|
3067
|
+
if (item.context?.dataExtracted) {
|
3068
|
+
extractedData[`step_${index + 1}`] = item.context.dataExtracted;
|
3069
|
+
}
|
3070
|
+
});
|
3071
|
+
return extractedData;
|
3072
|
+
}
|
2921
3073
|
};
|
2922
3074
|
|
2923
3075
|
// src/chrome-extension/agent.ts
|
@@ -3137,7 +3289,7 @@ function sleep2(ms) {
|
|
3137
3289
|
var ChromeExtensionProxyPage = class {
|
3138
3290
|
constructor(forceSameTabNavigation) {
|
3139
3291
|
this.pageType = "chrome-extension-proxy";
|
3140
|
-
this.version = "1.
|
3292
|
+
this.version = "1.6.0";
|
3141
3293
|
this.activeTabId = null;
|
3142
3294
|
this.tabIdOfDebuggerAttached = null;
|
3143
3295
|
this.attachingDebugger = null;
|