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