x4d-devkit 0.61.0__tar.gz → 0.62.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. {x4d_devkit-0.61.0/x4d_devkit.egg-info → x4d_devkit-0.62.0rc1}/PKG-INFO +1 -1
  2. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/pyproject.toml +1 -1
  3. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_sdk_api.py +1 -1
  4. x4d_devkit-0.62.0rc1/tests/test_work_facts.py +172 -0
  5. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/__init__.py +3 -0
  6. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/client.py +2 -0
  7. x4d_devkit-0.62.0rc1/x4d_devkit/client/work_facts.py +75 -0
  8. x4d_devkit-0.62.0rc1/x4d_devkit/work_facts.py +274 -0
  9. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1/x4d_devkit.egg-info}/PKG-INFO +1 -1
  10. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit.egg-info/SOURCES.txt +3 -0
  11. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/LICENSE +0 -0
  12. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/README.md +0 -0
  13. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/setup.cfg +0 -0
  14. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_accounts.py +0 -0
  15. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_annotation_contract.py +0 -0
  16. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_annotation_document_hash.py +0 -0
  17. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_annotation_reference.py +0 -0
  18. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_assets_client.py +0 -0
  19. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_boundary.py +0 -0
  20. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_box.py +0 -0
  21. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_build_info.py +0 -0
  22. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_category_audit.py +0 -0
  23. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_clean_basemap.py +0 -0
  24. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_clean_basemap_client.py +0 -0
  25. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_cli_auth.py +0 -0
  26. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_client_json_contract.py +0 -0
  27. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_client_projects.py +0 -0
  28. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_clip_archives.py +0 -0
  29. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_contract_validation.py +0 -0
  30. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_contracts.py +0 -0
  31. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_coordinate_frames.py +0 -0
  32. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_current_state.py +0 -0
  33. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_current_state_identity_consumers_example.py +0 -0
  34. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_dataset_contract.py +0 -0
  35. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_dataset_identity.py +0 -0
  36. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_detection_eval.py +0 -0
  37. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_evaluate.py +0 -0
  38. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_export_bundle.py +0 -0
  39. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_clip.py +0 -0
  40. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_conditional_rules.py +0 -0
  41. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_enum_set.py +0 -0
  42. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_export.py +0 -0
  43. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_external_predictions.py +0 -0
  44. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_geometry.py +0 -0
  45. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_groups.py +0 -0
  46. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_polygon.py +0 -0
  47. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_preannotation.py +0 -0
  48. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_reference.py +0 -0
  49. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_review.py +0 -0
  50. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_schema_migration.py +0 -0
  51. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_schema_registry_client.py +0 -0
  52. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_schema_upgrade.py +0 -0
  53. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_source.py +0 -0
  54. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_image_work_session.py +0 -0
  55. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_inference_input.py +0 -0
  56. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_inference_schemas.py +0 -0
  57. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_inference_service.py +0 -0
  58. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_label_schemas.py +0 -0
  59. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_lidar_materialization.py +0 -0
  60. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_loader.py +0 -0
  61. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_matching.py +0 -0
  62. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_metrics.py +0 -0
  63. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_models.py +0 -0
  64. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_parse_equivalence.py +0 -0
  65. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_platform_pose.py +0 -0
  66. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_preannotation_client.py +0 -0
  67. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_project_discovery.py +0 -0
  68. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_reconstruction_client.py +0 -0
  69. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_release_gate.py +0 -0
  70. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_roadmark_preview.py +0 -0
  71. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_semantic_scene_authoring.py +0 -0
  72. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_semantic_scene_client.py +0 -0
  73. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_semantic_scene_contract.py +0 -0
  74. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_semantic_scene_independent.py +0 -0
  75. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_semantic_scene_native_clip.py +0 -0
  76. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_source_attributes.py +0 -0
  77. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_source_content.py +0 -0
  78. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_time_contract.py +0 -0
  79. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_token.py +0 -0
  80. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_tracking_eval.py +0 -0
  81. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_training_identity.py +0 -0
  82. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_transform.py +0 -0
  83. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_transform_chain.py +0 -0
  84. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_validation.py +0 -0
  85. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_vector_map.py +0 -0
  86. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_vector_map_geometry.py +0 -0
  87. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_vector_map_session.py +0 -0
  88. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_work_items.py +0 -0
  89. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_work_session.py +0 -0
  90. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/tests/test_work_session_validation_reuse.py +0 -0
  91. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/__init__.py +0 -0
  92. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/_image_contract.py +0 -0
  93. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/accounts.py +0 -0
  94. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/annotation_contract.py +0 -0
  95. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/annotation_reference.py +0 -0
  96. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/audit.py +0 -0
  97. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/build_info.py +0 -0
  98. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/clean_basemap.py +0 -0
  99. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/cli.py +0 -0
  100. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/_origin.py +0 -0
  101. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/accounts.py +0 -0
  102. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/annotation_reference.py +0 -0
  103. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/assets.py +0 -0
  104. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/bags.py +0 -0
  105. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/capabilities.py +0 -0
  106. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/checkpoints.py +0 -0
  107. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/clean_basemap.py +0 -0
  108. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/clip_work_sessions.py +0 -0
  109. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/clips.py +0 -0
  110. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/dataset_identity.py +0 -0
  111. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/image_clips.py +0 -0
  112. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/image_exports.py +0 -0
  113. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/image_preannotations.py +0 -0
  114. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/image_review.py +0 -0
  115. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/image_schemas.py +0 -0
  116. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/image_work_sessions.py +0 -0
  117. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/label_schemas.py +0 -0
  118. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/preannotation.py +0 -0
  119. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/projects.py +0 -0
  120. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/reconstruction.py +0 -0
  121. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/semantic_scene.py +0 -0
  122. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/semantic_scene_authoring.py +0 -0
  123. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/services.py +0 -0
  124. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/test_sets.py +0 -0
  125. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/client/work_items.py +0 -0
  126. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/consumer_identity.py +0 -0
  127. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/contracts.py +0 -0
  128. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/coordinate_contract.py +0 -0
  129. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/core/__init__.py +0 -0
  130. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/core/loader.py +0 -0
  131. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/core/models.py +0 -0
  132. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/core/token.py +0 -0
  133. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/core/transform.py +0 -0
  134. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/current_state.py +0 -0
  135. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/dataset_contract.py +0 -0
  136. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/dataset_identity.py +0 -0
  137. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/eval/__init__.py +0 -0
  138. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/eval/api.py +0 -0
  139. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/eval/box.py +0 -0
  140. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/eval/detection.py +0 -0
  141. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/eval/matching.py +0 -0
  142. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/eval/metrics.py +0 -0
  143. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/eval/tracking.py +0 -0
  144. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/export_bundle.py +0 -0
  145. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_clip.py +0 -0
  146. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_export.py +0 -0
  147. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_geometry.py +0 -0
  148. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_groups.py +0 -0
  149. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_preannotation.py +0 -0
  150. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_reference.py +0 -0
  151. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_review.py +0 -0
  152. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_schema.py +0 -0
  153. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_schema_migration.py +0 -0
  154. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_schema_upgrade.py +0 -0
  155. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_source.py +0 -0
  156. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/image_work_session.py +0 -0
  157. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/inference/__init__.py +0 -0
  158. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/inference/input.py +0 -0
  159. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/inference/models.py +0 -0
  160. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/inference/schemas.py +0 -0
  161. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/inference/service.py +0 -0
  162. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/inference/tasks.py +0 -0
  163. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/json_contract.py +0 -0
  164. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/label_schema.py +0 -0
  165. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/lidar_materialization.py +0 -0
  166. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/materialize.py +0 -0
  167. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/project_discovery.py +0 -0
  168. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/roadmark_preview.py +0 -0
  169. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/semantic_scene_authoring.py +0 -0
  170. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/semantic_scene_contract.py +0 -0
  171. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/source_content.py +0 -0
  172. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/time_contract.py +0 -0
  173. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/training_identity.py +0 -0
  174. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/validation/__init__.py +0 -0
  175. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/validation/contract.py +0 -0
  176. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/validation/platform_pose.py +0 -0
  177. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/validation/report.py +0 -0
  178. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/validation/validator.py +0 -0
  179. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/vector_map.py +0 -0
  180. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/vector_map_geometry.py +0 -0
  181. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/work_items.py +0 -0
  182. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit/work_session.py +0 -0
  183. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit.egg-info/dependency_links.txt +0 -0
  184. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit.egg-info/entry_points.txt +0 -0
  185. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit.egg-info/requires.txt +0 -0
  186. {x4d_devkit-0.61.0 → x4d_devkit-0.62.0rc1}/x4d_devkit.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: x4d-devkit
