34 Commits

Author SHA1 Message Date
Accusys a57e0bb433 fix: scan.rs stats API 使用 per-library 路徑 — 修復 Scene VLM 數量不顯示
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- get_file_stats_inner: output_dir 改 per-library(scene_vlm/face_cluster/vlm_summary stats)
- get_pipeline_progress_handler: output_dir 改 per-library
- get_ingestion_status: scene_meta_path 改 per-library
- get_scene_vlm_stats: output_dir 改 per-library
- 驗證: test library scene-vlm-stats 回傳 18 scenes, 18/18 done
2026-11-19 15:43:17 +08:00
Accusys 02ef25d4e7 fix: face/trace 縮圖 API 使用 per-library 路徑
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- face_thumbnail: .faces cache + trace_{id}/key_face.jpg 改 per-library + global fallback
- trace_thumbnail: key_face.jpg 改 per-library + global fallback
- 驗證: test library face 縮圖 HTTP 200 (422x422 JPEG), demo 也正常
2026-11-19 15:30:25 +08:00
Accusys f5363ca862 fix: Scene VLM 全流程 per-library 路徑
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- job_worker: cut.json 檢查 + output_dir + scenes_path 改用 get_output_dir_for_file
- media_api: scene_thumbnail 改用 per-library + global fallback
- 確保 test library 的 scenes.json 與 scene jpg 寫到 output/test/
- 已搬移舊 scene jpg 從 demo 到 test
2026-11-19 15:06:10 +08:00
Accusys 0be345eb24 fix: Unregister sync mode 清除 per-library output — rust_unregister 只刪全域 OUTPUT_DIR
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- UI Unregister 走 sync mode → rust_unregister binary
- rust_unregister 只用 config::OUTPUT_DIR(demo),不考慮 library → test output 殘留
- 修復: rust_unregister 成功後補呼叫 delete_output_files (掃描全域+per-lib+所有 upload_paths)
- 驗證: test 目錄 8 個 output 檔案全清除
2026-11-19 14:37:01 +08:00
Accusys e0d09ed7b3 fix: swift_ocr 使用已廢棄的 -vsync vfr(ffmpeg 9 移除)
Cross-Project Integration / integration (push) Has been cancelled
- ffmpeg 9 移除 -vsync 選項 → swift_ocr frame extraction 完全失敗(0 幀)
- 改為 -fps_mode vfr(ffmpeg 9 新語法)
- 重新編譯 swift_ocr binary 並部署
- 結果: OCR 從 0 幀 → 494 幀有文字
2026-11-19 14:06:33 +08:00
Accusys 2df98eb31c fix: output-completeness 檢查改用 per-library 路徑 — 修復 test library 誤報缺項
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- 原本用全域 OUTPUT_DIR(demo) 檢查所有影片
- test 檔案的 json 在 output/test → 誤報 6 項 missing
- 改用 get_output_dir_for_file(uuid) + global fallback
2026-11-19 13:51:32 +08:00
Accusys a4e176c682 fix: download_json 使用 per-library 路徑 — 修復 test library 卡片 detail 查看 json 失敗
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- proxy /api/v1/processor-json 實際呼叫 POST /api/v1/file/:uuid/json/:processor (download_json)
- download_json 原本用全域 OUTPUT_DIR(demo),test 檔案在 output/test → 404
- 改用 get_output_dir_for_file + global fallback
- face_trace → face_traced.json 映射
2026-11-19 13:46:06 +08:00
Accusys c4fbbfda4a fix: pipeline log 寫入 output root + processor-counts/json 使用 per-library 路徑
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- write_pipeline_timeline: log 寫到 ~/momentry/output (parent of per-lib dir)
- get_processor_counts: 用 get_output_dir_for_file + global fallback
- get_processor_json: 加 State, per-library 優先 + global fallback
- delete_output_files_for_uuid: 同時掃 output root 清 pipeline log
2026-11-19 13:35:24 +08:00
Accusys 36f4dcf807 fix: unregister 刪除 output 時使用 per-library 路徑(videos 刪除前解析)
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- 根因: get_output_dir_for_file JOIN videos,但 unregister 先刪 videos 再刪 output
  → 解析失敗回退全域 OUTPUT_DIR(demo),沒刪到 test 目錄舊檔
  → re-scan 時 AUTO-REPAIR 看到舊 asrx.json 就標 completed(無 status/chunks)→ 卡住
