vibrante-node 2.5.1__py3-none-any.whl

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 (487) hide show
  1. src/core/__init__.py +0 -0
  2. src/core/engine.py +484 -0
  3. src/core/events.py +32 -0
  4. src/core/graph.py +74 -0
  5. src/core/integrity.py +925 -0
  6. src/core/loader.py +56 -0
  7. src/core/manifest.py +910 -0
  8. src/core/models.py +59 -0
  9. src/core/persistence.py +27 -0
  10. src/core/python_to_workflow.py +182 -0
  11. src/core/registry.py +314 -0
  12. src/core/workflow_to_python.py +801 -0
  13. src/main.py +188 -0
  14. src/models/__init__.py +0 -0
  15. src/nodes/__init__.py +0 -0
  16. src/nodes/ai/__init__.py +1 -0
  17. src/nodes/base.py +174 -0
  18. src/nodes/builtins/__init__.py +0 -0
  19. src/nodes/builtins/group_node.py +210 -0
  20. src/nodes/builtins/nodes.py +452 -0
  21. src/nodes/print.py +19 -0
  22. src/nodes/test.py +19 -0
  23. src/ui/__init__.py +0 -0
  24. src/ui/canvas/__init__.py +0 -0
  25. src/ui/canvas/backdrop.py +223 -0
  26. src/ui/canvas/canvas_search_bar.py +222 -0
  27. src/ui/canvas/edge.py +98 -0
  28. src/ui/canvas/mini_map.py +138 -0
  29. src/ui/canvas/node_search_popup.py +270 -0
  30. src/ui/canvas/scene.py +1149 -0
  31. src/ui/canvas/sticky_note.py +123 -0
  32. src/ui/canvas/view.py +285 -0
  33. src/ui/code_editor.py +435 -0
  34. src/ui/export_python_dialog.py +490 -0
  35. src/ui/gemini_api_dialog.py +41 -0
  36. src/ui/gemini_chat.py +370 -0
  37. src/ui/import_python_dialog.py +122 -0
  38. src/ui/library_panel.py +246 -0
  39. src/ui/log_panel.py +315 -0
  40. src/ui/node_builder.py +841 -0
  41. src/ui/node_widget.py +1009 -0
  42. src/ui/port_widget.py +116 -0
  43. src/ui/script_editor.py +53 -0
  44. src/ui/scripting_console.py +270 -0
  45. src/ui/settings_window.py +575 -0
  46. src/ui/window.py +2012 -0
  47. src/utils/color_manager.py +50 -0
  48. src/utils/config_manager.py +71 -0
  49. src/utils/env_manager.py +232 -0
  50. src/utils/highlighter.py +110 -0
  51. src/utils/paths.py +30 -0
  52. src/utils/prism_config.py +300 -0
  53. src/utils/prism_core.py +80 -0
  54. src/utils/qt_compat.py +159 -0
  55. src/utils/runtime.py +80 -0
  56. vibrante_node/CLA.md +96 -0
  57. vibrante_node/COMMERCIAL_LICENSE.md +170 -0
  58. vibrante_node/LICENSE +178 -0
  59. vibrante_node/LICENSES/AGPL-3.0.txt +661 -0
  60. vibrante_node/LICENSES/CC-BY-4.0-SCOPE.md +53 -0
  61. vibrante_node/LICENSES/CC-BY-4.0.txt +396 -0
  62. vibrante_node/LICENSES/GPL-3.0.txt +674 -0
  63. vibrante_node/LICENSES/LGPL-3.0.txt +165 -0
  64. vibrante_node/LICENSES/README.md +65 -0
  65. vibrante_node/THIRD_PARTY_NOTICES.txt +3277 -0
  66. vibrante_node/__init__.py +2 -0
  67. vibrante_node/app.py +60 -0
  68. vibrante_node/docs/AUTOMATION_API.html +785 -0
  69. vibrante_node/docs/DEVELOPER.html +891 -0
  70. vibrante_node/docs/DOCUMENTATION.html +2761 -0
  71. vibrante_node/docs/LICENSE.txt +35 -0
  72. vibrante_node/docs/NODE_BUILDER_API.html +1155 -0
  73. vibrante_node/docs/RELEASE_v1.0.5.html +140 -0
  74. vibrante_node/docs/RELEASE_v1.1.0.html +163 -0
  75. vibrante_node/docs/RELEASE_v1.1.5.html +286 -0
  76. vibrante_node/docs/RELEASE_v1.2.0.html +175 -0
  77. vibrante_node/docs/RELEASE_v1.3.0.html +168 -0
  78. vibrante_node/docs/RELEASE_v1.4.0.html +160 -0
  79. vibrante_node/docs/RELEASE_v1.5.0.html +432 -0
  80. vibrante_node/docs/RELEASE_v1.6.0.html +293 -0
  81. vibrante_node/docs/RELEASE_v1.6.1.html +171 -0
  82. vibrante_node/docs/RELEASE_v1.7.0.html +270 -0
  83. vibrante_node/docs/RELEASE_v1.8.0.html +201 -0
  84. vibrante_node/docs/RELEASE_v1.8.1.html +124 -0
  85. vibrante_node/docs/RELEASE_v1.8.2.html +119 -0
  86. vibrante_node/docs/RELEASE_v1.8.3.html +125 -0
  87. vibrante_node/docs/RELEASE_v1.8.4.html +210 -0
  88. vibrante_node/docs/RELEASE_v1.8.5.html +223 -0
  89. vibrante_node/docs/RELEASE_v2.0.0.html +284 -0
  90. vibrante_node/docs/RELEASE_v2.1.0.html +259 -0
  91. vibrante_node/docs/RELEASE_v2.1.1.html +156 -0
  92. vibrante_node/docs/RELEASE_v2.2.0.html +369 -0
  93. vibrante_node/docs/RELEASE_v2.2.1.html +168 -0
  94. vibrante_node/docs/RELEASE_v2.3.0.html +185 -0
  95. vibrante_node/docs/RELEASE_v2.4.0.html +446 -0
  96. vibrante_node/docs/RELEASE_v2.5.0.html +478 -0
  97. vibrante_node/docs/RELEASE_v2.5.1.html +190 -0
  98. vibrante_node/docs/USER_GUIDE.html +1407 -0
  99. vibrante_node/docs/index.html +103 -0
  100. vibrante_node/docs/portal/01_introduction.html +1177 -0
  101. vibrante_node/docs/portal/02_getting_started.html +1267 -0
  102. vibrante_node/docs/portal/03_user_guide.html +1736 -0
  103. vibrante_node/docs/portal/04_workflow_tutorials.html +1473 -0
  104. vibrante_node/docs/portal/05_node_development.html +1562 -0
  105. vibrante_node/docs/portal/06_backend_architecture.html +1373 -0
  106. vibrante_node/docs/portal/07_frontend_architecture.html +1588 -0
  107. vibrante_node/docs/portal/08_api_reference.html +2336 -0
  108. vibrante_node/docs/portal/09_advanced_topics.html +1664 -0
  109. vibrante_node/docs/portal/10_contribution_guide.html +1263 -0
  110. vibrante_node/docs/portal/11_troubleshooting.html +1108 -0
  111. vibrante_node/docs/portal/12_examples_library.html +1498 -0
  112. vibrante_node/docs/portal/13_general_purpose_automation.html +1472 -0
  113. vibrante_node/docs/portal/14_custom_nodes_api.html +1960 -0
  114. vibrante_node/docs/portal/index.html +605 -0
  115. vibrante_node/docs/portal/integrations_blender.html +605 -0
  116. vibrante_node/docs/portal/integrations_deadline.html +536 -0
  117. vibrante_node/docs/portal/integrations_houdini.html +787 -0
  118. vibrante_node/docs/portal/integrations_maya.html +675 -0
  119. vibrante_node/docs/portal/integrations_prism.html +628 -0
  120. vibrante_node/docs/portal/search.json +1 -0
  121. vibrante_node/docs/validation.json +333 -0
  122. vibrante_node/examples/arnold_lighting/orchestration_notes.md +45 -0
  123. vibrante_node/examples/arnold_lighting/prompt.md +47 -0
  124. vibrante_node/examples/automation/01_linear_chain.py +10 -0
  125. vibrante_node/examples/automation/02_batch_update_prefix.py +8 -0
  126. vibrante_node/examples/automation/03_reset_scene.py +5 -0
  127. vibrante_node/examples/automation/04_batch_execution.py +9 -0
  128. vibrante_node/examples/automation/05_git_backup.py +6 -0
  129. vibrante_node/examples/automation/06_reset_math_nodes.py +12 -0
  130. vibrante_node/examples/automation/07_stress_test_grid.py +8 -0
  131. vibrante_node/examples/automation/08_scene_summary.py +8 -0
  132. vibrante_node/examples/automation/09_toggle_bools.py +8 -0
  133. vibrante_node/examples/automation/10_session_report.py +7 -0
  134. vibrante_node/examples/automation/11_simple_math_node.py +7 -0
  135. vibrante_node/examples/cinematic_camera/orchestration_notes.md +56 -0
  136. vibrante_node/examples/cinematic_camera/prompt.md +50 -0
  137. vibrante_node/examples/cinematic_explosion/orchestration_notes.md +76 -0
  138. vibrante_node/examples/cinematic_explosion/prompt.md +47 -0
  139. vibrante_node/examples/cinematic_explosion/review.md +75 -0
  140. vibrante_node/examples/dust_wave/orchestration_notes.md +43 -0
  141. vibrante_node/examples/dust_wave/prompt.md +40 -0
  142. vibrante_node/examples/nodes/async_delay.py +21 -0
  143. vibrante_node/examples/nodes/connection_logger.py +25 -0
  144. vibrante_node/examples/nodes/data_filter.py +19 -0
  145. vibrante_node/examples/nodes/dict_merge.py +20 -0
  146. vibrante_node/examples/nodes/dict_summary.py +21 -0
  147. vibrante_node/examples/nodes/dropdown_selector.py +29 -0
  148. vibrante_node/examples/nodes/env_reader.py +18 -0
  149. vibrante_node/examples/nodes/list_item_picker.py +85 -0
  150. vibrante_node/examples/nodes/list_stats.py +27 -0
  151. vibrante_node/examples/nodes/logic_threshold.py +23 -0
  152. vibrante_node/examples/nodes/math_square.py +30 -0
  153. vibrante_node/examples/nodes/random_list.py +18 -0
  154. vibrante_node/examples/nodes/reactive_config.py +24 -0
  155. vibrante_node/examples/nodes/safety_reset.py +31 -0
  156. vibrante_node/examples/nodes/string_reverse.py +16 -0
  157. vibrante_node/icons/210429_DeadlineFreeOn10RenderMachines.jpg +0 -0
  158. vibrante_node/icons/README.md +39 -0
  159. vibrante_node/icons/blender_icon.png +0 -0
  160. vibrante_node/icons/braces.png +0 -0
  161. vibrante_node/icons/braces.svg +1 -0
  162. vibrante_node/icons/builder.png +0 -0
  163. vibrante_node/icons/check.png +0 -0
  164. vibrante_node/icons/check.svg +1 -0
  165. vibrante_node/icons/chevron-right.svg +3 -0
  166. vibrante_node/icons/code.png +0 -0
  167. vibrante_node/icons/code.svg +4 -0
  168. vibrante_node/icons/computer-window.png +0 -0
  169. vibrante_node/icons/data.png +0 -0
  170. vibrante_node/icons/data.svg +5 -0
  171. vibrante_node/icons/database-search.png +0 -0
  172. vibrante_node/icons/database-search.svg +5 -0
  173. vibrante_node/icons/database-zap.png +0 -0
  174. vibrante_node/icons/database-zap.svg +5 -0
  175. vibrante_node/icons/database.png +0 -0
  176. vibrante_node/icons/database.svg +5 -0
  177. vibrante_node/icons/dice.png +0 -0
  178. vibrante_node/icons/dice.svg +1 -0
  179. vibrante_node/icons/divide.svg +5 -0
  180. vibrante_node/icons/file-input.svg +6 -0
  181. vibrante_node/icons/file-plus.png +0 -0
  182. vibrante_node/icons/file-plus.svg +6 -0
  183. vibrante_node/icons/file-text.png +0 -0
  184. vibrante_node/icons/file-text.svg +7 -0
  185. vibrante_node/icons/folder-plus.png +0 -0
  186. vibrante_node/icons/folder-plus.svg +5 -0
  187. vibrante_node/icons/folder.png +0 -0
  188. vibrante_node/icons/folder.svg +3 -0
  189. vibrante_node/icons/gear.png +0 -0
  190. vibrante_node/icons/gear.svg +1 -0
  191. vibrante_node/icons/git-branch.svg +6 -0
  192. vibrante_node/icons/hash.png +0 -0
  193. vibrante_node/icons/hash.svg +1 -0
  194. vibrante_node/icons/houdini.svg +4 -0
  195. vibrante_node/icons/houdini_icon.png +0 -0
  196. vibrante_node/icons/http.png +0 -0
  197. vibrante_node/icons/list-check.png +0 -0
  198. vibrante_node/icons/list-check.svg +7 -0
  199. vibrante_node/icons/list-plus.svg +10 -0
  200. vibrante_node/icons/list.png +0 -0
  201. vibrante_node/icons/list.svg +8 -0
  202. vibrante_node/icons/logic.png +0 -0
  203. vibrante_node/icons/logic.svg +7 -0
  204. vibrante_node/icons/math.png +0 -0
  205. vibrante_node/icons/math.svg +4 -0
  206. vibrante_node/icons/maya_icon.jpg +0 -0
  207. vibrante_node/icons/message.png +0 -0
  208. vibrante_node/icons/message.svg +3 -0
  209. vibrante_node/icons/minus.svg +3 -0
  210. vibrante_node/icons/multiply.png +0 -0
  211. vibrante_node/icons/multiply.svg +1 -0
  212. vibrante_node/icons/online-library.png +0 -0
  213. vibrante_node/icons/percentage.svg +5 -0
  214. vibrante_node/icons/plus.png +0 -0
  215. vibrante_node/icons/plus.svg +1 -0
  216. vibrante_node/icons/print.png +0 -0
  217. vibrante_node/icons/print.svg +5 -0
  218. vibrante_node/icons/prism_icon.png +0 -0
  219. vibrante_node/icons/refresh.svg +6 -0
  220. vibrante_node/icons/repeat.svg +6 -0
  221. vibrante_node/icons/scales.png +0 -0
  222. vibrante_node/icons/scales.svg +1 -0
  223. vibrante_node/icons/shuffle.svg +7 -0
  224. vibrante_node/icons/string.png +0 -0
  225. vibrante_node/icons/string.svg +5 -0
  226. vibrante_node/icons/terminal.png +0 -0
  227. vibrante_node/icons/terminal.svg +1 -0
  228. vibrante_node/icons/timer.png +0 -0
  229. vibrante_node/icons/timer.svg +4 -0
  230. vibrante_node/icons/toggle-switch.svg +5 -0
  231. vibrante_node/icons/uppercase.png +0 -0
  232. vibrante_node/icons/uppercase.svg +1 -0
  233. vibrante_node/icons/variable-get.svg +4 -0
  234. vibrante_node/icons/variable-set.svg +6 -0
  235. vibrante_node/icons/variable.png +0 -0
  236. vibrante_node/icons/variable.svg +5 -0
  237. vibrante_node/icons/vibrante-node-icon.png +0 -0
  238. vibrante_node/icons/vibrante-node-logo.png +0 -0
  239. vibrante_node/icons/vibrante-node-main_logo.png +0 -0
  240. vibrante_node/icons/vibrante-node-resize_main_logo.png +0 -0
  241. vibrante_node/logo.png +0 -0
  242. vibrante_node/mcp_cli.py +36 -0
  243. vibrante_node/node_examples/Split_String.json +35 -0
  244. vibrante_node/node_examples/async_delay.json +32 -0
  245. vibrante_node/node_examples/delay_timer.json +29 -0
  246. vibrante_node/node_examples/file_reader.json +29 -0
  247. vibrante_node/node_examples/fruit_selector.json +37 -0
  248. vibrante_node/node_examples/json_parser.json +29 -0
  249. vibrante_node/node_examples/line_counter.json +29 -0
  250. vibrante_node/node_examples/list_append.json +32 -0
  251. vibrante_node/node_examples/list_images_recursive.json +55 -0
  252. vibrante_node/node_examples/logic_and.json +34 -0
  253. vibrante_node/node_examples/logic_compare.json +36 -0
  254. vibrante_node/node_examples/math_abs.json +29 -0
  255. vibrante_node/node_examples/math_add.json +32 -0
  256. vibrante_node/node_examples/reactive_config.json +28 -0
  257. vibrante_node/node_examples/string_uppercase.json +29 -0
  258. vibrante_node/nodes/Dropdown_Selector.json +27 -0
  259. vibrante_node/nodes/add_integers.json +34 -0
  260. vibrante_node/nodes/blender_action_bake_animation.json +23 -0
  261. vibrante_node/nodes/blender_action_custom.json +21 -0
  262. vibrante_node/nodes/blender_action_export_alembic.json +22 -0
  263. vibrante_node/nodes/blender_action_export_fbx.json +23 -0
  264. vibrante_node/nodes/blender_action_export_gltf.json +21 -0
  265. vibrante_node/nodes/blender_action_export_obj.json +19 -0
  266. vibrante_node/nodes/blender_action_export_usd.json +23 -0
  267. vibrante_node/nodes/blender_action_import_alembic.json +18 -0
  268. vibrante_node/nodes/blender_action_import_fbx.json +18 -0
  269. vibrante_node/nodes/blender_action_import_gltf.json +18 -0
  270. vibrante_node/nodes/blender_action_import_obj.json +18 -0
  271. vibrante_node/nodes/blender_action_new_blend.json +18 -0
  272. vibrante_node/nodes/blender_action_open_blend.json +18 -0
  273. vibrante_node/nodes/blender_action_render.json +23 -0
  274. vibrante_node/nodes/blender_action_save_blend.json +18 -0
  275. vibrante_node/nodes/blender_action_scene_info.json +17 -0
  276. vibrante_node/nodes/blender_action_set_frame_range.json +20 -0
  277. vibrante_node/nodes/blender_action_set_render_settings.json +27 -0
  278. vibrante_node/nodes/blender_get_action_result.json +22 -0
  279. vibrante_node/nodes/blender_headless.json +86 -0
  280. vibrante_node/nodes/compare.json +48 -0
  281. vibrante_node/nodes/console_print.json +29 -0
  282. vibrante_node/nodes/create_dictionary.json +18 -0
  283. vibrante_node/nodes/create_folder.json +17 -0
  284. vibrante_node/nodes/create_list.json +18 -0
  285. vibrante_node/nodes/deadline_blender_submit.json +38 -0
  286. vibrante_node/nodes/deadline_houdini_submit.json +38 -0
  287. vibrante_node/nodes/deadline_job_status.json +28 -0
  288. vibrante_node/nodes/deadline_maya_submit.json +40 -0
  289. vibrante_node/nodes/delay_timer.json +26 -0
  290. vibrante_node/nodes/example_random_float.json +35 -0
  291. vibrante_node/nodes/file_append.json +18 -0
  292. vibrante_node/nodes/file_write.json +18 -0
  293. vibrante_node/nodes/for_loop.json +46 -0
  294. vibrante_node/nodes/get_dict_value.json +19 -0
  295. vibrante_node/nodes/get_list_item.json +19 -0
  296. vibrante_node/nodes/houdini_action_bake_animation.json +20 -0
  297. vibrante_node/nodes/houdini_action_custom.json +20 -0
  298. vibrante_node/nodes/houdini_action_export_alembic.json +20 -0
  299. vibrante_node/nodes/houdini_action_export_camera_alembic.json +20 -0
  300. vibrante_node/nodes/houdini_action_export_fbx.json +18 -0
  301. vibrante_node/nodes/houdini_action_import_alembic.json +18 -0
  302. vibrante_node/nodes/houdini_action_import_camera.json +17 -0
  303. vibrante_node/nodes/houdini_action_import_fbx.json +18 -0
  304. vibrante_node/nodes/houdini_action_import_obj.json +18 -0
  305. vibrante_node/nodes/houdini_action_new_hip.json +16 -0
  306. vibrante_node/nodes/houdini_action_open_hip.json +17 -0
  307. vibrante_node/nodes/houdini_action_save_hip.json +17 -0
  308. vibrante_node/nodes/houdini_action_scene_info.json +16 -0
  309. vibrante_node/nodes/houdini_action_set_frame_range.json +18 -0
  310. vibrante_node/nodes/houdini_get_action_result.json +21 -0
  311. vibrante_node/nodes/houdini_headless.json +85 -0
  312. vibrante_node/nodes/houdini_scene_snapshot.json +41 -0
  313. vibrante_node/nodes/http_request.json +76 -0
  314. vibrante_node/nodes/if_condition.json +45 -0
  315. vibrante_node/nodes/list_directory.json +17 -0
  316. vibrante_node/nodes/list_images_recursive.json +41 -0
  317. vibrante_node/nodes/list_item_picker.json +41 -0
  318. vibrante_node/nodes/list_length.json +17 -0
  319. vibrante_node/nodes/logical_gate.json +45 -0
  320. vibrante_node/nodes/loop_body.json +62 -0
  321. vibrante_node/nodes/math_add.json +17 -0
  322. vibrante_node/nodes/math_divide.json +17 -0
  323. vibrante_node/nodes/math_modulo.json +17 -0
  324. vibrante_node/nodes/math_multiply.json +36 -0
  325. vibrante_node/nodes/math_subtract.json +17 -0
  326. vibrante_node/nodes/maya_action_assign_material.json +18 -0
  327. vibrante_node/nodes/maya_action_bake_animation.json +21 -0
  328. vibrante_node/nodes/maya_action_create_render_layer.json +19 -0
  329. vibrante_node/nodes/maya_action_custom.json +20 -0
  330. vibrante_node/nodes/maya_action_export_alembic.json +22 -0
  331. vibrante_node/nodes/maya_action_export_camera_alembic.json +20 -0
  332. vibrante_node/nodes/maya_action_export_fbx.json +18 -0
  333. vibrante_node/nodes/maya_action_import_alembic.json +17 -0
  334. vibrante_node/nodes/maya_action_import_camera.json +17 -0
  335. vibrante_node/nodes/maya_action_import_fbx.json +17 -0
  336. vibrante_node/nodes/maya_action_import_obj.json +17 -0
  337. vibrante_node/nodes/maya_action_list_references.json +16 -0
  338. vibrante_node/nodes/maya_action_new_scene.json +16 -0
  339. vibrante_node/nodes/maya_action_open_scene.json +18 -0
  340. vibrante_node/nodes/maya_action_playblast.json +22 -0
  341. vibrante_node/nodes/maya_action_reference_alembic.json +18 -0
  342. vibrante_node/nodes/maya_action_reference_scene.json +18 -0
  343. vibrante_node/nodes/maya_action_save_scene.json +18 -0
  344. vibrante_node/nodes/maya_action_scene_info.json +16 -0
  345. vibrante_node/nodes/maya_action_set_aovs.json +18 -0
  346. vibrante_node/nodes/maya_action_set_frame_range.json +18 -0
  347. vibrante_node/nodes/maya_action_set_render_settings.json +23 -0
  348. vibrante_node/nodes/maya_get_action_result.json +21 -0
  349. vibrante_node/nodes/maya_headless.json +27 -0
  350. vibrante_node/nodes/mcp_call_tool.json +19 -0
  351. vibrante_node/nodes/mcp_list_tools.json +18 -0
  352. vibrante_node/nodes/mcp_server_init.json +23 -0
  353. vibrante_node/nodes/message_node.json +32 -0
  354. vibrante_node/nodes/prism_add_integration.json +49 -0
  355. vibrante_node/nodes/prism_build_entity.json +45 -0
  356. vibrante_node/nodes/prism_change_project.json +37 -0
  357. vibrante_node/nodes/prism_core_info.json +37 -0
  358. vibrante_node/nodes/prism_core_init.json +46 -0
  359. vibrante_node/nodes/prism_create_category.json +44 -0
  360. vibrante_node/nodes/prism_create_entity.json +60 -0
  361. vibrante_node/nodes/prism_create_playblast.json +56 -0
  362. vibrante_node/nodes/prism_create_product_version.json +64 -0
  363. vibrante_node/nodes/prism_create_project.json +50 -0
  364. vibrante_node/nodes/prism_create_scene_from_preset.json +59 -0
  365. vibrante_node/nodes/prism_eval.json +42 -0
  366. vibrante_node/nodes/prism_get_aovs.json +29 -0
  367. vibrante_node/nodes/prism_get_asset_by_name.json +69 -0
  368. vibrante_node/nodes/prism_get_asset_type_by_name.json +62 -0
  369. vibrante_node/nodes/prism_get_asset_types_by_project.json +55 -0
  370. vibrante_node/nodes/prism_get_assets_by_project.json +41 -0
  371. vibrante_node/nodes/prism_get_assets_by_type.json +69 -0
  372. vibrante_node/nodes/prism_get_config.json +48 -0
  373. vibrante_node/nodes/prism_get_current_scene.json +37 -0
  374. vibrante_node/nodes/prism_get_departments.json +37 -0
  375. vibrante_node/nodes/prism_get_entity_info.json +69 -0
  376. vibrante_node/nodes/prism_get_entity_path.json +69 -0
  377. vibrante_node/nodes/prism_get_export_path.json +26 -0
  378. vibrante_node/nodes/prism_get_latest_product_path.json +34 -0
  379. vibrante_node/nodes/prism_get_media.json +29 -0
  380. vibrante_node/nodes/prism_get_media_versions.json +33 -0
  381. vibrante_node/nodes/prism_get_plugin.json +35 -0
  382. vibrante_node/nodes/prism_get_preset_scenes.json +35 -0
  383. vibrante_node/nodes/prism_get_product_versions.json +33 -0
  384. vibrante_node/nodes/prism_get_products.json +29 -0
  385. vibrante_node/nodes/prism_get_project_by_name.json +55 -0
  386. vibrante_node/nodes/prism_get_project_config_path.json +26 -0
  387. vibrante_node/nodes/prism_get_scene_files.json +45 -0
  388. vibrante_node/nodes/prism_get_scene_path.json +23 -0
  389. vibrante_node/nodes/prism_get_sequence_by_project.json +48 -0
  390. vibrante_node/nodes/prism_get_sequences_by_project.json +41 -0
  391. vibrante_node/nodes/prism_get_shot_by_name.json +62 -0
  392. vibrante_node/nodes/prism_get_shot_by_sequence.json +55 -0
  393. vibrante_node/nodes/prism_get_shot_info.json +69 -0
  394. vibrante_node/nodes/prism_get_shots.json +29 -0
  395. vibrante_node/nodes/prism_get_shots_by_project_sequence.json +48 -0
  396. vibrante_node/nodes/prism_get_shots_by_sequence.json +48 -0
  397. vibrante_node/nodes/prism_get_tasks.json +39 -0
  398. vibrante_node/nodes/prism_import_product.json +37 -0
  399. vibrante_node/nodes/prism_list_plugins.json +25 -0
  400. vibrante_node/nodes/prism_list_projects.json +25 -0
  401. vibrante_node/nodes/prism_login_token.json +33 -0
  402. vibrante_node/nodes/prism_monkey_patch.json +46 -0
  403. vibrante_node/nodes/prism_open_scene.json +33 -0
  404. vibrante_node/nodes/prism_popup.json +40 -0
  405. vibrante_node/nodes/prism_register_callback.json +58 -0
  406. vibrante_node/nodes/prism_save_scene_version.json +90 -0
  407. vibrante_node/nodes/prism_send_cmd.json +54 -0
  408. vibrante_node/nodes/prism_set_config.json +55 -0
  409. vibrante_node/nodes/prism_studio_assign_project.json +43 -0
  410. vibrante_node/nodes/prism_trigger_callback.json +42 -0
  411. vibrante_node/nodes/prism_usd_department_layer_path.json +35 -0
  412. vibrante_node/nodes/prism_usd_entity_path.json +29 -0
  413. vibrante_node/nodes/prism_usd_sublayer_path.json +41 -0
  414. vibrante_node/nodes/prism_usd_update_department_layer.json +33 -0
  415. vibrante_node/nodes/prism_usd_update_sublayer.json +33 -0
  416. vibrante_node/nodes/python_script.json +17 -0
  417. vibrante_node/nodes/scene_intent_extractor.json +25 -0
  418. vibrante_node/nodes/set_dict_value.json +20 -0
  419. vibrante_node/nodes/string_concat.json +47 -0
  420. vibrante_node/nodes/string_length.json +16 -0
  421. vibrante_node/nodes/string_lowercase.json +16 -0
  422. vibrante_node/nodes/string_replace.json +18 -0
  423. vibrante_node/nodes/string_split.json +17 -0
  424. vibrante_node/nodes/string_uppercase.json +16 -0
  425. vibrante_node/nodes/variable_node.json +42 -0
  426. vibrante_node/nodes/while_loop.json +18 -0
  427. vibrante_node/splash.png +0 -0
  428. vibrante_node/vfx_workflows/01_prism_project_overview.json +492 -0
  429. vibrante_node/vfx_workflows/02_maya_asset_publish.json +776 -0
  430. vibrante_node/vfx_workflows/03_multi_shot_alembic_export.json +856 -0
  431. vibrante_node/vfx_workflows/04_deadline_render_pipeline.json +994 -0
  432. vibrante_node/vfx_workflows/05_houdini_fx_pipeline.json +1056 -0
  433. vibrante_node/vfx_workflows/06_blender_multi_format_export.json +1206 -0
  434. vibrante_node/website_examples/database_query.json +69 -0
  435. vibrante_node/website_examples/email_notification.json +104 -0
  436. vibrante_node/website_examples/file_batch_processor.json +62 -0
  437. vibrante_node/website_examples/folder_monitor.json +55 -0
  438. vibrante_node/website_examples/hou_sop_chain.json +69 -0
  439. vibrante_node/website_examples/http_request.json +90 -0
  440. vibrante_node/website_examples/image_resizer.json +90 -0
  441. vibrante_node/website_examples/llm_text_generation.json +90 -0
  442. vibrante_node/website_examples/prism_multi_asset_publisher.json +76 -0
  443. vibrante_node/website_examples/regex_replace.json +69 -0
  444. vibrante_node/workflows/If_condition.json +134 -0
  445. vibrante_node/workflows/Maya_WorkFlow.json +464 -0
  446. vibrante_node/workflows/asset_intelligence_pipeline.json +259 -0
  447. vibrante_node/workflows/concat_string_with_loop.json +262 -0
  448. vibrante_node/workflows/delay_time.json +74 -0
  449. vibrante_node/workflows/example_workflow_maya_prism_demo.json +503 -0
  450. vibrante_node/workflows/example_workflow_prism_demo.json +276 -0
  451. vibrante_node/workflows/example_workflow_prism_demo_02.json +221 -0
  452. vibrante_node/workflows/extract_FPS_from_maya_scene.json +265 -0
  453. vibrante_node/workflows/for_each.json +260 -0
  454. vibrante_node/workflows/get_list_item.json +151 -0
  455. vibrante_node/workflows/hou_mcp_scene_context_demo.json +67 -0
  456. vibrante_node/workflows/list_recursive_images.json +103 -0
  457. vibrante_node/workflows/logic_if_example.json +262 -0
  458. vibrante_node/workflows/logic_if_with_variables.json +210 -0
  459. vibrante_node/workflows/loop_break_example.json +197 -0
  460. vibrante_node/workflows/loop_operation_example.json +382 -0
  461. vibrante_node/workflows/mcp_list_tools_demo.json +90 -0
  462. vibrante_node/workflows/prism_assets_workflow.json +131 -0
  463. vibrante_node/workflows/python_script_node.json +89 -0
  464. vibrante_node/workflows/run_in_sequence.json +158 -0
  465. vibrante_node/workflows/scene_intent_pipeline.json +134 -0
  466. vibrante_node/workflows/scene_planning_pipeline.json +258 -0
  467. vibrante_node/workflows/semantic_scene_intent.json +96 -0
  468. vibrante_node/workflows/setup_maya_scene.json +352 -0
  469. vibrante_node/workflows/tutorial_maya_headless_prism_pipeline.json +593 -0
  470. vibrante_node/workflows/two_way_switch.json +341 -0
  471. vibrante_node/workflows/while_loop_class_example.json +192 -0
  472. vibrante_node/workflows/while_loop_example.json +184 -0
  473. vibrante_node/workflows/while_loop_retry_example.json +276 -0
  474. vibrante_node-2.5.1.dist-info/METADATA +715 -0
  475. vibrante_node-2.5.1.dist-info/RECORD +487 -0
  476. vibrante_node-2.5.1.dist-info/WHEEL +5 -0
  477. vibrante_node-2.5.1.dist-info/entry_points.txt +3 -0
  478. vibrante_node-2.5.1.dist-info/licenses/CLA.md +96 -0
  479. vibrante_node-2.5.1.dist-info/licenses/COMMERCIAL_LICENSE.md +170 -0
  480. vibrante_node-2.5.1.dist-info/licenses/LICENSE +178 -0
  481. vibrante_node-2.5.1.dist-info/licenses/LICENSES/AGPL-3.0.txt +661 -0
  482. vibrante_node-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0-SCOPE.md +53 -0
  483. vibrante_node-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0.txt +396 -0
  484. vibrante_node-2.5.1.dist-info/licenses/LICENSES/GPL-3.0.txt +674 -0
  485. vibrante_node-2.5.1.dist-info/licenses/LICENSES/LGPL-3.0.txt +165 -0
  486. vibrante_node-2.5.1.dist-info/licenses/LICENSES/README.md +65 -0
  487. vibrante_node-2.5.1.dist-info/top_level.txt +2 -0
