@camstack/addon-model-studio 1.1.223 → 1.1.225
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.
- package/dist/{MotionZonesSettings-1CDVW7ke.mjs → MotionZonesSettings-AwjU_jds.mjs} +2 -2
- package/dist/{PrivacyMaskSettings-D86lwQor.mjs → PrivacyMaskSettings-BxJyOTIX.mjs} +4 -4
- package/dist/{SceneMonitorEditor-DaIyTg2F.mjs → SceneMonitorEditor-CvsWahwh.mjs} +3 -3
- package/dist/_stub.js +3613 -3487
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-BTzjbw2l.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-Bz8hcMYe.mjs} +4 -4
- package/dist/{_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.js-CISC_XrP.mjs → _virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.js-IW_NC3TX.mjs} +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DTZ_Cxlt.mjs +26 -0
- package/dist/addon-model-studio.css +1 -1
- package/dist/{hostInit-BdkWsNLF.mjs → hostInit-BCIUeCcs.mjs} +3 -3
- package/dist/model-studio.addon.js +2008 -142
- package/dist/model-studio.addon.mjs +2009 -143
- package/dist/{player-overlays-9n207Syf.mjs → player-overlays-DUpfuxPB.mjs} +1 -1
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-BrYRx--E.mjs → responsive-BHoVd25G.mjs} +1 -1
- package/dist/{scene-monitor-copy-Ccsj8OvK.mjs → scene-monitor-copy-DGpr-uDO.mjs} +1 -1
- package/dist/{square-DceOOyOz.mjs → square-CeBzl9Ag.mjs} +1 -1
- package/dist/{trash-2-B_ZsSine.mjs → trash-2-Bl3EnWCS.mjs} +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-DuDl-a7I.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-BE9Offwp.mjs} +1 -1
- package/package.json +1 -1
- package/python/__tests__/test_int8_recipe.py +77 -0
- package/python/convert_lib.py +68 -1
- package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Drvqb9B5.mjs +0 -26
|
@@ -31,6 +31,7 @@ node_os = __toESM(node_os);
|
|
|
31
31
|
let node_path = require("node:path");
|
|
32
32
|
node_path = __toESM(node_path);
|
|
33
33
|
let _camstack_system_addon_utils = require("@camstack/system/addon-utils");
|
|
34
|
+
let node_fs_promises = require("node:fs/promises");
|
|
34
35
|
//#region src/scrypted/scrypted-yolo-manifest-data.json
|
|
35
36
|
var scrypted_yolo_manifest_data_default = /*#__PURE__*/ JSON.parse("[{\"id\":\"scrypted-yolov9t-relu-coreml\",\"label\":\"Scrypted YOLOv9T ReLU CoreML\",\"family\":\"yolov9t\",\"variant\":\"relu\",\"format\":\"coreml\",\"precision\":\"fp16\",\"files\":[{\"relativePath\":\"coreml/scrypted_yolov9t_relu/scrypted_yolov9t_relu.mlpackage/Manifest.json\",\"size\":617,\"sha256\":\"0a8733949d77e3204dba6418e81a11a8cc177015711457ce2c171266f23382d6\"},{\"relativePath\":\"coreml/scrypted_yolov9t_relu/scrypted_yolov9t_relu.mlpackage/Data/com.apple.CoreML/model.mlmodel\",\"size\":322229,\"sha256\":\"f5a62f196f1e72a84efa1637119dffb6501621af9cf6f867bc76b4b59c9242a0\"},{\"relativePath\":\"coreml/scrypted_yolov9t_relu/scrypted_yolov9t_relu.mlpackage/Data/com.apple.CoreML/weights/weight.bin\",\"size\":3797160,\"sha256\":\"b994419b8b68cfd6b89c3c6f3fe6b37458c86cc1d87fcca3df5034476a99dd38\"}],\"sizeMB\":4.12},{\"id\":\"scrypted-yolov9t-relu-onnx\",\"label\":\"Scrypted YOLOv9T ReLU ONNX\",\"family\":\"yolov9t\",\"variant\":\"relu\",\"format\":\"onnx\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"onnx/scrypted_yolov9t_relu/scrypted_yolov9t_relu.onnx\",\"size\":8499266,\"sha256\":\"3f11ea2071b27c285b58c16636a44d6a0a27bdd1ca8b64112dfadabd39cfea47\"}],\"sizeMB\":8.5},{\"id\":\"scrypted-yolov9t-relu-test-coreml\",\"label\":\"Scrypted YOLOv9T ReLU test CoreML\",\"family\":\"yolov9t\",\"variant\":\"relu_test\",\"format\":\"coreml\",\"precision\":\"fp16\",\"files\":[{\"relativePath\":\"coreml/scrypted_yolov9t_relu_test/scrypted_yolov9t_relu_test.mlpackage/Manifest.json\",\"size\":617,\"sha256\":\"a5e0128b643f1a66f3e07d4b332f9ccbca97ccab75651c794f0b9f1fb41c8491\"},{\"relativePath\":\"coreml/scrypted_yolov9t_relu_test/scrypted_yolov9t_relu_test.mlpackage/Data/com.apple.CoreML/model.mlmodel\",\"size\":322229,\"sha256\":\"79f4f647f2a0c79db3b560c84251b48c7ba7cbe9c1fecc9674d1a603a389dfa3\"},{\"relativePath\":\"coreml/scrypted_yolov9t_relu_test/scrypted_yolov9t_relu_test.mlpackage/Data/com.apple.CoreML/weights/weight.bin\",\"size\":3797160,\"sha256\":\"72efc9dc6af9241b5e5ee7de24a4f55741f6425d0e279d797f0f223e3d355f84\"}],\"sizeMB\":4.12},{\"id\":\"scrypted-yolov9t-relu-test-onnx\",\"label\":\"Scrypted YOLOv9T ReLU test ONNX\",\"family\":\"yolov9t\",\"variant\":\"relu_test\",\"format\":\"onnx\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"onnx/scrypted_yolov9t_relu_test/scrypted_yolov9t_relu_test.onnx\",\"size\":8499266,\"sha256\":\"d20aa0e6923a3af7f5e84e3a6d28fb00e8ecd592e3225f986f93bd34b634e2f8\"}],\"sizeMB\":8.5},{\"id\":\"scrypted-yolov9s-relu-coreml\",\"label\":\"Scrypted YOLOv9S ReLU CoreML\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"coreml\",\"precision\":\"fp16\",\"files\":[{\"relativePath\":\"coreml/scrypted_yolov9s_relu/scrypted_yolov9s_relu.mlpackage/Manifest.json\",\"size\":617,\"sha256\":\"3bcdb820b82f1e89266f2d11bae1604d3ee4ca6d11dc5bd5c57055ff4157e9f3\"},{\"relativePath\":\"coreml/scrypted_yolov9s_relu/scrypted_yolov9s_relu.mlpackage/Data/com.apple.CoreML/model.mlmodel\",\"size\":322664,\"sha256\":\"9a9c3c9cbca406ec2f0418ec867ed6b878ec6d02c16636d30e0bbd83d2ff7c40\"},{\"relativePath\":\"coreml/scrypted_yolov9s_relu/scrypted_yolov9s_relu.mlpackage/Data/com.apple.CoreML/weights/weight.bin\",\"size\":14190120,\"sha256\":\"fd51eda58a993997268f6a2e424b536ba173207ad7974ab8bee2a8ff76d52dab\"}],\"sizeMB\":14.51},{\"id\":\"scrypted-yolov9s-relu-onnx\",\"label\":\"Scrypted YOLOv9S ReLU ONNX\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"onnx\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"onnx/scrypted_yolov9s_relu/scrypted_yolov9s_relu.onnx\",\"size\":29287339,\"sha256\":\"ca0b5bd98d5f59eb2029c6cb5129d53af59873f62a317a028beda463bbb96399\"}],\"sizeMB\":29.29},{\"id\":\"scrypted-yolov9s-relu-test-coreml\",\"label\":\"Scrypted YOLOv9S ReLU test CoreML\",\"family\":\"yolov9s\",\"variant\":\"relu_test\",\"format\":\"coreml\",\"precision\":\"fp16\",\"files\":[{\"relativePath\":\"coreml/scrypted_yolov9s_relu_test/scrypted_yolov9s_relu_test.mlpackage/Manifest.json\",\"size\":617,\"sha256\":\"e2d24de0ce7e8573f19572029765e55abc714f36a85175ad7fcb95c001a76653\"},{\"relativePath\":\"coreml/scrypted_yolov9s_relu_test/scrypted_yolov9s_relu_test.mlpackage/Data/com.apple.CoreML/model.mlmodel\",\"size\":322664,\"sha256\":\"186b147cdfd15c5ed7a381ec3a426a22cee0b5c52d56f14efd26da06357f5cb0\"},{\"relativePath\":\"coreml/scrypted_yolov9s_relu_test/scrypted_yolov9s_relu_test.mlpackage/Data/com.apple.CoreML/weights/weight.bin\",\"size\":14190120,\"sha256\":\"e50651924c2cbffd56008a8953569e66c3de69f21807fcf7d825390ce30f21f8\"}],\"sizeMB\":14.51},{\"id\":\"scrypted-yolov9s-relu-test-onnx\",\"label\":\"Scrypted YOLOv9S ReLU test ONNX\",\"family\":\"yolov9s\",\"variant\":\"relu_test\",\"format\":\"onnx\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"onnx/scrypted_yolov9s_relu_test/scrypted_yolov9s_relu_test.onnx\",\"size\":29287339,\"sha256\":\"115ddb83333762a0f2599421335678696454a5c3571ade5df9bac8e9cb5fb4cf\"}],\"sizeMB\":29.29},{\"id\":\"scrypted-yolov9m-relu-coreml\",\"label\":\"Scrypted YOLOv9M ReLU CoreML\",\"family\":\"yolov9m\",\"variant\":\"relu\",\"format\":\"coreml\",\"precision\":\"fp16\",\"files\":[{\"relativePath\":\"coreml/scrypted_yolov9m_relu/scrypted_yolov9m_relu.mlpackage/Manifest.json\",\"size\":617,\"sha256\":\"c548c6e1ff768b2b01bd71e230aa712a1635ae2baa30e0369557a42fc531ecbf\"},{\"relativePath\":\"coreml/scrypted_yolov9m_relu/scrypted_yolov9m_relu.mlpackage/Data/com.apple.CoreML/model.mlmodel\",\"size\":247061,\"sha256\":\"1c40e02fc2a2559cb906ea6cd9da9c730d4a78f5019290cbb38d2fcaae379fe7\"},{\"relativePath\":\"coreml/scrypted_yolov9m_relu/scrypted_yolov9m_relu.mlpackage/Data/com.apple.CoreML/weights/weight.bin\",\"size\":39880616,\"sha256\":\"4cf938e5bfcc3ee1644813e4eb4702a7de450cc0581df94c719cf43d0ed2e408\"}],\"sizeMB\":40.13},{\"id\":\"scrypted-yolov9m-relu-onnx\",\"label\":\"Scrypted YOLOv9M ReLU ONNX\",\"family\":\"yolov9m\",\"variant\":\"relu\",\"format\":\"onnx\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"onnx/scrypted_yolov9m_relu/scrypted_yolov9m_relu.onnx\",\"size\":80380404,\"sha256\":\"e7a81fb33224a0105d2a0a594c3fa43c398c361de623f1d14156ae826e7312d5\"}],\"sizeMB\":80.38},{\"id\":\"scrypted-yolov9m-relu-test-coreml\",\"label\":\"Scrypted YOLOv9M ReLU test CoreML\",\"family\":\"yolov9m\",\"variant\":\"relu_test\",\"format\":\"coreml\",\"precision\":\"fp16\",\"files\":[{\"relativePath\":\"coreml/scrypted_yolov9m_relu_test/scrypted_yolov9m_relu_test.mlpackage/Manifest.json\",\"size\":617,\"sha256\":\"8e2684b286d02b4bdf9db1027c84cb89bf8e4830cfb58269f3ec457c5a010650\"},{\"relativePath\":\"coreml/scrypted_yolov9m_relu_test/scrypted_yolov9m_relu_test.mlpackage/Data/com.apple.CoreML/model.mlmodel\",\"size\":247061,\"sha256\":\"53d5946e74b13b15c5f8616081c9f15e8a95a5df3d5b45b830fc5a7f49561c16\"},{\"relativePath\":\"coreml/scrypted_yolov9m_relu_test/scrypted_yolov9m_relu_test.mlpackage/Data/com.apple.CoreML/weights/weight.bin\",\"size\":39880616,\"sha256\":\"69774bf0032c37707601b8cdc1e1820dbd9f8288eb5d6f3879618a5d34ff5199\"}],\"sizeMB\":40.13},{\"id\":\"scrypted-yolov9m-relu-test-onnx\",\"label\":\"Scrypted YOLOv9M ReLU test ONNX\",\"family\":\"yolov9m\",\"variant\":\"relu_test\",\"format\":\"onnx\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"onnx/scrypted_yolov9m_relu_test/scrypted_yolov9m_relu_test.onnx\",\"size\":80380404,\"sha256\":\"8bb054f099295909ec518e2a6598d63db24d3f90edc8105a0f016903f2a205a2\"}],\"sizeMB\":80.38},{\"id\":\"scrypted-yolov9c-relu-coreml\",\"label\":\"Scrypted YOLOv9C ReLU CoreML\",\"family\":\"yolov9c\",\"variant\":\"relu\",\"format\":\"coreml\",\"precision\":\"fp16\",\"files\":[{\"relativePath\":\"coreml/scrypted_yolov9c_relu/scrypted_yolov9c_relu.mlpackage/Manifest.json\",\"size\":617,\"sha256\":\"813a306ebd69cabfd31f00434f5a961feeca7d237833f3e11805dcf4ad120ba9\"},{\"relativePath\":\"coreml/scrypted_yolov9c_relu/scrypted_yolov9c_relu.mlpackage/Data/com.apple.CoreML/model.mlmodel\",\"size\":263210,\"sha256\":\"862f082619075e470738306b0ff0a37ae70a7d08e684ca6a6dfa1971d404e0c3\"},{\"relativePath\":\"coreml/scrypted_yolov9c_relu/scrypted_yolov9c_relu.mlpackage/Data/com.apple.CoreML/weights/weight.bin\",\"size\":50489960,\"sha256\":\"ed89747e58943758e2a87221d1d404f6a4466cbc039c3c6f96e327cadc403d27\"}],\"sizeMB\":50.75},{\"id\":\"scrypted-yolov9c-relu-onnx\",\"label\":\"Scrypted YOLOv9C ReLU ONNX\",\"family\":\"yolov9c\",\"variant\":\"relu\",\"format\":\"onnx\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"onnx/scrypted_yolov9c_relu/scrypted_yolov9c_relu.onnx\",\"size\":101631962,\"sha256\":\"b9372c4428daf4cd944c114b1e80d1a9ff0487d743e53a77216a051cfbef7116\"}],\"sizeMB\":101.63},{\"id\":\"scrypted-yolov9c-relu-test-coreml\",\"label\":\"Scrypted YOLOv9C ReLU test CoreML\",\"family\":\"yolov9c\",\"variant\":\"relu_test\",\"format\":\"coreml\",\"precision\":\"fp16\",\"files\":[{\"relativePath\":\"coreml/scrypted_yolov9c_relu_test/scrypted_yolov9c_relu_test.mlpackage/Manifest.json\",\"size\":617,\"sha256\":\"966ef82a93cb0ccf1036a8c9729c065fd372fa9590a97d0945e581cc674f7ad2\"},{\"relativePath\":\"coreml/scrypted_yolov9c_relu_test/scrypted_yolov9c_relu_test.mlpackage/Data/com.apple.CoreML/model.mlmodel\",\"size\":263210,\"sha256\":\"08718ecd3e9552d21a702bd8df60911cad0eec7b2ae382466809550f14634711\"},{\"relativePath\":\"coreml/scrypted_yolov9c_relu_test/scrypted_yolov9c_relu_test.mlpackage/Data/com.apple.CoreML/weights/weight.bin\",\"size\":50489960,\"sha256\":\"fe5936b9430ab4c87f30b148220131d6ec998b2377223d033e2fa2a00e60aada\"}],\"sizeMB\":50.75},{\"id\":\"scrypted-yolov9c-relu-test-onnx\",\"label\":\"Scrypted YOLOv9C ReLU test ONNX\",\"family\":\"yolov9c\",\"variant\":\"relu_test\",\"format\":\"onnx\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"onnx/scrypted_yolov9c_relu_test/scrypted_yolov9c_relu_test.onnx\",\"size\":101631962,\"sha256\":\"2f4e2031e8efb4cbc871594338b2e875d78ab4af3ee0258d253273b1aac84742\"}],\"sizeMB\":101.63},{\"id\":\"scrypted-yolov9t-relu-openvino-fp32\",\"label\":\"Scrypted YOLOv9T ReLU OpenVINO FP32\",\"family\":\"yolov9t\",\"variant\":\"relu\",\"format\":\"openvino\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9t_relu/best-converted.xml\",\"size\":628222,\"sha256\":\"01b5a9d02a0f281e1aaf4860e1b0ed3a7f16b9d78975be8ff985ae0ee283d877\"},{\"relativePath\":\"openvino/scrypted_yolov9t_relu/best-converted.bin\",\"size\":7542204,\"sha256\":\"4fe9ce8dbdf94514fdd450cbfc907f257153e4898a0c1489a44e4912d8e32cc7\"}],\"sizeMB\":8.17},{\"id\":\"scrypted-yolov9s-relu-openvino-fp32\",\"label\":\"Scrypted YOLOv9S ReLU OpenVINO FP32\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"openvino\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9s_relu/best-converted.xml\",\"size\":629249,\"sha256\":\"5b4a229bf7229425698b63bd065a403e440a6151a6ddff0034867659cc4a480d\"},{\"relativePath\":\"openvino/scrypted_yolov9s_relu/best-converted.bin\",\"size\":28329724,\"sha256\":\"c030bd219208ea94082578c81f383d4ef9ec45d7150eec1c2c2ff2569cf49b35\"}],\"sizeMB\":28.96},{\"id\":\"scrypted-yolov9m-relu-openvino-fp32\",\"label\":\"Scrypted YOLOv9M ReLU OpenVINO FP32\",\"family\":\"yolov9m\",\"variant\":\"relu\",\"format\":\"openvino\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9m_relu/best-converted.xml\",\"size\":485439,\"sha256\":\"c66f9f1965bf70fd3635d4dfc3cb94c72c06b344c256713237d77706725b9a0c\"},{\"relativePath\":\"openvino/scrypted_yolov9m_relu/best-converted.bin\",\"size\":79717372,\"sha256\":\"dfc2d8952bbca9ad0e116168e3fd5c754e601c327d78c4f4d0d4cae12f0e1d2a\"}],\"sizeMB\":80.2},{\"id\":\"scrypted-yolov9c-relu-openvino-fp32\",\"label\":\"Scrypted YOLOv9C ReLU OpenVINO FP32\",\"family\":\"yolov9c\",\"variant\":\"relu\",\"format\":\"openvino\",\"precision\":\"fp32\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9c_relu/best-converted.xml\",\"size\":535047,\"sha256\":\"836c1e998ebf76108ff64d554fdfa07aa72c42624f1a5448701bb409f27b8d68\"},{\"relativePath\":\"openvino/scrypted_yolov9c_relu/best-converted.bin\",\"size\":100942972,\"sha256\":\"11a1b330ac9843b349927977b3c7c7f17bb42af73a7ff102969132f27ab81814\"}],\"sizeMB\":101.48},{\"id\":\"scrypted-yolov9t-relu-openvino-int8\",\"label\":\"Scrypted YOLOv9T ReLU OpenVINO INT8\",\"family\":\"yolov9t\",\"variant\":\"relu\",\"format\":\"openvino\",\"precision\":\"int8\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9t_relu_int8/best-converted.xml\",\"size\":1380379,\"sha256\":\"e5a76bf88ac69fc0ebc50c04b61ff91550dd9c2349af1f6d7e4cac949c640cec\"},{\"relativePath\":\"openvino/scrypted_yolov9t_relu_int8/best-converted.bin\",\"size\":1954956,\"sha256\":\"98fb5b6826d7c6697a585f69ba96754873772d9d61fbed8335aab761e8248659\"}],\"sizeMB\":3.34},{\"id\":\"scrypted-yolov9t-relu-test-openvino-int8\",\"label\":\"Scrypted YOLOv9T ReLU test OpenVINO INT8\",\"family\":\"yolov9t\",\"variant\":\"relu_test\",\"format\":\"openvino\",\"precision\":\"int8\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9t_relu_test_int8/best-converted.xml\",\"size\":1380383,\"sha256\":\"9e4119284e923e08c9929e78fd31e2552e602a552ac538ae99bf34a50dd4d172\"},{\"relativePath\":\"openvino/scrypted_yolov9t_relu_test_int8/best-converted.bin\",\"size\":1954960,\"sha256\":\"efe5b0a2fd2f5ddef5923eeb9e592a7ef14719061bb7605c86e05b35c2c58ea9\"}],\"sizeMB\":3.34},{\"id\":\"scrypted-yolov9s-relu-openvino-int8\",\"label\":\"Scrypted YOLOv9S ReLU OpenVINO INT8\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"openvino\",\"precision\":\"int8\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9s_relu_int8/best-converted.xml\",\"size\":1382088,\"sha256\":\"4e6c24cf24afbab21462f7e1a15bd05b1cbbe5915046000e03c2435d8110bbbf\"},{\"relativePath\":\"openvino/scrypted_yolov9s_relu_int8/best-converted.bin\",\"size\":7197308,\"sha256\":\"23fd3d666a938c41db232d9c6239baec1134716cfb4ed4ddd3d602dd20eb8ac0\"}],\"sizeMB\":8.58},{\"id\":\"scrypted-yolov9s-relu-test-openvino-int8\",\"label\":\"Scrypted YOLOv9S ReLU test OpenVINO INT8\",\"family\":\"yolov9s\",\"variant\":\"relu_test\",\"format\":\"openvino\",\"precision\":\"int8\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9s_relu_test_int8/best-converted.xml\",\"size\":1382092,\"sha256\":\"49865bfeafe7576afce089ba6f5c3e25a9192c8b514eb96265c90fe877795641\"},{\"relativePath\":\"openvino/scrypted_yolov9s_relu_test_int8/best-converted.bin\",\"size\":7197312,\"sha256\":\"78e9d36e6b74754db2b624ea3ec0b3ff57ed6dfed59a4f2225e1a271054597de\"}],\"sizeMB\":8.58},{\"id\":\"scrypted-yolov9m-relu-openvino-int8\",\"label\":\"Scrypted YOLOv9M ReLU OpenVINO INT8\",\"family\":\"yolov9m\",\"variant\":\"relu\",\"format\":\"openvino\",\"precision\":\"int8\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9m_relu_int8/best-converted.xml\",\"size\":1024595,\"sha256\":\"1242ab8d8c73b2e80c5dd541177ade6e102a2684114b059136acb4cad6efb034\"},{\"relativePath\":\"openvino/scrypted_yolov9m_relu_int8/best-converted.bin\",\"size\":20090516,\"sha256\":\"da8e44af8bee66478e6f359e9504bfb13ab4b76f4bd8a2f1b10cfbc22febcf6e\"}],\"sizeMB\":21.12},{\"id\":\"scrypted-yolov9m-relu-test-openvino-int8\",\"label\":\"Scrypted YOLOv9M ReLU test OpenVINO INT8\",\"family\":\"yolov9m\",\"variant\":\"relu_test\",\"format\":\"openvino\",\"precision\":\"int8\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9m_relu_test_int8/best-converted.xml\",\"size\":1024601,\"sha256\":\"24395ae5fdbb321304c865372cd2b905cdc55abb7610520f3963702e2371decb\"},{\"relativePath\":\"openvino/scrypted_yolov9m_relu_test_int8/best-converted.bin\",\"size\":20090520,\"sha256\":\"4360fe0312067f92c49f180c7b8a10271f14d58b8909aa9b96b13af4ab9289aa\"}],\"sizeMB\":21.12},{\"id\":\"scrypted-yolov9c-relu-openvino-int8\",\"label\":\"Scrypted YOLOv9C ReLU OpenVINO INT8\",\"family\":\"yolov9c\",\"variant\":\"relu\",\"format\":\"openvino\",\"precision\":\"int8\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9c_relu_int8/best-converted.xml\",\"size\":1092695,\"sha256\":\"a45c62940120c4301d8fff9fb3b275c29e3618f403ea68a785f2f3220cefec7a\"},{\"relativePath\":\"openvino/scrypted_yolov9c_relu_int8/best-converted.bin\",\"size\":25428280,\"sha256\":\"0643403a56178c3ed1e066c7884458d8ea6780115d662bdc38d10754d7a11c79\"}],\"sizeMB\":26.52},{\"id\":\"scrypted-yolov9c-relu-test-openvino-int8\",\"label\":\"Scrypted YOLOv9C ReLU test OpenVINO INT8\",\"family\":\"yolov9c\",\"variant\":\"relu_test\",\"format\":\"openvino\",\"precision\":\"int8\",\"files\":[{\"relativePath\":\"openvino/scrypted_yolov9c_relu_test_int8/best-converted.xml\",\"size\":1092695,\"sha256\":\"a8a1899848ebd060af2326d3c8d3c09ea83354f0bedff6cce6fa08b284ea5519\"},{\"relativePath\":\"openvino/scrypted_yolov9c_relu_test_int8/best-converted.bin\",\"size\":25428280,\"sha256\":\"2eb6bb3d0a03a9b239b6f623f9e7bced62eea61fbe4d8ff89c1b3e2e2b7978a2\"}],\"sizeMB\":26.52},{\"id\":\"scrypted-yolov9s-relu-sep-320-tflite-float16\",\"label\":\"Scrypted YOLOv9s ReLU sep 320 TFLite float16\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"tflite\",\"precision\":\"float16\",\"files\":[{\"relativePath\":\"tflite/scrypted_yolov9s_relu_sep_320/best_float16.tflite\",\"size\":14482836,\"sha256\":\"04889db3b81af361c361e41ffa99327330d37b71d680a2f889e6cdf1e94c0d8c\"}],\"sizeMB\":14.48},{\"id\":\"scrypted-yolov9s-relu-sep-320-tflite-float32\",\"label\":\"Scrypted YOLOv9s ReLU sep 320 TFLite float32\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"tflite\",\"precision\":\"float32\",\"files\":[{\"relativePath\":\"tflite/scrypted_yolov9s_relu_sep_320/best_float32.tflite\",\"size\":28777068,\"sha256\":\"f5d7d08fc1d8f2262633d2df4391638e0481740331aaa1837880a47c33001a96\"}],\"sizeMB\":28.78},{\"id\":\"scrypted-yolov9s-relu-sep-320-tflite-int8\",\"label\":\"Scrypted YOLOv9s ReLU sep 320 TFLite int8\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"tflite\",\"precision\":\"int8\",\"files\":[{\"relativePath\":\"tflite/scrypted_yolov9s_relu_sep_320/best_int8.tflite\",\"size\":7325616,\"sha256\":\"1e9866b16fe80931383bf3c94dc629fe93a37ba3dc1465ea019eb0a50bd428df\"}],\"sizeMB\":7.33},{\"id\":\"scrypted-yolov9s-relu-sep-320-tflite-integer_quant\",\"label\":\"Scrypted YOLOv9s ReLU sep 320 TFLite integer_quant\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"tflite\",\"precision\":\"integer_quant\",\"files\":[{\"relativePath\":\"tflite/scrypted_yolov9s_relu_sep_320/best_integer_quant.tflite\",\"size\":7342552,\"sha256\":\"bc1c902e9a9865637ee2403f70c6bf5c29c695d9163e58ad658feb29bb097ebc\"}],\"sizeMB\":7.34},{\"id\":\"scrypted-yolov9s-relu-sep-320-tflite-full_integer_quant\",\"label\":\"Scrypted YOLOv9s ReLU sep 320 TFLite full_integer_quant\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"tflite\",\"precision\":\"full_integer_quant\",\"files\":[{\"relativePath\":\"tflite/scrypted_yolov9s_relu_sep_320/best_full_integer_quant.tflite\",\"size\":7341704,\"sha256\":\"483ce38dbe33ee5a35f40a82f56c77629a44fa5d95efd8ade9fa97e4d2a261fd\"}],\"sizeMB\":7.34},{\"id\":\"scrypted-yolov9s-relu-sep-320-tflite-edgetpu\",\"label\":\"Scrypted YOLOv9s ReLU sep 320 TFLite edgetpu\",\"family\":\"yolov9s\",\"variant\":\"relu\",\"format\":\"tflite\",\"precision\":\"edgetpu\",\"files\":[{\"relativePath\":\"tflite/scrypted_yolov9s_relu_sep_320/best_full_integer_quant_edgetpu.tflite\",\"size\":8164480,\"sha256\":\"e1e6b074a3b9fdf19a171baf615553ad375a046aa7de2a3fef9a1950175fab22\"}],\"sizeMB\":8.16}]");
|
|
36
37
|
//#endregion
|
|
@@ -5771,7 +5772,7 @@ var ZodIssueCode = {
|
|
|
5771
5772
|
var ZodFirstPartyTypeKind;
|
|
5772
5773
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5773
5774
|
//#endregion
|
|
5774
|
-
//#region ../types/dist/sleep-
|
|
5775
|
+
//#region ../types/dist/sleep-r3RWkGVx.mjs
|
|
5775
5776
|
/**
|
|
5776
5777
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5777
5778
|
* window to float samples (D455).
|
|
@@ -5888,7 +5889,7 @@ function isKeychainStoredField(field) {
|
|
|
5888
5889
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5889
5890
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5890
5891
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5891
|
-
function isRecord$
|
|
5892
|
+
function isRecord$2(value) {
|
|
5892
5893
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5893
5894
|
}
|
|
5894
5895
|
function makeSecretMarker(ref) {
|
|
@@ -5899,12 +5900,12 @@ function makeSecretMarker(ref) {
|
|
|
5899
5900
|
}
|
|
5900
5901
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5901
5902
|
function isSecretMarker(value) {
|
|
5902
|
-
if (!isRecord$
|
|
5903
|
+
if (!isRecord$2(value)) return false;
|
|
5903
5904
|
const ref = value["$secret"];
|
|
5904
5905
|
return typeof ref === "string" && ref.length > 0;
|
|
5905
5906
|
}
|
|
5906
5907
|
function isSecretClear(value) {
|
|
5907
|
-
return isRecord$
|
|
5908
|
+
return isRecord$2(value) && value["$secretClear"] === true;
|
|
5908
5909
|
}
|
|
5909
5910
|
/**
|
|
5910
5911
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6420,6 +6421,13 @@ function globalSecretScope() {
|
|
|
6420
6421
|
function encodeSegment(value) {
|
|
6421
6422
|
return encodeURIComponent(value);
|
|
6422
6423
|
}
|
|
6424
|
+
function decodeSegment(value) {
|
|
6425
|
+
try {
|
|
6426
|
+
return decodeURIComponent(value);
|
|
6427
|
+
} catch {
|
|
6428
|
+
return null;
|
|
6429
|
+
}
|
|
6430
|
+
}
|
|
6423
6431
|
/**
|
|
6424
6432
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6425
6433
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6428,6 +6436,75 @@ function encodeSegment(value) {
|
|
|
6428
6436
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6429
6437
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6430
6438
|
}
|
|
6439
|
+
function parseScope(segments) {
|
|
6440
|
+
switch (segments[0]) {
|
|
6441
|
+
case "global": return {
|
|
6442
|
+
scope: GLOBAL_SCOPE,
|
|
6443
|
+
used: 1
|
|
6444
|
+
};
|
|
6445
|
+
case "node": {
|
|
6446
|
+
const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6447
|
+
return nodeId === null || nodeId.length === 0 ? null : {
|
|
6448
|
+
scope: {
|
|
6449
|
+
kind: "node",
|
|
6450
|
+
nodeId
|
|
6451
|
+
},
|
|
6452
|
+
used: 2
|
|
6453
|
+
};
|
|
6454
|
+
}
|
|
6455
|
+
case "device": {
|
|
6456
|
+
const raw = segments[1];
|
|
6457
|
+
if (raw === void 0 || !/^\d+$/.test(raw)) return null;
|
|
6458
|
+
return {
|
|
6459
|
+
scope: {
|
|
6460
|
+
kind: "device",
|
|
6461
|
+
deviceId: Number(raw)
|
|
6462
|
+
},
|
|
6463
|
+
used: 2
|
|
6464
|
+
};
|
|
6465
|
+
}
|
|
6466
|
+
case "integration": {
|
|
6467
|
+
const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6468
|
+
return id === null || id.length === 0 ? null : {
|
|
6469
|
+
scope: {
|
|
6470
|
+
kind: "integration",
|
|
6471
|
+
integrationId: id
|
|
6472
|
+
},
|
|
6473
|
+
used: 2
|
|
6474
|
+
};
|
|
6475
|
+
}
|
|
6476
|
+
case "row": {
|
|
6477
|
+
const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
|
|
6478
|
+
const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
|
|
6479
|
+
if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
|
|
6480
|
+
return {
|
|
6481
|
+
scope: {
|
|
6482
|
+
kind: "row",
|
|
6483
|
+
collection,
|
|
6484
|
+
rowId
|
|
6485
|
+
},
|
|
6486
|
+
used: 3
|
|
6487
|
+
};
|
|
6488
|
+
}
|
|
6489
|
+
default: return null;
|
|
6490
|
+
}
|
|
6491
|
+
}
|
|
6492
|
+
/** Take a ref apart; `null` when it is not a well-formed ref. */
|
|
6493
|
+
function parseSecretRef(ref) {
|
|
6494
|
+
if (!ref.startsWith("secret://")) return null;
|
|
6495
|
+
const segments = ref.slice(9).split("/");
|
|
6496
|
+
const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
|
|
6497
|
+
if (owner === null || owner.length === 0) return null;
|
|
6498
|
+
const parsed = parseScope(segments.slice(1));
|
|
6499
|
+
if (parsed === null) return null;
|
|
6500
|
+
const fieldPath = segments.slice(1 + parsed.used).join("/");
|
|
6501
|
+
if (fieldPath.length === 0) return null;
|
|
6502
|
+
return {
|
|
6503
|
+
owner,
|
|
6504
|
+
scope: parsed.scope,
|
|
6505
|
+
fieldPath
|
|
6506
|
+
};
|
|
6507
|
+
}
|
|
6431
6508
|
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6432
6509
|
var KeychainWriteRefusedError = class extends Error {
|
|
6433
6510
|
fieldPath;
|
|
@@ -6438,7 +6515,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6438
6515
|
}
|
|
6439
6516
|
};
|
|
6440
6517
|
var KEEP = { kind: "keep" };
|
|
6441
|
-
function isRecord$
|
|
6518
|
+
function isRecord$1(value) {
|
|
6442
6519
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6443
6520
|
}
|
|
6444
6521
|
function defaultMintId() {
|
|
@@ -6451,7 +6528,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6451
6528
|
return out;
|
|
6452
6529
|
}
|
|
6453
6530
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6454
|
-
else if (isRecord$
|
|
6531
|
+
else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6455
6532
|
return out;
|
|
6456
6533
|
}
|
|
6457
6534
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6506,7 +6583,7 @@ function rowId(row, idKey) {
|
|
|
6506
6583
|
return null;
|
|
6507
6584
|
}
|
|
6508
6585
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6509
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6586
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
|
|
6510
6587
|
if (!Array.isArray(incoming)) {
|
|
6511
6588
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6512
6589
|
return {
|
|
@@ -6522,7 +6599,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6522
6599
|
const kept = /* @__PURE__ */ new Set();
|
|
6523
6600
|
const rows = [];
|
|
6524
6601
|
for (const row of incoming) {
|
|
6525
|
-
if (!isRecord$
|
|
6602
|
+
if (!isRecord$1(row)) {
|
|
6526
6603
|
rows.push(row);
|
|
6527
6604
|
continue;
|
|
6528
6605
|
}
|
|
@@ -6547,7 +6624,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6547
6624
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6548
6625
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6549
6626
|
case "object": {
|
|
6550
|
-
if (!isRecord$
|
|
6627
|
+
if (!isRecord$1(incoming)) {
|
|
6551
6628
|
if (incoming === void 0) return KEEP;
|
|
6552
6629
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6553
6630
|
return {
|
|
@@ -6555,7 +6632,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6555
6632
|
value: incoming
|
|
6556
6633
|
};
|
|
6557
6634
|
}
|
|
6558
|
-
const storedObj = isRecord$
|
|
6635
|
+
const storedObj = isRecord$1(stored) ? stored : {};
|
|
6559
6636
|
return {
|
|
6560
6637
|
kind: "value",
|
|
6561
6638
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6614,12 +6691,19 @@ async function transformSecretWrite(input) {
|
|
|
6614
6691
|
}
|
|
6615
6692
|
};
|
|
6616
6693
|
}
|
|
6694
|
+
/** Is `ref` one of `owner`'s refs? */
|
|
6695
|
+
function isSecretRefOwnedBy(ref, owner) {
|
|
6696
|
+
return parseSecretRef(ref)?.owner === owner;
|
|
6697
|
+
}
|
|
6617
6698
|
/**
|
|
6618
6699
|
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6619
6700
|
* reference when there is no marker (no allocation, no keychain call).
|
|
6620
6701
|
*/
|
|
6621
|
-
async function resolveSecretMarkers(value, secrets) {
|
|
6622
|
-
const
|
|
6702
|
+
async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
6703
|
+
const keepMarker = options.unresolved === "keep-marker";
|
|
6704
|
+
const owner = options.ownedBy;
|
|
6705
|
+
const inScope = (ref) => owner === void 0 || isSecretRefOwnedBy(ref, owner);
|
|
6706
|
+
const refs = collectSecretMarkerRefs(value).filter(inScope);
|
|
6623
6707
|
if (refs.length === 0) return {
|
|
6624
6708
|
value,
|
|
6625
6709
|
unresolved: []
|
|
@@ -6643,10 +6727,18 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6643
6727
|
}
|
|
6644
6728
|
const substitute = (v) => {
|
|
6645
6729
|
if (isSecretMarker(v)) {
|
|
6730
|
+
if (!inScope(v.$secret)) return {
|
|
6731
|
+
keep: true,
|
|
6732
|
+
value: v
|
|
6733
|
+
};
|
|
6646
6734
|
const answer = answers[v.$secret];
|
|
6647
|
-
|
|
6735
|
+
if (answer?.kind === "value") return {
|
|
6648
6736
|
keep: true,
|
|
6649
6737
|
value: answer.value
|
|
6738
|
+
};
|
|
6739
|
+
return keepMarker ? {
|
|
6740
|
+
keep: true,
|
|
6741
|
+
value: v
|
|
6650
6742
|
} : {
|
|
6651
6743
|
keep: false,
|
|
6652
6744
|
value: void 0
|
|
@@ -6663,7 +6755,7 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6663
6755
|
value: items
|
|
6664
6756
|
};
|
|
6665
6757
|
}
|
|
6666
|
-
if (isRecord$
|
|
6758
|
+
if (isRecord$1(v)) {
|
|
6667
6759
|
const out = {};
|
|
6668
6760
|
for (const [k, child] of Object.entries(v)) {
|
|
6669
6761
|
const s = substitute(child);
|
|
@@ -6684,14 +6776,152 @@ async function resolveSecretMarkers(value, secrets) {
|
|
|
6684
6776
|
unresolved
|
|
6685
6777
|
};
|
|
6686
6778
|
}
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6779
|
+
/** An addon tried to replace a stored secret it could not read. Nothing was written. */
|
|
6780
|
+
var SecretOverwriteRefusedError = class extends Error {
|
|
6781
|
+
ref;
|
|
6782
|
+
reason;
|
|
6783
|
+
constructor(ref, reason) {
|
|
6784
|
+
super(`secret ${ref} was not replaced: its stored value cannot be read right now (${reason}), and an addon may not overwrite a secret it cannot see. Nothing was written.`);
|
|
6785
|
+
this.ref = ref;
|
|
6786
|
+
this.reason = reason;
|
|
6787
|
+
this.name = "SecretOverwriteRefusedError";
|
|
6788
|
+
}
|
|
6789
|
+
};
|
|
6790
|
+
function isRecord$3(value) {
|
|
6791
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6792
|
+
}
|
|
6793
|
+
function resolvedValue(pass, marker) {
|
|
6794
|
+
const answer = pass.answers[marker.$secret];
|
|
6795
|
+
return answer?.kind === "value" ? answer.value : null;
|
|
6796
|
+
}
|
|
6797
|
+
async function atMarker(pass, incoming, stored) {
|
|
6798
|
+
if (incoming === null) return stored;
|
|
6799
|
+
if (typeof incoming !== "string") return incoming;
|
|
6800
|
+
if (incoming === resolvedValue(pass, stored)) return stored;
|
|
6801
|
+
const intent = classifySecretWrite(incoming);
|
|
6802
|
+
if (intent.kind !== "set") return stored;
|
|
6803
|
+
const ref = stored.$secret;
|
|
6804
|
+
if (!isSecretRefOwnedBy(ref, pass.secrets.owner)) return incoming;
|
|
6805
|
+
const answer = pass.answers[ref];
|
|
6806
|
+
if ((answer === void 0 || answer.kind === "unavailable" || answer.kind === "forbidden") && !pass.operatorWrite) throw new SecretOverwriteRefusedError(ref, answer === void 0 ? "not-initialized" : answer.kind === "unavailable" ? answer.reason : answer.kind);
|
|
6807
|
+
try {
|
|
6808
|
+
await pass.secrets.put(ref, intent.value);
|
|
6809
|
+
} catch (err) {
|
|
6810
|
+
throw new KeychainWriteRefusedError(ref, err);
|
|
6811
|
+
}
|
|
6812
|
+
pass.changedRefs.push(ref);
|
|
6813
|
+
return stored;
|
|
6814
|
+
}
|
|
6815
|
+
function inArray(pass, incoming, stored) {
|
|
6816
|
+
return incoming.map((item, index) => {
|
|
6817
|
+
const twin = stored[index];
|
|
6818
|
+
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
6819
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
6820
|
+
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
6821
|
+
return item;
|
|
6822
|
+
});
|
|
6823
|
+
}
|
|
6824
|
+
function inArrayRow(pass, incoming, stored) {
|
|
6825
|
+
const out = { ...incoming };
|
|
6826
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
6827
|
+
const twin = stored[key];
|
|
6828
|
+
if (isSecretMarker(twin)) {
|
|
6829
|
+
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
6830
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
6831
|
+
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
6832
|
+
}
|
|
6833
|
+
return out;
|
|
6834
|
+
}
|
|
6835
|
+
async function walk(pass, incoming, stored) {
|
|
6836
|
+
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
6837
|
+
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
6838
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
6839
|
+
const out = { ...incoming };
|
|
6840
|
+
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
6841
|
+
return out;
|
|
6842
|
+
}
|
|
6843
|
+
/** Restore markers a write-back carries as values. See the file doc. */
|
|
6844
|
+
async function restoreUnchangedSecrets(input) {
|
|
6845
|
+
const refs = [];
|
|
6846
|
+
for (const key of Object.keys(input.patch)) collectSecretMarkerRefs(input.stored[key], refs);
|
|
6847
|
+
const owned = refs.filter((ref) => isSecretRefOwnedBy(ref, input.secrets.owner));
|
|
6848
|
+
if (owned.length === 0) return {
|
|
6849
|
+
patch: input.patch,
|
|
6850
|
+
changedRefs: []
|
|
6851
|
+
};
|
|
6852
|
+
const pass = {
|
|
6853
|
+
secrets: input.secrets,
|
|
6854
|
+
answers: await input.secrets.resolve([...new Set(owned)]),
|
|
6855
|
+
operatorWrite: input.operatorWrite,
|
|
6856
|
+
changedRefs: []
|
|
6857
|
+
};
|
|
6858
|
+
const out = {};
|
|
6859
|
+
for (const [key, value] of Object.entries(input.patch)) out[key] = await walk(pass, value, input.stored[key]);
|
|
6860
|
+
return {
|
|
6861
|
+
patch: out,
|
|
6862
|
+
changedRefs: pass.changedRefs
|
|
6863
|
+
};
|
|
6864
|
+
}
|
|
6865
|
+
/** Structural equality over JSON-shaped values (key order does not matter). */
|
|
6866
|
+
function isJsonEqual(a, b) {
|
|
6867
|
+
if (Object.is(a, b)) return true;
|
|
6868
|
+
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
6869
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
6870
|
+
const keys = Object.keys(a);
|
|
6871
|
+
if (keys.length !== Object.keys(b).length) return false;
|
|
6872
|
+
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
6692
6873
|
}
|
|
6693
6874
|
return false;
|
|
6694
6875
|
}
|
|
6876
|
+
/** The patch without the keys whose value already equals the stored one. */
|
|
6877
|
+
function dropUnchangedKeys(patch, stored) {
|
|
6878
|
+
const out = {};
|
|
6879
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
6880
|
+
if (Object.prototype.hasOwnProperty.call(stored, key) && isJsonEqual(value, stored[key])) continue;
|
|
6881
|
+
out[key] = value;
|
|
6882
|
+
}
|
|
6883
|
+
return out;
|
|
6884
|
+
}
|
|
6885
|
+
/** The top-level keys of a blob that hold at least one of `owner`'s markers. */
|
|
6886
|
+
function markerKeysOf(blob, owner) {
|
|
6887
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6888
|
+
for (const [key, value] of Object.entries(blob)) if (collectSecretMarkerRefs(value).some((ref) => isSecretRefOwnedBy(ref, owner))) keys.add(key);
|
|
6889
|
+
return keys;
|
|
6890
|
+
}
|
|
6891
|
+
function nodeFromStored(value, owner) {
|
|
6892
|
+
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
6893
|
+
if (!isRecord$3(value)) return null;
|
|
6894
|
+
const children = /* @__PURE__ */ new Map();
|
|
6895
|
+
for (const [key, child] of Object.entries(value)) {
|
|
6896
|
+
const node = nodeFromStored(child, owner);
|
|
6897
|
+
if (node !== null) children.set(key, node);
|
|
6898
|
+
}
|
|
6899
|
+
return children.size > 0 ? {
|
|
6900
|
+
kind: "object",
|
|
6901
|
+
children
|
|
6902
|
+
} : null;
|
|
6903
|
+
}
|
|
6904
|
+
/**
|
|
6905
|
+
* The declared secret tree, widened by every place the STORED blob holds a
|
|
6906
|
+
* marker under one of `keys` — so a marker the schema no longer declares (or
|
|
6907
|
+
* never declared: Wyze before b4906cec6) still gets the save path's
|
|
6908
|
+
* KEEP / SET / CLEAR semantics instead of being overwritten by whatever the
|
|
6909
|
+
* addon writes. Markers inside arrays are not added: a row has no id field to
|
|
6910
|
+
* match by unless the schema declares one. Only `owner`'s markers count: a
|
|
6911
|
+
* builtin that keeps another addon's marker (device-manager) never takes it
|
|
6912
|
+
* over.
|
|
6913
|
+
*/
|
|
6914
|
+
function widenTreeWithStoredMarkers(declared, stored, keys, owner) {
|
|
6915
|
+
const added = /* @__PURE__ */ new Map();
|
|
6916
|
+
for (const key of keys) {
|
|
6917
|
+
const at = key.indexOf("@");
|
|
6918
|
+
const base = at > 0 ? key.slice(0, at) : key;
|
|
6919
|
+
if (declared.has(base) || added.has(base)) continue;
|
|
6920
|
+
const node = nodeFromStored(stored[key], owner);
|
|
6921
|
+
if (node !== null) added.set(base, node);
|
|
6922
|
+
}
|
|
6923
|
+
return added.size === 0 ? declared : new Map([...declared, ...added]);
|
|
6924
|
+
}
|
|
6695
6925
|
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6696
6926
|
async function readStoredAddonBlob(raw) {
|
|
6697
6927
|
const threeWay = raw.readAddonStoreResult;
|
|
@@ -6700,7 +6930,41 @@ async function readStoredAddonBlob(raw) {
|
|
|
6700
6930
|
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6701
6931
|
return result.kind === "missing" ? {} : result.value;
|
|
6702
6932
|
}
|
|
6703
|
-
function
|
|
6933
|
+
function touchesTree(tree, patch) {
|
|
6934
|
+
if (tree.size === 0) return false;
|
|
6935
|
+
for (const key of Object.keys(patch)) {
|
|
6936
|
+
const at = key.indexOf("@");
|
|
6937
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6938
|
+
}
|
|
6939
|
+
return false;
|
|
6940
|
+
}
|
|
6941
|
+
/**
|
|
6942
|
+
* Which top-level keys of each store held markers when last seen. `undefined`
|
|
6943
|
+
* for a store not seen yet: its first write reads it, to be safe.
|
|
6944
|
+
*/
|
|
6945
|
+
var MarkerKeyIndex = class {
|
|
6946
|
+
owner;
|
|
6947
|
+
byStore = /* @__PURE__ */ new Map();
|
|
6948
|
+
constructor(owner) {
|
|
6949
|
+
this.owner = owner;
|
|
6950
|
+
}
|
|
6951
|
+
seen(store, blob) {
|
|
6952
|
+
this.byStore.set(store, markerKeysOf(blob, this.owner));
|
|
6953
|
+
}
|
|
6954
|
+
wrote(store, patch) {
|
|
6955
|
+
const keys = this.byStore.get(store);
|
|
6956
|
+
if (keys === void 0) return;
|
|
6957
|
+
const now = markerKeysOf(patch, this.owner);
|
|
6958
|
+
for (const key of Object.keys(patch)) if (now.has(key)) keys.add(key);
|
|
6959
|
+
else keys.delete(key);
|
|
6960
|
+
}
|
|
6961
|
+
mayHoldMarkers(store, patch) {
|
|
6962
|
+
const keys = this.byStore.get(store);
|
|
6963
|
+
if (keys === void 0) return true;
|
|
6964
|
+
return Object.keys(patch).some((key) => keys.has(key));
|
|
6965
|
+
}
|
|
6966
|
+
};
|
|
6967
|
+
function createHandle(raw, opts) {
|
|
6704
6968
|
const chains = /* @__PURE__ */ new Map();
|
|
6705
6969
|
const serialize = (key, fn) => {
|
|
6706
6970
|
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
@@ -6711,46 +6975,130 @@ function createSecretAwareSettings(raw, opts) {
|
|
|
6711
6975
|
});
|
|
6712
6976
|
return next;
|
|
6713
6977
|
};
|
|
6714
|
-
const
|
|
6715
|
-
|
|
6716
|
-
|
|
6978
|
+
const index = new MarkerKeyIndex(opts.secrets.owner);
|
|
6979
|
+
const resolveRead = async (store, blob) => {
|
|
6980
|
+
index.seen(store, blob);
|
|
6981
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, opts.secrets, {
|
|
6982
|
+
unresolved: "keep-marker",
|
|
6983
|
+
ownedBy: opts.secrets.owner
|
|
6984
|
+
});
|
|
6985
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
6986
|
+
return value;
|
|
6987
|
+
};
|
|
6988
|
+
const write = async (store, declared, scope, patch, readStored, rawWrite) => {
|
|
6989
|
+
if (!touchesTree(declared, patch) && !index.mayHoldMarkers(store, patch)) {
|
|
6990
|
+
await rawWrite(patch);
|
|
6991
|
+
index.wrote(store, patch);
|
|
6992
|
+
return { changed: true };
|
|
6993
|
+
}
|
|
6994
|
+
return serialize(store, async () => {
|
|
6717
6995
|
const stored = await readStored();
|
|
6996
|
+
index.seen(store, stored);
|
|
6997
|
+
const operatorWrite = opts.isOperatorWrite?.() === true;
|
|
6998
|
+
const restored = await restoreUnchangedSecrets({
|
|
6999
|
+
patch,
|
|
7000
|
+
stored,
|
|
7001
|
+
secrets: opts.secrets,
|
|
7002
|
+
operatorWrite
|
|
7003
|
+
});
|
|
6718
7004
|
const result = await transformSecretWrite({
|
|
6719
|
-
tree,
|
|
7005
|
+
tree: widenTreeWithStoredMarkers(declared, stored, Object.keys(restored.patch), opts.secrets.owner),
|
|
6720
7006
|
secrets: opts.secrets,
|
|
6721
|
-
patch,
|
|
7007
|
+
patch: restored.patch,
|
|
6722
7008
|
stored,
|
|
6723
7009
|
...scope !== void 0 ? { scope } : {},
|
|
6724
|
-
operatorWrite
|
|
7010
|
+
operatorWrite
|
|
6725
7011
|
});
|
|
6726
|
-
|
|
7012
|
+
const effective = dropUnchangedKeys(result.patch, stored);
|
|
7013
|
+
const wroteBlob = Object.keys(effective).length > 0;
|
|
7014
|
+
if (wroteBlob) {
|
|
7015
|
+
await rawWrite(effective);
|
|
7016
|
+
index.wrote(store, effective);
|
|
7017
|
+
}
|
|
6727
7018
|
const { orphaned } = await result.afterWrite();
|
|
6728
7019
|
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
7020
|
+
return { changed: wroteBlob || restored.changedRefs.length > 0 };
|
|
6729
7021
|
});
|
|
6730
7022
|
};
|
|
6731
|
-
const
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
7023
|
+
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
7024
|
+
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
7025
|
+
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
7026
|
+
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
7027
|
+
const overrides = {
|
|
7028
|
+
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
7029
|
+
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
7030
|
+
const result = await readAddonStoreResult.call(raw);
|
|
7031
|
+
return result.kind === "value" ? {
|
|
7032
|
+
kind: "value",
|
|
7033
|
+
value: await resolveRead("addon", result.value)
|
|
7034
|
+
} : result;
|
|
7035
|
+
} } : {},
|
|
7036
|
+
...readAddonStoreKeyResult !== void 0 ? { readAddonStoreKeyResult: async (key) => {
|
|
7037
|
+
const result = await readAddonStoreKeyResult.call(raw, key);
|
|
7038
|
+
if (result.kind !== "present") return result;
|
|
7039
|
+
const { value, unresolved } = await resolveSecretMarkers({ [key]: result.value }, opts.secrets, {
|
|
7040
|
+
unresolved: "keep-marker",
|
|
7041
|
+
ownedBy: opts.secrets.owner
|
|
7042
|
+
});
|
|
7043
|
+
if (unresolved.length > 0) opts.onUnresolved?.(unresolved);
|
|
7044
|
+
return {
|
|
7045
|
+
kind: "present",
|
|
7046
|
+
value: value[key]
|
|
7047
|
+
};
|
|
7048
|
+
} } : {},
|
|
7049
|
+
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
7050
|
+
...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
|
|
7051
|
+
const rows = await readDeviceStoreBatch.call(raw, deviceIds);
|
|
7052
|
+
const out = /* @__PURE__ */ new Map();
|
|
7053
|
+
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
7054
|
+
return out;
|
|
7055
|
+
} } : {},
|
|
7056
|
+
writeAddonStore: async (patch) => {
|
|
7057
|
+
await writeAddon(patch);
|
|
7058
|
+
},
|
|
7059
|
+
writeDeviceStore: async (deviceId, patch) => {
|
|
7060
|
+
await write(`device:${deviceId}`, opts.deviceTree(), {
|
|
7061
|
+
kind: "device",
|
|
7062
|
+
deviceId
|
|
7063
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p));
|
|
7064
|
+
}
|
|
7065
|
+
};
|
|
7066
|
+
return {
|
|
7067
|
+
settings: new Proxy(raw, { get(target, prop, receiver) {
|
|
7068
|
+
if (typeof prop === "string" && Object.prototype.hasOwnProperty.call(overrides, prop)) return Reflect.get(overrides, prop);
|
|
7069
|
+
const value = Reflect.get(target, prop, receiver);
|
|
7070
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
7071
|
+
} }),
|
|
7072
|
+
raw: {
|
|
7073
|
+
readAddonStore: async () => {
|
|
7074
|
+
const blob = await raw.readAddonStore();
|
|
7075
|
+
index.seen("addon", blob);
|
|
7076
|
+
return blob;
|
|
7077
|
+
},
|
|
7078
|
+
readDeviceStore: async (deviceId) => {
|
|
7079
|
+
const blob = await raw.readDeviceStore(deviceId);
|
|
7080
|
+
index.seen(`device:${deviceId}`, blob);
|
|
7081
|
+
return blob;
|
|
7082
|
+
}
|
|
7083
|
+
},
|
|
7084
|
+
writeAddonStore: writeAddon
|
|
6737
7085
|
};
|
|
6738
|
-
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6739
|
-
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6740
|
-
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6741
|
-
const value = Reflect.get(target, prop, receiver);
|
|
6742
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
6743
|
-
} });
|
|
6744
7086
|
}
|
|
6745
|
-
/** The context the addon sees
|
|
6746
|
-
function
|
|
7087
|
+
/** The context the addon sees, plus the private raw view and write outcome. */
|
|
7088
|
+
function createSecretAwareContext(context, opts) {
|
|
6747
7089
|
const raw = context.settings;
|
|
6748
|
-
if (raw === void 0) return
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
7090
|
+
if (raw === void 0) return {
|
|
7091
|
+
context,
|
|
7092
|
+
handle: null
|
|
7093
|
+
};
|
|
7094
|
+
const handle = createHandle(raw, opts);
|
|
7095
|
+
return {
|
|
7096
|
+
context: new Proxy(context, { get(target, prop, receiver) {
|
|
7097
|
+
if (prop === "settings") return handle.settings;
|
|
7098
|
+
return Reflect.get(target, prop, receiver);
|
|
7099
|
+
} }),
|
|
7100
|
+
handle
|
|
7101
|
+
};
|
|
6754
7102
|
}
|
|
6755
7103
|
var LEAF = { kind: "leaf" };
|
|
6756
7104
|
var DEFAULT_ITEM_ID_KEY = "id";
|
|
@@ -6925,6 +7273,14 @@ var BaseAddon = class {
|
|
|
6925
7273
|
_secretChangeUnsub = null;
|
|
6926
7274
|
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6927
7275
|
_operatorWriteDepth = 0;
|
|
7276
|
+
/**
|
|
7277
|
+
* The keychain-aware settings handle (D798). Its `raw` view is the ONLY way
|
|
7278
|
+
* to the marker-bearing blobs and stays private to this class: the form
|
|
7279
|
+
* hydrate and config resolution need markers, addon code never does.
|
|
7280
|
+
*/
|
|
7281
|
+
_secretSettings = null;
|
|
7282
|
+
/** Refs an addon-facing read could not resolve — each is logged once per process. */
|
|
7283
|
+
_loggedUnresolvedReads = /* @__PURE__ */ new Set();
|
|
6928
7284
|
constructor(defaults) {
|
|
6929
7285
|
this.defaults = defaults;
|
|
6930
7286
|
this._config = { ...defaults };
|
|
@@ -6961,13 +7317,21 @@ var BaseAddon = class {
|
|
|
6961
7317
|
}
|
|
6962
7318
|
async initialize(context) {
|
|
6963
7319
|
const secrets = context.secrets;
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
7320
|
+
if (secrets !== void 0) {
|
|
7321
|
+
const { context: wrapped, handle } = createSecretAwareContext(context, {
|
|
7322
|
+
secrets,
|
|
7323
|
+
addonTree: () => this.addonSecretTree(),
|
|
7324
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
7325
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
7326
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0,
|
|
7327
|
+
onUnresolved: (unresolved) => this.logUnresolvedRead(unresolved)
|
|
7328
|
+
});
|
|
7329
|
+
this._ctx = wrapped;
|
|
7330
|
+
this._secretSettings = handle;
|
|
7331
|
+
} else {
|
|
7332
|
+
this._ctx = context;
|
|
7333
|
+
this._secretSettings = null;
|
|
7334
|
+
}
|
|
6971
7335
|
await this.resolveConfig();
|
|
6972
7336
|
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6973
7337
|
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
@@ -7084,11 +7448,8 @@ var BaseAddon = class {
|
|
|
7084
7448
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
7085
7449
|
const schema = this.globalSettingsSchema(cap);
|
|
7086
7450
|
if (!schema) return { sections: [] };
|
|
7087
|
-
const projected = await this.
|
|
7088
|
-
return hydrateSchema(schema, overlay ? {
|
|
7089
|
-
...projected,
|
|
7090
|
-
...overlay
|
|
7091
|
-
} : projected, { inlineSecretsAsViews: true });
|
|
7451
|
+
const projected = await this.readRawProjectedStore(nodeId, cap);
|
|
7452
|
+
return hydrateSchema(schema, overlay ? await this.overlayKeepingMarkers(projected, overlay) : projected, { inlineSecretsAsViews: true });
|
|
7092
7453
|
}
|
|
7093
7454
|
/**
|
|
7094
7455
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -7133,7 +7494,7 @@ var BaseAddon = class {
|
|
|
7133
7494
|
});
|
|
7134
7495
|
}
|
|
7135
7496
|
if (sections.length === 0) return null;
|
|
7136
|
-
const projected = await this.
|
|
7497
|
+
const projected = await this.readRawProjectedStore(nodeId);
|
|
7137
7498
|
return hydrateSchema({
|
|
7138
7499
|
...schema,
|
|
7139
7500
|
sections
|
|
@@ -7150,12 +7511,50 @@ var BaseAddon = class {
|
|
|
7150
7511
|
* the store for custom option logic (option narrowing, value snapping) to
|
|
7151
7512
|
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
7152
7513
|
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
7514
|
+
*
|
|
7515
|
+
* Keychain values come back RESOLVED (D798): a secret reads as its value,
|
|
7516
|
+
* never as a `{ $secret }` marker. One the keychain cannot serve right now
|
|
7517
|
+
* stays a marker — "stored, unavailable" (`isSecretMarker()` is true, and it
|
|
7518
|
+
* is listed in {@link unresolvedSecrets}) — never `''` and never absent, so
|
|
7519
|
+
* it cannot be mistaken for "nothing stored, mint a new one". Writing the
|
|
7520
|
+
* resolved blob back is a no-op for every unchanged secret.
|
|
7153
7521
|
*/
|
|
7154
7522
|
async resolveGlobalStore(nodeId, cap) {
|
|
7155
7523
|
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
7524
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7525
|
+
}
|
|
7526
|
+
projectForNode(store, nodeId, cap) {
|
|
7156
7527
|
const keys = this.perNodeKeys(cap);
|
|
7157
7528
|
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7158
|
-
return keys.size > 0 ? projectStore(
|
|
7529
|
+
return keys.size > 0 ? projectStore(store, keys, node) : store;
|
|
7530
|
+
}
|
|
7531
|
+
/** The PROJECTED store with its markers — the form hydrate only (D798). */
|
|
7532
|
+
async readRawProjectedStore(nodeId, cap) {
|
|
7533
|
+
const raw = await this.rawSettings()?.readAddonStore() ?? {};
|
|
7534
|
+
return this.projectForNode(raw, nodeId, cap);
|
|
7535
|
+
}
|
|
7536
|
+
/**
|
|
7537
|
+
* `{ ...stored, ...overlay }`, except that an overlay member equal to the
|
|
7538
|
+
* RESOLVED stored one keeps the stored (marker-bearing) member — so a form
|
|
7539
|
+
* hydrated from a resolved overlay still shows a secret as "set", never as
|
|
7540
|
+
* its value.
|
|
7541
|
+
*/
|
|
7542
|
+
async overlayKeepingMarkers(stored, overlay) {
|
|
7543
|
+
const secrets = this._ctx?.secrets;
|
|
7544
|
+
const merged = {
|
|
7545
|
+
...stored,
|
|
7546
|
+
...overlay
|
|
7547
|
+
};
|
|
7548
|
+
if (secrets === void 0 || collectSecretMarkerRefs(stored).length === 0) return merged;
|
|
7549
|
+
const { value: resolved } = await resolveSecretMarkers(stored, secrets, {
|
|
7550
|
+
unresolved: "keep-marker",
|
|
7551
|
+
ownedBy: secrets.owner
|
|
7552
|
+
});
|
|
7553
|
+
for (const key of Object.keys(overlay)) {
|
|
7554
|
+
if (collectSecretMarkerRefs(stored[key]).length === 0) continue;
|
|
7555
|
+
if (isJsonEqual(overlay[key], resolved[key])) merged[key] = stored[key];
|
|
7556
|
+
}
|
|
7557
|
+
return merged;
|
|
7159
7558
|
}
|
|
7160
7559
|
/**
|
|
7161
7560
|
* Whether ONE global key of this addon's store was written, read three-way
|
|
@@ -7220,8 +7619,12 @@ var BaseAddon = class {
|
|
|
7220
7619
|
async clearSecrets(keys, nodeId) {
|
|
7221
7620
|
const tree = this.addonSecretTree();
|
|
7222
7621
|
const keychain = this._ctx?.secrets !== void 0;
|
|
7622
|
+
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7223
7623
|
const patch = {};
|
|
7224
|
-
for (const key of keys)
|
|
7624
|
+
for (const key of keys) {
|
|
7625
|
+
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7626
|
+
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7627
|
+
}
|
|
7225
7628
|
await this.applyGlobalPatch(patch, nodeId);
|
|
7226
7629
|
}
|
|
7227
7630
|
async applyGlobalPatch(barePatch, nodeId) {
|
|
@@ -7229,7 +7632,11 @@ var BaseAddon = class {
|
|
|
7229
7632
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7230
7633
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7231
7634
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
7232
|
-
|
|
7635
|
+
const handle = this._secretSettings;
|
|
7636
|
+
if (handle !== null) {
|
|
7637
|
+
const { changed } = await handle.writeAddonStore(scoped);
|
|
7638
|
+
if (!changed) return;
|
|
7639
|
+
} else await this._ctx?.settings?.writeAddonStore(scoped);
|
|
7233
7640
|
if (target !== localNode) return;
|
|
7234
7641
|
await this.resolveConfig();
|
|
7235
7642
|
await this.onConfigChanged();
|
|
@@ -7282,7 +7689,7 @@ var BaseAddon = class {
|
|
|
7282
7689
|
async getDeviceSettings(deviceId) {
|
|
7283
7690
|
const schema = this.deviceSettingsSchema();
|
|
7284
7691
|
if (!schema) return { sections: [] };
|
|
7285
|
-
return hydrateSchema(schema, await this.
|
|
7692
|
+
return hydrateSchema(schema, await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
7286
7693
|
}
|
|
7287
7694
|
async updateDeviceSettings(deviceId, patch) {
|
|
7288
7695
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7454,7 +7861,7 @@ var BaseAddon = class {
|
|
|
7454
7861
|
key,
|
|
7455
7862
|
schema,
|
|
7456
7863
|
fallback,
|
|
7457
|
-
read: async () => this.resolveStoredSecrets(await this.
|
|
7864
|
+
read: async () => this.resolveStoredSecrets(await this.rawSettings()?.readDeviceStore(deviceId) ?? {}, false),
|
|
7458
7865
|
write: async (patch) => {
|
|
7459
7866
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7460
7867
|
},
|
|
@@ -7516,6 +7923,23 @@ var BaseAddon = class {
|
|
|
7516
7923
|
}
|
|
7517
7924
|
return value;
|
|
7518
7925
|
}
|
|
7926
|
+
/**
|
|
7927
|
+
* The marker-bearing settings reads (D798) — private on purpose. Without a
|
|
7928
|
+
* keychain the context's own view is already raw.
|
|
7929
|
+
*/
|
|
7930
|
+
rawSettings() {
|
|
7931
|
+
return this._secretSettings?.raw ?? this._ctx?.settings;
|
|
7932
|
+
}
|
|
7933
|
+
/** An addon-facing read met markers it could not resolve: say so once per ref. */
|
|
7934
|
+
logUnresolvedRead(unresolved) {
|
|
7935
|
+
const fresh = unresolved.filter((u) => !this._loggedUnresolvedReads.has(u.ref));
|
|
7936
|
+
if (fresh.length === 0) return;
|
|
7937
|
+
for (const u of fresh) this._loggedUnresolvedReads.add(u.ref);
|
|
7938
|
+
this._ctx?.logger?.warn?.("settings read: a stored secret is unavailable — it reads as its marker, not as a value", { meta: { secrets: fresh.map((u) => ({
|
|
7939
|
+
ref: u.ref,
|
|
7940
|
+
reason: u.reason
|
|
7941
|
+
})) } });
|
|
7942
|
+
}
|
|
7519
7943
|
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7520
7944
|
scheduleSecretReresolve(delayMs) {
|
|
7521
7945
|
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
@@ -7542,7 +7966,7 @@ var BaseAddon = class {
|
|
|
7542
7966
|
* `{}` (defaults) — the addon's first successful patch will rehydrate.
|
|
7543
7967
|
*/
|
|
7544
7968
|
async readAddonStoreWithRetry() {
|
|
7545
|
-
const settings = this.
|
|
7969
|
+
const settings = this.rawSettings();
|
|
7546
7970
|
if (!settings) return {};
|
|
7547
7971
|
const delaysMs = [
|
|
7548
7972
|
150,
|
|
@@ -9849,6 +10273,278 @@ var CameraSwitchGroupSchema = object({
|
|
|
9849
10273
|
fetchedAt: number()
|
|
9850
10274
|
});
|
|
9851
10275
|
/**
|
|
10276
|
+
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
10277
|
+
* gets back (cloud training, D805+).
|
|
10278
|
+
*
|
|
10279
|
+
* The trainer (`hf/camstack-trainer`, published as the Hugging Face repo
|
|
10280
|
+
* `camstack/camstack-trainer`) is a separate AGPL program the hub never
|
|
10281
|
+
* imports: `job.json` goes in, files come out, and progress is `CAMSTACK_EVENT`
|
|
10282
|
+
* lines on stdout. These schemas are the hub's half of that boundary; the
|
|
10283
|
+
* trainer's pydantic models (and the JSON Schemas generated from them under
|
|
10284
|
+
* `hf/camstack-trainer/schemas/`) are the other half. A change here is a
|
|
10285
|
+
* change there, in the same piece of work.
|
|
10286
|
+
*
|
|
10287
|
+
* No `.default()` anywhere: defaults do not run on the addon cap path, so the
|
|
10288
|
+
* orchestrator fills every field of a job spec explicitly.
|
|
10289
|
+
*/
|
|
10290
|
+
var TRAINING_JOB_SCHEMA = "camstack.training/v1";
|
|
10291
|
+
var TRAINING_RESULT_SCHEMA = "camstack.training-result/v1";
|
|
10292
|
+
/** What the trainer can export. Edge TPU is a later, separate image. */
|
|
10293
|
+
var TrainingExportSchema = _enum([
|
|
10294
|
+
"onnx",
|
|
10295
|
+
"openvino-fp16",
|
|
10296
|
+
"openvino-int8",
|
|
10297
|
+
"coreml-fp16"
|
|
10298
|
+
]);
|
|
10299
|
+
var FloorsSchema = record(string(), number().min(0).max(1));
|
|
10300
|
+
object({
|
|
10301
|
+
schema: literal(TRAINING_JOB_SCHEMA),
|
|
10302
|
+
jobKey: string().uuid(),
|
|
10303
|
+
target: object({
|
|
10304
|
+
kind: literal("detector"),
|
|
10305
|
+
step: literal("object-detection")
|
|
10306
|
+
}),
|
|
10307
|
+
base: object({
|
|
10308
|
+
modelId: string().min(1),
|
|
10309
|
+
/** Ultralytics weights id, e.g. `yolov9m.pt`. */
|
|
10310
|
+
weights: string().min(1),
|
|
10311
|
+
imgsz: number().int().positive()
|
|
10312
|
+
}),
|
|
10313
|
+
baseline: object({
|
|
10314
|
+
modelId: string().min(1),
|
|
10315
|
+
/** The baseline ONNX the holdout comparison runs; public mirror URL. */
|
|
10316
|
+
onnxUrl: string().url(),
|
|
10317
|
+
imgsz: number().int().positive(),
|
|
10318
|
+
floors: FloorsSchema
|
|
10319
|
+
}),
|
|
10320
|
+
dataset: object({
|
|
10321
|
+
versionId: string().min(1),
|
|
10322
|
+
annotationHash: string(),
|
|
10323
|
+
/** sha256 of the uploaded archive; the trainer refuses a mismatch (exit 65). */
|
|
10324
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10325
|
+
}),
|
|
10326
|
+
split: object({
|
|
10327
|
+
holdoutCameras: array(number().int()),
|
|
10328
|
+
/** When no camera is held out: the last N days of every camera. */
|
|
10329
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
10330
|
+
valFraction: number().min(0).max(.5),
|
|
10331
|
+
seed: number().int()
|
|
10332
|
+
}),
|
|
10333
|
+
hyper: object({
|
|
10334
|
+
epochs: number().int().positive(),
|
|
10335
|
+
batch: number().int().positive(),
|
|
10336
|
+
lr0: number().positive(),
|
|
10337
|
+
/** Layers frozen from the start of the backbone; 0 = none. */
|
|
10338
|
+
freeze: number().int().nonnegative(),
|
|
10339
|
+
patience: number().int().nonnegative(),
|
|
10340
|
+
seed: number().int()
|
|
10341
|
+
}),
|
|
10342
|
+
replay: object({
|
|
10343
|
+
source: literal("coco2017"),
|
|
10344
|
+
count: number().int().nonnegative()
|
|
10345
|
+
}),
|
|
10346
|
+
exports: array(TrainingExportSchema).min(1),
|
|
10347
|
+
calibration: object({ maxFrames: number().int().positive() }),
|
|
10348
|
+
floors: object({
|
|
10349
|
+
minSupport: number().int().positive(),
|
|
10350
|
+
clamp: number().min(0).max(1)
|
|
10351
|
+
}),
|
|
10352
|
+
int8Gate: object({ maxMap50Drop: number().min(0).max(1) }),
|
|
10353
|
+
catalog: object({
|
|
10354
|
+
id: string().regex(/^[a-z0-9][a-z0-9-]{2,80}$/),
|
|
10355
|
+
name: string().min(1).max(160)
|
|
10356
|
+
})
|
|
10357
|
+
});
|
|
10358
|
+
/** One regular file of the bundle. An mlpackage contributes one row per member. */
|
|
10359
|
+
var TrainingResultFileSchema = object({
|
|
10360
|
+
path: string().min(1),
|
|
10361
|
+
bytes: number().int().nonnegative(),
|
|
10362
|
+
sha256: string().regex(/^[0-9a-f]{64}$/),
|
|
10363
|
+
format: _enum([
|
|
10364
|
+
"onnx",
|
|
10365
|
+
"openvino",
|
|
10366
|
+
"coreml",
|
|
10367
|
+
"pt"
|
|
10368
|
+
]),
|
|
10369
|
+
variant: _enum(["base", "int8"])
|
|
10370
|
+
});
|
|
10371
|
+
var DraftFormatSchema = object({
|
|
10372
|
+
/** RELATIVE path inside the bundle; the hub rewrites it to `camstack-local://`. */
|
|
10373
|
+
url: string().min(1),
|
|
10374
|
+
sizeMB: number().nonnegative(),
|
|
10375
|
+
isDirectory: boolean().optional(),
|
|
10376
|
+
files: array(string()).optional(),
|
|
10377
|
+
runtimes: array(literal("python")).optional(),
|
|
10378
|
+
revision: string().min(1)
|
|
10379
|
+
});
|
|
10380
|
+
/** The trainer's half of a catalog entry; the hub completes it (labels, licence, group). */
|
|
10381
|
+
var TrainingCatalogDraftSchema = object({
|
|
10382
|
+
id: string().min(1),
|
|
10383
|
+
name: string().min(1),
|
|
10384
|
+
description: string(),
|
|
10385
|
+
labels: array(unknown()),
|
|
10386
|
+
inputSize: object({
|
|
10387
|
+
width: number().int().positive(),
|
|
10388
|
+
height: number().int().positive()
|
|
10389
|
+
}),
|
|
10390
|
+
preprocessMode: literal("letterbox"),
|
|
10391
|
+
defaultClassFloors: FloorsSchema,
|
|
10392
|
+
formats: object({
|
|
10393
|
+
onnx: DraftFormatSchema.optional(),
|
|
10394
|
+
openvino: DraftFormatSchema.optional(),
|
|
10395
|
+
coreml: DraftFormatSchema.optional()
|
|
10396
|
+
})
|
|
10397
|
+
});
|
|
10398
|
+
/** One class of one model's holdout report (the eval harness's summary). */
|
|
10399
|
+
var TrainingEvalClassSchema = object({
|
|
10400
|
+
positives: number().int(),
|
|
10401
|
+
floor: number().nullable(),
|
|
10402
|
+
tp: number().int(),
|
|
10403
|
+
fp: number().int(),
|
|
10404
|
+
fn: number().int(),
|
|
10405
|
+
precision: number().nullable(),
|
|
10406
|
+
recall: number().nullable(),
|
|
10407
|
+
ap50: number().nullable(),
|
|
10408
|
+
recallByCamera: record(string(), number().nullable()).optional(),
|
|
10409
|
+
recallByLight: record(string(), number().nullable()).optional(),
|
|
10410
|
+
fpByCamera: record(string(), number()).optional(),
|
|
10411
|
+
smallFound: number().int().optional(),
|
|
10412
|
+
smallTotal: number().int().optional()
|
|
10413
|
+
}).passthrough();
|
|
10414
|
+
var TrainingEvalReportSchema = object({
|
|
10415
|
+
frames: number().int(),
|
|
10416
|
+
classes: record(string(), TrainingEvalClassSchema)
|
|
10417
|
+
}).passthrough();
|
|
10418
|
+
/**
|
|
10419
|
+
* A succeeded result carries every block; a failed one carries the error and
|
|
10420
|
+
* whatever was known by then — the other blocks are ABSENT, not null. The
|
|
10421
|
+
* orchestrator checks the blocks it needs before it trusts a success.
|
|
10422
|
+
*/
|
|
10423
|
+
var TrainingResultSchema = object({
|
|
10424
|
+
schema: literal(TRAINING_RESULT_SCHEMA),
|
|
10425
|
+
jobKey: string(),
|
|
10426
|
+
status: _enum(["succeeded", "failed"]),
|
|
10427
|
+
error: object({
|
|
10428
|
+
stage: string(),
|
|
10429
|
+
code: string(),
|
|
10430
|
+
message: string()
|
|
10431
|
+
}).nullable(),
|
|
10432
|
+
trainer: object({
|
|
10433
|
+
version: string(),
|
|
10434
|
+
revision: string()
|
|
10435
|
+
}),
|
|
10436
|
+
toolchain: record(string(), string().nullable()),
|
|
10437
|
+
dataset: object({
|
|
10438
|
+
versionId: string(),
|
|
10439
|
+
annotationHash: string(),
|
|
10440
|
+
sha256: string(),
|
|
10441
|
+
frames: object({
|
|
10442
|
+
train: number().int(),
|
|
10443
|
+
val: number().int(),
|
|
10444
|
+
holdout: number().int()
|
|
10445
|
+
}),
|
|
10446
|
+
holdoutCameras: array(number().int()),
|
|
10447
|
+
replayImages: number().int()
|
|
10448
|
+
}).optional(),
|
|
10449
|
+
training: object({
|
|
10450
|
+
epochsRun: number().int(),
|
|
10451
|
+
bestEpoch: number().int(),
|
|
10452
|
+
bestMap50: number(),
|
|
10453
|
+
bestMap50_95: number(),
|
|
10454
|
+
seconds: number()
|
|
10455
|
+
}).optional(),
|
|
10456
|
+
evaluation: object({
|
|
10457
|
+
holdoutFrames: number().int(),
|
|
10458
|
+
baseline: TrainingEvalReportSchema.nullable(),
|
|
10459
|
+
candidate: TrainingEvalReportSchema.nullable(),
|
|
10460
|
+
candidateInt8: TrainingEvalReportSchema.nullable(),
|
|
10461
|
+
recallDeltaByCamera: record(string(), record(string(), number())).nullable(),
|
|
10462
|
+
map50: record(string(), number().nullable())
|
|
10463
|
+
}).optional(),
|
|
10464
|
+
floors: object({
|
|
10465
|
+
baseline: FloorsSchema,
|
|
10466
|
+
candidate: FloorsSchema,
|
|
10467
|
+
candidateInt8: FloorsSchema.nullable(),
|
|
10468
|
+
notes: array(string())
|
|
10469
|
+
}).optional(),
|
|
10470
|
+
int8: object({
|
|
10471
|
+
kept: boolean(),
|
|
10472
|
+
map50Fp16: number().nullable(),
|
|
10473
|
+
map50Int8: number().nullable(),
|
|
10474
|
+
reason: string().nullable()
|
|
10475
|
+
}).optional(),
|
|
10476
|
+
exportsDropped: array(object({
|
|
10477
|
+
export: string(),
|
|
10478
|
+
reason: string()
|
|
10479
|
+
})).optional(),
|
|
10480
|
+
files: array(TrainingResultFileSchema).optional(),
|
|
10481
|
+
bundle: object({
|
|
10482
|
+
path: literal("bundle.tar"),
|
|
10483
|
+
bytes: number().int().nonnegative(),
|
|
10484
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
10485
|
+
}).nullable().optional(),
|
|
10486
|
+
catalogDraft: object({
|
|
10487
|
+
base: TrainingCatalogDraftSchema,
|
|
10488
|
+
int8: TrainingCatalogDraftSchema.nullable()
|
|
10489
|
+
}).nullable().optional(),
|
|
10490
|
+
licence: string()
|
|
10491
|
+
});
|
|
10492
|
+
var TrainingStageSchema = _enum([
|
|
10493
|
+
"prepare",
|
|
10494
|
+
"replay",
|
|
10495
|
+
"train",
|
|
10496
|
+
"eval",
|
|
10497
|
+
"export",
|
|
10498
|
+
"package"
|
|
10499
|
+
]);
|
|
10500
|
+
var EventBase = {
|
|
10501
|
+
v: literal(1),
|
|
10502
|
+
ts: number()
|
|
10503
|
+
};
|
|
10504
|
+
discriminatedUnion("type", [
|
|
10505
|
+
object({
|
|
10506
|
+
...EventBase,
|
|
10507
|
+
type: literal("stage"),
|
|
10508
|
+
stage: TrainingStageSchema
|
|
10509
|
+
}),
|
|
10510
|
+
object({
|
|
10511
|
+
...EventBase,
|
|
10512
|
+
type: literal("epoch"),
|
|
10513
|
+
epoch: number().int(),
|
|
10514
|
+
epochs: number().int(),
|
|
10515
|
+
boxLoss: number().nullable().optional(),
|
|
10516
|
+
map50: number().nullable().optional(),
|
|
10517
|
+
map50_95: number().nullable().optional(),
|
|
10518
|
+
etaSec: number().nullable().optional()
|
|
10519
|
+
}),
|
|
10520
|
+
object({
|
|
10521
|
+
...EventBase,
|
|
10522
|
+
type: literal("metric"),
|
|
10523
|
+
name: string(),
|
|
10524
|
+
value: number()
|
|
10525
|
+
}),
|
|
10526
|
+
object({
|
|
10527
|
+
...EventBase,
|
|
10528
|
+
type: literal("artifact"),
|
|
10529
|
+
path: string(),
|
|
10530
|
+
bytes: number(),
|
|
10531
|
+
sha256: string()
|
|
10532
|
+
}),
|
|
10533
|
+
object({
|
|
10534
|
+
...EventBase,
|
|
10535
|
+
type: literal("done"),
|
|
10536
|
+
status: _enum(["succeeded", "failed"]),
|
|
10537
|
+
resultSha256: string().nullable().optional()
|
|
10538
|
+
}),
|
|
10539
|
+
object({
|
|
10540
|
+
...EventBase,
|
|
10541
|
+
type: literal("error"),
|
|
10542
|
+
stage: string(),
|
|
10543
|
+
code: string(),
|
|
10544
|
+
message: string()
|
|
10545
|
+
})
|
|
10546
|
+
]);
|
|
10547
|
+
/**
|
|
9852
10548
|
* What the gate decided about a birth, from the CALLER's point of view.
|
|
9853
10549
|
*
|
|
9854
10550
|
* Deliberately not `ConfirmationVerdict`: `undecided` is not a birth decision
|
|
@@ -12332,7 +13028,9 @@ var AddonHttpRouteSchema = object({
|
|
|
12332
13028
|
"authenticated",
|
|
12333
13029
|
"admin"
|
|
12334
13030
|
]).optional(),
|
|
12335
|
-
description: string().optional()
|
|
13031
|
+
description: string().optional(),
|
|
13032
|
+
/** The hub limits this route per client address before the handler runs. */
|
|
13033
|
+
rateLimit: _enum(["auth"]).optional()
|
|
12336
13034
|
});
|
|
12337
13035
|
/**
|
|
12338
13036
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -13037,6 +13735,37 @@ var BackupDestinationInfoSchema = object({
|
|
|
13037
13735
|
lastError: string().optional()
|
|
13038
13736
|
});
|
|
13039
13737
|
/**
|
|
13738
|
+
* How an archive is encrypted (operator decision 2026-10-09): to a backup
|
|
13739
|
+
* PUBLIC key the hub holds, so only the operator's secret key opens it.
|
|
13740
|
+
* Absent on a plain `.tar.gz` — every archive made before encryption, or
|
|
13741
|
+
* with it off — which restores without a key.
|
|
13742
|
+
*/
|
|
13743
|
+
var BackupArchiveEncryptionSchema = object({
|
|
13744
|
+
/** `x25519-hkdf-aes256gcm-stream-v1`. */
|
|
13745
|
+
scheme: string(),
|
|
13746
|
+
/** 16 hex — the backup key whose secret restores this archive. */
|
|
13747
|
+
keyId: string()
|
|
13748
|
+
});
|
|
13749
|
+
/**
|
|
13750
|
+
* The backup encryption setting. The hub keeps PUBLIC keys only: the active
|
|
13751
|
+
* one new archives are encrypted to, and the retired ones older archives
|
|
13752
|
+
* still need. The secret key is shown once, at `setupEncryption`.
|
|
13753
|
+
*/
|
|
13754
|
+
var BackupEncryptionStatusSchema = object({
|
|
13755
|
+
enabled: boolean(),
|
|
13756
|
+
active: object({
|
|
13757
|
+
keyId: string(),
|
|
13758
|
+
publicKey: string(),
|
|
13759
|
+
createdAt: number()
|
|
13760
|
+
}).nullable(),
|
|
13761
|
+
/** Every key ever set up, newest first. */
|
|
13762
|
+
keys: array(object({
|
|
13763
|
+
keyId: string(),
|
|
13764
|
+
createdAt: number(),
|
|
13765
|
+
retiredAt: number().nullable()
|
|
13766
|
+
})).readonly()
|
|
13767
|
+
});
|
|
13768
|
+
/**
|
|
13040
13769
|
* Per-archive entry returned by `backup.listArchives({ destinationId })`.
|
|
13041
13770
|
* Same shape the destination drill-in renders. Sourced from the per-
|
|
13042
13771
|
* location `manifests.json` (no per-archive tarball read required).
|
|
@@ -13048,7 +13777,9 @@ var BackupArchiveEntrySchema = object({
|
|
|
13048
13777
|
sizeBytes: number(),
|
|
13049
13778
|
label: string().optional(),
|
|
13050
13779
|
/** Top-level locations included in the archive (db, addons, tls, …). */
|
|
13051
|
-
locations: array(string()).readonly()
|
|
13780
|
+
locations: array(string()).readonly(),
|
|
13781
|
+
/** Present when the archive is encrypted; restore then needs that key. */
|
|
13782
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13052
13783
|
});
|
|
13053
13784
|
var BackupEntrySchema = object({
|
|
13054
13785
|
id: string(),
|
|
@@ -13057,7 +13788,8 @@ var BackupEntrySchema = object({
|
|
|
13057
13788
|
label: string().optional(),
|
|
13058
13789
|
createdAt: number(),
|
|
13059
13790
|
sizeBytes: number(),
|
|
13060
|
-
locations: array(string()).optional()
|
|
13791
|
+
locations: array(string()).optional(),
|
|
13792
|
+
encryption: BackupArchiveEncryptionSchema.optional()
|
|
13061
13793
|
});
|
|
13062
13794
|
var ArchiveEntrySchema = object({
|
|
13063
13795
|
path: string(),
|
|
@@ -13246,10 +13978,40 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
|
|
|
13246
13978
|
* this list and skips entries whose path doesn't start with
|
|
13247
13979
|
* any of them.
|
|
13248
13980
|
*/
|
|
13249
|
-
locations: array(string()).optional()
|
|
13981
|
+
locations: array(string()).optional(),
|
|
13982
|
+
/**
|
|
13983
|
+
* The backup SECRET key, for an encrypted archive (ignored for a plain
|
|
13984
|
+
* one). The archive is decrypted into the hub's private staging
|
|
13985
|
+
* before the restart; the key is not stored. A wrong or missing key
|
|
13986
|
+
* is refused before the archive is downloaded.
|
|
13987
|
+
*/
|
|
13988
|
+
backupSecretKey: string().optional()
|
|
13250
13989
|
}), _void(), {
|
|
13251
13990
|
kind: "mutation",
|
|
13252
13991
|
auth: "admin"
|
|
13992
|
+
}), method(_void(), BackupEncryptionStatusSchema, { auth: "admin" }), method(object({}), object({
|
|
13993
|
+
keyId: string(),
|
|
13994
|
+
secretKey: string(),
|
|
13995
|
+
publicKey: string(),
|
|
13996
|
+
createdAt: number(),
|
|
13997
|
+
replacedKeyId: string().nullable()
|
|
13998
|
+
}), {
|
|
13999
|
+
kind: "mutation",
|
|
14000
|
+
auth: "admin"
|
|
14001
|
+
}), method(object({}), object({ disabledKeyId: string().nullable() }), {
|
|
14002
|
+
kind: "mutation",
|
|
14003
|
+
auth: "admin"
|
|
14004
|
+
}), method(object({ backupSecretKey: string() }), object({
|
|
14005
|
+
valid: boolean(),
|
|
14006
|
+
keyId: string().nullable(),
|
|
14007
|
+
/** The hub knows this key (active or retired). */
|
|
14008
|
+
known: boolean(),
|
|
14009
|
+
/** It is the key new archives are encrypted to. */
|
|
14010
|
+
active: boolean(),
|
|
14011
|
+
error: string().optional()
|
|
14012
|
+
}), {
|
|
14013
|
+
kind: "mutation",
|
|
14014
|
+
auth: "admin"
|
|
13253
14015
|
}), method(object({
|
|
13254
14016
|
destinationId: string(),
|
|
13255
14017
|
backupId: string()
|
|
@@ -14873,22 +15635,87 @@ var CustomModelDescriptorSchema = object({
|
|
|
14873
15635
|
stepId: string(),
|
|
14874
15636
|
entry: ModelCatalogEntrySchema
|
|
14875
15637
|
});
|
|
15638
|
+
/** One regular file of an imported bundle, as the producer measured it. */
|
|
15639
|
+
var ModelBundleFileSchema = object({
|
|
15640
|
+
/** Relative path inside the bundle tar; an mlpackage member is `<x>.mlpackage/<member>`. */
|
|
15641
|
+
path: string().min(1),
|
|
15642
|
+
bytes: number().int().nonnegative(),
|
|
15643
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15644
|
+
});
|
|
15645
|
+
var ImportModelBundleInputSchema = object({
|
|
15646
|
+
/** The registry provider that keeps the model (Model Studio). */
|
|
15647
|
+
addonId: string(),
|
|
15648
|
+
stepId: string().min(1),
|
|
15649
|
+
/**
|
|
15650
|
+
* The catalog rows to register, complete, every format URL already
|
|
15651
|
+
* `camstack-local://<modelId>/<file>` naming a file of the bundle. One
|
|
15652
|
+
* bundle may carry several rows (a base and its INT8 variant).
|
|
15653
|
+
*/
|
|
15654
|
+
entries: array(ModelCatalogEntrySchema).min(1).max(4),
|
|
15655
|
+
/** The bundle tar, offered by the producer over `ctx.peerBytes` (same host). */
|
|
15656
|
+
bundle: object({
|
|
15657
|
+
ticket: PeerBytesTicketSchema,
|
|
15658
|
+
bytes: number().int().positive(),
|
|
15659
|
+
sha256: string().regex(/^[0-9a-f]{64}$/)
|
|
15660
|
+
}),
|
|
15661
|
+
/** Every file the tar must hold; anything missing, extra or different is refused. */
|
|
15662
|
+
files: array(ModelBundleFileSchema).min(1).max(64),
|
|
15663
|
+
/** Convert missing engine formats and push the model to every agent afterwards. */
|
|
15664
|
+
distribute: boolean()
|
|
15665
|
+
});
|
|
15666
|
+
var ImportModelBundleResultSchema = discriminatedUnion("kind", [object({
|
|
15667
|
+
kind: literal("imported"),
|
|
15668
|
+
modelIds: array(string()).readonly(),
|
|
15669
|
+
distributed: array(object({
|
|
15670
|
+
modelId: string(),
|
|
15671
|
+
nodeId: string(),
|
|
15672
|
+
format: _enum(MODEL_FORMATS),
|
|
15673
|
+
ok: boolean(),
|
|
15674
|
+
error: string().optional()
|
|
15675
|
+
})).readonly()
|
|
15676
|
+
}), object({
|
|
15677
|
+
kind: literal("refused"),
|
|
15678
|
+
reason: _enum([
|
|
15679
|
+
"transfer-failed",
|
|
15680
|
+
"checksum-mismatch",
|
|
15681
|
+
"bundle-mismatch",
|
|
15682
|
+
"invalid-entry",
|
|
15683
|
+
"id-taken"
|
|
15684
|
+
]),
|
|
15685
|
+
detail: string()
|
|
15686
|
+
})]);
|
|
14876
15687
|
var customModelRegistryCapability = {
|
|
14877
15688
|
name: "custom-model-registry",
|
|
14878
15689
|
scope: "system",
|
|
14879
15690
|
mode: "collection",
|
|
14880
15691
|
internal: true,
|
|
14881
|
-
methods: {
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14890
|
-
|
|
14891
|
-
listModels: method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" })
|
|
15692
|
+
methods: {
|
|
15693
|
+
/**
|
|
15694
|
+
* `internal: true` did not gate the mount (see the 2026-08-26 note on
|
|
15695
|
+
* `data-store-provider`) — this was reachable on the AppRouter by ANY
|
|
15696
|
+
* authenticated session at the default `auth: 'protected'`. The only
|
|
15697
|
+
* consumer, the detection-pipeline's model resolution
|
|
15698
|
+
* (`addon-pipeline/src/detection-pipeline/provider.ts`), calls
|
|
15699
|
+
* `ctx.api.customModelRegistry.listModels.query()` — UDS/Moleculer,
|
|
15700
|
+
* never tRPC — so `auth: 'admin'` costs it nothing.
|
|
15701
|
+
*/
|
|
15702
|
+
listModels: method(_void(), array(CustomModelDescriptorSchema).readonly(), { auth: "admin" }),
|
|
15703
|
+
/**
|
|
15704
|
+
* Register a model whose files arrive as ONE bundle tar (D806): the tar
|
|
15705
|
+
* is taken over `ctx.peerBytes`, checked against `bundle.sha256` and
|
|
15706
|
+
* every row of `files`, unpacked into the hub's flat modelsDir (directory
|
|
15707
|
+
* formats included), each format's `.revision` record written, the rows
|
|
15708
|
+
* upserted under the operator's name, the hub marked available and —
|
|
15709
|
+
* when asked — engine formats converted and the model distributed. A
|
|
15710
|
+
* model id already registered by another source is refused, never
|
|
15711
|
+
* overwritten.
|
|
15712
|
+
*/
|
|
15713
|
+
importModelBundle: method(ImportModelBundleInputSchema, ImportModelBundleResultSchema, {
|
|
15714
|
+
kind: "mutation",
|
|
15715
|
+
auth: "admin",
|
|
15716
|
+
timeoutMs: 30 * 6e4
|
|
15717
|
+
})
|
|
15718
|
+
}
|
|
14892
15719
|
};
|
|
14893
15720
|
/**
|
|
14894
15721
|
* Query filter for settings-store collections.
|
|
@@ -15368,6 +16195,35 @@ var KeychainKeySourceSchema = object({
|
|
|
15368
16195
|
*/
|
|
15369
16196
|
sharesBackupWithDatabase: boolean()
|
|
15370
16197
|
});
|
|
16198
|
+
/**
|
|
16199
|
+
* One keychain reset, as the Secrets page reports it until the operator
|
|
16200
|
+
* acknowledges it. Never a value: refs, counts and table names only.
|
|
16201
|
+
*/
|
|
16202
|
+
var KeychainResetRecordSchema = object({
|
|
16203
|
+
id: string(),
|
|
16204
|
+
at: number(),
|
|
16205
|
+
/** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
|
|
16206
|
+
actor: string(),
|
|
16207
|
+
/** Why the keychain was locked when it was reset; `null` when it was not locked. */
|
|
16208
|
+
lockedReason: string().nullable(),
|
|
16209
|
+
/** Values moved into the archive table (ciphertext under the lost key). */
|
|
16210
|
+
archived: number().int(),
|
|
16211
|
+
/** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
|
|
16212
|
+
archivedCollection: string().nullable(),
|
|
16213
|
+
/**
|
|
16214
|
+
* `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
|
|
16215
|
+
* so the archive can still be opened if the lost master key turns up.
|
|
16216
|
+
*/
|
|
16217
|
+
archivedKeysCollection: string().nullable(),
|
|
16218
|
+
/**
|
|
16219
|
+
* `system-settings` keys whose marker the reset cleared — the cluster
|
|
16220
|
+
* secret's: a marker left pointing at an archived value would refuse every
|
|
16221
|
+
* agent forever (D797).
|
|
16222
|
+
*/
|
|
16223
|
+
clearedSettingsKeys: array(string()).readonly(),
|
|
16224
|
+
/** When an operator dismissed the notice on the Secrets page; `null` until then. */
|
|
16225
|
+
acknowledgedAt: number().nullable()
|
|
16226
|
+
});
|
|
15371
16227
|
var KeychainStatusSchema = object({
|
|
15372
16228
|
keychain: KeychainStateSchema,
|
|
15373
16229
|
/** The source of the master key in use; `null` while locked. */
|
|
@@ -15385,7 +16241,9 @@ var KeychainStatusSchema = object({
|
|
|
15385
16241
|
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15386
16242
|
retiredWraps: number().int(),
|
|
15387
16243
|
recoveryKeyDownloadedAt: number().nullable(),
|
|
15388
|
-
secretCount: number().int()
|
|
16244
|
+
secretCount: number().int(),
|
|
16245
|
+
/** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
|
|
16246
|
+
lastReset: KeychainResetRecordSchema.nullable()
|
|
15389
16247
|
});
|
|
15390
16248
|
/**
|
|
15391
16249
|
* Whether a stored value is still pointed at by its owner's settings.
|
|
@@ -15407,13 +16265,14 @@ var KeychainAuditActionSchema = _enum([
|
|
|
15407
16265
|
"download-recovery-key",
|
|
15408
16266
|
"delete-orphans",
|
|
15409
16267
|
"reset",
|
|
16268
|
+
"acknowledge-reset",
|
|
15410
16269
|
"initialize"
|
|
15411
16270
|
]);
|
|
15412
16271
|
var KeychainAuditEntrySchema = object({
|
|
15413
16272
|
id: string(),
|
|
15414
16273
|
at: number(),
|
|
15415
16274
|
action: KeychainAuditActionSchema,
|
|
15416
|
-
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
16275
|
+
/** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
|
|
15417
16276
|
actor: string(),
|
|
15418
16277
|
ref: string().nullable(),
|
|
15419
16278
|
detail: string().nullable()
|
|
@@ -15479,6 +16338,13 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
15479
16338
|
kind: "mutation",
|
|
15480
16339
|
auth: "admin",
|
|
15481
16340
|
caller: "required"
|
|
16341
|
+
}), method(object({}), object({
|
|
16342
|
+
reset: KeychainResetRecordSchema.nullable(),
|
|
16343
|
+
pendingReentry: array(KeychainSecretMetaSchema).readonly()
|
|
16344
|
+
}), { auth: "admin" }), method(object({}), object({ acknowledged: boolean() }), {
|
|
16345
|
+
kind: "mutation",
|
|
16346
|
+
auth: "admin",
|
|
16347
|
+
caller: "required"
|
|
15482
16348
|
});
|
|
15483
16349
|
method(_void(), object({
|
|
15484
16350
|
id: string(),
|
|
@@ -18124,7 +18990,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18124
18990
|
* `login-method` — collection cap through which auth addons contribute
|
|
18125
18991
|
* their pre-auth login surfaces to the login page. This is the SINGLE,
|
|
18126
18992
|
* generic mechanism that supersedes the dead `auth.listProviders` reader:
|
|
18127
|
-
* every auth addon (OIDC,
|
|
18993
|
+
* every auth addon (OIDC, WebAuthn/passkey) registers a
|
|
18128
18994
|
* `login-method` provider and the PUBLIC `auth.listLoginMethods`
|
|
18129
18995
|
* procedure aggregates them for the unauthenticated login page.
|
|
18130
18996
|
*
|
|
@@ -18132,8 +18998,7 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18132
18998
|
*
|
|
18133
18999
|
* - `redirect` — a declarative button. The login page renders a generic
|
|
18134
19000
|
* button that navigates to `startUrl` (an addon-owned HTTP route).
|
|
18135
|
-
* Covers OIDC (`/addon/auth-oidc/<id>/start`)
|
|
18136
|
-
* ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
19001
|
+
* Covers OIDC (`/addon/auth-oidc/<id>/start`) with ZERO shell-side JS. A future SSO addon plugs in the same way — the
|
|
18137
19002
|
* login page needs NO change.
|
|
18138
19003
|
*
|
|
18139
19004
|
* - `widget` — a Module-Federation widget the login page mounts (via
|
|
@@ -18152,8 +19017,8 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
|
|
|
18152
19017
|
* decision.
|
|
18153
19018
|
*
|
|
18154
19019
|
* Every contribution carries a `stage`:
|
|
18155
|
-
* - `primary` — shown on the first credentials screen (OIDC
|
|
18156
|
-
*
|
|
19020
|
+
* - `primary` — shown on the first credentials screen (OIDC
|
|
19021
|
+
* buttons; a usernameless passkey).
|
|
18157
19022
|
* - `second-factor` — shown AFTER the password leg, gated on the
|
|
18158
19023
|
* returned `factors` (passkey-as-2FA today).
|
|
18159
19024
|
*
|
|
@@ -18180,7 +19045,7 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18180
19045
|
* The provider names an external identity a signed-in user can link to
|
|
18181
19046
|
* their own account (D782): `auth.listLinkableProviders` /
|
|
18182
19047
|
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18183
|
-
* whatever their id. Absent / false — a login button only
|
|
19048
|
+
* whatever their id. Absent / false — a login button only.
|
|
18184
19049
|
*/
|
|
18185
19050
|
linkable: boolean().optional()
|
|
18186
19051
|
}),
|
|
@@ -22003,8 +22868,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
22003
22868
|
* `super_admin` — collapsed onto the single boolean because every
|
|
22004
22869
|
* non-admin caller is governed by the same scope-check rules; the
|
|
22005
22870
|
* distinction was only ever used to route role-specific procedures
|
|
22006
|
-
* which we no longer have.
|
|
22007
|
-
* `createServiceToken`; CLI / webhook integrations are `cst_*` tokens
|
|
22871
|
+
* which we no longer have. CLI / webhook integrations are `cst_*` tokens
|
|
22008
22872
|
* with `isAdmin: false` + an explicit scope list.
|
|
22009
22873
|
*/
|
|
22010
22874
|
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
@@ -24699,6 +25563,17 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24699
25563
|
kind: "mutation",
|
|
24700
25564
|
auth: "admin",
|
|
24701
25565
|
timeoutMs: 60 * 6e4
|
|
25566
|
+
}), method(object({
|
|
25567
|
+
filter: RetrainExportFilterSchema,
|
|
25568
|
+
layout: RetrainExportLayoutSchema
|
|
25569
|
+
}), object({
|
|
25570
|
+
ticket: PeerBytesTicketSchema,
|
|
25571
|
+
frames: number().int(),
|
|
25572
|
+
annotations: number().int()
|
|
25573
|
+
}), {
|
|
25574
|
+
kind: "mutation",
|
|
25575
|
+
auth: "admin",
|
|
25576
|
+
timeoutMs: 12e4
|
|
24702
25577
|
}), method(object({
|
|
24703
25578
|
selection: RetrainDatasetSelectionSchema,
|
|
24704
25579
|
completeOnly: boolean().optional()
|
|
@@ -28267,8 +29142,8 @@ version: string().optional() }), ServerUpdateActionResultSchema, {
|
|
|
28267
29142
|
* `smtp-provider` — pluggable email delivery surface.
|
|
28268
29143
|
*
|
|
28269
29144
|
* Collection cap: a deployment may install multiple SMTP relays (e.g.
|
|
28270
|
-
* one for transactional / one for notifications). Consumers (
|
|
28271
|
-
*
|
|
29145
|
+
* one for transactional / one for notifications). Consumers (notifier
|
|
29146
|
+
* addons, …) walk the collection and pick the first
|
|
28272
29147
|
* ready provider OR target a specific addonId.
|
|
28273
29148
|
*
|
|
28274
29149
|
* The shape stays small on purpose — `sendEmail` is enough for the
|
|
@@ -28447,7 +29322,7 @@ targets: array(object({
|
|
|
28447
29322
|
})));
|
|
28448
29323
|
/**
|
|
28449
29324
|
* `sso-bridge` — internal hub-only cap that lets SSO-style auth
|
|
28450
|
-
* providers (OIDC, SAML,
|
|
29325
|
+
* providers (OIDC, SAML, …) mint an HMAC-signed token
|
|
28451
29326
|
* carrying the post-callback claims before redirecting back to
|
|
28452
29327
|
* `/api/auth/sso/finish`.
|
|
28453
29328
|
*
|
|
@@ -28510,7 +29385,14 @@ var SsoBridgeClaimsSchema = object({
|
|
|
28510
29385
|
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28511
29386
|
* subject is unique only per issuer, so a link is bound to it.
|
|
28512
29387
|
*/
|
|
28513
|
-
issuer: string().optional()
|
|
29388
|
+
issuer: string().optional(),
|
|
29389
|
+
/**
|
|
29390
|
+
* SHA-256 (hex) of the `camstack_sso_state` cookie the IdP `/start` set in
|
|
29391
|
+
* the browser that began this sign-in. `/api/auth/sso/finish` requires the
|
|
29392
|
+
* request to present the matching cookie — a login bridge is useless in
|
|
29393
|
+
* any other browser.
|
|
29394
|
+
*/
|
|
29395
|
+
browserBinding: string().optional()
|
|
28514
29396
|
});
|
|
28515
29397
|
method(object({
|
|
28516
29398
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -34402,7 +35284,13 @@ var TopologyNodeSchema = object({
|
|
|
34402
35284
|
})).readonly(),
|
|
34403
35285
|
processes: array(TopologyProcessSchema).readonly(),
|
|
34404
35286
|
categories: array(TopologyCategorySchema).readonly(),
|
|
34405
|
-
rootPackage: TopologyRootPackageSchema.nullable()
|
|
35287
|
+
rootPackage: TopologyRootPackageSchema.nullable(),
|
|
35288
|
+
/**
|
|
35289
|
+
* How an online AGENT reaches the hub (mesh mTLS Release A): `tls` once it has
|
|
35290
|
+
* completed a mutual-TLS handshake, `clear` otherwise. Absent for the hub,
|
|
35291
|
+
* for offline rows and when the hub cannot tell.
|
|
35292
|
+
*/
|
|
35293
|
+
meshTransport: _enum(["tls", "clear"]).optional()
|
|
34406
35294
|
});
|
|
34407
35295
|
var CapUsageEdgeSchema = object({
|
|
34408
35296
|
callerAddonId: string(),
|
|
@@ -38430,16 +39318,6 @@ var ApiKeySummarySchema = object({
|
|
|
38430
39318
|
createdAt: number(),
|
|
38431
39319
|
lastUsedAt: number().optional()
|
|
38432
39320
|
});
|
|
38433
|
-
var CreateApiKeyInputSchema = object({
|
|
38434
|
-
label: string(),
|
|
38435
|
-
isAdmin: boolean().default(false),
|
|
38436
|
-
allowedProviders: union([array(string()), literal("*")]).optional(),
|
|
38437
|
-
allowedDevices: record(string(), union([array(string()), literal("*")])).optional()
|
|
38438
|
-
});
|
|
38439
|
-
var CreateApiKeyResultSchema = object({
|
|
38440
|
-
token: string(),
|
|
38441
|
-
record: ApiKeySummarySchema
|
|
38442
|
-
});
|
|
38443
39321
|
var ScopedTokenSummarySchema = object({
|
|
38444
39322
|
id: string(),
|
|
38445
39323
|
userId: string(),
|
|
@@ -38538,17 +39416,10 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
38538
39416
|
}), UserSummarySchema.extend({ passwordHash: string() }).nullable(), {
|
|
38539
39417
|
kind: "mutation",
|
|
38540
39418
|
access: "view"
|
|
38541
|
-
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(
|
|
38542
|
-
kind: "mutation",
|
|
38543
|
-
auth: "admin",
|
|
38544
|
-
access: "create"
|
|
38545
|
-
}), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
39419
|
+
}), method(_void(), array(ApiKeySummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: literal(true) }), {
|
|
38546
39420
|
kind: "mutation",
|
|
38547
39421
|
auth: "admin",
|
|
38548
39422
|
access: "delete"
|
|
38549
|
-
}), method(object({ token: string() }), ApiKeySummarySchema.nullable(), {
|
|
38550
|
-
kind: "mutation",
|
|
38551
|
-
access: "view"
|
|
38552
39423
|
}), method(CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, {
|
|
38553
39424
|
kind: "mutation",
|
|
38554
39425
|
auth: "admin",
|
|
@@ -38622,15 +39493,7 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
38622
39493
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
38623
39494
|
userId: string(),
|
|
38624
39495
|
issuer: string()
|
|
38625
|
-
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
38626
|
-
userId: string(),
|
|
38627
|
-
issuer: string().min(1),
|
|
38628
|
-
label: string().optional()
|
|
38629
|
-
}), object({ success: literal(true) }), {
|
|
38630
|
-
kind: "mutation",
|
|
38631
|
-
auth: "admin",
|
|
38632
|
-
access: "create"
|
|
38633
|
-
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
39496
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
38634
39497
|
kind: "mutation",
|
|
38635
39498
|
auth: "admin",
|
|
38636
39499
|
access: "delete"
|
|
@@ -39025,6 +39888,451 @@ DeviceType.Camera, method(object({
|
|
|
39025
39888
|
detection: array(ZoneRuleSchema).readonly(),
|
|
39026
39889
|
package: array(ZoneRuleSchema).readonly()
|
|
39027
39890
|
});
|
|
39891
|
+
/**
|
|
39892
|
+
* `training-provider` — ONE cloud that can run the CamStack trainer.
|
|
39893
|
+
*
|
|
39894
|
+
* A thin, mockable translation layer: it knows how to run a container with a
|
|
39895
|
+
* GPU, move a dataset in, read the job's stdout and hand artefacts back. It
|
|
39896
|
+
* knows nothing about datasets, splits, floors, cost policy or Model Studio —
|
|
39897
|
+
* those are the `training` orchestrator's (D805). Every rule written there
|
|
39898
|
+
* once is what makes a second provider (RunPod, a local NVIDIA node) a new
|
|
39899
|
+
* manifest entry and nothing else.
|
|
39900
|
+
*
|
|
39901
|
+
* Collection, routed by the `addonId` in every single-row input (the `llm` /
|
|
39902
|
+
* `notification-output` posture); `describe` concat-fans across providers.
|
|
39903
|
+
* Every method is `admin`: these spend money.
|
|
39904
|
+
*
|
|
39905
|
+
* Every cloud object a provider creates is tagged with the orchestrator's
|
|
39906
|
+
* `jobKey`, so a retried submit finds the job it already started instead of
|
|
39907
|
+
* starting a second GPU, and `listJobs` can find orphans.
|
|
39908
|
+
*
|
|
39909
|
+
* Bytes never ride a cap field: the dataset arrives as a `ctx.peerBytes`
|
|
39910
|
+
* ticket the producer (pipeline-analytics) minted, and artefacts leave as a
|
|
39911
|
+
* ticket the provider mints (D613).
|
|
39912
|
+
*/
|
|
39913
|
+
var TrainingGpuOptionSchema = object({
|
|
39914
|
+
id: string(),
|
|
39915
|
+
label: string(),
|
|
39916
|
+
/** List price, USD per GPU-hour, before any region multiplier. */
|
|
39917
|
+
usdPerHour: number().nonnegative(),
|
|
39918
|
+
vramGb: number().nonnegative()
|
|
39919
|
+
});
|
|
39920
|
+
var TrainingRegionOptionSchema = object({
|
|
39921
|
+
/** `''` = any region (the provider's choice). */
|
|
39922
|
+
id: string(),
|
|
39923
|
+
label: string(),
|
|
39924
|
+
priceMultiplier: number().positive()
|
|
39925
|
+
});
|
|
39926
|
+
/**
|
|
39927
|
+
* The provider's per-account settings, as the orchestrator reads them. They
|
|
39928
|
+
* live in the PROVIDER addon's settings (operator decision 2026-10-08: they
|
|
39929
|
+
* depend on the user's account), never hard-coded in the orchestrator.
|
|
39930
|
+
*/
|
|
39931
|
+
var TrainingProviderDefaultsSchema = object({
|
|
39932
|
+
gpuType: string(),
|
|
39933
|
+
region: string(),
|
|
39934
|
+
costCapUsd: number().nonnegative(),
|
|
39935
|
+
maxRuntimeSec: number().int().positive(),
|
|
39936
|
+
/** Hours a FAILED job's cloud dataset is kept for debugging; 0 = delete at once. */
|
|
39937
|
+
failedDatasetGraceHours: number().nonnegative()
|
|
39938
|
+
});
|
|
39939
|
+
var TrainingProviderDescriptorSchema = object({
|
|
39940
|
+
addonId: string(),
|
|
39941
|
+
/** `modal`, `runpod`, `fake`, … */
|
|
39942
|
+
kind: string(),
|
|
39943
|
+
label: string(),
|
|
39944
|
+
gpuTypes: array(TrainingGpuOptionSchema).readonly(),
|
|
39945
|
+
regions: array(TrainingRegionOptionSchema).readonly(),
|
|
39946
|
+
maxDatasetBytes: number().int().positive(),
|
|
39947
|
+
maxRuntimeSec: number().int().positive(),
|
|
39948
|
+
freeTierNote: string().optional(),
|
|
39949
|
+
/** Where the data goes, in one sentence the confirm dialog repeats. */
|
|
39950
|
+
dataResidencyNote: string(),
|
|
39951
|
+
/** Credentials are present — never the values. */
|
|
39952
|
+
configured: boolean(),
|
|
39953
|
+
defaults: TrainingProviderDefaultsSchema
|
|
39954
|
+
});
|
|
39955
|
+
var TrainingCredentialCheckSchema = object({
|
|
39956
|
+
ok: boolean(),
|
|
39957
|
+
/** Workspace / account name, when the provider says. */
|
|
39958
|
+
account: string().optional(),
|
|
39959
|
+
reason: _enum([
|
|
39960
|
+
"missing",
|
|
39961
|
+
"invalid",
|
|
39962
|
+
"forbidden",
|
|
39963
|
+
"network",
|
|
39964
|
+
"quota"
|
|
39965
|
+
]).optional(),
|
|
39966
|
+
detail: string().optional()
|
|
39967
|
+
});
|
|
39968
|
+
var ProviderJobStateSchema = _enum([
|
|
39969
|
+
"pending",
|
|
39970
|
+
"starting",
|
|
39971
|
+
"running",
|
|
39972
|
+
"succeeded",
|
|
39973
|
+
"failed",
|
|
39974
|
+
"cancelled",
|
|
39975
|
+
"lost"
|
|
39976
|
+
]);
|
|
39977
|
+
var ProviderJobStatusSchema = object({
|
|
39978
|
+
jobKey: string(),
|
|
39979
|
+
providerJobId: string().optional(),
|
|
39980
|
+
state: ProviderJobStateSchema,
|
|
39981
|
+
startedAt: number().optional(),
|
|
39982
|
+
endedAt: number().optional(),
|
|
39983
|
+
exitCode: number().int().optional(),
|
|
39984
|
+
failureReason: string().optional(),
|
|
39985
|
+
gpuType: string(),
|
|
39986
|
+
region: string().optional(),
|
|
39987
|
+
billedSeconds: number().nonnegative(),
|
|
39988
|
+
costUsd: number().nonnegative(),
|
|
39989
|
+
/** True when `costUsd` is runtime × list price, not a billing answer. */
|
|
39990
|
+
costIsEstimate: boolean(),
|
|
39991
|
+
lastFetchedAt: number()
|
|
39992
|
+
});
|
|
39993
|
+
/**
|
|
39994
|
+
* The trainer the job runs, by SOURCE revision: the provider turns it into an
|
|
39995
|
+
* image its own way (Modal builds the published Dockerfile at that revision;
|
|
39996
|
+
* a registry-pull provider maps it to a tag). Recorded on the job and echoed
|
|
39997
|
+
* in `result.json`.
|
|
39998
|
+
*/
|
|
39999
|
+
var TrainerSourceRefSchema = object({
|
|
40000
|
+
/** Hugging Face repo id, e.g. `camstack/camstack-trainer`. */
|
|
40001
|
+
repo: string().min(1),
|
|
40002
|
+
/** A commit sha (never a branch) — the job must be reproducible. */
|
|
40003
|
+
revision: string().regex(/^[0-9a-f]{7,64}$/)
|
|
40004
|
+
});
|
|
40005
|
+
var JobRef = {
|
|
40006
|
+
addonId: string(),
|
|
40007
|
+
jobKey: string().uuid()
|
|
40008
|
+
};
|
|
40009
|
+
var TrainingLogLineSchema = object({
|
|
40010
|
+
ts: number(),
|
|
40011
|
+
text: string()
|
|
40012
|
+
});
|
|
40013
|
+
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({ addonId: string() }), TrainingCredentialCheckSchema, {
|
|
40014
|
+
kind: "mutation",
|
|
40015
|
+
auth: "admin",
|
|
40016
|
+
timeoutMs: 3e4
|
|
40017
|
+
}), method(object({
|
|
40018
|
+
addonId: string(),
|
|
40019
|
+
gpuType: string(),
|
|
40020
|
+
region: string(),
|
|
40021
|
+
datasetBytes: number().int().nonnegative(),
|
|
40022
|
+
gpuSecondsLow: number().nonnegative(),
|
|
40023
|
+
gpuSecondsHigh: number().nonnegative()
|
|
40024
|
+
}), object({
|
|
40025
|
+
usdLow: number().nonnegative(),
|
|
40026
|
+
usdHigh: number().nonnegative(),
|
|
40027
|
+
notes: array(string()).readonly()
|
|
40028
|
+
}), { auth: "admin" }), method(object({
|
|
40029
|
+
...JobRef,
|
|
40030
|
+
ticket: PeerBytesTicketSchema
|
|
40031
|
+
}), object({
|
|
40032
|
+
bytes: number().int().nonnegative(),
|
|
40033
|
+
sha256: string()
|
|
40034
|
+
}), {
|
|
40035
|
+
kind: "mutation",
|
|
40036
|
+
auth: "admin",
|
|
40037
|
+
timeoutMs: 120 * 6e4
|
|
40038
|
+
}), method(object({
|
|
40039
|
+
...JobRef,
|
|
40040
|
+
trainer: TrainerSourceRefSchema,
|
|
40041
|
+
jobSpecJson: string().min(2).max(64e3),
|
|
40042
|
+
gpuType: string(),
|
|
40043
|
+
region: string(),
|
|
40044
|
+
maxRuntimeSec: number().int().positive()
|
|
40045
|
+
}), ProviderJobStatusSchema, {
|
|
40046
|
+
kind: "mutation",
|
|
40047
|
+
auth: "admin",
|
|
40048
|
+
timeoutMs: 30 * 6e4
|
|
40049
|
+
}), method(object(JobRef), ProviderJobStatusSchema, {
|
|
40050
|
+
auth: "admin",
|
|
40051
|
+
timeoutMs: 6e4
|
|
40052
|
+
}), method(object({
|
|
40053
|
+
...JobRef,
|
|
40054
|
+
cursor: string().optional(),
|
|
40055
|
+
max: number().int().min(1).max(500)
|
|
40056
|
+
}), object({
|
|
40057
|
+
lines: array(TrainingLogLineSchema).readonly(),
|
|
40058
|
+
cursor: string()
|
|
40059
|
+
}), {
|
|
40060
|
+
auth: "admin",
|
|
40061
|
+
timeoutMs: 6e4
|
|
40062
|
+
}), method(object(JobRef), object({ ok: literal(true) }), {
|
|
40063
|
+
kind: "mutation",
|
|
40064
|
+
auth: "admin",
|
|
40065
|
+
timeoutMs: 6e4
|
|
40066
|
+
}), method(object(JobRef), object({
|
|
40067
|
+
found: boolean(),
|
|
40068
|
+
text: string().optional()
|
|
40069
|
+
}), {
|
|
40070
|
+
kind: "mutation",
|
|
40071
|
+
auth: "admin",
|
|
40072
|
+
timeoutMs: 5 * 6e4
|
|
40073
|
+
}), method(object({
|
|
40074
|
+
...JobRef,
|
|
40075
|
+
path: _enum(["bundle.tar"])
|
|
40076
|
+
}), object({ ticket: PeerBytesTicketSchema }), {
|
|
40077
|
+
kind: "mutation",
|
|
40078
|
+
auth: "admin",
|
|
40079
|
+
timeoutMs: 5 * 6e4
|
|
40080
|
+
}), method(object(JobRef), object({ deleted: array(string()).readonly() }), {
|
|
40081
|
+
kind: "mutation",
|
|
40082
|
+
auth: "admin",
|
|
40083
|
+
timeoutMs: 5 * 6e4
|
|
40084
|
+
}), method(object({ addonId: string() }), array(ProviderJobStatusSchema).readonly(), {
|
|
40085
|
+
auth: "admin",
|
|
40086
|
+
timeoutMs: 2 * 6e4
|
|
40087
|
+
});
|
|
40088
|
+
/**
|
|
40089
|
+
* `training` — the cloud-training orchestrator (D805). Hub-only singleton,
|
|
40090
|
+
* provided by `addon-training`.
|
|
40091
|
+
*
|
|
40092
|
+
* It owns what every provider must agree on, written once:
|
|
40093
|
+
*
|
|
40094
|
+
* - **Dataset versions.** Taken over from pipeline-analytics (D796): the rows
|
|
40095
|
+
* live here (D808); pipeline-analytics still CUTS a version (it owns the corpus and
|
|
40096
|
+
* the export plan) and reaches this store through the five row methods
|
|
40097
|
+
* below, so the Retrain page and the export did not change.
|
|
40098
|
+
* - **Jobs.** A persisted state machine, a reconcile loop against the
|
|
40099
|
+
* provider, a cost guard, a daily orphan sweep and the retention rules.
|
|
40100
|
+
* - **The return flow.** Verified artefacts → Model Studio
|
|
40101
|
+
* (`custom-model-registry.importModelBundle`) → canary on cameras →
|
|
40102
|
+
* rollback. Nothing is ever registered automatically.
|
|
40103
|
+
*
|
|
40104
|
+
* Every method is `admin`.
|
|
40105
|
+
*/
|
|
40106
|
+
/** A version WITH its frame list — what the export and a job read. */
|
|
40107
|
+
var TrainingDatasetVersionRowSchema = RetrainDatasetVersionSchema.omit({ frameCount: true }).extend({ frameIds: array(string()).max(2e4).readonly() });
|
|
40108
|
+
/** A base model a detector job can fine-tune, and the baseline it is judged against. */
|
|
40109
|
+
var TrainingBaseModelSchema = object({
|
|
40110
|
+
modelId: string(),
|
|
40111
|
+
label: string(),
|
|
40112
|
+
weights: string(),
|
|
40113
|
+
imgsz: number().int(),
|
|
40114
|
+
baselineOnnxUrl: string(),
|
|
40115
|
+
baselineFloors: record(string(), number()),
|
|
40116
|
+
/** The base the fleet runs most — the UI's default. */
|
|
40117
|
+
recommended: boolean()
|
|
40118
|
+
});
|
|
40119
|
+
var TrainingPresetSchema = _enum([
|
|
40120
|
+
"quick",
|
|
40121
|
+
"standard",
|
|
40122
|
+
"thorough"
|
|
40123
|
+
]);
|
|
40124
|
+
var TrainingJobRequestSchema = object({
|
|
40125
|
+
datasetVersionId: string().min(1),
|
|
40126
|
+
/** The `training-provider` addon that runs it. */
|
|
40127
|
+
addonId: string().min(1),
|
|
40128
|
+
gpuType: string().min(1),
|
|
40129
|
+
region: string(),
|
|
40130
|
+
baseModelId: string().min(1),
|
|
40131
|
+
preset: TrainingPresetSchema,
|
|
40132
|
+
/** Freeze the backbone's first N layers; `null` = the preset's choice. */
|
|
40133
|
+
freeze: number().int().nonnegative().nullable(),
|
|
40134
|
+
/** Cameras held out whole for evaluation; `null` = the orchestrator's default. */
|
|
40135
|
+
holdoutCameras: array(number().int()).nullable()
|
|
40136
|
+
});
|
|
40137
|
+
var TrainingSplitPlanSchema = object({
|
|
40138
|
+
holdoutCameras: array(number().int()).readonly(),
|
|
40139
|
+
/** Used when no camera is held out: the last N days of every camera. */
|
|
40140
|
+
holdoutLastDays: number().int().nonnegative(),
|
|
40141
|
+
/** Holdout subjects per class (camera holdout only; `null` = known only after the split). */
|
|
40142
|
+
holdoutSupport: record(string(), number().int()).nullable(),
|
|
40143
|
+
trainSubjects: number().int()
|
|
40144
|
+
});
|
|
40145
|
+
var TrainingRefusalReasonSchema = _enum([
|
|
40146
|
+
"unknown-dataset",
|
|
40147
|
+
"unknown-provider",
|
|
40148
|
+
"provider-not-configured",
|
|
40149
|
+
"unknown-base-model",
|
|
40150
|
+
"unknown-gpu",
|
|
40151
|
+
"dataset-too-large",
|
|
40152
|
+
"no-training-subjects",
|
|
40153
|
+
"job-already-running"
|
|
40154
|
+
]);
|
|
40155
|
+
var TrainingJobPlanSchema = object({
|
|
40156
|
+
refusal: object({
|
|
40157
|
+
reason: TrainingRefusalReasonSchema,
|
|
40158
|
+
detail: string()
|
|
40159
|
+
}).nullable(),
|
|
40160
|
+
warnings: array(string()).readonly(),
|
|
40161
|
+
split: TrainingSplitPlanSchema.nullable(),
|
|
40162
|
+
estimate: object({
|
|
40163
|
+
datasetBytes: number().int(),
|
|
40164
|
+
uploadMinutesAt20Mbps: number(),
|
|
40165
|
+
gpuSecondsLow: number(),
|
|
40166
|
+
gpuSecondsHigh: number(),
|
|
40167
|
+
usdLow: number(),
|
|
40168
|
+
usdHigh: number(),
|
|
40169
|
+
notes: array(string()).readonly()
|
|
40170
|
+
}).nullable(),
|
|
40171
|
+
/** Pre-filled from the provider's settings; the operator may lower or raise them. */
|
|
40172
|
+
defaults: object({
|
|
40173
|
+
maxCostUsd: number(),
|
|
40174
|
+
maxRuntimeSec: number().int()
|
|
40175
|
+
}).nullable(),
|
|
40176
|
+
/** The sentence the confirm dialog repeats: where the frames go and when they are deleted. */
|
|
40177
|
+
dataNotice: string()
|
|
40178
|
+
});
|
|
40179
|
+
/**
|
|
40180
|
+
* Orchestrator-owned states, persisted. `uploading` covers exporting the
|
|
40181
|
+
* archive (it is streamed, never staged). Terminal: `failed`, `cancelled`,
|
|
40182
|
+
* `lost`, `expired`, `discarded`. `registered` and `canary` are where a
|
|
40183
|
+
* result lives after the operator acted on it.
|
|
40184
|
+
*/
|
|
40185
|
+
var TrainingJobStateSchema = _enum([
|
|
40186
|
+
"uploading",
|
|
40187
|
+
"submitted",
|
|
40188
|
+
"starting",
|
|
40189
|
+
"running",
|
|
40190
|
+
"collecting",
|
|
40191
|
+
"ready",
|
|
40192
|
+
"registered",
|
|
40193
|
+
"canary",
|
|
40194
|
+
"failed",
|
|
40195
|
+
"cancelling",
|
|
40196
|
+
"cancelled",
|
|
40197
|
+
"lost",
|
|
40198
|
+
"expired",
|
|
40199
|
+
"discarded"
|
|
40200
|
+
]);
|
|
40201
|
+
var TrainingFailureReasonSchema = _enum([
|
|
40202
|
+
"cost-cap",
|
|
40203
|
+
"runtime-cap",
|
|
40204
|
+
"upload-failed",
|
|
40205
|
+
"submit-failed",
|
|
40206
|
+
"trainer-failed",
|
|
40207
|
+
"result-invalid",
|
|
40208
|
+
"checksum-mismatch",
|
|
40209
|
+
"fetch-failed",
|
|
40210
|
+
"provider-error",
|
|
40211
|
+
"hub-restart-during-upload"
|
|
40212
|
+
]);
|
|
40213
|
+
var TrainingProgressPointSchema = object({
|
|
40214
|
+
epoch: number().int(),
|
|
40215
|
+
map50: number().nullable(),
|
|
40216
|
+
map50_95: number().nullable()
|
|
40217
|
+
});
|
|
40218
|
+
var TrainingCanarySchema = object({
|
|
40219
|
+
deviceIds: array(number().int()).readonly(),
|
|
40220
|
+
since: number(),
|
|
40221
|
+
/** Every override the canary replaced, exactly, so rollback restores it. */
|
|
40222
|
+
previous: array(object({
|
|
40223
|
+
deviceId: number().int(),
|
|
40224
|
+
nodeId: string(),
|
|
40225
|
+
deviceKey: string(),
|
|
40226
|
+
patch: object({
|
|
40227
|
+
modelId: string().optional(),
|
|
40228
|
+
settings: record(string(), unknown()).readonly().optional()
|
|
40229
|
+
}).nullable()
|
|
40230
|
+
})).readonly()
|
|
40231
|
+
});
|
|
40232
|
+
var TrainingJobSchema = object({
|
|
40233
|
+
id: string(),
|
|
40234
|
+
idempotencyKey: string(),
|
|
40235
|
+
name: string(),
|
|
40236
|
+
createdAt: number(),
|
|
40237
|
+
updatedAt: number(),
|
|
40238
|
+
state: TrainingJobStateSchema,
|
|
40239
|
+
stage: TrainingStageSchema.nullable(),
|
|
40240
|
+
failure: object({
|
|
40241
|
+
reason: TrainingFailureReasonSchema,
|
|
40242
|
+
stage: string().nullable(),
|
|
40243
|
+
detail: string()
|
|
40244
|
+
}).nullable(),
|
|
40245
|
+
request: TrainingJobRequestSchema,
|
|
40246
|
+
maxCostUsd: number().nonnegative(),
|
|
40247
|
+
maxRuntimeSec: number().int().positive(),
|
|
40248
|
+
trainer: TrainerSourceRefSchema,
|
|
40249
|
+
datasetLayout: RetrainExportLayoutSchema,
|
|
40250
|
+
dataset: object({
|
|
40251
|
+
bytes: number().int(),
|
|
40252
|
+
sha256: string(),
|
|
40253
|
+
uploadedAt: number()
|
|
40254
|
+
}).nullable(),
|
|
40255
|
+
split: TrainingSplitPlanSchema,
|
|
40256
|
+
provider: object({
|
|
40257
|
+
state: ProviderJobStateSchema.nullable(),
|
|
40258
|
+
providerJobId: string().nullable(),
|
|
40259
|
+
startedAt: number().nullable(),
|
|
40260
|
+
endedAt: number().nullable(),
|
|
40261
|
+
billedSeconds: number(),
|
|
40262
|
+
costUsd: number(),
|
|
40263
|
+
costIsEstimate: boolean(),
|
|
40264
|
+
lastPolledAt: number().nullable()
|
|
40265
|
+
}),
|
|
40266
|
+
progress: object({
|
|
40267
|
+
epoch: number().int().nullable(),
|
|
40268
|
+
epochs: number().int().nullable(),
|
|
40269
|
+
etaSec: number().nullable(),
|
|
40270
|
+
series: array(TrainingProgressPointSchema).readonly()
|
|
40271
|
+
}),
|
|
40272
|
+
/** The last lines of the job's output (≤ 200), newest last. Never frame paths. */
|
|
40273
|
+
logTail: array(string()).readonly(),
|
|
40274
|
+
logCursor: string().nullable(),
|
|
40275
|
+
artifacts: object({
|
|
40276
|
+
bundleBytes: number().int(),
|
|
40277
|
+
bundleSha256: string(),
|
|
40278
|
+
fetchedAt: number(),
|
|
40279
|
+
/** When the staged artefacts are deleted from the hub. */
|
|
40280
|
+
expiresAt: number()
|
|
40281
|
+
}).nullable(),
|
|
40282
|
+
/** When the provider-side copy of the frames was deleted; null while it exists. */
|
|
40283
|
+
cloudDatasetDeletedAt: number().nullable(),
|
|
40284
|
+
/** A failed job's dataset is kept until then (the provider's grace), then deleted. */
|
|
40285
|
+
cloudCleanupDueAt: number().nullable(),
|
|
40286
|
+
/** Model ids registered from this job (base, and int8 when kept). */
|
|
40287
|
+
registeredModelIds: array(string()).readonly(),
|
|
40288
|
+
canary: TrainingCanarySchema.nullable()
|
|
40289
|
+
});
|
|
40290
|
+
var IdInput = object({ id: string().min(1) });
|
|
40291
|
+
method(TrainingDatasetVersionRowSchema, object({ stored: boolean() }), {
|
|
40292
|
+
kind: "mutation",
|
|
40293
|
+
auth: "admin"
|
|
40294
|
+
}), method(IdInput, TrainingDatasetVersionRowSchema.nullable(), { auth: "admin" }), method(object({}), array(RetrainDatasetVersionSchema).readonly(), { auth: "admin" }), method(object({ name: string() }), object({ id: string().nullable() }), { auth: "admin" }), method(IdInput, object({ removed: boolean() }), {
|
|
40295
|
+
kind: "mutation",
|
|
40296
|
+
auth: "admin"
|
|
40297
|
+
}), method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" }), method(TrainingJobRequestSchema, TrainingJobPlanSchema, {
|
|
40298
|
+
auth: "admin",
|
|
40299
|
+
timeoutMs: 6e4
|
|
40300
|
+
}), method(TrainingJobRequestSchema.extend({
|
|
40301
|
+
name: string().min(1).max(120),
|
|
40302
|
+
maxCostUsd: number().positive(),
|
|
40303
|
+
maxRuntimeSec: number().int().positive(),
|
|
40304
|
+
idempotencyKey: string().min(8).max(80)
|
|
40305
|
+
}), discriminatedUnion("kind", [object({
|
|
40306
|
+
kind: literal("started"),
|
|
40307
|
+
job: TrainingJobSchema
|
|
40308
|
+
}), object({
|
|
40309
|
+
kind: literal("refused"),
|
|
40310
|
+
reason: TrainingRefusalReasonSchema,
|
|
40311
|
+
detail: string()
|
|
40312
|
+
})]), {
|
|
40313
|
+
kind: "mutation",
|
|
40314
|
+
auth: "admin",
|
|
40315
|
+
timeoutMs: 12e4
|
|
40316
|
+
}), method(object({}), array(TrainingJobSchema).readonly(), { auth: "admin" }), method(IdInput, TrainingJobSchema.nullable(), { auth: "admin" }), method(IdInput, TrainingJobSchema, {
|
|
40317
|
+
kind: "mutation",
|
|
40318
|
+
auth: "admin",
|
|
40319
|
+
timeoutMs: 12e4
|
|
40320
|
+
}), method(IdInput, TrainingResultSchema.nullable(), { auth: "admin" }), method(IdInput.extend({ canaryDeviceIds: array(number().int()).readonly() }), TrainingJobSchema, {
|
|
40321
|
+
kind: "mutation",
|
|
40322
|
+
auth: "admin",
|
|
40323
|
+
timeoutMs: 30 * 6e4
|
|
40324
|
+
}), method(IdInput.extend({ deviceIds: array(number().int()).min(1).readonly() }), TrainingJobSchema, {
|
|
40325
|
+
kind: "mutation",
|
|
40326
|
+
auth: "admin",
|
|
40327
|
+
timeoutMs: 12e4
|
|
40328
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
40329
|
+
kind: "mutation",
|
|
40330
|
+
auth: "admin",
|
|
40331
|
+
timeoutMs: 12e4
|
|
40332
|
+
}), method(IdInput, TrainingJobSchema, {
|
|
40333
|
+
kind: "mutation",
|
|
40334
|
+
auth: "admin"
|
|
40335
|
+
});
|
|
39028
40336
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
39029
40337
|
function isClassMapMacroTarget(value) {
|
|
39030
40338
|
return CLASS_MAP_MACRO_TARGETS.some((target) => target === value);
|
|
@@ -39746,6 +41054,12 @@ Object.freeze({
|
|
|
39746
41054
|
addonId: null,
|
|
39747
41055
|
access: "create"
|
|
39748
41056
|
},
|
|
41057
|
+
"backup.checkBackupKey": {
|
|
41058
|
+
capName: "backup",
|
|
41059
|
+
capScope: "system",
|
|
41060
|
+
addonId: null,
|
|
41061
|
+
access: "create"
|
|
41062
|
+
},
|
|
39749
41063
|
"backup.delete": {
|
|
39750
41064
|
capName: "backup",
|
|
39751
41065
|
capScope: "system",
|
|
@@ -39758,6 +41072,18 @@ Object.freeze({
|
|
|
39758
41072
|
addonId: null,
|
|
39759
41073
|
access: "delete"
|
|
39760
41074
|
},
|
|
41075
|
+
"backup.disableEncryption": {
|
|
41076
|
+
capName: "backup",
|
|
41077
|
+
capScope: "system",
|
|
41078
|
+
addonId: null,
|
|
41079
|
+
access: "create"
|
|
41080
|
+
},
|
|
41081
|
+
"backup.getEncryption": {
|
|
41082
|
+
capName: "backup",
|
|
41083
|
+
capScope: "system",
|
|
41084
|
+
addonId: null,
|
|
41085
|
+
access: "view"
|
|
41086
|
+
},
|
|
39761
41087
|
"backup.getEntries": {
|
|
39762
41088
|
capName: "backup",
|
|
39763
41089
|
capScope: "system",
|
|
@@ -39812,6 +41138,12 @@ Object.freeze({
|
|
|
39812
41138
|
addonId: null,
|
|
39813
41139
|
access: "create"
|
|
39814
41140
|
},
|
|
41141
|
+
"backup.setupEncryption": {
|
|
41142
|
+
capName: "backup",
|
|
41143
|
+
capScope: "system",
|
|
41144
|
+
addonId: null,
|
|
41145
|
+
access: "create"
|
|
41146
|
+
},
|
|
39815
41147
|
"backup.trigger": {
|
|
39816
41148
|
capName: "backup",
|
|
39817
41149
|
capScope: "system",
|
|
@@ -40364,6 +41696,12 @@ Object.freeze({
|
|
|
40364
41696
|
addonId: null,
|
|
40365
41697
|
access: "create"
|
|
40366
41698
|
},
|
|
41699
|
+
"customModelRegistry.importModelBundle": {
|
|
41700
|
+
capName: "custom-model-registry",
|
|
41701
|
+
capScope: "system",
|
|
41702
|
+
addonId: null,
|
|
41703
|
+
access: "create"
|
|
41704
|
+
},
|
|
40367
41705
|
"customModelRegistry.listModels": {
|
|
40368
41706
|
capName: "custom-model-registry",
|
|
40369
41707
|
capScope: "system",
|
|
@@ -41804,6 +43142,12 @@ Object.freeze({
|
|
|
41804
43142
|
addonId: null,
|
|
41805
43143
|
access: "view"
|
|
41806
43144
|
},
|
|
43145
|
+
"keychainAdmin.acknowledgeReset": {
|
|
43146
|
+
capName: "keychain-admin",
|
|
43147
|
+
capScope: "system",
|
|
43148
|
+
addonId: null,
|
|
43149
|
+
access: "create"
|
|
43150
|
+
},
|
|
41807
43151
|
"keychainAdmin.deleteOrphans": {
|
|
41808
43152
|
capName: "keychain-admin",
|
|
41809
43153
|
capScope: "system",
|
|
@@ -41840,6 +43184,12 @@ Object.freeze({
|
|
|
41840
43184
|
addonId: null,
|
|
41841
43185
|
access: "delete"
|
|
41842
43186
|
},
|
|
43187
|
+
"keychainAdmin.resetReport": {
|
|
43188
|
+
capName: "keychain-admin",
|
|
43189
|
+
capScope: "system",
|
|
43190
|
+
addonId: null,
|
|
43191
|
+
access: "delete"
|
|
43192
|
+
},
|
|
41843
43193
|
"keychainAdmin.reveal": {
|
|
41844
43194
|
capName: "keychain-admin",
|
|
41845
43195
|
capScope: "system",
|
|
@@ -43586,6 +44936,12 @@ Object.freeze({
|
|
|
43586
44936
|
addonId: null,
|
|
43587
44937
|
access: "view"
|
|
43588
44938
|
},
|
|
44939
|
+
"pipelineAnalytics.offerRetrainArchive": {
|
|
44940
|
+
capName: "pipeline-analytics",
|
|
44941
|
+
capScope: "device",
|
|
44942
|
+
addonId: null,
|
|
44943
|
+
access: "create"
|
|
44944
|
+
},
|
|
43589
44945
|
"pipelineAnalytics.ownersWithMedia": {
|
|
43590
44946
|
capName: "pipeline-analytics",
|
|
43591
44947
|
capScope: "device",
|
|
@@ -46124,6 +47480,174 @@ Object.freeze({
|
|
|
46124
47480
|
addonId: null,
|
|
46125
47481
|
access: "view"
|
|
46126
47482
|
},
|
|
47483
|
+
"training.canaryResult": {
|
|
47484
|
+
capName: "training",
|
|
47485
|
+
capScope: "system",
|
|
47486
|
+
addonId: null,
|
|
47487
|
+
access: "create"
|
|
47488
|
+
},
|
|
47489
|
+
"training.cancelJob": {
|
|
47490
|
+
capName: "training",
|
|
47491
|
+
capScope: "system",
|
|
47492
|
+
addonId: null,
|
|
47493
|
+
access: "create"
|
|
47494
|
+
},
|
|
47495
|
+
"training.discardResult": {
|
|
47496
|
+
capName: "training",
|
|
47497
|
+
capScope: "system",
|
|
47498
|
+
addonId: null,
|
|
47499
|
+
access: "create"
|
|
47500
|
+
},
|
|
47501
|
+
"training.findDatasetVersionIdByName": {
|
|
47502
|
+
capName: "training",
|
|
47503
|
+
capScope: "system",
|
|
47504
|
+
addonId: null,
|
|
47505
|
+
access: "view"
|
|
47506
|
+
},
|
|
47507
|
+
"training.getDatasetVersion": {
|
|
47508
|
+
capName: "training",
|
|
47509
|
+
capScope: "system",
|
|
47510
|
+
addonId: null,
|
|
47511
|
+
access: "view"
|
|
47512
|
+
},
|
|
47513
|
+
"training.getJob": {
|
|
47514
|
+
capName: "training",
|
|
47515
|
+
capScope: "system",
|
|
47516
|
+
addonId: null,
|
|
47517
|
+
access: "view"
|
|
47518
|
+
},
|
|
47519
|
+
"training.getJobResult": {
|
|
47520
|
+
capName: "training",
|
|
47521
|
+
capScope: "system",
|
|
47522
|
+
addonId: null,
|
|
47523
|
+
access: "view"
|
|
47524
|
+
},
|
|
47525
|
+
"training.listBaseModels": {
|
|
47526
|
+
capName: "training",
|
|
47527
|
+
capScope: "system",
|
|
47528
|
+
addonId: null,
|
|
47529
|
+
access: "view"
|
|
47530
|
+
},
|
|
47531
|
+
"training.listDatasetVersions": {
|
|
47532
|
+
capName: "training",
|
|
47533
|
+
capScope: "system",
|
|
47534
|
+
addonId: null,
|
|
47535
|
+
access: "view"
|
|
47536
|
+
},
|
|
47537
|
+
"training.listJobs": {
|
|
47538
|
+
capName: "training",
|
|
47539
|
+
capScope: "system",
|
|
47540
|
+
addonId: null,
|
|
47541
|
+
access: "view"
|
|
47542
|
+
},
|
|
47543
|
+
"training.planJob": {
|
|
47544
|
+
capName: "training",
|
|
47545
|
+
capScope: "system",
|
|
47546
|
+
addonId: null,
|
|
47547
|
+
access: "view"
|
|
47548
|
+
},
|
|
47549
|
+
"training.putDatasetVersion": {
|
|
47550
|
+
capName: "training",
|
|
47551
|
+
capScope: "system",
|
|
47552
|
+
addonId: null,
|
|
47553
|
+
access: "create"
|
|
47554
|
+
},
|
|
47555
|
+
"training.registerResult": {
|
|
47556
|
+
capName: "training",
|
|
47557
|
+
capScope: "system",
|
|
47558
|
+
addonId: null,
|
|
47559
|
+
access: "create"
|
|
47560
|
+
},
|
|
47561
|
+
"training.removeDatasetVersion": {
|
|
47562
|
+
capName: "training",
|
|
47563
|
+
capScope: "system",
|
|
47564
|
+
addonId: null,
|
|
47565
|
+
access: "delete"
|
|
47566
|
+
},
|
|
47567
|
+
"training.rollbackCanary": {
|
|
47568
|
+
capName: "training",
|
|
47569
|
+
capScope: "system",
|
|
47570
|
+
addonId: null,
|
|
47571
|
+
access: "create"
|
|
47572
|
+
},
|
|
47573
|
+
"training.startJob": {
|
|
47574
|
+
capName: "training",
|
|
47575
|
+
capScope: "system",
|
|
47576
|
+
addonId: null,
|
|
47577
|
+
access: "create"
|
|
47578
|
+
},
|
|
47579
|
+
"trainingProvider.cancelJob": {
|
|
47580
|
+
capName: "training-provider",
|
|
47581
|
+
capScope: "system",
|
|
47582
|
+
addonId: null,
|
|
47583
|
+
access: "create"
|
|
47584
|
+
},
|
|
47585
|
+
"trainingProvider.cleanupJob": {
|
|
47586
|
+
capName: "training-provider",
|
|
47587
|
+
capScope: "system",
|
|
47588
|
+
addonId: null,
|
|
47589
|
+
access: "create"
|
|
47590
|
+
},
|
|
47591
|
+
"trainingProvider.describe": {
|
|
47592
|
+
capName: "training-provider",
|
|
47593
|
+
capScope: "system",
|
|
47594
|
+
addonId: null,
|
|
47595
|
+
access: "view"
|
|
47596
|
+
},
|
|
47597
|
+
"trainingProvider.estimateJob": {
|
|
47598
|
+
capName: "training-provider",
|
|
47599
|
+
capScope: "system",
|
|
47600
|
+
addonId: null,
|
|
47601
|
+
access: "view"
|
|
47602
|
+
},
|
|
47603
|
+
"trainingProvider.getJob": {
|
|
47604
|
+
capName: "training-provider",
|
|
47605
|
+
capScope: "system",
|
|
47606
|
+
addonId: null,
|
|
47607
|
+
access: "view"
|
|
47608
|
+
},
|
|
47609
|
+
"trainingProvider.listJobEvents": {
|
|
47610
|
+
capName: "training-provider",
|
|
47611
|
+
capScope: "system",
|
|
47612
|
+
addonId: null,
|
|
47613
|
+
access: "view"
|
|
47614
|
+
},
|
|
47615
|
+
"trainingProvider.listJobs": {
|
|
47616
|
+
capName: "training-provider",
|
|
47617
|
+
capScope: "system",
|
|
47618
|
+
addonId: null,
|
|
47619
|
+
access: "view"
|
|
47620
|
+
},
|
|
47621
|
+
"trainingProvider.offerArtifact": {
|
|
47622
|
+
capName: "training-provider",
|
|
47623
|
+
capScope: "system",
|
|
47624
|
+
addonId: null,
|
|
47625
|
+
access: "create"
|
|
47626
|
+
},
|
|
47627
|
+
"trainingProvider.readResult": {
|
|
47628
|
+
capName: "training-provider",
|
|
47629
|
+
capScope: "system",
|
|
47630
|
+
addonId: null,
|
|
47631
|
+
access: "create"
|
|
47632
|
+
},
|
|
47633
|
+
"trainingProvider.submitJob": {
|
|
47634
|
+
capName: "training-provider",
|
|
47635
|
+
capScope: "system",
|
|
47636
|
+
addonId: null,
|
|
47637
|
+
access: "create"
|
|
47638
|
+
},
|
|
47639
|
+
"trainingProvider.uploadDataset": {
|
|
47640
|
+
capName: "training-provider",
|
|
47641
|
+
capScope: "system",
|
|
47642
|
+
addonId: null,
|
|
47643
|
+
access: "create"
|
|
47644
|
+
},
|
|
47645
|
+
"trainingProvider.validateCredentials": {
|
|
47646
|
+
capName: "training-provider",
|
|
47647
|
+
capScope: "system",
|
|
47648
|
+
addonId: null,
|
|
47649
|
+
access: "create"
|
|
47650
|
+
},
|
|
46127
47651
|
"turnProvider.getTurnServers": {
|
|
46128
47652
|
capName: "turn-provider",
|
|
46129
47653
|
capScope: "system",
|
|
@@ -46148,12 +47672,6 @@ Object.freeze({
|
|
|
46148
47672
|
addonId: null,
|
|
46149
47673
|
access: "create"
|
|
46150
47674
|
},
|
|
46151
|
-
"userManagement.createApiKey": {
|
|
46152
|
-
capName: "user-management",
|
|
46153
|
-
capScope: "system",
|
|
46154
|
-
addonId: null,
|
|
46155
|
-
access: "create"
|
|
46156
|
-
},
|
|
46157
47675
|
"userManagement.createScopedToken": {
|
|
46158
47676
|
capName: "user-management",
|
|
46159
47677
|
capScope: "system",
|
|
@@ -46190,12 +47708,6 @@ Object.freeze({
|
|
|
46190
47708
|
addonId: null,
|
|
46191
47709
|
access: "view"
|
|
46192
47710
|
},
|
|
46193
|
-
"userManagement.linkExternalIdentity": {
|
|
46194
|
-
capName: "user-management",
|
|
46195
|
-
capScope: "system",
|
|
46196
|
-
addonId: null,
|
|
46197
|
-
access: "create"
|
|
46198
|
-
},
|
|
46199
47711
|
"userManagement.listApiKeys": {
|
|
46200
47712
|
capName: "user-management",
|
|
46201
47713
|
capScope: "system",
|
|
@@ -46298,12 +47810,6 @@ Object.freeze({
|
|
|
46298
47810
|
addonId: null,
|
|
46299
47811
|
access: "create"
|
|
46300
47812
|
},
|
|
46301
|
-
"userManagement.validateApiKey": {
|
|
46302
|
-
capName: "user-management",
|
|
46303
|
-
capScope: "system",
|
|
46304
|
-
addonId: null,
|
|
46305
|
-
access: "view"
|
|
46306
|
-
},
|
|
46307
47813
|
"userManagement.validateCredentials": {
|
|
46308
47814
|
capName: "user-management",
|
|
46309
47815
|
capScope: "system",
|
|
@@ -50417,6 +51923,11 @@ Object.freeze({
|
|
|
50417
51923
|
form: "single",
|
|
50418
51924
|
optional: false
|
|
50419
51925
|
}],
|
|
51926
|
+
"training.canaryResult": [{
|
|
51927
|
+
name: "deviceIds",
|
|
51928
|
+
form: "array",
|
|
51929
|
+
optional: false
|
|
51930
|
+
}],
|
|
50420
51931
|
"update.getStatus": [{
|
|
50421
51932
|
name: "deviceId",
|
|
50422
51933
|
form: "single",
|
|
@@ -52353,6 +53864,310 @@ async function ensureFormatsThenDistribute(modelId, deps) {
|
|
|
52353
53864
|
};
|
|
52354
53865
|
}
|
|
52355
53866
|
//#endregion
|
|
53867
|
+
//#region src/bundle/bundle-tar.ts
|
|
53868
|
+
/**
|
|
53869
|
+
* A minimal, allowlist-only tar reader for model bundles (D806).
|
|
53870
|
+
*
|
|
53871
|
+
* The bundle comes from a trainer we did not run on this machine, so the
|
|
53872
|
+
* reader trusts nothing in it: every regular file must be NAMED in the
|
|
53873
|
+
* caller's allowlist (exact match after normalisation), anything else — an
|
|
53874
|
+
* unlisted file, a link, a device, an absolute or `..` path — fails the whole
|
|
53875
|
+
* bundle. Files are streamed to disk in chunks and hashed on the way; nothing
|
|
53876
|
+
* is held whole in memory.
|
|
53877
|
+
*
|
|
53878
|
+
* Formats read: POSIX ustar (with its 155-byte prefix), PAX `path` records
|
|
53879
|
+
* (`x`), GNU long names (`L`) — what Python's `tarfile` writes. Directory
|
|
53880
|
+
* entries are accepted and ignored (directories are created from file paths).
|
|
53881
|
+
*/
|
|
53882
|
+
var BLOCK = 512;
|
|
53883
|
+
var COPY_CHUNK = 1024 * 1024;
|
|
53884
|
+
function readString(buf, start, length) {
|
|
53885
|
+
const slice = buf.subarray(start, start + length);
|
|
53886
|
+
const nul = slice.indexOf(0);
|
|
53887
|
+
return slice.subarray(0, nul < 0 ? slice.length : nul).toString("utf8");
|
|
53888
|
+
}
|
|
53889
|
+
function readOctal(buf, start, length) {
|
|
53890
|
+
const text = readString(buf, start, length).trim();
|
|
53891
|
+
return text === "" ? 0 : Number.parseInt(text, 8);
|
|
53892
|
+
}
|
|
53893
|
+
function isZeroBlock(buf) {
|
|
53894
|
+
for (const byte of buf) if (byte !== 0) return false;
|
|
53895
|
+
return true;
|
|
53896
|
+
}
|
|
53897
|
+
/** `a/b/c` only: no absolute path, no `.`/`..`/empty segment, no backslash. */
|
|
53898
|
+
function isSafeBundlePath(name) {
|
|
53899
|
+
if (name === "" || name.startsWith("/") || name.includes("\\") || name.includes("\0")) return false;
|
|
53900
|
+
return name.split("/").every((seg) => seg !== "" && seg !== "." && seg !== "..");
|
|
53901
|
+
}
|
|
53902
|
+
function paxPath(body) {
|
|
53903
|
+
let offset = 0;
|
|
53904
|
+
while (offset < body.length) {
|
|
53905
|
+
const space = body.indexOf(32, offset);
|
|
53906
|
+
if (space < 0) break;
|
|
53907
|
+
const length = Number.parseInt(body.subarray(offset, space).toString("utf8"), 10);
|
|
53908
|
+
if (!Number.isFinite(length) || length <= 0) break;
|
|
53909
|
+
const record = body.subarray(space + 1, offset + length - 1).toString("utf8");
|
|
53910
|
+
const eq = record.indexOf("=");
|
|
53911
|
+
if (eq > 0 && record.slice(0, eq) === "path") return record.slice(eq + 1);
|
|
53912
|
+
offset += length;
|
|
53913
|
+
}
|
|
53914
|
+
return null;
|
|
53915
|
+
}
|
|
53916
|
+
/**
|
|
53917
|
+
* Extract every allowlisted regular file of `tarPath` under `destDir`,
|
|
53918
|
+
* keeping its relative path. Refuses on the first entry outside the
|
|
53919
|
+
* allowlist, a duplicate, a non-file entry or a truncated archive.
|
|
53920
|
+
*/
|
|
53921
|
+
async function extractBundleTar(tarPath, destDir, allow) {
|
|
53922
|
+
const handle = await (0, node_fs_promises.open)(tarPath, "r");
|
|
53923
|
+
try {
|
|
53924
|
+
const header = Buffer.alloc(BLOCK);
|
|
53925
|
+
const seen = /* @__PURE__ */ new Map();
|
|
53926
|
+
let position = 0;
|
|
53927
|
+
let pendingName = null;
|
|
53928
|
+
for (;;) {
|
|
53929
|
+
const { bytesRead } = await handle.read(header, 0, BLOCK, position);
|
|
53930
|
+
if (bytesRead === 0) break;
|
|
53931
|
+
if (bytesRead < BLOCK) return {
|
|
53932
|
+
kind: "refused",
|
|
53933
|
+
detail: "truncated tar header"
|
|
53934
|
+
};
|
|
53935
|
+
position += BLOCK;
|
|
53936
|
+
if (isZeroBlock(header)) break;
|
|
53937
|
+
const size = readOctal(header, 124, 12);
|
|
53938
|
+
const type = String.fromCharCode(header[156] ?? 48);
|
|
53939
|
+
const padded = Math.ceil(size / BLOCK) * BLOCK;
|
|
53940
|
+
if (type === "x" || type === "L") {
|
|
53941
|
+
const body = Buffer.alloc(size);
|
|
53942
|
+
await handle.read(body, 0, size, position);
|
|
53943
|
+
pendingName = type === "x" ? paxPath(body) : readString(body, 0, size);
|
|
53944
|
+
position += padded;
|
|
53945
|
+
continue;
|
|
53946
|
+
}
|
|
53947
|
+
if (type === "g") {
|
|
53948
|
+
position += padded;
|
|
53949
|
+
continue;
|
|
53950
|
+
}
|
|
53951
|
+
const prefix = readString(header, 345, 155);
|
|
53952
|
+
const shortName = readString(header, 0, 100);
|
|
53953
|
+
const name = (pendingName ?? (prefix !== "" ? `${prefix}/${shortName}` : shortName)).replace(/^\.\//, "");
|
|
53954
|
+
pendingName = null;
|
|
53955
|
+
if (type === "5") {
|
|
53956
|
+
position += padded;
|
|
53957
|
+
continue;
|
|
53958
|
+
}
|
|
53959
|
+
if (type !== "0" && type !== "\0" && type !== "7") return {
|
|
53960
|
+
kind: "refused",
|
|
53961
|
+
detail: `entry "${name}" is not a regular file (type ${type})`
|
|
53962
|
+
};
|
|
53963
|
+
if (!isSafeBundlePath(name) || !allow.has(name)) return {
|
|
53964
|
+
kind: "refused",
|
|
53965
|
+
detail: `entry "${name}" is not part of the declared bundle`
|
|
53966
|
+
};
|
|
53967
|
+
if (seen.has(name)) return {
|
|
53968
|
+
kind: "refused",
|
|
53969
|
+
detail: `entry "${name}" appears twice`
|
|
53970
|
+
};
|
|
53971
|
+
const written = await copyEntry(handle, position, size, node_path.default.join(destDir, name));
|
|
53972
|
+
if (written === null) return {
|
|
53973
|
+
kind: "refused",
|
|
53974
|
+
detail: `entry "${name}" is truncated`
|
|
53975
|
+
};
|
|
53976
|
+
seen.set(name, {
|
|
53977
|
+
path: name,
|
|
53978
|
+
bytes: size,
|
|
53979
|
+
sha256: written
|
|
53980
|
+
});
|
|
53981
|
+
position += padded;
|
|
53982
|
+
}
|
|
53983
|
+
return {
|
|
53984
|
+
kind: "extracted",
|
|
53985
|
+
files: [...seen.values()]
|
|
53986
|
+
};
|
|
53987
|
+
} finally {
|
|
53988
|
+
await handle.close();
|
|
53989
|
+
}
|
|
53990
|
+
}
|
|
53991
|
+
async function copyEntry(source, start, size, target) {
|
|
53992
|
+
await (0, node_fs_promises.mkdir)(node_path.default.dirname(target), { recursive: true });
|
|
53993
|
+
const out = await (0, node_fs_promises.open)(target, "w");
|
|
53994
|
+
const hash = (0, node_crypto.createHash)("sha256");
|
|
53995
|
+
const chunk = Buffer.alloc(Math.min(COPY_CHUNK, Math.max(size, 1)));
|
|
53996
|
+
try {
|
|
53997
|
+
let done = 0;
|
|
53998
|
+
while (done < size) {
|
|
53999
|
+
const want = Math.min(chunk.length, size - done);
|
|
54000
|
+
const { bytesRead } = await source.read(chunk, 0, want, start + done);
|
|
54001
|
+
if (bytesRead === 0) return null;
|
|
54002
|
+
const piece = chunk.subarray(0, bytesRead);
|
|
54003
|
+
hash.update(piece);
|
|
54004
|
+
await out.write(piece);
|
|
54005
|
+
done += bytesRead;
|
|
54006
|
+
}
|
|
54007
|
+
return hash.digest("hex");
|
|
54008
|
+
} finally {
|
|
54009
|
+
await out.close();
|
|
54010
|
+
}
|
|
54011
|
+
}
|
|
54012
|
+
//#endregion
|
|
54013
|
+
//#region src/bundle/bundle-import.ts
|
|
54014
|
+
/**
|
|
54015
|
+
* `custom-model-registry.importModelBundle` — a model whose files arrive as
|
|
54016
|
+
* ONE tar from another addon (D806; the training orchestrator is the first
|
|
54017
|
+
* caller).
|
|
54018
|
+
*
|
|
54019
|
+
* Model Studio's upload path takes one `.onnx`/`.tflite` at a time; a trained
|
|
54020
|
+
* detector is an ONNX, two OpenVINO IR pairs and a Core ML package, which is
|
|
54021
|
+
* a directory. So the bundle is taken whole over `ctx.peerBytes` (D613),
|
|
54022
|
+
* checked against its declared sha256 AND against every declared file, and
|
|
54023
|
+
* only then moved into the hub's FLAT modelsDir — the layout every model
|
|
54024
|
+
* download path already resolves (`<modelsDir>/<basename of the url>`).
|
|
54025
|
+
*
|
|
54026
|
+
* Nothing is half-imported: the files land in a staging directory first, the
|
|
54027
|
+
* registry row is written only after every file is in place, and a refusal
|
|
54028
|
+
* names its reason (`checksum-mismatch`, `bundle-mismatch`, `invalid-entry`,
|
|
54029
|
+
* `id-taken`, `transfer-failed`).
|
|
54030
|
+
*/
|
|
54031
|
+
var LOCAL_SCHEME = "camstack-local://";
|
|
54032
|
+
var refuse = (reason, detail) => ({
|
|
54033
|
+
kind: "refused",
|
|
54034
|
+
reason,
|
|
54035
|
+
detail
|
|
54036
|
+
});
|
|
54037
|
+
/** The bundle paths one format occupies: main file + siblings, or the package members. */
|
|
54038
|
+
function formatBundlePaths(entry, format) {
|
|
54039
|
+
const fmt = entry.formats[format];
|
|
54040
|
+
if (fmt === void 0) return [];
|
|
54041
|
+
const prefix = `${LOCAL_SCHEME}${entry.id}/`;
|
|
54042
|
+
if (!fmt.url.startsWith(prefix)) return null;
|
|
54043
|
+
const main = fmt.url.slice(prefix.length);
|
|
54044
|
+
if (main === "" || main.includes("/")) return null;
|
|
54045
|
+
if (fmt.isDirectory === true) return (fmt.files ?? []).map((member) => `${main}/${member}`);
|
|
54046
|
+
return [main, ...fmt.files ?? []];
|
|
54047
|
+
}
|
|
54048
|
+
function presentFormats(entry) {
|
|
54049
|
+
return MODEL_FORMATS.filter((format) => entry.formats[format] !== void 0);
|
|
54050
|
+
}
|
|
54051
|
+
function entryPaths(entry) {
|
|
54052
|
+
const out = [];
|
|
54053
|
+
for (const format of presentFormats(entry)) {
|
|
54054
|
+
const paths = formatBundlePaths(entry, format);
|
|
54055
|
+
if (paths === null) return null;
|
|
54056
|
+
out.push(...paths);
|
|
54057
|
+
}
|
|
54058
|
+
return out;
|
|
54059
|
+
}
|
|
54060
|
+
function sameRevisions(a, b) {
|
|
54061
|
+
for (const format of MODEL_FORMATS) {
|
|
54062
|
+
const ra = a.formats[format];
|
|
54063
|
+
const rb = b.formats[format];
|
|
54064
|
+
if (ra === void 0 && rb === void 0) continue;
|
|
54065
|
+
if (ra?.revision === void 0 || ra.revision !== rb?.revision) return false;
|
|
54066
|
+
}
|
|
54067
|
+
return true;
|
|
54068
|
+
}
|
|
54069
|
+
async function sha256File(file) {
|
|
54070
|
+
const hash = (0, node_crypto.createHash)("sha256");
|
|
54071
|
+
for await (const chunk of (0, node_fs.createReadStream)(file)) hash.update(chunk);
|
|
54072
|
+
return hash.digest("hex");
|
|
54073
|
+
}
|
|
54074
|
+
async function importModelBundle(input, deps) {
|
|
54075
|
+
const declared = new Map(input.files.map((f) => [f.path, f]));
|
|
54076
|
+
const covered = /* @__PURE__ */ new Set();
|
|
54077
|
+
for (const entry of input.entries) {
|
|
54078
|
+
const paths = entryPaths(entry);
|
|
54079
|
+
if (paths === null) return refuse("invalid-entry", `"${entry.id}": every format URL must be ${LOCAL_SCHEME}${entry.id}/<file>`);
|
|
54080
|
+
for (const p of paths) {
|
|
54081
|
+
if (!declared.has(p)) return refuse("bundle-mismatch", `"${entry.id}" names "${p}", which the bundle does not declare`);
|
|
54082
|
+
covered.add(p);
|
|
54083
|
+
}
|
|
54084
|
+
}
|
|
54085
|
+
const existing = new Map((await deps.listModels()).map((m) => [m.entry.id, m.entry]));
|
|
54086
|
+
const fresh = [];
|
|
54087
|
+
for (const entry of input.entries) {
|
|
54088
|
+
const prior = existing.get(entry.id);
|
|
54089
|
+
if (prior === void 0) fresh.push(entry);
|
|
54090
|
+
else if (!sameRevisions(prior, entry)) return refuse("id-taken", `"${entry.id}" is already registered with other files`);
|
|
54091
|
+
}
|
|
54092
|
+
if (fresh.length === 0) return {
|
|
54093
|
+
kind: "imported",
|
|
54094
|
+
modelIds: input.entries.map((e) => e.id),
|
|
54095
|
+
distributed: []
|
|
54096
|
+
};
|
|
54097
|
+
const work = node_path.default.join(deps.stagingDir, `bundle-${deps.newId()}`);
|
|
54098
|
+
await (0, node_fs_promises.mkdir)(work, { recursive: true });
|
|
54099
|
+
try {
|
|
54100
|
+
const opened = await deps.openTicket(input.bundle.ticket);
|
|
54101
|
+
if (opened.kind === "refused") return refuse("transfer-failed", `${opened.code}: ${opened.detail}`);
|
|
54102
|
+
const tarPath = node_path.default.join(work, "bundle.tar");
|
|
54103
|
+
const written = await opened.body.writeToFile(tarPath, { maxBytes: input.bundle.bytes });
|
|
54104
|
+
if (written.kind === "refused") return refuse("transfer-failed", `${written.code}: ${written.detail}`);
|
|
54105
|
+
if (written.bytes !== input.bundle.bytes || await sha256File(tarPath) !== input.bundle.sha256) return refuse("checksum-mismatch", "the bundle does not match its declared size and sha256");
|
|
54106
|
+
const unpacked = node_path.default.join(work, "files");
|
|
54107
|
+
const extracted = await extractBundleTar(tarPath, unpacked, new Set(declared.keys()));
|
|
54108
|
+
if (extracted.kind === "refused") return refuse("bundle-mismatch", extracted.detail);
|
|
54109
|
+
for (const file of input.files) {
|
|
54110
|
+
const got = extracted.files.find((f) => f.path === file.path);
|
|
54111
|
+
if (got === void 0) return refuse("bundle-mismatch", `"${file.path}" is missing from the bundle`);
|
|
54112
|
+
if (got.sha256 !== file.sha256 || got.bytes !== file.bytes) return refuse("checksum-mismatch", `"${file.path}" does not match its declared sha256`);
|
|
54113
|
+
}
|
|
54114
|
+
await (0, node_fs_promises.mkdir)(deps.modelsDir, { recursive: true });
|
|
54115
|
+
for (const entry of fresh) await placeEntry(entry, unpacked, deps);
|
|
54116
|
+
for (const entry of fresh) {
|
|
54117
|
+
await deps.upsert({
|
|
54118
|
+
stepId: input.stepId,
|
|
54119
|
+
entry
|
|
54120
|
+
});
|
|
54121
|
+
for (const format of presentFormats(entry)) {
|
|
54122
|
+
const bytes = (formatBundlePaths(entry, format) ?? []).reduce((sum, p) => sum + (declared.get(p)?.bytes ?? 0), 0);
|
|
54123
|
+
await deps.markHubAvailable(entry.id, format, bytes);
|
|
54124
|
+
}
|
|
54125
|
+
}
|
|
54126
|
+
const distributed = [];
|
|
54127
|
+
if (input.distribute) for (const entry of fresh) distributed.push(...await deps.distribute(entry.id));
|
|
54128
|
+
return {
|
|
54129
|
+
kind: "imported",
|
|
54130
|
+
modelIds: input.entries.map((e) => e.id),
|
|
54131
|
+
distributed
|
|
54132
|
+
};
|
|
54133
|
+
} finally {
|
|
54134
|
+
await (0, node_fs_promises.rm)(work, {
|
|
54135
|
+
recursive: true,
|
|
54136
|
+
force: true
|
|
54137
|
+
});
|
|
54138
|
+
}
|
|
54139
|
+
}
|
|
54140
|
+
async function placeEntry(entry, unpacked, deps) {
|
|
54141
|
+
for (const format of presentFormats(entry)) {
|
|
54142
|
+
const fmt = entry.formats[format];
|
|
54143
|
+
if (fmt === void 0) continue;
|
|
54144
|
+
const main = fmt.url.slice(`${LOCAL_SCHEME}${entry.id}/`.length);
|
|
54145
|
+
const names = fmt.isDirectory === true ? [main] : [main, ...fmt.files ?? []];
|
|
54146
|
+
for (const name of names) {
|
|
54147
|
+
const target = node_path.default.join(deps.modelsDir, name);
|
|
54148
|
+
await (0, node_fs_promises.rm)(target, {
|
|
54149
|
+
recursive: true,
|
|
54150
|
+
force: true
|
|
54151
|
+
});
|
|
54152
|
+
await moveInto(node_path.default.join(unpacked, name), target);
|
|
54153
|
+
}
|
|
54154
|
+
if (fmt.revision !== void 0) await (0, node_fs_promises.writeFile)(node_path.default.join(deps.modelsDir, `${main}.revision`), `${fmt.revision}\n`, "utf8");
|
|
54155
|
+
}
|
|
54156
|
+
}
|
|
54157
|
+
/** Rename, or copy-then-remove when staging and modelsDir sit on different filesystems. */
|
|
54158
|
+
async function moveInto(source, target) {
|
|
54159
|
+
try {
|
|
54160
|
+
await (0, node_fs_promises.rename)(source, target);
|
|
54161
|
+
} catch (err) {
|
|
54162
|
+
if (!(err instanceof Error && "code" in err && err.code === "EXDEV")) throw err;
|
|
54163
|
+
await (0, node_fs_promises.cp)(source, target, { recursive: true });
|
|
54164
|
+
await (0, node_fs_promises.rm)(source, {
|
|
54165
|
+
recursive: true,
|
|
54166
|
+
force: true
|
|
54167
|
+
});
|
|
54168
|
+
}
|
|
54169
|
+
}
|
|
54170
|
+
//#endregion
|
|
52356
54171
|
//#region src/frigate/frigate-plus.ts
|
|
52357
54172
|
/**
|
|
52358
54173
|
* Frigate+ API client — the REAL api.frigate.video contract, verified against
|
|
@@ -53150,7 +54965,10 @@ var ModelStudioAddon = class ModelStudioAddon extends BaseAddon {
|
|
|
53150
54965
|
}];
|
|
53151
54966
|
if (isHub) providers.push({
|
|
53152
54967
|
capability: customModelRegistryCapability,
|
|
53153
|
-
provider: {
|
|
54968
|
+
provider: {
|
|
54969
|
+
listModels: async () => state.get(),
|
|
54970
|
+
importModelBundle: async (input) => this.importModelBundle_(input)
|
|
54971
|
+
}
|
|
53154
54972
|
});
|
|
53155
54973
|
return {
|
|
53156
54974
|
providers,
|
|
@@ -53698,6 +55516,54 @@ var ModelStudioAddon = class ModelStudioAddon extends BaseAddon {
|
|
|
53698
55516
|
} });
|
|
53699
55517
|
return { conversions: ensured.conversions };
|
|
53700
55518
|
}
|
|
55519
|
+
/** `custom-model-registry.importModelBundle` (D806); the body is `bundle/bundle-import.ts`. */
|
|
55520
|
+
async importModelBundle_(input) {
|
|
55521
|
+
const peerBytes = this.ctx.peerBytes;
|
|
55522
|
+
if (peerBytes === void 0) return {
|
|
55523
|
+
kind: "refused",
|
|
55524
|
+
reason: "transfer-failed",
|
|
55525
|
+
detail: "no peer-bytes facility in this process"
|
|
55526
|
+
};
|
|
55527
|
+
const modelsDir = await this.resolveModelsDir();
|
|
55528
|
+
const nodeId = this.ctx.kernel?.localNodeId ?? "hub";
|
|
55529
|
+
const result = await importModelBundle(input, {
|
|
55530
|
+
modelsDir,
|
|
55531
|
+
stagingDir: node_path.default.join(this.ctx.dataDir ?? node_os.default.tmpdir(), "model-bundles"),
|
|
55532
|
+
openTicket: (ticket) => peerBytes.open(ticket),
|
|
55533
|
+
listModels: async () => this.state_.get(),
|
|
55534
|
+
upsert: async (descriptor) => {
|
|
55535
|
+
await this.state_.update((prev) => upsertCustomModel(prev, descriptor, "operator"));
|
|
55536
|
+
},
|
|
55537
|
+
markHubAvailable: async (modelId, format, bytes) => {
|
|
55538
|
+
await this.availability_.update((prev) => upsertAvailability(prev, modelId, nodeId.split("/")[0] ?? "hub", {
|
|
55539
|
+
format,
|
|
55540
|
+
sha256: "",
|
|
55541
|
+
bytes,
|
|
55542
|
+
at: Date.now()
|
|
55543
|
+
}));
|
|
55544
|
+
},
|
|
55545
|
+
distribute: async (modelId) => {
|
|
55546
|
+
return (await this.ensureFormatsThenDistribute_(modelId)).distributed.map((d) => ({
|
|
55547
|
+
modelId,
|
|
55548
|
+
nodeId: d.nodeId,
|
|
55549
|
+
format: d.format,
|
|
55550
|
+
ok: d.ok,
|
|
55551
|
+
...d.error !== void 0 ? { error: d.error } : {}
|
|
55552
|
+
}));
|
|
55553
|
+
},
|
|
55554
|
+
newId: () => node_crypto.default.randomUUID()
|
|
55555
|
+
});
|
|
55556
|
+
if (result.kind === "refused") this.ctx.logger.warn("Model bundle import refused", { meta: {
|
|
55557
|
+
reason: result.reason,
|
|
55558
|
+
detail: result.detail,
|
|
55559
|
+
modelIds: input.entries.map((e) => e.id)
|
|
55560
|
+
} });
|
|
55561
|
+
else this.ctx.logger.info("Model bundle imported", { meta: {
|
|
55562
|
+
modelIds: [...result.modelIds],
|
|
55563
|
+
distributed: result.distributed.length
|
|
55564
|
+
} });
|
|
55565
|
+
return result;
|
|
55566
|
+
}
|
|
53701
55567
|
async ensureFormatsThenDistribute_(modelId) {
|
|
53702
55568
|
const api = this.ctx.api;
|
|
53703
55569
|
if (!api) throw new Error("ensureFormatsThenDistribute: ctx.api unavailable");
|