misoai-web 1.5.8 → 1.5.9

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.
Files changed (40) hide show
  1. package/dist/es/agent.js +104 -1
  2. package/dist/es/agent.js.map +1 -1
  3. package/dist/es/bridge-mode-browser.js +3 -3
  4. package/dist/es/bridge-mode.js +106 -3
  5. package/dist/es/bridge-mode.js.map +1 -1
  6. package/dist/es/chrome-extension.js +105 -2
  7. package/dist/es/chrome-extension.js.map +1 -1
  8. package/dist/es/index.js +104 -1
  9. package/dist/es/index.js.map +1 -1
  10. package/dist/es/midscene-playground.js +104 -1
  11. package/dist/es/midscene-playground.js.map +1 -1
  12. package/dist/es/playground.js +104 -1
  13. package/dist/es/playground.js.map +1 -1
  14. package/dist/es/playwright.js +104 -1
  15. package/dist/es/playwright.js.map +1 -1
  16. package/dist/es/puppeteer-agent-launcher.js +104 -1
  17. package/dist/es/puppeteer-agent-launcher.js.map +1 -1
  18. package/dist/es/puppeteer.js +104 -1
  19. package/dist/es/puppeteer.js.map +1 -1
  20. package/dist/lib/agent.js +104 -1
  21. package/dist/lib/agent.js.map +1 -1
  22. package/dist/lib/bridge-mode-browser.js +3 -3
  23. package/dist/lib/bridge-mode.js +106 -3
  24. package/dist/lib/bridge-mode.js.map +1 -1
  25. package/dist/lib/chrome-extension.js +105 -2
  26. package/dist/lib/chrome-extension.js.map +1 -1
  27. package/dist/lib/index.js +104 -1
  28. package/dist/lib/index.js.map +1 -1
  29. package/dist/lib/midscene-playground.js +104 -1
  30. package/dist/lib/midscene-playground.js.map +1 -1
  31. package/dist/lib/playground.js +104 -1
  32. package/dist/lib/playground.js.map +1 -1
  33. package/dist/lib/playwright.js +104 -1
  34. package/dist/lib/playwright.js.map +1 -1
  35. package/dist/lib/puppeteer-agent-launcher.js +104 -1
  36. package/dist/lib/puppeteer-agent-launcher.js.map +1 -1
  37. package/dist/lib/puppeteer.js +104 -1
  38. package/dist/lib/puppeteer.js.map +1 -1
  39. package/dist/types/agent.d.ts +16 -1
  40. package/package.json +2 -2
package/dist/lib/index.js CHANGED
@@ -2005,7 +2005,7 @@ var import_js_yaml3 = __toESM(require("js-yaml"));
2005
2005
  var import_semver = __toESM(require("semver"));
2006
2006
 
2007
2007
  // package.json
2008
- var version = "1.5.7";
2008
+ var version = "1.5.8";
2009
2009
 
2010
2010
  // src/common/task-cache.ts
2011
2011
  var debug3 = (0, import_logger3.getDebug)("cache");
