dsh-remote-cluster 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +14 -8
  2. package/cordis.patch.yml +2 -0
  3. package/lib/client.js +1520 -2613
  4. package/lib/contracts.d.ts +84 -389
  5. package/lib/host/artifacts.d.ts +0 -1
  6. package/lib/host/artifacts.js +4 -4
  7. package/lib/host/helper.js +19 -4
  8. package/lib/host/notification-state.d.ts +2 -2
  9. package/lib/host/notification-state.js +4 -2
  10. package/lib/host/notifications.d.ts +4 -2
  11. package/lib/host/notifications.js +14 -4
  12. package/lib/host/plugin-upgrade.d.ts +2 -2
  13. package/lib/host/plugin-upgrade.js +3 -3
  14. package/lib/host/policy.d.ts +1 -6
  15. package/lib/host/policy.js +6 -21
  16. package/lib/host/runtime.d.ts +3 -3
  17. package/lib/host/runtime.js +16 -17
  18. package/lib/host/trust-stream.js +4 -4
  19. package/lib/index.js +1004 -1958
  20. package/lib/remote-web/assets/{b7f316f5fb0833db75e64ce8b7175fed9f7c183ecde8cbefeed176d486bed045.js → 0084c52f62a385e6094e5dfa889de8c7099e915b1ef0c5119c91745ac29ea890.js} +24 -24
  21. package/lib/remote-web/assets/{d21d232ead8f68e0e469830b95f6453508ed06591fd6cdb5f0b01f3ea61c24c7.js → 02ea64b75b5ebef3caa1dc974cc4e1e4e524c9cddaf60fd88f058f483bce03be.js} +100 -100
  22. package/lib/remote-web/assets/{098bde291652f9081cfecf174e69dba72fdf314d723e9e5c3e3b8ef492ef060c.js → 08034715255f7a5edb4b26ddedbad14f7972f25bb1ce9fb3e8740c66bb9ad956.js} +1 -1
  23. package/lib/remote-web/assets/{0a35520ffc7be23507ad92b1356c324e16e67816207fe53f7148fb129e3f7b16.js → 087bed002531649ed2b202ef468b6bdf42b3ce77848316fc3377741e52fa2f84.js} +1 -1
  24. package/lib/remote-web/assets/{adfdafc2983dd8062d21830340ae64002b98a0b73112397c1e18b87e50981eb5.js → 08ccb052f1bf6514d581ea35581c796a8b72b119a3ede4c49659569d4ba2b390.js} +14 -14
  25. package/lib/remote-web/assets/{334885a21328d9e13b7b2a55291f3029eb7e643be2193c72bc1d92b93f5e8124.js → 09d0199543b952650a5fc2822fa3f1f1b11ec40fb6821be4e4a4957a54462fa5.js} +13 -13
  26. package/lib/remote-web/assets/{15a481b4185010cf0070c1765cff4ae70803c47009b46b969ed23245d47d8d1b.js → 0c7796fb3d285a3e952108018f50ca54f6f9abe12cd5d113abfdda6ca0a9c291.js} +210 -210
  27. package/lib/remote-web/assets/{3fa1e622c06d545d0397d9294797e08af723cf89efcf27ba0b6a06ab3178b74b.js → 0cde6b99667f8398fc0b93679218518296de65e93c7add4e514fb84b037288fb.js} +1 -1
  28. package/lib/remote-web/assets/{1c98cd48db7795f939b6f60e34e476c5cdb987b74591c888221bc3cffcd039b9.js → 0d98fb17a975a69e1a44a15a6a7a598f51e4ec7e87d63c5dbba20c937b79b278.js} +536 -536
  29. package/lib/remote-web/assets/{7e81b7468feb6d690a5ae7bdc9f6d39764372cd64ffac39e5903ccd2de452bb2.js → 0df770f50561c1809781b6df2e39cdd9955bf85a0078b890965e1b5f4a8a644a.js} +35 -35
  30. package/lib/remote-web/assets/{b96274d6ccca084c0ecddbe2b511899ee8170bdb07f0443b78ed04aee136a9ea.js → 122d30bcfc3f574de9cef4216d1bae603158b8c362157107856a90b224bfa4d6.js} +163 -163
  31. package/lib/remote-web/assets/{cebafc997b717b6e4129067181e893f3a8789b5b57d22ab0b42ac9228b824281.js → 139b0cb0e366fa40d529e32c7dc7bef81fa9242d5814c77b20399c022b26b657.js} +1 -1
  32. package/lib/remote-web/assets/{5d58a7f2c9328dff985f169ff9b1d11e19341e1fc195364336c6d19d9944e919.js → 15133b18c27254c4071409497f17ce289290096f02444f776579322822e056fa.js} +11 -11
  33. package/lib/remote-web/assets/{e9275df5d01fa592536ef387b19c25aebc136aac8e3faa310bca203a43aee10b.js → 18a1bfce18b181785c5722a84fa68c2448c5c293845a54463608c249052231fa.js} +8 -8
  34. package/lib/remote-web/assets/{1adb6da8d7880db5639471451e8f1a734fd2a3a9366b1564b6d1df7626461b55.js → 18e7fca36248d92ede2e900db36d1caa20a1fc4ef228cff27ce1432a96df4edf.js} +77 -77
  35. package/lib/remote-web/assets/{01973d1544b193546badc3d3a5b3f3e4ff25c0f97f5dbe31419d8e847dcd1efb.js → 1c14db1f0a14adeb85ae8f71ce1b3c48437014fea4647a28191ec9aeec8e9d64.js} +1 -1
  36. package/lib/remote-web/assets/{f444d2cee7fc1bdac53f7114a920c659842cdf99e28a24bbd47bb24680bbea9e.js → 1d1aa9c727ce764d8dfdbe2419497486fce7acd87b5208ba38401e51bba343da.js} +43 -43
  37. package/lib/remote-web/assets/{2c542544e16be5db63d680b340dc54945c5f1c118b9d2bdff9d1cd86e119bccd.js → 1da0fcc4e8c98734daabe0b842ae647c5b31603595932c7679ec0fa5d26530a3.js} +20 -20
  38. package/lib/remote-web/assets/{e034cf380b694c73636b3b0806ba7373e1801855aacb940f72c15fa229de2b49.js → 1dc4ca74265350d289728f94a067f90af7b0512ff57a11ccc1592cad93b9dc05.js} +1 -1
  39. package/lib/remote-web/assets/{43a4cc3e142648f4ac9f9be6935c483d45ca25e93509a743ad52893179707a52.js → 2760cb3815b4db58d919c994e60adf195e4cffadbb5a7bb7864e5e38f0e9c4cc.js} +1 -1
  40. package/lib/remote-web/assets/{f1525fc764d1075eb7e514eef4c8727f861268ca1cd13a7932fe346c783928c1.js → 3b7e8eedc420d0f92c8e02f4f76d2770335cd6886deb43a21c7a055236389ce2.js} +2033 -2018
  41. package/lib/remote-web/assets/{e02bf19583b6a625934e7a3f186d9501b7643cf66fb8842c112aec334d6c6fb2.js → 3bdb86657b39a44141e195454ff97175c002e6645e854cf5a53e79e14f62d1a7.js} +1 -1
  42. package/lib/remote-web/assets/{2468f65781a1ed70cba018fd39cc67a752b1bab369a5cea6496979d953469a98.js → 44359122d19e49d937a2479a03fa4b54487ad56333bc8ea3af88ecb93f343a57.js} +56 -56
  43. package/lib/remote-web/assets/{b951fa440cfa468b10993fc6ab7ff26049c3feeb2555508d3314941ce61d1688.js → 48ee5453fb22d299af902f2f16d392fc3f0fd1c7a61d529af3c8ec2d852d0ef9.js} +1 -1
  44. package/lib/remote-web/assets/{12e7dcb173cae94664df91583dfee627aff9e6274330cf4ceb8a71848015b1f5.js → 4a9fb8705a24728082865ef72044ed52f7dc8af7958a6c59e2f54a322ea159d3.js} +81 -81
  45. package/lib/remote-web/assets/{fe588c75b14b5b80a8b1e2ed3d427a018b0478a710ff1158285299a118c68552.js → 4b1f01ce0e6cdf3427082b0ea09f5b4444c5f33becb2e61fcff036be6caecf61.js} +39 -39
  46. package/lib/remote-web/assets/{94dc298a4c0b13582626b568744d73438379611c70c94f27276de5524a764646.js → 4b5bbd08c07143177017aec55b9c3cfa99f7ac2b7e7df41eb711e5686e8fc45c.js} +1 -1
  47. package/lib/remote-web/assets/{adb35a440db8d19c4c4259db43a2581dc976973a18c33a21537c7a4f134c3751.js → 4d62ec73c613195dbcc605687437075d9ae69abfff46f2222828ef6552aeb7fb.js} +198 -198
  48. package/lib/remote-web/assets/{ddfab7b1b5a26429dec5bce358ed59cbfde9abb4163d799cc21dd0c81bbf0039.js → 4fba08815fd76d75051f8cd3a8422efaddaabd35916b782b8c3a6c5efca37df7.js} +1 -1
  49. package/lib/remote-web/assets/{6b47fdd8a6f11322c7b05295cc13333968713fb6d31afd3aaff2ff472e779899.js → 51df9318706eec62dd9ac25b3e177f27b381b2badd74c9105b4ecd19fd9d8a7f.js} +187 -187
  50. package/lib/remote-web/assets/{f95c2501d2da00fc152537c126ec680b4ce0d1bbe11439e34d39906400e0d314.js → 5448433f82ecf21d6c836ad57deddf1794ba63eee14e7380d3f61f84e12e5fdb.js} +38 -38
  51. package/lib/remote-web/assets/{d60e1fc1a4c2fd58f0e8bdba92181866c6a91dbe78f246ff13a7f36f322fe2e0.js → 5513a63c1c3db2570ffc3d4247838e1fdd74720aea7f6fc31ae2e5e7803f55ba.js} +10 -10
  52. package/lib/remote-web/assets/{a5fbb399f54ed13ab75612b231af21361747b2aa647d74f9643d09ebf6850cf4.js → 61aefa00f389470ac6c115e3235e098fd748b96305383a2d1bd6ce44cea0fec5.js} +17 -17
  53. package/lib/remote-web/assets/{77466b3f709f3db981e917e814f6a994525b19e6549a9cd39329242cba39a8ec.js → 633253522c4782e41100d66490ce6cdecabeca111378fbc37584a4cfceccfb15.js} +8 -8
  54. package/lib/remote-web/assets/{859bc5e8483c0b551734cf5b56d293ffac7c6ad861753115ed3e614b7063f875.js → 6e4e15365f3e55613ce8287ad50e74b10b45b9a93e8e3ea0432a84d3339a0814.js} +4 -4
  55. package/lib/remote-web/assets/{49d4a89c9a9c14f512853f602a6a48677fc2bfaccb285968dbbf7a5bce9cca23.js → 7b45fae07f4e474e34e468c8e2d6ec357ccbd6cfa3874e9f1f16852975bf7b70.js} +28 -28
  56. package/lib/remote-web/assets/{02fa8868185ded075a4fc747a57779bb44693016716e7f5cf15118d5e277f67d.js → 7b668aebc28b5370196dc974f744a9b73ee22fb64ac86644bbd3f6d35e30a9c3.js} +1 -1
  57. package/lib/remote-web/assets/{86f233ebd933cc27cd1fd375eadaef756258ec6ef3f1ec6bbc8a74bd749b25cf.js → 81a52db264b358f8a0571c1a21df44d005711d3070edab12b01718962f237daa.js} +19 -19
  58. package/lib/remote-web/assets/{27049d2062e1559c71c12312b3bd4a3d12b7551aa1cae18d0eabef42b15f22e3.js → 85674b722e9ddd3a7fb57729957619a72c125c6444b8067bedaf736a083e8870.js} +66 -66
  59. package/lib/remote-web/assets/{7c12a1642113ad6e6fef1215ece81f8119e6eda32c933d0e6d0cdf45b955dcf6.js → 8ec58a658326c139649a5fa4337d716d487a19eb53cefef6ab33a8f170cbb937.js} +12 -12
  60. package/lib/remote-web/assets/{ac1eeb4080e4ceeb19b90bae0449d11cf3bca7bb10865f75d22234b193e3c71f.js → 8ee1f0abb65b41bdae842afcf92fd5423227ff79190064d16d72e3cf5d663ccb.js} +66 -66
  61. package/lib/remote-web/assets/{76df7944d9167c8570be01943f4c4fa388c231ce28679391478a621a2b992302.js → 93e5328c86c55d0f5f572c52e301a94edb6ff183e59a088c807cb003acf19b3e.js} +40 -40
  62. package/lib/remote-web/assets/{af8d8b6d4866268a09ab3fa3a7b4207ee05a679acab4b0fdcb636573d4362cd4.js → 95db94d22c7fbb20288fd23f7300f237a32eef01fb14d080ce2ba5a4056cb58b.js} +5 -2
  63. package/lib/remote-web/assets/{8d9390f9055cae8f6cb9007160df46e927206e8bc6be2b85ad2cded69c55c258.js → 971050ba209a083dc0f76aae76c920b0cf6f39833caa9eac04d5e7c098b10294.js} +6 -6
  64. package/lib/remote-web/assets/{65245e000893241e7bb501a9a74f817e7127d3ac52f9498f426729e33b936042.css → 9b651fa4a96aae97c23e1e7774719c275901770622525feddee8982f881d30cb.css} +1 -1
  65. package/lib/remote-web/assets/{5f7c0da75b7d175568413e9252b489e38e1a105dc5cba4ee2af5c14614b19636.js → 9be52bd9e34016d26eac150a60864792bac13cedeb610134847c3750fe6d7d65.js} +1 -1
  66. package/lib/remote-web/assets/{fad9547b869d68c968df3a4c6223547dea854d82ba9d03b5bed7cb1b6f5a863a.js → a46ac5f37d4d56a6f3ef55f9d1c22afe79ae6e6486cac58d1a8b5f4aa35e3454.js} +4 -4
  67. package/lib/remote-web/assets/{b4795c75852caa38530903f2f5c6a068245769ca598519062ef8c84ee952dcbb.js → a902a4629188498d3de6c11bdab9d6331ebc78ac84f1eed1426808e152324eef.js} +1 -1
  68. package/lib/remote-web/assets/{3c58d660556f04bf959a80a68ceb24f9ca271effa47d4c11bf80a2a7298e094b.js → b14165b5a2b7ea65983dd50bb4d2a812e742902d215ac0838e4acb6e9d2219cb.js} +29 -29
  69. package/lib/remote-web/assets/{e9c84734488eb05a5046cdadc91c42eead837ebba2c347382afb6b6a928ff453.js → bc71bf8433d22d5044fc0a1d23cf3da7249e1d4d68a28403cdcdeb62f6c06fd0.js} +8 -8
  70. package/lib/remote-web/assets/{4452b5457ed9ef75852ed655421678a4c9761a8ba665a6acb76a7bee9591f80a.js → c19cad32a941358746573aa8775bfa25bb039ab11c0dbc8609472e4954d99569.js} +1 -1
  71. package/lib/remote-web/assets/{1dc7a20ec252e349870f557514a7400c40204ec2843b5465f2566fbda4c2c6d7.js → c3c64c8c168f764e3179ddc5756b784bae721d76425f2bed1be8c94c2981c023.js} +105 -105
  72. package/lib/remote-web/assets/{642d744b2336ffdca7f6ef2142b982d7583dc16a8f0fa6336a3ad342ae2e92bf.js → c9b9443fe4210c5c7e9c473b18516d12972136bc2158944009e64f378d6a0f76.js} +61 -61
  73. package/lib/remote-web/assets/{9ad4c375e58485513f0bb245c565dde8d9e377daa743973c2ffbd1db6edf5c14.js → ca4eacba163e6456f16b51db159f5bb8022d77f769d997e71542a8a462526f89.js} +1 -1
  74. package/lib/remote-web/assets/{19fdc5bfa9eb27746a52d4136d82432adad1fc5c05da343375c47e9eb1e0ff6d.js → cb63e257fb5d660613f44875d534ed8b2ca3d84ea23a7c2126a32b48848bb952.js} +1 -1
  75. package/lib/remote-web/assets/{18be6c6b00a6cebc5d61c987d345c295670aba2c448824b89394ef0225a9ad8f.js → d091b2f2d7a7405446aa3cf3e9222ab01c9108c51d8bdaddac35e1c0787f5d9e.js} +17 -17
  76. package/lib/remote-web/assets/{a9136a821ffdecfbb7da3181201a294599113fde30a9194d300a0ebd04265777.js → d1702ad9988e1f43af19d6222173fcd19df5eeb818178d0121965cb28c4aac79.js} +32 -32
  77. package/lib/remote-web/assets/{3ca829260281ebaa7e63eacb26fb5d6f9b3d2536424f17602f43eca797236daf.js → d2214a70ac36fce2f7f9f4fc955d487fdb7b2fac778eb6768bafefbf9d483756.js} +96 -96
  78. package/lib/remote-web/assets/{32eac0da1495da50f652018ac86c7dfeb5623a5aad823b876f42220667f1e7ed.js → d5a949b16e3425e396fbb9da6c72b7753c712d7a6e2f7cd82ee149ea5dddaf46.js} +19 -19
  79. package/lib/remote-web/assets/{6381af51cd1f1ff8f74971e145d78efbbb0a91ee04c08b67b0d826807410ce6c.js → d89ab139a3c4c779fcd0f7d90178e1e40b6918df5ff3ee88bf2e21ff4f4a408c.js} +23 -23
  80. package/lib/remote-web/assets/{52ac36b862f86e3fb3484b4cf739c2814e10c48be9a2ff0628a7ca41fc58286a.js → dad39c89eb29f99a02c2af23d3a8311b91f0b5a6ec46ef82e6e9dccdbb5ee6fc.js} +46 -46
  81. package/lib/remote-web/assets/{6e976052085dd6ca0696d3a8af15c019d603ffbebd7025e4296adde26392b610.js → dc5ab043cebd5fea48e4986e9702c1e7e80474ff9d9d169ac0cc3e5011d2a577.js} +14 -14
  82. package/lib/remote-web/assets/{005428c618c289f581815d719452c1d079fde087ab7597f1f4c9612cc9a58a4d.js → e1ae1c76c261fb7942bbcb954a2daf44b19e441c43a1e01bec909e11a0e3a112.js} +17 -17
  83. package/lib/remote-web/assets/{18f57f2be1c19d9ef485ceb00726357034de63728633c69d63ca2e2308e5958b.js → e2588f4df22316a5592393a5d6a846477deb9a7e61e2bb275bffdbdc2aceeb18.js} +1 -1
  84. package/lib/remote-web/assets/{c597d36a6b01cd4210733f7646be58b0868d3daa52d99430c5af5d28c89657b4.js → e2b04a76c8759e5147bbdd901106b4c52abdf7a930b50fc1b9db0abfde6943d4.js} +55 -55
  85. package/lib/remote-web/assets/{a1ec080e7d44c62ef90702af75eeeb076d07fe038c0520cad58bd3dbd423292d.js → e473d6a294c1c3e8dc0de53d575c5dfb819e7ac17276c2a1a6857f00926cca23.js} +248 -236
  86. package/lib/remote-web/assets/{9e5285630189b8e0b0a05ff063c168a7529bdc050577951adfb83d259211da24.js → e49b263f1d23afca80ae12e6b22bad8160d7af4040e67f651e118716501c9877.js} +7 -7
  87. package/lib/remote-web/assets/{e199929a866f9546c5f82ffa151f6360c31fae41e50594eb6d581f332a3e6b0c.js → e5c3c7acacaa3a8fe1a751fe18efd6971ed08da4bcfe22552b5ab2acdffbdda0.js} +10 -10
  88. package/lib/remote-web/assets/{6e8987340a515a088aca1ac7a058497830773028608c13ce2534d879148cd4e1.js → e97c5e1b2d22345551b36963fa0732dd2d3b35b2151c325afa5383a92274a46b.js} +1 -1
  89. package/lib/remote-web/assets/{64b30fa405d0e970e2cd9965e6885cf0a51d3e9405620cb9b7475dcd201567e8.js → e9dc6f3cb84e3cbbbf89f784935ddb888998996c6a821cdd6034813519d5b805.js} +40 -40
  90. package/lib/remote-web/assets/{940768cc4030ed48826915533c051037bf0cc7abe1cf7beb848209117e9e1e8c.js → eca547fd17bc209b737202e26038f067f5e7343d03853c03c522a7ffce1478e9.js} +27 -27
  91. package/lib/remote-web/assets/{cafa7df812524a60fdd7a87a5e2a999d30a3db98020be2215d3911e971b82703.js → eda44f09786da18ba9e1565add234c28dc6ce7921f8015c0d1802d41fab65830.js} +48 -48
  92. package/lib/remote-web/assets/{a2d62f5423b1fa2be3fa79c3f7242ae5152a993ac5179767aebb5c494eb23a31.js → fad9a550005adba79006e476f4542fb0946734ceaf44963d7dcdf6b671f5366c.js} +1 -1
  93. package/lib/remote-web/assets/{679ca4f6d055b4e3f42552bc908312a3a2a9639cc0ebdd26559de02051b2d720.js → fbc51e4c027ee369392bf78c535d4713e226dd65e4be60c0e7466205f3cb514f.js} +193 -193
  94. package/lib/remote-web/assets/{d780f0181c73771dade5f793f0a81fc914cc45cae63d1dc4cb04c2c34f2ddbe4.js → fe91c282e5695c3920bcb5168c49c0038909b22b040269802b348889d07ac6e1.js} +1 -1
  95. package/lib/remote-web/index.html +2 -2
  96. package/lib/remote-web/manifest.json +461 -461
  97. package/package.json +24 -23
  98. package/lib/host/awake-timeout.d.ts +0 -24
  99. package/lib/host/awake-timeout.js +0 -45