- 修復: 在 unregister_internal 開頭(videos 還在時)解析 output_dir
- delete_output_files 掃描 全域 + pre-resolved per-library + 所有 upload_paths
- 同步修復 unregister_api.rs
- 結果: re-scan 真正清掉舊檔 → ASRX 重跑 → has_transcript + 28 chunks ✓
2026-11-19 13:23:10 +08:00
Accusys 3d56151787 fix: ASRX legacy 檔無 status 時推導 has_transcript + 補 segment_count
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- AUTO-REPAIR: asrx.json 無 status 但有 segments → 推導 has_transcript 並回寫
- 修正 has_transcript 被誤映射為 SilentAudio 的 bug
- segment_count 正確帶入
2026-11-19 12:54:26 +08:00
Accusys 3a6f9b0044 feat: Queue 管理 API — list/cancel/priority/clear + job_status 回傳
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- GET /api/v1/jobs/queue — 列出所有 job + processor 狀態 + summary
- POST /api/v1/jobs/:uuid/cancel — 取消單一 job
- POST /api/v1/jobs/:uuid/priority — 調整優先順序
- POST /api/v1/jobs/queue/clear — 批次清除 pending/paused/all jobs
- files API 回傳 job_status
- 修正 queue API panic (型別錯誤)
2026-11-19 10:53:47 +08:00
Accusys 8ab7bbaea7 fix: _debug output_dir 改為從實際路徑推導 + executor 使用 per-library output dir
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- json_standardize.rs: create_debug() 從檔案路徑推導 output_dir
- executor.rs: resolve_output_dir() 優先使用 env var 或從 output_path 推導
- 修復 output_dir 永遠顯示 output/demo 的問題
2026-11-19 02:12:38 +08:00
Accusys 9a7528d49b fix: worker 自動補遺漏的 monitor_jobs(repair 機制)
Cross-Project Integration / integration (push) Has been cancelled
Core Test / lint-and-test (push) Has been cancelled
- Sync mode register 不會建立 monitor_jobs
- Worker poll 迴圈自動為 pending videos 建立 monitor_jobs
- 修正 file_type 判斷(video/mp4/mov/avi/mkv)
2026-11-19 01:44:10 +08:00
Accusys b583946f7e fix: per-library output path for face_trace spawn check + completeness check
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- face_trace spawn 改用 get_output_dir_for_file 檢查 face_traced.json
- completeness check 改用 per-library dir + global fallback
- rust_store_traced_faces output_dir 改用 get_output_dir_for_file
2026-11-18 16:08:33 +08:00
Accusys 8101ff0cb4 fix: face processor 讀取 .with_embedding 檔案當 copy 失敗時(確保 facenet embeddings 不會遺失)
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-18 01:05:38 +08:00
Accusys 18aa0130a7 fix: 檔案列表 name matching fallback — path 不匹配時改用 name 比對(處理 symlink 路徑差異)
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 23:38:01 +08:00
Accusys 1d3c86c56c fix: upload_paths output_path 自動設定 + settings save 不覆蓋既有 full_path
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- 新增 upload_path 時自動設定 output_path = /Users/accusys/momentry/output/{name}
- ON CONFLICT 只設 enabled=true,不再覆蓋 full_path
2026-11-17 22:11:54 +08:00
Accusys 2a8bd88a3e fix: appearance API per-library output path(與 trace_profile/face_cluster 同樣的 per-library fallback 模式)
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 19:46:13 +08:00
Accusys be16a588c2 feat: 自動產生 face_id(face_{frame}_{idx})於 face.json 儲存前
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 19:29:14 +08:00
Accusys 4100d5c77a fix: per-library output path for cluster_agent, profile, trace_agent
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
- cluster_agent: resolve_output_path per-library + fallback
- profile.rs: materialize_auto_groups + get_cluster_results + trace_profile filesystem fallback
- trace_agent_api.rs: read_trace_profile per-library + fallback
All now check output/demo/ before falling back to global output/
2026-11-17 19:14:15 +08:00
Accusys a16a2981e1 fix: unregistered 卡片確保有 size/mdate — MarkBase fallback + 磁碟掃描補齊 + formatSize/formatDate 顯示 '—' 替代空白
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 18:12:21 +08:00
Accusys 953d677c8e feat: DELETE API /api/v1/file/delete-unregistered — 永久刪除殘留 entry(磁碟檔 + DB + Qdrant + Redis),路徑限縮 storage root
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 17:56:06 +08:00
Accusys 5b5c1d9563 fix: face pipeline 三項修復
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
1. face_clustering: 先試 Rust binary,Python script 缺失不再提前返回空結果
2. face.rs: facenet model 查找加 fallback ( -> momentry_core/models),config 路徑補 --model 參數
3. rust_store_traced_faces: embedding 缺失時退回純 IoU 追蹤(不再強制要求 similarity);trace_profile.json 補上真實 avg_bbox/best_bbox/capture_quality
2026-11-17 17:26:00 +08:00
Accusys 5056c20667 fix: embedding port 全部改為 11436(plist + svc_def + server_type + test-embedding) 2026-11-17 13:31:20 +08:00
Accusys 8f0315e588 fix: embedding port 11437 → 11436 (correct system port)
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 13:26:56 +08:00
Accusys 6ba4ee1e06 fix: Redis service label sh.brew.redis → com.momentry.redis
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 12:48:51 +08:00
Accusys b4b84dc797 feat: composite scoring for best face selection (0.4 frontal + 0.4 confidence + 0.2 quality)
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 10:56:42 +08:00
Accusys 7fd7df2913 fix: scripts_dir() 恢復正確路徑 resolve_asset_path('MOMENTRY_SCRIPTS_DIR', 'scripts'); embedding port 11436→11437
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 08:41:34 +08:00
Accusys eac827d932 fix: scripts_dir() 恢復正確路徑 resolve_asset_path('MOMENTRY_SCRIPTS_DIR', 'scripts') → ~/momentry/scripts/ 2026-11-17 04:31:03 +08:00
Accusys a85e31ff16 fix: embedding default port 11436 → 11437 (llama-server GGUF) 2026-11-17 04:26:33 +08:00
Accusys 646d2a1361 fix(P0): face_cluster_done 雙路徑檢查 + run_processor 改用 async get_output_dir_for_file; 補 ingestion_complete output_dir
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 03:03:16 +08:00
Accusys d01e456ae5 fix(P0): per-library output dir for worker ingestion/verification (face_cluster guard, verifier, TKG, qdrant_face, ASR/ASRX); fix face_cluster serde default for empty output; fix face_cluster dependencies in pipeline_flows.json
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-17 02:46:57 +08:00
Accusys db790e2c89 fix: face_cluster guard checks both global OUTPUT_DIR and demo subdirectory for face_traced.json
Cross-Project Integration / integration (push) Has been cancelled
Core Test / lint-and-test (push) Has been cancelled
2026-11-17 01:29:28 +08:00
Accusys 75cbaa3302 feat: rebuild embeddings endpoint + standalone tool (API + binary), clear collection before rebuild, fix upsert_scene_embedding args
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled
2026-11-16 21:56:43 +08:00
652 changed files with 6576 additions and 3823 deletions
@@ -2,109 +2,77 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.momentry.n8n.main</string>
<key>UserName</key>
<string>accusys</string>
<key>WorkingDirectory</key>
<string>/Users/accusys/momentry/var/n8n</string>
<key>ProgramArguments</key>
<array>
<string>/Users/accusys/momentry/scripts/start_n8n.sh</string>
<string>start</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/homebrew/opt/node@22/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
<key>N8N_ENCRYPTION_KEY</key>
<string>Test3200Test3200Test3200</string>
<key>DOMAIN_NAME</key>
<string>n8n.momentry.ddns.net</string>
<key>WEBHOOK_URL</key>
<string>https://n8n.momentry.ddns.net/</string>
<key>N8N_PORT</key>
<string>5678</string>
<key>N8N_HOST</key>
<string>127.0.0.1</string>
<key>N8N_LISTEN_ADDRESS</key>
<string>0.0.0.0</string>
<key>N8N_USER_MANAGEMENT_JWT_DURATION</key>
<string>1h</string>
<key>N8N_RUNNERS_ENABLED</key>
<string>false</string>
<key>GENERIC_TIMEZONE</key>
<string>Asia/Taipei</string>
<key>TZ</key>
<string>Asia/Taipei</string>
<key>N8N_LOG_LEVEL</key>
<string>info</string>
<key>DB_TYPE</key>
<string>postgresdb</string>
<key>DB_POSTGRESDB_HOST</key>
<string>127.0.0.1</string>
<key>DB_POSTGRESDB_PORT</key>
<string>5432</string>
<key>DB_POSTGRESDB_DATABASE</key>
<string>n8n</string>
<key>DB_POSTGRESDB_USER</key>
<string>n8n</string>
<key>DB_POSTGRESDB_PASSWORD</key>
<string>accusys</string>
<key>EXECUTIONS_MODE</key>
<string>queue</string>
<key>QUEUE_BULL_REDIS_HOST</key>
<string>127.0.0.1</string>
<key>QUEUE_BULL_REDIS_PORT</key>
<string>6379</string>
<key>QUEUE_BULL_REDIS_PASSWORD</key>
<string>accusys</string>
<key>N8N_USER_FOLDER</key>
<string>/Users/accusys/momentry/var/n8n</string>
<key>N8N_METRICS</key>
<string>true</string>
<key>N8N_PUBLIC_API_ENABLED</key>
<string>true</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/accusys/momentry/log/n8n-main.log</string>
<key>StandardErrorPath</key>
<string>/Users/accusys/momentry/log/n8n-main.error.log</string>
<key>EnvironmentVariables</key>
<dict>
<key>DB_POSTGRESDB_DATABASE</key>
<string>n8n</string>
<key>DB_POSTGRESDB_HOST</key>
<string>127.0.0.1</string>
<key>DB_POSTGRESDB_PASSWORD</key>
<string>accusys</string>
<key>DB_POSTGRESDB_PORT</key>
<string>5432</string>
<key>DB_POSTGRESDB_USER</key>
<string>n8n</string>
<key>DB_TYPE</key>
<string>postgresdb</string>
<key>DOMAIN_NAME</key>
<string>n8n.momentry.ddns.net</string>
<key>EXECUTIONS_MODE</key>
<string>queue</string>
<key>GENERIC_TIMEZONE</key>
<string>Asia/Taipei</string>
<key>N8N_ENCRYPTION_KEY</key>
<string>Test3200Test3200Test3200</string>
<key>N8N_HOST</key>
<string>127.0.0.1</string>
<key>N8N_LISTEN_ADDRESS</key>
<string>0.0.0.0</string>
<key>N8N_LOG_LEVEL</key>
<string>info</string>
<key>N8N_METRICS</key>
<string>true</string>
<key>N8N_PORT</key>
<string>5678</string>
<key>N8N_PUBLIC_API_ENABLED</key>
<string>true</string>
<key>N8N_RUNNERS_ENABLED</key>
<string>false</string>
<key>N8N_USER_FOLDER</key>
<string>/Users/accusys/momentry/var/n8n</string>
<key>N8N_USER_MANAGEMENT_JWT_DURATION</key>
<string>1h</string>
<key>PATH</key>
<string>/opt/homebrew/opt/node@22/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
<key>QUEUE_BULL_REDIS_HOST</key>
<string>127.0.0.1</string>
<key>QUEUE_BULL_REDIS_PASSWORD</key>
<string>accusys</string>
<key>QUEUE_BULL_REDIS_PORT</key>
<string>6379</string>
<key>TZ</key>
<string>Asia/Taipei</string>
<key>WEBHOOK_URL</key>
<string>https://n8n.momentry.ddns.net/</string>
</dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.momentry.n8n.main</string>
<key>ProgramArguments</key>
<array>
<string>/Users/accusys/momentry/scripts/start_n8n.sh</string>
<string>start</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/Users/accusys/momentry/logs/n8n-main.error.log</string>
<key>StandardOutPath</key>
<string>/Users/accusys/momentry/logs/n8n-main.log</string>
<key>UserName</key>
<string>accusys</string>
<key>WorkingDirectory</key>
<string>/Users/accusys/momentry/var/n8n</string>
</dict>
</plist>
@@ -2,103 +2,73 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.momentry.n8n.worker</string>
<key>UserName</key>
<string>accusys</string>
<key>GroupName</key>
<string>staff</string>
<key>WorkingDirectory</key>
<string>/Users/accusys/momentry/var/n8n</string>
<key>ProgramArguments</key>
<array>
<string>/Users/accusys/momentry/scripts/start_n8n.sh</string>
<string>worker</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/homebrew/opt/node@22/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
<key>N8N_ENCRYPTION_KEY</key>
<string>Test3200Test3200Test3200</string>
<key>N8N_PORT</key>
<string>5681</string>
<key>QUEUE_HEALTH_CHECK_PORT</key>
<string>5682</string>
<key>N8N_HOST</key>
<string>127.0.0.1</string>
<key>GENERIC_TIMEZONE</key>
<string>Asia/Taipei</string>
<key>TZ</key>
<string>Asia/Taipei</string>
<key>N8N_LOG_LEVEL</key>
<string>info</string>
<key>DB_TYPE</key>
<string>postgresdb</string>
<key>DB_POSTGRESDB_HOST</key>
<string>127.0.0.1</string>
<key>DB_POSTGRESDB_PORT</key>
<string>5432</string>
<key>DB_POSTGRESDB_DATABASE</key>
<string>n8n</string>
<key>DB_POSTGRESDB_USER</key>
<string>n8n</string>
<key>DB_POSTGRESDB_PASSWORD</key>
<string>accusys</string>
<key>EXECUTIONS_MODE</key>
<string>queue</string>
<key>QUEUE_BULL_REDIS_HOST</key>
<string>127.0.0.1</string>
<key>QUEUE_BULL_REDIS_PORT</key>
<string>6379</string>
<key>QUEUE_BULL_REDIS_PASSWORD</key>
<string>accusys</string>
<key>N8N_USER_FOLDER</key>
<string>/Users/accusys/momentry/var/n8n</string>
<key>N8N_METRICS</key>
<string>true</string>
<key>N8N_RUNNERS_BROKER_PORT</key>
<string>5690</string>
<key>N8N_RUNNERS_LAUNCHER_HEALTH_CHECK_PORT</key>
<string>5691</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/accusys/momentry/log/n8n-worker.log</string>
<key>StandardErrorPath</key>
<string>/Users/accusys/momentry/log/n8n-worker.error.log</string>
<key>EnvironmentVariables</key>
<dict>
<key>DB_POSTGRESDB_DATABASE</key>
<string>n8n</string>
<key>DB_POSTGRESDB_HOST</key>
<string>127.0.0.1</string>
<key>DB_POSTGRESDB_PASSWORD</key>
<string>accusys</string>
<key>DB_POSTGRESDB_PORT</key>
<string>5432</string>
<key>DB_POSTGRESDB_USER</key>
<string>n8n</string>
<key>DB_TYPE</key>
<string>postgresdb</string>
<key>EXECUTIONS_MODE</key>
<string>queue</string>
<key>GENERIC_TIMEZONE</key>
<string>Asia/Taipei</string>
<key>N8N_ENCRYPTION_KEY</key>
<string>Test3200Test3200Test3200</string>
<key>N8N_HOST</key>
<string>127.0.0.1</string>
<key>N8N_LOG_LEVEL</key>
<string>info</string>
<key>N8N_METRICS</key>
<string>true</string>
<key>N8N_PORT</key>
<string>5681</string>
<key>N8N_RUNNERS_BROKER_PORT</key>
<string>5690</string>
<key>N8N_RUNNERS_LAUNCHER_HEALTH_CHECK_PORT</key>
<string>5691</string>
<key>N8N_USER_FOLDER</key>
<string>/Users/accusys/momentry/var/n8n</string>
<key>PATH</key>
<string>/opt/homebrew/opt/node@22/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
<key>QUEUE_BULL_REDIS_HOST</key>
<string>127.0.0.1</string>
<key>QUEUE_BULL_REDIS_PASSWORD</key>
<string>accusys</string>
<key>QUEUE_BULL_REDIS_PORT</key>
<string>6379</string>
<key>QUEUE_HEALTH_CHECK_PORT</key>
<string>5682</string>
<key>TZ</key>
<string>Asia/Taipei</string>
</dict>
<key>GroupName</key>
<string>staff</string>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.momentry.n8n.worker</string>
<key>ProgramArguments</key>
<array>
<string>/Users/accusys/momentry/scripts/start_n8n.sh</string>
<string>worker</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/Users/accusys/momentry/logs/n8n-worker.error.log</string>
<key>StandardOutPath</key>
<string>/Users/accusys/momentry/logs/n8n-worker.log</string>
<key>UserName</key>
<string>accusys</string>
<key>WorkingDirectory</key>
<string>/Users/accusys/momentry/var/n8n</string>
</dict>
</plist>
@@ -2,32 +2,25 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.momentry.rustdesk.hbbr</string>
<key>UserName</key>
<string>accusys</string>
<key>WorkingDirectory</key>
<string>/Users/accusys/momentry/var/rustdesk</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/hbbr</string>
<string>-k</string>
<string>_</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/accusys/momentry/log/rustdesk-hbbr.log</string>
<key>StandardErrorPath</key>
<string>/Users/accusys/momentry/log/rustdesk-hbbr.error.log</string>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.momentry.rustdesk.hbbr</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/hbbr</string>
<string>-k</string>
<string>_</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/Users/accusys/momentry/logs/rustdesk-hbbr.error.log</string>
<key>StandardOutPath</key>
<string>/Users/accusys/momentry/logs/rustdesk-hbbr.log</string>
<key>UserName</key>
<string>accusys</string>
<key>WorkingDirectory</key>
<string>/Users/accusys/momentry/var/rustdesk</string>
</dict>
</plist>
@@ -2,32 +2,25 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.momentry.rustdesk.hbbs</string>
<key>UserName</key>
<string>accusys</string>
<key>WorkingDirectory</key>
<string>/Users/accusys/momentry/var/rustdesk</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/hbbs</string>
<string>-k</string>
<string>_</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/accusys/momentry/log/rustdesk-hbbs.log</string>
<key>StandardErrorPath</key>
<string>/Users/accusys/momentry/log/rustdesk-hbbs.error.log</string>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.momentry.rustdesk.hbbs</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/hbbs</string>
<string>-k</string>
<string>_</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/Users/accusys/momentry/logs/rustdesk-hbbs.error.log</string>
<key>StandardOutPath</key>
<string>/Users/accusys/momentry/logs/rustdesk-hbbs.log</string>
<key>UserName</key>
<string>accusys</string>
<key>WorkingDirectory</key>
<string>/Users/accusys/momentry/var/rustdesk</string>
</dict>
</plist>
+19 -10
View File
@@ -14,6 +14,18 @@ use tokio::sync::RwLock;
use super::middleware::UserAuth;
use super::types::AppState;
use crate::core::config::OUTPUT_DIR;
/// Resolve output path for a per-library file, falling back to global OUTPUT_DIR.
/// Used by both cluster_agent and profile (get_cluster_results).
pub(crate) async fn resolve_output_path(pool: &sqlx::PgPool, file_uuid: &str, ext: &str) -> std::path::PathBuf {
let per_lib = crate::core::config::get_output_dir_for_file(file_uuid, pool).await;
let candidate = std::path::PathBuf::from(&per_lib).join(format!("{}.{ext}", file_uuid));
if candidate.exists() {
return candidate;
}
// Fallback: global output dir (legacy)
PathBuf::from(OUTPUT_DIR.as_str()).join(format!("{}.{ext}", file_uuid))
}
use crate::core::db::schema;
use crate::core::processor::{process_face_cluster, FaceClusterResult};
@@ -221,8 +233,8 @@ pub async fn trigger_cluster_agent(
.unwrap_or_default()
.as_secs()
);
let output_path =
PathBuf::from(OUTPUT_DIR.as_str()).join(format!("{}.face_cluster.json", file_uuid));
// Resolve output paths (per-library with global fallback)
let output_path = resolve_output_path(state.db.pool(), &file_uuid, "face_cluster.json").await;
let cancel_token = tokio_util::sync::CancellationToken::new();
// Register job
@@ -242,8 +254,7 @@ pub async fn trigger_cluster_agent(
.insert(job_id.clone(), handle);
// Reset trace names before re-clustering
let traced_path =
PathBuf::from(OUTPUT_DIR.as_str()).join(format!("{}.face_traced.json", file_uuid));
let traced_path = resolve_output_path(state.db.pool(), &file_uuid, "face_traced.json").await;
if let Ok(content) = std::fs::read_to_string(&traced_path) {
if let Ok(traced_data) = serde_json::from_str::<serde_json::Value>(&content) {
if let Some(traces) = traced_data.get("traces") {
@@ -502,8 +513,7 @@ async fn update_trace_labels_from_cluster(
file_uuid: &str,
result: &FaceClusterResult,
) -> anyhow::Result<()> {
let traced_path = std::path::Path::new(crate::core::config::OUTPUT_DIR.as_str())
.join(format!("{}.face_traced.json", file_uuid));
let traced_path = resolve_output_path(db.pool(), file_uuid, "face_traced.json").await;
let mut frame_face_to_trace: HashMap<(u64, usize), i64> = HashMap::new();
if let Ok(content) = std::fs::read_to_string(&traced_path) {
if let Ok(traced_data) = serde_json::from_str::<serde_json::Value>(&content) {
@@ -565,7 +575,7 @@ async fn update_trace_labels_from_cluster(
.await;
}
if let Some(all_trace_ids) = get_all_trace_ids(file_uuid) {
if let Some(all_trace_ids) = get_all_trace_ids(db.pool(), file_uuid).await {
let mut updated_count = 0u64;
for tid in &all_trace_ids {
if !trace_to_cluster.contains_key(tid) {
@@ -594,9 +604,8 @@ async fn update_trace_labels_from_cluster(
Ok(())
}
fn get_all_trace_ids(file_uuid: &str) -> Option<Vec<i64>> {
let traced_path = std::path::Path::new(crate::core::config::OUTPUT_DIR.as_str())
.join(format!("{}.face_traced.json", file_uuid));
async fn get_all_trace_ids(pool: &sqlx::PgPool, file_uuid: &str) -> Option<Vec<i64>> {
let traced_path = resolve_output_path(pool, file_uuid, "face_traced.json").await;
let content = std::fs::read_to_string(&traced_path).ok()?;
let traced_data: serde_json::Value = serde_json::from_str(&content).ok()?;
let traces = traced_data.get("traces")?;
+35 -5
View File
@@ -1297,10 +1297,28 @@ struct ReScanResponse {
process_command_id: Option<String>,
}
fn delete_output_files(uuid: &str) -> u64 {
async fn delete_output_files(uuid: &str, pool: &sqlx::PgPool, pre_resolved_dir: Option<&str>) -> u64 {
let mut deleted_count = 0u64;
// Check multiple output directories
let output_dirs = [config::OUTPUT_DIR.to_string()];
// Build output dirs: global OUTPUT_DIR + pre-resolved per-library dir + all upload_paths
let mut output_dirs: Vec<String> = vec![config::OUTPUT_DIR.to_string()];
if let Some(dir) = pre_resolved_dir {
if !dir.is_empty() && !output_dirs.contains(&dir.to_string()) {
output_dirs.push(dir.to_string());
}
}
// All enabled upload_paths output paths (covers all libraries regardless of videos row)
if let Ok(rows) = sqlx::query_scalar::<_, String>(
"SELECT output_path FROM upload_paths WHERE enabled = true AND output_path IS NOT NULL"
).fetch_all(pool).await {
for dir in rows {
if !dir.is_empty() && !output_dirs.contains(&dir) {
output_dirs.push(dir);
}
}
}
tracing::info!("[UNREGISTER] Scanning output dirs for {}: {:?}", uuid, output_dirs);
for output_dir in &output_dirs {
if let Ok(entries) = std::fs::read_dir(output_dir) {
@@ -1445,6 +1463,13 @@ async fn unregister(
})?;
if output.status.success() {
// rust_unregister only clears the global OUTPUT_DIR (demo).
// Also clear per-library output dirs (test, etc.) which it doesn't know about.
let extra_deleted = delete_output_files(&uuid, state.db.pool(), None).await;
if extra_deleted > 0 {
tracing::info!("[UNREGISTER] Sync mode: additionally deleted {} output files across libraries for {}", extra_deleted, uuid);
}
Ok(Json(UnregisterResponse {
success: true,
message: "Unregister completed (sync mode)".to_string(),
@@ -1659,6 +1684,11 @@ async fn re_scan(
/// Internal unregister function - can be called from both API and register
pub(crate) async fn unregister_internal(db: &PostgresDb, uuid: &str) -> Result<(), StatusCode> {
// Resolve per-library output dir BEFORE deleting the videos row
// (get_output_dir_for_file JOINs videos → must run while the row still exists)
let resolved_output_dir = crate::core::config::get_output_dir_for_file(uuid, db.pool()).await;
tracing::info!("[UNREGISTER] Resolved output dir for {}: {}", uuid, resolved_output_dir);
let videos_table = schema::table_name("videos");
let processor_table = schema::table_name("processor_results");
let chunks_table = schema::table_name("chunk");
@@ -1783,8 +1813,8 @@ pub(crate) async fn unregister_internal(db: &PostgresDb, uuid: &str) -> Result<(
tracing::info!("[UNREGISTER] Deleted all data for {}", uuid);
// Delete output files
delete_output_files(uuid);
// Delete output files (pass pre-resolved dir since videos row is already deleted)
delete_output_files(uuid, db.pool(), Some(&resolved_output_dir)).await;
// Delete Qdrant vectors — iterate all collections that carry per-file points.
// The main collection holds text/trace chunks (incl. vlm_summary); `_faces` (face
+94 -3
View File
@@ -129,6 +129,7 @@ async fn list_files(
file_size: None,
modified_time: None,
thumbnail_url: None,
job_status: None,
}]
} else {
vec![]
@@ -202,8 +203,10 @@ async fn list_files(
let name = mb_file.name;
let mb_path = mb_file.file_path.clone().unwrap_or_default();
// Try path match first, then fall back to name match
// (handles symlink paths where MarkBase returns different path than registered)
let matched = if !mb_path.is_empty() {
registered_by_path.get(&mb_path)
registered_by_path.get(&mb_path).or_else(|| registered_by_name.get(&name))
} else {
registered_by_name.get(&name)
};
@@ -221,6 +224,7 @@ async fn list_files(
file_size,
modified_time,
thumbnail_url: None,
job_status: None,
});
} else {
// Not registered: use MarkBase file_path if available
@@ -236,6 +240,19 @@ async fn list_files(
format!("{}/{}", default_root, name)
})
});
// Fallback: use filesystem metadata when MarkBase data is unavailable
let file_size = if mb_file.size > 0 {
Some(mb_file.size)
} else {
std::fs::metadata(&file_path).ok().map(|m| m.len())
};
let modified_time = if !mb_file.modified.is_empty() {
Some(mb_file.modified)
} else {
std::fs::metadata(&file_path).ok()
.and_then(|m| m.modified().ok())
.map(|t| chrono::DateTime::<chrono::Utc>::from(t).to_rfc3339())
};
all_files.push(FileItem {
file_uuid: mb_file.file_uuid.unwrap_or_default(),
file_name: name,
@@ -243,9 +260,10 @@ async fn list_files(
status: "unregistered".to_string(),
is_registered: false,
total_chunks: 0,
file_size: Some(mb_file.size),
modified_time: Some(mb_file.modified),
file_size,
modified_time,
thumbnail_url: None,
job_status: None,
});
}
}
@@ -274,10 +292,41 @@ async fn list_files(
file_size,
modified_time,
thumbnail_url: None,
job_status: None,
});
}
}
// Scan filesystem for files not in MarkBase AND not in DB (true unregistered)
for (_, dir_path) in &upload_paths {
if let Ok(entries) = std::fs::read_dir(dir_path) {
for entry in entries.flatten() {
let path = entry.path();
if !path.is_file() { continue }
let name = entry.file_name().to_string_lossy().to_string();
let name_lower = name.to_lowercase();
if name_lower == ".ds_store" || name_lower.ends_with(".sqlite") { continue }
if all_names.contains(&name) { continue }
// Check all paths (including MarkBase paths)
if all_paths.contains(&path.to_string_lossy().to_string()) { continue }
let meta = entry.metadata().ok();
all_files.push(FileItem {
file_uuid: String::new(),
file_name: name,
file_path: path.to_string_lossy().to_string(),
status: "unregistered".to_string(),
is_registered: false,
total_chunks: 0,
file_size: meta.as_ref().map(|m| m.len()),
modified_time: meta.and_then(|m| m.modified().ok())
.map(|t| chrono::DateTime::<chrono::Utc>::from(t).to_rfc3339()),
thumbnail_url: None,
job_status: None,
});
}
}
}
// Add thumbnail URLs for all video files
for file in &mut all_files {
@@ -318,11 +367,50 @@ async fn list_files(
count_map = chunk_counts.into_iter().collect();
}
// Fetch job status counts for all files
let monitor_jobs_table = crate::core::db::schema::table_name("monitor_jobs");
let mut job_status_map: std::collections::HashMap<String, serde_json::Value> = std::collections::HashMap::new();
if !uuids.is_empty() {
// Build query with proper bindings
let placeholders: Vec<String> = (1..=uuids.len()).map(|i| format!("${}", i)).collect();
let job_query = format!(
"SELECT uuid, status, COUNT(*) as cnt FROM {mj_t} WHERE uuid IN ({}) GROUP BY uuid, status",
placeholders.join(", "),
mj_t = monitor_jobs_table
);
let mut query = sqlx::query_as::<_, (String, String, i64)>(&job_query);
for uuid in &uuids {
query = query.bind(uuid);
}
let job_counts: Vec<(String, String, i64)> = query
.fetch_all(state.db.pool())
.await
.unwrap_or_default();
// Group by uuid: {pending: N, running: N, completed: N}
let mut temp_map: std::collections::HashMap<String, serde_json::Map<String, serde_json::Value>> = std::collections::HashMap::new();
for (uuid, status, cnt) in job_counts {
let entry = temp_map.entry(uuid).or_default();
entry.insert(status, serde_json::Value::Number(serde_json::Number::from(cnt)));
}
for (uuid, map) in temp_map {
job_status_map.insert(uuid, serde_json::Value::Object(map));
}
}
let mut data = data;
for item in &mut data {
if let Some(cnt) = count_map.get(&item.file_uuid) {
item.total_chunks = *cnt;
}
if let Some(js) = job_status_map.get(&item.file_uuid) {
item.job_status = Some(js.clone());
}
}
Ok(Json(FilesResponse {
@@ -368,6 +456,9 @@ pub struct FileItem {
pub modified_time: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail_url: Option<String>,
/// Job status summary: {pending: N, running: N, completed: N}
#[serde(skip_serializing_if = "Option::is_none")]
pub job_status: Option<serde_json::Value>,
}
#[derive(Debug, Serialize)]
+333
View File
@@ -9,6 +9,7 @@ use axum::{
};
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use sqlx::Row;
use super::types::AppState;
use crate::core::db::schema;
@@ -20,6 +21,10 @@ pub fn job_management_routes() -> Router<AppState> {
.route("/api/v1/jobs/paused", get(list_paused_jobs))
.route("/api/v1/jobs/:uuid/status", get(get_job_status))
.route("/api/v1/admin/sync-status", post(sync_all_statuses))
.route("/api/v1/jobs/queue", get(list_queue_jobs))
.route("/api/v1/jobs/:uuid/cancel", post(cancel_job))
.route("/api/v1/jobs/:uuid/priority", post(set_job_priority))
.route("/api/v1/jobs/queue/clear", post(clear_queue_jobs))
}
#[derive(Debug, Serialize)]
@@ -362,3 +367,331 @@ async fn sync_all_statuses(
message: format!("Found {} mismatches, fixed {}", mismatch_count, fixed),
}))
}
// ─── Queue Management: list, cancel, priority ─────────────────────────────────
#[derive(Debug, Serialize)]
pub struct QueueJob {
pub job_id: i32,
pub uuid: String,
pub file_name: String,
pub status: String,
pub created_at: Option<String>,
pub updated_at: Option<String>,
/// Processor completion summary from processor_results
pub processors_total: i64,
pub processors_completed: i64,
pub processors_running: i64,
pub processors_pending: i64,
pub processors_failed: i64,
}
#[derive(Debug, Serialize)]
pub struct QueueResponse {
pub jobs: Vec<QueueJob>,
pub summary: serde_json::Value,
}
/// GET /api/v1/jobs/queue
/// List all jobs in the queue with their processor status.
/// Query params: status (filter), limit (default 100)
async fn list_queue_jobs(
State(state): State<AppState>,
axum::extract::Query(params): axum::extract::Query<std::collections::HashMap<String, String>>,
) -> Result<Json<QueueResponse>, (StatusCode, String)> {
let monitor_jobs_table = schema::table_name("monitor_jobs");
let videos_table = schema::table_name("videos");
let pr_table = schema::table_name("processor_results");
let status_filter = params.get("status").cloned().unwrap_or_default();
let limit: i64 = params.get("limit").and_then(|v| v.parse().ok()).unwrap_or(100);
let status_clause = if status_filter.is_empty() {
String::new()
} else {
format!("WHERE mj.status = '{}'", status_filter.replace('\'', ""))
};
let rows = sqlx::query(&format!(
"SELECT mj.id::text, mj.uuid, v.file_name, mj.status,
mj.created_at::text, COALESCE(mj.updated_at::text, ''),
COALESCE(pr.total, 0), COALESCE(pr.completed, 0),
COALESCE(pr.running, 0), COALESCE(pr.pending, 0), COALESCE(pr.failed, 0)
FROM {mj_t} mj
LEFT JOIN {v_t} v ON v.file_uuid = mj.uuid
LEFT JOIN (
SELECT job_id,
COUNT(*) as total,
COUNT(*) FILTER (WHERE status = 'completed') as completed,
COUNT(*) FILTER (WHERE status = 'running') as running,
COUNT(*) FILTER (WHERE status = 'pending') as pending,
COUNT(*) FILTER (WHERE status = 'failed') as failed
FROM {pr_t}
GROUP BY job_id
) pr ON pr.job_id = mj.id
{status_clause}
ORDER BY mj.created_at DESC
LIMIT $1",
mj_t = monitor_jobs_table,
v_t = videos_table,
pr_t = pr_table,
status_clause = status_clause,
))
.bind(limit)
.fetch_all(state.db.pool())
.await
.map_err(|e| {
tracing::error!("[Queue] query failed: {}", e);
(StatusCode::INTERNAL_SERVER_ERROR, e.to_string())
})?;
let mut jobs = Vec::new();
for row in rows {
jobs.push(QueueJob {
job_id: row.try_get::<String, _>("id").unwrap_or_default().parse().unwrap_or(0),
uuid: row.try_get::<String, _>("uuid").unwrap_or_default(),
file_name: row.try_get::<String, _>("file_name").unwrap_or_else(|_| "(unknown)".to_string()),
status: row.try_get::<String, _>("status").unwrap_or_default(),
created_at: row.try_get::<String, _>("created_at").ok(),
updated_at: row.try_get::<String, _>("updated_at").ok(),
processors_total: row.try_get::<i64, _>("total").unwrap_or(0),
processors_completed: row.try_get::<i64, _>("completed").unwrap_or(0),
processors_running: row.try_get::<i64, _>("running").unwrap_or(0),
processors_pending: row.try_get::<i64, _>("pending").unwrap_or(0),
processors_failed: row.try_get::<i64, _>("failed").unwrap_or(0),
});
}
// Summary counts
let summary_rows: Vec<(String, i64)> = sqlx::query_as(&format!(
"SELECT status, COUNT(*) FROM {mj_t} GROUP BY status",
mj_t = monitor_jobs_table
))
.fetch_all(state.db.pool())
.await
.unwrap_or_default();
let mut summary = serde_json::Map::new();
for (status, count) in summary_rows {
summary.insert(status, serde_json::Value::Number(serde_json::Number::from(count)));
}
Ok(Json(QueueResponse {
jobs,
summary: serde_json::Value::Object(summary),
}))
}
/// POST /api/v1/jobs/:uuid/cancel
/// Cancel a pending/paused job: delete monitor_jobs + processor_results, reset video status.
async fn cancel_job(
State(state): State<AppState>,
Path(uuid): Path<String>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
let monitor_jobs_table = schema::table_name("monitor_jobs");
let pr_table = schema::table_name("processor_results");
let videos_table = schema::table_name("videos");
// Check current status — only pending/paused/running jobs can be cancelled
let status: Option<String> = sqlx::query_scalar(&format!(
"SELECT status FROM {mj_t} WHERE uuid = $1",
mj_t = monitor_jobs_table
))
.bind(&uuid)
.fetch_optional(state.db.pool())
.await
.map_err(|e| {
(StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({"error": e.to_string()})))
})?
.flatten();
let status = match status {
Some(s) => s,
None => {
return Err((
StatusCode::NOT_FOUND,
Json(serde_json::json!({"error": "Job not found"})),
))
}
};
if status == "completed" {
return Err((
StatusCode::BAD_REQUEST,
Json(serde_json::json!({"error": "Cannot cancel a completed job"})),
));
}
// Delete processor_results
sqlx::query(&format!(
"DELETE FROM {pr_t} WHERE job_id IN (SELECT id FROM {mj_t} WHERE uuid = $1)",
pr_t = pr_table,
mj_t = monitor_jobs_table
))
.bind(&uuid)
.execute(state.db.pool())
.await
.map_err(|e| {
(StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({"error": e.to_string()})))
})?;
// Delete monitor_jobs
sqlx::query(&format!(
"DELETE FROM {mj_t} WHERE uuid = $1",
mj_t = monitor_jobs_table
))
.bind(&uuid)
.execute(state.db.pool())
.await
.map_err(|e| {
(StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({"error": e.to_string()})))
})?;
// Reset video status
sqlx::query(&format!(
"UPDATE {v_t} SET status = 'registered', updated_at = NOW() WHERE file_uuid = $1",
v_t = videos_table
))
.bind(&uuid)
.execute(state.db.pool())
.await
.map_err(|e| {
(StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({"error": e.to_string()})))
})?;
tracing::info!("[Queue] Cancelled job for {} (was {})", uuid, status);
Ok(Json(serde_json::json!({
"success": true,
"message": format!("Job cancelled (was {})", status),
"uuid": uuid
})))
}
/// POST /api/v1/jobs/:uuid/priority
/// Move a pending job to the front of the queue (oldest created_at).
async fn set_job_priority(
State(state): State<AppState>,
Path(uuid): Path<String>,
axum::Json(body): axum::Json<serde_json::Value>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
let monitor_jobs_table = schema::table_name("monitor_jobs");
let action = body.get("action").and_then(|v| v.as_str()).unwrap_or("front");
let result = sqlx::query(&format!(
"UPDATE {mj_t} SET created_at = CASE WHEN $1 = 'front' THEN NOW() - INTERVAL '1 hour' ELSE NOW() END, updated_at = NOW() WHERE uuid = $2 AND status = 'pending'",
mj_t = monitor_jobs_table
))
.bind(action)
.bind(&uuid)
.execute(state.db.pool())
.await
.map_err(|e| {
(StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({"error": e.to_string()})))
})?;
if result.rows_affected() == 0 {
return Err((
StatusCode::NOT_FOUND,
Json(serde_json::json!({"error": "Pending job not found"})),
));
}
tracing::info!("[Queue] Job {} priority set to {}", uuid, action);
Ok(Json(serde_json::json!({
"success": true,
"message": format!("Job priority: {}", action),
"uuid": uuid
})))
}
/// POST /api/v1/jobs/queue/clear
/// Bulk-clear queued jobs by status: delete monitor_jobs + processor_results,
/// reset video status to 'registered'. Body: { status: "pending" | "paused" | "all" }
async fn clear_queue_jobs(
State(state): State<AppState>,
axum::Json(body): axum::Json<serde_json::Value>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
let monitor_jobs_table = schema::table_name("monitor_jobs");
let pr_table = schema::table_name("processor_results");
let videos_table = schema::table_name("videos");
let target = body.get("status").and_then(|v| v.as_str()).unwrap_or("pending");
let status_clause = match target {
"pending" => "WHERE mj.status = 'pending'".to_string(),
"paused" => "WHERE mj.status = 'paused'".to_string(),
"all" => "WHERE mj.status != 'completed'".to_string(),
_ => {
return Err((
StatusCode::BAD_REQUEST,
Json(serde_json::json!({"error": "status must be pending/paused/all"})),
))
}
};
// Collect affected uuids first
let uuids: Vec<String> = sqlx::query_scalar(&format!(
"SELECT mj.uuid FROM {mj_t} mj {sc}",
mj_t = monitor_jobs_table,
sc = status_clause
))
.fetch_all(state.db.pool())
.await
.map_err(|e| {
(StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({"error": e.to_string()})))
})?;
if uuids.is_empty() {
return Ok(Json(serde_json::json!({
"success": true, "cleared": 0, "message": "No matching jobs"
})));
}
// Delete processor_results
sqlx::query(&format!(
"DELETE FROM {pr_t} WHERE job_id IN (SELECT id FROM {mj_t} WHERE uuid = ANY($1))",
pr_t = pr_table,
mj_t = monitor_jobs_table
))
.bind(&uuids)
.execute(state.db.pool())
.await
.map_err(|e| {
(StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({"error": e.to_string()})))
})?;
// Delete monitor_jobs
sqlx::query(&format!(
"DELETE FROM {mj_t} WHERE uuid = ANY($1)",
mj_t = monitor_jobs_table
))
.bind(&uuids)
.execute(state.db.pool())
.await
.map_err(|e| {
(StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({"error": e.to_string()})))
})?;
// Reset video status
sqlx::query(&format!(
"UPDATE {v_t} SET status = 'registered', updated_at = NOW() WHERE file_uuid = ANY($1) AND status NOT IN ('completed')",
v_t = videos_table
))
.bind(&uuids)
.execute(state.db.pool())
.await
.map_err(|e| {
(StatusCode::INTERNAL_SERVER_ERROR, Json(serde_json::json!({"error": e.to_string()})))
})?;
let cleared = uuids.len();
tracing::info!("[Queue] Cleared {} {} jobs", cleared, target);
Ok(Json(serde_json::json!({
"success": true,
"cleared": cleared,
"message": format!("Cleared {} {} jobs", cleared, target)
})))
}
+53 -29
View File
@@ -1058,14 +1058,18 @@ async fn thumbnail_by_path(
/// Direct access to trace key_face.jpg — bypasses ffmpeg, reads pre-cached file.
/// Used by Studio for fast face group thumbnail loading.
async fn trace_thumbnail(
State(_state): State<crate::api::types::AppState>,
State(state): State<crate::api::types::AppState>,
Path((file_uuid, trace_id)): Path<(String, i32)>,
) -> Result<impl IntoResponse, StatusCode> {
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let key_face_path = std::path::PathBuf::from(output_dir)
.join(&file_uuid)
// Try per-library dir first, then global OUTPUT_DIR (legacy)
let per_lib = crate::core::config::get_output_dir_for_file(&file_uuid, state.db.pool()).await;
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
let rel = std::path::PathBuf::from(&file_uuid)
.join(format!("trace_{}", trace_id))
.join("key_face.jpg");
let candidate1 = std::path::PathBuf::from(&per_lib).join(&rel);
let candidate2 = std::path::PathBuf::from(global_dir).join(&rel);
let key_face_path = if candidate1.exists() { candidate1 } else { candidate2 };
if !key_face_path.exists() {
return Err(StatusCode::NOT_FOUND);
@@ -1102,10 +1106,11 @@ async fn trace_thumbnail(
/// Path mirrors `thumbnail_url` produced by the VLM scene search API.
/// e.g. /api/v1/file/{file_uuid}/scenes/scene_000.jpg
pub async fn scene_thumbnail(
State(_state): State<crate::api::types::AppState>,
State(state): State<crate::api::types::AppState>,
Path((file_uuid, filename)): Path<(String, String)>,
) -> Result<impl IntoResponse, StatusCode> {
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
// Try per-library output dir first (test files live in output/test)
let per_lib = crate::core::config::get_output_dir_for_file(&file_uuid, state.db.pool()).await;
// Security: validate file_uuid to prevent path traversal
if !crate::core::thumbnail::validator::is_valid_file_uuid(&file_uuid) {
@@ -1120,10 +1125,16 @@ pub async fn scene_thumbnail(
.map(|_| filename.clone())
.ok_or(StatusCode::NOT_FOUND)?;
let file_path = std::path::PathBuf::from(output_dir)
.join(&file_uuid)
.join("scenes")
.join(&safe_name);
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
let candidate1 = std::path::PathBuf::from(&per_lib)
.join(&file_uuid).join("scenes").join(&safe_name);
let candidate2 = std::path::PathBuf::from(global_dir)
.join(&file_uuid).join("scenes").join(&safe_name);
let file_path = if candidate1.exists() {
candidate1
} else {
candidate2
};
if !file_path.exists() {
return Err(StatusCode::NOT_FOUND);
@@ -1178,14 +1189,17 @@ async fn face_thumbnail(
// Step 1: Check for pre-stored face crop if trace_id is provided
if let Some(trace_id) = q.trace_id {
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let per_lib_dir = crate::core::config::get_output_dir_for_file(&file_uuid, state.db.pool()).await;
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
// Check .faces cache first
let cached_path = std::path::PathBuf::from(output_dir)
.join(".faces")
// Check .faces cache first (per-library + global)
let rel_cache = std::path::PathBuf::from(".faces")
.join(&file_uuid)
.join(trace_id.to_string())
.join(format!("{}.jpg", frame));
let cached_path_c1 = std::path::PathBuf::from(&per_lib_dir).join(&rel_cache);
let cached_path_c2 = std::path::PathBuf::from(global_dir).join(&rel_cache);
let cached_path = if cached_path_c1.exists() { cached_path_c1 } else { cached_path_c2.clone() };
if cached_path.exists() {
tracing::debug!(
@@ -1205,11 +1219,13 @@ async fn face_thumbnail(
return Ok(image_response(bytes));
}
// Fallback: check trace directory for key_face.jpg
let trace_key_face = std::path::PathBuf::from(output_dir)
.join(&file_uuid)
// Fallback: check trace directory for key_face.jpg (per-library + global)
let rel_trace = std::path::PathBuf::from(&file_uuid)
.join(format!("trace_{}", trace_id))
.join("key_face.jpg");
let tc1 = std::path::PathBuf::from(&per_lib_dir).join(&rel_trace);
let tc2 = std::path::PathBuf::from(global_dir).join(&rel_trace);
let trace_key_face = if tc1.exists() { tc1 } else { tc2 };
if trace_key_face.exists() {
tracing::debug!(
@@ -1888,21 +1904,29 @@ async fn get_appearance_handler(
Path(file_uuid): Path<String>,
Query(params): Query<AppearanceQuery>,
) -> Result<axum::Json<AppearanceResponse>, StatusCode> {
use crate::core::config::OUTPUT_DIR;
let output_dir = OUTPUT_DIR.as_str();
// Try per-library dir first, fallback to global OUTPUT_DIR
let per_lib = crate::core::config::get_output_dir_for_file(&file_uuid, _state.db.pool()).await;
let appearance_path =
std::path::Path::new(output_dir).join(format!("{}.appearance.json", file_uuid));
std::path::Path::new(&per_lib).join(format!("{}.appearance.json", file_uuid));
if !appearance_path.exists() {
tracing::error!(
"[get_appearance] File not found: {}",
appearance_path.display()
);
// Fallback: global OUTPUT_DIR
let global = crate::core::config::OUTPUT_DIR.as_str();
let global_path = std::path::Path::new(global).join(format!("{}.appearance.json", file_uuid));
if global_path.exists() {
// use global_path
return read_appearance(&global_path, params.frame).await;
}
return Err(StatusCode::NOT_FOUND);
}
let content = std::fs::read_to_string(&appearance_path).map_err(|e| {
read_appearance(&appearance_path, params.frame).await
}
async fn read_appearance(
path: &std::path::Path,
frame: i64,
) -> Result<axum::Json<AppearanceResponse>, StatusCode> {
let content = std::fs::read_to_string(path).map_err(|e| {
tracing::error!("[get_appearance] Failed to read appearance.json: {}", e);
StatusCode::INTERNAL_SERVER_ERROR
})?;
@@ -1919,7 +1943,7 @@ async fn get_appearance_handler(
let frame_data = frames
.iter()
.find(|f| f.get("frame").and_then(|v| v.as_i64()) == Some(params.frame))
.find(|f| f.get("frame").and_then(|v| v.as_i64()) == Some(frame))
.ok_or(StatusCode::NOT_FOUND)?;
let hsv_histogram = frame_data
@@ -1937,7 +1961,7 @@ async fn get_appearance_handler(
.unwrap_or_default();
Ok(axum::Json(AppearanceResponse {
frame: params.frame,
frame,
dominant_colors: vec![],
hsv_histogram,
}))
+57 -15
View File
@@ -25,6 +25,14 @@ use crate::{Embedder, FileManager};
fn delete_output_files_for_uuid(uuid: &str, output_dir: &str) -> u64 {
let mut deleted_count = 0u64;
// Also scan output root (parent of per-library dir) for pipeline logs
let mut dirs = vec![output_dir.to_string()];
if let Some(parent) = std::path::Path::new(output_dir).parent() {
if parent.file_name().and_then(|n| n.to_str()) == Some("output") {
dirs.push(parent.to_string_lossy().to_string());
}
}
for output_dir in &dirs {
if let Ok(entries) = std::fs::read_dir(output_dir) {
for entry in entries.flatten() {
let path = entry.path();
@@ -41,6 +49,7 @@ fn delete_output_files_for_uuid(uuid: &str, output_dir: &str) -> u64 {
}
}
}
}
deleted_count
}
@@ -578,8 +587,18 @@ async fn download_json(
State(state): State<AppState>,
Path((file_uuid, processor)): Path<(String, String)>,
) -> Result<Json<serde_json::Value>, StatusCode> {
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
let path = std::path::Path::new(&output_dir).join(format!("{}.{}.json", file_uuid, processor));
let per_lib_dir = crate::core::config::get_output_dir_for_file(&file_uuid, state.db.pool()).await;
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
// face_trace processor writes as face_traced.json
let ext = if processor == "face_trace" { "face_traced" } else { processor.as_str() };
let filename = format!("{}.{}.json", file_uuid, ext);
let candidates = [
std::path::Path::new(&per_lib_dir).join(&filename),
std::path::Path::new(global_dir).join(&filename),
];
let path = candidates.iter().find(|p| p.exists())
.cloned()
.unwrap_or_else(|| candidates[0].clone());
let content = tokio::fs::read_to_string(&path)
.await
.map_err(|_| StatusCode::NOT_FOUND)?;
@@ -916,7 +935,7 @@ struct OutputCompletenessItem {
async fn get_output_completeness(
State(state): State<AppState>,
) -> Result<Json<serde_json::Value>, StatusCode> {
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
let videos_table = schema::table_name("videos");
let rows: Vec<(String, String, String)> = sqlx::query_as(&format!(
@@ -937,13 +956,25 @@ async fn get_output_completeness(
continue; // 只檢查 completed 的影片
}
// Per-library output dir with global fallback (test files live in output/test)
let per_lib = crate::core::config::get_output_dir_for_file(&uuid, state.db.pool()).await;
let output_dir = if std::path::Path::new(&per_lib).is_dir() {
per_lib
} else {
global_dir.to_string()
};
let mut missing = Vec::new();
// 檢查 JSON 產出
for ext in ["asrx", "cut", "face", "face_cluster", "face_traced", "ocr", "scenes"] {
let path = format!("{}/{}.{}.json", output_dir, uuid, ext);
if !std::path::Path::new(&path).exists() {
missing.push(format!("{}.json", ext));
// fallback to global dir
let global_path = format!("{}/{}.{}.json", global_dir, uuid, ext);
if !std::path::Path::new(&global_path).exists() {
missing.push(format!("{}.json", ext));
}
}
}
@@ -999,6 +1030,7 @@ async fn get_output_completeness(
}
async fn get_processor_json(
State(state): State<AppState>,
Query(params): Query<std::collections::HashMap<String, String>>,
) -> Result<Json<serde_json::Value>, (StatusCode, Json<serde_json::Value>)> {
let file_uuid = params.get("file_hash").ok_or((
@@ -1023,8 +1055,16 @@ async fn get_processor_json(
"tkg" => "tkg",
other => other,
};
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let path = format!("{}/{}.{}.json", output_dir.trim_end_matches('/'), file_uuid, ext);
// Try per-library dir first, then global OUTPUT_DIR (legacy)
let per_lib_dir = crate::core::config::get_output_dir_for_file(file_uuid, state.db.pool()).await;
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
let candidates = [
format!("{}/{}.{}.json", per_lib_dir.trim_end_matches('/'), file_uuid, ext),
format!("{}/{}.{}.json", global_dir.trim_end_matches('/'), file_uuid, ext),
];
let path = candidates.iter().find(|p| std::path::Path::new(p).exists())
.cloned()
.unwrap_or_else(|| candidates[0].clone());
match std::fs::read_to_string(&path) {
Ok(content) => match serde_json::from_str(&content) {
@@ -1067,37 +1107,39 @@ async fn get_processor_counts(
});
let file_uuid = full_uuid.ok_or(StatusCode::NOT_FOUND)?;
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
// Use per-library output dir (test files live in output/test, not output/demo)
let per_lib_dir = crate::core::config::get_output_dir_for_file(&file_uuid, state.db.pool()).await;
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
let processors = crate::core::db::ProcessorType::all();
let mut results = Vec::new();
for processor in &processors {
let proc_name = processor.as_str();
// resolve output filename: some processors write under a different
// extension than their queue name (face_trace → face_traced.json).
let json_ext = match proc_name {
"face_trace" => "face_traced",
other => other,
};
let json_path =
std::path::Path::new(&output_dir).join(format!("{}.{}.json", file_uuid, json_ext));
let filename = format!("{}.{}.json", file_uuid, json_ext);
let json_path = std::path::Path::new(&per_lib_dir).join(&filename);
let fallback_path = std::path::Path::new(global_dir).join(&filename);
let effective_path = if json_path.exists() { json_path } else { fallback_path };
let has_json = json_path.exists();
let has_json = effective_path.exists();
let mut frame_count = None;
let mut segment_count = None;
let mut chunk_count = None;
let mut last_modified = None;
if has_json {
if let Ok(metadata) = std::fs::metadata(&json_path) {
if let Ok(metadata) = std::fs::metadata(&effective_path) {
if let Ok(modified) = metadata.modified() {
let chrono_dt: chrono::DateTime<chrono::Utc> = modified.into();
last_modified = Some(chrono_dt.to_rfc3339());
}
}
if let Ok(content) = std::fs::read_to_string(&json_path) {
if let Ok(content) = std::fs::read_to_string(&effective_path) {
if let Ok(json) = serde_json::from_str::<serde_json::Value>(&content) {
// CUT: prioritize scenes count over frame_count
if proc_name == "cut" {
@@ -1166,7 +1208,7 @@ async fn get_processor_counts(
Ok(Json(ProcessorCountsResponse {
file_uuid,
output_dir,
output_dir: per_lib_dir,
processors: results,
}))
}
+17 -7
View File
@@ -9,6 +9,7 @@ use std::collections::HashMap;
use crate::api::middleware::UserAuth;
use crate::api::types::AppState;
use crate::api::cluster_agent::resolve_output_path;
use crate::core::db::schema;
use crate::core::file_profile::FaceFilterSettings;
@@ -47,8 +48,8 @@ async fn materialize_auto_groups(pool: &PgPool, file_uuid: &str) -> Result<(), S
.into_iter()
.collect();
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let fc_path = format!("{}/{}.face_cluster.json", output_dir, file_uuid);
// Try per-library dir first, fallback to global OUTPUT_DIR
let fc_path = resolve_output_path(pool, file_uuid, "face_cluster.json").await;
let Ok(content) = std::fs::read_to_string(&fc_path) else {
return Ok(()); // no auto clusters yet — done
};
@@ -355,12 +356,22 @@ let row: Option<(
file_uuid, trace_id);
// Construct path: {output_dir}/{file_uuid}/trace_{trace_id}/trace_profile.json
let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR")
.unwrap_or_else(|_| crate::core::config::OUTPUT_DIR.to_string().to_string());
let profile_path = std::path::Path::new(&output_dir)
let per_lib = crate::core::config::get_output_dir_for_file(file_uuid, pool).await;
let candidate = std::path::Path::new(&per_lib)
.join(file_uuid)
.join(format!("trace_{}", trace_id))
.join("trace_profile.json");
let profile_path = if candidate.exists() {
candidate
} else {
// Fallback: global OUTPUT_DIR (legacy)
let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR")
.unwrap_or_else(|_| crate::core::config::OUTPUT_DIR.to_string());
std::path::PathBuf::from(&output_dir)
.join(file_uuid)
.join(format!("trace_{}", trace_id))
.join("trace_profile.json")
};
// Read from filesystem
if profile_path.exists() {
@@ -2013,8 +2024,7 @@ pub async fn get_cluster_results_handler(
// Load face_cluster.json for similarity data only (not for adding clusters)
let cluster_similarity: HashMap<String, ClusterSimilarityInfo> = {
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let fc_path = format!("{}/{}.face_cluster.json", output_dir, file_uuid);
let fc_path = resolve_output_path(state.db.pool(), &file_uuid, "face_cluster.json").await;
let mut map = HashMap::new();
if let Ok(content) = std::fs::read_to_string(&fc_path) {
if let Ok(data) = serde_json::from_str::<serde_json::Value>(&content) {
+32 -9
View File
@@ -544,11 +544,14 @@ async fn get_ingestion_status(
let identity_count = identity_ids.len() as i64;
let strangers = stranger_traces.len() as i64;
let scene_meta_path = format!(
"{}/{}.scene_meta.json",
crate::core::config::OUTPUT_DIR.as_str(),
file_uuid
);
let per_lib_dir = crate::core::config::get_output_dir_for_file(&file_uuid, pool).await;
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
let scene_meta_base = if std::path::Path::new(&per_lib_dir).is_dir() {
per_lib_dir
} else {
global_dir.to_string()
};
let scene_meta_path = format!("{}/{}.scene_meta.json", scene_meta_base, file_uuid);
let scene_meta_ok = std::path::Path::new(&scene_meta_path).exists();
macro_rules! count_sql {
@@ -1153,8 +1156,15 @@ async fn get_file_stats_inner(
..Default::default()
};
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
let per_lib_dir = crate::core::config::get_output_dir_for_file(&file_uuid, pool).await;
let output_dir: &str = if std::path::Path::new(&per_lib_dir).is_dir() {
&per_lib_dir
} else {
global_dir
};
// 6. Get Face Dedup stats
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let face_cluster_path = format!("{}/{}.face_cluster.json", output_dir, file_uuid);
let face_clusters = if std::path::Path::new(&face_cluster_path).exists() {
if let Ok(content) = std::fs::read_to_string(&face_cluster_path) {
@@ -1330,6 +1340,15 @@ async fn get_pipeline_progress_handler(
State(state): State<AppState>,
Path(file_uuid): Path<String>,
) -> Result<Json<crate::core::progress::PipelineProgress>, StatusCode> {
// Per-library output dir (test files live in output/test)
let per_lib_dir = crate::core::config::get_output_dir_for_file(&file_uuid, state.db.pool()).await;
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
let output_dir: &str = if std::path::Path::new(&per_lib_dir).is_dir() {
&per_lib_dir
} else {
global_dir
};
// 1. Try to read existing progress from Redis first
let redis_progress: Option<crate::core::progress::PipelineProgress> = {
use crate::core::db::RedisClient;
@@ -1521,7 +1540,6 @@ async fn get_pipeline_progress_handler(
// Check scene_vlm progress from scenes.json
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let scenes_path = format!("{}/{}.scenes.json", output_dir, file_uuid);
if std::path::Path::new(&scenes_path).exists() {
if let Ok(scenes_json) = std::fs::read_to_string(&scenes_path) {
@@ -1578,7 +1596,6 @@ async fn get_pipeline_progress_handler(
// Check face dedup from actual face_cluster.json content
// Always check if processors_done, regardless of tkg_node_count (A-10 fix)
if processors_done {
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let face_cluster_path = format!("{}/{}.face_cluster.json", output_dir, file_uuid);
if std::path::Path::new(&face_cluster_path).exists() {
if let Ok(content) = std::fs::read_to_string(&face_cluster_path) {
@@ -1649,7 +1666,13 @@ pub async fn get_scene_vlm_stats(
State(state): State<AppState>,
Path(file_uuid): Path<String>,
) -> Result<Json<SceneVlmStats>, StatusCode> {
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
let per_lib = crate::core::config::get_output_dir_for_file(&file_uuid, state.db.pool()).await;
let global_dir = crate::core::config::OUTPUT_DIR.as_str();
let output_dir = if std::path::Path::new(&per_lib).is_dir() {
per_lib
} else {
global_dir.to_string()
};
let scenes_path = format!("{}/{}.scenes.json", output_dir, file_uuid);
if !std::path::Path::new(&scenes_path).exists() {
+217
View File
@@ -0,0 +1,217 @@
use std::time::Duration;
use axum::{Json, Router};
use serde_json::json;
use tokio::time::timeout;
use tower_http::cors::{Any, CorsLayer};
use tower_http::services::ServeDir;
use crate::core::cache::{MongoCache, RedisCache};
use crate::core::db::{Database, PostgresDb, QdrantDb};
use crate::Embedder;
use super::admin_config;
use super::agent_api;
use super::agent_search;
use super::auth;
use super::billing;
use super::checkin_api;
use super::clip_api;
use super::cluster_agent;
use super::docs;
use super::face_filter;
use super::file_progress;
use super::files;
use super::health;
use super::health::{health, health_consistency, health_detailed, health_queue};
use super::identities;
use super::identity_api;
use super::identity_binding;
use super::llm_search;
use super::markbase_compat;
use super::media_api;
use super::middleware::unified_auth;
use super::pipeline;
use super::processing;
use super::profile;
use super::scan;
use super::search::search_routes;
use super::service_management;
use super::tmdb_api;
use super::trace_agent_api;
use super::types::AppState;
use super::monitor;
use super::universal_search::universal_search_routes;
use super::vlm_search;
use super::job_management;
pub async fn start_server(host: &str, port: u16) -> anyhow::Result<()> {
health::init_server_state(host, port);
let embedder = std::sync::Arc::new(Embedder::new("embeddinggemma-300m".to_string()));
// ── ⚠️ WARNING: DO NOT move MongoCache::init() back to critical path ──
//
// MongoDB is ONLY a cache layer — if unavailable, the server MUST still
// start with Redis cache alone. This keeps 3002 bootable on machines
// without MongoDB installed. If you add a new dependency here, ask:
// "Can this service degrade gracefully if the dependant is missing?"
//
// See also: MongoCache::disabled() in mongo_cache.rs
let mongo_cache = match timeout(Duration::from_secs(5), MongoCache::init()).await {
Ok(Ok(cache)) => cache,
Ok(Err(e)) => {
tracing::warn!("MongoDB cache unavailable (continuing without): {e}");
MongoCache::disabled().await
}
Err(_) => {
tracing::warn!("MongoDB init timed out (continuing without cache)");
MongoCache::disabled().await
}
};
let redis_cache = RedisCache::new()?;
let db = PostgresDb::init().await?;
// Run migrations (create identity_history table if not exists)
PostgresDb::run_migrations(db.pool()).await?;
let schema_health = health::check_schema_migrations(db.pool()).await;
if schema_health.ok {
tracing::info!(
"[SCHEMA] All {}/{} required migrations applied ✓",
schema_health.required.len(),
schema_health.required.len()
);
} else if !schema_health.table_exists {
tracing::warn!("[SCHEMA] schema_migrations table not found!");
} else {
let missing: Vec<&str> = schema_health
.required
.iter()
.filter(|req| {
!schema_health
.applied
.iter()
.any(|app| app.filename == req.filename && app.checksum == req.checksum)
})
.map(|m| m.filename.as_str())
.collect();
tracing::warn!(
"[SCHEMA] {}/{} migrations match. Missing: {}",
schema_health.applied.len(),
schema_health.required.len(),
missing.join(", ")
);
}
let db = std::sync::Arc::new(db);
let api_state = super::middleware::ApiState { db: db.clone() };
let qdrant = std::sync::Arc::new(QdrantDb::new());
// Initialize AdminConfigManager
let admin_config_manager = std::sync::Arc::new(
crate::core::admin_config::AdminConfigManager::new(
&crate::core::admin_config::get_default_config_path(),
)
.expect("Failed to initialize AdminConfigManager"),
);
// Ensure trash collection exists for trace hard-delete undo
if let Err(e) = qdrant.ensure_collection("_faces_trash", 512).await {
tracing::warn!("[Server] Failed to ensure _faces_trash collection: {}", e);
}
let state = AppState {
db,
qdrant,
embedder,
embedder_model: "nomic-embed-text-v2-moe:latest".to_string(),
mongo_cache,
redis_cache,
api_state,
admin_config_manager,
};
let protected_routes = Router::new()
.merge(files::file_routes())
.merge(markbase_compat::markbase_routes())
.merge(scan::scan_routes())
.merge(identity_binding::identity_binding_routes())
.merge(identities::identity_routes())
.merge(tmdb_api::tmdb_routes())
.merge(identity_api::identity_routes())
.merge(agent_api::agent_routes())
.merge(agent_search::agent_search_routes())
.merge(processing::processing_routes())
.merge(file_progress::file_progress_routes())
.merge(media_api::bbox_routes())
.merge(media_api::media_proxy_routes())
.merge(media_api::pose_appearance_routes())
.merge(trace_agent_api::trace_agent_routes())
.merge(clip_api::clip_routes())
.merge(search_routes())
.merge(llm_search::llm_smart_routes())
.merge(universal_search_routes())
.merge(pipeline::pipeline_routes())
.merge(checkin_api::checkin_routes())
.merge(cluster_agent::cluster_agent_routes())
.merge(profile::profile_routes())
.merge(face_filter::face_filter_routes())
.merge(admin_config::admin_config_routes())
.merge(vlm_search::vlm_search_routes())
.merge(billing::billing_routes())
.merge(job_management::job_management_routes())
.merge(service_management::router())
.layer(axum::middleware::from_fn_with_state(
state.api_state.clone(),
unified_auth,
))
.with_state(state.clone());
let cors = CorsLayer::new()
.allow_origin(Any)
.allow_methods(Any)
.allow_headers(Any);
let public_health_routes = Router::new()
.route("/api/v1/health", axum::routing::get(health))
.route(
"/api/v1/health/detailed",
axum::routing::get(health_detailed),
)
.route(
"/api/v1/health/consistency",
axum::routing::get(health_consistency),
)
.route(
"/api/v1/health/queue",
axum::routing::get(health_queue),
)
.route(
"/api/v1/mbe/health",
axum::routing::get(service_management::mbe_health),
);
let app = Router::new()
.merge(auth::auth_routes())
.merge(public_health_routes)
.merge(docs::doc_routes())
.merge(monitor::monitor_routes())
.nest_service("/monitor", ServeDir::new("static/monitor"))
.merge(protected_routes)
.layer(cors)
.layer(axum::middleware::from_fn(super::middleware::request_logger))
.layer(axum::middleware::from_fn(
super::middleware::concurrency_limit,
))
.with_state(state);
let addr: std::net::SocketAddr = format!("{}:{}", host, port).parse().unwrap();
tracing::info!("Starting API server at http://{}", addr);
let listener = tokio::net::TcpListener::bind(addr).await?;
axum::serve(listener, app).await?;
Ok(())
}
+219 -5
View File
@@ -60,13 +60,13 @@ fn svc_def(name: &str) -> Option<(&'static str, u16, Option<&'static str>)> {
"markbase" | "mb" => ("markbase", 11438, Some("com.momentry.markbase")),
"mbe" | "markbaseengine" | "vlm" => ("mbe", 8082, Some("com.momentry.llm")), // MBE = markbaseengine service; spawns VLM llama-server (8082)
"chat" | "llama" => ("chat", 8080, Some("com.momentry.chat-llamacpp")), // Chat llama-server instance (8080)
"embedding" => ("embedding", 11437, Some("com.momentry.embedding-gguf")),
"embedding" => ("embedding", 11436, Some("com.momentry.embedding-gguf")),
"proxy" => ("proxy", 8888, Some("com.momentry.proxy")),
"worker" => ("worker", 0, Some("com.momentry.worker")),
"postgres" | "postgresql" | "pg" => ("postgres", 5432, Some("com.momentry.postgresql")),
// NOTE: the redis actually serving 127.0.0.1:6379 is brew-services' launchd agent,
// not com.momentry.redis (which can't bind while brew's owns the port).
"redis" => ("redis", 6379, Some("sh.brew.redis")),
"redis" => ("redis", 6379, Some("com.momentry.redis")),
"qdrant" => ("qdrant", 6333, Some("com.momentry.qdrant")),
_ => return None,
};
@@ -1085,6 +1085,7 @@ pub fn router() -> axum::Router<AppState> {
axum::Router::new()
.route("/api/v2/service/start", axum::routing::post(start_service))
.route("/api/v2/service/stop", axum::routing::post(stop_service))
.route("/api/v1/admin/rebuild-embeddings", axum::routing::post(rebuild_embeddings))
// NOTE: /api/v1/mbe/health is already registered in server.rs (line 192)
}
@@ -1101,10 +1102,10 @@ pub async fn test_embedding(
.unwrap_or_else(|_| "http://localhost:11436".to_string());
// Detect server type from URL port
let server_type = if url.contains("11437") {
let server_type = if url.contains("11436") {
"llama.cpp GGUF Q8"
} else if url.contains("11436") {
"Python Flask (safetensors fp32)"
} else if url.contains("11437") {
"llama.cpp GGUF Q8 (alt)"
} else {
"unknown"
};
@@ -1693,6 +1694,219 @@ pub async fn test_core(
Ok(Json(result))
}
/// POST /api/v1/admin/rebuild-embeddings — rebuild text/scene embeddings
/// with the current (possibly updated) embedding model.
///
/// Body: `{ "collection": "momentry_rule1" | "_scenes" | "all", "file_uuid": "optional" }`
/// Uses the Rust `Embedder` (same code path as production).
pub async fn rebuild_embeddings(
State(state): State<AppState>,
Json(body): Json<serde_json::Value>,
) -> Result<Json<serde_json::Value>, StatusCode> {
use crate::core::embedding::Embedder;
use crate::core::db::{schema, QdrantDb};
let collection = body.get("collection").and_then(|v| v.as_str()).unwrap_or("all");
let file_uuid = body.get("file_uuid").and_then(|v| v.as_str());
let embedder = Embedder::new("embeddinggemma-300m".to_string());
let qdrant = QdrantDb::new();
let chunk_table = schema::table_name("chunk");
let scenes_table = schema::table_name("scenes");
let mut results = serde_json::json!({});
let t0 = std::time::Instant::now();
// ── Rebuild text chunks (sentence) → momentry_rule1 ──
if collection == "all" || collection == "momentry_rule1" {
let mut ok = 0usize;
let mut fail = 0usize;
// Clear existing points for this file_uuid (or all if no filter)
if let Some(uuid) = file_uuid {
let _ = qdrant.delete_points_by_filter("momentry_rule1", serde_json::json!({
"must": [{"key": "file_uuid", "match": {"value": uuid}}]
})).await;
} else {
// Delete all in collection: use empty filter to match everything
let _ = qdrant.delete_points_by_filter("momentry_rule1", serde_json::json!({})).await;
}
// Query chunks that need re-embedding
let query = if let Some(uuid) = file_uuid {
format!(
"SELECT chunk_id, text_content, start_frame, end_frame, start_time, end_time, chunk_type, file_uuid \
FROM {} WHERE chunk_type = 'sentence' AND text_content IS NOT NULL AND text_content != '' AND file_uuid = $1 \
ORDER BY id",
chunk_table
)
} else {
format!(
"SELECT chunk_id, text_content, start_frame, end_frame, start_time, end_time, chunk_type, file_uuid \
FROM {} WHERE chunk_type = 'sentence' AND text_content IS NOT NULL AND text_content != '' \
ORDER BY id",
chunk_table
)
};
let rows: Vec<(String, String, i64, i64, f64, f64, String, String)> = if file_uuid.is_some() {
sqlx::query_as(&query)
.bind(file_uuid.unwrap())
.fetch_all(state.db.pool())
.await
.unwrap_or_default()
} else {
sqlx::query_as(&query)
.fetch_all(state.db.pool())
.await
.unwrap_or_default()
};
let total = rows.len();
for (chunk_id, text, start_frame, end_frame, start_time, end_time, chunk_type, fuuid) in &rows {
match embedder.embed_document(text).await {
Ok(vector) => {
// Update PG embedding column
let vector_json = serde_json::to_string(&vector).unwrap_or_default();
let _ = sqlx::query(&format!(
"UPDATE {} SET embedding = $1::vector WHERE chunk_id = $2 AND file_uuid = $3",
chunk_table
))
.bind(&vector_json)
.bind(chunk_id)
.bind(fuuid)
.execute(state.db.pool())
.await;
// Upsert to Qdrant
let payload = crate::core::db::VectorPayload {
file_uuid: fuuid.clone(),
chunk_id: chunk_id.clone(),
chunk_type: chunk_type.clone(),
start_frame: *start_frame,
end_frame: *end_frame,
start_time: *start_time,
end_time: *end_time,
text: Some(text.clone()),
};
if qdrant.upsert_vector(chunk_id, &vector, payload).await.is_ok() {
ok += 1;
} else {
fail += 1;
}
}
Err(e) => {
tracing::error!("[rebuild-embed] Failed to embed {}: {}", chunk_id, e);
fail += 1;
}
}
}
results["momentry_rule1"] = serde_json::json!({
"total": total,
"ok": ok,
"fail": fail,
});
}
// ── Rebuild scene embeddings → _scenes ──
if collection == "all" || collection == "_scenes" {
let mut ok = 0usize;
let mut fail = 0usize;
// Clear existing scene points
if let Some(uuid) = file_uuid {
let _ = qdrant.delete_points_by_filter("_scenes", serde_json::json!({
"must": [{"key": "file_uuid", "match": {"value": uuid}}]
})).await;
} else {
// Delete all in _scenes: use empty filter to match everything
let _ = qdrant.delete_points_by_filter("_scenes", serde_json::json!({})).await;
}
// Query scenes with VLM descriptions
let query = if let Some(uuid) = file_uuid {
format!(
"SELECT id, file_uuid, scene_index, timestamp_sec, frame_number, \
COALESCE(vlm_description_localized, vlm_description) as description \
FROM {} WHERE file_uuid = $1 AND (vlm_description_localized IS NOT NULL OR vlm_description IS NOT NULL) \
ORDER BY id",
scenes_table
)
} else {
format!(
"SELECT id, file_uuid, scene_index, timestamp_sec, frame_number, \
COALESCE(vlm_description_localized, vlm_description) as description \
FROM {} WHERE vlm_description_localized IS NOT NULL OR vlm_description IS NOT NULL \
ORDER BY id",
scenes_table
)
};
let rows: Vec<(i64, String, i32, f64, i64, String)> = if file_uuid.is_some() {
sqlx::query_as(&query)
.bind(file_uuid.unwrap())
.fetch_all(state.db.pool())
.await
.unwrap_or_default()
} else {
sqlx::query_as(&query)
.fetch_all(state.db.pool())
.await
.unwrap_or_default()
};
let total = rows.len();
for (scene_id, fuuid, scene_index, timestamp_sec, frame_number, description) in &rows {
match embedder.embed_document(description).await {
Ok(vector) => {
let point_id_str = format!("{}_s{}", fuuid, scene_index);
let point_id = {
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
let mut hasher = DefaultHasher::new();
point_id_str.hash(&mut hasher);
hasher.finish()
};
if qdrant.upsert_scene_embedding(
point_id,
&vector,
fuuid,
*scene_index as usize,
*timestamp_sec,
*frame_number as u32,
description,
None,
&[],
&[],
).await.is_ok() {
ok += 1;
} else {
fail += 1;
}
}
Err(e) => {
tracing::error!("[rebuild-embed] Failed to embed scene {}: {}", scene_id, e);
fail += 1;
}
}
}
results["_scenes"] = serde_json::json!({
"total": total,
"ok": ok,
"fail": fail,
});
}
results["elapsed_ms"] = serde_json::json!(t0.elapsed().as_millis());
results["collection"] = serde_json::json!(collection);
results["file_uuid"] = serde_json::json!(file_uuid);
Ok(Json(results))
}
/// GET /api/v1/admin/components — full component registry with versions
/// Returns all system components: binaries, tools, scripts, dists, externals
/// Each with current file hash, size, repo mapping, and latest Gitea commit.
+19 -5
View File
@@ -237,7 +237,7 @@ async fn list_traces_sorted(
entry.best_bbox = bbox;
} else {
// 如果 Qdrant 沒有,從 trace_profile.json 讀取
if let Some(profile) = read_trace_profile(&file_uuid, trace_id) {
if let Some(profile) = read_trace_profile(state.db.pool(), &file_uuid, trace_id).await {
entry.best_bbox = profile.get("best_bbox").cloned();
}
}
@@ -252,7 +252,7 @@ async fn list_traces_sorted(
entry.best_capture_bbox = bbox;
} else {
// 如果 Qdrant 沒有,從 trace_profile.json 讀取
if let Some(profile) = read_trace_profile(&file_uuid, trace_id) {
if let Some(profile) = read_trace_profile(state.db.pool(), &file_uuid, trace_id).await {
entry.best_capture_bbox = profile.get("best_bbox").cloned();
}
}
@@ -2805,9 +2805,23 @@ fn tkg_snapshot_count(before_snapshot: &serde_json::Value) -> usize {
}
/// Read trace_profile.json for a given file_uuid and trace_id.
fn read_trace_profile(file_uuid: &str, trace_id: i32) -> Option<serde_json::Value> {
/// Tries per-library output dir first, falls back to global OUTPUT_DIR.
async fn read_trace_profile(pool: &sqlx::PgPool, file_uuid: &str, trace_id: i32) -> Option<serde_json::Value> {
use std::path::PathBuf;
// Try per-library output dir first
let per_lib = crate::core::config::get_output_dir_for_file(file_uuid, pool).await;
let candidate: PathBuf = PathBuf::from(&per_lib)
.join(file_uuid)
.join(format!("trace_{}", trace_id))
.join("trace_profile.json");
if let Ok(content) = std::fs::read_to_string(&candidate) {
if let Ok(profile) = serde_json::from_str::<serde_json::Value>(&content) {
return Some(profile);
}
}
// Fallback: global OUTPUT_DIR (legacy)
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let profile_path: PathBuf = [
output_dir,
@@ -2817,7 +2831,6 @@ fn read_trace_profile(file_uuid: &str, trace_id: i32) -> Option<serde_json::Valu
]
.iter()
.collect();
if let Ok(content) = std::fs::read_to_string(&profile_path) {
if let Ok(profile) = serde_json::from_str::<serde_json::Value>(&content) {
return Some(profile);
@@ -2829,6 +2842,7 @@ fn read_trace_profile(file_uuid: &str, trace_id: i32) -> Option<serde_json::Valu
/// GET /api/v1/trace-profile-file?file_uuid=...&trace_id=...
/// Returns the trace_profile.json for a given file and trace.
async fn get_trace_profile_file(
State(state): State<crate::api::types::AppState>,
Query(params): Query<std::collections::HashMap<String, String>>,
) -> impl IntoResponse {
let file_uuid = match params.get("file_uuid") {
@@ -2840,7 +2854,7 @@ async fn get_trace_profile_file(
None => return (StatusCode::BAD_REQUEST, Json(serde_json::json!({"error": "Missing or invalid trace_id"}))),
};
match read_trace_profile(&file_uuid, trace_id) {
match read_trace_profile(state.db.pool(), &file_uuid, trace_id).await {
Some(profile) => (StatusCode::OK, Json(profile)),
None => {
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
+166 -3
View File
@@ -146,8 +146,21 @@ async fn unregister_file_from_system(
// 1. Delete from Qdrant (best effort)
// TODO: Implement Qdrant deletion
// 2. Delete output files
delete_output_files(uuid, output_dir);
// 2. Delete output files (all libraries: per-library + global + all upload_paths)
delete_output_files(uuid, output_dir).await;
let per_lib = crate::core::config::get_output_dir_for_file(uuid, pool).await;
if !per_lib.is_empty() && per_lib != output_dir {
delete_output_files(uuid, &per_lib).await;
}
if let Ok(rows) = sqlx::query_scalar::<_, String>(
"SELECT output_path FROM upload_paths WHERE enabled = true AND output_path IS NOT NULL"
).fetch_all(pool).await {
for dir in rows {
if !dir.is_empty() && dir != output_dir && dir != per_lib {
delete_output_files(uuid, &dir).await;
}
}
}
// 3. Delete original video (if not keeping)
if !keep_video {
@@ -218,7 +231,7 @@ async fn unregister_file_from_system(
Ok(deleted)
}
fn delete_output_files(uuid: &str, output_dir: &str) {
async fn delete_output_files(uuid: &str, output_dir: &str) {
let dir = std::path::PathBuf::from(output_dir);
// Delete JSON files: {uuid}.*.json
@@ -240,9 +253,159 @@ fn delete_output_files(uuid: &str, output_dir: &str) {
}
}
// ─── Delete API (true delete, not unregister) ────────────────────────────────
#[derive(Debug, Deserialize)]
pub struct DeleteUnregisteredRequest {
pub path: String,
}
#[derive(Debug, Serialize)]
pub struct DeleteUnregisteredResponse {
pub success: bool,
pub deleted_file: bool,
pub deleted_db: bool,
pub file_uuid: Option<String>,
pub message: String,
}
/// Resolve the rust_unregister binary the same way files.rs unregister does.
fn resolve_rust_unregister_binary() -> std::path::PathBuf {
std::env::var_os("MOMENTRY_RUST_UNREGISTER")
.map(std::path::PathBuf::from)
.filter(|p| p.is_file())
.or_else(|| {
std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(|d| d.join("rust_unregister")))
.filter(|p| p.is_file())
})
.unwrap_or_else(|| std::path::PathBuf::from("target/release/rust_unregister"))
}
/// Storage root for path validation (prevent arbitrary file deletion).
fn storage_roots() -> Vec<std::path::PathBuf> {
let home = std::env::var("HOME").unwrap_or_default();
let mut roots = vec![];
if let Ok(r) = std::env::var("MOMENTRY_STORAGE_ROOT") {
roots.push(std::path::PathBuf::from(r));
}
roots.push(std::path::PathBuf::from(format!(
"{}/momentry/var/sftpgo/data",
home
)));
roots
}
/// POST /api/v1/file/delete-unregistered
/// Permanently delete an unregistered/leftover entry:
/// - disk file (if still present)
/// - videos row + all related records + outputs + Qdrant + Redis (via rust_unregister)
pub async fn delete_unregistered_handler(
State(_state): State<AppState>,
Json(req): Json<DeleteUnregisteredRequest>,
) -> Result<Json<DeleteUnregisteredResponse>, (StatusCode, Json<serde_json::Value>)> {
let path = std::path::PathBuf::from(&req.path);
// Security: only allow deletion inside the storage roots
let canonical = path
.canonicalize()
.unwrap_or_else(|_| std::path::PathBuf::from(&req.path));
let allowed = storage_roots()
.iter()
.filter_map(|r| r.canonicalize().ok())
.any(|r| canonical.starts_with(&r));
if !allowed {
return Err((
StatusCode::FORBIDDEN,
Json(serde_json::json!({
"error": "Path is outside the storage root",
"path": req.path
})),
));
}
// 1. Delete disk file (if still present)
let mut deleted_file = false;
if canonical.exists() {
match std::fs::remove_file(&canonical) {
Ok(()) => {
deleted_file = true;
tracing::info!("[DELETE] Removed file: {}", canonical.display());
}
Err(e) => {
tracing::warn!("[DELETE] Failed to remove file {}: {}", canonical.display(), e);
}
}
}
// 2. Find a leftover DB row by file_path → full cleanup via rust_unregister
let uuid: Option<String> = sqlx::query_scalar("SELECT file_uuid FROM videos WHERE file_path = $1")
.bind(&req.path)
.fetch_optional(_state.db.pool())
.await
.ok()
.flatten();
let mut deleted_db = false;
if let Some(ref uuid) = uuid {
let binary_path = resolve_rust_unregister_binary();
if !binary_path.is_file() {
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(serde_json::json!({
"error": format!("rust_unregister binary not found at {:?}", binary_path)
})),
));
}
let output = std::process::Command::new(&binary_path)
.args(["--uuid", &uuid])
.output()
.map_err(|e| {
tracing::error!("[DELETE] Failed to execute rust_unregister: {:?}", e);
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(serde_json::json!({"error": format!("rust_unregister failed: {}", e)})),
)
})?;
if output.status.success() {
deleted_db = true;
tracing::info!("[DELETE] rust_unregister cleaned DB/Qdrant/Redis for {}", uuid);
} else {
let stderr = String::from_utf8_lossy(&output.stderr);
tracing::error!("[DELETE] rust_unregister failed for {}: {}", uuid, stderr);
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(serde_json::json!({
"error": format!("rust_unregister exit {:?}: {}", output.status.code(), stderr.trim())
})),
));
}
}
let message = match (deleted_file, deleted_db) {
(true, true) => "File and database records deleted".to_string(),
(true, false) => "File deleted".to_string(),
(false, true) => "Database records deleted".to_string(),
(false, false) => "Nothing to delete (entry not found)".to_string(),
};
Ok(Json(DeleteUnregisteredResponse {
success: true,
deleted_file,
deleted_db,
file_uuid: uuid,
message,
}))
}
// ─── Router ──────────────────────────────────────────────────────────────────
pub fn unregister_routes() -> Router<AppState> {
Router::new()
.route("/api/v1/file/:uuid/unregister", post(unregister_file_handler))
.route(
"/api/v1/file/delete-unregistered",
post(delete_unregistered_handler),
)
}
+87
View File
@@ -66,12 +66,15 @@ pub struct UpdateUploadPathRequest {
// ── Routes ──────────────────────────────────────────────────────────
pub fn upload_path_routes() -> Router<AppState> {
use axum::routing::post;
Router::new()
.route("/api/v1/admin/upload-paths", get(list_upload_paths))
.route("/api/v1/admin/upload-paths", post(create_upload_path))
.route("/api/v1/admin/upload-paths/:id", get(get_upload_path))
.route("/api/v1/admin/upload-paths/:id", put(update_upload_path))
.route("/api/v1/admin/upload-paths/:id", delete(delete_upload_path))
.route("/api/v2/settings", post(save_legacy_settings))
.route("/api/v2/settings/validate", post(validate_legacy_settings))
}
// ── Handlers ────────────────────────────────────────────────────────
@@ -253,3 +256,87 @@ async fn delete_upload_path(
info!("[upload_paths] deleted id={}", id);
Ok(Json(serde_json::json!({"success": true})))
}
// ── Legacy settings compatibility (/api/v2/settings) ─────────────────
#[derive(Debug, Deserialize)]
struct LegacySettingsRequest {
server: Option<LegacyServerSettings>,
}
#[derive(Debug, Deserialize)]
struct LegacyServerSettings {
upload_path: Option<String>,
}
/// POST /api/v2/settings — legacy compatibility for admin upload path
pub async fn save_legacy_settings(
State(state): State<AppState>,
Json(req): Json<LegacySettingsRequest>,
) -> Result<Json<serde_json::Value>, StatusCode> {
let upload_path = req.server.and_then(|s| s.upload_path).unwrap_or_default();
if upload_path.is_empty() {
return Ok(Json(serde_json::json!({
"success": false,
"error": "upload_path is required"
})));
}
let pool = state.db.pool();
let name = std::path::Path::new(&upload_path)
.file_name()
.map(|n| n.to_string_lossy().to_string())
.unwrap_or_else(|| upload_path.replace('/', "_"));
// Check if already exists
let existing: Option<i32> = sqlx::query_scalar(
"SELECT id FROM upload_paths WHERE full_path = $1"
)
.bind(&upload_path)
.fetch_optional(pool)
.await
.map_err(|e| {
error!("[settings] query failed: {}", e);
StatusCode::INTERNAL_SERVER_ERROR
})?;
if let Some(id) = existing {
let _ = sqlx::query("UPDATE upload_paths SET enabled = true, updated_at = NOW() WHERE id = $1")
.bind(id)
.execute(pool)
.await;
} else {
let output_path = format!("/Users/accusys/momentry/output/{}", name);
let _ = sqlx::query(
"INSERT INTO upload_paths (name, base_path, sub_path, full_path, output_path, enabled)
VALUES ($1, $2, '', $3, $4, true) ON CONFLICT (name) DO UPDATE SET enabled = true, updated_at = NOW()"
)
.bind(&name)
.bind(&upload_path)
.bind(&upload_path)
.bind(&output_path)
.execute(pool)
.await;
}
info!("[settings] saved upload_path: {}", upload_path);
Ok(Json(serde_json::json!({
"success": true,
"message": "Upload path saved successfully"
})))
}
/// POST /api/v2/settings/validate — always valid (no restrictions)
pub async fn validate_legacy_settings(
Json(req): Json<LegacySettingsRequest>,
) -> Result<Json<serde_json::Value>, StatusCode> {
let upload_path = req.server.and_then(|s| s.upload_path).unwrap_or_default();
Ok(Json(serde_json::json!({
"success": true,
"valid": true,
"message": format!("Path is valid: {}", upload_path),
"details": {
"absolute_path": upload_path
}
})))
}
+267
View File
@@ -0,0 +1,267 @@
//! Standalone embedding rebuild tool.
//!
//! Rebuilds text/scene embeddings with the current embedding model.
//! Uses the Rust `Embedder` (same code path as production).
//!
//! Usage:
//! cargo run --release --bin rebuild_embeddings -- --collection momentry_rule1
//! cargo run --release --bin rebuild_embeddings -- --collection _scenes
//! cargo run --release --bin rebuild_embeddings -- --collection all
//! cargo run --release --bin rebuild_embeddings -- --collection momentry_rule1 --uuid abc123
use anyhow::{Context, Result};
use dotenv::dotenv;
use momentry_core::core::config;
use momentry_core::core::db::{schema, QdrantDb, VectorPayload};
use momentry_core::core::embedding::Embedder;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
#[derive(clap::Parser)]
#[command(name = "rebuild_embeddings", about = "Rebuild embeddings with current model")]
struct Args {
/// Collection to rebuild: momentry_rule1, _scenes, or all
#[arg(short, long, default_value = "all")]
collection: String,
/// Optional file UUID to rebuild only one video
#[arg(short, long)]
uuid: Option<String>,
/// Skip PG embedding column update (only update Qdrant)
#[arg(long)]
skip_pg: bool,
}
async fn rebuild_text_chunks(db: &momentry_core::core::db::postgres_db::PostgresDb, qdrant: &QdrantDb, embedder: &Embedder, file_uuid: Option<&str>, skip_pg: bool) -> Result<(usize, usize)> {
let chunk_table = schema::table_name("chunk");
let mut ok = 0usize;
let mut fail = 0usize;
// Clear existing points
if let Some(uuid) = file_uuid {
let _ = qdrant.delete_points_by_filter("momentry_rule1", serde_json::json!({
"must": [{"key": "file_uuid", "match": {"value": uuid}}]
})).await;
println!(" Cleared points for file_uuid={}", uuid);
} else {
let _ = qdrant.delete_points_by_filter("momentry_rule1", serde_json::json!({})).await;
println!(" Cleared all points in momentry_rule1");
}
// Query chunks
let query = if let Some(uuid) = file_uuid {
format!(
"SELECT chunk_id, text_content, start_frame, end_frame, start_time, end_time, chunk_type, file_uuid \
FROM {} WHERE chunk_type = 'sentence' AND text_content IS NOT NULL AND text_content != '' AND file_uuid = $1 \
ORDER BY id",
chunk_table
)
} else {
format!(
"SELECT chunk_id, text_content, start_frame, end_frame, start_time, end_time, chunk_type, file_uuid \
FROM {} WHERE chunk_type = 'sentence' AND text_content IS NOT NULL AND text_content != '' \
ORDER BY id",
chunk_table
)
};
let rows: Vec<(String, String, i64, i64, f64, f64, String, String)> = if file_uuid.is_some() {
sqlx::query_as(&query)
.bind(file_uuid.unwrap())
.fetch_all(db.pool())
.await
.unwrap_or_default()
} else {
sqlx::query_as(&query)
.fetch_all(db.pool())
.await
.unwrap_or_default()
};
let total = rows.len();
println!(" Found {} sentence chunks to rebuild", total);
for (i, (chunk_id, text, start_frame, end_frame, start_time, end_time, chunk_type, fuuid)) in rows.iter().enumerate() {
if text.is_empty() {
continue;
}
match embedder.embed_document(text).await {
Ok(vector) => {
// Update PG embedding column if not skipped
if !skip_pg {
let vector_json = serde_json::to_string(&vector).unwrap_or_default();
let _ = sqlx::query(&format!(
"UPDATE {} SET embedding = $1::vector WHERE chunk_id = $2 AND file_uuid = $3",
chunk_table
))
.bind(&vector_json)
.bind(chunk_id)
.bind(fuuid)
.execute(db.pool())
.await;
}
// Upsert to Qdrant
let payload = VectorPayload {
file_uuid: fuuid.clone(),
chunk_id: chunk_id.clone(),
chunk_type: chunk_type.clone(),
start_frame: *start_frame,
end_frame: *end_frame,
start_time: *start_time,
end_time: *end_time,
text: Some(text.clone()),
};
if qdrant.upsert_vector(chunk_id, &vector, payload).await.is_ok() {
ok += 1;
} else {
fail += 1;
}
if (i + 1) % 50 == 0 || i + 1 == total {
println!(" Progress: {}/{} (ok={}, fail={})", i + 1, total, ok, fail);
}
}
Err(e) => {
eprintln!(" ✗ Failed to embed {}: {}", chunk_id, e);
fail += 1;
}
}
}
Ok((ok, fail))
}
async fn rebuild_scenes(db: &momentry_core::core::db::postgres_db::PostgresDb, qdrant: &QdrantDb, embedder: &Embedder, file_uuid: Option<&str>) -> Result<(usize, usize)> {
let scenes_table = schema::table_name("scenes");
let mut ok = 0usize;
let mut fail = 0usize;
// Clear existing scene points
if let Some(uuid) = file_uuid {
let _ = qdrant.delete_points_by_filter("_scenes", serde_json::json!({
"must": [{"key": "file_uuid", "match": {"value": uuid}}]
})).await;
println!(" Cleared scene points for file_uuid={}", uuid);
} else {
let _ = qdrant.delete_points_by_filter("_scenes", serde_json::json!({})).await;
println!(" Cleared all points in _scenes");
}
// Query scenes with VLM descriptions
let query = if let Some(uuid) = file_uuid {
format!(
"SELECT id, file_uuid, scene_index, timestamp_sec, frame_number, \
COALESCE(vlm_description_localized, vlm_description) as description \
FROM {} WHERE file_uuid = $1 AND (vlm_description_localized IS NOT NULL OR vlm_description IS NOT NULL) \
ORDER BY id",
scenes_table
)
} else {
format!(
"SELECT id, file_uuid, scene_index, timestamp_sec, frame_number, \
COALESCE(vlm_description_localized, vlm_description) as description \
FROM {} WHERE vlm_description_localized IS NOT NULL OR vlm_description IS NOT NULL \
ORDER BY id",
scenes_table
)
};
let rows: Vec<(i64, String, i32, f64, i64, String)> = if file_uuid.is_some() {
sqlx::query_as(&query)
.bind(file_uuid.unwrap())
.fetch_all(db.pool())
.await
.unwrap_or_default()
} else {
sqlx::query_as(&query)
.fetch_all(db.pool())
.await
.unwrap_or_default()
};
let total = rows.len();
println!(" Found {} scenes to rebuild", total);
for (i, (scene_id, fuuid, scene_index, timestamp_sec, frame_number, description)) in rows.iter().enumerate() {
match embedder.embed_document(description).await {
Ok(vector) => {
let point_id_str = format!("{}_s{}", fuuid, scene_index);
let point_id = {
let mut hasher = DefaultHasher::new();
point_id_str.hash(&mut hasher);
hasher.finish()
};
if qdrant.upsert_scene_embedding(
point_id,
&vector,
fuuid,
*scene_index as usize,
*timestamp_sec,
*frame_number as u32,
description,
None,
&[],
&[],
).await.is_ok() {
ok += 1;
} else {
fail += 1;
}
if (i + 1) % 50 == 0 || i + 1 == total {
println!(" Progress: {}/{} (ok={}, fail={})", i + 1, total, ok, fail);
}
}
Err(e) => {
eprintln!(" ✗ Failed to embed scene {}: {}", scene_id, e);
fail += 1;
}
}
}
Ok((ok, fail))
}
#[tokio::main]
async fn main() -> Result<()> {
use clap::Parser;
dotenv().ok();
let args = Args::parse();
println!("═══ Embedding Rebuild Tool ═══");
println!("Collection: {}", args.collection);
if let Some(uuid) = &args.uuid {
println!("File UUID: {}", uuid);
}
println!("Skip PG update: {}", args.skip_pg);
println!();
let db = momentry_core::core::db::postgres_db::PostgresDb::new(&config::DATABASE_URL).await
.context("Failed to connect to PostgreSQL")?;
let qdrant = QdrantDb::new();
let embedder = Embedder::new("embeddinggemma-300m".to_string());
let t0 = std::time::Instant::now();
if args.collection == "all" || args.collection == "momentry_rule1" {
println!("── Rebuilding momentry_rule1 (text chunks) ──");
let (ok, fail) = rebuild_text_chunks(&db, &qdrant, &embedder, args.uuid.as_deref(), args.skip_pg).await?;
println!(" Result: {}/{} succeeded, {} failed\n", ok, ok + fail, fail);
}
if args.collection == "all" || args.collection == "_scenes" {
println!("── Rebuilding _scenes (scene embeddings) ──");
let (ok, fail) = rebuild_scenes(&db, &qdrant, &embedder, args.uuid.as_deref()).await?;
println!(" Result: {}/{} succeeded, {} failed\n", ok, ok + fail, fail);
}
let elapsed = t0.elapsed();
println!("═══ Total time: {:.1}s ═══", elapsed.as_secs_f64());
Ok(())
}
+8 -2
View File
@@ -3976,8 +3976,14 @@ pub async fn get_session_by_id(
"processor": processor,
"status": status,
});
let path = std::path::Path::new(crate::core::config::OUTPUT_DIR.as_str())
.join(format!("pipeline_{}.log", uuid));
// Pipeline timeline logs go to the output ROOT (parent of per-library dir).
// OUTPUT_DIR may be a per-library dir like output/demo — strip it to output/.
let output_root = std::path::Path::new(crate::core::config::OUTPUT_DIR.as_str())
.parent()
.filter(|p| p.file_name().and_then(|n| n.to_str()) == Some("output"))
.map(|p| p.to_path_buf())
.unwrap_or_else(|| std::path::PathBuf::from(crate::core::config::OUTPUT_DIR.as_str()));
let path = output_root.join(format!("pipeline_{}.log", uuid));
if let Ok(mut file) = std::fs::OpenOptions::new()
.create(true)
.append(true)
+27 -2
View File
@@ -126,14 +126,39 @@ pub fn create_meta(
/// 建立 _debug 區塊
pub fn create_debug(path: &Path) -> DebugFooter {
// 從實際路徑推導 output_dir(取父目錄或上兩層)
let output_dir = if let Some(parent) = path.parent() {
// 如果路徑是 /output/test/uuid/trace_N/trace_profile.json → /output/test
// 如果路徑是 /output/test/uuid.face.json → /output/test
let path_str = parent.to_string_lossy();
if path_str.contains("/output/") {
// 找出 /output/ 之後的 library 目錄
if let Some(pos) = path_str.find("/output/") {
let after_output = &path_str[pos + 8..]; // skip "/output/"
if let Some(first_slash) = after_output.find('/') {
path_str[..pos + 8 + first_slash].to_string()
} else {
// 沒有更多層級,就用整個 parent
parent.to_string_lossy().to_string()
}
} else {
parent.to_string_lossy().to_string()
}
} else {
parent.to_string_lossy().to_string()
}
} else {
std::env::var("MOMENTRY_OUTPUT_DIR")
.unwrap_or_else(|_| "output".to_string())
};
DebugFooter {
absolute_path: absolute_path_string(path),
written_at_unix: SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|d| d.as_secs())
.unwrap_or(0),
output_dir: std::env::var("MOMENTRY_OUTPUT_DIR")
.unwrap_or_else(|_| "output/demo".to_string()),
output_dir,
}
}
+1 -3
View File
@@ -73,9 +73,7 @@ pub fn demo_dir() -> PathBuf {
/// Get scripts directory
pub fn scripts_dir() -> PathBuf {
env::var("MOMENTRY_SCRIPTS_DIR")
.map(PathBuf::from)
.unwrap_or_else(|_| momentry_core_dir().join("tools/script"))
resolve_asset_path("MOMENTRY_SCRIPTS_DIR", "scripts")
}
/// Get CLI tools directory
+29 -6
View File
@@ -157,6 +157,29 @@ pub struct PythonExecutor {
}
impl PythonExecutor {
/// Determine the correct output directory for a processor execution.
/// Uses MOMENTRY_OUTPUT_DIR env var if set, otherwise derives from output_path
/// or falls back to the global OUTPUT_DIR.
fn resolve_output_dir(&self, uuid: Option<&str>, output_path: Option<&std::path::PathBuf>) -> String {
// Priority: env var > derived from output_path > global OUTPUT_DIR
if let Ok(dir) = std::env::var("MOMENTRY_OUTPUT_DIR") {
return dir;
}
if let Some(path) = output_path {
if let Some(parent) = path.parent() {
return parent.to_string_lossy().to_string();
}
}
// Fallback: use uuid to look up per-library dir (sync call)
if let Some(u) = uuid {
// Try to derive from known patterns
if let Ok(dir) = std::env::var("MOMENTRY_OUTPUT_DIR_PER_LIB") {
return dir;
}
}
OUTPUT_DIR.to_string()
}
pub fn new() -> Result<Self> {
let python_path = std::env::var("MOMENTRY_PYTHON_PATH")
.unwrap_or_else(|_| "/opt/homebrew/bin/python3.11".to_string());
@@ -335,7 +358,7 @@ impl PythonExecutor {
let mut cmd = Command::new(&self.python_path);
cmd.env("PYTHONPATH", &self.scripts_dir);
cmd.env("PATH", "/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin");
cmd.env("MOMENTRY_OUTPUT_DIR", &*OUTPUT_DIR);
cmd.env("MOMENTRY_OUTPUT_DIR", self.resolve_output_dir(uuid, output_path.as_ref()));
cmd.env("DATABASE_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_DB_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_REDIS_PREFIX", &*REDIS_KEY_PREFIX);
@@ -507,7 +530,7 @@ impl PythonExecutor {
let mut cmd = Command::new(&self.python_path);
cmd.env("PYTHONPATH", &self.scripts_dir);
cmd.env("PATH", "/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin");
cmd.env("MOMENTRY_OUTPUT_DIR", &*OUTPUT_DIR);
cmd.env("MOMENTRY_OUTPUT_DIR", self.resolve_output_dir(uuid, output_path.as_ref()));
cmd.env("DATABASE_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_DB_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_REDIS_PREFIX", &*REDIS_KEY_PREFIX);
@@ -723,7 +746,7 @@ impl PythonExecutor {
let mut cmd = Command::new(&self.python_path);
cmd.env("PYTHONPATH", &self.scripts_dir);
cmd.env("PATH", "/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin");
cmd.env("MOMENTRY_OUTPUT_DIR", &*OUTPUT_DIR);
cmd.env("MOMENTRY_OUTPUT_DIR", self.resolve_output_dir(uuid, output_path.as_ref()));
cmd.env("DATABASE_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_DB_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_REDIS_PREFIX", &*REDIS_KEY_PREFIX);
@@ -947,7 +970,7 @@ impl PythonExecutor {
let mut cmd = Command::new(&self.python_path);
cmd.env("PYTHONPATH", &self.scripts_dir);
cmd.env("PATH", "/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin");
cmd.env("MOMENTRY_OUTPUT_DIR", &*OUTPUT_DIR);
cmd.env("MOMENTRY_OUTPUT_DIR", self.resolve_output_dir(uuid, output_path.as_ref()));
cmd.env("DATABASE_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_DB_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_REDIS_PREFIX", &*REDIS_KEY_PREFIX);
@@ -1249,7 +1272,7 @@ impl PythonExecutor {
});
let mut cmd = Command::new(bin_path);
cmd.env("MOMENTRY_OUTPUT_DIR", &*OUTPUT_DIR);
cmd.env("MOMENTRY_OUTPUT_DIR", self.resolve_output_dir(uuid, output_path.as_ref()));
cmd.env("DATABASE_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_DB_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_REDIS_PREFIX", &*REDIS_KEY_PREFIX);
@@ -1475,7 +1498,7 @@ mod tests {
let executor = PythonExecutor::new().unwrap();
let mut cmd = Command::new(&executor.python_path);
cmd.env("MOMENTRY_OUTPUT_DIR", &*OUTPUT_DIR);
cmd.env("MOMENTRY_OUTPUT_DIR", self.resolve_output_dir(uuid, output_path.as_ref()));
cmd.env("DATABASE_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_DB_SCHEMA", &*DATABASE_SCHEMA);
cmd.env("MOMENTRY_REDIS_PREFIX", &*REDIS_KEY_PREFIX);
+59 -13
View File
@@ -8,6 +8,24 @@ use super::FaceStatus;
const FACE_TIMEOUT: Duration = Duration::from_secs(7200);
/// Resolve the FaceNet512 CoreML model path.
/// Priority: $MOMENTRY_MODELS_DIR/facenet512.mlpackage -> momentry_core/models/facenet512.mlpackage
pub fn facenet_model_path() -> Option<std::path::PathBuf> {
use std::path::PathBuf;
let env_dir = std::env::var("MOMENTRY_MODELS_DIR")
.ok()
.map(PathBuf::from);
let candidates = [
env_dir.map(|d| d.join("facenet512.mlpackage")),
Some(
crate::core::path_utils::momentry_core_dir()
.join("models")
.join("facenet512.mlpackage"),
),
];
candidates.into_iter().flatten().find(|p| p.exists())
}
pub fn swift_processor_path(bin: &str) -> std::path::PathBuf {
use std::path::PathBuf;
let rel = format!(".build/release/{}", bin);
@@ -98,6 +116,19 @@ impl FaceResult {
self.metadata = Some(metadata);
}
/// Generate face_id for faces that don't have one.
/// Format: face_{frame}_{index_within_frame}
pub fn ensure_face_ids(&mut self) {
for frame in &mut self.frames {
let frame_num = frame.frame;
for (idx, face) in frame.faces.iter_mut().enumerate() {
if face.face_id.is_none() {
face.face_id = Some(format!("face_{}_{}", frame_num, idx));
}
}
}
}
pub fn save_to_file(&self, path: &str) -> Result<()> {
self.save_to_file_with_source(path, None, None)
}
@@ -263,6 +294,7 @@ pub async fn process_face(
result.compute_status();
result.add_metadata("face", "swift_face", uuid);
result.ensure_face_ids();
result.save_to_file(output_path)?;
tracing::info!(
@@ -323,16 +355,14 @@ pub async fn process_face(
if facenet_path.exists() {
tracing::info!("[FACE] Generating embeddings with FaceNet CoreML");
// Resolve model path
let models_dir =
crate::core::path_utils::resolve_asset_path("MOMENTRY_MODELS_DIR", "models");
let model_path = models_dir.join("facenet512.mlpackage");
if !model_path.exists() {
tracing::error!("[FACE] FaceNet model not found at {:?}", model_path);
tracing::error!("[FACE] Set MOMENTRY_MODELS_DIR environment variable or ensure models/facenet512.mlpackage exists");
anyhow::bail!("FaceNet model not found - cannot generate embeddings");
}
// Resolve model path (env dir -> momentry_core/models fallback)
let model_path = match facenet_model_path() {
Some(p) => p,
None => {
tracing::error!("[FACE] FaceNet model not found (checked $MOMENTRY_MODELS_DIR and momentry_core/models)");
anyhow::bail!("FaceNet model not found - cannot generate embeddings");
}
};
let facenet_output = format!("{}.with_embedding", output_path);
let facenet_args = vec![
@@ -415,6 +445,7 @@ pub async fn process_face(
tracing::info!("[FACE] Face tracking completed successfully");
}
result.ensure_face_ids();
result.save_to_file(output_path)?;
tracing::info!(
@@ -470,6 +501,7 @@ pub async fn process_face(
tracing::info!("[FACE] Face tracking completed successfully");
}
result.ensure_face_ids();
result.save_to_file(output_path)?;
tracing::info!(
@@ -544,16 +576,22 @@ async fn run_face_with_config(
// Generate embeddings with FaceNet CoreML
let facenet_path = swift_processor_path("facenet_embedding");
let facenet_output = format!("{}.with_embedding", output_path);
if facenet_path.exists() {
tracing::info!("[FACE] Generating embeddings with FaceNet CoreML");
let facenet_output = format!("{}.with_embedding", output_path);
let facenet_args = vec![
let mut facenet_args = vec![
video_path.to_string(),
output_path.to_string(),
facenet_output.clone(),
];
// Explicit --model (the binary otherwise derives the path from
// MOMENTRY_MODELS_DIR, which may not contain facenet512)
if let Some(model_path) = facenet_model_path() {
facenet_args.push("--model".to_string());
facenet_args.push(model_path.to_string_lossy().to_string());
}
let facenet_result = tokio::process::Command::new(facenet_path)
.args(&facenet_args)
@@ -576,12 +614,19 @@ async fn run_face_with_config(
}
}
let json_str = std::fs::read_to_string(output_path)
// Read face.json (prefer .with_embedding if copy failed)
let json_path = if std::path::Path::new(&facenet_output).exists() {
&facenet_output
} else {
output_path
};
let json_str = std::fs::read_to_string(json_path)
.context("Failed to read Swift FACE output")?;
let mut result: FaceResult =
serde_json::from_str(&json_str).context("Failed to parse Swift FACE output")?;
result.compute_status();
result.add_metadata("face", "swift_face", uuid);
result.ensure_face_ids();
result.save_to_file(output_path)?;
if let Some(uid) = uuid {
@@ -625,6 +670,7 @@ async fn run_face_with_config(
.context("Failed to parse Python FACE output")?;
result.compute_status();
result.add_metadata("face", "python_face_processor", uuid);
result.ensure_face_ids();
result.save_to_file(output_path)?;
if let Some(uid) = uuid {
+7 -2
View File
@@ -13,7 +13,9 @@ pub struct FaceClusterResult {
#[serde(default)]
pub file_uuid: Option<String>,
pub status: String,
#[serde(default)]
pub stats: ClusterStats,
#[serde(default)]
pub clusters: Vec<FaceClusterInfo>,
#[serde(default)]
pub unassigned_traces: Vec<i32>,
@@ -157,11 +159,14 @@ pub async fn process_face_cluster(
similarity_threshold: Option<f64>,
) -> Result<FaceClusterResult> {
let executor = PythonExecutor::new()?;
let script_path = executor.script_path("fast_face_clustering_processor.py");
tracing::info!("[FACE_CLUSTER] Starting face clustering: {}", video_path);
if !script_path.exists() {
// Try Rust binary first (preferred); legacy Python script is only a fallback.
// Do NOT bail early just because the Python script is missing — that would
// skip the Rust binary even when it exists.
let script_path = executor.script_path("fast_face_clustering_processor.py");
if executor.rust_binary_path("rust_face_cluster").is_none() && !script_path.exists() {
tracing::warn!("[FACE_CLUSTER] Script not found, returning empty result");
return Ok(FaceClusterResult {
schema_version: "2.0".to_string(),
@@ -0,0 +1,859 @@
use anyhow::{Context, Result};
use futures_util::future::join_all;
use std::collections::HashMap;
use std::path::Path;
use tokio::process::Command;
use crate::core::file_profile::{
EmbeddingStatus, SceneConfig, SceneFrame, SceneInfo, SceneProfile, SceneStatus,
SelectionReason, VideoInfo, VlmStatus, VlmTag, VlmTagValue,
};
pub struct SceneVlmProcessor {
samples_per_interval: usize,
use_cuts: bool,
max_workers: usize,
}
impl SceneVlmProcessor {
pub fn new(samples_per_interval: usize, use_cuts: bool, max_workers: usize) -> Self {
Self {
samples_per_interval,
use_cuts,
max_workers,
}
}
pub fn compute_sample_frames(
interval_start_sec: f64,
interval_sec: f64,
fps: f64,
samples: usize,
) -> Vec<u32> {
if samples == 0 {
return vec![];
}
let sample_interval = interval_sec / samples as f64;
let frames: Vec<u32> = (0..samples)
.map(|i| {
let time = interval_start_sec + (i as f64 + 0.5) * sample_interval;
(time * fps).round() as u32
})
.collect();
// Ensure at least frame 0 is included for short videos
if frames.is_empty() || frames.iter().all(|&f| f > 0) {
let mut result = vec![0u32];
result.extend(frames.into_iter().filter(|&f| f > 0));
result
} else {
frames
}
}
pub async fn calculate_blur_single(video_path: &str, frame: u32, fps: f64) -> Result<f64> {
let time_sec = frame as f64 / fps;
let output = Command::new("/opt/homebrew/bin/ffmpeg")
.args([
"-ss",
&format!("{:.2}", time_sec),
"-i",
video_path,
"-vframes",
"1",
"-vf",
"blurdetect",
"-f",
"null",
"-",
])
.output()
.await
.context("FFmpeg blurdetect failed")?;
let stderr = String::from_utf8_lossy(&output.stderr);
for line in stderr.lines() {
if let Some(blur_str) = line.split("blur mean: ").nth(1) {
if let Ok(blur) = blur_str.trim().parse::<f64>() {
return Ok(blur);
}
}
}
Ok(f64::NAN)
}
pub async fn calculate_blur_parallel(
video_path: &str,
frames: &[u32],
fps: f64,
max_workers: usize,
) -> Result<Vec<(u32, f64)>> {
let tasks: Vec<_> = frames
.iter()
.map(|frame| Self::calculate_blur_single(video_path, *frame, fps))
.collect();
let results = join_all(tasks).await;
let mut combined = Vec::new();
for (frame, result) in frames.iter().zip(results.into_iter()) {
if let Ok(blur) = result {
combined.push((*frame, blur));
} else {
combined.push((*frame, f64::NAN));
}
}
Ok(combined)
}
pub fn select_best_frame(blur_scores: &[(u32, f64)]) -> Option<(u32, f64)> {
blur_scores
.iter()
.filter(|(_, blur)| !blur.is_nan())
.min_by(|a, b| a.1.partial_cmp(&b.1).unwrap())
.map(|(frame, blur)| (*frame, *blur))
}
pub fn find_cuts_in_interval(
interval_start: f64,
interval_end: f64,
cut_data: &serde_json::Value,
) -> Vec<serde_json::Value> {
let mut cuts = Vec::new();
if let Some(scenes) = cut_data.get("scenes").and_then(|s| s.as_array()) {
for scene in scenes {
if let Some(start_time) = scene.get("start_time").and_then(|t| t.as_f64()) {
if start_time > interval_start && start_time < interval_end {
cuts.push(scene.clone());
}
}
}
}
cuts
}
pub async fn process_interval(
video_path: &str,
interval_start: f64,
interval_sec: f64,
fps: f64,
cut_data: &serde_json::Value,
samples_per_interval: usize,
max_workers: usize,
) -> Result<Vec<SceneFrame>> {
let sample_frames =
Self::compute_sample_frames(interval_start, interval_sec, fps, samples_per_interval);
let blur_scores =
Self::calculate_blur_parallel(video_path, &sample_frames, fps, max_workers).await?;
let cuts =
Self::find_cuts_in_interval(interval_start, interval_start + interval_sec, cut_data);
let mut selected_frames = Vec::new();
if cuts.is_empty() {
if let Some((frame, blur)) = Self::select_best_frame(&blur_scores) {
let timestamp = frame as f64 / fps;
selected_frames.push(SceneFrame {
index: 0,
filename: format!("scene_{:03}.jpg", 0),
timestamp_sec: timestamp,
frame_number: frame,
selection_reason: SelectionReason::BestBlur,
quality_score: Some(blur),
quality_source: Some("ffmpeg_blurdetect".to_string()),
scene_info: None,
face_count: 0,
person_traces: Vec::new(),
has_cut: false,
cut_count: 0,
vlm_status: VlmStatus::Pending,
vlm_description: None,
vlm_description_localized: None,
vlm_scene_type: None,
vlm_location: None,
vlm_objects: Vec::new(),
vlm_attributes: None,
vlm_tags: Vec::new(),
embedding_status: EmbeddingStatus::Pending,
});
} else if let Some(&frame) = sample_frames.first() {
// Fallback: use first sample frame when blur detection yields no scores
let timestamp = frame as f64 / fps;
selected_frames.push(SceneFrame {
index: 0,
filename: format!("scene_{:03}.jpg", 0),
timestamp_sec: timestamp,
frame_number: frame,
selection_reason: SelectionReason::Default,
quality_score: None,
quality_source: None,
scene_info: None,
face_count: 0,
person_traces: Vec::new(),
has_cut: false,
cut_count: 0,
vlm_status: VlmStatus::Pending,
vlm_description: None,
vlm_description_localized: None,
vlm_scene_type: None,
vlm_location: None,
vlm_objects: Vec::new(),
vlm_attributes: None,
vlm_tags: Vec::new(),
embedding_status: EmbeddingStatus::Pending,
});
}
} else {
let cut = &cuts[0];
let cut_time = cut
.get("start_time")
.and_then(|t| t.as_f64())
.unwrap_or(interval_start);
let cut_frame = (cut_time * fps).round() as u32;
let pre_frames: Vec<u32> = sample_frames
.iter()
.filter(|f| **f < cut_frame)
.cloned()
.collect();
let post_frames: Vec<u32> = sample_frames
.iter()
.filter(|f| **f >= cut_frame)
.cloned()
.collect();
if !pre_frames.is_empty() {
let pre_blur =
Self::calculate_blur_parallel(video_path, &pre_frames, fps, max_workers)
.await?;
if let Some((frame, blur)) = Self::select_best_frame(&pre_blur) {
let timestamp = frame as f64 / fps;
selected_frames.push(SceneFrame {
index: 0,
filename: format!("scene_{:03}.jpg", selected_frames.len()),
timestamp_sec: timestamp,
frame_number: frame,
selection_reason: SelectionReason::PreCutBestBlur,
quality_score: Some(blur),
quality_source: Some("ffmpeg_blurdetect".to_string()),
scene_info: None,
face_count: 0,
person_traces: Vec::new(),
has_cut: true,
cut_count: cuts.len() as u32,
vlm_status: VlmStatus::Pending,
vlm_description: None,
vlm_description_localized: None,
vlm_scene_type: None,
vlm_location: None,
vlm_objects: Vec::new(),
vlm_attributes: None,
vlm_tags: Vec::new(),
embedding_status: EmbeddingStatus::Pending,
});
}
}
if !post_frames.is_empty() {
let post_blur =
Self::calculate_blur_parallel(video_path, &post_frames, fps, max_workers)
.await?;
if let Some((frame, blur)) = Self::select_best_frame(&post_blur) {
let timestamp = frame as f64 / fps;
selected_frames.push(SceneFrame {
index: 0,
filename: format!("scene_{:03}.jpg", selected_frames.len()),
timestamp_sec: timestamp,
frame_number: frame,
selection_reason: SelectionReason::PostCutBestBlur,
quality_score: Some(blur),
quality_source: Some("ffmpeg_blurdetect".to_string()),
scene_info: None,
face_count: 0,
person_traces: Vec::new(),
has_cut: true,
cut_count: cuts.len() as u32,
vlm_status: VlmStatus::Pending,
vlm_description: None,
vlm_description_localized: None,
vlm_scene_type: None,
vlm_location: None,
vlm_objects: Vec::new(),
vlm_attributes: None,
vlm_tags: Vec::new(),
embedding_status: EmbeddingStatus::Pending,
});
}
}
}
for (i, frame) in selected_frames.iter_mut().enumerate() {
frame.index = i;
}
Ok(selected_frames)
}
pub async fn generate_scene_profile(
&self,
video_path: &str,
file_uuid: &str,
output_dir: &str,
interval_sec: u32,
cut_data: &serde_json::Value,
fps: f64,
duration: f64,
width: u32,
height: u32,
total_frames: u32,
) -> Result<SceneProfile> {
let config = SceneConfig {
interval_sec,
use_cuts: true,
use_faces: false,
quality_metric: "ffmpeg_blurdetect".to_string(),
samples_per_interval: self.samples_per_interval,
};
let video_info = VideoInfo {
duration_sec: duration,
fps,
width,
height,
total_frames,
};
let mut profile = SceneProfile::new(file_uuid, video_info, config);
let mut all_frames = Vec::new();
let total_intervals = (duration / interval_sec as f64).ceil() as usize;
for i in 0..total_intervals {
let interval_start = i as f64 * interval_sec as f64;
let interval_end = (interval_start + interval_sec as f64).min(duration);
let actual_interval_sec = interval_end - interval_start;
let frames = Self::process_interval(
video_path,
interval_start,
actual_interval_sec,
fps,
cut_data,
self.samples_per_interval,
self.max_workers,
)
.await?;
all_frames.extend(frames);
}
// Fix indices
for (i, frame) in all_frames.iter_mut().enumerate() {
frame.index = i;
frame.filename = format!("scene_{:03}.jpg", i);
}
profile.scenes = all_frames;
profile.total_scenes = profile.scenes.len();
profile.status = SceneStatus::Ready;
profile.updated_at = chrono::Utc::now();
Ok(profile)
}
pub fn save_scene_profile(profile: &SceneProfile, output_dir: &str) -> Result<()> {
let path = SceneProfile::scenes_path(output_dir, &profile.file_uuid);
let json =
serde_json::to_string_pretty(profile).context("Failed to serialize SceneProfile")?;
std::fs::write(&path, json).context("Failed to write scenes.json")?;
Ok(())
}
pub fn load_scene_profile(output_dir: &str, file_uuid: &str) -> Result<SceneProfile> {
let path = SceneProfile::scenes_path(output_dir, file_uuid);
let json = std::fs::read_to_string(&path).context("Failed to read scenes.json")?;
let profile: SceneProfile =
serde_json::from_str(&json).context("Failed to parse scenes.json")?;
Ok(profile)
}
pub async fn extract_scene_frames(
video_path: &str,
output_dir: &str,
file_uuid: &str,
scenes: &[SceneFrame],
) -> Result<Vec<std::path::PathBuf>> {
let scenes_dir = SceneProfile::scenes_dir(output_dir, file_uuid);
std::fs::create_dir_all(&scenes_dir).context("Failed to create scenes directory")?;
let mut extracted_paths = Vec::new();
for scene in scenes {
let output_path =
SceneProfile::scene_frame_path(output_dir, file_uuid, &scene.filename);
let time_sec = scene.timestamp_sec;
let status = Command::new("/opt/homebrew/bin/ffmpeg")
.args([
"-y",
"-ss",
&format!("{:.2}", time_sec),
"-i",
video_path,
"-vframes",
"1",
"-q:v",
"5",
&output_path.to_string_lossy(),
])
.status()
.await
.context("FFmpeg frame extraction failed")?;
if status.success() && output_path.exists() {
extracted_paths.push(output_path);
}
}
Ok(extracted_paths)
}
/// Helper function to extract scene info from parsed JSON
fn extract_scene_info(
parsed: &serde_json::Value,
fallback: &str,
) -> (String, Vec<String>, Vec<String>) {
let desc = parsed
.get("description")
.and_then(|d| d.as_str())
.unwrap_or(fallback)
.to_string();
let objs = parsed
.get("objects")
.and_then(|o| o.as_array())
.map(|arr| {
arr.iter()
.filter_map(|v| v.as_str().map(String::from))
.collect()
})
.unwrap_or_default();
let tgs = parsed
.get("tags")
.and_then(|t| t.as_array())
.map(|arr| {
arr.iter()
.filter_map(|v| v.as_str().map(String::from))
.collect()
})
.unwrap_or_default();
(desc, objs, tgs)
}
/// Extract objects from text (simple keyword matching)
fn extract_objects_from_text(text: &str) -> Vec<String> {
let keywords = [
"river", "tree", "forest", "mountain", "building", "person", "text", "water", "sky",
"cloud", "road", "car", "house", "flower", "grass", "rock", "bridge", "boat", "animal",
"bird",
];
keywords
.iter()
.filter(|&k| text.to_lowercase().contains(k))
.map(|k| k.to_string())
.collect()
}
/// Extract tags from text (category inference)
fn extract_tags_from_text(text: &str) -> Vec<String> {
let mut tags = vec![];
let lower = text.to_lowercase();
if lower.contains("landscape") || lower.contains("nature") {
tags.push("nature".to_string());
}
if lower.contains("indoor") || lower.contains("room") {
tags.push("indoor".to_string());
}
if lower.contains("outdoor") {
tags.push("outdoor".to_string());
}
if lower.contains("presentation") || lower.contains("slide") {
tags.push("presentation".to_string());
}
if lower.contains("text") || lower.contains("title") {
tags.push("text".to_string());
}
if lower.contains("water") || lower.contains("river") {
tags.push("water".to_string());
}
tags
}
fn language_display_name(language: &str) -> &'static str {
match language {
"zh-TW" => "Traditional Chinese (zh-TW)",
"zh-CN" => "Simplified Chinese (zh-CN)",
"ja" => "Japanese (ja)",
"ko" => "Korean (ko)",
"es" => "Spanish (es)",
"fr" => "French (fr)",
"de" => "German (de)",
_ => "English (en)",
}
}
/// Build the structured scene analysis prompt.
fn build_scene_prompt(local_language: &str) -> String {
let local_name = Self::language_display_name(local_language);
format!(
r#"You are an expert visual analyst for a multimodal video search system.
Analyze the attached image frame and return ONLY valid JSON with NO markdown, NO explanations, NO reasoning, NO thinking.
Use this exact schema:
{{
"summary": "Concise English summary of the core content (1-2 sentences). Factual, avoid superlatives like beautiful/stunning/amazing.",
"category": "Single highest-level category. Choose ONE from: landscape|architecture|interior|people|event|nature|urban|transport|food|animal|product|other",
"scene_type": "Environment/background. Choose ONE from: indoor|outdoor|city street|resort|nature|mountain|beach|forest|building exterior|building interior|road|park|unknown",
"objects": ["3-5 most prominent objects or subjects in English. Concrete and specific."],
"actions": ["Main actions/events or static state if no motion. Use English (e.g. 'static scene', 'driving', 'walking')."],
"visual_attributes": {{
"lighting": "e.g. natural daylight, golden hour, overcast, artificial, backlit, mixed lighting",
"composition": "e.g. aerial view, wide angle, eye level, low angle, close-up, drone shot, street level",
"color_palette": ["3-5 dominant colors in English (e.g. gray, green, blue, orange)"]
}},
"detected_text": ["Exact visible signs, logos, plaques, or printed text. Only if legible. Empty array if none."],
"tags": [
{{"en": "english_tag", "local": "localized_tag"}}
]
}}
Rules:
- summary must be English only
- objects, actions, visual_attributes must use concrete English terms. Avoid generic words like "photo", "image", "view", "scene"
- tags: 5-10 items. Each item MUST be an object with both "en" and "local" keys
- Use {local_name} for "local". If the preferred language is English, set "local" equal to "en" but keep both keys
- Prioritize search-relevant terms (environment type, key structures/objects). Do NOT just copy the full summary into tags
- Do NOT duplicate objects 1:1 unless genuinely useful as search tags
- Keep tags concise (1-3 words). Avoid redundancy between tags
- detected_text: only extract text actually visible, do not guess or infer
- Output ONLY the JSON object"#
)
}
/// Extract the first JSON object from a VLM response (tolerates markdown fences).
fn extract_json_object(content: &str) -> Option<&str> {
let start = content.find('{')?;
let end = content.rfind('}')?;
if end <= start {
return None;
}
Some(&content[start..=end])
}
fn parse_tags(value: Option<&serde_json::Value>) -> Vec<VlmTagValue> {
let Some(arr) = value.and_then(|v| v.as_array()) else {
return Vec::new();
};
arr.iter()
.filter_map(|tag| {
if let Some(en) = tag.get("en").and_then(|v| v.as_str()) {
let local = tag
.get("local")
.and_then(|v| v.as_str())
.unwrap_or(en)
.to_string();
Some(VlmTagValue::Structured(VlmTag {
en: en.to_string(),
local,
}))
} else {
tag.as_str().map(|s| VlmTagValue::String(s.to_string()))
}
})
.collect()
}
/// Call VLM API to generate structured scene info.
/// Returns (english_description, objects, bilingual_tags).
pub async fn generate_scene_description(
image_path: &std::path::Path,
local_language: &str,
) -> Result<(String, Vec<String>, Vec<VlmTagValue>)> {
use base64::{engine::general_purpose::STANDARD as BASE64, Engine as _};
use std::time::Duration;
// Read image
let jpeg_bytes = std::fs::read(image_path)
.with_context(|| format!("Failed to read image: {:?}", image_path))?;
let base64_img = BASE64.encode(&jpeg_bytes);
// VLM API config
let vlm_url = crate::core::config::llm::VISION_URL.clone();
let vlm_model = crate::core::config::llm::VISION_MODEL.clone();
let prompt = Self::build_scene_prompt(local_language);
tracing::debug!(
"[VLM API] Calling {} with model {} (local language: {})",
vlm_url,
vlm_model,
local_language
);
let body = serde_json::json!({
"model": vlm_model,
"messages": [{
"role": "user",
"content": [
{
"type": "text",
"text": prompt
},
{
"type": "image_url",
"image_url": {
"url": format!("data:image/jpeg;base64,{}", base64_img)
}
}
]
}],
"max_tokens": 1024,
"temperature": 0.1,
"chat_template_kwargs": {"enable_thinking": false}
});
let client = reqwest::Client::builder()
.timeout(Duration::from_secs(120))
.build()
.context("Failed to create HTTP client")?;
let resp = client
.post(&vlm_url)
.json(&body)
.send()
.await
.context("VLM API request failed")?;
if !resp.status().is_success() {
let status = resp.status();
let body = resp.text().await.unwrap_or_default();
anyhow::bail!("VLM API returned {}: {}", status, body);
}
let resp_json: serde_json::Value = resp
.json()
.await
.context("Failed to parse VLM API response")?;
// Parse response
let choice = resp_json
.get("choices")
.and_then(|c| c.get(0))
.context("Invalid VLM API response structure")?;
if choice.get("finish_reason").and_then(|v| v.as_str()) == Some("length") {
anyhow::bail!("VLM returned truncated response (finish_reason=length)");
}
let message = choice.get("message").context("Invalid VLM API response structure")?;
let content = match message
.get("content")
.and_then(|c| c.as_str())
.filter(|s| !s.trim().is_empty())
{
Some(s) => s.trim().to_string(),
None => anyhow::bail!("VLM returned empty content"),
};
tracing::debug!(
"[Scene VLM] VLM response content (first 500 chars): {}",
&content[..content.len().min(500)]
);
// Parse structured JSON; fall back to heuristic extraction if it fails.
if let Some(json_str) = Self::extract_json_object(&content) {
tracing::debug!("[Scene VLM] Extracted JSON object ({} chars)", json_str.len());
if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(json_str) {
tracing::debug!("[Scene VLM] Successfully parsed JSON");
let description = parsed
.get("summary")
.and_then(|v| v.as_str())
.map(|s| s.trim().to_string())
.filter(|s| !s.is_empty());
if let Some(description) = description {
let objects = parsed
.get("objects")
.and_then(|v| v.as_array())
.map(|arr| {
arr.iter()
.filter_map(|v| v.as_str().map(|s| s.to_string()))
.collect::<Vec<_>>()
})
.unwrap_or_default();
let tags = Self::parse_tags(parsed.get("tags"));
tracing::info!(
"[Scene VLM] Parsed {} objects, {} tags from JSON",
objects.len(),
tags.len()
);
return Ok((description, objects, tags));
} else {
tracing::warn!("[Scene VLM] JSON missing 'summary' field or summary is empty");
}
} else {
tracing::warn!("[Scene VLM] Failed to parse extracted JSON: {}", json_str);
}
} else {
tracing::warn!("[Scene VLM] Failed to extract JSON object from VLM response");
}
tracing::warn!(
"[Scene VLM] Failed to parse structured JSON, falling back to text heuristics"
);
let objects = Self::extract_objects_from_text(&content);
let tags = Self::extract_tags_from_text(&content)
.into_iter()
.map(VlmTagValue::String)
.collect();
Ok((content, objects, tags))
}
/// Generate VLM descriptions for all scene frames
pub async fn generate_vlm_descriptions(
output_dir: &str,
file_uuid: &str,
scenes: &mut [SceneFrame],
max_workers: usize,
) -> Result<()> {
tracing::info!(
"[Scene VLM] Generating descriptions for {} scenes",
scenes.len()
);
// Get preferred language from admin config
let preferred_language = crate::core::admin_config::ADMIN_CONFIG
.get_full_config()
.await
.search
.vlm_output_language
.clone();
crate::core::config::set_preferred_language(preferred_language.clone());
tracing::info!("[Scene VLM] Preferred language: {}", preferred_language);
// Process scenes sequentially to avoid issues
for (idx, scene) in scenes.iter_mut().enumerate() {
let frame_path = SceneProfile::scene_frame_path(output_dir, file_uuid, &scene.filename);
// Generate English description (for indexing)
match Self::generate_scene_description(&frame_path, &preferred_language).await {
Ok((description_en, objects, tags)) => {
scene.vlm_description = Some(description_en.clone());
scene.vlm_objects = objects.clone();
scene.vlm_tags = tags.clone();
tracing::info!(
"[Scene VLM] Scene {}: Generated {} tags: {:?}",
idx,
tags.len(),
tags
);
// Generate localized description by translation if needed
if preferred_language != "en" {
let system_prompt = "You are a professional translator. Translate accurately. Return ONLY the translated text, no explanations or notes.";
let prompt = format!("Translate the following scene description into {}. Do not summarize, add, or omit any details. Keep the same number of sentences.\n\n{}", preferred_language, description_en);
let body = serde_json::json!({
"model": crate::core::config::llm::CHAT_MODEL.as_str(),
"messages": [
{"role": "system", "content": system_prompt},
{"role": "user", "content": prompt}
],
"stream": false,
"max_tokens": 1024,
"temperature": 0.1,
"chat_template_kwargs": {"enable_thinking": false}
});
let client = reqwest::Client::builder().timeout(std::time::Duration::from_secs(120)).build()?;
match client.post(&*crate::core::config::llm::CHAT_URL).json(&body).send().await {
Ok(resp) => {
if resp.status().is_success() {
if let Ok(v) = resp.json::<serde_json::Value>().await {
if let Some(choice) = v["choices"].get(0) {
if choice.get("finish_reason").and_then(|x| x.as_str()) != Some("length") {
if let Some(tr) = choice["message"]["content"].as_str() {
let tr = tr.trim();
if !tr.is_empty() && !tr.contains("thinking") && !tr.contains("I need to") && !tr.contains("* Task") && !tr.contains("* Scene:") && tr.len() > 10 {
scene.vlm_description_localized = Some(tr.to_string());
tracing::info!("[Scene VLM] ✅ Scene {}: EN + {} (translated)", idx, preferred_language);
scene.vlm_status = VlmStatus::Completed;
continue;
}
}
}
}
}
}
tracing::warn!("[Scene VLM] ⚠️ Scene {} localized translation failed", idx);
}
Err(e) => {
tracing::warn!("[Scene VLM] ⚠️ Scene {} localized translation failed: {}", idx, e);
}
}
} else {
tracing::info!("[Scene VLM] ✅ Scene {}: EN only", idx);
}
scene.vlm_status = VlmStatus::Completed;
}
Err(e) => {
tracing::error!("[Scene VLM] ❌ Scene {}: {}", idx, e);
scene.vlm_status = VlmStatus::Failed;
}
}
}
let success_count = scenes
.iter()
.filter(|s| s.vlm_status == VlmStatus::Completed)
.count();
let fail_count = scenes
.iter()
.filter(|s| s.vlm_status == VlmStatus::Failed)
.count();
tracing::info!(
"[Scene VLM] ✅ Generated {} descriptions, {} failed",
success_count,
fail_count
);
Ok(())
}
}
+30 -1
View File
@@ -563,9 +563,38 @@ pub fn verify_file(file_uuid: &str) -> FileVerificationReport {
/// Legacy verification function (backward compatible)
pub fn verify_output(processor: &ProcessorType, file_uuid: &str) -> VerificationResult {
let output_dir = OUTPUT_DIR.as_str();
verify_output_in_dir(processor, file_uuid, output_dir)
}
/// Verification with explicit output directory (per-library aware).
/// Falls back to the global OUTPUT_DIR and the demo subdirectory if the
/// primary path does not exist, so per-library outputs verify correctly.
pub fn verify_output_in_dir(
processor: &ProcessorType,
file_uuid: &str,
output_dir: &str,
) -> VerificationResult {
let proc_name = processor.as_str();
let filename = format!("{}.{}.json", file_uuid, proc_name);
let output_path = PathBuf::from(OUTPUT_DIR.as_str()).join(&filename);
// Candidate locations: explicit dir → global OUTPUT_DIR → OUTPUT_DIR/demo
let base = output_dir.trim_end_matches('/');
let global = OUTPUT_DIR.as_str().trim_end_matches('/');
let candidates = if base == global {
vec![
PathBuf::from(base),
PathBuf::from(format!("{}/demo", global)),
]
} else {
vec![PathBuf::from(base), PathBuf::from(global)]
};
let output_path = candidates
.iter()
.map(|d| d.join(&filename))
.find(|p| p.exists())
.unwrap_or_else(|| PathBuf::from(base).join(&filename));
if !output_path.exists() {
return VerificationResult::fail(proc_name, file_uuid, "output file not found");
+184 -99
View File
@@ -335,6 +335,30 @@ impl JobWorker {
error!("Failed to reset stale running jobs: {}", e);
}
// ── Layer 3b: 補遺漏的 monitor_jobs(repair 機制)───────────────────
// Sync mode register 不會建立 monitor_jobs,這裡自動補上
// 只針對 status='pending' 且 file_type 為影片格式的檔案
let monitor_jobs_table = schema::table_name("monitor_jobs");
let videos_table = schema::table_name("videos");
let created = sqlx::query(&format!(
"INSERT INTO {mj_t} (uuid, status, created_at, updated_at)
SELECT v.file_uuid, 'pending', NOW(), NOW()
FROM {v_t} v
WHERE v.status = 'pending'
AND v.file_type IN ('video', 'mp4', 'mov', 'avi', 'mkv')
AND NOT EXISTS (SELECT 1 FROM {mj_t} mj WHERE mj.uuid = v.file_uuid)",
mj_t = monitor_jobs_table,
v_t = videos_table
))
.execute(self.db.pool())
.await;
if let Ok(r) = created {
let n = r.rows_affected();
if n > 0 {
info!("[REPAIR] Created {} monitor_jobs for pending videos", n);
}
}
// ── Layer 3c: Job 併發上限(backpressure)─────────────────────────────
// 同時執行 deep scan 的 job 數不得超過上限;超出的 running jobs 自動
// 轉為 paused(video 退回 registered),名額釋出時自動恢復。
@@ -589,7 +613,7 @@ impl JobWorker {
async fn periodic_completeness_check(&self) -> Result<()> {
info!("[COMPLETENESS] Starting periodic output completeness check");
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
let global_output_dir = crate::core::config::OUTPUT_DIR.to_string();
let videos_table = schema::table_name("videos");
let rows: Vec<(String, String)> = sqlx::query_as(&format!(
@@ -606,18 +630,31 @@ impl JobWorker {
for (uuid, file_name) in &rows {
let mut missing: Vec<String> = Vec::new();
// Use per-library output dir with fallback to global
let per_lib_dir = crate::core::config::get_output_dir_for_file(uuid, self.db.pool()).await;
// 檢查 JSON 產出
for ext in ["asrx", "cut", "face", "face_cluster", "face_traced", "ocr", "scenes"] {
let path = format!("{}/{}.{}.json", output_dir, uuid, ext);
if !std::path::Path::new(&path).exists() {
let filename = format!("{}.{}.json", uuid, ext);
let per_lib_path = format!("{}/{}", per_lib_dir.trim_end_matches('/'), filename);
let global_path = format!("{}/{}", global_output_dir.trim_end_matches('/'), filename);
if !std::path::Path::new(&per_lib_path).exists() && !std::path::Path::new(&global_path).exists() {
missing.push(format!("{}.json", ext));
}
}
// 檢查 trace 目錄
let trace_base = std::path::Path::new(&output_dir).join(uuid);
if trace_base.is_dir() {
if let Ok(entries) = std::fs::read_dir(&trace_base) {
let trace_base = std::path::Path::new(&per_lib_dir).join(uuid);
let trace_base_global = std::path::Path::new(&global_output_dir).join(uuid);
let effective_trace_base = if trace_base.is_dir() {
trace_base
} else if trace_base_global.is_dir() {
trace_base_global
} else {
std::path::PathBuf::new()
};
if effective_trace_base.is_dir() {
if let Ok(entries) = std::fs::read_dir(&effective_trace_base) {
for entry in entries.filter_map(|e| e.ok()) {
let name = entry.file_name().to_string_lossy().to_string();
if name.starts_with("trace_") && entry.path().is_dir() {
@@ -1066,8 +1103,10 @@ impl JobWorker {
) -> Result<()> {
use std::path::Path;
// Get output directory from config
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
// Get output directory (per-library, fallback global)
let output_dir = crate::core::config::get_output_dir_for_file(&job.uuid, self.db.pool()).await;
// Also check the global output dir for legacy files
let global_output_dir = crate::core::config::OUTPUT_DIR.to_string();
// Get current processor_results
let existing_results = match self
@@ -1090,12 +1129,15 @@ impl JobWorker {
let mut repaired_count = 0;
for processor_type in processors {
let output_path = format!(
"{}/{}.{}.json",
output_dir,
job.uuid,
processor_type.as_str()
);
let filename = format!("{}.{}.json", job.uuid, processor_type.as_str());
// Per-library first, then global fallback (legacy files)
let per_lib_path = format!("{}/{}", output_dir.trim_end_matches('/'), filename);
let global_path = format!("{}/{}", global_output_dir.trim_end_matches('/'), filename);
let output_path = if Path::new(&per_lib_path).exists() {
per_lib_path
} else {
global_path
};
// If file exists but no DB record
if Path::new(&output_path).exists() {
@@ -1112,6 +1154,7 @@ impl JobWorker {
);
// Special handling for ASR: read status from output JSON
// Fallback: if no status field but has segments, infer "has_transcript"
let mut asr_status_value: Option<String> = None;
if processor_type == crate::core::db::ProcessorType::Asrx {
if let Ok(json_str) = std::fs::read_to_string(&output_path) {
@@ -1122,6 +1165,26 @@ impl JobWorker {
"[AUTO-REPAIR] ASR status from file: {}",
status
);
} else {
// Legacy file without status: infer from segments
let seg_count = json_val.get("segments")
.and_then(|s| s.as_array())
.map(|a| a.len())
.unwrap_or(0);
if seg_count > 0 {
asr_status_value = Some("has_transcript".to_string());
info!(
"[AUTO-REPAIR] ASR status inferred from {} segments: has_transcript",
seg_count
);
// Backfill the status into the JSON file
let mut patched = json_val.clone();
patched["status"] = serde_json::Value::String("has_transcript".to_string());
patched["segment_count"] = serde_json::Value::Number(seg_count.into());
if let Ok(updated) = serde_json::to_string_pretty(&patched) {
let _ = std::fs::write(&output_path, updated);
}
}
}
}
}
@@ -1140,12 +1203,13 @@ impl JobWorker {
crate::core::db::ProcessorType::Asrx => {
// Update asr_status from JSON
if let Some(asr_status) = asr_status_value.clone() {
let status_enum = match asr_status.as_str() {
"no_audio_track" => crate::core::processor::AsrStatus::NoAudioTrack,
"silent_audio" => crate::core::processor::AsrStatus::SilentAudio,
_ => crate::core::processor::AsrStatus::SilentAudio,
let (status_enum, seg_count) = match asr_status.as_str() {
"no_audio_track" => (crate::core::processor::AsrStatus::NoAudioTrack, 0),
"silent_audio" => (crate::core::processor::AsrStatus::SilentAudio, 0),
"has_transcript" => (crate::core::processor::AsrStatus::HasTranscript, 1),
_ => (crate::core::processor::AsrStatus::SilentAudio, 0),
};
if let Err(e) = self.db.update_asr_status(result_id, &status_enum, 0).await {
if let Err(e) = self.db.update_asr_status(result_id, &status_enum, seg_count).await {
warn!("[AUTO-REPAIR] Failed to update asr_status for {}: {}", job.uuid, e);
} else {
info!("[AUTO-REPAIR] Updated asr_status to '{}' for {}", asr_status, job.uuid);
@@ -1639,19 +1703,24 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
.await?;
// Check if output file already exists on disk (source of truth)
let output_path = PathBuf::from(OUTPUT_DIR.as_str()).join(format!(
"{}.{}.json",
job.uuid,
processor_type.as_str()
));
// Per-library output dir(先查此檔案的專屬目錄,fallback 全域)
let per_lib_dir = crate::core::config::get_output_dir_for_file(&job.uuid, self.db.pool()).await;
let global_dir = OUTPUT_DIR.as_str();
let filename = format!("{}.{}.json", job.uuid, processor_type.as_str());
let output_path = if PathBuf::from(&per_lib_dir).join(&filename).exists() {
PathBuf::from(&per_lib_dir).join(&filename)
} else {
PathBuf::from(global_dir).join(&filename)
};
debug!("Checking output file: {:?}", output_path);
// Check for stale .tmp file (process crashed before renaming)
let tmp_path = PathBuf::from(OUTPUT_DIR.as_str()).join(format!(
"{}.{}.json.tmp",
job.uuid,
processor_type.as_str()
));
let tmp_filename = format!("{}.{}.json.tmp", job.uuid, processor_type.as_str());
let tmp_path = if PathBuf::from(&per_lib_dir).join(&tmp_filename).exists() {
PathBuf::from(&per_lib_dir).join(&tmp_filename)
} else {
PathBuf::from(global_dir).join(&tmp_filename)
};
if tmp_path.exists() && !output_path.exists() {
if let Ok(meta) = std::fs::metadata(&tmp_path) {
// 條件 1: 檔案 > 1KB
@@ -2273,18 +2342,17 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
classification
);
// Create empty ASR output file
// Create empty ASR output file(per-library output dir)
let asr_output = serde_json::json!({
"status": classification,
"segments": [],
"language": "",
"language_probability": 0.0
});
let output_dir = crate::core::config::get_output_dir_for_file(&job.uuid, self.db.pool()).await;
let asr_path = format!(
"{}/{}.asr.json",
crate::core::config::OUTPUT_DIR
.as_str()
.trim_end_matches('/'),
output_dir.trim_end_matches('/'),
job.uuid
);
if let Err(e) = std::fs::write(&asr_path, asr_output.to_string()) {
@@ -2328,13 +2396,11 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
// Enhanced ASRX fast-path: check for silent/no-audio or empty segments
if *processor_type == crate::core::db::ProcessorType::Asrx {
let asr_output_path = format!(
"{}/{}.asr.json",
crate::core::config::OUTPUT_DIR
.as_str()
.trim_end_matches('/'),
job.uuid
);
// Per-library output directory
let output_dir = crate::core::config::get_output_dir_for_file(&job.uuid, self.db.pool()).await;
let output_base = output_dir.trim_end_matches('/');
let asr_output_path = format!("{}/{}.asr.json", output_base, job.uuid);
if let Ok(asr_json) = std::fs::read_to_string(&asr_output_path) {
if let Ok(asr_data) = serde_json::from_str::<serde_json::Value>(&asr_json) {
let asr_status = asr_data.get("status").and_then(|s| s.as_str());
@@ -2357,14 +2423,8 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
info!("ASRX: fast-path (status={}, segments_empty={})", effective_status, segments_empty);
// Write asrx.json output file (so sync-status sees it)
let asrx_output_path = format!(
"{}/{}.asrx.json",
crate::core::config::OUTPUT_DIR
.as_str()
.trim_end_matches('/'),
job.uuid
);
// Write asrx.json output file(per-library output dir)
let asrx_output_path = format!("{}/{}.asrx.json", output_base, job.uuid);
let asrx_result = serde_json::json!({
"status": effective_status,
"language": asr_data.get("language").and_then(|l| l.as_str()),
@@ -2426,25 +2486,27 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
// Without it, clustering produces no_faces even when faces were detected
// (the trace file is produced later by store_traced_faces.py in P2 trigger).
if *processor_type == crate::core::db::ProcessorType::FaceCluster {
let traced_path = format!(
"{}/{}.face_traced.json",
crate::core::config::OUTPUT_DIR
.as_str()
.trim_end_matches('/'),
job.uuid
);
// ✅ V2: Validate file integrity, not just existence
let trace_complete = if std::path::Path::new(&traced_path).exists() {
if let Ok(content) = std::fs::read_to_string(&traced_path) {
if let Ok(traced_data) = serde_json::from_str::<serde_json::Value>(&content) {
let frames = traced_data.get("frames");
frames.map_or(false, |f| match f {
// Per-library output directory lookup (async, correct path resolution)
let output_dir =
crate::core::config::get_output_dir_for_file(&job.uuid, self.db.pool()).await;
let output_base = output_dir.trim_end_matches('/');
let traced_path = format!("{}/{}.face_traced.json", output_base, job.uuid);
let trace_complete = if !std::path::Path::new(&traced_path).exists() {
false
} else if let Ok(content) = std::fs::read_to_string(&traced_path) {
if let Ok(traced_data) = serde_json::from_str::<serde_json::Value>(&content) {
// Terminal statuses are ready even with empty frames:
// "no_faces"/"completed" means face_trace finished its pass.
let status = traced_data.get("status").and_then(|s| s.as_str()).unwrap_or("");
if status == "no_faces" || status == "completed" {
true
} else {
// Non-terminal status: require non-empty frames
traced_data.get("frames").map_or(false, |f| match f {
serde_json::Value::Array(arr) => !arr.is_empty(),
serde_json::Value::Object(obj) => !obj.is_empty(),
_ => false,
})
} else {
false
}
} else {
false
@@ -2673,11 +2735,20 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
.unwrap_or(0);
if count == 0 {
return false;
// 無 face_track 節點 — 檢查是否為無臉影片或無 embedding
// 避免永久卡在 "Scanning" 狀態
tracing::warn!(
"[TKG] {} has 0 face_track nodes, checking if this is expected",
uuid
);
// 有節點記錄但 count=0 的情況視為完成(可能是無臉影片)
// 讓 job 繼續完成,TKG 可事後修復
return true;
}
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let trace_base_dir = std::path::Path::new(output_dir).join(uuid);
// Per-library output directory(不是全域 OUTPUT_DIR)
let output_dir = crate::core::config::get_output_dir_for_file(uuid, pool).await;
let trace_base_dir = std::path::Path::new(&output_dir).join(uuid);
if let Ok(entries) = std::fs::read_dir(&trace_base_dir) {
let trace_count = entries
@@ -2718,6 +2789,12 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
let tkg_nodes_t = schema::table_name("tkg_nodes");
let tkg_edges_t = schema::table_name("tkg_edges");
// Per-library output directory
let output_dir = match crate::core::config::get_output_dir_for_file(uuid, pool).await {
dir if !dir.is_empty() => dir,
_ => crate::core::config::OUTPUT_DIR.to_string(),
};
let has_asr_or_asrx =
job_processors.is_empty() || job_processors.iter().any(|p| p == "asrx" || p == "asr" || p == "asr_asrx");
let has_face = job_processors.is_empty() || job_processors.iter().any(|p| p == "face");
@@ -2762,21 +2839,11 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
if status_from_db {
true
} else {
// Fallback: check asr.json / asr_asrx.json file directly
let asr_path = format!(
"{}/{}.asr.json",
crate::core::config::OUTPUT_DIR
.as_str()
.trim_end_matches('/'),
uuid
);
let asr_asrx_path = format!(
"{}/{}.asr_asrx.json",
crate::core::config::OUTPUT_DIR
.as_str()
.trim_end_matches('/'),
uuid
);
// Fallback: check asr.json / asr_asrx.json file directly(per-library output)
let output_dir = crate::core::config::get_output_dir_for_file(uuid, pool).await;
let output_base = output_dir.trim_end_matches('/');
let asr_path = format!("{}/{}.asr.json", output_base, uuid);
let asr_asrx_path = format!("{}/{}.asr_asrx.json", output_base, uuid);
let content = std::fs::read_to_string(&asr_path)
.or_else(|_| std::fs::read_to_string(&asr_asrx_path));
if let Ok(content) = content {
@@ -2801,9 +2868,9 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
true
};
// 2. Face Trace: face_traced.json 有 traces
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
let traced_path = format!("{}/{}.face_traced.json", output_dir, uuid);
// 2. Face Trace: face_traced.json 有 traces(per-library output dir)
let output_dir = crate::core::config::get_output_dir_for_file(uuid, pool).await;
let traced_path = format!("{}/{}.face_traced.json", output_dir.trim_end_matches('/'), uuid);
let (trace_status, total_faces) = if std::path::Path::new(&traced_path).exists() {
if let Ok(content) = std::fs::read_to_string(&traced_path) {
@@ -2888,8 +2955,13 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
}
true
} else {
let cluster_path = format!("{}/{}.face_cluster.json", output_dir, uuid);
let file_exists = std::path::Path::new(&cluster_path).exists();
// Check BOTH per-library and global output dirs
// (rust_face_cluster writes to global OUTPUT_DIR via sync stub)
let cluster_path_lib = format!("{}/{}.face_cluster.json", output_dir, uuid);
let cluster_path_global = format!("{}/{}.face_cluster.json",
crate::core::config::OUTPUT_DIR.as_str().trim_end_matches('/'), uuid);
let file_exists = std::path::Path::new(&cluster_path_lib).exists()
|| std::path::Path::new(&cluster_path_global).exists();
if file_exists {
true
} else {
@@ -2937,7 +3009,19 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
"must": [{"key": "file_uuid", "match": {"value": uuid}}]
});
match qdrant.count_points("_faces", filter).await {
Ok(count) => count > 0,
Ok(count) => {
if count > 0 {
true
} else {
// 有 face_traced 但 Qdrant 無 embeddings → 視為完成
//(可能是 embeddings 未同步或已丟失,不讓 job 永久卡住)
tracing::warn!(
"[Ingestion] {} has face traces but 0 embeddings in Qdrant, proceeding anyway",
uuid
);
true
}
}
Err(_) => false,
}
}
@@ -3099,7 +3183,7 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
uuid: &str,
job_processors: &[String],
) -> Result<Vec<String>> {
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
let output_dir = crate::core::config::get_output_dir_for_file(uuid, self.db.pool()).await;
let mut missing = Vec::new();
// 1. 檢查 JSON 產出
@@ -3402,9 +3486,10 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
});
if face_cluster_done {
// Check if key_frame.jpg files are ready
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let trace_dir = std::path::PathBuf::from(output_dir).join(uuid);
// Check if key_frame.jpg files are ready(per-library output dir)
let output_dir =
crate::core::config::get_output_dir_for_file(uuid, self.db.pool()).await;
let trace_dir = std::path::PathBuf::from(&output_dir).join(uuid);
let key_frame_count = if trace_dir.exists() {
std::fs::read_dir(&trace_dir)
.ok()
@@ -3427,7 +3512,7 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
let db_clone = self.db.clone();
let redis_clone = self.redis.clone();
let uuid_clone = uuid.to_string();
let output_dir_clone = crate::core::config::OUTPUT_DIR.clone();
let output_dir_clone = output_dir.clone();
tokio::spawn(async move {
crate::core::processor::vlm_summary::generate_vlm_summaries(
&db_clone,
@@ -3688,13 +3773,13 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
.all(|p| p == "scene_vlm" || p == "scene");
let cut_json_exists = std::path::Path::new(&format!(
"{}/{}.cut.json",
crate::core::config::OUTPUT_DIR.as_str(),
crate::core::config::get_output_dir_for_file(uuid, self.db.pool()).await.trim_end_matches('/'),
uuid
))
.exists();
if has_cut || (wants_scene_vlm && cut_json_exists) {
let output_dir = crate::core::config::OUTPUT_DIR.clone();
let scenes_path = format!("{}/{}.scenes.json", output_dir, uuid);
let output_dir = crate::core::config::get_output_dir_for_file(uuid, self.db.pool()).await;
let scenes_path = format!("{}/{}.scenes.json", output_dir.trim_end_matches('/'), uuid);
// 重跑條件:scenes.json 不存在 或 未完整完成(vlm completed 數 < total_scenes)
let scene_vlm_complete = if std::path::Path::new(&scenes_path).exists() {
@@ -3991,11 +4076,10 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
// Note: trigger is gated on face alone (not has_asrx) so no-face videos still
// get face_traced.json written via the fast-path, unblocking FaceCluster.
if has_face {
let per_lib_dir = crate::core::config::get_output_dir_for_file(uuid, self.db.pool()).await;
let traced_path = format!(
"{}/{}.face_traced.json",
crate::core::config::OUTPUT_DIR
.as_str()
.trim_end_matches('/'),
per_lib_dir.trim_end_matches('/'),
uuid
);
// ✅ V2: Check data integrity, not just file existence
@@ -4189,7 +4273,8 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
}
};
let output_dir = crate::core::config::OUTPUT_DIR.as_str();
let output_dir = crate::core::config::get_output_dir_for_file(&uuid_clone, db_clone.pool()).await;
let output_dir = output_dir.as_str();
// Get video path from DB for face crop extraction
let video_path: Option<String> = db_clone
+10 -5
View File
@@ -502,9 +502,14 @@ impl ProcessorPool {
match result {
Ok(output) => {
// 驗收 agent 檢查產出內容
let verification =
crate::verification::verifier::verify_output(&processor_type, &job.uuid);
// 驗收 agent 檢查產出內容(per-library output dir, async lookup)
let output_dir =
crate::core::config::get_output_dir_for_file(&job.uuid, db.pool()).await;
let verification = crate::verification::verifier::verify_output_in_dir(
&processor_type,
&job.uuid,
&output_dir,
);
if verification.passed {
info!(
@@ -679,9 +684,9 @@ impl ProcessorPool {
) -> Result<ProcessorOutput> {
let video_path = job.video_path.as_ref().context("No video path in job")?;
// Determine per-library output directory
// Determine per-library output directory (async, correct path resolution)
let output_dir = PathBuf::from(
crate::core::config::get_output_dir_for_file_sync(&job.uuid, db.pool())
crate::core::config::get_output_dir_for_file(&job.uuid, db.pool()).await
);
let suffix = format!("{}.{}", job.uuid, processor_type.as_str());
let output_path = output_dir.join(format!("{}.json", suffix));
+72 -13
View File
@@ -75,9 +75,18 @@ fn round_json(value: Value) -> Value {
fn write_empty_output(status: &str, file_uuid: &str, output_path: &std::path::Path) {
let output_data = json!({
"schema_version": "2.0",
"status": status,
"file_uuid": file_uuid,
"stats": {
"total_clusters": 0,
"total_faces": 0,
"noise_faces": 0,
"total_traces": 0,
},
"clusters": [],
"unassigned_traces": [],
"speaker_person_mapping": {},
"frames": [],
});
let text = serde_json::to_string_pretty(&output_data).unwrap_or_default();
@@ -882,9 +891,40 @@ fn main() {
return;
}
// Person face counts + best face (representative).
// Person face counts + best face (representative) using composite scoring.
// Composite score: 0.4 × frontal + 0.4 × confidence + 0.2 × quality
let mut person_face_count: BTreeMap<String, u64> = BTreeMap::new();
let mut person_best_face: BTreeMap<String, Value> = BTreeMap::new();
let mut person_best_score: BTreeMap<String, f64> = BTreeMap::new();
// Pre-compute min/max for normalization within each person
let mut person_stats: BTreeMap<String, (f64, f64, f64, f64, f64, f64)> = BTreeMap::new();
for (frame_idx, frame_obj) in frames_list.iter().enumerate() {
let frame_num = frame_obj.get("frame")
.and_then(|f| f.as_u64())
.unwrap_or(frame_idx as u64);
let faces = frame_obj.get("faces").and_then(|f| f.as_array()).cloned().unwrap_or_default();
for face in faces.iter() {
let person_id = face.get("person_id").and_then(|p| p.as_str());
if let Some(pid) = person_id {
let conf = face.get("confidence").and_then(|c| c.as_f64()).unwrap_or(0.5);
let quality = face.get("captureQuality").and_then(|c| c.as_f64()).unwrap_or(0.0);
let pose = face.get("pose_angle").or_else(|| face.get("pose")).and_then(|p| p.as_object());
let yaw_rad = pose.and_then(|p| p.get("yaw").and_then(|y| y.as_f64())).unwrap_or(0.0);
let yaw_deg = yaw_rad * 57.2958;
let frontal = (1.0 - yaw_deg.abs() / 60.0).max(0.0);
let entry = person_stats.entry(pid.to_string()).or_insert((conf, conf, quality, quality, frontal, frontal));
entry.0 = entry.0.min(conf);
entry.1 = entry.1.max(conf);
entry.2 = entry.2.min(quality);
entry.3 = entry.3.max(quality);
entry.4 = entry.4.min(frontal);
entry.5 = entry.5.max(frontal);
}
}
}
for (frame_idx, frame_obj) in frames_list.iter().enumerate() {
let frame_num = frame_obj.get("frame")
.and_then(|f| f.as_u64())
@@ -894,18 +934,37 @@ fn main() {
let person_id = face.get("person_id").and_then(|p| p.as_str());
if let Some(person_id) = person_id {
*person_face_count.entry(person_id.to_string()).or_insert(0) += 1;
let confidence = face.get("confidence").and_then(|c| c.as_f64()).unwrap_or(0.9);
let entry = person_best_face
.entry(person_id.to_string())
.or_insert_with(|| {
json!({
"confidence": f64::NEG_INFINITY,
})
});
if confidence > entry.get("confidence").and_then(|c| c.as_f64()).unwrap_or(f64::NEG_INFINITY) {
*entry = json!({
// Calculate composite score
let conf = face.get("confidence").and_then(|c| c.as_f64()).unwrap_or(0.5);
let quality = face.get("captureQuality").and_then(|c| c.as_f64()).unwrap_or(0.0);
let pose = face.get("pose_angle").or_else(|| face.get("pose")).and_then(|p| p.as_object());
let yaw_rad = pose.and_then(|p| p.get("yaw").and_then(|y| y.as_f64())).unwrap_or(0.0);
let yaw_deg = yaw_rad * 57.2958;
let frontal = (1.0 - yaw_deg.abs() / 60.0).max(0.0);
// Normalize within person
let stats = person_stats.get(person_id).unwrap();
let conf_range = stats.1 - stats.0;
let quality_range = stats.3 - stats.2;
let frontal_range = stats.5 - stats.4;
let conf_norm = if conf_range > 0.001 { (conf - stats.0) / conf_range } else { 0.5 };
let quality_norm = if quality_range > 0.001 { (quality - stats.2) / quality_range } else { 0.5 };
let frontal_norm = if frontal_range > 0.001 { (frontal - stats.4) / frontal_range } else { 0.5 };
// Composite: 0.4 frontal + 0.4 confidence + 0.2 quality
let composite_score = 0.4 * frontal_norm + 0.4 * conf_norm + 0.2 * quality_norm;
let current_best = person_best_score.get(person_id).copied().unwrap_or(-1.0);
if composite_score > current_best {
person_best_score.insert(person_id.to_string(), composite_score);
person_best_face.insert(person_id.to_string(), json!({
"face_id": format!("face_{}_{}", frame_num, face_idx),
"confidence": confidence,
"confidence": conf,
"capture_quality": quality,
"yaw_deg": round_digits(yaw_deg, 2),
"composite_score": round_digits(composite_score, 4),
"frame": frame_num,
"bbox": {
"x": face.get("x").cloned().unwrap_or(Value::Null),
@@ -913,7 +972,7 @@ fn main() {
"width": face.get("width").cloned().unwrap_or(Value::Null),
"height": face.get("height").cloned().unwrap_or(Value::Null),
}
});
}));
}
}
}
@@ -349,9 +349,64 @@ fn extract_full_frame(video_path: &str, frame_num: usize, output: &std::path::Pa
fn write_trace_profile(trace: &TraceInfo, file_uuid: &str, output: &std::path::Path) {
use std::io::Write;
let best_confidence = trace.best_confidence;
let avg_confidence = trace.avg_confidence;
let best_frame = trace.best_frame;
// Compute real stats from face instances (fallback to path when instances empty)
let instances: &Vec<TracePoint> = if !trace.face_instances.is_empty() {
&trace.face_instances
} else {
&trace.path
};
let avg_confidence = if !instances.is_empty() {
instances.iter().map(|p| p.confidence as f64).sum::<f64>() / instances.len() as f64
} else {
trace.avg_confidence
};
let best = instances.iter().max_by(|a, b| {
a.confidence
.partial_cmp(&b.confidence)
.unwrap_or(std::cmp::Ordering::Equal)
});
let best_frame = best.map(|p| p.frame as u64).unwrap_or(trace.best_frame as u64);
let best_confidence = best.map(|p| p.confidence as f64).unwrap_or(trace.best_confidence);
let best_capture_quality = instances
.iter()
.map(|p| p.capture_quality as f64)
.fold(0.0f64, |acc, q| if q > acc { q } else { acc });
let avg_capture_quality = if !instances.is_empty() {
instances.iter().map(|p| p.capture_quality as f64).sum::<f64>() / instances.len() as f64
} else {
0.0
};
let best_bbox = best.map(|p| {
serde_json::json!({
"x": p.bbox.x, "y": p.bbox.y,
"width": p.bbox.width, "height": p.bbox.height,
"x2": p.bbox.x2, "y2": p.bbox.y2,
"center_x": p.bbox.center_x, "center_y": p.bbox.center_y,
})
});
let avg_bbox = if !instances.is_empty() {
let mut b = trace.avg_bbox.clone();
let n = instances.len() as i32;
b.x = instances.iter().map(|p| p.bbox.x).sum::<i32>() / n;
b.y = instances.iter().map(|p| p.bbox.y).sum::<i32>() / n;
b.width = instances.iter().map(|p| p.bbox.width).sum::<i32>() / n;
b.height = instances.iter().map(|p| p.bbox.height).sum::<i32>() / n;
b.compute_derived();
serde_json::json!({
"x": b.x, "y": b.y,
"width": b.width, "height": b.height,
"x2": b.x2, "y2": b.y2,
"center_x": b.center_x, "center_y": b.center_y,
})
} else {
serde_json::Value::Null
};
let profile = serde_json::json!({
"version": "1.0",
@@ -364,10 +419,10 @@ fn write_trace_profile(trace: &TraceInfo, file_uuid: &str, output: &std::path::P
"best_frame": best_frame,
"avg_confidence": avg_confidence,
"best_confidence": best_confidence,
"avg_capture_quality": null,
"best_capture_quality": null,
"avg_bbox": null,
"best_bbox": null,
"avg_capture_quality": avg_capture_quality,
"best_capture_quality": best_capture_quality,
"avg_bbox": avg_bbox,
"best_bbox": best_bbox,
"key_frame": "key_frame.jpg",
"key_face": "key_face.jpg",
"status": "pending",
@@ -789,11 +844,19 @@ fn run_face_tracking(
(Some(curr), Some(prev)) => calculate_cosine_similarity(curr, prev),
_ => 0.0,
};
// Match if IoU AND similarity meet thresholds
if iou > best_iou
&& iou > iou_threshold
&& similarity > similarity_threshold {
// Match if IoU AND similarity meet thresholds.
// When embeddings are unavailable (either face missing its
// vector), fall back to IoU-only geometric continuation:
// consecutive frames of the same face have overlapping bboxes.
let matched = if current_embedding.is_none() || prev_embedding.is_none() {
iou > best_iou && iou > iou_threshold
} else {
iou > best_iou
&& iou > iou_threshold
&& similarity > similarity_threshold
};
if matched {
best_iou = iou;
best_match = Some((prev_trace_id, iou, similarity));
}
+1 -1
View File
@@ -1 +1 @@
27744
35478
+128 -7
View File
@@ -5,12 +5,12 @@
"name" : "swift_processors",
"path" : "/Users/accusys/momentry_core/tools/cli/swift",
"projects" : [
"4bb951680c7a5f5d226b6a3b0d2453f90e35844d52f94b5dc0d359d3d568b372",
"a6496b512993faa30402e6518bde4e4b69bd2427f8d64cf41ee7f5bc28d67be3",
"afba80c4dbe0096fd6d93282d3148df1eb86d6b5b3d68aa4e57be69d20f77b41",
"d8df0460d8830dd1bb13d74c609cd5c7f1e55863be9670a7a624932593afd537"
]
},
"signature" : "fcd9b0e36d2713de6dd4d629dacae1f5407953bc27259d7dd3226d7ac263d5a9",
"signature" : "ac12913d02bc1781a2fb24346b9ff7e318fca309870a0d5aae6d838c8f5d9499",
"type" : "workspace"
},
{
@@ -1664,12 +1664,13 @@
"projectIsPackage" : "true",
"projectName" : "swift-argument-parser",
"targets" : [
"c39fb450e72e228c87a5fd1779b08c540b490df0be13beb8c47198e94bce40d4",
"feb414f4b920fe466ce2562be7158dc040eefd827ea4bd81b50c64522737bac5",
"6e0f63d50477fed3ee9576e6dcdfa21371c8937cb4ca9d9a4ead97e57b36c845",
"62e3757020fe9abcbcf9560154a74c692658afed4cc2d56aac07665eae590a60",
"336477e6ce4166cc8665edb239411e1c2d61d3b8de49393a479b59c51985ee6d",
"4422a602fd4ba6358980ab18b61b6cd83ba2ddc5942a3c45076548f2c6c17f91",
"eddc80fc5d9cbc2e9bc74e7f0fe4466479359aa7253d71fa5d21d70274526e6c",
"35012d84eab8c4a916b260a25ca44ca9671450315d261b046b39ca3d660e35f3",
"2931340a6f32f4a5286ab1ab347d840ffcf96e4846cb36f32332444123663ad4",
"399ecfcd48ab3231c78332b8a2c9f519716dbe91ad6518c5fb3095f6ab1430b4",
"408cf308c0ee52b99b2202371b3c3f81a2fbc8cdbc0fc9dd846b0804d912b123",
"ec0da54fd80b82fba969e690109a420dba92e8a573f4f2b928c02b4c5ab49d7e",
@@ -1680,7 +1681,7 @@
"14bda589fb95cd2e7da33e3335ef51859afaea06e8edf316e72a885bb4a9af25"
]
},
"signature" : "4bb951680c7a5f5d226b6a3b0d2453f90e35844d52f94b5dc0d359d3d568b372",
"signature" : "a6496b512993faa30402e6518bde4e4b69bd2427f8d64cf41ee7f5bc28d67be3",
"type" : "project"
},
{
@@ -1735,6 +1736,7 @@
]
}
],
"dynamicTargetVariantGuid" : "PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser-39B7DAEE4DD359BE-dynamic",
"frameworksBuildPhase" : {
"buildFiles" : [
{
@@ -1759,7 +1761,7 @@
"name" : "ArgumentParser-product",
"type" : "packageProduct"
},
"signature" : "c39fb450e72e228c87a5fd1779b08c540b490df0be13beb8c47198e94bce40d4",
"signature" : "feb414f4b920fe466ce2562be7158dc040eefd827ea4bd81b50c64522737bac5",
"type" : "target"
},
{
@@ -2518,6 +2520,9 @@
"$(inherited)",
"SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE"
],
"SWIFT_DISABLE_COMPILATION_FOR_STATIC_LINKING_WHEN_ANY_TARGET_IS_PROMOTED_TO_DYNAMIC[__platform_filter=windows-msvc]" : [
"PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser"
],
"SWIFT_DISABLE_PARSE_AS_LIBRARY" : "NO",
"SWIFT_ENABLE_BARE_SLASH_REGEX" : "NO",
"SWIFT_LIBRARIES_ONLY" : "YES",
@@ -2572,6 +2577,9 @@
"$(inherited)",
"SWIFT_MODULE_RESOURCE_BUNDLE_UNAVAILABLE"
],
"SWIFT_DISABLE_COMPILATION_FOR_STATIC_LINKING_WHEN_ANY_TARGET_IS_PROMOTED_TO_DYNAMIC[__platform_filter=windows-msvc]" : [
"PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser"
],
"SWIFT_DISABLE_PARSE_AS_LIBRARY" : "NO",
"SWIFT_ENABLE_BARE_SLASH_REGEX" : "NO",
"SWIFT_LIBRARIES_ONLY" : "YES",
@@ -3108,7 +3116,7 @@
"productTypeIdentifier" : "org.swift.product-type.library.static",
"type" : "standard"
},
"signature" : "35012d84eab8c4a916b260a25ca44ca9671450315d261b046b39ca3d660e35f3",
"signature" : "2931340a6f32f4a5286ab1ab347d840ffcf96e4846cb36f32332444123663ad4",
"type" : "target"
},
{
@@ -4115,6 +4123,119 @@
"signature" : "14bda589fb95cd2e7da33e3335ef51859afaea06e8edf316e72a885bb4a9af25",
"type" : "target"
},
{
"contents" : {
"approvedByUser" : "true",
"buildConfigurations" : [
{
"buildSettings" : {
"EXECUTABLE_PREFIX" : "lib",
"EXECUTABLE_PREFIX[__platform_filter=windows-msvc]" : "",
"PRODUCT_BUNDLE_IDENTIFIER" : "swift-argument-parser.ArgumentParser",
"PRODUCT_MODULE_NAME" : "ArgumentParser",
"PRODUCT_NAME" : "ArgumentParser",
"SDKROOT" : "auto",
"SDK_VARIANT" : "auto",
"SWIFT_PACKAGE_NAME" : "swift_argument_parser",
"SWIFT_USER_MODULE_VERSION" : "1.8.2",
"TARGET_NAME" : "ArgumentParser-product",
"TARGET_TEMP_DIR_SUFFIX" : "-t",
"USES_SWIFTPM_UNSAFE_FLAGS" : "NO"
},
"guid" : "PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser-39B7DAEE4DD359BE-dynamic::BUILDCONFIG_0",
"impartedBuildProperties" : {
"buildSettings" : {
}
},
"name" : "Debug"
},
{
"buildSettings" : {
"EXECUTABLE_PREFIX" : "lib",
"EXECUTABLE_PREFIX[__platform_filter=windows-msvc]" : "",
"PRODUCT_BUNDLE_IDENTIFIER" : "swift-argument-parser.ArgumentParser",
"PRODUCT_MODULE_NAME" : "ArgumentParser",
"PRODUCT_NAME" : "ArgumentParser",
"SDKROOT" : "auto",
"SDK_VARIANT" : "auto",
"SWIFT_PACKAGE_NAME" : "swift_argument_parser",
"SWIFT_USER_MODULE_VERSION" : "1.8.2",
"TARGET_NAME" : "ArgumentParser-product",
"TARGET_TEMP_DIR_SUFFIX" : "-t",
"USES_SWIFTPM_UNSAFE_FLAGS" : "NO"
},
"guid" : "PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser-39B7DAEE4DD359BE-dynamic::BUILDCONFIG_1",
"impartedBuildProperties" : {
"buildSettings" : {
}
},
"name" : "Release"
}
],
"buildPhases" : [
{
"buildFiles" : [
{
"guid" : "PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser-39B7DAEE4DD359BE-dynamic::BUILDPHASE_0::0",
"platformFilters" : [
],
"targetReference" : "PACKAGE-TARGET:ArgumentParser"
},
{
"guid" : "PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser-39B7DAEE4DD359BE-dynamic::BUILDPHASE_0::1",
"platformFilters" : [
],
"targetReference" : "PACKAGE-TARGET:ArgumentParserToolInfo"
}
],
"guid" : "PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser-39B7DAEE4DD359BE-dynamic::BUILDPHASE_0",
"type" : "com.apple.buildphase.frameworks"
},
{
"buildFiles" : [
],
"guid" : "PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser-39B7DAEE4DD359BE-dynamic::BUILDPHASE_1",
"type" : "com.apple.buildphase.sources"
}
],
"buildRules" : [
],
"customTasks" : [
],
"dependencies" : [
{
"guid" : "PACKAGE-TARGET:ArgumentParser",
"platformFilters" : [
]
},
{
"guid" : "PACKAGE-TARGET:ArgumentParserToolInfo",
"platformFilters" : [
]
}
],
"guid" : "PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser-39B7DAEE4DD359BE-dynamic",
"name" : "ArgumentParserdynamic-product",
"productReference" : {
"guid" : "PRODUCTREF-PACKAGE-PRODUCT:swift-argument-parser_ArgumentParser.ArgumentParser-39B7DAEE4DD359BE-dynamic",
"name" : "$(EXECUTABLE_NAME)",
"type" : "file"
},
"productTypeIdentifier" : "com.apple.product-type.library.dynamic",
"type" : "standard"
},
"signature" : "6e0f63d50477fed3ee9576e6dcdfa21371c8937cb4ca9d9a4ead97e57b36c845",
"type" : "target"
},
{
"contents" : {
"approvedByUser" : "true",
@@ -1,6 +1,6 @@
#if 0
#elif defined(__arm64__) && __arm64__
// Generated by Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)
// Generated by Apple Swift version 6.4.2 (swiftlang-6.4.2.1.9 clang-2100.4.1.1)
#ifndef ARGUMENTPARSER_SWIFT_H
#define ARGUMENTPARSER_SWIFT_H
#pragma clang diagnostic push
@@ -1,6 +1,6 @@
#if 0
#elif defined(__arm64__) && __arm64__
// Generated by Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)
// Generated by Apple Swift version 6.4.2 (swiftlang-6.4.2.1.9 clang-2100.4.1.1)
#ifndef ARGUMENTPARSERTOOLINFO_SWIFT_H
#define ARGUMENTPARSERTOOLINFO_SWIFT_H
#pragma clang diagnostic push
@@ -1,16 +0,0 @@
{
"" : {
"const-values" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/swift_scene_detector-primary.swiftconstvalues",
"dependencies" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/swift_scene_detector-primary.d",
"diagnostics" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/swift_scene_detector-primary.dia",
"emit-module-dependencies" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/swift_scene_detector-primary-emit-module.d",
"emit-module-diagnostics" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/swift_scene_detector-primary-emit-module.dia",
"pch" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/swift_scene_detector-primary-Bridging-header.pch",
"swift-dependencies" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/swift_scene_detector-primary.swiftdeps"
},
"/Users/accusys/momentry_core/tools/cli/swift/Sources/swift_scene_detector/main.swift" : {
"index-unit-output-path" : "/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/main.o",
"llvm-bc" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/main.bc",
"object" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/main.o"
}
}
@@ -1 +0,0 @@
/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_scene_detector-p.build/Objects-normal/arm64/main.o
@@ -1 +0,0 @@
/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/main.o /Users/accusys/momentry_core/tools/cli/swift/.build/out/Products/Release/ArgumentParser.o /Users/accusys/momentry_core/tools/cli/swift/.build/out/Products/Release/ArgumentParserToolInfo.o
@@ -1 +0,0 @@
/Users/accusys/momentry_core/tools/cli/swift/Sources/swift_scene_detector/main.swift
@@ -1 +0,0 @@
/Users/accusys/momentry_core/tools/cli/swift/Sources/swift_face/main.swift
@@ -0,0 +1 @@
/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/main.o /Users/accusys/momentry_core/tools/cli/swift/.build/out/Products/Release/ArgumentParser.o /Users/accusys/momentry_core/tools/cli/swift/.build/out/Products/Release/ArgumentParserToolInfo.o
@@ -1,16 +1,16 @@
{
"" : {
"const-values" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/swift_face-primary.swiftconstvalues",
"dependencies" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/swift_face-primary.d",
"diagnostics" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/swift_face-primary.dia",
"emit-module-dependencies" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/swift_face-primary-emit-module.d",
"emit-module-diagnostics" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/swift_face-primary-emit-module.dia",
"pch" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/swift_face-primary-Bridging-header.pch",
"swift-dependencies" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/swift_face-primary.swiftdeps"
"const-values" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/swift_ocr-primary.swiftconstvalues",
"dependencies" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/swift_ocr-primary.d",
"diagnostics" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/swift_ocr-primary.dia",
"emit-module-dependencies" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/swift_ocr-primary-emit-module.d",
"emit-module-diagnostics" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/swift_ocr-primary-emit-module.dia",
"pch" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/swift_ocr-primary-Bridging-header.pch",
"swift-dependencies" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/swift_ocr-primary.swiftdeps"
},
"/Users/accusys/momentry_core/tools/cli/swift/Sources/swift_face/main.swift" : {
"index-unit-output-path" : "/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/main.o",
"llvm-bc" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/main.bc",
"object" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_face-p.build/Objects-normal/arm64/main.o"
"/Users/accusys/momentry_core/tools/cli/swift/Sources/swift_ocr/main.swift" : {
"index-unit-output-path" : "/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/main.o",
"llvm-bc" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/main.bc",
"object" : "/Users/accusys/momentry_core/tools/cli/swift/.build/out/Intermediates.noindex/swift_processors.build/Release/swift_ocr-p.build/Objects-normal/arm64/main.o"
}
}
@@ -0,0 +1 @@
/Users/accusys/momentry_core/tools/cli/swift/Sources/swift_ocr/main.swift
@@ -6,7 +6,7 @@
},
"configuredTargets" : [
{
"guid" : "ALL-EXCLUDING-TESTS",
"guid" : "PACKAGE-PRODUCT:swift_swift_ocr.swift_ocr",
"parameters" : {
"action" : "build",
"activeRunDestination" : {
@@ -53,7 +53,7 @@
"OTHER_SWIFT_FLAGS[__destination_platform=YES]" : "$(inherited)",
"STRIP_INSTALLED_PRODUCT" : "NO",
"SWIFT_FORCE_STATIC_LINK_STDLIB" : "NO",
"TOOLCHAINS" : "org.swift.CommandLineTools $(inherited)"
"TOOLCHAINS" : "com.apple.dt.toolchain.XcodeDefault $(inherited)"
}
}
}
@@ -110,7 +110,7 @@
"OTHER_SWIFT_FLAGS[__destination_platform=YES]" : "$(inherited)",
"STRIP_INSTALLED_PRODUCT" : "NO",
"SWIFT_FORCE_STATIC_LINK_STDLIB" : "NO",
"TOOLCHAINS" : "org.swift.CommandLineTools $(inherited)"
"TOOLCHAINS" : "com.apple.dt.toolchain.XcodeDefault $(inherited)"
}
}
}
@@ -1,13 +1,9 @@
Target dependency graph (6 targets)
Target 'AllExcludingTests' in project 'Aggregate'
➜ Explicit dependency on target 'swift_scene_detector-product' in project 'swift_processors'
➜ Explicit dependency on target 'swift_face-product' in project 'swift_processors'
Target 'swift_face-product' in project 'swift_processors'
Target dependency graph (4 targets)
Target 'swift_ocr-product' in project 'swift_processors'
➜ Explicit dependency on target 'ArgumentParser-product' in project 'swift-argument-parser'
Target 'ArgumentParser-product' in project 'swift-argument-parser'
➜ Explicit dependency on target 'ArgumentParser' in project 'swift-argument-parser'
➜ Explicit dependency on target 'ArgumentParserToolInfo' in project 'swift-argument-parser'
Target 'ArgumentParser' in project 'swift-argument-parser'
➜ Explicit dependency on target 'ArgumentParserToolInfo' in project 'swift-argument-parser'
Target 'ArgumentParserToolInfo' in project 'swift-argument-parser' (no dependencies)
Target 'swift_scene_detector-product' in project 'swift_processors' (no dependencies)
Target 'ArgumentParserToolInfo' in project 'swift-argument-parser' (no dependencies)
@@ -6,3 +6,4 @@ e82b9b1fa6e2155ecd5d48e4eafb0de6
b560b6c95d5323089188c41bce087705
0c65646c2030f5b7157b378e289d7935
3ca87f1a3cf69ca4254ec37726e9054e
9d5c9831f7a032439fc2527a4921bbc1
@@ -1,4 +1,4 @@
// Generated by Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)
// Generated by Apple Swift version 6.4.2 (swiftlang-6.4.2.1.9 clang-2100.4.1.1)
#ifndef ARGUMENTPARSER_SWIFT_H
#define ARGUMENTPARSER_SWIFT_H
#pragma clang diagnostic push
@@ -7,341 +7,341 @@
{
"isFramework" : true,
"moduleName" : "Combine",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Combine-HZXIDVRS1RHS.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Combine-1MQD19MFP7YP0.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "CoreFoundation",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/CoreFoundation-1ZR84FL6049EO.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/CoreFoundation-1XA0K2EAORYIG.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "Darwin",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Darwin-2YURQ1NTTP12G.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Darwin-1TESJRJ3CHXJX.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "Dispatch",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Dispatch-1AFJ8KY8MJUVZ.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Dispatch-E3QYKUOWATEB.swiftmodule"
},
{
"isFramework" : true,
"moduleName" : "Foundation",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Foundation-33L54W4MUI10Q.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Foundation-1HKRN7SGCE3ZL.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "IOKit",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/IOKit-CSC23YYAC90H.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/IOKit-18QTH2K2O8UW3.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "ObjectiveC",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/ObjectiveC-GA4NBN3Y5M3X.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/ObjectiveC-32IVS8Z36XT4E.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "Observation",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Observation-1ULOIXFMMWT2Z.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Observation-2Z0R48LOYDWT9.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "Swift",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Swift-1BDYYDYC90NDQ.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Swift-KU4R36X95208.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "System",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/System-12GM73T8YN3SE.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/System-319KKF0UNM77U.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "XPC",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/XPC-LSET5NHDQUSS.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/XPC-2TIKMEBVUZIGP.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "_Builtin_float",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_float-2DVAU8LXVIX6C.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_float-2KG30KIN06N76.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "_Concurrency",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Concurrency-X4L7DUWFQ224.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Concurrency-3B41COEBYAOHN.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "_DarwinFoundation1",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation1-3EKSPSYJ3B5WF.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation1-TN0JMYD3KX8G.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "_DarwinFoundation2",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation2-YJE2XKP3QD6F.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation2-1Q22QAOQ6KBAI.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "_DarwinFoundation3",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation3-TUEGO3SZ71SU.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation3-2J9L00U6N633O.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "_StringProcessing",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_StringProcessing-MGC1BQR57F9B.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_StringProcessing-3L7V9645RLKMA.swiftmodule"
},
{
"isFramework" : false,
"moduleName" : "os",
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/os-15CPJ0X72EZHL.swiftmodule"
"modulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/os-1S9410INZSSGD.swiftmodule"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/System\/Library\/Frameworks\/CFNetwork.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/CFNetwork-8SWLSMUO8ZDLAVV0RXI64MZJW.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/System\/Library\/Frameworks\/CFNetwork.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/CFNetwork-A6FB0NO27TMQ8W89N9I8OTURS.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "CFNetwork"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/System\/Library\/Frameworks\/CoreFoundation.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/CoreFoundation-3VPXEWXZT7QL1D0IK0FCN623T.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/System\/Library\/Frameworks\/CoreFoundation.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/CoreFoundation-F3H63C1DPQDP17ANIJ8UHMS4D.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "CoreFoundation"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/System\/Library\/Frameworks\/CoreServices.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/CoreServices-8Y8XLWTRUVX92SOVAUCDHP566.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/System\/Library\/Frameworks\/CoreServices.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/CoreServices-8YAM1RTUB5D81GT30XFOO7SGS.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "CoreServices"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/Darwin.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Darwin-1PO333ST3ZHUE3CMDK11CYMRD.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/Darwin.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Darwin-D6MYOFGYMIB6Y8OKZ0RI1X0SB.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "Darwin"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/System\/Library\/Frameworks\/DiskArbitration.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/DiskArbitration-7V03GTHCIWJ4GC6S2YJK0PM9O.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/System\/Library\/Frameworks\/DiskArbitration.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/DiskArbitration-1HTA4IBSL1WWZ6VXU8E2DH4BO.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "DiskArbitration"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/dispatch.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Dispatch-13GWP0VO5YFASGFHV7FSBUUUN.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/dispatch.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Dispatch-5VU17F24X73A3FCCTI84ZPC7N.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "Dispatch"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/System\/Library\/Frameworks\/Foundation.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Foundation-CCQ97L9JPBHIMYMW51LOTRROG.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/System\/Library\/Frameworks\/Foundation.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Foundation-ACKVOFYRXRR50KGW4XV4OQ7RD.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "Foundation"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/System\/Library\/Frameworks\/IOKit.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/IOKit-4U6UIC9VEH6ZAE5X5MUIA0CD0.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/System\/Library\/Frameworks\/IOKit.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/IOKit-E5TXC7GF2H1H8GPUA4US05D6O.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "IOKit"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/DarwinBasic.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/MachO-3RUAM0ENCPOLY5X85F3O4MPD4.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/DarwinBasic.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/MachO-39MAC48JWYT2QDPJFHVK2FNYY.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "MachO"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/ObjectiveC.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/ObjectiveC-6K4BZG6FL62FHH4YW7YO7ZRW9.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/ObjectiveC.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/ObjectiveC-9T7BP113LI8SHW9ONPSCQEP5Z.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "ObjectiveC"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/System\/Library\/Frameworks\/Security.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Security-6022BI0SK4FDX6AUP1ZQQ1MYK.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/System\/Library\/Frameworks\/Security.framework\/Modules\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/Security-D3IH07DNM01CQA47X3PBC2O87.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "Security"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/lib\/swift\/shims\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/SwiftShims-5OVPMYW11HC3ZP1UM41DL1107.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/lib\/swift\/shims\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/SwiftShims-908JTSCB9N7VPIJMQJ1PZNYZR.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "SwiftShims"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/xpc.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/XPC-8S45JAQAI29K7FUVCQGP2E0WA.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/xpc.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/XPC-8LKV8SPA6LS03KXKU4WCZNHF0.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "XPC"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/DarwinFoundation1.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_AvailabilityInternal-CRU4IMFDXL4VC3IECO7AA9V92.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/DarwinFoundation1.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_AvailabilityInternal-7NMM7DAXX6A7IR8XY05UPZTOL.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_AvailabilityInternal"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_float-4FZH66PFDZMZBFAF7SUEA7LV6.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_float-61XD6D0QTECFXZZS24CDL1MJ7.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_Builtin_float"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_inttypes-HM5QYS9QSMKEW1AGU6690N4L.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_inttypes-2SINIPEZYXB8UWTOMW8YQOIGO.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_Builtin_inttypes"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_limits-4G0NQA5GK9Z713ELX38ZI3992.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_limits-7XFXMEX4HUG5WP1H8CF8N1EE2.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_Builtin_limits"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stdarg-838CZFRMP7CJQMTHHI2CESB8N.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stdarg-1XQOITE4V1BBP2BJ7M5OTBU94.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_Builtin_stdarg"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stdatomic-8SS4V6YRZHBVXKZHEMJ7831TJ.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stdatomic-5UL9X0N5TNKD0RYFBBEFYNUW7.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_Builtin_stdatomic"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stdbool-BK1A1AW1Z68Y0W1PX9ZO4PWT1.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stdbool-9C0R5SFJMCGOG1OPBWARSG8RZ.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_Builtin_stdbool"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stddef-78083T9YAQ2I3Y38AMA1XZ06H.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stddef-8HWLOIBNZ6CQAH1699BKPMNO4.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_Builtin_stddef"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stdint-4RHBWNI18KU9MI7Q2DQN83RJ8.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_Builtin_stdint-3AD0O3PS20TS854ZDUWJKQ829.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_Builtin_stdint"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/DarwinFoundation1.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation1-953JXDK1NE54C20WWJ2RBZ4I9.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/DarwinFoundation1.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation1-AU0YCCBBXI8HDDMQS2FFWE7G9.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_DarwinFoundation1"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/DarwinFoundation2.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation2-AVXB2H3XJ4O9L9X3WKK6Y8L4G.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/DarwinFoundation2.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation2-ACMDPTTH3YTUE8UJZ5UR68HU8.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_DarwinFoundation2"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/DarwinFoundation3.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation3-BQY27OGUP2M9UHIQQR15BGTJI.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/DarwinFoundation3.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_DarwinFoundation3-CORBOAAT9E5AWFEZDD6ZRTRX7.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_DarwinFoundation3"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/lib\/swift\/shims\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_SwiftConcurrencyShims-4GGTDYVZN9IK9W9BO3FQUMZ9B.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/lib\/swift\/shims\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/_SwiftConcurrencyShims-75EIVSEIU91LXJI1CFUUIK8UW.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "_SwiftConcurrencyShims"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/launch.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/launch-7J3E8HS4VVB3UD6CK61ZEB89C.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/launch.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/launch-G3RR0PY71UETBDB34FLUY6K0.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "launch"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/libDER\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/libDER-1BHGOP3QNX4AE7ETI40RXOUCB.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/libDER\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/libDER-ATOCQG69Z41COA5423P9J2R03.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "libDER"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/libkern.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/libkern-3P8RWJSXAQD33E5688RBYXXG.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/libkern.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/libkern-5GEE2D3ZYF3C33NC0SF2DQF8O.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "libkern"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/os.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/os-6PTMFPW6JVF1UEQ62TLJ7P5WL.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/os.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/os-BH0OXYTQKY0V39J3TJRC5ZHE7.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "os"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/os.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/os_object-1PDILO1CXHP8L6RRM9NBF8FA3.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/os.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/os_object-CTNCVH9V0QE2GFSL4WH8XGNPJ.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "os_object"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/os.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/os_workgroup-DQLHTOZ1KJ4SPSCA4FJB4PUQT.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/os.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/os_workgroup-EFGFZHMQQVHEBFYKJM9TTS283.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "os_workgroup"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/ptrauth-EXZ29ESNLUGAEIVCR2VR64YLY.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/ptrauth-2K7KNTSPGDZJ6K86MU9BKE1WU.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "ptrauth"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/usr\/lib\/clang\/21\/include\/module.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/ptrcheck-5SOYM7XO9J48444O7BU8LKZG8.pcm",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/ptrcheck-1YKDMD4KC8BCY1TVZ8BMLXBUC.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "ptrcheck"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/c_standard_library.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/string_h-CKYTK6OTWEC0DZ7NUUQS7Q961.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/c_standard_library.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/string_h-4RYRGWNKE50AN10N3ETPZFLS8.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "string_h"
},
{
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.0.sdk\/usr\/include\/DarwinFoundation2.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/sys_types-47ERAGTYA98Z5MRSBBKMJNL74.pcm",
"clangModuleMapPath" : "\/Library\/Developer\/CommandLineTools\/SDKs\/MacOSX27.2.sdk\/usr\/include\/DarwinFoundation2.modulemap",
"clangModulePath" : "\/Users\/accusys\/momentry_core\/tools\/cli\/swift\/.build\/out\/SDKExplicitPrecompiledModules\/sys_types-EFKODKC7EBOACNANX52AC9PIN.pcm",
"isBridgingHeaderDependency" : false,
"isFramework" : false,
"moduleName" : "sys_types"

Some files were not shown because too many files have changed in this diff Show More