@@ -2922,6 +2922,109 @@ ${errors}`);
2922
2922
  clearMemory() {
2923
2923
  this.taskExecutor.clearMemory();
2924
2924
  }
2925
+ /**
2926
+ * Test sonunda kullanım için detaylı hafıza raporu döndürür (JSON formatında)
2927
+ */
2928
+ getMemoryReport() {
2929
+ const memory = this.getMemory();
2930
+ const stats = this.getMemoryStats();
2931
+ return {
2932
+ summary: {
2933
+ totalItems: memory.length,
2934
+ totalTasks: stats.analytics.totalTasks,
2935
+ memoryHits: stats.analytics.memoryHits,
2936
+ memoryMisses: stats.analytics.memoryMisses,
2937
+ memoryEffectiveness: Math.round(stats.analytics.memoryEffectiveness * 100),
2938
+ averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
2939
+ },
2940
+ config: stats.config,
2941
+ items: memory.map((item) => ({
2942
+ id: item.id,
2943
+ timestamp: item.timestamp,
2944
+ taskType: item.taskType,
2945
+ summary: item.summary,
2946
+ context: item.context,
2947
+ metadata: item.metadata,
2948
+ tags: item.tags,
2949
+ relativeTime: this.formatRelativeTime(item.timestamp)
2950
+ })),
2951
+ analytics: {
2952
+ taskTypeDistribution: this.getTaskTypeDistribution(memory),
2953
+ successRate: this.calculateSuccessRate(memory),
2954
+ averageExecutionTime: this.calculateAverageExecutionTime(memory),
2955
+ dataExtractionCount: this.countDataExtractions(memory),
2956
+ workflowSteps: this.extractWorkflowSteps(memory)
2957
+ }
2958
+ };
2959
+ }
2960
+ /**
2961
+ * Test sonunda kullanım için basit hafıza özeti döndürür (JSON formatında)
2962
+ */
2963
+ getMemorySummary() {
2964
+ const memory = this.getMemory();
2965
+ const stats = this.getMemoryStats();
2966
+ return {
2967
+ totalItems: memory.length,
2968
+ memoryEffectiveness: `${Math.round(stats.analytics.memoryEffectiveness * 100)}%`,
2969
+ taskTypes: this.getTaskTypeDistribution(memory),
2970
+ recentSteps: memory.slice(-5).map((item) => ({
2971
+ step: item.summary,
2972
+ type: item.taskType,
2973
+ success: item.metadata?.success || false,
2974
+ time: this.formatRelativeTime(item.timestamp)
2975
+ })),
2976
+ dataExtracted: this.getExtractedDataSummary(memory)
2977
+ };
2978
+ }
2979
+ formatRelativeTime(timestamp) {
2980
+ const now = Date.now();
2981
+ const diff = now - timestamp;
2982
+ const seconds = Math.floor(diff / 1e3);
2983
+ const minutes = Math.floor(seconds / 60);
2984
+ const hours = Math.floor(minutes / 60);
2985
+ if (hours > 0)
2986
+ return `${hours}h ${minutes % 60}m ago`;
2987
+ if (minutes > 0)
2988
+ return `${minutes}m ${seconds % 60}s ago`;
2989
+ return `${seconds}s ago`;
2990
+ }
2991
+ getTaskTypeDistribution(memory) {
2992
+ const distribution = {};
2993
+ memory.forEach((item) => {
2994
+ distribution[item.taskType] = (distribution[item.taskType] || 0) + 1;
2995
+ });
2996
+ return distribution;
2997
+ }
2998
+ calculateSuccessRate(memory) {
2999
+ if (memory.length === 0)
3000
+ return 0;
3001
+ const successCount = memory.filter((item) => item.metadata?.success !== false).length;
3002
+ return Math.round(successCount / memory.length * 100);
3003
+ }
3004
+ calculateAverageExecutionTime(memory) {
3005
+ const executionTimes = memory.map((item) => item.metadata?.executionTime).filter((time) => typeof time === "number");
3006
+ if (executionTimes.length === 0)
3007
+ return 0;
3008
+ const average = executionTimes.reduce((sum, time) => sum + time, 0) / executionTimes.length;
3009
+ return Math.round(average);
3010
+ }
3011
+ countDataExtractions(memory) {
3012
+ return memory.filter(
3013
+ (item) => item.context?.dataExtracted || item.taskType === "Insight" && item.summary.includes("Extracted")
3014
+ ).length;
3015
+ }
3016
+ extractWorkflowSteps(memory) {
3017
+ return memory.map((item) => item.summary);
3018
+ }
3019
+ getExtractedDataSummary(memory) {
3020
+ const extractedData = {};
3021
+ memory.forEach((item, index) => {
3022
+ if (item.context?.dataExtracted) {
3023
+ extractedData[`step_${index + 1}`] = item.context.dataExtracted;
3024
+ }
3025
+ });
3026
+ return extractedData;
3027
+ }
2925
3028
  };
2926
3029
 
2927
3030
  // src/puppeteer/base-page.ts