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,6 +1,6 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
- import type { TargetRef } from '../contracts.js';
2
+ import type { DeviceTargetRef } from '../contracts.js';
3
3
  import type { ApprovalBroker } from './approvals.ts';
4
4
  import type { SessionNoticeSource } from './notifications.ts';
5
5
  /** Observe only live public services. Nothing here follows or resolves a cold session. */
6
- export declare function dshSessionNoticeSource(ctx: Context, target: TargetRef, runId: string, approvals: ApprovalBroker): SessionNoticeSource;
6
+ export declare function dshSessionNoticeSource(ctx: Context, target: DeviceTargetRef, runId: string, approvals: ApprovalBroker): SessionNoticeSource;
@@ -1,3 +1,4 @@
1
+ import { SessionId } from '@deepseek-ai/dsh-session';
1
2
  /** Observe only live public services. Nothing here follows or resolves a cold session. */
2
3
  export function dshSessionNoticeSource(ctx, target, runId, approvals) {
3
4
  return {
@@ -6,7 +7,8 @@ export function dshSessionNoticeSource(ctx, target, runId, approvals) {
6
7
  subscribe(listener) {
7
8
  let closed = false;
8
9
  const timers = new Set();
9
- const state = (agent) => ({ sessionId: agent.session.id, running: agent.status === 'running', queued: agent.inbox.nextTurn.length, steering: agent.inbox.nextStep.length });
10
+ const title = (agent) => agent ? ctx.get('sessionTitle')?.get(agent.session)?.title : undefined;
11
+ const state = (agent) => ({ sessionId: agent.session.id, sessionTitle: title(agent), running: agent.status === 'running', queued: agent.inbox.nextTurn.length, steering: agent.inbox.nextStep.length });
10
12
  const sample = (agent) => {
11
13
  const timer = setImmediate(() => {
12
14
  timers.delete(timer);
@@ -36,7 +38,7 @@ export function dshSessionNoticeSource(ctx, target, runId, approvals) {
36
38
  ctx.on('agent/disposed', ({ agent }) => listener({ type: 'dispose', sessionId: agent.session.id })),
37
39
  approvals.observePending((frame, occurredAt) => {
38
40
  const common = { brokerRunId: frame.runId, requestId: frame.requestId };
39
- const update = frame.state === 'pending' ? { type: 'approval', ...common, sessionId: frame.sessionId, occurredAt } : { type: 'approval-settled', ...common };
41
+ const update = frame.state === 'pending' ? { type: 'approval', ...common, sessionId: frame.sessionId, sessionTitle: title(ctx.agents.get(SessionId(frame.sessionId))), occurredAt } : { type: 'approval-settled', ...common };
40
42
  listener(update);
41
43
  }),
42
44
  ];
@@ -1,6 +1,7 @@
1
- import type { Notice, TargetRef } from '../contracts.js';
1
+ import type { Notice, DeviceTargetRef } from '../contracts.js';
2
2
  export interface SessionNoticeState {
3
3
  sessionId: string;
4
+ sessionTitle?: string;
4
5
  running: boolean;
5
6
  queued: number;
6
7
  steering: number;
@@ -24,12 +25,13 @@ export type SessionNoticeUpdate = ({
24
25
  } | {
25
26
  type: 'approval';
26
27
  sessionId: string;
28
+ sessionTitle?: string;
27
29
  brokerRunId: string;
28
30
  requestId: string;
29
31
  occurredAt: number;
30
32
  };
31
33
  export interface SessionNoticeSource {
32
- readonly target: TargetRef;
34
+ readonly target: DeviceTargetRef;
33
35
  readonly runId: string;
34
36
  subscribe(listener: (update: SessionNoticeUpdate) => void): () => void;
35
37
  unavailable?(reason: string): void;
@@ -4,8 +4,18 @@ export function observeSessionNotices(source, emit) {
4
4
  const sessions = new Map();
5
5
  const approvals = new Set();
6
6
  const id = (...parts) => createHash('sha256').update(JSON.stringify([source.runId, ...parts])).digest('hex');
7
- const publish = (notice) => { if (!closed)
8
- void emit(notice).catch(() => { }); };
7
+ const title = (value) => value === undefined ? {} : { sessionTitle: Array.from(value.trim()).slice(0, 256).join('') };
8
+ const publish = (notice) => {
9
+ if (!closed)
10
+ void emit(notice).catch(() => {
11
+ if (!closed) {
12
+ try {
13
+ source.unavailable?.('Notice submission failed');
14
+ }
15
+ catch { /* Diagnostics cannot own session or approval state. */ }
16
+ }
17
+ });
18
+ };
9
19
  const remove = source.subscribe(update => {
10
20
  if (closed)
11
21
  return;
@@ -18,7 +28,7 @@ export function observeSessionNotices(source, emit) {
18
28
  if (approvals.has(eventId) || approvals.size >= 1024)
19
29
  return;
20
30
  approvals.add(eventId);
21
- publish({ eventId, target: source.target, sessionId: update.sessionId, runId: source.runId, kind: 'approval-waiting', approvalId: update.requestId, occurredAt: update.occurredAt });
31
+ publish({ eventId, target: source.target, sessionId: update.sessionId, ...title(update.sessionTitle), runId: source.runId, kind: 'approval-waiting', approvalId: update.requestId, occurredAt: update.occurredAt });
22
32
  return;
23
33
  }
24
34
  if (update.type === 'dispose') {
@@ -49,7 +59,7 @@ export function observeSessionNotices(source, emit) {
49
59
  sessions.delete(update.sessionId);
50
60
  if (state.invalid || !state.outcome)
51
61
  return;
52
- publish({ eventId: id('idle', update.sessionId, state.turn), target: source.target, sessionId: update.sessionId, runId: source.runId, kind: 'session-idle', outcome: state.outcome, occurredAt: Date.now() });
62
+ publish({ eventId: id('idle', update.sessionId, state.turn), target: source.target, sessionId: update.sessionId, ...title(update.sessionTitle), runId: source.runId, kind: 'session-idle', outcome: state.outcome, occurredAt: Date.now() });
53
63
  }
54
64
  });
55
65
  return () => { closed = true; remove(); sessions.clear(); approvals.clear(); };
@@ -1,6 +1,6 @@
1
- import type { PluginReport, TargetRef } from '../contracts.js';
1
+ import type { PluginReport, DeviceTargetRef } from '../contracts.js';
2
2
  export interface PluginIdentity {
3
- target: TargetRef;
3
+ target: DeviceTargetRef;
4
4
  admissionId: string;
5
5
  runId: string;
6
6
  }
@@ -67,15 +67,15 @@ function parse(value) {
67
67
  throw fault('INVALID_REQUEST');
68
68
  exact(input, ['action', 'target', 'admissionId', 'runId', 'operationId', ...(input.action === 'upgrade' ? ['version'] : [])]);
69
69
  const target = object(input.target);
70
- exact(target, ['clusterId', 'deviceId', 'instanceId']);
71
- const identity = { target: { clusterId: identifier(target.clusterId), deviceId: identifier(target.deviceId), instanceId: identifier(target.instanceId) }, admissionId: identifier(input.admissionId), runId: identifier(input.runId) };
70
+ exact(target, ['clusterId', 'deviceId']);
71
+ const identity = { target: { clusterId: identifier(target.clusterId), deviceId: identifier(target.deviceId) }, admissionId: identifier(input.admissionId), runId: identifier(input.runId) };
72
72
  const version = input.action === 'upgrade' ? identifier(input.version) : undefined;
73
73
  if (version && !stable(version))
74
74
  throw fault('INVALID_REQUEST');
75
75
  return { action: input.action, identity, operationId: identifier(input.operationId, 4096), version };
76
76
  }
77
77
  function same(a, b, run = true) {
78
- return a.target.clusterId === b.target.clusterId && a.target.deviceId === b.target.deviceId && a.target.instanceId === b.target.instanceId && a.admissionId === b.admissionId && (!run || a.runId === b.runId);
78
+ return a.target.clusterId === b.target.clusterId && a.target.deviceId === b.target.deviceId && a.admissionId === b.admissionId && (!run || a.runId === b.runId);
79
79
  }
80
80
  function manager(value) {
81
81
  if (!value || typeof value !== 'object')
@@ -8,13 +8,11 @@ export interface TrustFrame {
8
8
  fence: number;
9
9
  clusterId: string;
10
10
  enabled: boolean;
11
- expiresAt: number;
12
- remainingMillis: number;
13
11
  members: {
14
12
  deviceId: string;
15
13
  admissionId: string;
16
14
  }[] | null;
17
- refusalCode?: 'CLUSTER_UNAVAILABLE' | 'REMOTE_DISABLED' | 'TRUST_EXPIRED' | 'MEMBER_REVOKED';
15
+ refusalCode?: 'CLUSTER_UNAVAILABLE' | 'REMOTE_DISABLED' | 'MEMBER_REVOKED';
18
16
  }
19
17
  /** Synchronous authority projection, cleared whenever its sole helper stream is unknown. */
20
18
  export declare class DevicePolicy implements RemoteAccessPolicy<DevicePrincipal> {
@@ -23,9 +21,6 @@ export declare class DevicePolicy implements RemoteAccessPolicy<DevicePrincipal>
23
21
  private readonly drop;
24
22
  private frame?;
25
23
  private watermark?;
26
- private deadline;
27
- private budget?;
28
- private timer?;
29
24
  constructor(grants: () => readonly RemoteAccessBinding[], invalidate: () => void, drop: () => void);
30
25
  bindings(principal: DevicePrincipal): readonly RemoteAccessBinding[];
31
26
  trusted(p: DevicePrincipal): boolean;
@@ -1,5 +1,4 @@
1
1
  import { fault } from "./errors.js";
2
- import { performance } from 'node:perf_hooks';
3
2
  /** Synchronous authority projection, cleared whenever its sole helper stream is unknown. */
4
3
  export class DevicePolicy {
5
4
  grants;
@@ -8,9 +7,6 @@ export class DevicePolicy {
8
7
  frame;
9
8
  // Clearing current authority must not forget restrictions already observed.
10
9
  watermark;
11
- deadline = 0;
12
- budget;
13
- timer;
14
10
  constructor(grants, invalidate, drop) {
15
11
  this.grants = grants;
16
12
  this.invalidate = invalidate;
@@ -24,8 +20,6 @@ export class DevicePolicy {
24
20
  return 'CLUSTER_UNAVAILABLE';
25
21
  if (!f.enabled)
26
22
  return f.refusalCode ?? 'CLUSTER_UNAVAILABLE';
27
- if (performance.now() >= this.deadline || Date.now() >= f.expiresAt)
28
- return 'TRUST_EXPIRED';
29
23
  if (f.clusterId !== p.clusterId)
30
24
  return 'IDENTITY_INVALID';
31
25
  if (!f.members?.some(m => m.deviceId === p.deviceId && m.admissionId === p.admissionId))
@@ -42,37 +36,28 @@ export class DevicePolicy {
42
36
  const changed = !old || old.runId !== f.runId || old.generation !== f.generation || old.fence !== f.fence;
43
37
  if (changed)
44
38
  this.drop();
45
- const proposed = performance.now() + Math.min(f.remainingMillis, Math.max(0, f.expiresAt - Date.now()));
46
- // A repeated snapshot cannot extend the previously received budget.
47
- const prior = this.budget;
48
- this.deadline = prior?.runId === f.runId && prior.generation === f.generation && prior.expiresAt === f.expiresAt ? Math.min(prior.deadline, proposed) : proposed;
49
- if (f.enabled)
50
- this.budget = { runId: f.runId, generation: f.generation, expiresAt: f.expiresAt, deadline: this.deadline };
51
39
  this.watermark = { runId: f.runId, generation: f.generation, sequence: f.sequence, fence: f.fence };
52
40
  this.frame = f;
53
- clearTimeout(this.timer);
54
- if (f.enabled)
55
- this.timer = setTimeout(() => { this.deadline = 0; this.drop(); this.invalidate(); }, Math.max(0, this.deadline - performance.now()));
56
- else
41
+ if (!f.enabled)
57
42
  this.drop();
58
43
  this.invalidate();
59
44
  }
60
- clear() { clearTimeout(this.timer); this.frame = undefined; this.deadline = 0; this.drop(); this.invalidate(); }
45
+ clear() { this.frame = undefined; this.drop(); this.invalidate(); }
61
46
  }
62
47
  export function parseTrustFrame(value) {
63
48
  if (!value || typeof value !== 'object')
64
49
  throw new Error('invalid trust frame');
65
50
  const f = value;
66
- for (const key of ['generation', 'sequence', 'fence', 'expiresAt', 'remainingMillis'])
51
+ for (const key of ['generation', 'sequence', 'fence'])
67
52
  if (typeof f[key] !== 'number' || !Number.isSafeInteger(f[key]) || f[key] < 0)
68
53
  throw new Error('invalid trust counter');
69
54
  if (typeof f.runId !== 'string' || !f.runId || typeof f.clusterId !== 'string' || typeof f.enabled !== 'boolean' || (f.members !== null && !Array.isArray(f.members)))
70
55
  throw new Error('invalid trust identity');
71
- if (Number(f.remainingMillis) > 86_400_000 || (f.enabled && (!f.clusterId || !f.expiresAt)))
72
- throw new Error('invalid trust budget');
56
+ if (f.enabled && !f.clusterId)
57
+ throw new Error('invalid trust cluster');
73
58
  if (Array.isArray(f.members) && f.members.some(m => !m || typeof m !== 'object' || typeof m.deviceId !== 'string' || typeof m.admissionId !== 'string'))
74
59
  throw new Error('invalid trust member');
75
- if (f.refusalCode !== undefined && (f.enabled || !['CLUSTER_UNAVAILABLE', 'REMOTE_DISABLED', 'TRUST_EXPIRED', 'MEMBER_REVOKED'].includes(String(f.refusalCode))))
60
+ if (f.refusalCode !== undefined && (f.enabled || !['CLUSTER_UNAVAILABLE', 'REMOTE_DISABLED', 'MEMBER_REVOKED'].includes(String(f.refusalCode))))
76
61
  throw new Error('invalid trust refusal');
77
62
  return f;
78
63
  }
@@ -1,12 +1,12 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
- import type { IpcPayloads, TargetRef } from '../contracts.js';
2
+ import type { IpcPayloads, DeviceTargetRef } from '../contracts.js';
3
3
  import { ApprovalBroker } from './approvals.ts';
4
4
  export interface PluginConfig {
5
5
  helperBinary: string;
6
6
  dataDirectory: string;
7
7
  deviceDirectory: string;
8
8
  credentialNamespace: string;
9
- etcdBinary: string;
9
+ etcdBinary?: string;
10
10
  maxCallers: number;
11
11
  maxReadBytes: number;
12
12
  directoryMaxEntries: number;
@@ -14,7 +14,7 @@ export interface PluginConfig {
14
14
  }
15
15
  export interface RemoteRuntime {
16
16
  readonly approvals: ApprovalBroker;
17
- openTarget(target: TargetRef): Promise<{
17
+ openTarget(target: DeviceTargetRef): Promise<{
18
18
  connectionId: string;
19
19
  basePath: string;
20
20
  }>;
@@ -99,7 +99,7 @@ export async function startRemotePlugin(ctx, config) {
99
99
  const status = record(await supervisor.request('status', {}));
100
100
  if (generation !== noticeGeneration || lifetime.signal.aborted || !status.paired)
101
101
  return;
102
- const target = { clusterId: text(status.clusterId), deviceId: text(status.deviceId), instanceId: text(status.instanceId) };
102
+ const target = { clusterId: text(status.clusterId), deviceId: text(status.deviceId) };
103
103
  const runId = text(status.runId);
104
104
  const stop = new AbortController();
105
105
  const remove = observeSessionNotices(dshSessionNoticeSource(ctx, target, runId, approvals), async (notice) => {
@@ -130,7 +130,7 @@ export async function startRemotePlugin(ctx, config) {
130
130
  throw new Error();
131
131
  const identifier = (value) => { const id = text(value); if (!id || id.length > 128)
132
132
  throw new Error(); return id; };
133
- return { target: { clusterId: identifier(value.clusterId), deviceId: identifier(value.deviceId), instanceId: identifier(value.instanceId) }, admissionId: identifier(value.admissionId), runId: identifier(value.runId) };
133
+ return { target: { clusterId: identifier(value.clusterId), deviceId: identifier(value.deviceId) }, admissionId: identifier(value.admissionId), runId: identifier(value.runId) };
134
134
  }
135
135
  catch {
136
136
  throw fault('CLUSTER_UNAVAILABLE', 'Plugin update identity is unavailable');
@@ -340,7 +340,7 @@ export async function startRemotePlugin(ctx, config) {
340
340
  if (!generationSignal)
341
341
  throw fault('CLUSTER_UNAVAILABLE');
342
342
  const origin = helperBase;
343
- const response = await fetch(origin + '/v1/local/connections', { method: 'POST', headers: { 'X-Dsh-Local-Key': key.toString('base64url'), 'Content-Type': 'application/json' }, body: JSON.stringify({ clusterId: target.clusterId, deviceId: target.deviceId, instanceId: target.instanceId }), signal: AbortSignal.any([lifetime.signal, generationSignal, AbortSignal.timeout(30_000)]) });
343
+ const response = await fetch(origin + '/v1/local/connections', { method: 'POST', headers: { 'X-Dsh-Local-Key': key.toString('base64url'), 'Content-Type': 'application/json' }, body: JSON.stringify({ clusterId: target.clusterId, deviceId: target.deviceId }), signal: AbortSignal.any([lifetime.signal, generationSignal, AbortSignal.timeout(30_000)]) });
344
344
  if (!response.ok) {
345
345
  const failure = record(await response.json());
346
346
  throw Object.assign(new Error(text(failure.message)), failure);
@@ -390,9 +390,13 @@ export async function startRemotePlugin(ctx, config) {
390
390
  closeTarget,
391
391
  async managementStatus(options) {
392
392
  if (supervisor.initialized) {
393
+ const generation = currentGeneration;
394
+ const stillReady = () => supervisor.initialized && generation === currentGeneration;
393
395
  try {
394
396
  const raw = record(await supervisor.request('status', {}));
395
- const status = Object.fromEntries(['deviceId', 'instanceId', 'clusterId', 'admissionId', 'paired', 'remoteEnabled', 'storageRole', 'controlPlane', 'deviceName', 'instanceName', 'recoveryState'].map(k => [k, raw[k]]));
397
+ if (!stillReady())
398
+ throw fault('CLUSTER_UNAVAILABLE');
399
+ const status = Object.fromEntries(['deviceId', 'clusterId', 'admissionId', 'paired', 'remoteEnabled', 'storageRole', 'controlPlane', 'deviceName', 'recoveryState'].map(k => [k, raw[k]]));
396
400
  const pendingBootstrap = raw.pendingBootstrap && typeof raw.pendingBootstrap === 'object' && !Array.isArray(raw.pendingBootstrap) ? raw.pendingBootstrap : {};
397
401
  if (typeof pendingBootstrap.requestId === 'string' && pendingBootstrap.requestId.length > 0 && pendingBootstrap.requestId.length <= 4096)
398
402
  status.pendingBootstrap = { requestId: pendingBootstrap.requestId };
@@ -411,25 +415,18 @@ export async function startRemotePlugin(ctx, config) {
411
415
  const previous = lastManagement && lastManagement.status.clusterId === status.clusterId ? record(lastManagement.catalog) : {};
412
416
  catalog = { ...previous, readAt: previous.readAt ?? 0, cached: true,
413
417
  members: Array.isArray(previous.members) ? previous.members.map(value => ({ ...record(value), online: null })) : [],
414
- instances: Array.isArray(previous.instances) ? previous.instances.map(value => ({ ...record(value), online: null })) : [],
415
- notificationSync: { state: 'unavailable' } };
418
+ };
416
419
  }
420
+ if (!stillReady())
421
+ throw fault('CLUSTER_UNAVAILABLE');
417
422
  lastManagement = { status, catalog };
418
423
  return { initialized: true, ...localInformation(), runtimeHealth: supervisor.health, status, catalog, ...(catalogError && { catalogError }) };
419
424
  }
420
425
  catch (error) {
421
- if (supervisor.initialized)
426
+ if (stillReady())
422
427
  throw error;
423
428
  }
424
429
  }
425
- if (lastManagement) {
426
- if (options?.watchCatalog)
427
- return { initialized: true, ...localInformation(), runtimeHealth: supervisor.health, status: lastManagement.status };
428
- const catalog = record(lastManagement.catalog);
429
- const instances = Array.isArray(catalog.instances) ? catalog.instances.map(value => ({ ...record(value), online: null })) : [];
430
- const members = Array.isArray(catalog.members) ? catalog.members.map(value => ({ ...record(value), online: null })) : [];
431
- return { initialized: true, ...localInformation(), runtimeHealth: supervisor.health, status: lastManagement.status, catalog: { ...catalog, readAt: catalog.readAt ?? 0, notificationSync: { state: 'unavailable' }, cached: true, members, instances, onlineInstanceIds: [] } };
432
- }
433
430
  return { initialized: false, ...localInformation(), initializationError: supervisor.initializationError && apiFailure(supervisor.initializationError), runtimeHealth: supervisor.health };
434
431
  },
435
432
  async control(operation, payload, requestId) {
@@ -509,7 +506,7 @@ export async function startRemotePlugin(ctx, config) {
509
506
  }
510
507
  try {
511
508
  const value = record(await json(req));
512
- reply(res, await runtime.openTarget({ clusterId: text(value.clusterId), deviceId: text(value.deviceId), instanceId: text(value.instanceId) }));
509
+ reply(res, await runtime.openTarget({ clusterId: text(value.clusterId), deviceId: text(value.deviceId) }));
513
510
  }
514
511
  catch (error) {
515
512
  respondFailure(res, error);
@@ -709,7 +706,9 @@ export async function startRemotePlugin(ctx, config) {
709
706
  return { helper, initialization };
710
707
  },
711
708
  });
712
- await supervisor.start();
709
+ // Start eagerly at plugin activation. Keep management/status available
710
+ // while initialization waits for tailcat and native storage readiness.
711
+ void supervisor.start().catch(error => ctx.logger.error(error));
713
712
  return runtime;
714
713
  }
715
714
  catch (error) {
@@ -27,8 +27,8 @@ export async function observeTrustStream(body, options) {
27
27
  }, 30_000);
28
28
  timer.unref();
29
29
  };
30
- // Silence after a complete snapshot is normal. Authority expiry is enforced
31
- // by DevicePolicy; health probes own process liveness independently.
30
+ // Silence after a complete snapshot is normal. Cached membership has no
31
+ // expiry; health probes own helper process liveness independently.
32
32
  awaitSnapshot();
33
33
  diagnostic('stream-observe-start');
34
34
  try {
@@ -60,8 +60,8 @@ export async function observeTrustStream(body, options) {
60
60
  break;
61
61
  const receiving = options.receive(JSON.parse(partial.slice(0, end)));
62
62
  const initialFrame = awaitingFrame;
63
- // A complete snapshot has arrived. Its locally enforced authority
64
- // budget remains independent of asynchronous notice attachment.
63
+ // A complete membership snapshot has arrived; asynchronous notice
64
+ // attachment does not control membership validity.
65
65
  awaitingFrame = false;
66
66
  clearTimeout(timer);
67
67
  await receiving;