3
- Version: 0.61.0
3
+ Version: 0.62.0rc1
4
4
  Summary: Official X-4D external SDK and CLI for datasets, platform APIs, training bridges, and automation
5
5
  Author: windzu
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "x4d-devkit"
7
- version = "0.61.0"
7
+ version = "0.62.0rc1"
8
8
  description = "Official X-4D external SDK and CLI for datasets, platform APIs, training bridges, and automation"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -11,7 +11,7 @@ from x4d_devkit.eval.matching import MetricData
11
11
 
12
12
 
13
13
  def test_package_version_is_current_release():
14
- assert x4d_devkit.__version__ == "0.61.0"
14
+ assert x4d_devkit.__version__ == "0.62.0rc1"
15
15
 
16
16
 
17
17
  def test_loader_exposes_and_enforces_only_current_schema(tmp_path):
@@ -0,0 +1,172 @@
1
+ from copy import deepcopy
2
+ import json
3
+
4
+ import httpx
5
+ import pytest
6
+
7
+ from x4d_devkit.client import WorkFactError, X4DClient
8
+ from x4d_devkit.work_facts import (
9
+ MAX_WORK_FACTS_PER_BATCH,
10
+ WORK_COUNT_KINDS,
11
+ WORK_FACT_BATCH_CONTRACT,
12
+ WORK_FACT_RECEIPT_CONTRACT,
13
+ parse_work_fact,
14
+ parse_work_fact_batch,
15
+ parse_work_fact_receipt,
16
+ work_fact_batch,
17
+ work_fact_time,
18
+ )
19
+
20
+ BASE = {"project_id": 3, "clip_id": "clip-001", "round": 1}
21
+ FACTS = {
22
+ "progress": {
23
+ "fact_id": "p-1", "kind": "progress", **BASE,
24
+ "units_total": 40, "units_done": 12, "stage": "editing", "saved_at": "2026-11-17T01:00:00Z",
25
+ },
26
+ "unit_completed": {
27
+ "fact_id": "c-1", "kind": "unit_completed", **BASE, "unit_id": "cam_front/000012.jpg",
28
+ "counts": {"box_2d": 3, "description": 1}, "completed_at": "2026-11-17T01:00:00.5Z",
29
+ },
30
+ "unit_reviewed": {
31
+ "fact_id": "r-1", "kind": "unit_reviewed", **BASE, "unit_id": "cam_front/000012.jpg",
32
+ "verdict": "defect", "defect_count": 2, "reviewed_at": "2026-11-17T03:00:00Z",
33
+ },
34
+ "activity": {
35
+ "fact_id": "a-1", "kind": "activity", **BASE, "stage": "annotate",
36
+ "started_at": "2026-11-17T00:50:00Z", "ended_at": "2026-11-17T01:20:00Z",
37
+ },
38
+ "watermark": {
39
+ "fact_id": "w-1", "kind": "watermark", "project_id": 3, "delivered_through": "2026-11-17T16:00:00Z",
40
+ },
41
+ }
42
+
43
+
44
+ def fact(kind, **changes):
45
+ value = deepcopy(FACTS[kind])
46
+ value.update(changes)
47
+ return value
48
+
49
+
50
+ @pytest.mark.parametrize("kind", sorted(FACTS))
51
+ def test_every_fact_kind_round_trips(kind):
52
+ assert parse_work_fact(fact(kind)) == FACTS[kind]
53
+
54
+
55
+ def test_occurrence_time_is_the_kind_specific_instant():
56
+ assert work_fact_time(fact("activity")) == "2026-11-17T01:20:00Z"
57
+ assert work_fact_time(fact("unit_reviewed")) == "2026-11-17T03:00:00Z"
58
+
59
+
60
+ @pytest.mark.parametrize(
61
+ "value, message",
62
+ [
63
+ (fact("progress", units_done=41), "within units_total"),
64
+ (fact("progress", stage="accepted"), "stage must be one of"),
65
+ (fact("unit_completed", counts={"description": 1, "box_2d": 3}), "sorted"),
66
+ (fact("unit_completed", counts={"box_2d": 0}), "counts.box_2d"),
67
+ (fact("unit_completed", counts={"cuboid": 1}), "drawn from"),
68
+ (fact("unit_reviewed", verdict="pass", defect_count=1), "exactly when verdict is pass"),
69
+ (fact("unit_reviewed", verdict="defect", defect_count=0), "exactly when verdict is pass"),
70
+ (fact("activity", ended_at="2026-11-17T00:50:00Z"), "end after it starts"),
71
+ (fact("activity", started_at="2026-11-16T00:00:00Z"), "at most"),
72
+ (fact("activity", ended_at="2026-11-17T09:20:00+08:00"), "UTC timestamp"),
73
+ (fact("watermark", clip_id="clip-001"), "fields do not match"),
74
+ (fact("progress", actor_id=7), "fields do not match"),
75
+ (fact("progress", fact_id="-bad"), "fact_id"),
76
+ (fact("progress", round=0), "round"),
77
+ (fact("unit_completed", unit_id=" padded"), "unit_id"),
78
+ ({**fact("progress"), "kind": "login"}, "kind must be one of"),
79
+ ],
80
+ )
81
+ def test_facts_reject_anything_outside_the_current_contract(value, message):
82
+ with pytest.raises(ValueError, match=message):
83
+ parse_work_fact(value)
84
+
85
+
86
+ def test_confirmed_empty_unit_has_no_counts_and_3d_kinds_are_allowed():
87
+ parse_work_fact(fact("unit_completed", counts={}))
88
+ parse_work_fact(fact("unit_completed", counts={"box_3d": 7, "track_3d": 2}))
89
+ assert set(WORK_COUNT_KINDS) >= {"box_2d", "polyline_2d", "polygon_2d", "box_3d", "track_3d", "description"}
90
+
91
+
92
+ def test_batches_bound_size_require_unique_ids_and_one_source():
93
+ batch = work_fact_batch("x-images", [fact("progress"), fact("activity")])
94
+ assert batch["contract_version"] == WORK_FACT_BATCH_CONTRACT
95
+ with pytest.raises(ValueError, match="unique"):
96
+ work_fact_batch("x-images", [fact("progress"), fact("activity", fact_id="p-1")])
97
+ with pytest.raises(ValueError, match="1–500"):
98
+ work_fact_batch("x-images", [])
99
+ many = [fact("activity", fact_id=f"a-{i}") for i in range(MAX_WORK_FACTS_PER_BATCH + 1)]
100
+ with pytest.raises(ValueError, match="1–500"):
101
+ work_fact_batch("x-images", many)
102
+ with pytest.raises(ValueError, match="source"):
103
+ work_fact_batch("X Images", [fact("progress")])
104
+ with pytest.raises(ValueError, match=r"facts\[1\]"):
105
+ work_fact_batch("x-points", [fact("progress"), fact("progress", fact_id="p-2", units_total=-1)])
106
+ with pytest.raises(ValueError, match="fields do not match"):
107
+ parse_work_fact_batch({**batch, "actor_id": 9})
108
+
109
+
110
+ def receipt(*results):
111
+ return {"contract_version": WORK_FACT_RECEIPT_CONTRACT, "results": list(results)}
112
+
113
+
114
+ def test_receipts_carry_codes_only_on_rejection():
115
+ parse_work_fact_receipt(receipt(
116
+ {"fact_id": "p-1", "status": "accepted", "code": None},
117
+ {"fact_id": "a-1", "status": "duplicate", "code": None},
118
+ {"fact_id": "r-1", "status": "rejected", "code": "work_fact_role_mismatch"},
119
+ ))
120
+ with pytest.raises(ValueError, match="only on a rejected"):
121
+ parse_work_fact_receipt(receipt({"fact_id": "p-1", "status": "accepted", "code": "work_fact_conflict"}))
122
+ with pytest.raises(ValueError, match="code must be one of"):
123
+ parse_work_fact_receipt(receipt({"fact_id": "p-1", "status": "rejected", "code": None}))
124
+
125
+
126
+ def _client(handler):
127
+ client = X4DClient(api_url="http://platform.test", token="t")
128
+ client._http.close()
129
+ client._http = httpx.Client(base_url=client.api_url, transport=httpx.MockTransport(handler))
130
+ return client
131
+
132
+
133
+ def test_client_reports_and_verifies_the_receipt_order():
134
+ seen = []
135
+
136
+ def handler(request):
137
+ body = json.loads(request.content)
138
+ seen.append((request.method, request.url.path, body))
139
+ return httpx.Response(200, json=receipt(*(
140
+ {"fact_id": row["fact_id"], "status": "accepted", "code": None} for row in body["facts"]
141
+ )))
142
+
143
+ with _client(handler) as client:
144
+ result = client.work_facts.report(source="x-images", facts=[fact("progress"), fact("watermark")])
145
+ assert [row["status"] for row in result["results"]] == ["accepted", "accepted"]
146
+ method, path, body = seen[0]
147
+ assert (method, path, body["source"]) == ("POST", "/api/v1/work/facts", "x-images")
148
+ assert "actor_id" not in json.dumps(body), "the platform derives the actor from the token"
149
+
150
+
151
+ def test_client_rejects_foreign_receipts_and_maps_batch_errors():
152
+ def reordered(request):
153
+ return httpx.Response(200, json=receipt(
154
+ {"fact_id": "w-1", "status": "accepted", "code": None},
155
+ {"fact_id": "p-1", "status": "accepted", "code": None},
156
+ ))
157
+
158
+ with _client(reordered) as client:
159
+ with pytest.raises(ValueError, match="another request"):
160
+ client.work_facts.report(source="x-images", facts=[fact("progress"), fact("watermark")])
161
+
162
+ def too_large(request):
163
+ return httpx.Response(413, json={"detail": {"code": "work_fact_batch_too_large", "message": "too many"}})
164
+
165
+ with _client(too_large) as client:
166
+ with pytest.raises(WorkFactError) as caught:
167
+ client.work_facts.report(source="x-images", facts=[fact("progress")])
168
+ assert caught.value.to_dict() == {"code": "work_fact_batch_too_large", "message": "too many", "status_code": 413}
169
+
170
+ with _client(lambda request: pytest.fail("invalid batches never reach the platform")) as client:
171
+ with pytest.raises(ValueError):
172
+ client.work_facts.report(source="x-images", facts=[fact("progress", units_done=99)])
@@ -42,6 +42,7 @@ from x4d_devkit.client.reconstruction import (
42
42
  )
