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/agent.js CHANGED
@@ -1968,7 +1968,7 @@ var import_js_yaml3 = __toESM(require("js-yaml"));
1968
1968
  var import_semver = __toESM(require("semver"));
1969
1969
 
1970
1970
  // package.json
1971
- var version = "1.5.7";
1971
+ var version = "1.5.8";
1972
1972
 
1973
1973
  // src/common/task-cache.ts
1974
1974
  var debug3 = (0, import_logger3.getDebug)("cache");
@@ -2885,6 +2885,109 @@ ${errors}`);
2885
2885
  clearMemory() {
2886
2886
  this.taskExecutor.clearMemory();
2887
2887
  }
2888
+ /**
2889
+ * Test sonunda kullanım için detaylı hafıza raporu döndürür (JSON formatında)
2890
+ */
2891
+ getMemoryReport() {
2892
+ const memory = this.getMemory();
2893
+ const stats = this.getMemoryStats();
2894
+ return {
2895
+ summary: {
2896
+ totalItems: memory.length,
2897
+ totalTasks: stats.analytics.totalTasks,
2898
+ memoryHits: stats.analytics.memoryHits,
2899
+ memoryMisses: stats.analytics.memoryMisses,
2900
+ memoryEffectiveness: Math.round(stats.analytics.memoryEffectiveness * 100),
2901
+ averageMemorySize: Math.round(stats.analytics.averageMemorySize * 100) / 100
2902
+ },
2903
+ config: stats.config,
2904
+ items: memory.map((item) => ({
2905
+ id: item.id,
2906
+ timestamp: item.timestamp,
2907
+ taskType: item.taskType,
2908
+ summary: item.summary,
2909
+ context: item.context,
2910
+ metadata: item.metadata,
2911
+ tags: item.tags,
2912
+ relativeTime: this.formatRelativeTime(item.timestamp)
2913
+ })),
2914
+ analytics: {
2915
+ taskTypeDistribution: this.getTaskTypeDistribution(memory),
2916
+ successRate: this.calculateSuccessRate(memory),
2917
+ averageExecutionTime: this.calculateAverageExecutionTime(memory),
2918
+ dataExtractionCount: this.countDataExtractions(memory),
2919
+ workflowSteps: this.extractWorkflowSteps(memory)
2920
+ }
2921
+ };
2922
+ }
2923
+ /**
2924
+ * Test sonunda kullanım için basit hafıza özeti döndürür (JSON formatında)
2925
+ */
2926
+ getMemorySummary() {
2927
+ const memory = this.getMemory();
2928
+ const stats = this.getMemoryStats();
2929
+ return {
2930
+ totalItems: memory.length,
2931
+ memoryEffectiveness: `${Math.round(stats.analytics.memoryEffectiveness * 100)}%`,
2932
+ taskTypes: this.getTaskTypeDistribution(memory),
2933
+ recentSteps: memory.slice(-5).map((item) => ({
2934
+ step: item.summary,
2935
+ type: item.taskType,
2936
+ success: item.metadata?.success || false,
2937
+ time: this.formatRelativeTime(item.timestamp)
2938
+ })),
2939
+ dataExtracted: this.getExtractedDataSummary(memory)
2940
+ };
2941
+ }
2942
+ formatRelativeTime(timestamp) {
2943
+ const now = Date.now();
2944
+ const diff = now - timestamp;
2945
+ const seconds = Math.floor(diff / 1e3);
2946
+ const minutes = Math.floor(seconds / 60);
2947
+ const hours = Math.floor(minutes / 60);
2948
+ if (hours > 0)
2949
+ return `${hours}h ${minutes % 60}m ago`;
2950
+ if (minutes > 0)
2951
+ return `${minutes}m ${seconds % 60}s ago`;
2952
+ return `${seconds}s ago`;
2953
+ }
2954
+ getTaskTypeDistribution(memory) {
2955
+ const distribution = {};
2956
+ memory.forEach((item) => {
2957
+ distribution[item.taskType] = (distribution[item.taskType] || 0) + 1;
2958
+ });
2959
+ return distribution;
2960
+ }
2961
+ calculateSuccessRate(memory) {
2962
+ if (memory.length === 0)
2963
+ return 0;
2964
+ const successCount = memory.filter((item) => item.metadata?.success !== false).length;
2965
+ return Math.round(successCount / memory.length * 100);
2966
+ }
2967
+ calculateAverageExecutionTime(memory) {
2968
+ const executionTimes = memory.map((item) => item.metadata?.executionTime).filter((time) => typeof time === "number");
2969
+ if (executionTimes.length === 0)
2970
+ return 0;
2971
+ const average = executionTimes.reduce((sum, time) => sum + time, 0) / executionTimes.length;
2972
+ return Math.round(average);
2973
+ }
2974
+ countDataExtractions(memory) {
2975
+ return memory.filter(
2976
+ (item) => item.context?.dataExtracted || item.taskType === "Insight" && item.summary.includes("Extracted")
2977
+ ).length;
2978
+ }
2979
+ extractWorkflowSteps(memory) {
2980
+ return memory.map((item) => item.summary);
2981
+ }
2982
+ getExtractedDataSummary(memory) {
2983
+ const extractedData = {};
2984
+ memory.forEach((item, index) => {
2985
+ if (item.context?.dataExtracted) {
2986
+ extractedData[`step_${index + 1}`] = item.context.dataExtracted;
2987
+ }
2988
+ });
2989
+ return extractedData;
2990
+ }
2888
2991
  };
2889
2992
  // Annotate the CommonJS export names for ESM import in node:
2890
2993
  0 && (module.exports = {