@donggui/core 1.6.4 → 1.6.5

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.
@@ -103,6 +103,20 @@ function updateProgressiveConvergence(record, newCenter, confidence) {
103
103
  newCenter
104
104
  ];
105
105
  const convergenceRadius = Math.max(...allPoints.map((p)=>Math.sqrt((p[0] - convergedCenter[0]) ** 2 + (p[1] - convergedCenter[1]) ** 2)));
106
+ if (record.convergenceRadius > 0 && convergenceRadius > 3 * record.convergenceRadius) {
107
+ debug('progressive convergence: outlier detected, resetting', {
108
+ previousRadius: record.convergenceRadius.toFixed(1),
109
+ newRadius: convergenceRadius.toFixed(1),
110
+ newCenter,
111
+ oldCenter: record.convergedCenter
112
+ });
113
+ return {
114
+ convergedCenter: record.convergedCenter,
115
+ convergenceRadius: 0,
116
+ sampleCount: 1,
117
+ lastUpdatedAt: Date.now()
118
+ };
119
+ }
106
120
  debug('updateProgressiveConvergence', {
107
121
  newCenter,
108
122
  convergedCenter: convergedCenter.map((v)=>v.toFixed(1)),
@@ -1 +1 @@
1
- {"version":3,"file":"agent/cache-confidence.mjs","sources":["../../../src/agent/cache-confidence.ts"],"sourcesContent":["import type {\n CacheConfidenceState,\n ProgressiveLocateRecord,\n VerificationLevel,\n} from '@/types';\nimport {\n MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS,\n MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE,\n} from '@midscene/shared/env/constants';\nimport { getDebug } from '@midscene/shared/logger';\n\nconst debug = getDebug('cache-confidence');\n\nconst DEFAULT_HALF_LIFE_MS = 30 * 60 * 1000;\n\nexport function calculateConfidence(state: CacheConfidenceState): number {\n const halfLifeMs =\n Number.parseInt(\n process.env[MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS] || '',\n 10,\n ) || DEFAULT_HALF_LIFE_MS;\n\n const ageMs = Date.now() - state.lastVerifiedAt;\n const ageDecay = Math.exp((-ageMs * Math.LN2) / halfLifeMs);\n const experienceBonus = Math.min(state.verificationCount / 10, 0.3);\n const score = Math.max(0.1, ageDecay * 0.7 + experienceBonus);\n\n debug('calculateConfidence', {\n ageMs,\n ageDecay: ageDecay.toFixed(3),\n verificationCount: state.verificationCount,\n experienceBonus: experienceBonus.toFixed(3),\n score: score.toFixed(3),\n });\n\n return score;\n}\n\nexport function determineVerificationLevel(\n confidence: number,\n): VerificationLevel {\n if (confidence > 0.8) return 'minimal';\n if (confidence > 0.5) return 'standard';\n if (confidence > 0.2) return 'enhanced';\n return 'full';\n}\n\nexport function getVerificationActions(level: VerificationLevel): {\n coordCheck: boolean;\n visualVerify: boolean;\n semanticAnchor: boolean;\n skipCache: boolean;\n} {\n switch (level) {\n case 'minimal':\n return {\n coordCheck: true,\n visualVerify: false,\n semanticAnchor: false,\n skipCache: false,\n };\n case 'standard':\n return {\n coordCheck: true,\n visualVerify: true,\n semanticAnchor: false,\n skipCache: false,\n };\n case 'enhanced':\n return {\n coordCheck: true,\n visualVerify: true,\n semanticAnchor: true,\n skipCache: false,\n };\n case 'full':\n return {\n coordCheck: false,\n visualVerify: false,\n semanticAnchor: false,\n skipCache: true,\n };\n }\n}\n\nexport function createInitialConfidenceState(): CacheConfidenceState {\n return {\n lastVerifiedAt: Date.now(),\n verificationCount: 1,\n confidenceScore: 1.0,\n };\n}\n\nexport function updateConfidenceOnVerify(\n state: CacheConfidenceState,\n passed: boolean,\n): CacheConfidenceState {\n return {\n lastVerifiedAt: passed ? Date.now() : state.lastVerifiedAt,\n verificationCount: passed\n ? state.verificationCount + 1\n : state.verificationCount,\n confidenceScore: passed\n ? calculateConfidence({\n ...state,\n lastVerifiedAt: Date.now(),\n verificationCount: state.verificationCount + 1,\n })\n : Math.max(0.1, state.confidenceScore * 0.5),\n };\n}\n\nexport function createInitialProgressiveRecord(\n center: [number, number],\n): ProgressiveLocateRecord {\n return {\n convergedCenter: center,\n convergenceRadius: 0,\n sampleCount: 1,\n lastUpdatedAt: Date.now(),\n };\n}\n\nexport function updateProgressiveConvergence(\n record: ProgressiveLocateRecord,\n newCenter: [number, number],\n confidence: number,\n): ProgressiveLocateRecord {\n const enableProgressive =\n process.env[MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE] !== 'false';\n if (!enableProgressive) {\n return {\n convergedCenter: newCenter,\n convergenceRadius: 0,\n sampleCount: record.sampleCount + 1,\n lastUpdatedAt: Date.now(),\n };\n }\n\n const weight = Math.max(0.1, confidence);\n const totalWeight = record.sampleCount + weight;\n\n const convergedCenter: [number, number] = [\n (record.convergedCenter[0] * record.sampleCount + newCenter[0] * weight) /\n totalWeight,\n (record.convergedCenter[1] * record.sampleCount + newCenter[1] * weight) /\n totalWeight,\n ];\n\n const allPoints = [\n [record.convergedCenter[0], record.convergedCenter[1]],\n newCenter,\n ];\n const convergenceRadius = Math.max(\n ...allPoints.map((p) =>\n Math.sqrt(\n (p[0] - convergedCenter[0]) ** 2 + (p[1] - convergedCenter[1]) ** 2,\n ),\n ),\n );\n\n debug('updateProgressiveConvergence', {\n newCenter,\n convergedCenter: convergedCenter.map((v) => v.toFixed(1)),\n convergenceRadius: convergenceRadius.toFixed(1),\n sampleCount: record.sampleCount + 1,\n });\n\n return {\n convergedCenter,\n convergenceRadius,\n sampleCount: record.sampleCount + 1,\n lastUpdatedAt: Date.now(),\n };\n}\n"],"names":["debug","getDebug","DEFAULT_HALF_LIFE_MS","calculateConfidence","state","halfLifeMs","Number","process","MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS","ageMs","Date","ageDecay","Math","experienceBonus","score","determineVerificationLevel","confidence","getVerificationActions","level","createInitialConfidenceState","updateConfidenceOnVerify","passed","createInitialProgressiveRecord","center","updateProgressiveConvergence","record","newCenter","enableProgressive","MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE","weight","totalWeight","convergedCenter","allPoints","convergenceRadius","p","v"],"mappings":";;AAWA,MAAMA,QAAQC,SAAS;AAEvB,MAAMC,uBAAuB;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EAAC,KAAM,IAAKG,AAAAA,CAAAA,CAAC,CAAC,EAAE,GAAGH,eAAe,CAAC,EAAC,KAAM;IAKxE/B,MAAM,gCAAgC;QACpC0B;QACA,iBAAiBK,gBAAgB,GAAG,CAAC,CAACI,IAAMA,EAAE,OAAO,CAAC;QACtD,mBAAmBF,kBAAkB,OAAO,CAAC;QAC7C,aAAaR,OAAO,WAAW,GAAG;IACpC;IAEA,OAAO;QACLM;QACAE;QACA,aAAaR,OAAO,WAAW,GAAG;QAClC,eAAef,KAAK,GAAG;IACzB;AACF"}
1
+ {"version":3,"file":"agent/cache-confidence.mjs","sources":["../../../src/agent/cache-confidence.ts"],"sourcesContent":["import type {\n CacheConfidenceState,\n ProgressiveLocateRecord,\n VerificationLevel,\n} from '@/types';\nimport {\n MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS,\n MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE,\n} from '@midscene/shared/env/constants';\nimport { getDebug } from '@midscene/shared/logger';\n\nconst debug = getDebug('cache-confidence');\n\nconst DEFAULT_HALF_LIFE_MS = 30 * 60 * 1000;\n\nexport function calculateConfidence(state: CacheConfidenceState): number {\n const halfLifeMs =\n Number.parseInt(\n process.env[MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS] || '',\n 10,\n ) || DEFAULT_HALF_LIFE_MS;\n\n const ageMs = Date.now() - state.lastVerifiedAt;\n const ageDecay = Math.exp((-ageMs * Math.LN2) / halfLifeMs);\n const experienceBonus = Math.min(state.verificationCount / 10, 0.3);\n const score = Math.max(0.1, ageDecay * 0.7 + experienceBonus);\n\n debug('calculateConfidence', {\n ageMs,\n ageDecay: ageDecay.toFixed(3),\n verificationCount: state.verificationCount,\n experienceBonus: experienceBonus.toFixed(3),\n score: score.toFixed(3),\n });\n\n return score;\n}\n\nexport function determineVerificationLevel(\n confidence: number,\n): VerificationLevel {\n if (confidence > 0.8) return 'minimal';\n if (confidence > 0.5) return 'standard';\n if (confidence > 0.2) return 'enhanced';\n return 'full';\n}\n\nexport function getVerificationActions(level: VerificationLevel): {\n coordCheck: boolean;\n visualVerify: boolean;\n semanticAnchor: boolean;\n skipCache: boolean;\n} {\n switch (level) {\n case 'minimal':\n return {\n coordCheck: true,\n visualVerify: false,\n semanticAnchor: false,\n skipCache: false,\n };\n case 'standard':\n return {\n coordCheck: true,\n visualVerify: true,\n semanticAnchor: false,\n skipCache: false,\n };\n case 'enhanced':\n return {\n coordCheck: true,\n visualVerify: true,\n semanticAnchor: true,\n skipCache: false,\n };\n case 'full':\n return {\n coordCheck: false,\n visualVerify: false,\n semanticAnchor: false,\n skipCache: true,\n };\n }\n}\n\nexport function createInitialConfidenceState(): CacheConfidenceState {\n return {\n lastVerifiedAt: Date.now(),\n verificationCount: 1,\n confidenceScore: 1.0,\n };\n}\n\nexport function updateConfidenceOnVerify(\n state: CacheConfidenceState,\n passed: boolean,\n): CacheConfidenceState {\n return {\n lastVerifiedAt: passed ? Date.now() : state.lastVerifiedAt,\n verificationCount: passed\n ? state.verificationCount + 1\n : state.verificationCount,\n confidenceScore: passed\n ? calculateConfidence({\n ...state,\n lastVerifiedAt: Date.now(),\n verificationCount: state.verificationCount + 1,\n })\n : Math.max(0.1, state.confidenceScore * 0.5),\n };\n}\n\nexport function createInitialProgressiveRecord(\n center: [number, number],\n): ProgressiveLocateRecord {\n return {\n convergedCenter: center,\n convergenceRadius: 0,\n sampleCount: 1,\n lastUpdatedAt: Date.now(),\n };\n}\n\nexport function updateProgressiveConvergence(\n record: ProgressiveLocateRecord,\n newCenter: [number, number],\n confidence: number,\n): ProgressiveLocateRecord {\n const enableProgressive =\n process.env[MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE] !== 'false';\n if (!enableProgressive) {\n return {\n convergedCenter: newCenter,\n convergenceRadius: 0,\n sampleCount: record.sampleCount + 1,\n lastUpdatedAt: Date.now(),\n };\n }\n\n const weight = Math.max(0.1, confidence);\n const totalWeight = record.sampleCount + weight;\n\n const convergedCenter: [number, number] = [\n (record.convergedCenter[0] * record.sampleCount + newCenter[0] * weight) /\n totalWeight,\n (record.convergedCenter[1] * record.sampleCount + newCenter[1] * weight) /\n totalWeight,\n ];\n\n const allPoints = [\n [record.convergedCenter[0], record.convergedCenter[1]],\n newCenter,\n ];\n const convergenceRadius = Math.max(\n ...allPoints.map((p) =>\n Math.sqrt(\n (p[0] - convergedCenter[0]) ** 2 + (p[1] - convergedCenter[1]) ** 2,\n ),\n ),\n );\n\n // If radius suddenly spikes (outlier detected), reset convergence\n // to prevent the outlier from contaminating future calculations.\n // Keep the old convergedCenter as anchor since it represents\n // the historical consensus before the outlier.\n if (\n record.convergenceRadius > 0 &&\n convergenceRadius > record.convergenceRadius * 3\n ) {\n debug('progressive convergence: outlier detected, resetting', {\n previousRadius: record.convergenceRadius.toFixed(1),\n newRadius: convergenceRadius.toFixed(1),\n newCenter,\n oldCenter: record.convergedCenter,\n });\n return {\n convergedCenter: record.convergedCenter,\n convergenceRadius: 0,\n sampleCount: 1,\n lastUpdatedAt: Date.now(),\n };\n }\n\n debug('updateProgressiveConvergence', {\n newCenter,\n convergedCenter: convergedCenter.map((v) => v.toFixed(1)),\n convergenceRadius: convergenceRadius.toFixed(1),\n sampleCount: record.sampleCount + 1,\n });\n\n return {\n convergedCenter,\n convergenceRadius,\n sampleCount: record.sampleCount + 1,\n lastUpdatedAt: Date.now(),\n };\n}\n"],"names":["debug","getDebug","DEFAULT_HALF_LIFE_MS","calculateConfidence","state","halfLifeMs","Number","process","MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS","ageMs","Date","ageDecay","Math","experienceBonus","score","determineVerificationLevel","confidence","getVerificationActions","level","createInitialConfidenceState","updateConfidenceOnVerify","passed","createInitialProgressiveRecord","center","updateProgressiveConvergence","record","newCenter","enableProgressive","MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE","weight","totalWeight","convergedCenter","allPoints","convergenceRadius","p","v"],"mappings":";;AAWA,MAAMA,QA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C,CAAC,EAAE,GAAGH,eAAe,CAAC,EAAC,KAAM,IAAKG,AAAAA,CAAAA,CAAC,CAAC,EAAE,GAAGH,eAAe,CAAC,EAAC,KAAM;IASxE,IACEN,OAAO,iBAAiB,GAAG,KAC3BQ,oBAAoBR,AAA2B,IAA3BA,OAAO,iBAAiB,EAC5C;QACAzB,MAAM,wDAAwD;YAC5D,gBAAgByB,OAAO,iBAAiB,CAAC,OAAO,CAAC;YACjD,WAAWQ,kBAAkB,OAAO,CAAC;YACrCP;YACA,WAAWD,OAAO,eAAe;QACnC;QACA,OAAO;YACL,iBAAiBA,OAAO,eAAe;YACvC,mBAAmB;YACnB,aAAa;YACb,eAAef,KAAK,GAAG;QACzB;IACF;IAEAV,MAAM,gCAAgC;QACpC0B;QACA,iBAAiBK,gBAAgB,GAAG,CAAC,CAACI,IAAMA,EAAE,OAAO,CAAC;QACtD,mBAAmBF,kBAAkB,OAAO,CAAC;QAC7C,aAAaR,OAAO,WAAW,GAAG;IACpC;IAEA,OAAO;QACLM;QACAE;QACA,aAAaR,OAAO,WAAW,GAAG;QAClC,eAAef,KAAK,GAAG;IACzB;AACF"}
@@ -152,7 +152,7 @@ async function matchElementFromCache(context, cacheEntry, cachePrompt, cacheable
152
152
  return;
153
153
  }
154
154
  }
155
- const getMidsceneVersion = ()=>"1.6.4";
155
+ const getMidsceneVersion = ()=>"1.6.5";
156
156
  const parsePrompt = (prompt)=>{
157
157
  if ('string' == typeof prompt) return {
158
158
  textPrompt: prompt,
package/dist/es/utils.mjs CHANGED
@@ -159,7 +159,7 @@ function stringifyDumpData(data, indents) {
159
159
  return JSON.stringify(data, replacerForPageObject, indents);
160
160
  }
161
161
  function getVersion() {
162
- return "1.6.4";
162
+ return "1.6.5";
163
163
  }
164
164
  function debugLog(...message) {
165
165
  const debugMode = process.env[MIDSCENE_DEBUG_MODE];
@@ -137,6 +137,20 @@ function updateProgressiveConvergence(record, newCenter, confidence) {
137
137
  newCenter
138
138
  ];
139
139
  const convergenceRadius = Math.max(...allPoints.map((p)=>Math.sqrt((p[0] - convergedCenter[0]) ** 2 + (p[1] - convergedCenter[1]) ** 2)));
140
+ if (record.convergenceRadius > 0 && convergenceRadius > 3 * record.convergenceRadius) {
141
+ debug('progressive convergence: outlier detected, resetting', {
142
+ previousRadius: record.convergenceRadius.toFixed(1),
143
+ newRadius: convergenceRadius.toFixed(1),
144
+ newCenter,
145
+ oldCenter: record.convergedCenter
146
+ });
147
+ return {
148
+ convergedCenter: record.convergedCenter,
149
+ convergenceRadius: 0,
150
+ sampleCount: 1,
151
+ lastUpdatedAt: Date.now()
152
+ };
153
+ }
140
154
  debug('updateProgressiveConvergence', {
141
155
  newCenter,
142
156
  convergedCenter: convergedCenter.map((v)=>v.toFixed(1)),
@@ -1 +1 @@
1
- {"version":3,"file":"agent/cache-confidence.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/agent/cache-confidence.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n CacheConfidenceState,\n ProgressiveLocateRecord,\n VerificationLevel,\n} from '@/types';\nimport {\n MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS,\n MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE,\n} from '@midscene/shared/env/constants';\nimport { getDebug } from '@midscene/shared/logger';\n\nconst debug = getDebug('cache-confidence');\n\nconst DEFAULT_HALF_LIFE_MS = 30 * 60 * 1000;\n\nexport function calculateConfidence(state: CacheConfidenceState): number {\n const halfLifeMs =\n Number.parseInt(\n process.env[MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS] || '',\n 10,\n ) || DEFAULT_HALF_LIFE_MS;\n\n const ageMs = Date.now() - state.lastVerifiedAt;\n const ageDecay = Math.exp((-ageMs * Math.LN2) / halfLifeMs);\n const experienceBonus = Math.min(state.verificationCount / 10, 0.3);\n const score = Math.max(0.1, ageDecay * 0.7 + experienceBonus);\n\n debug('calculateConfidence', {\n ageMs,\n ageDecay: ageDecay.toFixed(3),\n verificationCount: state.verificationCount,\n experienceBonus: experienceBonus.toFixed(3),\n score: score.toFixed(3),\n });\n\n return score;\n}\n\nexport function determineVerificationLevel(\n confidence: number,\n): VerificationLevel {\n if (confidence > 0.8) return 'minimal';\n if (confidence > 0.5) return 'standard';\n if (confidence > 0.2) return 'enhanced';\n return 'full';\n}\n\nexport function getVerificationActions(level: VerificationLevel): {\n coordCheck: boolean;\n visualVerify: boolean;\n semanticAnchor: boolean;\n skipCache: boolean;\n} {\n switch (level) {\n case 'minimal':\n return {\n coordCheck: true,\n visualVerify: false,\n semanticAnchor: false,\n skipCache: false,\n };\n case 'standard':\n return {\n coordCheck: true,\n visualVerify: true,\n semanticAnchor: false,\n skipCache: false,\n };\n case 'enhanced':\n return {\n coordCheck: true,\n visualVerify: true,\n semanticAnchor: true,\n skipCache: false,\n };\n case 'full':\n return {\n coordCheck: false,\n visualVerify: false,\n semanticAnchor: false,\n skipCache: true,\n };\n }\n}\n\nexport function createInitialConfidenceState(): CacheConfidenceState {\n return {\n lastVerifiedAt: Date.now(),\n verificationCount: 1,\n confidenceScore: 1.0,\n };\n}\n\nexport function updateConfidenceOnVerify(\n state: CacheConfidenceState,\n passed: boolean,\n): CacheConfidenceState {\n return {\n lastVerifiedAt: passed ? Date.now() : state.lastVerifiedAt,\n verificationCount: passed\n ? state.verificationCount + 1\n : state.verificationCount,\n confidenceScore: passed\n ? calculateConfidence({\n ...state,\n lastVerifiedAt: Date.now(),\n verificationCount: state.verificationCount + 1,\n })\n : Math.max(0.1, state.confidenceScore * 0.5),\n };\n}\n\nexport function createInitialProgressiveRecord(\n center: [number, number],\n): ProgressiveLocateRecord {\n return {\n convergedCenter: center,\n convergenceRadius: 0,\n sampleCount: 1,\n lastUpdatedAt: Date.now(),\n };\n}\n\nexport function updateProgressiveConvergence(\n record: ProgressiveLocateRecord,\n newCenter: [number, number],\n confidence: number,\n): ProgressiveLocateRecord {\n const enableProgressive =\n process.env[MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE] !== 'false';\n if (!enableProgressive) {\n return {\n convergedCenter: newCenter,\n convergenceRadius: 0,\n sampleCount: record.sampleCount + 1,\n lastUpdatedAt: Date.now(),\n };\n }\n\n const weight = Math.max(0.1, confidence);\n const totalWeight = record.sampleCount + weight;\n\n const convergedCenter: [number, number] = [\n (record.convergedCenter[0] * record.sampleCount + newCenter[0] * weight) /\n totalWeight,\n (record.convergedCenter[1] * record.sampleCount + newCenter[1] * weight) /\n totalWeight,\n ];\n\n const allPoints = [\n [record.convergedCenter[0], record.convergedCenter[1]],\n newCenter,\n ];\n const convergenceRadius = Math.max(\n ...allPoints.map((p) =>\n Math.sqrt(\n (p[0] - convergedCenter[0]) ** 2 + (p[1] - convergedCenter[1]) ** 2,\n ),\n ),\n );\n\n debug('updateProgressiveConvergence', {\n newCenter,\n convergedCenter: convergedCenter.map((v) => v.toFixed(1)),\n convergenceRadius: convergenceRadius.toFixed(1),\n sampleCount: record.sampleCount + 1,\n });\n\n return {\n convergedCenter,\n convergenceRadius,\n sampleCount: record.sampleCount + 1,\n lastUpdatedAt: Date.now(),\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","debug","getDebug","DEFAULT_HALF_LIFE_MS","calculateConfidence","state","halfLifeMs","Number","process","MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS","ageMs","Date","ageDecay","Math","experienceBonus","score","determineVerificationLevel","confidence","getVerificationActions","level","createInitialConfidenceState","updateConfidenceOnVerify","passed","createInitialProgressiveRecord","center","updateProgressiveConvergence","record","newCenter","enableProgressive","MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE","weight","totalWeight","convergedCenter","allPoints","convergenceRadius","p","v"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;ACKA,MAAMI,QAAQC,AAAAA,IAAAA,uBAAAA,QAAAA,AAAAA,EAAS;AAEvB,MAAMC,uBAAuB;AAEtB,SAASC,oBAAoBC,KAA2B;IAC7D,MAAMC,aACJC,OAAO,QAAQ,CACbC,QAAQ,GAAG,CAACC,0BAAAA,sCAAsCA,CAAC,IAAI,IACvD,OACGN;IAEP,MAAMO,QAAQC,KAAK,GAAG,KAAKN,MAAM,cAAc;IAC/C,MAAMO,WAAWC,KAAK,GAAG,CAAE,CAACH,QAAQG,KAAK,GAAG,GAAIP;IAChD,MAAMQ,kBAAkBD,KAAK,GAAG,CAACR,MAAM,iBAAiB,GAAG,IAAI;IAC/D,MAAMU,QAAQF,KAAK,GAAG,CAAC,KAAKD,AA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ACF"}
1
+ {"version":3,"file":"agent/cache-confidence.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/agent/cache-confidence.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n CacheConfidenceState,\n ProgressiveLocateRecord,\n VerificationLevel,\n} from '@/types';\nimport {\n MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS,\n MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE,\n} from '@midscene/shared/env/constants';\nimport { getDebug } from '@midscene/shared/logger';\n\nconst debug = getDebug('cache-confidence');\n\nconst DEFAULT_HALF_LIFE_MS = 30 * 60 * 1000;\n\nexport function calculateConfidence(state: CacheConfidenceState): number {\n const halfLifeMs =\n Number.parseInt(\n process.env[MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS] || '',\n 10,\n ) || DEFAULT_HALF_LIFE_MS;\n\n const ageMs = Date.now() - state.lastVerifiedAt;\n const ageDecay = Math.exp((-ageMs * Math.LN2) / halfLifeMs);\n const experienceBonus = Math.min(state.verificationCount / 10, 0.3);\n const score = Math.max(0.1, ageDecay * 0.7 + experienceBonus);\n\n debug('calculateConfidence', {\n ageMs,\n ageDecay: ageDecay.toFixed(3),\n verificationCount: state.verificationCount,\n experienceBonus: experienceBonus.toFixed(3),\n score: score.toFixed(3),\n });\n\n return score;\n}\n\nexport function determineVerificationLevel(\n confidence: number,\n): VerificationLevel {\n if (confidence > 0.8) return 'minimal';\n if (confidence > 0.5) return 'standard';\n if (confidence > 0.2) return 'enhanced';\n return 'full';\n}\n\nexport function getVerificationActions(level: VerificationLevel): {\n coordCheck: boolean;\n visualVerify: boolean;\n semanticAnchor: boolean;\n skipCache: boolean;\n} {\n switch (level) {\n case 'minimal':\n return {\n coordCheck: true,\n visualVerify: false,\n semanticAnchor: false,\n skipCache: false,\n };\n case 'standard':\n return {\n coordCheck: true,\n visualVerify: true,\n semanticAnchor: false,\n skipCache: false,\n };\n case 'enhanced':\n return {\n coordCheck: true,\n visualVerify: true,\n semanticAnchor: true,\n skipCache: false,\n };\n case 'full':\n return {\n coordCheck: false,\n visualVerify: false,\n semanticAnchor: false,\n skipCache: true,\n };\n }\n}\n\nexport function createInitialConfidenceState(): CacheConfidenceState {\n return {\n lastVerifiedAt: Date.now(),\n verificationCount: 1,\n confidenceScore: 1.0,\n };\n}\n\nexport function updateConfidenceOnVerify(\n state: CacheConfidenceState,\n passed: boolean,\n): CacheConfidenceState {\n return {\n lastVerifiedAt: passed ? Date.now() : state.lastVerifiedAt,\n verificationCount: passed\n ? state.verificationCount + 1\n : state.verificationCount,\n confidenceScore: passed\n ? calculateConfidence({\n ...state,\n lastVerifiedAt: Date.now(),\n verificationCount: state.verificationCount + 1,\n })\n : Math.max(0.1, state.confidenceScore * 0.5),\n };\n}\n\nexport function createInitialProgressiveRecord(\n center: [number, number],\n): ProgressiveLocateRecord {\n return {\n convergedCenter: center,\n convergenceRadius: 0,\n sampleCount: 1,\n lastUpdatedAt: Date.now(),\n };\n}\n\nexport function updateProgressiveConvergence(\n record: ProgressiveLocateRecord,\n newCenter: [number, number],\n confidence: number,\n): ProgressiveLocateRecord {\n const enableProgressive =\n process.env[MIDSCENE_CACHE_ENABLE_PROGRESSIVE_CONVERGENCE] !== 'false';\n if (!enableProgressive) {\n return {\n convergedCenter: newCenter,\n convergenceRadius: 0,\n sampleCount: record.sampleCount + 1,\n lastUpdatedAt: Date.now(),\n };\n }\n\n const weight = Math.max(0.1, confidence);\n const totalWeight = record.sampleCount + weight;\n\n const convergedCenter: [number, number] = [\n (record.convergedCenter[0] * record.sampleCount + newCenter[0] * weight) /\n totalWeight,\n (record.convergedCenter[1] * record.sampleCount + newCenter[1] * weight) /\n totalWeight,\n ];\n\n const allPoints = [\n [record.convergedCenter[0], record.convergedCenter[1]],\n newCenter,\n ];\n const convergenceRadius = Math.max(\n ...allPoints.map((p) =>\n Math.sqrt(\n (p[0] - convergedCenter[0]) ** 2 + (p[1] - convergedCenter[1]) ** 2,\n ),\n ),\n );\n\n // If radius suddenly spikes (outlier detected), reset convergence\n // to prevent the outlier from contaminating future calculations.\n // Keep the old convergedCenter as anchor since it represents\n // the historical consensus before the outlier.\n if (\n record.convergenceRadius > 0 &&\n convergenceRadius > record.convergenceRadius * 3\n ) {\n debug('progressive convergence: outlier detected, resetting', {\n previousRadius: record.convergenceRadius.toFixed(1),\n newRadius: convergenceRadius.toFixed(1),\n newCenter,\n oldCenter: record.convergedCenter,\n });\n return {\n convergedCenter: record.convergedCenter,\n convergenceRadius: 0,\n sampleCount: 1,\n lastUpdatedAt: Date.now(),\n };\n }\n\n debug('updateProgressiveConvergence', {\n newCenter,\n convergedCenter: convergedCenter.map((v) => v.toFixed(1)),\n convergenceRadius: convergenceRadius.toFixed(1),\n sampleCount: record.sampleCount + 1,\n });\n\n return {\n convergedCenter,\n convergenceRadius,\n sampleCount: record.sampleCount + 1,\n lastUpdatedAt: Date.now(),\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","debug","getDebug","DEFAULT_HALF_LIFE_MS","calculateConfidence","state","halfLifeMs","Number","process","MIDSCENE_CACHE_CONFIDENCE_HALF_LIFE_MS","ageMs","Date","ageDecay","Math","experienceBonus","score","determineVerificationLevel","confidence","getVerificationActions","level","createInitialConfidenceState","updateConfidenceOnVerify","passed","createInitialProgressiveRecord","center","updateProgressiveConvergence","record","newCenter","enableProgressive","MIDSCENE_CACHE_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gBAAgB,GAAG,CAAC,CAACI,IAAMA,EAAE,OAAO,CAAC;QACtD,mBAAmBF,kBAAkB,OAAO,CAAC;QAC7C,aAAaR,OAAO,WAAW,GAAG;IACpC;IAEA,OAAO;QACLM;QACAE;QACA,aAAaR,OAAO,WAAW,GAAG;QAClC,eAAef,KAAK,GAAG;IACzB;AACF"}
@@ -201,7 +201,7 @@ async function matchElementFromCache(context, cacheEntry, cachePrompt, cacheable
201
201
  return;
202
202
  }
203
203
  }
204
- const getMidsceneVersion = ()=>"1.6.4";
204
+ const getMidsceneVersion = ()=>"1.6.5";
205
205
  const parsePrompt = (prompt)=>{
206
206
  if ('string' == typeof prompt) return {
207
207
  textPrompt: prompt,
package/dist/lib/utils.js CHANGED
@@ -202,7 +202,7 @@ function stringifyDumpData(data, indents) {
202
202
  return JSON.stringify(data, replacerForPageObject, indents);
203
203
  }
204
204
  function getVersion() {
205
- return "1.6.4";
205
+ return "1.6.5";
206
206
  }
207
207
  function debugLog(...message) {
208
208
  const debugMode = process.env[env_namespaceObject.MIDSCENE_DEBUG_MODE];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@donggui/core",
3
3
  "description": "DongGUI Core - AI-powered automation SDK with enhanced assertion capabilities",
4
- "version": "1.6.4",
4
+ "version": "1.6.5",
5
5
  "repository": "https://github.com/web-infra-dev/midscene",
6
6
  "homepage": "https://midscenejs.com/",
7
7
  "main": "./dist/lib/index.js",