src/core/manifest.py ADDED
@@ -0,0 +1,910 @@
1
+ """
2
+ Manifest parsing and discovery for Vibrante-Node (P7-B4.10 / E3-D12..E3-D17).
3
+
4
+ STANDALONE MODULE
5
+ -----------------
6
+ This module is intentionally independent of ``src.core.registry`` and of the
7
+ future ``src.core.integrity`` module. It performs *no* SHA-256 file reads, no
8
+ registry mutation, and no enforcement: it only parses/validates the
9
+ ``vibrante-nodes.manifest`` sidecar and classifies directories/keys. The registry
10
+ will orchestrate it in a separately authorized task.
11
+
12
+ Manifest fields are DATA ONLY. No field is ever executed, and no field triggers
13
+ plugin entry-point execution.
14
+
15
+ OWNER-APPROVED FOR DESIGN (P7-B4.5.9)
16
+ -------------------------------------
17
+ - Filename ``vibrante-nodes.manifest`` (no ``.json`` extension on purpose, so the
18
+ existing node walker -- which matches ``.json`` -- never treats it as a node).
19
+ - JSON field ``schema_version``.
20
+ - Max size 1 MiB, enforced with a bounded read of at most 1 MiB + 1 byte.
21
+ - Integrity-map keys: normalized relative POSIX paths.
22
+ - Reject absolute / drive / UNC / traversal / resolved-symlink-escape keys.
23
+ - Duplicate JSON keys: warn, last occurrence wins.
24
+ - Windows matching is case-insensitive, with case-only collisions reported.
25
+ - Environment expansion: ``${VAR}`` and ``$VAR`` everywhere; ``%VAR%`` on Windows
26
+ only; ``$$`` -> literal ``$``; undefined or malformed variables cause the
27
+ affected path entry to be skipped with a warning; expansion happens before
28
+ normalization, canonicalization, and trusted-root classification.
29
+ - A manifest may tighten classification to ``external`` but must never grant
30
+ ``bundled`` or ``user`` trust.
31
+ - Integrity-map keys are passed through the same expansion (E3-D14) *before*
32
+ normalization and containment, so a key is only ever validated
33
+ post-expansion. An undefined or malformed expression skips the entry with a
34
+ structured issue; unresolved variable syntax is never accepted as a literal
35
+ path.
36
+ - Case-only collisions are detected on the *normalized* keys (M2), so
37
+ ``A/./b.json`` and ``a/b.json`` collide on Windows.
38
+ - An empty, well-formed ``integrity.files`` map is not usable for verification
39
+ (M3) and emits ``empty_integrity_map``; ``status`` remains ``ok``.
40
+ - A map with an unresolved key collision (case-only ``U-6`` or post-expansion
41
+ ``EXP-COLLISION``) is likewise not usable (R4); ``status`` remains ``ok``.
42
+
43
+ UNRESOLVED (P7-B4.5.9) -- NOT decided here
44
+ ------------------------------------------
45
+ Unresolved cases are recorded as issues carrying an ``unresolved`` code (``U-x``
46
+ or ``EXP-COLLISION``) instead of inventing behavior. See
47
+ ``UNRESOLVED_DECISIONS``. This module does not enforce any registry-level policy
48
+ (block vs fallback); it only reports facts.
49
+ """
50
+ from __future__ import annotations
51
+
52
+ import json
53
+ import os
54
+ import posixpath
55
+ import re
56
+ from dataclasses import dataclass
57
+ from typing import Any, Dict, List, Mapping, Optional, Tuple
58
+
59
+ # ---------------------------------------------------------------------------
60
+ # Constants
61
+ # ---------------------------------------------------------------------------
62
+
63
+ MANIFEST_NAME: str = "vibrante-nodes.manifest"
64
+ SCHEMA_VERSION: int = 1
65
+ MAX_MANIFEST_BYTES: int = 1024 * 1024 # 1 MiB
66
+ ALGORITHM: str = "sha256"
67
+
68
+ # Source classifications (E3-D12).
69
+ SOURCE_BUNDLED: str = "bundled"
70
+ SOURCE_USER: str = "user"
71
+ SOURCE_THIRD_PARTY: str = "third_party"
72
+ SOURCE_EXTERNAL: str = "external"
73
+
74
+ # Load-status values (coarse classification; the registry decides enforcement).
75
+ STATUS_OK: str = "ok"
76
+ STATUS_ABSENT: str = "absent"
77
+ STATUS_MALFORMED: str = "malformed"
78
+ STATUS_UNSUPPORTED: str = "unsupported"
79
+ STATUS_OVERSIZED: str = "oversized"
80
+ STATUS_UNREADABLE: str = "unreadable"
81
+
82
+ # Unresolved-case identifier for post-expansion normalization collisions. This is
83
+ # deliberately not a numbered ``U-x`` owner decision: the owner list does not
84
+ # cover it, so it is documented, reported, and left undecided.
85
+ EXP_COLLISION_CODE: str = "EXP-COLLISION"
86
+
87
+ # Unresolved owner decisions (P7-B4.5.9). Exposed so callers cannot mistake an
88
+ # unresolved case for settled behavior.
89
+ UNRESOLVED_DECISIONS: Mapping[str, str] = {
90
+ "U-1": "Malformed manifests for non-external directories: fallback vs block.",
91
+ "U-2": "Invalid or trust-granting source_class values.",
92
+ "U-3": "Scope of a manifest-declared external classification (beyond its own dir).",
93
+ "U-4": "Missing hashes for files added after manifest generation.",
94
+ "U-5": "Interaction between newly added files and duplicate node_id resolution.",
95
+ "U-6": "Case-distinct files on filesystems that permit them.",
96
+ "U-7": "Whether duplicate JSON keys should do anything beyond warning and last-wins.",
97
+ "U-8": "Edge cases involving $$ combinations.",
98
+ "U-9": "Unapproved schema fields or aliases.",
99
+ EXP_COLLISION_CODE: "Two distinct integrity keys collapsing to one normalized key "
100
+ "after environment expansion has no approved winner.",
101
+ }
102
+
103
+ _KNOWN_TOP_LEVEL = frozenset(
104
+ {"schema_version", "algorithm", "min_core_version", "tags", "source_class", "integrity"}
105
+ )
106
+ _KNOWN_INTEGRITY = frozenset({"algorithm", "files", "signature"})
107
+
108
+ _DRIVE_RE = re.compile(r"^[A-Za-z]:")
109
+ _HASH_RE = re.compile(r"^[0-9a-fA-F]{64}$")
110
+ _NAME_RE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*")
111
+
112
+ _MISSING = object()
113
+
114
+ # Reason -> issue code for a rejected integrity key.
115
+ _KEY_REASON_CODE = {
116
+ "empty": "invalid_key",
117
+ "absolute": "absolute_key",
118
+ "unc": "unc_key",
119
+ "drive": "drive_key",
120
+ "traversal": "traversal_key",
121
+ }
122
+
123
+
124
+ # ---------------------------------------------------------------------------
125
+ # Result dataclasses
126
+ # ---------------------------------------------------------------------------
127
+
128
+
129
+ @dataclass(frozen=True)
130
+ class ManifestIssue:
131
+ """A single non-fatal or fatal observation about a manifest."""
132
+
133
+ code: str
134
+ message: str
135
+ unresolved: Optional[str] = None # "U-x" when the case is not owner-decided
136
+
137
+
138
+ @dataclass(frozen=True)
139
+ class ManifestIntegrity:
140
+ """Parsed integrity section (no verification is performed here)."""
141
+
142
+ algorithm: str
143
+ files: Mapping[str, str] # normalized relative POSIX path -> lowercase hex
144
+ signature: Optional[Any] = None # reserved; always None in this phase
145
+
146
+
147
+ @dataclass(frozen=True)
148
+ class ManifestInfo:
149
+ """Best-effort, validated view of a manifest (populated when schema is ok)."""
150
+
151
+ path: str
152
+ directory: str
153
+ schema_version: int
154
+ algorithm: str
155
+ min_core_version: Optional[str]
156
+ tags: Tuple[str, ...]
157
+ source_class: Optional[str]
158
+ integrity: Optional[ManifestIntegrity]
159
+ integrity_usable: bool
160
+ issues: Tuple[ManifestIssue, ...] = ()
161
+
162
+
163
+ @dataclass(frozen=True)
164
+ class ManifestLoadResult:
165
+ """Outcome of :func:`load_manifest`. Never raises."""
166
+
167
+ status: str
168
+ path: Optional[str]
169
+ info: Optional[ManifestInfo]
170
+ issues: Tuple[ManifestIssue, ...] = ()
171
+
172
+ @property
173
+ def ok(self) -> bool:
174
+ return self.status == STATUS_OK
175
+
176
+ @property
177
+ def usable_for_integrity(self) -> bool:
178
+ """True only when a non-empty, collision-free integrity map is present.
179
+
180
+ Semantics (M3/R4): ``integrity.files`` must be present, contain at least
181
+ one entry that survived validation, and contain no unresolved key
182
+ collision (Windows case-only collisions or post-expansion exact
183
+ collisions). An empty map or a collided map verifies nothing
184
+ deterministically and is therefore **not** usable; ``status`` stays
185
+ ``ok`` because the manifest is still well-formed. Enforcement policy
186
+ (block vs fallback per source class) remains the registry's
187
+ responsibility.
188
+ """
189
+ return (
190
+ self.status == STATUS_OK
191
+ and self.info is not None
192
+ and self.info.integrity_usable
193
+ )
194
+
195
+
196
+ @dataclass(frozen=True)
197
+ class ExpansionResult:
198
+ """Result of environment-variable expansion over a raw path string."""
199
+
200
+ value: str
201
+ unresolved: Tuple[str, ...] = ()
202
+ malformed: Tuple[str, ...] = ()
203
+
204
+ @property
205
+ def has_unresolved(self) -> bool:
206
+ return bool(self.unresolved) or bool(self.malformed)
207
+
208
+
209
+ @dataclass(frozen=True)
210
+ class KeyValidation:
211
+ """Syntactic validation of an integrity-map key."""
212
+
213
+ normalized: Optional[str]
214
+ reason: Optional[str] # None when valid
215
+
216
+
217
+ @dataclass(frozen=True)
218
+ class KeyResolution:
219
+ """Syntactic + filesystem (symlink-aware) resolution of an integrity key."""
220
+
221
+ normalized: Optional[str]
222
+ path: Optional[str]
223
+ reason: Optional[str]
224
+ within: bool
225
+
226
+
227
+ # ---------------------------------------------------------------------------
228
+ # Environment-variable expansion (E3-D14)
229
+ # ---------------------------------------------------------------------------
230
+
231
+
232
+ def expand_env(
233
+ raw: str,
234
+ *,
235
+ env: Optional[Mapping[str, str]] = None,
236
+ platform: Optional[str] = None,
237
+ ) -> ExpansionResult:
238
+ """Expand ``${VAR}`` / ``$VAR`` (all platforms) and ``%VAR%`` (Windows only).
239
+
240
+ - ``$$`` becomes a literal ``$``.
241
+ - Undefined variables are recorded in ``unresolved`` and left in place.
242
+ - Malformed syntax (e.g. an unclosed ``${`` or ``%``) is recorded in
243
+ ``malformed`` and left in place.
244
+ Expansion is performed *before* any normalization/classification.
245
+ """
246
+ envmap: Mapping[str, str] = os.environ if env is None else env
247
+ plat = os.name if platform is None else platform
248
+
249
+ out: List[str] = []
250
+ unresolved: List[str] = []
251
+ malformed: List[str] = []
252
+
253
+ def _substitute(name: str, token: str) -> None:
254
+ if name in envmap:
255
+ out.append(str(envmap[name]))
256
+ else:
257
+ out.append(token)
258
+ unresolved.append(name)
259
+
260
+ i = 0
261
+ n = len(raw)
262
+ while i < n:
263
+ ch = raw[i]
264
+ if ch == "$":
265
+ nxt = raw[i + 1] if i + 1 < n else ""
266
+ if nxt == "$":
267
+ out.append("$")
268
+ i += 2
269
+ continue
270
+ if nxt == "{":
271
+ close = raw.find("}", i + 2)
272
+ if close == -1:
273
+ malformed.append(raw[i:])
274
+ out.append(raw[i:])
275
+ break
276
+ name = raw[i + 2 : close]
277
+ if not name:
278
+ malformed.append(raw[i : close + 1])
279
+ out.append(raw[i : close + 1])
280
+ else:
281
+ _substitute(name, raw[i : close + 1])
282
+ i = close + 1
283
+ continue
284
+ match = _NAME_RE.match(raw, i + 1)
285
+ if match:
286
+ name = match.group(0)
287
+ _substitute(name, raw[i : i + 1 + len(name)])
288
+ i += 1 + len(name)
289
+ continue
290
+ out.append("$")
291
+ i += 1
292
+ continue
293
+ if ch == "%" and plat == "nt":
294
+ close = raw.find("%", i + 1)
295
+ if close == -1 or close == i + 1:
296
+ malformed.append(raw[i:])
297
+ out.append(raw[i:])
298
+ break
299
+ name = raw[i + 1 : close]
300
+ _substitute(name, raw[i : close + 1])
301
+ i = close + 1
302
+ continue
303
+ out.append(ch)
304
+ i += 1
305
+
306
+ return ExpansionResult("".join(out), tuple(unresolved), tuple(malformed))
307
+
308
+
309
+ def resolve_path(
310
+ raw: str,
311
+ base_dir: Optional[str] = None,
312
+ *,
313
+ env: Optional[Mapping[str, str]] = None,
314
+ platform: Optional[str] = None,
315
+ ) -> Tuple[Optional[str], ExpansionResult]:
316
+ """Expand then normalize a path. Returns ``(normalized_path_or_None, expansion)``.
317
+
318
+ ``None`` is returned when expansion left unresolved/malformed syntax -- the
319
+ caller must skip the entry (a path with unresolved variable syntax is never
320
+ used).
321
+ """
322
+ expansion = expand_env(raw, env=env, platform=platform)
323
+ if expansion.has_unresolved:
324
+ return None, expansion
325
+ path = expansion.value
326
+ if base_dir is not None and not os.path.isabs(path):
327
+ path = os.path.join(base_dir, path)
328
+ return os.path.normpath(path), expansion
329
+
330
+
331
+ # ---------------------------------------------------------------------------
332
+ # Integrity-key validation (E3-D13)
333
+ # ---------------------------------------------------------------------------
334
+
335
+
336
+ def validate_key(key: Any) -> KeyValidation:
337
+ """Syntactically validate an integrity-map key.
338
+
339
+ Accepts only normalized relative POSIX paths. Rejects empty keys, absolute
340
+ paths, drive paths, UNC paths, and traversal that escapes the tree.
341
+ """
342
+ if not isinstance(key, str) or key == "":
343
+ return KeyValidation(None, "empty")
344
+ k = key.replace("\\", "/")
345
+ if k.startswith("//"):
346
+ return KeyValidation(None, "unc")
347
+ if k.startswith("/"):
348
+ return KeyValidation(None, "absolute")
349
+ if _DRIVE_RE.match(k):
350
+ return KeyValidation(None, "drive")
351
+ normalized = posixpath.normpath(k)
352
+ if normalized in (".", "..") or normalized.startswith("../") or normalized.startswith("/"):
353
+ return KeyValidation(None, "traversal")
354
+ return KeyValidation(normalized, None)
355
+
356
+
357
+ def is_within(base: str, target: str) -> bool:
358
+ """True when ``target`` is inside ``base`` after realpath + normcase."""
359
+ try:
360
+ base_real = os.path.normcase(os.path.realpath(base))
361
+ target_real = os.path.normcase(os.path.realpath(target))
362
+ except (OSError, ValueError):
363
+ return False
364
+ if base_real == target_real:
365
+ return True
366
+ try:
367
+ return os.path.commonpath([base_real, target_real]) == base_real
368
+ except ValueError:
369
+ return False
370
+
371
+
372
+ def resolve_integrity_key(key: Any, manifest_dir: str) -> KeyResolution:
373
+ """Validate a key and confirm it resolves inside ``manifest_dir``.
374
+
375
+ The filesystem check uses ``realpath`` so a symlink that escapes the
376
+ manifest directory is rejected even when the key is syntactically relative.
377
+ """
378
+ kv = validate_key(key)
379
+ if kv.normalized is None:
380
+ return KeyResolution(None, None, kv.reason, False)
381
+ abs_path = os.path.join(manifest_dir, *kv.normalized.split("/"))
382
+ if not is_within(manifest_dir, abs_path):
383
+ return KeyResolution(kv.normalized, abs_path, "escape", False)
384
+ return KeyResolution(kv.normalized, abs_path, None, True)
385
+
386
+
387
+ def detect_case_collisions(
388
+ keys: Any,
389
+ *,
390
+ platform: Optional[str] = None,
391
+ ) -> List[Tuple[str, str]]:
392
+ """Return case-only collisions between keys on case-insensitive platforms.
393
+
394
+ On non-Windows platforms this returns an empty list. On Windows, keys that
395
+ fold to the same value (lower-cased, with ``/`` and ``\\`` treated as the
396
+ same separator) but differ in original spelling are reported as
397
+ ``(first_seen, colliding)`` pairs. Folding is derived from the explicit
398
+ ``platform`` argument, not the running host, so behavior and tests are
399
+ deterministic across machines. The *handling* of such collisions remains an
400
+ unresolved owner decision (``U-6``).
401
+ """
402
+ plat = os.name if platform is None else platform
403
+ if plat != "nt":
404
+ return []
405
+ seen: Dict[str, str] = {}
406
+ collisions: List[Tuple[str, str]] = []
407
+ for key in keys:
408
+ if not isinstance(key, str):
409
+ continue
410
+ folded = key.replace("\\", "/").lower()
411
+ if folded in seen and seen[folded] != key:
412
+ collisions.append((seen[folded], key))
413
+ else:
414
+ seen.setdefault(folded, key)
415
+ return collisions
416
+
417
+
418
+ def normalize_hash(value: Any) -> Optional[str]:
419
+ """Return the lowercase 64-char SHA-256 hex for ``value`` or ``None``."""
420
+ if not isinstance(value, str) or not _HASH_RE.match(value):
421
+ return None
422
+ return value.lower()
423
+
424
+
425
+ # ---------------------------------------------------------------------------
426
+ # Classification (E3-D12)
427
+ # ---------------------------------------------------------------------------
428
+
429
+
430
+ def classify_source(
431
+ directory: str,
432
+ *,
433
+ bundled_root: Optional[str] = None,
434
+ user_root: Optional[str] = None,
435
+ manifest_declared_external: bool = False,
436
+ ) -> str:
437
+ """Classify a node directory per the approved location/declaration policy.
438
+
439
+ A directory without a manifest is the caller's concern: passing
440
+ ``manifest_declared_external=False`` yields the ``third_party`` default for
441
+ any directory that is outside the trusted roots.
442
+ """
443
+ if manifest_declared_external:
444
+ return SOURCE_EXTERNAL
445
+ if bundled_root is not None and is_within(bundled_root, directory):
446
+ return SOURCE_BUNDLED
447
+ if user_root is not None and is_within(user_root, directory):
448
+ return SOURCE_USER
449
+ return SOURCE_THIRD_PARTY
450
+
451
+
452
+ def tighten_source_class(location_class: str, info: Optional[ManifestInfo]) -> str:
453
+ """Apply a manifest's tighten-only classification.
454
+
455
+ A manifest may upgrade a location class to ``external`` but can never grant
456
+ ``bundled``/``user`` trust. Returns the (possibly tightened) class.
457
+ """
458
+ if (
459
+ info is not None
460
+ and info.source_class == SOURCE_EXTERNAL
461
+ and location_class != SOURCE_EXTERNAL
462
+ ):
463
+ return SOURCE_EXTERNAL
464
+ return location_class
465
+
466
+
467
+ # ---------------------------------------------------------------------------
468
+ # Discovery / enumeration
469
+ # ---------------------------------------------------------------------------
470
+
471
+
472
+ def find_manifest(directory: str) -> Optional[str]:
473
+ """Return the manifest path directly inside ``directory`` (direct child)."""
474
+ if not directory:
475
+ return None
476
+ candidate = os.path.join(directory, MANIFEST_NAME)
477
+ return candidate if os.path.isfile(candidate) else None
478
+
479
+
480
+ def enumerate_node_files(directory: str) -> List[str]:
481
+ """Deterministically enumerate ``.json`` node files as relative POSIX paths.
482
+
483
+ Traversal is sorted for determinism (E3-D17) and matches only ``.json`` so a
484
+ ``.manifest`` file is never enumerated as a node.
485
+ """
486
+ results: List[str] = []
487
+ if not isinstance(directory, str) or not os.path.isdir(directory):
488
+ return results
489
+ for root, dirnames, filenames in os.walk(directory):
490
+ dirnames.sort()
491
+ for filename in sorted(filenames):
492
+ if filename.endswith(".json"):
493
+ rel = os.path.relpath(os.path.join(root, filename), directory)
494
+ results.append(rel.replace(os.sep, "/"))
495
+ return results
496
+
497
+
498
+ # ---------------------------------------------------------------------------
499
+ # Manifest loading (E3-D15 bounded read; E3-D13/E3-D14 applied)
500
+ # ---------------------------------------------------------------------------
501
+
502
+
503
+ def _build_integrity(
504
+ integ: Any,
505
+ directory: str,
506
+ platform: Optional[str],
507
+ issues: List[ManifestIssue],
508
+ *,
509
+ env: Optional[Mapping[str, str]] = None,
510
+ ) -> Tuple[Optional[ManifestIntegrity], bool, str]:
511
+ if not isinstance(integ, dict):
512
+ issues.append(ManifestIssue("invalid_integrity", "integrity must be an object"))
513
+ return None, False, STATUS_MALFORMED
514
+
515
+ for key in integ:
516
+ if key not in _KNOWN_INTEGRITY:
517
+ issues.append(
518
+ ManifestIssue(
519
+ "unknown_field",
520
+ f"ignored unknown integrity field {key!r}; fields are never executable",
521
+ unresolved="U-9",
522
+ )
523
+ )
524
+
525
+ declared_algorithm = integ.get("algorithm", None)
526
+ if declared_algorithm is not None:
527
+ if not (
528
+ isinstance(declared_algorithm, str)
529
+ and declared_algorithm.strip().lower() == ALGORITHM
530
+ ):
531
+ issues.append(
532
+ ManifestIssue(
533
+ "unsupported_algorithm",
534
+ f"unsupported integrity algorithm {declared_algorithm!r}; only "
535
+ f"{ALGORITHM!r} is supported",
536
+ )
537
+ )
538
+ return None, False, STATUS_UNSUPPORTED
539
+
540
+ files_raw = integ.get("files", None)
541
+ if not isinstance(files_raw, dict):
542
+ issues.append(
543
+ ManifestIssue("invalid_integrity", "integrity.files must be an object")
544
+ )
545
+ return None, False, STATUS_MALFORMED
546
+
547
+ built: Dict[str, str] = {}
548
+ built_source: Dict[str, str] = {}
549
+ collision_detected = False
550
+ for raw_key, raw_val in files_raw.items():
551
+ # E3-D14: expand before normalization, canonicalization and containment.
552
+ expansion = expand_env(raw_key, env=env, platform=platform)
553
+ if expansion.unresolved:
554
+ issues.append(
555
+ ManifestIssue(
556
+ "unresolved_env_var",
557
+ f"skipped integrity key {raw_key!r}: undefined environment "
558
+ f"variable(s) {', '.join(sorted(set(expansion.unresolved)))}",
559
+ )
560
+ )
561
+ continue
562
+ if expansion.malformed:
563
+ issues.append(
564
+ ManifestIssue(
565
+ "malformed_env_expr",
566
+ f"skipped integrity key {raw_key!r}: malformed environment "
567
+ f"expression(s) {list(expansion.malformed)!r}",
568
+ )
569
+ )
570
+ continue
571
+ key = expansion.value
572
+ kv = validate_key(key)
573
+ if kv.normalized is None:
574
+ issues.append(
575
+ ManifestIssue(
576
+ _KEY_REASON_CODE.get(kv.reason or "empty", "invalid_key"),
577
+ f"rejected integrity key {key!r} ({kv.reason})",
578
+ )
579
+ )
580
+ continue
581
+ resolution = resolve_integrity_key(key, directory)
582
+ if not resolution.within:
583
+ issues.append(
584
+ ManifestIssue(
585
+ "symlink_escape",
586
+ f"rejected integrity key {key!r}: resolves outside the "
587
+ "manifest directory",
588
+ )
589
+ )
590
+ continue
591
+ digest = normalize_hash(raw_val)
592
+ if digest is None:
593
+ issues.append(
594
+ ManifestIssue("invalid_hash", f"invalid SHA-256 value for key {key!r}")
595
+ )
596
+ continue
597
+ if kv.normalized in built:
598
+ # Two distinct keys collapsed to one normalized key after expansion.
599
+ # No approved winner exists, so keep the first and report it as
600
+ # unresolved rather than silently overwriting (E3-D14 boundary).
601
+ issues.append(
602
+ ManifestIssue(
603
+ "expansion_key_collision",
604
+ f"integrity keys {built_source[kv.normalized]!r} and {raw_key!r} "
605
+ f"both normalize to {kv.normalized!r}; keeping the first entry",
606
+ unresolved=EXP_COLLISION_CODE,
607
+ )
608
+ )
609
+ collision_detected = True
610
+ continue
611
+ built[kv.normalized] = digest
612
+ built_source[kv.normalized] = raw_key
613
+
614
+ # M2: detect case-only collisions *after* expansion and normalization. On
615
+ # Windows two distinct normalized keys that fold to the same name denote a
616
+ # single file; the winner is an unresolved owner decision (U-6), so both
617
+ # entries are retained and the collision is reported rather than resolved.
618
+ for first, second in detect_case_collisions(list(built.keys()), platform=platform):
619
+ collision_detected = True
620
+ issues.append(
621
+ ManifestIssue(
622
+ "case_collision",
623
+ f"case-only path collision: {first!r} vs {second!r}",
624
+ unresolved="U-6",
625
+ )
626
+ )
627
+
628
+ signature = integ.get("signature", None)
629
+ if signature is not None:
630
+ issues.append(
631
+ ManifestIssue(
632
+ "signature_ignored",
633
+ "signature is reserved and not enforced in this phase; node files are "
634
+ "treated as unsigned",
635
+ )
636
+ )
637
+
638
+ # M3: an empty integrity map is well-formed but verifies nothing, so it is not
639
+ # usable as a basis for integrity verification (fail-closed, consistent with
640
+ # E3-D5/E3-D12). Reaching this point with an empty map means either the
641
+ # section listed no files or every listed entry was skipped/rejected.
642
+ #
643
+ # R4: a map with an unresolved key collision (case-only or post-expansion) is
644
+ # likewise not usable -- a verifier cannot deterministically attribute a hash
645
+ # to a single file while the winning key is an unresolved decision. This is
646
+ # reflected only in *usability*; the manifest's syntax ``status`` stays OK.
647
+ if not built:
648
+ issues.append(
649
+ ManifestIssue(
650
+ "empty_integrity_map",
651
+ "integrity.files is empty; no file can be verified, so the map is "
652
+ "not usable for integrity verification",
653
+ )
654
+ )
655
+
656
+ usable = bool(built) and not collision_detected
657
+
658
+ return (
659
+ ManifestIntegrity(algorithm=ALGORITHM, files=built, signature=None),
660
+ usable,
661
+ STATUS_OK,
662
+ )
663
+
664
+
665
+ def _build_info(
666
+ path: str,
667
+ directory: str,
668
+ data: Dict[str, Any],
669
+ duplicates: List[str],
670
+ *,
671
+ env: Optional[Mapping[str, str]],
672
+ platform: Optional[str],
673
+ ) -> ManifestLoadResult:
674
+ issues: List[ManifestIssue] = []
675
+
676
+ for key in duplicates:
677
+ issues.append(
678
+ ManifestIssue(
679
+ "duplicate_key",
680
+ f"duplicate JSON key {key!r}; last occurrence wins",
681
+ unresolved="U-7",
682
+ )
683
+ )
684
+
685
+ schema_version = data.get("schema_version", _MISSING)
686
+ if schema_version is _MISSING:
687
+ issues.append(
688
+ ManifestIssue(
689
+ "missing_schema_version",
690
+ "schema_version is required",
691
+ unresolved="U-1",
692
+ )
693
+ )
694
+ return ManifestLoadResult(STATUS_MALFORMED, path, None, tuple(issues))
695
+ if isinstance(schema_version, bool) or not isinstance(schema_version, int):
696
+ issues.append(
697
+ ManifestIssue(
698
+ "invalid_schema_version",
699
+ f"invalid schema_version: {schema_version!r}",
700
+ unresolved="U-1",
701
+ )
702
+ )
703
+ return ManifestLoadResult(STATUS_MALFORMED, path, None, tuple(issues))
704
+ if schema_version < 1:
705
+ issues.append(
706
+ ManifestIssue(
707
+ "invalid_schema_version",
708
+ f"invalid schema_version: {schema_version!r}",
709
+ unresolved="U-1",
710
+ )
711
+ )
712
+ return ManifestLoadResult(STATUS_MALFORMED, path, None, tuple(issues))
713
+ if schema_version > SCHEMA_VERSION:
714
+ issues.append(
715
+ ManifestIssue(
716
+ "unsupported_schema_version",
717
+ f"schema_version {schema_version} is newer than supported "
718
+ f"{SCHEMA_VERSION}",
719
+ unresolved="U-1",
720
+ )
721
+ )
722
+ return ManifestLoadResult(STATUS_UNSUPPORTED, path, None, tuple(issues))
723
+
724
+ status = STATUS_OK
725
+
726
+ algorithm = data.get("algorithm", ALGORITHM)
727
+ algorithm_ok = True
728
+ if not (
729
+ isinstance(algorithm, str) and algorithm.strip().lower() == ALGORITHM
730
+ ):
731
+ issues.append(
732
+ ManifestIssue(
733
+ "unsupported_algorithm",
734
+ f"unsupported algorithm {algorithm!r}; only {ALGORITHM!r} is supported",
735
+ )
736
+ )
737
+ algorithm_ok = False
738
+ status = STATUS_UNSUPPORTED
739
+ algorithm = ALGORITHM
740
+
741
+ min_core_version = data.get("min_core_version", None)
742
+ if min_core_version is not None and not isinstance(min_core_version, str):
743
+ issues.append(
744
+ ManifestIssue(
745
+ "invalid_min_core_version",
746
+ "min_core_version must be a string or null; ignored (advisory only)",
747
+ )
748
+ )
749
+ min_core_version = None
750
+
751
+ tags_raw = data.get("tags", [])
752
+ tags: List[str] = []
753
+ if isinstance(tags_raw, list):
754
+ for tag in tags_raw:
755
+ if isinstance(tag, str):
756
+ tags.append(tag)
757
+ else:
758
+ issues.append(
759
+ ManifestIssue("invalid_tag", f"tag {tag!r} is not a string; ignored")
760
+ )
761
+ else:
762
+ issues.append(ManifestIssue("invalid_tags", "tags must be a list; ignored"))
763
+
764
+ declared_class: Optional[str] = None
765
+ source_class = data.get("source_class", None)
766
+ if source_class is not None:
767
+ if isinstance(source_class, str) and source_class.strip().lower() == SOURCE_EXTERNAL:
768
+ declared_class = SOURCE_EXTERNAL
769
+ issues.append(
770
+ ManifestIssue(
771
+ "source_class_external",
772
+ "manifest declares external (tighten-only); whether this affects "
773
+ "paths beyond its own directory is an unresolved owner decision",
774
+ unresolved="U-3",
775
+ )
776
+ )
777
+ else:
778
+ issues.append(
779
+ ManifestIssue(
780
+ "source_class_ignored",
781
+ f"source_class {source_class!r} ignored; a manifest may only tighten "
782
+ "to 'external' and can never grant 'bundled'/'user' trust",
783
+ unresolved="U-2",
784
+ )
785
+ )
786
+
787
+ for key in data:
788
+ if key not in _KNOWN_TOP_LEVEL:
789
+ issues.append(
790
+ ManifestIssue(
791
+ "unknown_field",
792
+ f"ignored unknown field {key!r}; manifest fields are never executable",
793
+ unresolved="U-9",
794
+ )
795
+ )
796
+
797
+ integrity: Optional[ManifestIntegrity] = None
798
+ integrity_usable = False
799
+ integ_raw = data.get("integrity", None)
800
+ if integ_raw is not None:
801
+ integrity, integ_usable, integ_status = _build_integrity(
802
+ integ_raw, directory, platform, issues, env=env
803
+ )
804
+ integrity_usable = integ_usable and algorithm_ok
805
+ if integ_status != STATUS_OK and status == STATUS_OK:
806
+ status = integ_status
807
+
808
+ info = ManifestInfo(
809
+ path=path,
810
+ directory=directory,
811
+ schema_version=schema_version,
812
+ algorithm=algorithm,
813
+ min_core_version=min_core_version,
814
+ tags=tuple(tags),
815
+ source_class=declared_class,
816
+ integrity=integrity,
817
+ integrity_usable=integrity_usable,
818
+ issues=tuple(issues),
819
+ )
820
+ return ManifestLoadResult(status=status, path=path, info=info, issues=tuple(issues))
821
+
822
+
823
+ def load_manifest(
824
+ directory: str,
825
+ *,
826
+ env: Optional[Mapping[str, str]] = None,
827
+ platform: Optional[str] = None,
828
+ ) -> ManifestLoadResult:
829
+ """Locate, bounded-read, parse, and validate a manifest. Never raises.
830
+
831
+ Enforcement (block vs fallback per source class) is the registry's decision;
832
+ this function only returns facts and issues. Unresolved cases carry a ``U-x``
833
+ code rather than invented behavior.
834
+ """
835
+ path = find_manifest(directory)
836
+ if path is None:
837
+ return ManifestLoadResult(STATUS_ABSENT, None, None, ())
838
+
839
+ try:
840
+ with open(path, "rb") as handle:
841
+ raw = handle.read(MAX_MANIFEST_BYTES + 1)
842
+ except OSError as exc:
843
+ return ManifestLoadResult(
844
+ STATUS_UNREADABLE, path, None, (ManifestIssue("unreadable", str(exc)),)
845
+ )
846
+
847
+ if len(raw) > MAX_MANIFEST_BYTES:
848
+ return ManifestLoadResult(
849
+ STATUS_OVERSIZED,
850
+ path,
851
+ None,
852
+ (
853
+ ManifestIssue(
854
+ "oversized",
855
+ f"manifest exceeds the {MAX_MANIFEST_BYTES}-byte limit and is invalid",
856
+ ),
857
+ ),
858
+ )
859
+
860
+ try:
861
+ text = raw.decode("utf-8")
862
+ except UnicodeDecodeError as exc:
863
+ return ManifestLoadResult(
864
+ STATUS_MALFORMED,
865
+ path,
866
+ None,
867
+ (
868
+ ManifestIssue(
869
+ "malformed_json",
870
+ f"manifest is not valid UTF-8: {exc}",
871
+ unresolved="U-1",
872
+ ),
873
+ ),
874
+ )
875
+
876
+ duplicates: List[str] = []
877
+
878
+ def _pairs_hook(pairs: List[Tuple[str, Any]]) -> Dict[str, Any]:
879
+ obj: Dict[str, Any] = {}
880
+ for key, value in pairs:
881
+ if key in obj:
882
+ duplicates.append(key)
883
+ obj[key] = value
884
+ return obj
885
+
886
+ try:
887
+ data = json.loads(text, object_pairs_hook=_pairs_hook)
888
+ except (json.JSONDecodeError, ValueError) as exc:
889
+ return ManifestLoadResult(
890
+ STATUS_MALFORMED,
891
+ path,
892
+ None,
893
+ (ManifestIssue("malformed_json", str(exc), unresolved="U-1"),),
894
+ )
895
+
896
+ if not isinstance(data, dict):
897
+ return ManifestLoadResult(
898
+ STATUS_MALFORMED,
899
+ path,
900
+ None,
901
+ (
902
+ ManifestIssue(
903
+ "not_an_object",
904
+ "manifest root is not a JSON object",
905
+ unresolved="U-1",
906
+ ),
907
+ ),
908
+ )
909
+
910
+ return _build_info(path, directory, data, duplicates, env=env, platform=platform)