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
@@ -291,7 +291,7 @@ function sleep(ms) {
|
|
291
291
|
var ChromeExtensionProxyPage = class {
|
292
292
|
constructor(forceSameTabNavigation) {
|
293
293
|
this.pageType = "chrome-extension-proxy";
|
294
|
-
this.version = "1.
|
294
|
+
this.version = "1.6.0";
|
295
295
|
this.activeTabId = null;
|
296
296
|
this.tabIdOfDebuggerAttached = null;
|
297
297
|
this.attachingDebugger = null;
|
@@ -785,7 +785,7 @@ var BridgeClient = class {
|
|
785
785
|
this.socket = (0, import_socket.io)(this.endpoint, {
|
786
786
|
reconnection: false,
|
787
787
|
query: {
|
788
|
-
version: "1.
|
788
|
+
version: "1.6.0"
|
789
789
|
}
|
790
790
|
});
|
791
791
|
const timeout = setTimeout(() => {
|
@@ -926,7 +926,7 @@ var ExtensionBridgePageBrowserSide = class extends ChromeExtensionProxyPage {
|
|
926
926
|
);
|
927
927
|
await this.bridgeClient.connect();
|
928
928
|
this.onLogMessage(
|
929
|
-
`Bridge connected, cli-side version v${this.bridgeClient.serverVersion}, browser-side version v${"1.
|
929
|
+
`Bridge connected, cli-side version v${this.bridgeClient.serverVersion}, browser-side version v${"1.6.0"}`,
|
930
930
|
"log"
|
931
931
|
);
|
932
932
|
}
|
package/dist/lib/bridge-mode.js
CHANGED
@@ -1822,9 +1822,15 @@ var PageTaskExecutor = class {
|
|
1822
1822
|
}
|
1823
1823
|
async waitFor(assertion, opt) {
|
1824
1824
|
const description = `waitFor: ${assertion}`;
|
1825
|
-
const
|
1826
|
-
|
1827
|
-
|
1825
|
+
const useMemory = true;
|
1826
|
+
let taskExecutor;
|
1827
|
+
if (useMemory) {
|
1828
|
+
taskExecutor = this.getPersistentExecutor();
|
1829
|
+
} else {
|
1830
|
+
taskExecutor = new import_misoai_core.Executor(taskTitleStr("WaitFor", description), {
|
1831
|
+
onTaskStart: this.onTaskStartCallback
|
1832
|
+
});
|
1833
|
+
}
|
1828
1834
|
const { timeoutMs, checkIntervalMs } = opt;
|
1829
1835
|
(0, import_utils6.assert)(assertion, "No assertion for waitFor");
|
1830
1836
|
(0, import_utils6.assert)(timeoutMs, "No timeoutMs for waitFor");
|
@@ -1879,6 +1885,20 @@ var PageTaskExecutor = class {
|
|
1879
1885
|
`waitFor timeout: ${errorThought}`
|
1880
1886
|
);
|
1881
1887
|
}
|
1888
|
+
/**
|
1889
|
+
* Hafızaya yeni bir öğe ekler
|
1890
|
+
*/
|
1891
|
+
addToMemory(memoryItem) {
|
1892
|
+
if (!this.persistentExecutor || this.persistentExecutor.status === "error") {
|
1893
|
+
const previousMemory = this.workflowMemory.getWorkflowMemory(this.sessionContext.workflowId);
|
1894
|
+
this.persistentExecutor = new import_misoai_core.Executor("Persistent Task Executor", {
|
1895
|
+
onTaskStart: this.onTaskStartCallback,
|
1896
|
+
initialMemory: previousMemory
|
1897
|
+
});
|
1898
|
+
}
|
1899
|
+
this.persistentExecutor.memoryStore?.add(memoryItem);
|
1900
|
+
this.persistentExecutor.memoryAnalytics?.recordMemoryOperation("add", memoryItem);
|
1901
|
+
}
|
1882
1902
|
};
|
1883
1903
|
|
1884
1904
|
// src/common/plan-builder.ts
|
@@ -1973,7 +1993,7 @@ var import_js_yaml3 = __toESM(require("js-yaml"));
|
|
1973
1993
|
var import_semver = __toESM(require("semver"));
|
1974
1994
|
|
1975
1995
|
// package.json
|
1976
|
-
var version = "1.
|
1996
|
+
var version = "1.6.0";
|
1977
1997
|
|
1978
1998
|
// src/common/task-cache.ts
|
1979
1999
|
var debug3 = (0, import_logger3.getDebug)("cache");
|
@@ -2184,7 +2204,10 @@ var PageAgent = class {
|
|
2184
2204
|
}
|
2185
2205
|
this.taskExecutor = new PageTaskExecutor(this.page, this.insight, {
|
2186
2206
|
taskCache: this.taskCache,
|
2187
|
-
onTaskStart: this.callbackOnTaskStartTip.bind(this)
|
2207
|
+
onTaskStart: this.callbackOnTaskStartTip.bind(this),
|
2208
|
+
memoryConfig: opts?.memoryConfig,
|
2209
|
+
sessionId: opts?.sessionId,
|
2210
|
+
workflowId: opts?.workflowId
|
2188
2211
|
});
|
2189
2212
|
this.dump = this.resetDump();
|
2190
2213
|
this.reportFileName = reportFileName(
|
@@ -2635,6 +2658,7 @@ ${reasonMsg}`);
|
|
2635
2658
|
}
|
2636
2659
|
async aiCaptcha(options) {
|
2637
2660
|
const { deepThink = false, autoDetectComplexity = true } = options || {};
|
2661
|
+
const memoryContext = this.getMemoryAsContext();
|
2638
2662
|
let shouldUseDeepThink = deepThink;
|
2639
2663
|
if (autoDetectComplexity && !deepThink) {
|
2640
2664
|
const context = await this.getUIContext();
|
@@ -2715,6 +2739,26 @@ Return only "complex" or "simple" based on your analysis.
|
|
2715
2739
|
}
|
2716
2740
|
}
|
2717
2741
|
await new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
2742
|
+
const captchaMemoryItem = {
|
2743
|
+
id: `captcha_${Date.now()}`,
|
2744
|
+
timestamp: Date.now(),
|
2745
|
+
taskType: "Action",
|
2746
|
+
summary: `Solved ${captchaResult.captchaType} CAPTCHA: ${captchaResult.thought}`,
|
2747
|
+
context: {
|
2748
|
+
url: await this.page.url?.() || "",
|
2749
|
+
captchaType: captchaResult.captchaType,
|
2750
|
+
actions: captchaResult.actions,
|
2751
|
+
deepThink: actualDeepThink
|
2752
|
+
},
|
2753
|
+
metadata: {
|
2754
|
+
executionTime: Date.now() - Date.now(),
|
2755
|
+
// Will be updated
|
2756
|
+
success: true,
|
2757
|
+
confidence: 0.9
|
2758
|
+
},
|
2759
|
+
tags: ["captcha", "action", captchaResult.captchaType]
|
2760
|
+
};
|
2761
|
+
this.taskExecutor.addToMemory(captchaMemoryItem);
|
2718
2762
|
const metadata = {
|
2719
2763
|
status: "finished",
|
2720
2764
|
usage,
|
@@ -2731,10 +2775,15 @@ Return only "complex" or "simple" based on your analysis.
|
|
2731
2775
|
}
|
2732
2776
|
async aiWaitFor(assertion, opt) {
|
2733
2777
|
const startTime = Date.now();
|
2734
|
-
const
|
2778
|
+
const memoryContext = this.getMemoryAsContext();
|
2779
|
+
const assertionWithContext = memoryContext ? `${assertion}
|
2780
|
+
|
2781
|
+
Previous workflow steps:
|
2782
|
+
${memoryContext}` : assertion;
|
2783
|
+
const { executor } = await this.taskExecutor.waitFor(assertionWithContext, {
|
2735
2784
|
timeoutMs: opt?.timeoutMs || 15 * 1e3,
|
2736
2785
|
checkIntervalMs: opt?.checkIntervalMs || 3 * 1e3,
|
2737
|
-
assertion
|
2786
|
+
assertion: assertionWithContext
|
2738
2787
|
});
|
2739
2788
|
const metadata = {
|
2740
2789
|
status: executor.isInErrorState() ? "failed" : "finished",
|
@@ -2890,6 +2939,109 @@ ${errors}`);
|
|
2890
2939
|
clearMemory() {
|
2891
2940
|
this.taskExecutor.clearMemory();
|
2892
2941
|
}
|
2942
|
+
/**
|
2943
|
+
* Test sonunda kullanım için detaylı hafıza raporu döndürür (JSON formatında)
|
2944
|
+
*/
|
2945
|
+
getMemoryReport() {
|
2946
|
+
const memory = this.getMemory();
|
2947
|
+
const stats = this.getMemoryStats();
|
2948
|
+
return {
|
2949
|
+
summary: {
|
2950
|
+
totalItems: memory.length,
|
2951
|
+
totalTasks: stats.analytics.totalTasks,
|
2952
|
+
memoryHits: stats.analytics.memoryHits,
|
2953
|
+
memoryMisses: stats.analytics.memoryMisses,
|
2954
|
+
memoryEffectiveness: Math.round(stats.analytics.memoryEffectiveness * 100),
|
2955
|
+
averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
|
2956
|
+
},
|
2957
|
+
config: stats.config,
|
2958
|
+
items: memory.map((item) => ({
|
2959
|
+
id: item.id,
|
2960
|
+
timestamp: item.timestamp,
|
2961
|
+
taskType: item.taskType,
|
2962
|
+
summary: item.summary,
|
2963
|
+
context: item.context,
|
2964
|
+
metadata: item.metadata,
|
2965
|
+
tags: item.tags,
|
2966
|
+
relativeTime: this.formatRelativeTime(item.timestamp)
|
2967
|
+
})),
|
2968
|
+
analytics: {
|
2969
|
+
taskTypeDistribution: this.getTaskTypeDistribution(memory),
|
2970
|
+
successRate: this.calculateSuccessRate(memory),
|
2971
|
+
averageExecutionTime: this.calculateAverageExecutionTime(memory),
|
2972
|
+
dataExtractionCount: this.countDataExtractions(memory),
|
2973
|
+
workflowSteps: this.extractWorkflowSteps(memory)
|
2974
|
+
}
|
2975
|
+
};
|
2976
|
+
}
|
2977
|
+
/**
|
2978
|
+
* Test sonunda kullanım için basit hafıza özeti döndürür (JSON formatında)
|
2979
|
+
*/
|
2980
|
+
getMemorySummary() {
|
2981
|
+
const memory = this.getMemory();
|
2982
|
+
const stats = this.getMemoryStats();
|
2983
|
+
return {
|
2984
|
+
totalItems: memory.length,
|
2985
|
+
memoryEffectiveness: `${Math.round(stats.analytics.memoryEffectiveness * 100)}%`,
|
2986
|
+
taskTypes: this.getTaskTypeDistribution(memory),
|
2987
|
+
recentSteps: memory.slice(-5).map((item) => ({
|
2988
|
+
step: item.summary,
|
2989
|
+
type: item.taskType,
|
2990
|
+
success: item.metadata?.success || false,
|
2991
|
+
time: this.formatRelativeTime(item.timestamp)
|
2992
|
+
})),
|
2993
|
+
dataExtracted: this.getExtractedDataSummary(memory)
|
2994
|
+
};
|
2995
|
+
}
|
2996
|
+
formatRelativeTime(timestamp) {
|
2997
|
+
const now = Date.now();
|
2998
|
+
const diff = now - timestamp;
|
2999
|
+
const seconds = Math.floor(diff / 1e3);
|
3000
|
+
const minutes = Math.floor(seconds / 60);
|
3001
|
+
const hours = Math.floor(minutes / 60);
|
3002
|
+
if (hours > 0)
|
3003
|
+
return `${hours}h ${minutes % 60}m ago`;
|
3004
|
+
if (minutes > 0)
|
3005
|
+
return `${minutes}m ${seconds % 60}s ago`;
|
3006
|
+
return `${seconds}s ago`;
|
3007
|
+
}
|
3008
|
+
getTaskTypeDistribution(memory) {
|
3009
|
+
const distribution = {};
|
3010
|
+
memory.forEach((item) => {
|
3011
|
+
distribution[item.taskType] = (distribution[item.taskType] || 0) + 1;
|
3012
|
+
});
|
3013
|
+
return distribution;
|
3014
|
+
}
|
3015
|
+
calculateSuccessRate(memory) {
|
3016
|
+
if (memory.length === 0)
|
3017
|
+
return 0;
|
3018
|
+
const successCount = memory.filter((item) => item.metadata?.success !== false).length;
|
3019
|
+
return Math.round(successCount / memory.length * 100);
|
3020
|
+
}
|
3021
|
+
calculateAverageExecutionTime(memory) {
|
3022
|
+
const executionTimes = memory.map((item) => item.metadata?.executionTime).filter((time) => typeof time === "number");
|
3023
|
+
if (executionTimes.length === 0)
|
3024
|
+
return 0;
|
3025
|
+
const average = executionTimes.reduce((sum, time) => sum + time, 0) / executionTimes.length;
|
3026
|
+
return Math.round(average);
|
3027
|
+
}
|
3028
|
+
countDataExtractions(memory) {
|
3029
|
+
return memory.filter(
|
3030
|
+
(item) => item.context?.dataExtracted || item.taskType === "Insight" && item.summary.includes("Extracted")
|
3031
|
+
).length;
|
3032
|
+
}
|
3033
|
+
extractWorkflowSteps(memory) {
|
3034
|
+
return memory.map((item) => item.summary);
|
3035
|
+
}
|
3036
|
+
getExtractedDataSummary(memory) {
|
3037
|
+
const extractedData = {};
|
3038
|
+
memory.forEach((item, index) => {
|
3039
|
+
if (item.context?.dataExtracted) {
|
3040
|
+
extractedData[`step_${index + 1}`] = item.context.dataExtracted;
|
3041
|
+
}
|
3042
|
+
});
|
3043
|
+
return extractedData;
|
3044
|
+
}
|
2893
3045
|
};
|
2894
3046
|
|
2895
3047
|
// src/bridge-mode/agent-cli-side.ts
|
@@ -3002,7 +3154,7 @@ var BridgeServer = class {
|
|
3002
3154
|
this.socket = socket;
|
3003
3155
|
const clientVersion = socket.handshake.query.version;
|
3004
3156
|
(0, import_utils16.logMsg)(
|
3005
|
-
`Bridge connected, cli-side version v${"1.
|
3157
|
+
`Bridge connected, cli-side version v${"1.6.0"}, browser-side version v${clientVersion}`
|
3006
3158
|
);
|
3007
3159
|
socket.on("bridge-call-response" /* CallResponse */, (params) => {
|
3008
3160
|
const id = params.id;
|
@@ -3033,7 +3185,7 @@ var BridgeServer = class {
|
|
3033
3185
|
setTimeout(() => {
|
3034
3186
|
this.onConnect?.();
|
3035
3187
|
const payload = {
|
3036
|
-
version: "1.
|
3188
|
+
version: "1.6.0"
|
3037
3189
|
};
|
3038
3190
|
socket.emit("bridge-connected" /* Connected */, payload);
|
3039
3191
|
Promise.resolve().then(() => {
|