@xiaohhhh1/canvas-agent 0.4.66 → 0.4.67

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.
@@ -171,11 +171,22 @@ export function localVideoAnalysisPrompt(source, durationMs, transcript, attachm
171
171
  }
172
172
  export function assertJointVisualAndSpokenEvidence(analysis) {
173
173
  const segments = Array.isArray(analysis.segments) ? analysis.segments : [];
174
- if (segments.length < 2)
175
- throw new Error("本机 Codex 返回的镜头时间轴不足 2 段,未计为已理解");
176
- if (segments.some((segment) => !String(segment.visual || "").trim())) {
177
- throw new Error("视频分析存在缺少画面证据的镜头段,未计为已理解");
178
- }
174
+ const evidencedSegments = segments.filter((segment) => String(segment.visual || "").trim());
175
+ if (evidencedSegments.length < 2)
176
+ throw new Error("本机 Codex 返回的有效画面时间轴不足 2 段,未计为已理解");
177
+ if (evidencedSegments.length === segments.length)
178
+ return;
179
+ // Never invent a visual description for a speech-only/null segment. Keep the
180
+ // independently evidenced beats and record the omission so the server can
181
+ // build an auditable template without throwing away the whole Omni result.
182
+ analysis.segments = evidencedSegments;
183
+ const warnings = Array.isArray(analysis.analysisWarnings)
184
+ ? analysis.analysisWarnings.filter((item) => typeof item === "string")
185
+ : [];
186
+ analysis.analysisWarnings = [
187
+ ...warnings,
188
+ `已忽略 ${segments.length - evidencedSegments.length} 个缺少独立画面描述的时间段;未臆造画面事实`,
189
+ ];
179
190
  }
180
191
  export function timedTranscriptFromVtt(value) {
181
192
  const rows = String(value || "").replace(/^\uFEFF/, "").split(/\r?\n/);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaohhhh1/canvas-agent",
3
- "version": "0.4.66",
3
+ "version": "0.4.67",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",