43
43
  from x4d_devkit.client.services import ServicesAPI
44
44
  from x4d_devkit.client.test_sets import TestSetsAPI
45
+ from x4d_devkit.client.work_facts import WorkFactError, WorkFactsAPI
45
46
  from x4d_devkit.client.work_items import WorkItemError, WorkItemsAPI
46
47
 
47
48
  from x4d_devkit.client.image_schemas import (
@@ -52,6 +53,8 @@ from x4d_devkit.client.image_schemas import (
52
53
 
53
54
  __all__ = [
54
55
  "WorkItemError",
56
+ "WorkFactError",
57
+ "WorkFactsAPI",
55
58
  "WorkItemsAPI",
56
59
  "ImageProjectSchemaEntry",
57
60
  "ImageSchemaEntry",
@@ -37,6 +37,7 @@ from x4d_devkit.client.projects import ProjectsAPI
37
37
  from x4d_devkit.client.reconstruction import ReconstructionAPI
38
38
  from x4d_devkit.client.services import ServicesAPI
39
39
  from x4d_devkit.client.test_sets import TestSetsAPI
40
+ from x4d_devkit.client.work_facts import WorkFactsAPI
40
41
  from x4d_devkit.client.work_items import WorkItemsAPI
41
42
  from x4d_devkit.json_contract import parse_i_json
42
43
 
@@ -92,6 +93,7 @@ class X4DClient:
92
93
  self.test_sets = TestSetsAPI(self)
93
94
  self.checkpoints = CheckpointsAPI(self)
94
95
  self.work_items = WorkItemsAPI(self)
96
+ self.work_facts = WorkFactsAPI(self)
95
97
  self._preannotation: PreannotationAPI | None = None
96
98
  self._image_review: ImageReviewAPI | None = None
97
99
 
@@ -0,0 +1,75 @@
1
+ """Typed reporting client for editor work facts (X-4D #1000).
2
+
3
+ The platform authorizes every fact against the authenticated caller's role on
4
+ that Clip round; a locally valid batch is never accepted on its own.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from typing import Any
10
+
11
+ import httpx
12
+
13
+ from x4d_devkit.work_facts import (
14
+ WORK_FACT_ERROR_CODES,
15
+ parse_work_fact_receipt,
16
+ work_fact_batch,
17
+ )
18
+
19
+
20
+ class WorkFactError(RuntimeError):
21
+ """A whole-batch platform rejection carrying one ``work_fact_*`` code."""
22
+
23
+ def __init__(self, code: str, message: str, status_code: int):
24
+ super().__init__(message)
25
+ self.code = code
26
+ self.message = message
27
+ self.status_code = status_code
28
+
29
+ def to_dict(self) -> dict[str, Any]:
30
+ return {"code": self.code, "message": self.message, "status_code": self.status_code}
31
+
32
+
33
+ def _fact_error(exc: httpx.HTTPStatusError) -> WorkFactError | None:
34
+ try:
35
+ payload = exc.response.json()
36
+ except Exception:
37
+ return None
38
+ detail = payload.get("detail", payload) if isinstance(payload, dict) else None
39
+ if not isinstance(detail, dict) or detail.get("code") not in WORK_FACT_ERROR_CODES:
40
+ return None
41
+ message = detail.get("message")
42
+ return WorkFactError(
43
+ detail["code"],
44
+ message if isinstance(message, str) and message else detail["code"],
45
+ int(exc.response.status_code),
46
+ )
47
+
48
+
49
+ class WorkFactsAPI:
50
+ def __init__(self, client):
51
+ self._client = client
52
+
53
+ def report(self, *, source: str, facts: list[dict]) -> dict:
54
+ """Report 1–500 facts; returns the receipt with one result per fact, in order.
55
+
56
+ Resending the same facts is safe: already stored facts come back as
57
+ ``duplicate``. A fact ID reused with different content is
58
+ ``rejected`` with ``work_fact_conflict``.
59
+ """
60
+
61
+ batch = work_fact_batch(source, facts)
62
+ try:
63
+ response = self._client.post("/work/facts", json=batch)
64
+ except httpx.HTTPStatusError as exc:
65
+ error = _fact_error(exc)
66
+ if error is not None:
67
+ raise error from exc
68
+ raise
69
+ receipt = parse_work_fact_receipt(response)
70
+ if [row["fact_id"] for row in receipt["results"]] != [fact["fact_id"] for fact in batch["facts"]]:
71
+ raise ValueError("work fact receipt belongs to another request")
72
+ return receipt
73
+
74
+
75
+ __all__ = ["WorkFactError", "WorkFactsAPI"]
@@ -0,0 +1,274 @@
1
+ """Strict editor-reported work facts for platform work statistics (X-4D #1000).
2
+
3
+ An editor (X-Points, X-Images) records what already happened on its server
4
+ and reports it in batches. Devkit validates only the document grammar. The
5
+ platform derives the actor from the authenticated caller, checks that the
6
+ caller held the matching role on that Clip round, deduplicates, and owns
7
+ every aggregation (daily report, progress, workload). Nothing here grants
8
+ access to Clip data.
9
+
10
+ Counting rules the facts carry (the platform design owns their meaning):
11
+
12
+ - A *unit* is one image for 2D image tasks (image x view for multi-view
13
+ tasks) and one keyframe for 3D tasks.
14
+ - ``unit_completed`` is reported once, when a unit is first confirmed and
15
+ saved on the editor server; confirmed-empty units have empty ``counts``.
16
+ For 3D, units complete when the Clip is submitted for review.
17
+ - ``counts`` keys are geometry kinds. ``box_3d`` counts boxes on that
18
+ keyframe; ``track_3d`` counts tracks whose first keyframe is this unit, so
19
+ the sum over units is the number of distinct tracks.
20
+ - ``unit_reviewed`` is reported once per unit, for its first review.
21
+ - ``activity`` reports effective-operation intervals, never accumulated
22
+ durations; the platform unions overlapping intervals per person.
23
+ - ``watermark`` declares that every fact of this source and project that
24
+ occurred before ``delivered_through`` has been reported.
25
+ """
26
+
27
+ from __future__ import annotations
28
+
29
+ import re
30
+ import unicodedata
31
+ from datetime import datetime
32
+ from typing import Any
33
+
34
+ from x4d_devkit.image_schema import IMAGE_GEOMETRY_TYPES
35
+ from x4d_devkit.json_contract import ensure_i_json
36
+ from x4d_devkit.work_items import validate_clip_id, work_integer
37
+
38
+ WORK_FACT_BATCH_CONTRACT = "x4d-work-fact-batch-v1"
39
+ WORK_FACT_RECEIPT_CONTRACT = "x4d-work-fact-receipt-v1"
40
+
41
+ WORK_FACT_KINDS = ("activity", "progress", "unit_completed", "unit_reviewed", "watermark")
42
+ WORK_COUNT_KINDS = tuple(sorted((*IMAGE_GEOMETRY_TYPES, "box_3d", "description", "track_3d")))
43
+ WORK_EDITOR_STAGES = ("editing", "review_passed_unpublished", "reviewing")
44
+ WORK_ACTIVITY_STAGES = ("annotate", "review")
45
+ WORK_REVIEW_VERDICTS = ("defect", "pass")
46
+ WORK_FACT_STATUSES = ("accepted", "duplicate", "rejected")
47
+ WORK_FACT_ERROR_CODES = (
48
+ "work_fact_batch_too_large",
49
+ "work_fact_clip_not_found",
50
+ "work_fact_conflict",
51
+ "work_fact_invalid",
52
+ "work_fact_out_of_window",
53
+ "work_fact_role_mismatch",
54
+ )
55
+
56
+ MAX_WORK_FACTS_PER_BATCH = 500
57
+ MAX_ACTIVITY_SECONDS = 12 * 3600
58
+ MAX_UNIT_COUNT = 1_000_000
59
+
60
+ _TOKEN_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$")
61
+ _SOURCE_RE = re.compile(r"^[a-z][a-z0-9-]{0,63}$")
62
+ _UTC_RE = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,6})?Z$")
63
+
64
+ _COMMON = {"fact_id", "kind", "project_id"}
65
+ _FIELDS = {
66
+ "progress": _COMMON | {"clip_id", "round", "units_total", "units_done", "stage", "saved_at"},
67
+ "unit_completed": _COMMON | {"clip_id", "round", "unit_id", "counts", "completed_at"},
68
+ "unit_reviewed": _COMMON | {"clip_id", "round", "unit_id", "verdict", "defect_count", "reviewed_at"},
69
+ "activity": _COMMON | {"clip_id", "round", "stage", "started_at", "ended_at"},
70
+ "watermark": _COMMON | {"delivered_through"},
71
+ }
72
+
73
+
74
+ def _require(condition: bool, message: str) -> None:
75
+ if not condition:
76
+ raise ValueError(message)
77
+
78
+
79
+ def _token(value: Any, name: str) -> str:
80
+ _require(
81
+ type(value) is str and _TOKEN_RE.fullmatch(value) is not None,
82
+ f"{name} must be 1–128 characters of [A-Za-z0-9._:-] starting alphanumeric",
83
+ )
84
+ return value
85
+
86
+
87
+ def validate_work_fact_source(value: Any) -> str:
88
+ _require(
89
+ type(value) is str and _SOURCE_RE.fullmatch(value) is not None,
90
+ "source must be 1–64 lowercase characters of [a-z0-9-] starting with a letter",
91
+ )
92
+ return value
93
+
94
+
95
+ def _unit_id(value: Any) -> str:
96
+ _require(
97
+ type(value) is str
98
+ and 1 <= len(value) <= 256
99
+ and value == value.strip()
100
+ and not any(unicodedata.category(c).startswith("C") for c in value),
101
+ "unit_id must be canonical text of 1–256 characters without controls",
102
+ )
103
+ return value
104
+
105
+
106
+ def _utc(value: Any, name: str) -> datetime:
107
+ _require(
108
+ type(value) is str and _UTC_RE.fullmatch(value) is not None,
109
+ f"{name} must be an RFC 3339 UTC timestamp ending in Z",
110
+ )
111
+ whole, _, fraction = value[:-1].partition(".")
112
+ # Python 3.10 parses only 3- or 6-digit fractions; pad to microseconds.
113
+ return datetime.fromisoformat(f"{whole}.{fraction.ljust(6, '0')}+00:00")
114
+
115
+
116
+ def _enum(value: Any, allowed: tuple[str, ...], name: str) -> str:
117
+ _require(type(value) is str and value in allowed, f"{name} must be one of {allowed}")
118
+ return value
119
+
120
+
121
+ def _counts(value: Any) -> dict[str, int]:
122
+ _require(type(value) is dict, "counts must be an object")
123
+ keys = list(value)
124
+ _require(
125
+ keys == sorted(keys) and all(key in WORK_COUNT_KINDS for key in keys),
126
+ f"counts keys must be sorted and drawn from {list(WORK_COUNT_KINDS)}",
127
+ )
128
+ for key in keys:
129
+ work_integer(value[key], f"counts.{key}", minimum=1)
130
+ _require(value[key] <= MAX_UNIT_COUNT, f"counts.{key} exceeds {MAX_UNIT_COUNT}")
131
+ return dict(value)
132
+
133
+
134
+ def parse_work_fact(value: Any) -> dict:
135
+ """Validate one fact; returns the same canonical document."""
136
+
137
+ _require(type(value) is dict, "fact must be an object")
138
+ kind = _enum(value.get("kind"), WORK_FACT_KINDS, "kind")
139
+ _require(set(value) == _FIELDS[kind], f"{kind} fact fields do not match the current contract")
140
+ _token(value["fact_id"], "fact_id")
141
+ work_integer(value["project_id"], "project_id", minimum=1)
142
+ if kind == "watermark":
143
+ _utc(value["delivered_through"], "delivered_through")
144
+ return value
145
+ validate_clip_id(value["clip_id"])
146
+ work_integer(value["round"], "round", minimum=1)
147
+ if kind == "progress":
148
+ total = work_integer(value["units_total"], "units_total")
149
+ done = work_integer(value["units_done"], "units_done")
150
+ _require(total <= MAX_UNIT_COUNT and done <= total, "units_done must be within units_total")
151
+ _enum(value["stage"], WORK_EDITOR_STAGES, "stage")
152
+ _utc(value["saved_at"], "saved_at")
153
+ elif kind == "unit_completed":
154
+ _unit_id(value["unit_id"])
155
+ _counts(value["counts"])
156
+ _utc(value["completed_at"], "completed_at")
157
+ elif kind == "unit_reviewed":
158
+ _unit_id(value["unit_id"])
159
+ verdict = _enum(value["verdict"], WORK_REVIEW_VERDICTS, "verdict")
160
+ defects = work_integer(value["defect_count"], "defect_count")
161
+ _require(
162
+ (verdict == "pass") == (defects == 0) and defects <= MAX_UNIT_COUNT,
163
+ "defect_count is 0 exactly when verdict is pass",
164
+ )
165
+ _utc(value["reviewed_at"], "reviewed_at")
166
+ else:
167
+ _enum(value["stage"], WORK_ACTIVITY_STAGES, "stage")
168
+ started = _utc(value["started_at"], "started_at")
169
+ ended = _utc(value["ended_at"], "ended_at")
170
+ seconds = (ended - started).total_seconds()
171
+ _require(
172
+ 0 < seconds <= MAX_ACTIVITY_SECONDS,
173
+ f"activity must end after it starts and last at most {MAX_ACTIVITY_SECONDS} seconds",
174
+ )
175
+ return value
176
+
177
+
178
+ def work_fact_time(fact: dict) -> str:
179
+ """The instant a validated fact occurred (an activity ends at ``ended_at``)."""
180
+
181
+ return fact[
182
+ {
183
+ "progress": "saved_at",
184
+ "unit_completed": "completed_at",
185
+ "unit_reviewed": "reviewed_at",
186
+ "activity": "ended_at",
187
+ "watermark": "delivered_through",
188
+ }[fact["kind"]]
189
+ ]
190
+
191
+
192
+ def parse_work_fact_batch(value: Any) -> dict:
193
+ """Validate a report batch: one source, 1–500 facts, unique fact IDs."""
194
+
195
+ ensure_i_json(value, path="work_fact_batch")
196
+ _require(
197
+ type(value) is dict and set(value) == {"contract_version", "source", "facts"},
198
+ "work fact batch fields do not match the current contract",
199
+ )
200
+ _require(value["contract_version"] == WORK_FACT_BATCH_CONTRACT, "unsupported work fact batch contract")
201
+ validate_work_fact_source(value["source"])
202
+ facts = value["facts"]
203
+ _require(
204
+ type(facts) is list and 1 <= len(facts) <= MAX_WORK_FACTS_PER_BATCH,
205
+ f"facts must list 1–{MAX_WORK_FACTS_PER_BATCH} facts",
206
+ )
207
+ for index, fact in enumerate(facts):
208
+ try:
209
+ parse_work_fact(fact)
210
+ except ValueError as exc:
211
+ raise ValueError(f"facts[{index}]: {exc}") from None
212
+ ids = [fact["fact_id"] for fact in facts]
213
+ _require(len(set(ids)) == len(ids), "fact_id must be unique within a batch")
214
+ return value
215
+
216
+
217
+ def work_fact_batch(source: str, facts: list[dict]) -> dict:
218
+ """Build and validate a report batch."""
219
+
220
+ return parse_work_fact_batch(
221
+ {"contract_version": WORK_FACT_BATCH_CONTRACT, "source": source, "facts": list(facts)}
222
+ )
223
+
224
+
225
+ def parse_work_fact_receipt(value: Any) -> dict:
226
+ """Validate a receipt: one result per reported fact, in request order."""
227
+
228
+ ensure_i_json(value, path="work_fact_receipt")
229
+ _require(
230
+ type(value) is dict and set(value) == {"contract_version", "results"},
231
+ "work fact receipt fields do not match the current contract",
232
+ )
233
+ _require(
234
+ value["contract_version"] == WORK_FACT_RECEIPT_CONTRACT, "unsupported work fact receipt contract"
235
+ )
236
+ results = value["results"]
237
+ _require(
238
+ type(results) is list and 1 <= len(results) <= MAX_WORK_FACTS_PER_BATCH,
239
+ "receipt results must list 1–500 results",
240
+ )
241
+ for result in results:
242
+ _require(
243
+ type(result) is dict and set(result) == {"fact_id", "status", "code"},
244
+ "receipt result fields do not match the current contract",
245
+ )
246
+ _token(result["fact_id"], "fact_id")
247
+ status = _enum(result["status"], WORK_FACT_STATUSES, "status")
248
+ if status == "rejected":
249
+ _enum(result["code"], WORK_FACT_ERROR_CODES, "code")
250
+ else:
251
+ _require(result["code"] is None, "code is present only on a rejected result")
252
+ return value
253
+
254
+
255
+ __all__ = [
256
+ "MAX_ACTIVITY_SECONDS",
257
+ "MAX_UNIT_COUNT",
258
+ "MAX_WORK_FACTS_PER_BATCH",
259
+ "WORK_ACTIVITY_STAGES",
260
+ "WORK_COUNT_KINDS",
261
+ "WORK_EDITOR_STAGES",
262
+ "WORK_FACT_BATCH_CONTRACT",
263
+ "WORK_FACT_ERROR_CODES",
264
+ "WORK_FACT_KINDS",
265
+ "WORK_FACT_RECEIPT_CONTRACT",
266
+ "WORK_FACT_STATUSES",
267
+ "WORK_REVIEW_VERDICTS",
268
+ "parse_work_fact",
269
+ "parse_work_fact_batch",
270
+ "parse_work_fact_receipt",
271
+ "validate_work_fact_source",
272
+ "work_fact_batch",
273
+ "work_fact_time",
274
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: x4d-devkit
3
- Version: 0.61.0
3
+ Version: 0.62.0rc1
4
4
  Summary: Official X-4D external SDK and CLI for datasets, platform APIs, training bridges, and automation
5
5
  Author: windzu
6
6
  License-Expression: Apache-2.0
@@ -76,6 +76,7 @@ tests/test_validation.py
76
76
  tests/test_vector_map.py
77
77
  tests/test_vector_map_geometry.py
78
78
  tests/test_vector_map_session.py
79
+ tests/test_work_facts.py
79
80
  tests/test_work_items.py
80
81
  tests/test_work_session.py
81
82
  tests/test_work_session_validation_reuse.py
@@ -120,6 +121,7 @@ x4d_devkit/time_contract.py
120
121
  x4d_devkit/training_identity.py
121
122
  x4d_devkit/vector_map.py
122
123
  x4d_devkit/vector_map_geometry.py
124
+ x4d_devkit/work_facts.py
123
125
  x4d_devkit/work_items.py
124
126
  x4d_devkit/work_session.py
125
127
  x4d_devkit.egg-info/PKG-INFO
@@ -155,6 +157,7 @@ x4d_devkit/client/semantic_scene.py
155
157
  x4d_devkit/client/semantic_scene_authoring.py
156
158
  x4d_devkit/client/services.py
157
159
  x4d_devkit/client/test_sets.py
160
+ x4d_devkit/client/work_facts.py
158
161
  x4d_devkit/client/work_items.py
159
162
  x4d_devkit/core/__init__.py
160
163
  x4d_devkit/core/loader.py
File without changes
File without changes
File without changes