@@ -1,8 +1,4 @@
1
- export type TargetRef = {
2
- clusterId: string;
3
- deviceId: string;
4
- instanceId: string;
5
- };
1
+ import type { DeviceTargetRef } from "./devices.ts";
6
2
  export type Principal = {
7
3
  clusterId: string;
8
4
  deviceId: string;
@@ -25,23 +21,22 @@ export type Invite = {
25
21
  expiresAt: number;
26
22
  };
27
23
  export type InviteDescriptor = Omit<Invite, 'secret'>;
28
- export type MembershipProof = {
29
- version: 1;
30
- clusterId: string;
31
- deviceId: string;
32
- admissionId: string;
33
- publicKey: string;
34
- memberVersion: number;
35
- issuerDeviceId: string;
36
- issuerAdmissionId: string;
37
- issuedAt: number;
38
- expiresAt: number;
39
- signature: string;
24
+ export type NotificationLink = {
25
+ eventId: string;
26
+ target: DeviceTargetRef;
27
+ sessionId: string;
28
+ runId: string;
29
+ kind: 'approval-waiting' | 'session-idle';
30
+ };
31
+ export type NotificationIntentPayload = Omit<NotificationLink, 'target'> & {
32
+ source: DeviceTargetRef;
40
33
  };
34
+ export declare function parseNotificationLink(input: unknown): NotificationLink;
41
35
  export type Notice = {
42
36
  eventId: string;
43
- target: TargetRef;
37
+ target: DeviceTargetRef;
44
38
  sessionId: string;
39
+ sessionTitle?: string;
45
40
  runId: string;
46
41
  occurredAt: number;
47
42
  } & ({
@@ -62,35 +57,26 @@ export type PluginReport = {
62
57
  pluginVersion: string;
63
58
  pluginUpdate?: PluginUpdateInfo;
64
59
  };
65
- export type StorageOperation = {
66
- operationId: string;
67
- target: TargetRef;
68
- admissionId: string;
69
- enabled: boolean;
70
- status: 'accepted' | 'running' | 'waiting' | 'succeeded' | 'failed';
71
- stage: 'accepted' | 'preparing' | 'adding-learner' | 'starting' | 'syncing' | 'promoting' | 'verifying' | 'removing' | 'cleanup' | 'complete';
72
- revision: number;
73
- updatedAt: number;
74
- error?: ApiError;
75
- };
76
60
  export type IpcPayloads = {
77
- startStorageRole: {
78
- target: TargetRef;
61
+ setMemberRole: {
62
+ target: DeviceTargetRef;
79
63
  admissionId: string;
80
- enabled: boolean;
64
+ role: 'agent' | 'manager';
65
+ };
66
+ getMemberRole: {
67
+ target: DeviceTargetRef;
81
68
  };
82
- getStorageOperation: {
83
- target: TargetRef;
69
+ removeMember: {
70
+ target: DeviceTargetRef;
84
71
  admissionId: string;
85
- operationId?: string;
86
72
  };
87
73
  checkPluginUpdate: {
88
- target: TargetRef;
74
+ target: DeviceTargetRef;
89
75
  admissionId: string;
90
76
  runId: string;
91
77
  };
92
78
  upgradePlugin: {
93
- target: TargetRef;
79
+ target: DeviceTargetRef;
94
80
  admissionId: string;
95
81
  runId: string;
96
82
  version: string;
@@ -99,7 +85,6 @@ export type IpcPayloads = {
99
85
  platform?: string;
100
86
  dshVersion?: string;
101
87
  pluginVersion?: string;
102
- instanceId?: string;
103
88
  dataDirectory?: string;
104
89
  deviceDirectory?: string;
105
90
  credentialNamespace?: string;
@@ -111,7 +96,6 @@ export type IpcPayloads = {
111
96
  catalog: Record<string, never>;
112
97
  createCluster: {
113
98
  displayName: string;
114
- instanceName?: string;
115
99
  };
116
100
  createInvite: {
117
101
  clusterId: string;
@@ -119,10 +103,6 @@ export type IpcPayloads = {
119
103
  join: {
120
104
  invite: Invite;
121
105
  displayName: string;
122
- instanceName?: string;
123
- };
124
- revoke: {
125
- principal: Principal;
126
106
  };
127
107
  renameMember: {
128
108
  principal: Principal;
@@ -130,18 +110,10 @@ export type IpcPayloads = {
130
110
  };
131
111
  leave: {
132
112
  clusterId: string;
133
- resumeCleanupOperationId?: string;
134
113
  };
135
114
  setRemoteEnabled: {
136
115
  enabled: boolean;
137
116
  };
138
- setStorageRole: {
139
- enabled: boolean;
140
- plannedTargets?: TargetRef[];
141
- resumePeerRestartOperationId?: string;
142
- target?: TargetRef;
143
- admissionId?: string;
144
- };
145
117
  forgetCluster: {
146
118
  clusterId: string;
147
119
  acknowledged: true;
@@ -254,7 +226,7 @@ export type MobileBridgePayloads = {
254
226
  error?: ApiError;
255
227
  };
256
228
  'surface.notice': {
257
- notice: Notice;
229
+ notice: NotificationLink;
258
230
  };
259
231
  'surface.title': {
260
232
  sessionId: string;
@@ -359,95 +331,16 @@ export declare function parseIpc(input: unknown): IpcRequest;
359
331
  export declare function parseBridge(input: unknown): BridgeEnvelope;
360
332
  export declare function parseNotice(input: unknown): Notice;
361
333
  export declare function parseInvite(input: unknown): Invite;
362
- export declare function parseMembershipProof(input: unknown): MembershipProof;
363
- export declare function canonicalProof(input: unknown): string;
364
334
  export type InviteRequest = {
365
335
  schemaVersion: 1;
366
336
  inviteId: string;
367
337
  secretHash: string;
368
338
  expiresAt: number;
369
339
  };
370
- export type JoinRequest = {
340
+ export type RenameMemberRequest = {
371
341
  schemaVersion: 1;
372
- clusterId: string;
373
- inviteId: string;
374
- secret: string;
375
- deviceId: string;
376
- publicKey: string;
377
- networkKey: string;
378
- requestId: string;
379
- displayName: string;
380
- signature: string;
381
- };
382
- export type MemberRecord = {
383
- deviceId: string;
384
- admissionId: string;
385
- publicKey: string;
386
- networkKeys: string[];
342
+ principal: Principal;
387
343
  displayName: string;
388
- status: 'active' | 'revoked';
389
- memberVersion: number;
390
- };
391
- export type InstanceRecord = {
392
- platform?: string;
393
- dshVersion?: string;
394
- pluginVersion?: string;
395
- pluginUpdate?: PluginUpdateInfo;
396
- storageRole?: 'remote-only' | 'prepared' | 'learner' | 'voter' | 'unknown';
397
- storageOperation?: StorageOperation;
398
- storageCleanupPending?: boolean;
399
- displayName?: string;
400
- target: TargetRef;
401
- admissionId: string;
402
- protectedAddress: string;
403
- networkKey: string;
404
- metadataPort: number;
405
- businessPort: number;
406
- capabilities: ('metadata' | 'business' | 'peer')[];
407
- remoteEnabled: boolean;
408
- runId: string;
409
- updatedAt: number;
410
- };
411
- export type Summary = {
412
- target: TargetRef;
413
- sessionId: string;
414
- runId: string;
415
- title: string;
416
- status: 'idle' | 'busy' | 'approval-waiting' | 'failed';
417
- updatedAt: number;
418
- };
419
- export type MemberSnapshot = {
420
- schemaVersion: 1;
421
- clusterId: string;
422
- revision: number;
423
- readAt: number;
424
- members: MemberRecord[];
425
- };
426
- export type DirectorySnapshot = {
427
- nodes?: NodeRecord[];
428
- onlineDeviceIds?: string[];
429
- schemaVersion: 1;
430
- clusterId: string;
431
- revision: number;
432
- readAt: number;
433
- instances: InstanceRecord[];
434
- summaries: Summary[];
435
- onlineInstanceIds: string[];
436
- };
437
- export type NodeRecord = {
438
- platform?: string;
439
- deviceId: string;
440
- admissionId: string;
441
- kind: 'agent' | 'controller';
442
- runId: string;
443
- updatedAt: number;
444
- };
445
- export type ClusterSnapshot = {
446
- schemaVersion: 1;
447
- clusterId: string;
448
- revision: number;
449
- members: MemberSnapshot;
450
- directory: DirectorySnapshot;
451
344
  };
452
345
  export type WatchClusterRequest = {
453
346
  schemaVersion: 1;
@@ -459,282 +352,84 @@ export type TrustCheckpointResponse = {
459
352
  clusterId: string;
460
353
  membershipRevision: number;
461
354
  };
462
- export type JoinResult = {
463
- schemaVersion: 1;
464
- admissionId: string;
465
- members: MemberSnapshot;
466
- directory: DirectorySnapshot;
467
- proof: MembershipProof;
468
- };
469
- export type RenameMemberRequest = {
470
- schemaVersion: 1;
471
- principal: Principal;
472
- displayName: string;
473
- };
474
- export type RevokeRequest = {
475
- schemaVersion: 1;
476
- deviceId: string;
477
- operationId: string;
478
- };
479
- export type RevokeResult = {
480
- schemaVersion: 1;
481
- committedRevision: number;
482
- notificationState: 'pending' | 'synced';
483
- };
484
- export type NotificationSync = {
485
- schemaVersion: 1;
486
- operationId: string;
487
- actor: Principal;
488
- target: Principal;
489
- memberVersion: number;
490
- notificationState: 'pending' | 'synced';
491
- recipients?: NotificationSyncRecipient[];
492
- };
493
355
  export type WatchMembersRequest = {
494
356
  schemaVersion: 1;
495
357
  revision: number;
496
358
  };
497
- export type LeaveRequest = {
498
- schemaVersion: 1;
499
- operationId: string;
500
- };
501
- export type LeavePrepareRequest = LeaveRequest & {
502
- tokenHash: string;
503
- };
504
- export type LeaveCompletionRequest = LeaveRequest & {
505
- token: string;
506
- };
507
- export type LeaveResult = {
508
- storageRemoval: 'pending' | 'removed' | 'not-storage';
509
- membershipRevocation: 'pending' | 'revoked';
510
- notificationState: 'not-committed' | 'pending' | 'synced';
511
- committedRevision: number;
512
- trustCleanup: 'pending' | 'complete';
513
- };
514
- export type ClusterRequest = {
515
- method: 'POST';
516
- path: '/v1/notification-recipients';
517
- body: NotificationRecipient;
518
- } | {
519
- method: 'POST';
520
- path: '/v1/notification-recipients/remove';
521
- body: NotificationRecipientRemove;
522
- } | {
523
- method: 'POST';
524
- path: '/v1/notification-recipients/list';
525
- body: NotificationRecipientListRequest;
526
- } | {
527
- method: 'POST';
528
- path: '/v1/notification-sync/list';
529
- body: NotificationSyncListRequest;
530
- } | {
531
- method: 'POST';
532
- path: '/v1/notification-sync/read';
533
- body: NotificationSyncReadRequest;
534
- } | {
535
- method: 'POST';
536
- path: '/v1/notification-sync/ack';
537
- body: NotificationSyncAck;
538
- } | {
539
- method: 'GET';
540
- path: '/v1/members' | '/v1/directory' | '/v1/notification-membership-proof';
541
- body: null;
542
- } | {
543
- method: 'POST';
544
- path: '/v1/revoke';
545
- body: RevokeRequest;
546
- } | {
547
- method: 'POST';
548
- path: '/v1/members/rename';
549
- body: RenameMemberRequest;
550
- } | {
551
- method: 'POST';
552
- path: '/v1/leave';
553
- body: LeaveRequest;
554
- } | {
555
- method: 'POST';
556
- path: '/v1/leave/prepare';
557
- body: LeavePrepareRequest;
558
- } | {
559
- method: 'POST';
560
- path: '/v1/members/watch';
561
- body: WatchMembersRequest;
562
- } | {
563
- method: 'GET';
564
- path: '/v1/state' | '/v1/trust/checkpoint';
565
- body: null;
566
- } | {
567
- method: 'POST';
568
- path: '/v1/state/watch';
569
- body: WatchClusterRequest;
570
- } | {
571
- method: 'POST';
572
- path: '/v1/nodes';
573
- body: NodeRecord;
574
- } | {
575
- method: 'POST';
576
- path: '/v1/invites';
577
- body: InviteRequest;
578
- } | {
579
- method: 'POST';
580
- path: '/v1/instances';
581
- body: InstanceRecord;
582
- } | {
583
- method: 'POST';
584
- path: '/v1/summaries';
585
- body: Summary;
586
- } | {
587
- method: 'POST';
588
- path: '/v1/join';
589
- body: JoinRequest;
590
- };
591
- export declare function parseClusterRequest(input: unknown): ClusterRequest;
592
- export declare function parseJoinRequest(input: unknown): JoinRequest;
593
- export declare function parseJoinResult(input: unknown): JoinResult;
594
- export declare function parseMembers(input: unknown): MemberSnapshot;
595
- export declare function parseDirectory(input: unknown): DirectorySnapshot;
596
- /** RFC8785 for the flat v1 join transcript; secret, device and network key are signed. */
597
- export declare function canonicalJoin(input: unknown): string;
598
359
  export type Ack = {
599
360
  schemaVersion: 1;
600
361
  ok: true;
601
362
  };
363
+ /** Metadata resources accept only the device contract. */
364
+ export declare function parseClusterRequest(input: unknown): unknown;
602
365
  export type ClusterResults = {
603
- '/v1/notification-recipients': Ack;
604
- '/v1/notification-recipients/remove': Ack;
605
- '/v1/notification-recipients/list': NotificationRecipientList;
606
- '/v1/notification-sync/list': NotificationSyncList;
607
- '/v1/notification-sync/read': NotificationSyncRecord;
608
- '/v1/notification-sync/ack': NotificationSyncRecord;
609
- '/v1/notification-membership-proof': NotificationMembershipProof;
610
- '/v1/leave': LeaveResult;
611
- '/v1/leave/prepare': LeaveResult;
612
- '/v1/revoke': RevokeResult;
613
- '/v1/members/watch': MemberSnapshot;
614
- '/v1/state': ClusterSnapshot;
615
- '/v1/state/watch': ClusterSnapshot;
616
- '/v1/trust/checkpoint': TrustCheckpointResponse;
617
- '/v1/nodes': Ack;
618
- '/v1/members/rename': Ack;
619
- '/v1/members': MemberSnapshot;
620
- '/v1/directory': DirectorySnapshot;
366
+ '/v1/members': import('./devices.ts').DeviceMemberSnapshot;
367
+ '/v1/directory': import('./devices.ts').DeviceDirectorySnapshot;
368
+ '/v1/state': import('./devices.ts').DeviceClusterSnapshot;
369
+ '/v1/state/watch': import('./devices.ts').DeviceClusterSnapshot;
370
+ '/v1/members/watch': import('./devices.ts').DeviceMemberSnapshot;
621
371
  '/v1/invites': InviteDescriptor;
622
- '/v1/instances': Ack;
372
+ '/v1/join': import('./devices.ts').DeviceJoinResult;
373
+ '/v1/members/rename': Ack;
623
374
  '/v1/summaries': Ack;
624
- '/v1/join': JoinResult;
375
+ '/v1/trust/checkpoint': TrustCheckpointResponse;
625
376
  };
626
377
  export declare function parseClusterResult<P extends keyof ClusterResults>(path: P, input: unknown): ClusterResults[P];
378
+ /** Native etcd allocation, including retained MVCC history. */
379
+ export type StorageUsage = {
380
+ databaseBytes: number;
381
+ inUseBytes: number;
382
+ sampledAt: number;
383
+ };
627
384
  /** Display-only management projection; cached online state is always unknown. */
385
+ export type ManagementService = {
386
+ serviceName: 'dsh' | 'metadata' | 'etcd';
387
+ remoteEnabled?: boolean;
388
+ dshVersion?: string;
389
+ pluginVersion?: string;
390
+ };
391
+ export type ManagementMember = {
392
+ target: DeviceTargetRef;
393
+ deviceId: string;
394
+ admissionId: string;
395
+ displayName: string;
396
+ status: 'active' | 'revoked';
397
+ kind: 'manager' | 'agent' | 'controller';
398
+ platform: string;
399
+ online: boolean | null;
400
+ runId?: string;
401
+ role: 'agent' | 'manager' | 'unknown';
402
+ services: ManagementService[];
403
+ storageUsage?: StorageUsage;
404
+ roleTransition?: RoleTransition;
405
+ roleTransitionReceipt?: RoleTransition;
406
+ };
628
407
  export type ManagementCatalog = {
408
+ leaderDeviceId?: string;
629
409
  revision?: number;
630
410
  readAt: number;
631
411
  cached: boolean;
632
- members: {
633
- platform?: string;
634
- deviceId: string;
635
- admissionId: string;
636
- displayName: string;
637
- status: 'active' | 'revoked';
638
- nodeKind?: 'agent' | 'controller';
639
- online?: boolean | null;
640
- }[];
641
- instances: {
642
- platform?: string;
643
- dshVersion?: string;
644
- pluginVersion?: string;
645
- pluginUpdate?: PluginUpdateInfo;
646
- runId?: string;
647
- target: TargetRef;
648
- displayName: string;
649
- remoteEnabled: boolean;
650
- online: boolean | null;
651
- storageRole?: 'remote-only' | 'prepared' | 'learner' | 'voter' | 'unknown';
652
- storageOperation?: StorageOperation;
653
- storageCleanupPending?: boolean;
654
- }[];
655
- notificationSync: {
656
- state: 'pending' | 'synced' | 'unavailable';
657
- channel?: 'pending' | 'synced' | 'unavailable';
658
- };
412
+ members: ManagementMember[];
659
413
  };
660
414
  /** Validate only the finite display projection, never routing or trust evidence. */
661
415
  export declare function parseManagementCatalog(input: unknown): ManagementCatalog;
662
- export type NotificationMembershipProof = {
663
- purpose: 'notification-membership/v1';
664
- proof: MembershipProof;
665
- notificationSignature: string;
666
- };
667
- export declare function parseNotificationMembershipProof(input: unknown): NotificationMembershipProof;
668
- export type NotificationSubmission = {
669
- recipientId: string;
670
- notice: Notice;
671
- };
672
- export type NotificationStatusRequest = {
673
- recipientId: string;
674
- eventId: string;
675
- };
676
- export type NotificationResult = {
677
- eventId: string;
678
- state: 'pending' | 'accepted' | 'expired';
679
- reason?: 'deadline' | 'preference-disabled';
680
- provider?: 'apns' | 'fcm';
681
- result?: 'accepted' | 'retryable' | 'invalid-token' | 'permanent-error';
682
- requestId?: string;
683
- };
684
- export declare function parseNotificationSubmission(input: unknown): NotificationSubmission;
685
- export declare function parseNotificationStatusRequest(input: unknown): NotificationStatusRequest;
686
- export declare function parseNotificationResult(input: unknown): NotificationResult;
687
- export type NotificationRecipient = {
688
- schemaVersion: 1;
689
- owner: Principal;
690
- recipientId: string;
691
- memberVersion: number;
692
- bootstrapRevision: number;
693
- };
694
- export type NotificationRecipientRemove = {
695
- schemaVersion: 1;
696
- recipientId: string;
697
- };
698
- export type NotificationRecipientListRequest = {
699
- schemaVersion: 1;
700
- limit: number;
701
- afterDeviceId?: string;
702
- };
703
- export type NotificationRecipientList = {
704
- schemaVersion: 1;
705
- recipients: NotificationRecipient[];
706
- nextAfterDeviceId?: string;
707
- };
708
- export type NotificationSyncRecipient = {
709
- recipientId: string;
710
- owner: Principal;
711
- memberVersion: number;
712
- state: 'pending' | 'synced';
713
- };
714
- export type NotificationSyncRecord = NotificationSync & {
715
- revision: number;
716
- };
717
- export type NotificationSyncListRequest = {
718
- schemaVersion: 1;
719
- limit: number;
720
- afterOperationId?: string;
721
- };
722
- export type NotificationSyncList = {
723
- schemaVersion: 1;
724
- records: NotificationSyncRecord[];
725
- nextAfterOperationId?: string;
726
- };
727
- export type NotificationSyncReadRequest = {
728
- schemaVersion: 1;
416
+ export declare function parsePluginReport(input: unknown): PluginReport;
417
+ export type * from './devices.ts';
418
+ import type { DeviceContracts } from './devices.ts';
419
+ export declare function parseDeviceContract<K extends keyof DeviceContracts>(name: K, input: unknown): DeviceContracts[K];
420
+ export declare function canonicalDeviceJoin(input: unknown): string;
421
+ export declare function canonicalDeviceProof(input: unknown): string;
422
+ export type RoleTransitionPhase = 'accepted' | 'preparing' | 'starting' | 'syncing' | 'synced' | 'promoting' | 'removing' | 'stopping' | 'completed' | 'failed';
423
+ export type RoleTransition = {
424
+ revision?: number;
729
425
  operationId: string;
426
+ target: DeviceTargetRef;
427
+ admissionId: string;
428
+ role: 'agent' | 'manager';
429
+ phase: RoleTransitionPhase;
430
+ startedAt: number;
431
+ updatedAt: number;
432
+ elapsedMs: number;
433
+ result?: import('./devices.ts').MemberRoleResult;
434
+ error?: ApiError;
730
435
  };
731
- export type NotificationSyncAck = NotificationSyncReadRequest & {
732
- expectedRevision: number;
733
- recipientId: string;
734
- };
735
- export type NotificationResolvedNotice = {
736
- notice: Notice;
737
- result: NotificationResult;
738
- };
739
- export declare function parseNotificationResolvedNotice(input: unknown): NotificationResolvedNotice;
740
- export declare function parsePluginReport(input: unknown): PluginReport;
@@ -2,7 +2,6 @@ import type { PluginConfig } from "./runtime.ts";
2
2
  /** Select only a packaged, versioned platform artifact; never downloads a replacement. */
3
3
  export declare function packagedBinaries(directory?: string | undefined, platform?: string, arch?: string): Promise<{
4
4
  helperBinary: string;
5
- etcdBinary: string;
6
5
  }>;
7
6
  /** Resolve persistent per-profile instance storage and shared per-device identity paths. */
8
7
  export declare function resolvePluginConfig(input: Partial<PluginConfig>, profile: string): Promise<PluginConfig>;
@@ -54,7 +54,7 @@ export async function packagedBinaries(directory = undefined, platform = process
54
54
  !selected)
55
55
  throw fault("VERSION_UNSUPPORTED", `dsh-remote-cluster ${pluginVersion} has no compatible native artifact for ${target} (IPC 1, etcd 3.6.5)`);
56
56
  const validate = async (file) => {
57
- if (!/^[A-Za-z0-9._-]+$/.test(file.file) ||
57
+ if (!file || !/^[A-Za-z0-9._-]+$/.test(file.file) ||
58
58
  !/^[0-9a-f]{64}$/.test(file.sha256))
59
59
  throw fault("VERSION_UNSUPPORTED", "Invalid packaged native manifest");
60
60
  const path = join(directory, target, file.file);
@@ -71,7 +71,6 @@ export async function packagedBinaries(directory = undefined, platform = process
71
71
  };
72
72
  return {
73
73
  helperBinary: await validate(selected.helper),
74
- etcdBinary: await validate(selected.etcd),
75
74
  };
76
75
  }
77
76
  /** Resolve persistent per-profile instance storage and shared per-device identity paths. */
@@ -81,14 +80,15 @@ export async function resolvePluginConfig(input, profile) {
81
80
  : process.platform === "darwin"
82
81
  ? join(homedir(), "Library", "Application Support", "dsh-remote")
83
82
  : join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "dsh-remote");
84
- const native = input.helperBinary && input.etcdBinary
85
- ? { helperBinary: input.helperBinary, etcdBinary: input.etcdBinary }
83
+ const native = input.helperBinary
84
+ ? { helperBinary: input.helperBinary }
86
85
  : await packagedBinaries();
87
86
  return {
88
87
  ...native,
89
88
  dataDirectory: join(root, "instances", createHash("sha256").update(profile).digest("hex").slice(0, 24)),
90
89
  deviceDirectory: join(root, "device"),
91
90
  credentialNamespace: "dsh-remote",
91
+ notificationGateway: "https://dsh-notification-gateway.cugismyschool.workers.dev",
92
92
  maxCallers: 32,
93
93
  maxReadBytes: 4 * 1024 * 1024,
94
94
  directoryMaxEntries: 1000,
@@ -1,14 +1,14 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { createHash, randomUUID } from 'node:crypto';
3
3
  import { fileURLToPath } from 'node:url';
4
+ import { Agent } from 'undici';
4
5
  const maxBytes = 1_048_576;
5
6
  const resources = {
6
7
  initialize: 'initialize', status: 'status', catalog: 'catalog', shutdown: 'shutdown',
7
8
  checkPluginUpdate: 'plugin/update', upgradePlugin: 'plugin/update',
8
9
  createCluster: 'cluster/create', createInvite: 'cluster/invites', join: 'cluster/join',
9
- revoke: 'cluster/revoke', renameMember: 'cluster/members/rename', leave: 'cluster/leave', forgetCluster: 'cluster/forget',
10
- setRemoteEnabled: 'remote', setStorageRole: 'storage/operations', startStorageRole: 'storage/operations',
11
- getStorageOperation: 'storage/operations/query', backup: 'backup', restore: 'restore', refreshTrust: 'trust/refresh',
10
+ removeMember: 'cluster/members/remove', setMemberRole: 'cluster/members/role', getMemberRole: 'cluster/members/role/query', renameMember: 'cluster/members/rename', leave: 'cluster/leave', forgetCluster: 'cluster/forget',
11
+ setRemoteEnabled: 'remote', backup: 'backup', restore: 'restore', refreshTrust: 'trust/refresh',
12
12
  };
13
13
  const errorCodes = new Set(['IDENTITY_INVALID', 'MEMBER_REVOKED', 'TRUST_EXPIRED', 'REMOTE_DISABLED', 'TARGET_OFFLINE', 'CLUSTER_UNAVAILABLE', 'VERSION_UNSUPPORTED', 'FILE_CONFLICT', 'SEND_UNKNOWN', 'INVALID_REQUEST', 'INTERNAL']);
14
14
  function parseReady(value) {
@@ -146,6 +146,7 @@ export class Helper {
146
146
  throw new Error('oversized helper request');
147
147
  const correlationId = createHash('sha256').update('dsh-remote/ipc-operation/v1\n' + id).digest('hex');
148
148
  return new Promise((resolve, reject) => {
149
+ let initializationAgent;
149
150
  const controller = new AbortController();
150
151
  const cancel = () => { reject(controller.signal.reason); };
151
152
  controller.signal.addEventListener('abort', cancel, { once: true });
@@ -176,10 +177,21 @@ export class Helper {
176
177
  controller.signal.removeEventListener('abort', cancelBootstrap);
177
178
  }
178
179
  controller.signal.throwIfAborted();
180
+ // Bootstrap must be bounded, but initialization may need a long native
181
+ // snapshot transfer. Its lifetime is owned by this child, close or exit.
182
+ if (operation === 'initialize') {
183
+ clearTimeout(timer);
184
+ // Fetch also has its own response deadlines. Override them at dispatch
185
+ // so a slow snapshot is still owned by close/exit, not a second timer.
186
+ initializationAgent = new Agent().compose(dispatch => (options, handler) => dispatch({ ...options, headersTimeout: 0, bodyTimeout: 0 }, handler));
187
+ }
179
188
  const response = await fetch(ready.localBaseUrl + '/v1/local/' + resources[operation], {
180
189
  method: read ? 'GET' : 'POST', redirect: 'error', signal: controller.signal,
181
190
  headers: { 'X-Dsh-Local-Key': this.key, ...(read ? { 'X-Dsh-Request-Id': id } : { 'Content-Type': 'application/json' }) },
182
191
  ...(read ? {} : { body: data }),
192
+ // Node's fetch types track an independently versioned undici-types;
193
+ // dispatch is the compatible public protocol across these versions.
194
+ ...(initializationAgent ? { dispatcher: initializationAgent } : {}),
183
195
  });
184
196
  const result = await readResponse(response, id);
185
197
  controller.signal.throwIfAborted();
@@ -194,7 +206,10 @@ export class Helper {
194
206
  else
195
207
  reject(Object.assign(new Error(result.error.message), result.error));
196
208
  };
197
- void run().catch(error => { cleanup(); reject(error); }).finally(cleanup);
209
+ void run().catch(error => { cleanup(); reject(error); }).finally(() => {
210
+ cleanup();
211
+ void initializationAgent?.destroy().catch(() => { });
212
+ });
198
213
  });
199
214
  }
200
215
  close(reason = 'owner-close') {