@xiaohhhh1/canvas-agent 0.4.32 → 0.4.33

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.
@@ -135,6 +135,7 @@ export declare class FastMossIntegration {
135
135
  private resetObservedVideoRecords;
136
136
  private observeVideoRankingResponses;
137
137
  private waitForVideoResponseTasks;
138
+ private waitForObservedVideoRecords;
138
139
  private clickVideoLearningTab;
139
140
  private clickVideoLearningNextPage;
140
141
  private waitForVideoLearningNavigation;
@@ -353,6 +353,7 @@ export class FastMossIntegration {
353
353
  await this.inspect();
354
354
  if (this.verificationRequired)
355
355
  throw new Error("采集 AI 视频榜时出现滑块验证;请手动完成后重新采集");
356
+ await this.waitForObservedVideoRecords();
356
357
  const remaining = Math.min(VIDEO_AI_TARGET_PER_DIMENSION, requestedTarget - sources.length);
357
358
  await collect(entry.dimension, remaining);
358
359
  }
@@ -566,6 +567,15 @@ export class FastMossIntegration {
566
567
  if (this.videoResponseTasks.size)
567
568
  await Promise.allSettled([...this.videoResponseTasks]);
568
569
  }
570
+ async waitForObservedVideoRecords(timeoutMs = 5_000) {
571
+ const deadline = Date.now() + timeoutMs;
572
+ while (Date.now() < deadline) {
573
+ await this.waitForVideoResponseTasks();
574
+ if (this.observedVideoRecords.length)
575
+ return;
576
+ await new Promise((resolve) => setTimeout(resolve, 200));
577
+ }
578
+ }
569
579
  async clickVideoLearningTab(labels) {
570
580
  let lastError;
571
581
  for (let attempt = 0; attempt < 3; attempt += 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaohhhh1/canvas-agent",
3
- "version": "0.4.32",
3
+ "version": "0.4.33",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",