@syengup/fridaynext-hermes-channel 0.1.0-beta.4 → 0.1.0-beta.7

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 (877) hide show
  1. package/README.md +2 -2
  2. package/install-config.js +22 -5
  3. package/install-host.py +95 -0
  4. package/install-runtime.js +158 -38
  5. package/install.js +19 -4
  6. package/package.json +5 -5
  7. package/plugin.bundle +0 -0
  8. package/validation.json +1 -0
  9. package/plugin/README.md +0 -21
  10. package/plugin/__init__.py +0 -3
  11. package/plugin/fridaynext_plugin/__init__.py +0 -81
  12. package/plugin/fridaynext_plugin/adapter.py +0 -1333
  13. package/plugin/fridaynext_plugin/agent_defaults.py +0 -107
  14. package/plugin/fridaynext_plugin/agent_management.py +0 -158
  15. package/plugin/fridaynext_plugin/canonical_control.py +0 -517
  16. package/plugin/fridaynext_plugin/compat_v0225.py +0 -2080
  17. package/plugin/fridaynext_plugin/continuations.py +0 -271
  18. package/plugin/fridaynext_plugin/control_cli.py +0 -101
  19. package/plugin/fridaynext_plugin/controls.py +0 -296
  20. package/plugin/fridaynext_plugin/delivery_context.py +0 -210
  21. package/plugin/fridaynext_plugin/device-tools-v1.json +0 -302
  22. package/plugin/fridaynext_plugin/device_tools.py +0 -144
  23. package/plugin/fridaynext_plugin/diagnostics.py +0 -165
  24. package/plugin/fridaynext_plugin/history.py +0 -443
  25. package/plugin/fridaynext_plugin/host.py +0 -320
  26. package/plugin/fridaynext_plugin/initial_settings.py +0 -184
  27. package/plugin/fridaynext_plugin/inline_media.py +0 -58
  28. package/plugin/fridaynext_plugin/media_input.py +0 -186
  29. package/plugin/fridaynext_plugin/media_observations.py +0 -172
  30. package/plugin/fridaynext_plugin/media_output.py +0 -277
  31. package/plugin/fridaynext_plugin/message_speech.py +0 -143
  32. package/plugin/fridaynext_plugin/multi_agent.py +0 -221
  33. package/plugin/fridaynext_plugin/recovery.py +0 -214
  34. package/plugin/fridaynext_plugin/reply_context.py +0 -39
  35. package/plugin/fridaynext_plugin/runtime_port.py +0 -593
  36. package/plugin/fridaynext_plugin/scheduled_tasks.py +0 -229
  37. package/plugin/fridaynext_plugin/sessions.py +0 -184
  38. package/plugin/fridaynext_plugin/settings.py +0 -699
  39. package/plugin/fridaynext_plugin/settings_control.py +0 -101
  40. package/plugin/fridaynext_plugin/slash_commands.py +0 -163
  41. package/plugin/fridaynext_plugin/state.py +0 -155
  42. package/plugin/fridaynext_plugin/stream_bridge.py +0 -550
  43. package/plugin/fridaynext_plugin/stream_media.py +0 -59
  44. package/plugin/fridaynext_plugin/stream_projection.py +0 -293
  45. package/plugin/fridaynext_plugin/subagents.py +0 -228
  46. package/plugin/plugin.yaml +0 -29
  47. package/plugin/runtime/dist/commands-routes.js +0 -94
  48. package/plugin/runtime/dist/device-tools-v1.json +0 -302
  49. package/plugin/runtime/dist/host-peer.js +0 -106
  50. package/plugin/runtime/dist/hosted-artifacts.js +0 -189
  51. package/plugin/runtime/dist/hosted-backend.js +0 -436
  52. package/plugin/runtime/dist/hosted-continuations.js +0 -41
  53. package/plugin/runtime/dist/hosted-delivery-observations.js +0 -91
  54. package/plugin/runtime/dist/hosted-device-tools.js +0 -82
  55. package/plugin/runtime/dist/hosted-media.js +0 -368
  56. package/plugin/runtime/dist/hosted-recovery.js +0 -55
  57. package/plugin/runtime/dist/hosted-settings.js +0 -26
  58. package/plugin/runtime/dist/hosted-stream.js +0 -214
  59. package/plugin/runtime/dist/hosted-subagents.js +0 -78
  60. package/plugin/runtime/dist/identity.js +0 -55
  61. package/plugin/runtime/dist/kit-contract.json +0 -1
  62. package/plugin/runtime/dist/media-transport.js +0 -168
  63. package/plugin/runtime/dist/oss-upload-worker.js +0 -7
  64. package/plugin/runtime/dist/oss-upload.js +0 -94
  65. package/plugin/runtime/dist/ownership.js +0 -21
  66. package/plugin/runtime/dist/platform-service.js +0 -36
  67. package/plugin/runtime/dist/plugin-control.js +0 -193
  68. package/plugin/runtime/dist/plugin-worker.js +0 -43
  69. package/plugin/runtime/dist/private-files.js +0 -24
  70. package/plugin/runtime/dist/process-lock.js +0 -40
  71. package/plugin/runtime/dist/public-config.js +0 -58
  72. package/plugin/runtime/dist/scheduled-routes.js +0 -63
  73. package/plugin/runtime/dist/service-errors.js +0 -11
  74. package/plugin/runtime/dist/service-host.js +0 -275
  75. package/plugin/runtime/dist/speech-routes.js +0 -111
  76. package/plugin/runtime/dist/tool-presentation.js +0 -399
  77. package/plugin/runtime/node_modules/.package-lock.json +0 -436
  78. package/plugin/runtime/node_modules/@noble/hashes/LICENSE +0 -21
  79. package/plugin/runtime/node_modules/@noble/hashes/README.md +0 -521
  80. package/plugin/runtime/node_modules/@noble/hashes/_assert.d.ts +0 -17
  81. package/plugin/runtime/node_modules/@noble/hashes/_assert.d.ts.map +0 -1
  82. package/plugin/runtime/node_modules/@noble/hashes/_assert.js +0 -18
  83. package/plugin/runtime/node_modules/@noble/hashes/_assert.js.map +0 -1
  84. package/plugin/runtime/node_modules/@noble/hashes/_blake.d.ts +0 -14
  85. package/plugin/runtime/node_modules/@noble/hashes/_blake.d.ts.map +0 -1
  86. package/plugin/runtime/node_modules/@noble/hashes/_blake.js +0 -50
  87. package/plugin/runtime/node_modules/@noble/hashes/_blake.js.map +0 -1
  88. package/plugin/runtime/node_modules/@noble/hashes/_md.d.ts +0 -51
  89. package/plugin/runtime/node_modules/@noble/hashes/_md.d.ts.map +0 -1
  90. package/plugin/runtime/node_modules/@noble/hashes/_md.js +0 -162
  91. package/plugin/runtime/node_modules/@noble/hashes/_md.js.map +0 -1
  92. package/plugin/runtime/node_modules/@noble/hashes/_u64.d.ts +0 -55
  93. package/plugin/runtime/node_modules/@noble/hashes/_u64.d.ts.map +0 -1
  94. package/plugin/runtime/node_modules/@noble/hashes/_u64.js +0 -90
  95. package/plugin/runtime/node_modules/@noble/hashes/_u64.js.map +0 -1
  96. package/plugin/runtime/node_modules/@noble/hashes/argon2.d.ts +0 -32
  97. package/plugin/runtime/node_modules/@noble/hashes/argon2.d.ts.map +0 -1
  98. package/plugin/runtime/node_modules/@noble/hashes/argon2.js +0 -401
  99. package/plugin/runtime/node_modules/@noble/hashes/argon2.js.map +0 -1
  100. package/plugin/runtime/node_modules/@noble/hashes/blake1.d.ts +0 -106
  101. package/plugin/runtime/node_modules/@noble/hashes/blake1.d.ts.map +0 -1
  102. package/plugin/runtime/node_modules/@noble/hashes/blake1.js +0 -459
  103. package/plugin/runtime/node_modules/@noble/hashes/blake1.js.map +0 -1
  104. package/plugin/runtime/node_modules/@noble/hashes/blake2.d.ts +0 -116
  105. package/plugin/runtime/node_modules/@noble/hashes/blake2.d.ts.map +0 -1
  106. package/plugin/runtime/node_modules/@noble/hashes/blake2.js +0 -420
  107. package/plugin/runtime/node_modules/@noble/hashes/blake2.js.map +0 -1
  108. package/plugin/runtime/node_modules/@noble/hashes/blake2b.d.ts +0 -11
  109. package/plugin/runtime/node_modules/@noble/hashes/blake2b.d.ts.map +0 -1
  110. package/plugin/runtime/node_modules/@noble/hashes/blake2b.js +0 -14
  111. package/plugin/runtime/node_modules/@noble/hashes/blake2b.js.map +0 -1
  112. package/plugin/runtime/node_modules/@noble/hashes/blake2s.d.ts +0 -20
  113. package/plugin/runtime/node_modules/@noble/hashes/blake2s.d.ts.map +0 -1
  114. package/plugin/runtime/node_modules/@noble/hashes/blake2s.js +0 -24
  115. package/plugin/runtime/node_modules/@noble/hashes/blake2s.js.map +0 -1
  116. package/plugin/runtime/node_modules/@noble/hashes/blake3.d.ts +0 -54
  117. package/plugin/runtime/node_modules/@noble/hashes/blake3.d.ts.map +0 -1
  118. package/plugin/runtime/node_modules/@noble/hashes/blake3.js +0 -255
  119. package/plugin/runtime/node_modules/@noble/hashes/blake3.js.map +0 -1
  120. package/plugin/runtime/node_modules/@noble/hashes/crypto.d.ts +0 -2
  121. package/plugin/runtime/node_modules/@noble/hashes/crypto.d.ts.map +0 -1
  122. package/plugin/runtime/node_modules/@noble/hashes/crypto.js +0 -5
  123. package/plugin/runtime/node_modules/@noble/hashes/crypto.js.map +0 -1
  124. package/plugin/runtime/node_modules/@noble/hashes/cryptoNode.d.ts +0 -2
  125. package/plugin/runtime/node_modules/@noble/hashes/cryptoNode.d.ts.map +0 -1
  126. package/plugin/runtime/node_modules/@noble/hashes/cryptoNode.js +0 -18
  127. package/plugin/runtime/node_modules/@noble/hashes/cryptoNode.js.map +0 -1
  128. package/plugin/runtime/node_modules/@noble/hashes/eskdf.d.ts +0 -47
  129. package/plugin/runtime/node_modules/@noble/hashes/eskdf.d.ts.map +0 -1
  130. package/plugin/runtime/node_modules/@noble/hashes/eskdf.js +0 -166
  131. package/plugin/runtime/node_modules/@noble/hashes/eskdf.js.map +0 -1
  132. package/plugin/runtime/node_modules/@noble/hashes/esm/_assert.d.ts +0 -17
  133. package/plugin/runtime/node_modules/@noble/hashes/esm/_assert.d.ts.map +0 -1
  134. package/plugin/runtime/node_modules/@noble/hashes/esm/_assert.js +0 -15
  135. package/plugin/runtime/node_modules/@noble/hashes/esm/_assert.js.map +0 -1
  136. package/plugin/runtime/node_modules/@noble/hashes/esm/_blake.d.ts +0 -14
  137. package/plugin/runtime/node_modules/@noble/hashes/esm/_blake.d.ts.map +0 -1
  138. package/plugin/runtime/node_modules/@noble/hashes/esm/_blake.js +0 -45
  139. package/plugin/runtime/node_modules/@noble/hashes/esm/_blake.js.map +0 -1
  140. package/plugin/runtime/node_modules/@noble/hashes/esm/_md.d.ts +0 -51
  141. package/plugin/runtime/node_modules/@noble/hashes/esm/_md.d.ts.map +0 -1
  142. package/plugin/runtime/node_modules/@noble/hashes/esm/_md.js +0 -155
  143. package/plugin/runtime/node_modules/@noble/hashes/esm/_md.js.map +0 -1
  144. package/plugin/runtime/node_modules/@noble/hashes/esm/_u64.d.ts +0 -55
  145. package/plugin/runtime/node_modules/@noble/hashes/esm/_u64.d.ts.map +0 -1
  146. package/plugin/runtime/node_modules/@noble/hashes/esm/_u64.js +0 -67
  147. package/plugin/runtime/node_modules/@noble/hashes/esm/_u64.js.map +0 -1
  148. package/plugin/runtime/node_modules/@noble/hashes/esm/argon2.d.ts +0 -32
  149. package/plugin/runtime/node_modules/@noble/hashes/esm/argon2.d.ts.map +0 -1
  150. package/plugin/runtime/node_modules/@noble/hashes/esm/argon2.js +0 -392
  151. package/plugin/runtime/node_modules/@noble/hashes/esm/argon2.js.map +0 -1
  152. package/plugin/runtime/node_modules/@noble/hashes/esm/blake1.d.ts +0 -106
  153. package/plugin/runtime/node_modules/@noble/hashes/esm/blake1.d.ts.map +0 -1
  154. package/plugin/runtime/node_modules/@noble/hashes/esm/blake1.js +0 -452
  155. package/plugin/runtime/node_modules/@noble/hashes/esm/blake1.js.map +0 -1
  156. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2.d.ts +0 -116
  157. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2.d.ts.map +0 -1
  158. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2.js +0 -413
  159. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2.js.map +0 -1
  160. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2b.d.ts +0 -11
  161. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2b.d.ts.map +0 -1
  162. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2b.js +0 -11
  163. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2b.js.map +0 -1
  164. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2s.d.ts +0 -20
  165. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2s.d.ts.map +0 -1
  166. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2s.js +0 -21
  167. package/plugin/runtime/node_modules/@noble/hashes/esm/blake2s.js.map +0 -1
  168. package/plugin/runtime/node_modules/@noble/hashes/esm/blake3.d.ts +0 -54
  169. package/plugin/runtime/node_modules/@noble/hashes/esm/blake3.d.ts.map +0 -1
  170. package/plugin/runtime/node_modules/@noble/hashes/esm/blake3.js +0 -251
  171. package/plugin/runtime/node_modules/@noble/hashes/esm/blake3.js.map +0 -1
  172. package/plugin/runtime/node_modules/@noble/hashes/esm/crypto.d.ts +0 -2
  173. package/plugin/runtime/node_modules/@noble/hashes/esm/crypto.d.ts.map +0 -1
  174. package/plugin/runtime/node_modules/@noble/hashes/esm/crypto.js +0 -2
  175. package/plugin/runtime/node_modules/@noble/hashes/esm/crypto.js.map +0 -1
  176. package/plugin/runtime/node_modules/@noble/hashes/esm/cryptoNode.d.ts +0 -2
  177. package/plugin/runtime/node_modules/@noble/hashes/esm/cryptoNode.d.ts.map +0 -1
  178. package/plugin/runtime/node_modules/@noble/hashes/esm/cryptoNode.js +0 -15
  179. package/plugin/runtime/node_modules/@noble/hashes/esm/cryptoNode.js.map +0 -1
  180. package/plugin/runtime/node_modules/@noble/hashes/esm/eskdf.d.ts +0 -47
  181. package/plugin/runtime/node_modules/@noble/hashes/esm/eskdf.d.ts.map +0 -1
  182. package/plugin/runtime/node_modules/@noble/hashes/esm/eskdf.js +0 -160
  183. package/plugin/runtime/node_modules/@noble/hashes/esm/eskdf.js.map +0 -1
  184. package/plugin/runtime/node_modules/@noble/hashes/esm/hkdf.d.ts +0 -36
  185. package/plugin/runtime/node_modules/@noble/hashes/esm/hkdf.d.ts.map +0 -1
  186. package/plugin/runtime/node_modules/@noble/hashes/esm/hkdf.js +0 -82
  187. package/plugin/runtime/node_modules/@noble/hashes/esm/hkdf.js.map +0 -1
  188. package/plugin/runtime/node_modules/@noble/hashes/esm/hmac.d.ts +0 -35
  189. package/plugin/runtime/node_modules/@noble/hashes/esm/hmac.d.ts.map +0 -1
  190. package/plugin/runtime/node_modules/@noble/hashes/esm/hmac.js +0 -86
  191. package/plugin/runtime/node_modules/@noble/hashes/esm/hmac.js.map +0 -1
  192. package/plugin/runtime/node_modules/@noble/hashes/esm/index.d.ts +0 -2
  193. package/plugin/runtime/node_modules/@noble/hashes/esm/index.d.ts.map +0 -1
  194. package/plugin/runtime/node_modules/@noble/hashes/esm/index.js +0 -33
  195. package/plugin/runtime/node_modules/@noble/hashes/esm/index.js.map +0 -1
  196. package/plugin/runtime/node_modules/@noble/hashes/esm/legacy.d.ts +0 -71
  197. package/plugin/runtime/node_modules/@noble/hashes/esm/legacy.d.ts.map +0 -1
  198. package/plugin/runtime/node_modules/@noble/hashes/esm/legacy.js +0 -281
  199. package/plugin/runtime/node_modules/@noble/hashes/esm/legacy.js.map +0 -1
  200. package/plugin/runtime/node_modules/@noble/hashes/esm/package.json +0 -10
  201. package/plugin/runtime/node_modules/@noble/hashes/esm/pbkdf2.d.ts +0 -23
  202. package/plugin/runtime/node_modules/@noble/hashes/esm/pbkdf2.d.ts.map +0 -1
  203. package/plugin/runtime/node_modules/@noble/hashes/esm/pbkdf2.js +0 -97
  204. package/plugin/runtime/node_modules/@noble/hashes/esm/pbkdf2.js.map +0 -1
  205. package/plugin/runtime/node_modules/@noble/hashes/esm/ripemd160.d.ts +0 -13
  206. package/plugin/runtime/node_modules/@noble/hashes/esm/ripemd160.d.ts.map +0 -1
  207. package/plugin/runtime/node_modules/@noble/hashes/esm/ripemd160.js +0 -13
  208. package/plugin/runtime/node_modules/@noble/hashes/esm/ripemd160.js.map +0 -1
  209. package/plugin/runtime/node_modules/@noble/hashes/esm/scrypt.d.ts +0 -34
  210. package/plugin/runtime/node_modules/@noble/hashes/esm/scrypt.d.ts.map +0 -1
  211. package/plugin/runtime/node_modules/@noble/hashes/esm/scrypt.js +0 -228
  212. package/plugin/runtime/node_modules/@noble/hashes/esm/scrypt.js.map +0 -1
  213. package/plugin/runtime/node_modules/@noble/hashes/esm/sha1.d.ts +0 -11
  214. package/plugin/runtime/node_modules/@noble/hashes/esm/sha1.d.ts.map +0 -1
  215. package/plugin/runtime/node_modules/@noble/hashes/esm/sha1.js +0 -11
  216. package/plugin/runtime/node_modules/@noble/hashes/esm/sha1.js.map +0 -1
  217. package/plugin/runtime/node_modules/@noble/hashes/esm/sha2.d.ts +0 -159
  218. package/plugin/runtime/node_modules/@noble/hashes/esm/sha2.d.ts.map +0 -1
  219. package/plugin/runtime/node_modules/@noble/hashes/esm/sha2.js +0 -375
  220. package/plugin/runtime/node_modules/@noble/hashes/esm/sha2.js.map +0 -1
  221. package/plugin/runtime/node_modules/@noble/hashes/esm/sha256.d.ts +0 -20
  222. package/plugin/runtime/node_modules/@noble/hashes/esm/sha256.d.ts.map +0 -1
  223. package/plugin/runtime/node_modules/@noble/hashes/esm/sha256.js +0 -20
  224. package/plugin/runtime/node_modules/@noble/hashes/esm/sha256.js.map +0 -1
  225. package/plugin/runtime/node_modules/@noble/hashes/esm/sha3-addons.d.ts +0 -142
  226. package/plugin/runtime/node_modules/@noble/hashes/esm/sha3-addons.d.ts.map +0 -1
  227. package/plugin/runtime/node_modules/@noble/hashes/esm/sha3-addons.js +0 -393
  228. package/plugin/runtime/node_modules/@noble/hashes/esm/sha3-addons.js.map +0 -1
  229. package/plugin/runtime/node_modules/@noble/hashes/esm/sha3.d.ts +0 -53
  230. package/plugin/runtime/node_modules/@noble/hashes/esm/sha3.d.ts.map +0 -1
  231. package/plugin/runtime/node_modules/@noble/hashes/esm/sha3.js +0 -234
  232. package/plugin/runtime/node_modules/@noble/hashes/esm/sha3.js.map +0 -1
  233. package/plugin/runtime/node_modules/@noble/hashes/esm/sha512.d.ts +0 -26
  234. package/plugin/runtime/node_modules/@noble/hashes/esm/sha512.d.ts.map +0 -1
  235. package/plugin/runtime/node_modules/@noble/hashes/esm/sha512.js +0 -26
  236. package/plugin/runtime/node_modules/@noble/hashes/esm/sha512.js.map +0 -1
  237. package/plugin/runtime/node_modules/@noble/hashes/esm/utils.d.ts +0 -161
  238. package/plugin/runtime/node_modules/@noble/hashes/esm/utils.d.ts.map +0 -1
  239. package/plugin/runtime/node_modules/@noble/hashes/esm/utils.js +0 -281
  240. package/plugin/runtime/node_modules/@noble/hashes/esm/utils.js.map +0 -1
  241. package/plugin/runtime/node_modules/@noble/hashes/hkdf.d.ts +0 -36
  242. package/plugin/runtime/node_modules/@noble/hashes/hkdf.d.ts.map +0 -1
  243. package/plugin/runtime/node_modules/@noble/hashes/hkdf.js +0 -88
  244. package/plugin/runtime/node_modules/@noble/hashes/hkdf.js.map +0 -1
  245. package/plugin/runtime/node_modules/@noble/hashes/hmac.d.ts +0 -35
  246. package/plugin/runtime/node_modules/@noble/hashes/hmac.d.ts.map +0 -1
  247. package/plugin/runtime/node_modules/@noble/hashes/hmac.js +0 -91
  248. package/plugin/runtime/node_modules/@noble/hashes/hmac.js.map +0 -1
  249. package/plugin/runtime/node_modules/@noble/hashes/index.d.ts +0 -1
  250. package/plugin/runtime/node_modules/@noble/hashes/index.d.ts.map +0 -1
  251. package/plugin/runtime/node_modules/@noble/hashes/index.js +0 -33
  252. package/plugin/runtime/node_modules/@noble/hashes/index.js.map +0 -1
  253. package/plugin/runtime/node_modules/@noble/hashes/legacy.d.ts +0 -71
  254. package/plugin/runtime/node_modules/@noble/hashes/legacy.d.ts.map +0 -1
  255. package/plugin/runtime/node_modules/@noble/hashes/legacy.js +0 -287
  256. package/plugin/runtime/node_modules/@noble/hashes/legacy.js.map +0 -1
  257. package/plugin/runtime/node_modules/@noble/hashes/package.json +0 -266
  258. package/plugin/runtime/node_modules/@noble/hashes/pbkdf2.d.ts +0 -23
  259. package/plugin/runtime/node_modules/@noble/hashes/pbkdf2.d.ts.map +0 -1
  260. package/plugin/runtime/node_modules/@noble/hashes/pbkdf2.js +0 -101
  261. package/plugin/runtime/node_modules/@noble/hashes/pbkdf2.js.map +0 -1
  262. package/plugin/runtime/node_modules/@noble/hashes/ripemd160.d.ts +0 -13
  263. package/plugin/runtime/node_modules/@noble/hashes/ripemd160.d.ts.map +0 -1
  264. package/plugin/runtime/node_modules/@noble/hashes/ripemd160.js +0 -16
  265. package/plugin/runtime/node_modules/@noble/hashes/ripemd160.js.map +0 -1
  266. package/plugin/runtime/node_modules/@noble/hashes/scrypt.d.ts +0 -34
  267. package/plugin/runtime/node_modules/@noble/hashes/scrypt.d.ts.map +0 -1
  268. package/plugin/runtime/node_modules/@noble/hashes/scrypt.js +0 -232
  269. package/plugin/runtime/node_modules/@noble/hashes/scrypt.js.map +0 -1
  270. package/plugin/runtime/node_modules/@noble/hashes/sha1.d.ts +0 -11
  271. package/plugin/runtime/node_modules/@noble/hashes/sha1.d.ts.map +0 -1
  272. package/plugin/runtime/node_modules/@noble/hashes/sha1.js +0 -14
  273. package/plugin/runtime/node_modules/@noble/hashes/sha1.js.map +0 -1
  274. package/plugin/runtime/node_modules/@noble/hashes/sha2.d.ts +0 -159
  275. package/plugin/runtime/node_modules/@noble/hashes/sha2.d.ts.map +0 -1
  276. package/plugin/runtime/node_modules/@noble/hashes/sha2.js +0 -384
  277. package/plugin/runtime/node_modules/@noble/hashes/sha2.js.map +0 -1
  278. package/plugin/runtime/node_modules/@noble/hashes/sha256.d.ts +0 -20
  279. package/plugin/runtime/node_modules/@noble/hashes/sha256.d.ts.map +0 -1
  280. package/plugin/runtime/node_modules/@noble/hashes/sha256.js +0 -23
  281. package/plugin/runtime/node_modules/@noble/hashes/sha256.js.map +0 -1
  282. package/plugin/runtime/node_modules/@noble/hashes/sha3-addons.d.ts +0 -142
  283. package/plugin/runtime/node_modules/@noble/hashes/sha3-addons.d.ts.map +0 -1
  284. package/plugin/runtime/node_modules/@noble/hashes/sha3-addons.js +0 -402
  285. package/plugin/runtime/node_modules/@noble/hashes/sha3-addons.js.map +0 -1
  286. package/plugin/runtime/node_modules/@noble/hashes/sha3.d.ts +0 -53
  287. package/plugin/runtime/node_modules/@noble/hashes/sha3.d.ts.map +0 -1
  288. package/plugin/runtime/node_modules/@noble/hashes/sha3.js +0 -239
  289. package/plugin/runtime/node_modules/@noble/hashes/sha3.js.map +0 -1
  290. package/plugin/runtime/node_modules/@noble/hashes/sha512.d.ts +0 -26
  291. package/plugin/runtime/node_modules/@noble/hashes/sha512.d.ts.map +0 -1
  292. package/plugin/runtime/node_modules/@noble/hashes/sha512.js +0 -29
  293. package/plugin/runtime/node_modules/@noble/hashes/sha512.js.map +0 -1
  294. package/plugin/runtime/node_modules/@noble/hashes/src/_assert.ts +0 -22
  295. package/plugin/runtime/node_modules/@noble/hashes/src/_blake.ts +0 -50
  296. package/plugin/runtime/node_modules/@noble/hashes/src/_md.ts +0 -176
  297. package/plugin/runtime/node_modules/@noble/hashes/src/_u64.ts +0 -91
  298. package/plugin/runtime/node_modules/@noble/hashes/src/argon2.ts +0 -497
  299. package/plugin/runtime/node_modules/@noble/hashes/src/blake1.ts +0 -534
  300. package/plugin/runtime/node_modules/@noble/hashes/src/blake2.ts +0 -486
  301. package/plugin/runtime/node_modules/@noble/hashes/src/blake2b.ts +0 -10
  302. package/plugin/runtime/node_modules/@noble/hashes/src/blake2s.ts +0 -20
  303. package/plugin/runtime/node_modules/@noble/hashes/src/blake3.ts +0 -272
  304. package/plugin/runtime/node_modules/@noble/hashes/src/crypto.ts +0 -9
  305. package/plugin/runtime/node_modules/@noble/hashes/src/cryptoNode.ts +0 -15
  306. package/plugin/runtime/node_modules/@noble/hashes/src/eskdf.ts +0 -187
  307. package/plugin/runtime/node_modules/@noble/hashes/src/hkdf.ts +0 -88
  308. package/plugin/runtime/node_modules/@noble/hashes/src/hmac.ts +0 -94
  309. package/plugin/runtime/node_modules/@noble/hashes/src/index.ts +0 -31
  310. package/plugin/runtime/node_modules/@noble/hashes/src/legacy.ts +0 -293
  311. package/plugin/runtime/node_modules/@noble/hashes/src/pbkdf2.ts +0 -122
  312. package/plugin/runtime/node_modules/@noble/hashes/src/ripemd160.ts +0 -12
  313. package/plugin/runtime/node_modules/@noble/hashes/src/scrypt.ts +0 -257
  314. package/plugin/runtime/node_modules/@noble/hashes/src/sha1.ts +0 -10
  315. package/plugin/runtime/node_modules/@noble/hashes/src/sha2.ts +0 -402
  316. package/plugin/runtime/node_modules/@noble/hashes/src/sha256.ts +0 -24
  317. package/plugin/runtime/node_modules/@noble/hashes/src/sha3-addons.ts +0 -499
  318. package/plugin/runtime/node_modules/@noble/hashes/src/sha3.ts +0 -258
  319. package/plugin/runtime/node_modules/@noble/hashes/src/sha512.ts +0 -34
  320. package/plugin/runtime/node_modules/@noble/hashes/src/utils.ts +0 -395
  321. package/plugin/runtime/node_modules/@noble/hashes/utils.d.ts +0 -161
  322. package/plugin/runtime/node_modules/@noble/hashes/utils.d.ts.map +0 -1
  323. package/plugin/runtime/node_modules/@noble/hashes/utils.js +0 -313
  324. package/plugin/runtime/node_modules/@noble/hashes/utils.js.map +0 -1
  325. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/API.md +0 -536
  326. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/LICENSE +0 -21
  327. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/README.md +0 -97
  328. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attachment/store.d.ts +0 -57
  329. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attachment/store.js +0 -618
  330. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attest/attest-gate.d.ts +0 -29
  331. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attest/attest-gate.js +0 -58
  332. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attest/attest-key-prune.d.ts +0 -17
  333. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attest/attest-key-prune.js +0 -37
  334. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attest/attest-store.d.ts +0 -27
  335. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attest/attest-store.js +0 -146
  336. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attest/verifier.d.ts +0 -1
  337. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/attest/verifier.js +0 -2
  338. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/delivery-observations.d.ts +0 -38
  339. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/delivery-observations.js +0 -85
  340. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/history.d.ts +0 -89
  341. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/history.js +0 -179
  342. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/operations.d.ts +0 -136
  343. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/operations.js +0 -105
  344. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/pairing-codec.d.ts +0 -39
  345. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/pairing-codec.js +0 -233
  346. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/reconciliation.d.ts +0 -6
  347. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/reconciliation.js +0 -17
  348. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/settings-schema.d.ts +0 -3
  349. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/settings-schema.js +0 -45
  350. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/tool-presentation.d.ts +0 -10
  351. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/tool-presentation.js +0 -2
  352. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/types.d.ts +0 -259
  353. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/types.js +0 -33
  354. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/work-context.d.ts +0 -56
  355. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/contract/work-context.js +0 -60
  356. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/device-request/coordinator.d.ts +0 -19
  357. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/device-request/coordinator.js +0 -113
  358. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/device-request/pending-store.d.ts +0 -37
  359. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/device-request/pending-store.js +0 -67
  360. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/device-request/results.d.ts +0 -14
  361. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/device-request/results.js +0 -39
  362. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/index.d.ts +0 -21
  363. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/index.js +0 -20
  364. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/link-preview/og-parse.d.ts +0 -21
  365. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/link-preview/og-parse.js +0 -234
  366. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/link-preview/preview-service.d.ts +0 -39
  367. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/link-preview/preview-service.js +0 -232
  368. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/link-preview/ssrf-guard.d.ts +0 -52
  369. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/link-preview/ssrf-guard.js +0 -236
  370. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/prompt-capsules/capsules-store.d.ts +0 -38
  371. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/prompt-capsules/capsules-store.js +0 -149
  372. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/attachment-crypto.d.ts +0 -4
  373. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/attachment-crypto.js +0 -73
  374. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/cert-selfsign.d.ts +0 -6
  375. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/cert-selfsign.js +0 -88
  376. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/filter-proxy.d.ts +0 -17
  377. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/filter-proxy.js +0 -231
  378. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/frpc-manager.d.ts +0 -76
  379. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/frpc-manager.js +0 -1332
  380. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/oss-transfer.d.ts +0 -43
  381. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/oss-transfer.js +0 -280
  382. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/pairing-voucher.d.ts +0 -13
  383. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/pairing-voucher.js +0 -58
  384. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/private-file.d.ts +0 -2
  385. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/private-file.js +0 -11
  386. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/standby-loop-guard.d.ts +0 -9
  387. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/standby-loop-guard.js +0 -24
  388. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/tls-identity.d.ts +0 -36
  389. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/tls-identity.js +0 -151
  390. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/tunnel-watchdog-policy.d.ts +0 -24
  391. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/public-access/tunnel-watchdog-policy.js +0 -49
  392. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/push/push-runtime.d.ts +0 -45
  393. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/push/push-runtime.js +0 -233
  394. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/push/relay-transport.d.ts +0 -8
  395. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/push/relay-transport.js +0 -27
  396. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/canonical-update-batcher.d.ts +0 -26
  397. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/canonical-update-batcher.js +0 -112
  398. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/channel-kernel.d.ts +0 -52
  399. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/channel-kernel.js +0 -332
  400. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/channel-runtime.d.ts +0 -2
  401. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/channel-runtime.js +0 -2
  402. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/delivery-observation-publisher.d.ts +0 -43
  403. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/delivery-observation-publisher.js +0 -211
  404. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/durable-run-store.d.ts +0 -264
  405. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/durable-run-store.js +0 -1661
  406. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/runner.d.ts +0 -37
  407. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/runner.js +0 -319
  408. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/scheduler.d.ts +0 -13
  409. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/scheduler.js +0 -130
  410. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/work-context.d.ts +0 -13
  411. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/runtime/work-context.js +0 -73
  412. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/server-name/server-name-store.d.ts +0 -21
  413. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/server-name/server-name-store.js +0 -52
  414. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/service/channel-service.d.ts +0 -38
  415. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/service/channel-service.js +0 -266
  416. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/service/infrastructure.d.ts +0 -87
  417. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/service/infrastructure.js +0 -179
  418. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/testing/contract-harness.d.ts +0 -25
  419. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/testing/contract-harness.js +0 -44
  420. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/testing/reference-adapter.d.ts +0 -39
  421. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/testing/reference-adapter.js +0 -76
  422. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/testing/weaknet-server.d.ts +0 -6
  423. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/testing/weaknet-server.js +0 -130
  424. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/attest.d.ts +0 -39
  425. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/attest.js +0 -114
  426. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/body.d.ts +0 -2
  427. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/body.js +0 -24
  428. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/command-lifecycle.d.ts +0 -47
  429. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/command-lifecycle.js +0 -184
  430. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/controls.d.ts +0 -9
  431. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/controls.js +0 -123
  432. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/files-download.d.ts +0 -18
  433. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/files-download.js +0 -197
  434. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/files-upload.d.ts +0 -20
  435. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/files-upload.js +0 -227
  436. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/link-preview.d.ts +0 -15
  437. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/link-preview.js +0 -45
  438. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/messages.d.ts +0 -10
  439. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/messages.js +0 -111
  440. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/operations.d.ts +0 -13
  441. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/operations.js +0 -336
  442. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/pairing.d.ts +0 -22
  443. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/pairing.js +0 -138
  444. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/prompt-capsules.d.ts +0 -8
  445. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/prompt-capsules.js +0 -65
  446. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/push.d.ts +0 -13
  447. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/push.js +0 -65
  448. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/runtime.d.ts +0 -51
  449. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/runtime.js +0 -442
  450. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/server-name.d.ts +0 -8
  451. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/server-name.js +0 -43
  452. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/session-settings.d.ts +0 -5
  453. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/session-settings.js +0 -153
  454. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/sessions.d.ts +0 -20
  455. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/dist/transport/sessions.js +0 -118
  456. package/plugin/runtime/node_modules/@syengup/fridaynext-channel-kit/package.json +0 -39
  457. package/plugin/runtime/node_modules/ansi-regex/index.d.ts +0 -37
  458. package/plugin/runtime/node_modules/ansi-regex/index.js +0 -10
  459. package/plugin/runtime/node_modules/ansi-regex/license +0 -9
  460. package/plugin/runtime/node_modules/ansi-regex/package.json +0 -55
  461. package/plugin/runtime/node_modules/ansi-regex/readme.md +0 -78
  462. package/plugin/runtime/node_modules/ansi-styles/index.d.ts +0 -345
  463. package/plugin/runtime/node_modules/ansi-styles/index.js +0 -163
  464. package/plugin/runtime/node_modules/ansi-styles/license +0 -9
  465. package/plugin/runtime/node_modules/ansi-styles/package.json +0 -56
  466. package/plugin/runtime/node_modules/ansi-styles/readme.md +0 -152
  467. package/plugin/runtime/node_modules/asn1js/LICENSE +0 -30
  468. package/plugin/runtime/node_modules/asn1js/README.md +0 -222
  469. package/plugin/runtime/node_modules/asn1js/build/index.d.ts +0 -1412
  470. package/plugin/runtime/node_modules/asn1js/build/index.es.js +0 -3705
  471. package/plugin/runtime/node_modules/asn1js/build/index.js +0 -3773
  472. package/plugin/runtime/node_modules/asn1js/package.json +0 -89
  473. package/plugin/runtime/node_modules/bytestreamjs/LICENSE +0 -29
  474. package/plugin/runtime/node_modules/bytestreamjs/README.MD +0 -196
  475. package/plugin/runtime/node_modules/bytestreamjs/build/cjs/bit.js +0 -91
  476. package/plugin/runtime/node_modules/bytestreamjs/build/cjs/bit_stream.js +0 -400
  477. package/plugin/runtime/node_modules/bytestreamjs/build/cjs/byte_stream.js +0 -648
  478. package/plugin/runtime/node_modules/bytestreamjs/build/cjs/helpers.js +0 -59
  479. package/plugin/runtime/node_modules/bytestreamjs/build/cjs/index.js +0 -21
  480. package/plugin/runtime/node_modules/bytestreamjs/build/cjs/seq_bit_stream.js +0 -114
  481. package/plugin/runtime/node_modules/bytestreamjs/build/cjs/seq_stream.js +0 -437
  482. package/plugin/runtime/node_modules/bytestreamjs/build/mjs/bit.js +0 -88
  483. package/plugin/runtime/node_modules/bytestreamjs/build/mjs/bit_stream.js +0 -396
  484. package/plugin/runtime/node_modules/bytestreamjs/build/mjs/byte_stream.js +0 -644
  485. package/plugin/runtime/node_modules/bytestreamjs/build/mjs/helpers.js +0 -55
  486. package/plugin/runtime/node_modules/bytestreamjs/build/mjs/index.js +0 -5
  487. package/plugin/runtime/node_modules/bytestreamjs/build/mjs/seq_bit_stream.js +0 -110
  488. package/plugin/runtime/node_modules/bytestreamjs/build/mjs/seq_stream.js +0 -433
  489. package/plugin/runtime/node_modules/bytestreamjs/build/types/bit.d.ts +0 -1
  490. package/plugin/runtime/node_modules/bytestreamjs/build/types/bit_stream.d.ts +0 -222
  491. package/plugin/runtime/node_modules/bytestreamjs/build/types/byte_stream.d.ts +0 -292
  492. package/plugin/runtime/node_modules/bytestreamjs/build/types/helpers.d.ts +0 -23
  493. package/plugin/runtime/node_modules/bytestreamjs/build/types/index.d.ts +0 -5
  494. package/plugin/runtime/node_modules/bytestreamjs/build/types/seq_bit_stream.d.ts +0 -47
  495. package/plugin/runtime/node_modules/bytestreamjs/build/types/seq_stream.d.ts +0 -255
  496. package/plugin/runtime/node_modules/bytestreamjs/package.json +0 -66
  497. package/plugin/runtime/node_modules/camelcase/index.d.ts +0 -63
  498. package/plugin/runtime/node_modules/camelcase/index.js +0 -76
  499. package/plugin/runtime/node_modules/camelcase/license +0 -9
  500. package/plugin/runtime/node_modules/camelcase/package.json +0 -43
  501. package/plugin/runtime/node_modules/camelcase/readme.md +0 -99
  502. package/plugin/runtime/node_modules/cbor/LICENSE.md +0 -20
  503. package/plugin/runtime/node_modules/cbor/README.md +0 -282
  504. package/plugin/runtime/node_modules/cbor/lib/cbor.js +0 -114
  505. package/plugin/runtime/node_modules/cbor/lib/commented.js +0 -382
  506. package/plugin/runtime/node_modules/cbor/lib/constants.js +0 -79
  507. package/plugin/runtime/node_modules/cbor/lib/decoder.js +0 -680
  508. package/plugin/runtime/node_modules/cbor/lib/diagnose.js +0 -274
  509. package/plugin/runtime/node_modules/cbor/lib/encoder.js +0 -1121
  510. package/plugin/runtime/node_modules/cbor/lib/map.js +0 -185
  511. package/plugin/runtime/node_modules/cbor/lib/objectRecorder.js +0 -71
  512. package/plugin/runtime/node_modules/cbor/lib/sharedValueEncoder.js +0 -141
  513. package/plugin/runtime/node_modules/cbor/lib/simple.js +0 -104
  514. package/plugin/runtime/node_modules/cbor/lib/tagged.js +0 -378
  515. package/plugin/runtime/node_modules/cbor/lib/utils.js +0 -308
  516. package/plugin/runtime/node_modules/cbor/package.json +0 -47
  517. package/plugin/runtime/node_modules/cbor/types/lib/cbor.d.ts +0 -34
  518. package/plugin/runtime/node_modules/cbor/types/lib/commented.d.ts +0 -109
  519. package/plugin/runtime/node_modules/cbor/types/lib/constants.d.ts +0 -63
  520. package/plugin/runtime/node_modules/cbor/types/lib/decoder.d.ts +0 -199
  521. package/plugin/runtime/node_modules/cbor/types/lib/diagnose.d.ts +0 -91
  522. package/plugin/runtime/node_modules/cbor/types/lib/encoder.d.ts +0 -477
  523. package/plugin/runtime/node_modules/cbor/types/lib/map.d.ts +0 -78
  524. package/plugin/runtime/node_modules/cbor/types/lib/objectRecorder.d.ts +0 -36
  525. package/plugin/runtime/node_modules/cbor/types/lib/sharedValueEncoder.d.ts +0 -21
  526. package/plugin/runtime/node_modules/cbor/types/lib/simple.d.ts +0 -47
  527. package/plugin/runtime/node_modules/cbor/types/lib/tagged.d.ts +0 -74
  528. package/plugin/runtime/node_modules/cbor/types/lib/utils.d.ts +0 -20
  529. package/plugin/runtime/node_modules/cbor/types/vendor/binary-parse-stream/index.d.ts +0 -34
  530. package/plugin/runtime/node_modules/cbor/vendor/binary-parse-stream/README.md +0 -49
  531. package/plugin/runtime/node_modules/cbor/vendor/binary-parse-stream/index.js +0 -111
  532. package/plugin/runtime/node_modules/cliui/CHANGELOG.md +0 -76
  533. package/plugin/runtime/node_modules/cliui/LICENSE.txt +0 -14
  534. package/plugin/runtime/node_modules/cliui/README.md +0 -115
  535. package/plugin/runtime/node_modules/cliui/index.js +0 -354
  536. package/plugin/runtime/node_modules/cliui/package.json +0 -65
  537. package/plugin/runtime/node_modules/color-convert/CHANGELOG.md +0 -54
  538. package/plugin/runtime/node_modules/color-convert/LICENSE +0 -21
  539. package/plugin/runtime/node_modules/color-convert/README.md +0 -68
  540. package/plugin/runtime/node_modules/color-convert/conversions.js +0 -839
  541. package/plugin/runtime/node_modules/color-convert/index.js +0 -81
  542. package/plugin/runtime/node_modules/color-convert/package.json +0 -48
  543. package/plugin/runtime/node_modules/color-convert/route.js +0 -97
  544. package/plugin/runtime/node_modules/color-name/LICENSE +0 -8
  545. package/plugin/runtime/node_modules/color-name/README.md +0 -11
  546. package/plugin/runtime/node_modules/color-name/index.js +0 -152
  547. package/plugin/runtime/node_modules/color-name/package.json +0 -28
  548. package/plugin/runtime/node_modules/decamelize/index.js +0 -13
  549. package/plugin/runtime/node_modules/decamelize/license +0 -21
  550. package/plugin/runtime/node_modules/decamelize/package.json +0 -38
  551. package/plugin/runtime/node_modules/decamelize/readme.md +0 -48
  552. package/plugin/runtime/node_modules/dijkstrajs/.travis.yml +0 -4
  553. package/plugin/runtime/node_modules/dijkstrajs/CONTRIBUTING.md +0 -8
  554. package/plugin/runtime/node_modules/dijkstrajs/LICENSE.md +0 -19
  555. package/plugin/runtime/node_modules/dijkstrajs/README.md +0 -18
  556. package/plugin/runtime/node_modules/dijkstrajs/dijkstra.js +0 -165
  557. package/plugin/runtime/node_modules/dijkstrajs/package.json +0 -60
  558. package/plugin/runtime/node_modules/dijkstrajs/test/dijkstra.test.js +0 -96
  559. package/plugin/runtime/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
  560. package/plugin/runtime/node_modules/emoji-regex/README.md +0 -73
  561. package/plugin/runtime/node_modules/emoji-regex/es2015/index.js +0 -6
  562. package/plugin/runtime/node_modules/emoji-regex/es2015/text.js +0 -6
  563. package/plugin/runtime/node_modules/emoji-regex/index.d.ts +0 -23
  564. package/plugin/runtime/node_modules/emoji-regex/index.js +0 -6
  565. package/plugin/runtime/node_modules/emoji-regex/package.json +0 -50
  566. package/plugin/runtime/node_modules/emoji-regex/text.js +0 -6
  567. package/plugin/runtime/node_modules/find-up/index.d.ts +0 -137
  568. package/plugin/runtime/node_modules/find-up/index.js +0 -89
  569. package/plugin/runtime/node_modules/find-up/license +0 -9
  570. package/plugin/runtime/node_modules/find-up/package.json +0 -53
  571. package/plugin/runtime/node_modules/find-up/readme.md +0 -156
  572. package/plugin/runtime/node_modules/get-caller-file/LICENSE.md +0 -6
  573. package/plugin/runtime/node_modules/get-caller-file/README.md +0 -41
  574. package/plugin/runtime/node_modules/get-caller-file/index.d.ts +0 -2
  575. package/plugin/runtime/node_modules/get-caller-file/index.js +0 -22
  576. package/plugin/runtime/node_modules/get-caller-file/index.js.map +0 -1
  577. package/plugin/runtime/node_modules/get-caller-file/package.json +0 -42
  578. package/plugin/runtime/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  579. package/plugin/runtime/node_modules/is-fullwidth-code-point/index.js +0 -50
  580. package/plugin/runtime/node_modules/is-fullwidth-code-point/license +0 -9
  581. package/plugin/runtime/node_modules/is-fullwidth-code-point/package.json +0 -42
  582. package/plugin/runtime/node_modules/is-fullwidth-code-point/readme.md +0 -39
  583. package/plugin/runtime/node_modules/locate-path/index.d.ts +0 -83
  584. package/plugin/runtime/node_modules/locate-path/index.js +0 -65
  585. package/plugin/runtime/node_modules/locate-path/license +0 -9
  586. package/plugin/runtime/node_modules/locate-path/package.json +0 -45
  587. package/plugin/runtime/node_modules/locate-path/readme.md +0 -122
  588. package/plugin/runtime/node_modules/node-app-attest/.github/dependabot.yml +0 -6
  589. package/plugin/runtime/node_modules/node-app-attest/.github/workflows/ci.yml +0 -43
  590. package/plugin/runtime/node_modules/node-app-attest/.prettierrc +0 -1
  591. package/plugin/runtime/node_modules/node-app-attest/.yarnrc.yml +0 -1
  592. package/plugin/runtime/node_modules/node-app-attest/LICENSE +0 -21
  593. package/plugin/runtime/node_modules/node-app-attest/README.md +0 -300
  594. package/plugin/runtime/node_modules/node-app-attest/eslint.config.js +0 -30
  595. package/plugin/runtime/node_modules/node-app-attest/package.json +0 -44
  596. package/plugin/runtime/node_modules/node-app-attest/src/index.js +0 -4
  597. package/plugin/runtime/node_modules/node-app-attest/src/verifyAssertion.js +0 -81
  598. package/plugin/runtime/node_modules/node-app-attest/src/verifyAttestation.js +0 -211
  599. package/plugin/runtime/node_modules/node-app-attest/test/fixtures/attestation-development.json +0 -5
  600. package/plugin/runtime/node_modules/node-app-attest/test/fixtures/attestation-production.json +0 -5
  601. package/plugin/runtime/node_modules/node-app-attest/test/verifyAssertion.test.js +0 -119
  602. package/plugin/runtime/node_modules/node-app-attest/test/verifyAttestation.test.js +0 -303
  603. package/plugin/runtime/node_modules/node-app-attest/tsconfig.json +0 -11
  604. package/plugin/runtime/node_modules/node-app-attest/types/index.d.ts +0 -4
  605. package/plugin/runtime/node_modules/node-app-attest/types/index.d.ts.map +0 -1
  606. package/plugin/runtime/node_modules/node-app-attest/types/verifyAssertion.d.ts +0 -5
  607. package/plugin/runtime/node_modules/node-app-attest/types/verifyAssertion.d.ts.map +0 -1
  608. package/plugin/runtime/node_modules/node-app-attest/types/verifyAttestation.d.ts +0 -8
  609. package/plugin/runtime/node_modules/node-app-attest/types/verifyAttestation.d.ts.map +0 -1
  610. package/plugin/runtime/node_modules/nofilter/LICENSE.md +0 -20
  611. package/plugin/runtime/node_modules/nofilter/README.md +0 -36
  612. package/plugin/runtime/node_modules/nofilter/lib/index.js +0 -1055
  613. package/plugin/runtime/node_modules/nofilter/package.json +0 -60
  614. package/plugin/runtime/node_modules/nofilter/types/index.d.ts +0 -573
  615. package/plugin/runtime/node_modules/p-limit/index.d.ts +0 -38
  616. package/plugin/runtime/node_modules/p-limit/index.js +0 -57
  617. package/plugin/runtime/node_modules/p-limit/license +0 -9
  618. package/plugin/runtime/node_modules/p-limit/package.json +0 -52
  619. package/plugin/runtime/node_modules/p-limit/readme.md +0 -101
  620. package/plugin/runtime/node_modules/p-locate/index.d.ts +0 -64
  621. package/plugin/runtime/node_modules/p-locate/index.js +0 -52
  622. package/plugin/runtime/node_modules/p-locate/license +0 -9
  623. package/plugin/runtime/node_modules/p-locate/package.json +0 -53
  624. package/plugin/runtime/node_modules/p-locate/readme.md +0 -90
  625. package/plugin/runtime/node_modules/p-try/index.d.ts +0 -39
  626. package/plugin/runtime/node_modules/p-try/index.js +0 -9
  627. package/plugin/runtime/node_modules/p-try/license +0 -9
  628. package/plugin/runtime/node_modules/p-try/package.json +0 -42
  629. package/plugin/runtime/node_modules/p-try/readme.md +0 -58
  630. package/plugin/runtime/node_modules/path-exists/index.d.ts +0 -28
  631. package/plugin/runtime/node_modules/path-exists/index.js +0 -23
  632. package/plugin/runtime/node_modules/path-exists/license +0 -9
  633. package/plugin/runtime/node_modules/path-exists/package.json +0 -39
  634. package/plugin/runtime/node_modules/path-exists/readme.md +0 -52
  635. package/plugin/runtime/node_modules/pkijs/LICENSE +0 -30
  636. package/plugin/runtime/node_modules/pkijs/README.md +0 -81
  637. package/plugin/runtime/node_modules/pkijs/build/index.d.ts +0 -9419
  638. package/plugin/runtime/node_modules/pkijs/build/index.es.js +0 -18789
  639. package/plugin/runtime/node_modules/pkijs/build/index.js +0 -19014
  640. package/plugin/runtime/node_modules/pkijs/package.json +0 -98
  641. package/plugin/runtime/node_modules/pngjs/.eslintignore +0 -2
  642. package/plugin/runtime/node_modules/pngjs/.eslintrc.json +0 -19
  643. package/plugin/runtime/node_modules/pngjs/.prettierignore +0 -3
  644. package/plugin/runtime/node_modules/pngjs/LICENSE +0 -20
  645. package/plugin/runtime/node_modules/pngjs/README.md +0 -429
  646. package/plugin/runtime/node_modules/pngjs/browser.js +0 -16096
  647. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/base.css +0 -354
  648. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/bitmapper.js.html +0 -881
  649. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/bitpacker.js.html +0 -554
  650. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/block-navigation.js +0 -77
  651. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/chunkstream.js.html +0 -647
  652. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/constants.js.html +0 -176
  653. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/crc.js.html +0 -200
  654. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/favicon.png +0 -0
  655. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/filter-pack.js.html +0 -593
  656. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html +0 -152
  657. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html +0 -143
  658. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/filter-parse.js.html +0 -611
  659. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html +0 -359
  660. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/index.html +0 -426
  661. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/interlace.js.html +0 -365
  662. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/packer-async.js.html +0 -230
  663. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/packer-sync.js.html +0 -248
  664. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/packer.js.html +0 -467
  665. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html +0 -128
  666. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/parser-async.js.html +0 -575
  667. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/parser-sync.js.html +0 -404
  668. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/parser.js.html +0 -950
  669. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/png-sync.js.html +0 -116
  670. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/png.js.html +0 -662
  671. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/prettify.css +0 -101
  672. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/prettify.js +0 -1007
  673. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  674. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/sorter.js +0 -169
  675. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html +0 -584
  676. package/plugin/runtime/node_modules/pngjs/coverage/lcov-report/sync-reader.js.html +0 -215
  677. package/plugin/runtime/node_modules/pngjs/coverage/lcov.info +0 -2177
  678. package/plugin/runtime/node_modules/pngjs/lib/bitmapper.js +0 -267
  679. package/plugin/runtime/node_modules/pngjs/lib/bitpacker.js +0 -158
  680. package/plugin/runtime/node_modules/pngjs/lib/chunkstream.js +0 -189
  681. package/plugin/runtime/node_modules/pngjs/lib/constants.js +0 -32
  682. package/plugin/runtime/node_modules/pngjs/lib/crc.js +0 -40
  683. package/plugin/runtime/node_modules/pngjs/lib/filter-pack.js +0 -171
  684. package/plugin/runtime/node_modules/pngjs/lib/filter-parse-async.js +0 -24
  685. package/plugin/runtime/node_modules/pngjs/lib/filter-parse-sync.js +0 -21
  686. package/plugin/runtime/node_modules/pngjs/lib/filter-parse.js +0 -177
  687. package/plugin/runtime/node_modules/pngjs/lib/format-normaliser.js +0 -93
  688. package/plugin/runtime/node_modules/pngjs/lib/interlace.js +0 -95
  689. package/plugin/runtime/node_modules/pngjs/lib/packer-async.js +0 -50
  690. package/plugin/runtime/node_modules/pngjs/lib/packer-sync.js +0 -56
  691. package/plugin/runtime/node_modules/pngjs/lib/packer.js +0 -129
  692. package/plugin/runtime/node_modules/pngjs/lib/paeth-predictor.js +0 -16
  693. package/plugin/runtime/node_modules/pngjs/lib/parser-async.js +0 -165
  694. package/plugin/runtime/node_modules/pngjs/lib/parser-sync.js +0 -108
  695. package/plugin/runtime/node_modules/pngjs/lib/parser.js +0 -290
  696. package/plugin/runtime/node_modules/pngjs/lib/png-sync.js +0 -12
  697. package/plugin/runtime/node_modules/pngjs/lib/png.js +0 -194
  698. package/plugin/runtime/node_modules/pngjs/lib/sync-inflate.js +0 -168
  699. package/plugin/runtime/node_modules/pngjs/lib/sync-reader.js +0 -45
  700. package/plugin/runtime/node_modules/pngjs/package.json +0 -73
  701. package/plugin/runtime/node_modules/pvtsutils/LICENSE +0 -21
  702. package/plugin/runtime/node_modules/pvtsutils/README.md +0 -80
  703. package/plugin/runtime/node_modules/pvtsutils/build/index.d.ts +0 -208
  704. package/plugin/runtime/node_modules/pvtsutils/build/index.es.js +0 -393
  705. package/plugin/runtime/node_modules/pvtsutils/build/index.js +0 -399
  706. package/plugin/runtime/node_modules/pvtsutils/package.json +0 -76
  707. package/plugin/runtime/node_modules/pvutils/LICENSE +0 -24
  708. package/plugin/runtime/node_modules/pvutils/README.md +0 -24
  709. package/plugin/runtime/node_modules/pvutils/build/index.d.ts +0 -116
  710. package/plugin/runtime/node_modules/pvutils/build/utils.es.js +0 -340
  711. package/plugin/runtime/node_modules/pvutils/build/utils.js +0 -361
  712. package/plugin/runtime/node_modules/pvutils/package.json +0 -63
  713. package/plugin/runtime/node_modules/qrcode/README.md +0 -770
  714. package/plugin/runtime/node_modules/qrcode/bin/qrcode +0 -159
  715. package/plugin/runtime/node_modules/qrcode/helper/to-sjis-browser.js +0 -2
  716. package/plugin/runtime/node_modules/qrcode/helper/to-sjis.js +0 -105
  717. package/plugin/runtime/node_modules/qrcode/lib/browser.js +0 -76
  718. package/plugin/runtime/node_modules/qrcode/lib/can-promise.js +0 -7
  719. package/plugin/runtime/node_modules/qrcode/lib/core/alignment-pattern.js +0 -83
  720. package/plugin/runtime/node_modules/qrcode/lib/core/alphanumeric-data.js +0 -59
  721. package/plugin/runtime/node_modules/qrcode/lib/core/bit-buffer.js +0 -37
  722. package/plugin/runtime/node_modules/qrcode/lib/core/bit-matrix.js +0 -65
  723. package/plugin/runtime/node_modules/qrcode/lib/core/byte-data.js +0 -30
  724. package/plugin/runtime/node_modules/qrcode/lib/core/error-correction-code.js +0 -135
  725. package/plugin/runtime/node_modules/qrcode/lib/core/error-correction-level.js +0 -50
  726. package/plugin/runtime/node_modules/qrcode/lib/core/finder-pattern.js +0 -22
  727. package/plugin/runtime/node_modules/qrcode/lib/core/format-info.js +0 -29
  728. package/plugin/runtime/node_modules/qrcode/lib/core/galois-field.js +0 -69
  729. package/plugin/runtime/node_modules/qrcode/lib/core/kanji-data.js +0 -54
  730. package/plugin/runtime/node_modules/qrcode/lib/core/mask-pattern.js +0 -234
  731. package/plugin/runtime/node_modules/qrcode/lib/core/mode.js +0 -167
  732. package/plugin/runtime/node_modules/qrcode/lib/core/numeric-data.js +0 -43
  733. package/plugin/runtime/node_modules/qrcode/lib/core/polynomial.js +0 -62
  734. package/plugin/runtime/node_modules/qrcode/lib/core/qrcode.js +0 -495
  735. package/plugin/runtime/node_modules/qrcode/lib/core/reed-solomon-encoder.js +0 -56
  736. package/plugin/runtime/node_modules/qrcode/lib/core/regex.js +0 -31
  737. package/plugin/runtime/node_modules/qrcode/lib/core/segments.js +0 -330
  738. package/plugin/runtime/node_modules/qrcode/lib/core/utils.js +0 -63
  739. package/plugin/runtime/node_modules/qrcode/lib/core/version-check.js +0 -9
  740. package/plugin/runtime/node_modules/qrcode/lib/core/version.js +0 -163
  741. package/plugin/runtime/node_modules/qrcode/lib/index.js +0 -12
  742. package/plugin/runtime/node_modules/qrcode/lib/renderer/canvas.js +0 -63
  743. package/plugin/runtime/node_modules/qrcode/lib/renderer/png.js +0 -78
  744. package/plugin/runtime/node_modules/qrcode/lib/renderer/svg-tag.js +0 -81
  745. package/plugin/runtime/node_modules/qrcode/lib/renderer/svg.js +0 -19
  746. package/plugin/runtime/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +0 -85
  747. package/plugin/runtime/node_modules/qrcode/lib/renderer/terminal/terminal.js +0 -49
  748. package/plugin/runtime/node_modules/qrcode/lib/renderer/terminal.js +0 -9
  749. package/plugin/runtime/node_modules/qrcode/lib/renderer/utf8.js +0 -71
  750. package/plugin/runtime/node_modules/qrcode/lib/renderer/utils.js +0 -99
  751. package/plugin/runtime/node_modules/qrcode/lib/server.js +0 -138
  752. package/plugin/runtime/node_modules/qrcode/license +0 -10
  753. package/plugin/runtime/node_modules/qrcode/package.json +0 -77
  754. package/plugin/runtime/node_modules/require-directory/.jshintrc +0 -67
  755. package/plugin/runtime/node_modules/require-directory/.travis.yml +0 -3
  756. package/plugin/runtime/node_modules/require-directory/LICENSE +0 -22
  757. package/plugin/runtime/node_modules/require-directory/README.markdown +0 -184
  758. package/plugin/runtime/node_modules/require-directory/index.js +0 -86
  759. package/plugin/runtime/node_modules/require-directory/package.json +0 -40
  760. package/plugin/runtime/node_modules/require-main-filename/CHANGELOG.md +0 -26
  761. package/plugin/runtime/node_modules/require-main-filename/LICENSE.txt +0 -14
  762. package/plugin/runtime/node_modules/require-main-filename/README.md +0 -26
  763. package/plugin/runtime/node_modules/require-main-filename/index.js +0 -18
  764. package/plugin/runtime/node_modules/require-main-filename/package.json +0 -35
  765. package/plugin/runtime/node_modules/set-blocking/CHANGELOG.md +0 -26
  766. package/plugin/runtime/node_modules/set-blocking/LICENSE.txt +0 -14
  767. package/plugin/runtime/node_modules/set-blocking/README.md +0 -31
  768. package/plugin/runtime/node_modules/set-blocking/index.js +0 -7
  769. package/plugin/runtime/node_modules/set-blocking/package.json +0 -42
  770. package/plugin/runtime/node_modules/string-width/index.d.ts +0 -29
  771. package/plugin/runtime/node_modules/string-width/index.js +0 -47
  772. package/plugin/runtime/node_modules/string-width/license +0 -9
  773. package/plugin/runtime/node_modules/string-width/package.json +0 -56
  774. package/plugin/runtime/node_modules/string-width/readme.md +0 -50
  775. package/plugin/runtime/node_modules/strip-ansi/index.d.ts +0 -17
  776. package/plugin/runtime/node_modules/strip-ansi/index.js +0 -4
  777. package/plugin/runtime/node_modules/strip-ansi/license +0 -9
  778. package/plugin/runtime/node_modules/strip-ansi/package.json +0 -54
  779. package/plugin/runtime/node_modules/strip-ansi/readme.md +0 -46
  780. package/plugin/runtime/node_modules/tslib/CopyrightNotice.txt +0 -15
  781. package/plugin/runtime/node_modules/tslib/LICENSE.txt +0 -12
  782. package/plugin/runtime/node_modules/tslib/README.md +0 -159
  783. package/plugin/runtime/node_modules/tslib/SECURITY.md +0 -41
  784. package/plugin/runtime/node_modules/tslib/modules/index.d.ts +0 -38
  785. package/plugin/runtime/node_modules/tslib/modules/index.js +0 -70
  786. package/plugin/runtime/node_modules/tslib/modules/package.json +0 -3
  787. package/plugin/runtime/node_modules/tslib/package.json +0 -47
  788. package/plugin/runtime/node_modules/tslib/tslib.d.ts +0 -462
  789. package/plugin/runtime/node_modules/tslib/tslib.es6.html +0 -1
  790. package/plugin/runtime/node_modules/tslib/tslib.es6.js +0 -411
  791. package/plugin/runtime/node_modules/tslib/tslib.es6.mjs +0 -410
  792. package/plugin/runtime/node_modules/tslib/tslib.html +0 -1
  793. package/plugin/runtime/node_modules/tslib/tslib.js +0 -493
  794. package/plugin/runtime/node_modules/which-module/LICENSE +0 -13
  795. package/plugin/runtime/node_modules/which-module/README.md +0 -58
  796. package/plugin/runtime/node_modules/which-module/index.js +0 -9
  797. package/plugin/runtime/node_modules/which-module/package.json +0 -41
  798. package/plugin/runtime/node_modules/wrap-ansi/index.js +0 -186
  799. package/plugin/runtime/node_modules/wrap-ansi/license +0 -9
  800. package/plugin/runtime/node_modules/wrap-ansi/package.json +0 -61
  801. package/plugin/runtime/node_modules/wrap-ansi/readme.md +0 -97
  802. package/plugin/runtime/node_modules/y18n/CHANGELOG.md +0 -35
  803. package/plugin/runtime/node_modules/y18n/LICENSE +0 -13
  804. package/plugin/runtime/node_modules/y18n/README.md +0 -109
  805. package/plugin/runtime/node_modules/y18n/index.js +0 -188
  806. package/plugin/runtime/node_modules/y18n/package.json +0 -39
  807. package/plugin/runtime/node_modules/yargs/CHANGELOG.md +0 -420
  808. package/plugin/runtime/node_modules/yargs/LICENSE +0 -21
  809. package/plugin/runtime/node_modules/yargs/README.md +0 -140
  810. package/plugin/runtime/node_modules/yargs/build/lib/apply-extends.d.ts +0 -2
  811. package/plugin/runtime/node_modules/yargs/build/lib/apply-extends.js +0 -65
  812. package/plugin/runtime/node_modules/yargs/build/lib/argsert.d.ts +0 -2
  813. package/plugin/runtime/node_modules/yargs/build/lib/argsert.js +0 -65
  814. package/plugin/runtime/node_modules/yargs/build/lib/command.d.ts +0 -64
  815. package/plugin/runtime/node_modules/yargs/build/lib/command.js +0 -416
  816. package/plugin/runtime/node_modules/yargs/build/lib/common-types.d.ts +0 -36
  817. package/plugin/runtime/node_modules/yargs/build/lib/common-types.js +0 -25
  818. package/plugin/runtime/node_modules/yargs/build/lib/completion-templates.d.ts +0 -2
  819. package/plugin/runtime/node_modules/yargs/build/lib/completion-templates.js +0 -50
  820. package/plugin/runtime/node_modules/yargs/build/lib/completion.d.ts +0 -21
  821. package/plugin/runtime/node_modules/yargs/build/lib/completion.js +0 -135
  822. package/plugin/runtime/node_modules/yargs/build/lib/is-promise.d.ts +0 -1
  823. package/plugin/runtime/node_modules/yargs/build/lib/is-promise.js +0 -9
  824. package/plugin/runtime/node_modules/yargs/build/lib/levenshtein.d.ts +0 -1
  825. package/plugin/runtime/node_modules/yargs/build/lib/levenshtein.js +0 -58
  826. package/plugin/runtime/node_modules/yargs/build/lib/middleware.d.ts +0 -10
  827. package/plugin/runtime/node_modules/yargs/build/lib/middleware.js +0 -57
  828. package/plugin/runtime/node_modules/yargs/build/lib/obj-filter.d.ts +0 -1
  829. package/plugin/runtime/node_modules/yargs/build/lib/obj-filter.js +0 -14
  830. package/plugin/runtime/node_modules/yargs/build/lib/parse-command.d.ts +0 -11
  831. package/plugin/runtime/node_modules/yargs/build/lib/parse-command.js +0 -36
  832. package/plugin/runtime/node_modules/yargs/build/lib/process-argv.d.ts +0 -2
  833. package/plugin/runtime/node_modules/yargs/build/lib/process-argv.js +0 -31
  834. package/plugin/runtime/node_modules/yargs/build/lib/usage.d.ts +0 -49
  835. package/plugin/runtime/node_modules/yargs/build/lib/usage.js +0 -540
  836. package/plugin/runtime/node_modules/yargs/build/lib/validation.d.ts +0 -34
  837. package/plugin/runtime/node_modules/yargs/build/lib/validation.js +0 -330
  838. package/plugin/runtime/node_modules/yargs/build/lib/yargs.d.ts +0 -274
  839. package/plugin/runtime/node_modules/yargs/build/lib/yargs.js +0 -1190
  840. package/plugin/runtime/node_modules/yargs/build/lib/yerror.d.ts +0 -4
  841. package/plugin/runtime/node_modules/yargs/build/lib/yerror.js +0 -11
  842. package/plugin/runtime/node_modules/yargs/index.js +0 -40
  843. package/plugin/runtime/node_modules/yargs/locales/be.json +0 -46
  844. package/plugin/runtime/node_modules/yargs/locales/de.json +0 -46
  845. package/plugin/runtime/node_modules/yargs/locales/en.json +0 -51
  846. package/plugin/runtime/node_modules/yargs/locales/es.json +0 -46
  847. package/plugin/runtime/node_modules/yargs/locales/fi.json +0 -49
  848. package/plugin/runtime/node_modules/yargs/locales/fr.json +0 -53
  849. package/plugin/runtime/node_modules/yargs/locales/hi.json +0 -49
  850. package/plugin/runtime/node_modules/yargs/locales/hu.json +0 -46
  851. package/plugin/runtime/node_modules/yargs/locales/id.json +0 -50
  852. package/plugin/runtime/node_modules/yargs/locales/it.json +0 -46
  853. package/plugin/runtime/node_modules/yargs/locales/ja.json +0 -51
  854. package/plugin/runtime/node_modules/yargs/locales/ko.json +0 -49
  855. package/plugin/runtime/node_modules/yargs/locales/nb.json +0 -44
  856. package/plugin/runtime/node_modules/yargs/locales/nl.json +0 -49
  857. package/plugin/runtime/node_modules/yargs/locales/nn.json +0 -44
  858. package/plugin/runtime/node_modules/yargs/locales/pirate.json +0 -13
  859. package/plugin/runtime/node_modules/yargs/locales/pl.json +0 -49
  860. package/plugin/runtime/node_modules/yargs/locales/pt.json +0 -45
  861. package/plugin/runtime/node_modules/yargs/locales/pt_BR.json +0 -48
  862. package/plugin/runtime/node_modules/yargs/locales/ru.json +0 -46
  863. package/plugin/runtime/node_modules/yargs/locales/th.json +0 -46
  864. package/plugin/runtime/node_modules/yargs/locales/tr.json +0 -48
  865. package/plugin/runtime/node_modules/yargs/locales/zh_CN.json +0 -48
  866. package/plugin/runtime/node_modules/yargs/locales/zh_TW.json +0 -47
  867. package/plugin/runtime/node_modules/yargs/package.json +0 -92
  868. package/plugin/runtime/node_modules/yargs/yargs.js +0 -14
  869. package/plugin/runtime/node_modules/yargs-parser/CHANGELOG.md +0 -601
  870. package/plugin/runtime/node_modules/yargs-parser/LICENSE.txt +0 -14
  871. package/plugin/runtime/node_modules/yargs-parser/README.md +0 -449
  872. package/plugin/runtime/node_modules/yargs-parser/index.js +0 -1032
  873. package/plugin/runtime/node_modules/yargs-parser/lib/tokenize-arg-string.js +0 -40
  874. package/plugin/runtime/node_modules/yargs-parser/package.json +0 -46
  875. package/plugin/runtime/package-lock.json +0 -447
  876. package/plugin/runtime/package.json +0 -13
  877. package/plugin/tools.py +0 -3
@@ -1,2080 +0,0 @@
1
- """固定版身份、平台授权/首次注册、已授权FIFO、默认配置与原控制观察;公开协议优先,必要配置写入固定封装,告警保持。"""
2
-
3
- import asyncio
4
- from contextlib import contextmanager
5
- import json
6
- import logging
7
- import os
8
- import subprocess
9
- import time
10
- import threading
11
- from collections import OrderedDict
12
- from contextvars import ContextVar
13
- from pathlib import Path
14
- from gateway import config as gateway_config
15
- from .runtime_port import PublicRuntimeUnavailable, InputAdmissionRefused, InputAdmissionUnconfirmed
16
-
17
- APPROVED_REVISION = "bf0203a794a07aac3ff764972ab9087baa4e4f4e"
18
- logger = logging.getLogger(__name__)
19
-
20
- _resolved_default_warning_emitted = False
21
- _model_names_warning_emitted = False
22
- _profile_defaults_warning_emitted = False
23
- _multi_profile_warning_emitted = False
24
- _device_execution = ContextVar("fridaynext_device_execution", default=None)
25
-
26
-
27
- def _fridaynext_adapter(platforms):
28
- if not isinstance(platforms, dict):
29
- return None
30
- return next((adapter for platform, adapter in platforms.items()
31
- if getattr(platform, "value", platform) == "fridaynext"), None)
32
-
33
-
34
- def fridaynext_listener_owner(adapter):
35
- """固定版原生multiplex注册表;不扫描目录或自行创建Profile执行器。"""
36
- runner = getattr(adapter, "gateway_runner", None)
37
- primary = getattr(runner, "adapters", {})
38
- owner = _fridaynext_adapter(primary)
39
- if owner is adapter:
40
- return None
41
- candidates = [owner] if owner is not None else []
42
- if owner is None:
43
- registry = getattr(runner, "_profile_adapters", {})
44
- if isinstance(registry, dict):
45
- candidates = [_fridaynext_adapter(platforms) for _, platforms in sorted(registry.items())]
46
- for candidate in candidates:
47
- if candidate is None or candidate is adapter:
48
- continue
49
- # 默认Profile未启用本平台时,已有服务的命名Profile继续拥有原listener。
50
- candidate = getattr(getattr(candidate, "host", None), "owner", candidate)
51
- if candidate is adapter:
52
- continue
53
- if (not callable(getattr(candidate, "_host_request", None))
54
- or getattr(candidate, "gateway_runner", None) is not runner):
55
- continue
56
- host = getattr(candidate, "host", None)
57
- if not host or getattr(host, "stopping", False) or not getattr(candidate, "plugin_enabled", False):
58
- raise RuntimeError("PRIMARY_PROFILE_UNAVAILABLE")
59
- return candidate
60
- return None
61
-
62
-
63
- def fridaynext_profile_adapters(owner):
64
- """只列同一Gateway已登记、已初始化且允许owner进入的正式适配器。"""
65
- runner = getattr(owner, "gateway_runner", None)
66
- registry = getattr(runner, "_profile_adapters", {})
67
- peers = []
68
- for name, platforms in sorted(registry.items()) if isinstance(registry, dict) else []:
69
- adapter = _fridaynext_adapter(platforms)
70
- if (adapter is None or adapter is owner or not callable(getattr(adapter, "_host_request", None))
71
- or getattr(adapter, "gateway_runner", None) is not runner
72
- or not getattr(adapter, "plugin_enabled", False) or not getattr(adapter, "host", None)
73
- or not getattr(adapter, "runtime", None) or not getattr(adapter, "bindings", None)
74
- or getattr(adapter, "_running", True) is not True
75
- or adapter.profile == owner.profile):
76
- continue
77
- extra = getattr(getattr(adapter, "config", None), "extra", {})
78
- allowed = extra.get("allowed_users", [])
79
- if isinstance(allowed, str):
80
- allowed = [value.strip() for value in allowed.split(",")]
81
- if not isinstance(allowed, (list, tuple, set)):
82
- allowed = []
83
- if "owner" not in allowed and extra.get("allow_all_users") is not True:
84
- continue
85
- peers.append(adapter)
86
- global _multi_profile_warning_emitted
87
- if peers and not _multi_profile_warning_emitted:
88
- _multi_profile_warning_emitted = True
89
- logger.warning("hermes.compat.multi_profile_registry_v0_22_5:读取固定版原生Profile注册表,执行仍走标准平台入口")
90
- return [owner, *peers]
91
- _message_speech_warning_emitted = False
92
- _reasoning_options_warning_emitted = False
93
- _scheduled_warning_emitted = False
94
- _scheduled_lock = threading.RLock()
95
-
96
-
97
- def _scheduled_version(job):
98
- import hashlib
99
- import json
100
- # list_jobs 额外附上执行摘要,get_job 和写入回执只返回原任务。
101
- # 统一版本输入,仍用原任务字段拦截实际改动。
102
- record = {key: value for key, value in job.items() if key != "latest_execution"}
103
- return hashlib.sha256(json.dumps(record, sort_keys=True, ensure_ascii=False).encode()).hexdigest()
104
-
105
-
106
- def _scheduled_time_zone():
107
- """跟随Hermes生效时区;未配置时解析宿主本地时区,不把server-local误报成UTC。"""
108
- from hermes_time import get_timezone
109
- from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
110
- configured = get_timezone()
111
- if configured is not None:
112
- return str(configured)
113
- environment = os.environ.get("TZ", "").lstrip(":")
114
- candidates = [environment] if environment else []
115
- if not environment:
116
- local = Path("/etc/localtime").resolve()
117
- if "zoneinfo" in local.parts:
118
- candidates.append("/".join(local.parts[local.parts.index("zoneinfo") + 1:]))
119
- timezone_file = Path("/etc/timezone")
120
- if timezone_file.is_file():
121
- candidates.append(timezone_file.read_text().strip())
122
- for name in candidates:
123
- try:
124
- return str(ZoneInfo(name))
125
- except (ValueError, ZoneInfoNotFoundError):
126
- continue
127
- # 无可验证IANA名时保持未知,周期仍由原生调度器解释,不能给客户端伪造时区。
128
- return ""
129
-
130
-
131
- def _scheduled_wire(job, zone):
132
- from .settings import model_id
133
- schedule = job.get("schedule") or {}
134
- kind = schedule.get("kind")
135
- wire = ({"kind": "at", "at": schedule.get("run_at")} if kind == "once" else
136
- {"kind": "every", "everyMs": schedule.get("minutes", 0) * 60000} if kind == "interval" else
137
- {"kind": "cron", "expr": schedule.get("expr"), "tz": zone} if kind == "cron" else {"kind": kind or "unknown"})
138
- deliver = job.get("deliver") or "local"
139
- origin = job.get("origin") or {}
140
- if deliver == "origin":
141
- channel, target = origin.get("platform"), origin.get("chat_id")
142
- else:
143
- channel, _, target = deliver.partition(":")
144
- delivery = ({"mode": "none"} if deliver == "local" else
145
- {"mode": "announce", "channel": "friday-next" if channel == "fridaynext" else channel,
146
- **({"to": target} if target else {})})
147
- def epoch(value):
148
- from datetime import datetime
149
- try:
150
- return datetime.fromisoformat(value).timestamp() * 1000 if value else None
151
- except (ValueError, TypeError):
152
- return None
153
- return {"id": job["id"], "name": job.get("name", job["id"]), "agentId": "hermes",
154
- "version": _scheduled_version(job), "enabled": job.get("enabled", True), "schedule": wire,
155
- "payload": {"kind": "native" if job.get("script") or job.get("no_agent") else "agentTurn",
156
- "message": job.get("prompt", ""),
157
- "model": model_id(job.get("provider") or "", job["model"]) if job.get("model") else None},
158
- "delivery": delivery, "nextRunAtMs": epoch(job.get("next_run_at")), "lastRunAtMs": epoch(job.get("last_run_at")),
159
- "lastRunStatus": {"success": "ok", "error": "error", "failed": "error"}.get(job.get("last_status")),
160
- "lastRunError": job.get("last_error"), "deleteAfterRun": False}
161
-
162
-
163
- def _scheduled_text(schedule, zone):
164
- if not isinstance(schedule, dict):
165
- raise ValueError("SCHEDULE_INVALID")
166
- kind = schedule.get("kind")
167
- if kind == "cron":
168
- if schedule.get("tz") not in (None, "", zone):
169
- # 固定Hermes版本按Profile时区调度;不假装支持单任务时区,也不静默换算。
170
- raise ValueError("SCHEDULE_TIMEZONE_MISMATCH")
171
- return str(schedule.get("expr") or "")
172
- if kind == "every":
173
- interval = schedule.get("everyMs")
174
- if type(interval) not in (int, float) or interval < 60000 or interval % 60000:
175
- raise ValueError("SCHEDULE_INTERVAL_INVALID")
176
- return f"every {int(interval // 60000)}m"
177
- if kind == "at":
178
- from datetime import datetime
179
- parsed = datetime.fromisoformat(schedule.get("at") or "")
180
- if parsed.tzinfo is None:
181
- raise ValueError("SCHEDULE_TIMEZONE_REQUIRED")
182
- return parsed.isoformat()
183
- raise ValueError("SCHEDULE_KIND_UNSUPPORTED")
184
-
185
-
186
- def profile_scheduled_operation(profile, operation, value, *, device=None, prepare=None):
187
- """复用固定版原生cron API及官方蓝图定义;只在owner作用域内调用,不扫描其他Profile。"""
188
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
189
- from agent.secret_scope import set_secret_scope, reset_secret_scope
190
- from tui_gateway.launch_profile_policy import owner_secret_scope
191
- from cron import jobs
192
- from cron.scheduler import create_job_with_scheduler_registration
193
- from cron.scheduler_provider import resolve_cron_scheduler
194
- from cron.blueprint_catalog import list_blueprints, get_blueprint, blueprint_form_schema, fill_blueprint
195
-
196
- global _scheduled_warning_emitted
197
- if not _scheduled_warning_emitted:
198
- _scheduled_warning_emitted = True
199
- logger.warning("hermes.compat.scheduled_tasks_v0_22_5:固定cron存储作用域、调度器注册与蓝图API;非稳定Platform管理SDK")
200
- root = Path(profile).resolve()
201
- home_token = set_hermes_home_override(str(root))
202
- secret_token = None
203
- try:
204
- secret_token = set_secret_scope(owner_secret_scope(root), profile_home=str(root))
205
- with _scheduled_lock, jobs.use_cron_store(root):
206
- zone = _scheduled_time_zone()
207
-
208
- def notify():
209
- resolve_cron_scheduler().on_jobs_changed()
210
-
211
- def missing_skills(entry):
212
- from tools.skills_tool import find_all_skills
213
- available = {row["name"] for row in find_all_skills()}
214
- return [name for name in entry.skills if name not in available]
215
-
216
- def blueprint(identifier, values, *, require_available=False):
217
- entry = get_blueprint(identifier)
218
- if entry is None:
219
- raise ValueError("SCHEDULE_BLUEPRINT_NOT_FOUND")
220
- if require_available and missing_skills(entry):
221
- raise ValueError("SCHEDULE_BLUEPRINT_DEPENDENCY_UNAVAILABLE")
222
- return fill_blueprint(entry, values)
223
-
224
- def channels():
225
- from cron.scheduler_delivery import cron_delivery_targets
226
- native = cron_delivery_targets()
227
- return [{"id": "friday-next", "label": "FridayNext"}, *[
228
- {"id": row["id"], "label": row.get("label") or row["id"]}
229
- for row in native if row.get("id") not in (None, "fridaynext", "friday-next", "local", "origin")]]
230
-
231
- if operation == "schedule.blueprints":
232
- entries = []
233
- for entry in list_blueprints():
234
- missing = missing_skills(entry)
235
- entries.append({"id": entry.key, "name": entry.title, "description": entry.description,
236
- "available": not missing, "unavailableReason": "缺少或已停用技能:" + ", ".join(missing) if missing else None,
237
- "fields": [{**field, "role": "delivery" if field["name"] == "deliver" else "input"}
238
- for field in blueprint_form_schema(entry)["fields"]]})
239
- return {"version": 1, "timeZone": zone, "blueprints": entries}
240
- if operation == "schedule.channels":
241
- return {"version": 1, "channels": channels()}
242
- if operation == "schedule.preview":
243
- spec = blueprint(value.get("blueprintId"), value.get("values", {}))
244
- parsed = jobs.parse_schedule(spec["schedule"])
245
- wire = _scheduled_wire({"id": "preview", "schedule": parsed, "deliver": spec.get("deliver", "origin"),
246
- "origin": {"platform": "fridaynext"}}, zone)
247
- return {"version": 1, "job": {"name": spec["name"], "message": spec["prompt"],
248
- "schedule": wire["schedule"], "delivery": wire["delivery"]}}
249
- if operation == "schedule.list":
250
- return {"jobs": [_scheduled_wire(job, zone) for job in jobs.list_jobs(include_disabled=True)]}
251
- identifier = value.get("id")
252
- existing = jobs.get_job(identifier) if isinstance(identifier, str) else None
253
- if operation != "schedule.create" and existing is None:
254
- raise ValueError("SCHEDULE_NOT_FOUND")
255
- if operation == "schedule.runs":
256
- return _scheduled_runs(root, existing, value.get("limit", 20))
257
- patch = value.get("job" if operation == "schedule.create" else "patch", {})
258
- if not isinstance(patch, dict):
259
- raise ValueError("SCHEDULE_INPUT_INVALID")
260
- allowed = {"name", "message", "schedule", "model", "nativeModel", "nativeProvider", "deviceId", "agentId",
261
- "enabled", "deleteAfterRun", "delivery", "blueprintId", "blueprintValues", "expectedVersion"}
262
- if set(patch) - allowed or patch.get("agentId") not in (None, "hermes"):
263
- raise ValueError("SCHEDULE_INPUT_INVALID")
264
- if patch.get("deviceId", device) != device:
265
- raise ValueError("SCHEDULE_DEVICE_MISMATCH")
266
- if "enabled" in patch and type(patch["enabled"]) is not bool:
267
- raise ValueError("SCHEDULE_ENABLED_INVALID")
268
- if patch.get("deleteAfterRun") not in (None, False):
269
- raise ValueError("SCHEDULE_DELETE_AFTER_RUN_UNSUPPORTED")
270
- if existing and patch.get("expectedVersion") not in (None, _scheduled_version(existing)):
271
- return {"status": "conflict", "code": "SCHEDULE_VERSION_CONFLICT"}
272
- spec = blueprint(patch["blueprintId"], patch.get("blueprintValues", {}), require_available=True) if patch.get("blueprintId") else {}
273
- for source, target in (("name", "name"), ("message", "prompt")):
274
- if source in patch:
275
- if not isinstance(patch[source], str):
276
- raise ValueError("SCHEDULE_INPUT_INVALID")
277
- spec[target] = patch[source]
278
- if "message" in patch and existing and (existing.get("script") or existing.get("no_agent")):
279
- raise ValueError("SCHEDULE_PAYLOAD_READ_ONLY")
280
- if "schedule" in patch:
281
- spec["schedule"] = _scheduled_text(patch["schedule"], zone)
282
- jobs.parse_schedule(spec["schedule"])
283
- if "model" in patch:
284
- spec["model"] = patch.get("nativeModel") or None
285
- spec["provider"] = patch.get("nativeProvider") or None
286
- if operation == "schedule.create":
287
- if not (spec.get("prompt") or spec.get("skills")) or not spec.get("schedule"):
288
- raise ValueError("SCHEDULE_PAYLOAD_REQUIRED")
289
- spec["origin"] = {"platform": "fridaynext", "chat_id": device, "user_id": "owner", "chat_type": "dm"}
290
- spec.setdefault("deliver", "origin")
291
- if "delivery" in patch:
292
- delivery = patch["delivery"]
293
- if not isinstance(delivery, dict):
294
- raise ValueError("SCHEDULE_DELIVERY_INVALID")
295
- if delivery.get("mode") == "none":
296
- spec["deliver"] = "local"
297
- elif delivery.get("mode") == "announce":
298
- channel = delivery.get("channel")
299
- if channel not in {row["id"] for row in channels()}:
300
- raise ValueError("SCHEDULE_DELIVERY_UNAVAILABLE")
301
- target = delivery.get("to")
302
- if channel == "friday-next":
303
- if target not in (None, device):
304
- raise ValueError("SCHEDULE_DEVICE_MISMATCH")
305
- spec["deliver"] = "fridaynext:" + device
306
- else:
307
- spec["deliver"] = channel + (":" + target if isinstance(target, str) and target else "")
308
- else:
309
- raise ValueError("SCHEDULE_DELIVERY_INVALID")
310
- if operation == "schedule.create":
311
- if not spec.get("name"):
312
- spec.pop("name", None)
313
- spec["paused"] = patch.get("enabled") is False
314
- if prepare:
315
- prepare()
316
- created = create_job_with_scheduler_registration(**spec)
317
- return {"status": "applied", "value": {"job": _scheduled_wire(created, zone)}}
318
- if operation == "schedule.update":
319
- if prepare:
320
- prepare()
321
- changed = jobs.update_job(identifier, spec) if spec else existing
322
- if "enabled" in patch:
323
- changed = jobs.resume_job(identifier) if patch["enabled"] else jobs.pause_job(identifier)
324
- notify()
325
- return {"status": "applied", "value": {"job": _scheduled_wire(changed, zone)}}
326
- if operation == "schedule.delete":
327
- if prepare:
328
- prepare()
329
- removed = jobs.remove_job(identifier)
330
- notify()
331
- return {"status": "applied", "value": {"removed": removed}}
332
- if operation == "schedule.run":
333
- # 原生trigger只安排下一次tick,不在管理请求里另开Agent循环或宣称执行完成。
334
- if existing.get("run_claim") or existing.get("fire_claim"):
335
- return {"status": "applied", "value": {"ran": False, "reason": "already-running"}}
336
- if prepare:
337
- prepare()
338
- queued = jobs.trigger_job(identifier)
339
- notify()
340
- return {"status": "applied", "value": {"ran": queued is not None}}
341
- raise ValueError("SCHEDULE_OPERATION_UNSUPPORTED")
342
- finally:
343
- if secret_token is not None:
344
- reset_secret_scope(secret_token)
345
- reset_hermes_home_override(home_token)
346
-
347
-
348
- def profile_scheduled_delivery(profile, job_id, device):
349
- """核验原生执行或本进程正在投递的持久队列;终态记录本身不授予发送权。"""
350
- import json
351
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
352
- from cron import jobs, delivery_queue
353
- from cron.executions import live_inflight_execution, get_execution
354
- from datetime import datetime
355
- token = set_hermes_home_override(str(profile))
356
- try:
357
- with _scheduled_lock, jobs.use_cron_store(profile):
358
- queued = []
359
- # 固定兼容:Gateway的drain认领后才进入此集合;不接受pending、旧终态或别的进程的队列。
360
- for execution_id in tuple(delivery_queue._ACTIVE_DELIVERIES):
361
- receipt = delivery_queue.get_status(execution_id)
362
- execution = get_execution(execution_id)
363
- if (not receipt or receipt.get("status") != "delivering" or receipt.get("owner_pid") != os.getpid()
364
- or receipt.get("owner_process_id") != delivery_queue._PROCESS_ID
365
- or not execution or execution.get("job_id") != job_id):
366
- continue
367
- original = json.loads(receipt["job_json"])
368
- if original.get("id") == job_id:
369
- if receipt.get("for_failure") and original.get("failure_deliver"):
370
- original["deliver"] = original["failure_deliver"]
371
- queued.append((original, execution))
372
- if len(queued) > 1:
373
- return None
374
- job, execution = queued[0] if queued else (jobs.get_job(job_id), live_inflight_execution(job_id))
375
- if not job or not execution:
376
- return None
377
- origin = job.get("origin") or {}
378
- targets = (job.get("deliver") or "local").split(",")
379
- own = ("origin" in targets and origin.get("platform") == "fridaynext" and origin.get("chat_id") == device
380
- or "fridaynext:" + device in targets)
381
- if not own:
382
- return None
383
- return {"jobId": job_id, "executionId": execution["id"], "title": job.get("name") or job_id,
384
- "occurredAt": datetime.fromisoformat(execution.get("started_at") or execution["claimed_at"]).timestamp() * 1000}
385
- finally:
386
- reset_hermes_home_override(token)
387
-
388
-
389
- def native_reply_text(context, text):
390
- """共享CLI公开api_text没有回复字段,复用固定宿主原生上下文格式,不复制模板。"""
391
- from gateway.platforms.event import MessageEvent
392
- from gateway.run_inbound import GatewayInboundMixin
393
- from .reply_context import native_fields
394
- event = MessageEvent(text=text, **native_fields(context))
395
- return GatewayInboundMixin._prepend_inbound_reply_context(event, None, text)
396
-
397
-
398
- def profile_scheduled_inspection(profile, job_id, execution_id):
399
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
400
- from cron.executions import get_execution
401
- token = set_hermes_home_override(str(profile))
402
- try:
403
- row = get_execution(execution_id)
404
- if not row or row.get("job_id") != job_id:
405
- return {"state": "unknown", "reason": "SCHEDULE_EXECUTION_UNCONFIRMED"}
406
- state = {"claimed": "running", "running": "running", "completed": "completed", "failed": "failed"}.get(row.get("status"), "unknown")
407
- return {"state": state, **({"reason": "SCHEDULE_EXECUTION_FAILED", "error": row.get("error")} if state == "failed" else {})}
408
- finally:
409
- reset_hermes_home_override(token)
410
-
411
-
412
- def _scheduled_runs(profile, job, limit):
413
- """读取同一Profile的原生会话和执行记录,不从一份当前状态补造多条历史。"""
414
- from datetime import datetime
415
- from cron.executions import list_executions, get_execution
416
- from hermes_state import SessionDB
417
- count = max(1, min(int(limit), 100))
418
- runs = []
419
- seen = set()
420
- state = Path(profile) / "state.db"
421
- if state.is_file():
422
- db = SessionDB(db_path=state, read_only=True)
423
- try:
424
- for row in db.list_cron_job_runs(job["id"], limit=count, offset=0):
425
- messages = db.get_messages(row["id"])
426
- text = "\n".join(str(item.get("content") or "") for item in messages if item.get("role") == "assistant")
427
- execution = get_execution(row["cron_execution_id"]) if row.get("cron_execution_id") else None
428
- if execution and execution.get("job_id") != job["id"]:
429
- execution = None
430
- run_id = execution["id"] if execution else row["id"]
431
- seen.add(run_id)
432
- runs.append({"ts": row["started_at"] * 1000, "runId": run_id, "summary": text,
433
- "status": {"completed": "ok", "failed": "error"}.get((execution or {}).get("status")),
434
- "error": (execution or {}).get("error")})
435
- finally:
436
- db.close()
437
- for row in list_executions(job_id=job["id"], limit=count):
438
- if row["id"] not in seen:
439
- runs.append({"ts": datetime.fromisoformat(row["claimed_at"]).timestamp() * 1000, "runId": row["id"],
440
- "status": {"completed": "ok", "failed": "error"}.get(row.get("status")), "error": row.get("error")})
441
- return {"runs": sorted(runs, key=lambda row: row["ts"], reverse=True)[:count]}
442
-
443
-
444
- def reasoning_effort_levels():
445
- """读取固定宿主认可的请求档位;厂商wire映射仍由Hermes负责,不复制另一份梯级。"""
446
- global _reasoning_options_warning_emitted
447
- if not _reasoning_options_warning_emitted:
448
- _reasoning_options_warning_emitted = True
449
- logger.warning(
450
- "hermes.compat.reasoning_options_v0_22_5:公开model.options不含完整档位,"
451
- "读取固定版词表;公开接口可用后替换,读取失败不发布选项"
452
- )
453
- try:
454
- from hermes_constants import VALID_REASONING_EFFORTS, parse_reasoning_effort
455
-
456
- return [level for level in dict.fromkeys(VALID_REASONING_EFFORTS)
457
- if isinstance(level, str)
458
- and parse_reasoning_effort(level) == {"enabled": True, "effort": level}]
459
- except Exception:
460
- return []
461
-
462
-
463
- def _warn_message_speech_compat():
464
- """固定版消息朗读只发一次告警;不记录文本、音频或profile路径。"""
465
- global _message_speech_warning_emitted
466
- if _message_speech_warning_emitted:
467
- return
468
- _message_speech_warning_emitted = True
469
- logger.warning(
470
- "hermes.compat.message_speech_v0_22_5:消息朗读依赖固定版TTS内部函数"
471
- "(check_tts_requirements/_load_tts_config/_get_provider/text_to_speech_tool/"
472
- "_resolve_max_text_length);公开TTS接口可用后替换"
473
- )
474
-
475
-
476
- def message_speech_config(profile):
477
- """固定版消息朗读配置:在profile作用域读取provider可用性、名称和输入上限。"""
478
- _warn_message_speech_compat()
479
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
480
- from tools import tts_tool
481
- from tools.tts_tool_delivery import _resolve_max_text_length
482
-
483
- token = set_hermes_home_override(profile)
484
- try:
485
- tts_config = tts_tool._load_tts_config()
486
- provider = tts_tool._get_provider(tts_config)
487
- return {
488
- "available": bool(tts_tool.check_tts_requirements()),
489
- "provider": provider,
490
- "maxTextLength": _resolve_max_text_length(provider, tts_config),
491
- }
492
- finally:
493
- reset_hermes_home_override(token)
494
-
495
-
496
- class _DropCurrentThreadLogs(logging.Filter):
497
- """只丢弃本合成线程的宿主TTS日志,避免私有临时路径进入生产日志。"""
498
-
499
- def __init__(self):
500
- super().__init__()
501
- self.thread = threading.get_ident()
502
-
503
- def filter(self, record):
504
- return record.thread != self.thread
505
-
506
-
507
- def message_speech_synthesize(profile, text, output_path):
508
- """固定版TTS合成:调用原text_to_speech_tool,返回其JSON envelope。
509
-
510
- 同步函数;调用方负责放到线程中执行并清理output_path所在私有临时目录。
511
- 宿主TTS会在INFO/错误日志中打印输出路径;这里仅在本线程合成期间过滤这两个固定版logger,
512
- 不改Hermes core,也不影响其他线程的原生日志。
513
- """
514
- _warn_message_speech_compat()
515
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
516
- from tools import tts_tool, tts_command_provider # noqa: F401(固定版logger存在性由导入证明)
517
-
518
- filters = []
519
- for name in ("tools.tts_tool", "tools.tts_command_provider"):
520
- target = logging.getLogger(name)
521
- current = _DropCurrentThreadLogs()
522
- target.addFilter(current)
523
- filters.append((target, current))
524
- token = set_hermes_home_override(profile)
525
- try:
526
- if not tts_tool.check_tts_requirements():
527
- raise RuntimeError("TTS_UNAVAILABLE")
528
- return tts_tool.text_to_speech_tool(text, output_path=str(output_path))
529
- finally:
530
- reset_hermes_home_override(token)
531
- for target, current in filters:
532
- target.removeFilter(current)
533
-
534
-
535
- def profile_default_config(profile, *, expected_version=None, update=None, prepare=None):
536
- """固定0.22.5配置兼容:当前owner Profile内CAS及一次原子文件写入。
537
-
538
- 公开RPC不能成对保存主模型/思考;复用宿主配置锁、保留注释的原子writer与真实解析器。
539
- 不接受远端Profile路径,不保存展开后的凭据,不修改Hermes core。
540
- """
541
- import hashlib
542
- import json
543
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override, resolve_reasoning_config, parse_reasoning_effort
544
- from hermes_cli import config as config_mod
545
-
546
- global _profile_defaults_warning_emitted
547
- if not _profile_defaults_warning_emitted:
548
- _profile_defaults_warning_emitted = True
549
- logger.warning("hermes.compat.profile_defaults_v0_22_5:使用固定版配置锁/原子writer,非公开稳定默认写入RPC")
550
- token = set_hermes_home_override(profile)
551
- def digest(value):
552
- return hashlib.sha256(json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode()).hexdigest()
553
- try:
554
- with config_mod._CONFIG_LOCK:
555
- path = config_mod.get_config_path()
556
- raw = config_mod.require_readable_config_before_write(path)
557
- if not isinstance(raw, dict):
558
- raise ValueError("DEFAULT_CONFIG_UNREADABLE")
559
- def snapshot():
560
- current_raw = config_mod.require_readable_config_before_write(path)
561
- effective = config_mod.load_config()
562
- model = effective.get("model", {})
563
- model = model if isinstance(model, dict) else {"default": model}
564
- name = model.get("default") or model.get("model") or ""
565
- reasoning = resolve_reasoning_config(effective, name)
566
- effort = "none" if isinstance(reasoning, dict) and reasoning.get("enabled") is False else (reasoning or {}).get("effort")
567
- return {"version": digest([str(Path(profile).resolve()), current_raw, effective]),
568
- "fingerprint": digest(current_raw), "writable": not config_mod.is_managed(), "model": name, "provider": model.get("provider", ""),
569
- "thinkingLevel": effort}
570
- before = snapshot()
571
- if update is None:
572
- return before
573
- if before["version"] != expected_version:
574
- return {"status": "conflict", "snapshot": before}
575
- if config_mod.is_managed():
576
- raise ValueError("DEFAULT_CONFIG_MANAGED")
577
- if set(update) - {"model", "provider", "thinkingLevel"} or any(
578
- not isinstance(update.get(key), str) or not update[key].strip() for key in ("model", "provider")
579
- ):
580
- raise ValueError("INVALID_DEFAULT_SELECTION")
581
- if "thinkingLevel" in update and parse_reasoning_effort(update["thinkingLevel"]) is None:
582
- raise ValueError("INVALID_DEFAULT_REASONING")
583
- # raw保留模板和无关键;一次写入同时提交模型/provider与明确选择的思考。
584
- import copy
585
- target = copy.deepcopy(raw)
586
- model = target.get("model")
587
- model = model if isinstance(model, dict) else {}
588
- from hermes_cli.model_switch import ModelSwitchResult, apply_model_selection
589
- from hermes_cli.providers import resolve_provider_full, determine_api_mode
590
- from hermes_cli.web_server_config import _resolve_assignment_credentials
591
- effective = config_mod.load_config()
592
- definition = resolve_provider_full(update["provider"], effective.get("providers"), effective.get("custom_providers"))
593
- same_provider = model.get("provider") == update["provider"]
594
- base_url = (model.get("base_url") or "") if same_provider else (definition.base_url if definition else "")
595
- if not same_provider and definition is None:
596
- raise ValueError("DEFAULT_PROVIDER_ROUTE_UNRESOLVED")
597
- result = ModelSwitchResult(success=True, new_model=update["model"], target_provider=update["provider"],
598
- base_url=base_url, api_mode=determine_api_mode(update["provider"], base_url, update["model"]))
599
- target["model"] = apply_model_selection(model, result)
600
- _resolve_assignment_credentials(target["model"], update["provider"], (effective.get("providers") or {}).get(update["provider"]))
601
- if "thinkingLevel" in update:
602
- agent = target.setdefault("agent", {})
603
- if not isinstance(agent, dict):
604
- raise ValueError("INVALID_AGENT_CONFIG")
605
- overrides = agent.setdefault("reasoning_overrides", {})
606
- if not isinstance(overrides, dict):
607
- raise ValueError("INVALID_REASONING_OVERRIDES")
608
- agent["reasoning_effort"] = update["thinkingLevel"]
609
- # 精确模型键优先于拼写/前缀兼容匹配;保留其他模型的专项配置。
610
- overrides[update["model"]] = update["thinkingLevel"]
611
- resolved = resolve_reasoning_config(target, update["model"])
612
- if resolved != parse_reasoning_effort(update["thinkingLevel"]):
613
- raise ValueError("DEFAULT_REASONING_NOT_EFFECTIVE")
614
- if prepare:
615
- prepare(digest(target))
616
- # 原生模型选择会删除旧路由的端点/凭据指针;其余完整raw快照保持。
617
- config_mod.atomic_config_replace(path, target)
618
- after = snapshot()
619
- if after["model"] != update["model"] or after["provider"] != update["provider"] or (
620
- "thinkingLevel" in update and after["thinkingLevel"] != update["thinkingLevel"]
621
- ):
622
- raise ValueError("DEFAULT_READBACK_MISMATCH")
623
- return {"status": "applied", "snapshot": after}
624
- finally:
625
- reset_hermes_home_override(token)
626
-
627
-
628
- def model_display_names(profile, models):
629
- """固定版展示兼容:只读原profile的名称元数据,不刷新网络或改变模型身份。"""
630
- global _model_names_warning_emitted
631
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
632
-
633
- token = set_hermes_home_override(profile)
634
- names = {}
635
- try:
636
- from agent.models_dev import get_model_info
637
- from hermes_cli.config import load_config_readonly
638
-
639
- config = load_config_readonly()
640
- for model in models:
641
- try:
642
- info = get_model_info(model["provider"], model["name"], allow_network=False, config=config)
643
- name = info.name if info else None
644
- if isinstance(name, str) and name.strip():
645
- names[(model["provider"], model["name"])] = name.strip()
646
- except Exception:
647
- if not _model_names_warning_emitted:
648
- _model_names_warning_emitted = True
649
- logger.warning("hermes.compat.model_names_v0_22_5:名称元数据不可读,保留原模型ID")
650
- except Exception:
651
- if not _model_names_warning_emitted:
652
- _model_names_warning_emitted = True
653
- logger.warning("hermes.compat.model_names_v0_22_5:名称配置不可读,保留原模型ID")
654
- finally:
655
- reset_hermes_home_override(token)
656
- return names
657
-
658
-
659
- def resolved_reasoning_default(model: str):
660
- """固定版兼容:用Hermes自身合并配置解析当前模型的默认reasoning effort。
661
-
662
- Hermes 0.22.5 的公开 model.options 不发布默认值;这里只读 `hermes_cli.config.load_config_readonly()`
663
- 的合并结果,再走 `hermes_constants.resolve_reasoning_config()`(per-model overrides → 全局
664
- agent.reasoning_effort → 无配置则 None,交给provider默认)。读取失败不发布默认值并告警,
665
- 不写配置、不创建会话、不猜测档位。
666
- """
667
- global _resolved_default_warning_emitted
668
- if not isinstance(model, str) or not model.strip():
669
- return None
670
- try:
671
- from hermes_cli.config import load_config_readonly
672
- from hermes_constants import resolve_reasoning_config
673
-
674
- return resolve_reasoning_config(load_config_readonly(), model)
675
- except Exception:
676
- if not _resolved_default_warning_emitted:
677
- _resolved_default_warning_emitted = True
678
- logger.warning(
679
- "hermes.compat.resolved_reasoning_default_v0_22_5:无法读取宿主默认思考强度,"
680
- "模型目录不发布defaultValue(公开默认值API可用后替换)"
681
- )
682
- return None
683
-
684
-
685
- def profile_reasoning_default(profile, model):
686
- """目录默认与写入使用同一owner Profile;ContextVar不污染其他Profile。"""
687
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
688
- token = set_hermes_home_override(profile)
689
- try:
690
- return resolved_reasoning_default(model)
691
- finally:
692
- reset_hermes_home_override(token)
693
-
694
-
695
- CRITICAL_FILES = [
696
- "hermes_cli/commands.py", "hermes_cli/plugins.py", "agent/skill_commands.py",
697
- "gateway/slash_commands.py", "gateway/session_commands.py", "gateway/session_policy.py", "gateway/session_context.py",
698
- "hermes_time.py",
699
- "cron/jobs.py",
700
- "cron/scheduler.py",
701
- "cron/scheduler_provider.py",
702
- "cron/scheduler_delivery.py",
703
- "cron/blueprint_catalog.py",
704
- "cron/executions.py",
705
- "cron/delivery_queue.py",
706
- "gateway/delivery.py",
707
- "gateway/session_authorities.py",
708
- "gateway/session_identity.py",
709
- "gateway/session.py",
710
- "gateway/platforms/base.py",
711
- "hermes_state_runtime.py",
712
- "gateway/session_envelope.py",
713
- "gateway/session_authority.py",
714
- "gateway/authz_mixin.py",
715
- "gateway/run_adapters.py",
716
- "gateway/run_inbound.py",
717
- "gateway/run_inbound_hooks.py",
718
- "gateway/run.py",
719
- "gateway/run_busy.py",
720
- "gateway/run_startup.py",
721
- "gateway/run_runtime_init.py",
722
- "gateway/session_ingress.py",
723
- "gateway/session_ingress_burst.py",
724
- "gateway/platforms/event.py",
725
- "gateway/session_ingress_media.py",
726
- "agent/image_routing.py",
727
- "agent/session_persistence.py",
728
- "gateway/session_images.py",
729
- "tui_gateway/prompt_attachments.py",
730
- "gateway/session_authority.py",
731
- "gateway/session_pending_controls.py",
732
- "tools/approval.py",
733
- "tools/approval_context.py",
734
- "gateway/session_context.py",
735
- "tools/approval_gateway_wait.py",
736
- "tools/clarify_gateway.py",
737
- "gateway/session_server_requests.py",
738
- "gateway/session_usage.py",
739
- "gateway/session_controls.py",
740
- "gateway/session_events.py",
741
- "gateway/session_contract.py",
742
- "gateway/runtime_ownership.py",
743
- "gateway/control_socket.py",
744
- "gateway/run_bootstrap.py",
745
- "tui_gateway/transport.py",
746
- "gateway/session_context.py",
747
- "agent/plugin_stream_hooks.py",
748
- "agent/stream_delivery.py",
749
- "agent/secret_scope.py",
750
- "tui_gateway/launch_profile_policy.py",
751
- ]
752
-
753
-
754
- class MediaDeliveryBoundary:
755
- def media_source_references(self, event, extracted):
756
- # pre_extract是固定_ExtractedResponse内部字段,并非公开保证;只读配对,不改parser/dispatcher。
757
- from gateway.platforms.base import _ExtractedResponse
758
- if not isinstance(extracted, _ExtractedResponse):
759
- return ()
760
- targets = list(dict.fromkeys([path for path, _ in extracted.media_files] + extracted.local_files))
761
- original = getattr(extracted, "pre_extract", None)
762
- if not isinstance(original, str):
763
- return tuple((target, None) for target in targets)
764
- with self._media_delivery_scope(event.source):
765
- media, body = self.extract_media(original)
766
- _, body = self.extract_images(body)
767
- local, _ = self.extract_local_files(body)
768
- candidates = list(dict.fromkeys([path for path, _ in media] + local))
769
- route = self._source_session_key(event.source)
770
- mapped = [(candidate, self.validate_media_delivery_path(candidate, session_key=route)) for candidate in candidates]
771
- # 多义/失配只拒绝对应目标;不以basename或唯一当前run归属其他合法输出。
772
- return tuple((target, matches[0] if len(matches := [raw for raw, normalized in mapped if normalized == target]) == 1 else None)
773
- for target in targets)
774
-
775
- async def extract_owned_response(self, record, response):
776
- # 只投影原持久结果;此event不重新进入handle_message、授权或模型循环。
777
- lease = self._recovery().lease()
778
- event = await lease[0].delivery_event(record)
779
- self._recovery().check(lease)
780
- if event is None:
781
- return None
782
- extracted = await self._extract_response_content(response, event, self._source_session_key(event.source), is_ephemeral_response=False)
783
- self._recovery().check(lease)
784
- return extracted
785
-
786
- async def _deliver_attachments(self, event, *args, **kwargs):
787
- # 正常及原生恢复均经此含原event的固定边界;parser/派发全部继续使用SDK原实现。
788
- extracted = args[0] if args else kwargs.get("extracted")
789
- if extracted is not None and not any(getattr(extracted, field, ()) for field in ("images", "media_files", "local_files")):
790
- return await super()._deliver_attachments(event, *args, **kwargs)
791
- references = self.media_source_references(event, extracted)
792
- async with self.delivery_context(event, media_sources=references):
793
- return await super()._deliver_attachments(event, *args, **kwargs)
794
-
795
-
796
- def verified_source():
797
- root = Path(gateway_config.__file__).resolve().parents[1]
798
- try:
799
- revision = subprocess.check_output(
800
- ["git", "-C", str(root), "rev-parse", "HEAD"],
801
- text=True,
802
- stderr=subprocess.DEVNULL,
803
- timeout=3,
804
- ).strip()
805
- clean = (
806
- subprocess.run(
807
- [
808
- "git",
809
- "-C",
810
- str(root),
811
- "diff",
812
- "--quiet",
813
- "HEAD",
814
- "--",
815
- *CRITICAL_FILES,
816
- ],
817
- stderr=subprocess.DEVNULL,
818
- timeout=3,
819
- ).returncode
820
- == 0
821
- )
822
- except (OSError, subprocess.SubprocessError):
823
- raise PublicRuntimeUnavailable("HERMES_COMPAT_REVISION_UNVERIFIED")
824
- if revision != APPROVED_REVISION or not clean:
825
- raise PublicRuntimeUnavailable("HERMES_COMPAT_REVISION_UNSUPPORTED")
826
- return root
827
-
828
-
829
- class BindingLocator:
830
- platform = "fridaynext"
831
- hermes_version = "0.22.5"
832
-
833
- def __init__(self, adapter, profile):
834
- verified_source()
835
- logger.warning("hermes.compat.media_source_reference_v0_22_5:依赖内部pre_extract;公开原引用接缝可用后替换")
836
- # 静态导入保留validator可见性;不动态拼接名称隐藏耦合。
837
- from gateway.session_authorities import authority_for_home, owner_scope
838
- from gateway.session_identity import identity_of
839
- from hermes_state_runtime import list_session_admissions
840
-
841
- self.adapter = adapter
842
- self.profile_home = str(profile)
843
- self.authority_for_home = authority_for_home
844
- self.owner_scope = owner_scope
845
- self.identity_of = identity_of
846
- self.list_admissions = list_session_admissions
847
- self.observed_controls = {}
848
- self.reasoning_sources = OrderedDict()
849
- self.reasoning_lock = threading.Lock()
850
- self.reasoning_warning_emitted = False
851
-
852
- def publish_reasoning(self, event):
853
- """公开钩子的文本,用原回调 ContextVar 输入身份发布到原执行的回放流。
854
-
855
- 公开钩子没有 admission/generation;这里不按会话取最新运行,也不替换 Agent 回调。
856
- 固定版 observer 复制产生事件时的上下文,迟到回调仍指向旧输入,原代发布会拒绝它。
857
- """
858
- from hermes_constants import get_hermes_home
859
- from gateway.session_context import (
860
- _SESSION_MESSAGE_ID, _SESSION_CHAT_ID, _SESSION_KEY, _SESSION_ID, _SESSION_PLATFORM,
861
- )
862
-
863
- delta = event.get("delta")
864
- native, turn, iteration = event.get("session_id"), event.get("turn_id"), event.get("iteration")
865
- source = (_SESSION_MESSAGE_ID.get(None), _SESSION_CHAT_ID.get(None), _SESSION_KEY.get(None),
866
- _SESSION_ID.get(None), _SESSION_PLATFORM.get(None))
867
- if (event.get("kind") != "reasoning" or not isinstance(delta, str) or not delta
868
- or not isinstance(turn, str) or not turn or type(iteration) is not int or iteration < 1
869
- or any(not isinstance(value, str) or not value for value in source)
870
- or source[3] != native or source[4] != self.platform or event.get("surface") != self.platform
871
- or str(Path(get_hermes_home()).resolve()) != self.profile_home):
872
- return False
873
- adapter = self.adapter
874
- runtime = adapter.runtime
875
- identity = getattr(getattr(runtime, "client", None), "identity", None)
876
- if not adapter.plugin_enabled or not identity or adapter.host is None:
877
- return False
878
- authority = self.authority()
879
- if identity.get("authority_epoch") != authority.epoch:
880
- return False
881
- input_id, chat_id, session_key, _, _ = source
882
- with self.reasoning_lock:
883
- if not self.reasoning_warning_emitted:
884
- self.reasoning_warning_emitted = True
885
- logger.warning("hermes.compat.reasoning_identity_v0_22_5:文本来自公开on_stream_delta;原输入ContextVar与执行发布为固定版兼容接缝")
886
- key = (authority, authority.epoch, source, turn)
887
- original = self.reasoning_sources.get(key)
888
- if original is None:
889
- owner = authority.logical_owner(native)
890
- live = authority.sessions.get(owner)
891
- if (live is None or getattr(live.source, "chat_id", None) != chat_id
892
- or adapter._source_session_key(live.source) != session_key):
893
- return False
894
- with self.owner_scope(authority):
895
- rows = [row for row in self.list_admissions(authority.db, session_id=owner, pending_only=False)
896
- if row.get("request_id") == input_id]
897
- if len(rows) != 1:
898
- return False
899
- row = rows[0]
900
- payload = row.get("payload", {}).get("native_text_v1", {})
901
- original_source = payload.get("source", {})
902
- original_event = payload.get("event", {})
903
- if (original_source.get("platform") != self.platform or original_source.get("chat_id") != chat_id
904
- or original_source.get("message_id") != input_id or original_event.get("message_id") != input_id
905
- or original_event.get("allow_gateway_control") is not False
906
- or row.get("owner_epoch") != authority.epoch or type(row.get("generation")) is not int):
907
- return False
908
- original = (owner, row["generation"])
909
- self.reasoning_sources[key] = original
910
- while len(self.reasoning_sources) > 128:
911
- self.reasoning_sources.popitem(last=False)
912
- else:
913
- self.reasoning_sources.move_to_end(key)
914
- # 原生流锁同步检查执行代并打原准入stamp;停止后或下一代已运行则拒绝。
915
- return authority.publish_execution(*original, "reasoning.delta", {
916
- "text": delta, "turn_id": turn, "iteration": iteration,
917
- })
918
-
919
- def authority(self):
920
- value = self.authority_for_home(
921
- self.adapter.gateway_runner, Path(self.profile_home)
922
- )
923
- if value is None:
924
- raise RuntimeError("PROFILE_NOT_SERVED")
925
- return value
926
-
927
- def prepare_device_identity(self):
928
- """固定版实例观察器只复制原准入事实;不改宿主执行、授权或结果。"""
929
- authority = self.authority()
930
- if getattr(authority, "_fridaynext_device_identity", None) is not None:
931
- self.device_identity_authority = authority
932
- return True
933
- original = getattr(authority, "_execute_claimed", None)
934
- if not callable(original):
935
- return False
936
- profile = self.profile_home
937
- async def observe(ref, live, row):
938
- stamp = (authority, profile, ref.session_id, row.get("request_id"), row.get("admission_id"),
939
- row.get("generation"), row.get("owner_epoch"))
940
- token = _device_execution.set(stamp)
941
- try:
942
- return await original(ref, live, row)
943
- finally:
944
- _device_execution.reset(token)
945
- authority._fridaynext_device_identity = (original, observe)
946
- authority._execute_claimed = observe
947
- self.device_identity_authority = authority
948
- logger.warning("hermes.compat.device_execution_v0_22_5:公开工具上下文缺共享本地输入身份;实例观察器冻结原准入及执行代,不改变宿主执行")
949
- return True
950
-
951
- def release_device_identity(self):
952
- authority = getattr(self, "device_identity_authority", None)
953
- pair = getattr(authority, "_fridaynext_device_identity", None)
954
- if pair is not None and authority._execute_claimed is pair[1]:
955
- authority._execute_claimed = pair[0]
956
- del authority._fridaynext_device_identity
957
- self.device_identity_authority = None
958
-
959
- def device_tool_scope(self, session_id):
960
- """工具原线程的任务上下文;共享CLI会话也只认本插件提交的这一条输入。"""
961
- from hermes_constants import get_hermes_home
962
- from gateway.session_context import _SESSION_MESSAGE_ID, _SESSION_ID
963
- from tools.approval_context import _approval_tool_call_id, _approval_session_id
964
- message = _SESSION_MESSAGE_ID.get(None)
965
- native = _SESSION_ID.get(None)
966
- tool = _approval_tool_call_id.get()
967
- if (str(Path(get_hermes_home()).resolve()) != self.profile_home
968
- or not all(isinstance(v, str) and v for v in (native, session_id, tool))
969
- or native != session_id or _approval_session_id.get() != session_id):
970
- return None
971
- authority = self.authority()
972
- owner = authority.logical_owner(native)
973
- stamp = _device_execution.get()
974
- if stamp is not None and (stamp[0] is not authority or stamp[1] != self.profile_home or stamp[2] != owner):
975
- return None
976
- if not message and stamp is None:
977
- return None
978
- with self.owner_scope(authority):
979
- rows = [row for row in self.list_admissions(authority.db, session_id=owner, pending_only=False)
980
- if (not message or message in (row.get("request_id"), row.get("admission_id")))
981
- and (stamp is None or (row.get("request_id"), row.get("admission_id"),
982
- row.get("generation"), row.get("owner_epoch")) == stamp[3:])]
983
- if len(rows) != 1:
984
- return None
985
- row = rows[0]
986
- bindings = [r for r in self.adapter.bindings.all()
987
- if r.get("profile") == self.profile_home and r.get("service_id") == self.adapter.service_id
988
- and r.get("input_id") == row.get("request_id") and not r.get("legacy")]
989
- if len(bindings) != 1:
990
- return None
991
- record = bindings[0]
992
- # 标准平台源继续核对持久原输入;共享operator会话只允许本插件已保存的App提交。
993
- original = row.get("payload", {}).get("native_text_v1")
994
- if original is not None:
995
- source = original.get("source", {})
996
- if (source.get("platform") != self.platform or source.get("message_id") != record["input_id"]
997
- or original.get("event", {}).get("message_id") != record["input_id"]
998
- or original.get("event", {}).get("allow_gateway_control") is not False):
999
- return None
1000
- elif record.get("shared") is not True:
1001
- return None
1002
- scope = {"serviceInstanceId": self.adapter.service_id, "profileRoot": self.profile_home,
1003
- "runId": record["run_id"], "sessionKey": record["session_key"],
1004
- "nativeId": owner, "inputId": record["input_id"], "admissionId": row.get("admission_id"),
1005
- "generation": row.get("generation"), "authorityEpoch": row.get("owner_epoch"), "toolCallId": tool}
1006
- if not self.device_scope_matches(scope):
1007
- return None
1008
- if not getattr(self, "device_warning_emitted", False):
1009
- logger.warning("hermes.compat.device_identity_v0_22_5:工具注册为公开API;原调用ContextVar及准入执行代核验为固定版兼容接缝")
1010
- self.device_warning_emitted = True
1011
- return scope
1012
-
1013
- def device_scope_matches(self, scope):
1014
- """回包与IPC检查只复核冻结的原事实,不读取后来一次调用的当前上下文。"""
1015
- adapter, authority = self.adapter, self.authority()
1016
- identity = getattr(getattr(adapter.runtime, "client", None), "identity", {})
1017
- if (scope.get("profileRoot") != self.profile_home or scope.get("serviceInstanceId") != adapter.service_id
1018
- or scope.get("authorityEpoch") != authority.epoch or identity.get("authority_epoch") != authority.epoch
1019
- or type(scope.get("generation")) is not int or scope["generation"] < 1
1020
- or authority.executing.get(scope.get("nativeId")) != scope["generation"]):
1021
- return False
1022
- record = adapter.bindings.read(scope.get("runId", ""))
1023
- if (record is None or record.get("legacy") or record.get("profile") != self.profile_home
1024
- or record.get("service_id") != scope["serviceInstanceId"]
1025
- or record.get("input_id") != scope.get("inputId") or record.get("session_key") != scope.get("sessionKey")
1026
- or record.get("admission_id") not in (None, scope.get("admissionId"))
1027
- or record.get("native_id") is not None and authority.logical_owner(record["native_id"]) != scope.get("nativeId")):
1028
- return False
1029
- with self.owner_scope(authority):
1030
- rows = [r for r in self.list_admissions(authority.db, session_id=scope["nativeId"], pending_only=False)
1031
- if r.get("admission_id") == scope.get("admissionId") and r.get("request_id") == scope.get("inputId")]
1032
- return (len(rows) == 1 and rows[0].get("generation") == scope["generation"]
1033
- and rows[0].get("owner_epoch") == scope["authorityEpoch"] and rows[0].get("status") == "started")
1034
-
1035
- def subagent_owner(self, parent_session_id):
1036
- """公开子任务hook缺准入身份;只从产生回调的原输入ContextVar核对原持久记录。"""
1037
- from hermes_constants import get_hermes_home
1038
- from gateway.session_context import _SESSION_MESSAGE_ID, _SESSION_CHAT_ID, _SESSION_KEY, _SESSION_ID, _SESSION_PLATFORM
1039
- source = (_SESSION_MESSAGE_ID.get(None), _SESSION_CHAT_ID.get(None), _SESSION_KEY.get(None),
1040
- _SESSION_ID.get(None), _SESSION_PLATFORM.get(None))
1041
- if (any(not isinstance(v, str) or not v for v in source) or source[3] != parent_session_id
1042
- or source[4] != self.platform or str(Path(get_hermes_home()).resolve()) != self.profile_home):
1043
- return None
1044
- authority = self.authority()
1045
- identity = getattr(self.adapter.runtime.client, "identity", None)
1046
- if not identity or identity.get("authority_epoch") != authority.epoch:
1047
- return None
1048
- native = authority.logical_owner(parent_session_id)
1049
- live = authority.sessions.get(native)
1050
- if (live is None or getattr(live.source, "chat_id", None) != source[1]
1051
- or self.adapter._source_session_key(live.source) != source[2]):
1052
- return None
1053
- with self.owner_scope(authority):
1054
- rows = [r for r in self.list_admissions(authority.db, session_id=native, pending_only=False)
1055
- if r.get("request_id") == source[0]]
1056
- if len(rows) != 1:
1057
- return None
1058
- row = rows[0]
1059
- original = row.get("payload", {}).get("native_text_v1", {})
1060
- proof = original.get("source", {})
1061
- if (not isinstance(row.get("admission_id"), str) or not row["admission_id"]
1062
- or row.get("owner_epoch") != authority.epoch or type(row.get("generation")) is not int
1063
- or proof.get("platform") != self.platform or proof.get("chat_id") != source[1]
1064
- or proof.get("message_id") != source[0] or original.get("event", {}).get("message_id") != source[0]
1065
- or original.get("event", {}).get("allow_gateway_control") is not False):
1066
- return None
1067
- matches = [r for r in self.adapter.bindings.all() if r.get("input_id") == source[0]
1068
- and r.get("profile") == self.profile_home and r.get("service_id", self.adapter.service_id) == self.adapter.service_id]
1069
- if len(matches) != 1:
1070
- return None
1071
- if not getattr(self, "subagent_warning_emitted", False):
1072
- logger.warning("hermes.compat.subagent_identity_v0_22_5:公开observer沿原输入准入/执行代绑定;不借最新运行")
1073
- self.subagent_warning_emitted = True
1074
- return {"profile": self.profile_home, "service": self.adapter.service_id, "root_run_id": matches[0]["run_id"],
1075
- "input_id": source[0], "chat_id": source[1], "route": source[2], "native_id": source[3],
1076
- "admission_id": row["admission_id"], "authority_epoch": authority.epoch, "generation": row["generation"]}
1077
-
1078
- def subagent_context_matches(self, scope):
1079
- from hermes_constants import get_hermes_home
1080
- from gateway.session_context import _SESSION_MESSAGE_ID, _SESSION_CHAT_ID, _SESSION_KEY, _SESSION_PLATFORM
1081
- authority = self.authority()
1082
- if not (scope.get("profile") == str(Path(get_hermes_home()).resolve()) == self.profile_home
1083
- and scope.get("service") == self.adapter.service_id
1084
- and scope.get("authority_epoch") == authority.epoch
1085
- and _SESSION_MESSAGE_ID.get(None) == scope.get("input_id")
1086
- and _SESSION_CHAT_ID.get(None) == scope.get("chat_id")
1087
- and _SESSION_KEY.get(None) == scope.get("route") and _SESSION_PLATFORM.get(None) == self.platform):
1088
- return False
1089
- # 后台子任务允许晚于父下一轮结束;核对原准入,不借当前正在执行的generation。
1090
- with self.owner_scope(authority):
1091
- rows = [row for row in self.list_admissions(authority.db,
1092
- session_id=authority.logical_owner(scope["native_id"]), pending_only=False)
1093
- if row.get("request_id") == scope["input_id"]]
1094
- if len(rows) != 1:
1095
- return False
1096
- row = rows[0]
1097
- if (row.get("admission_id") != scope.get("admission_id") or row.get("generation") != scope.get("generation")
1098
- or row.get("owner_epoch") != scope["authority_epoch"]):
1099
- return False
1100
- bindings = [binding for binding in self.adapter.bindings.all()
1101
- if binding.get("input_id") == scope["input_id"] and binding.get("profile") == self.profile_home
1102
- and binding.get("service_id", self.adapter.service_id) == self.adapter.service_id]
1103
- return len(bindings) == 1 and bindings[0].get("run_id") == scope.get("root_run_id")
1104
-
1105
- def _continuation_admission(self, scope):
1106
- """只认宿主已持久准入的自动回报;不按最新运行或通知正文认领。"""
1107
- authority = self.authority()
1108
- if (scope.get("profile") != self.profile_home or scope.get("service") != self.adapter.service_id
1109
- or scope.get("authority_epoch") != authority.epoch):
1110
- return None
1111
- owner = authority.logical_owner(scope["native_id"])
1112
- if any(authority.logical_owner(native) != owner for native in scope.get("origin_native_ids", [])):
1113
- return None
1114
- live = authority.sessions.get(owner)
1115
- if (live is None or getattr(live.source, "chat_id", None) != scope.get("chat_id")
1116
- or self.adapter._source_session_key(live.source) != scope.get("route")):
1117
- return None
1118
- with self.owner_scope(authority):
1119
- rows = [row for row in self.list_admissions(authority.db, session_id=owner, pending_only=False)
1120
- if row.get("request_id") == scope["input_id"]]
1121
- if len(rows) != 1:
1122
- return None
1123
- row = rows[0]
1124
- envelope = row.get("payload", {}).get("native_text_v1", {})
1125
- source, event, automation = (envelope.get(key, {}) for key in ("source", "event", "automation"))
1126
- if (row.get("principal_id") != "automation:" + scope["route"]
1127
- or source.get("platform") != self.platform or source.get("chat_id") != scope["chat_id"]
1128
- or source.get("message_id") is not None or envelope.get("route") != scope["route"]
1129
- or event.get("message_id") != scope["input_id"]
1130
- or automation.get("identity") != scope["input_id"] or automation.get("owner") != owner
1131
- or automation.get("notification_category") == "diagnostic"
1132
- or row.get("owner_epoch") != authority.epoch or type(row.get("generation")) is not int
1133
- or not isinstance(row.get("admission_id"), str) or not row["admission_id"]):
1134
- return None
1135
- identities = automation.get("identities", [automation["identity"]])
1136
- if not isinstance(identities, list) or not identities:
1137
- return None
1138
- producers = []
1139
- for value in identities:
1140
- try:
1141
- identity = json.loads(value)
1142
- except (ValueError, TypeError):
1143
- return None
1144
- if (not isinstance(identity, list) or len(identity) != 3 or identity[0] != "async_delegation"
1145
- or not isinstance(identity[1], str) or not identity[1] or identity[2] != ""):
1146
- return None
1147
- producers.append(identity[1])
1148
- return {**scope, "admission_id": row["admission_id"], "generation": row["generation"],
1149
- "producer_ids": sorted(set(producers))}
1150
-
1151
- def continuation_owner(self, frame):
1152
- """公开会话流自带原执行戳;只读补全其自动准入及producer身份。"""
1153
- native = frame.get("session_id")
1154
- admission = frame.get("admission_id")
1155
- epoch, generation = frame.get("authority_epoch"), frame.get("execution_generation")
1156
- if (not isinstance(native, str) or not native or not isinstance(admission, str) or not admission
1157
- or type(epoch) is not int or type(generation) is not int):
1158
- return None
1159
- authority = self.authority()
1160
- identity = getattr(self.adapter.runtime.client, "identity", None)
1161
- if not identity or identity.get("authority_epoch") != epoch or authority.epoch != epoch:
1162
- return None
1163
- owner = authority.logical_owner(native)
1164
- live = authority.sessions.get(owner)
1165
- if live is None or getattr(live.source.platform, "value", None) != self.platform:
1166
- return None
1167
- with self.owner_scope(authority):
1168
- rows = [row for row in self.list_admissions(authority.db, session_id=owner, pending_only=False)
1169
- if row.get("admission_id") == admission]
1170
- if len(rows) != 1: return None
1171
- scope = self._continuation_admission({"profile": self.profile_home, "service": self.adapter.service_id,
1172
- "input_id": rows[0]["request_id"], "chat_id": live.source.chat_id,
1173
- "route": self.adapter._source_session_key(live.source), "native_id": native, "authority_epoch": epoch})
1174
- if scope is None or scope["generation"] != generation: return None
1175
- if not getattr(self, "continuation_warning_emitted", False):
1176
- logger.warning("hermes.compat.continuation_identity_v0_22_5:公开会话流沿原执行戳只读绑定自动准入;终态读取prompt.receipt")
1177
- self.continuation_warning_emitted = True
1178
- return scope
1179
-
1180
- def continuation_matches(self, scope):
1181
- current = self._continuation_admission(scope)
1182
- return current is not None and all(current.get(key) == scope.get(key) for key in (
1183
- "admission_id", "generation", "producer_ids"))
1184
-
1185
- def ingress_rejection(self, source):
1186
- """宿主 ingress 丢事件后,判断这是不是"明确未授权"。
1187
-
1188
- 宿主把不在允许列表里的发送者直接丢弃(`gateway/run_inbound.py` 的 "Unauthorized user"),
1189
- 只留下 None,客户端看不到任何原因(FN-171)。这里用宿主自己的授权判定复核同一来源:
1190
- 只有明确 False 才是确定拒绝;None(没装回调,"trust unknown")、True、异常或非布尔都
1191
- 不算,保持原来的 unknown 语义,不把合法入站误判成拒绝。
1192
- """
1193
- runner = self.adapter.gateway_runner
1194
- probe = getattr(runner, "_is_user_authorized_for_source", None)
1195
- if not callable(probe):
1196
- return None
1197
- try:
1198
- verdict = probe(source)
1199
- except Exception:
1200
- return None
1201
- if verdict is not False:
1202
- return None
1203
- return InputAdmissionRefused("HOST_SOURCE_UNAUTHORIZED", "ingress-auth")
1204
-
1205
- def validate_source(self, source):
1206
- self.adapter._canonicalize(source)
1207
- identity = self.identity_of(source)
1208
- return identity is not None and Path(identity.runtime_home).resolve() == Path(
1209
- self.profile_home
1210
- )
1211
-
1212
- def input_media_policy(self, *, shared=False):
1213
- # 只通过公开图片大小helper读原owner profile;范围切换继续收在固定兼容层。
1214
- from gateway.platforms.base import get_inbound_media_max_bytes
1215
- with self.owner_scope(self.authority()):
1216
- policy = {"version": 1, "maxCount": 10, "maxBytes": max(0, get_inbound_media_max_bytes())}
1217
- if shared:
1218
- # 公开stage RPC未声明可读的limit字段;固定实现的额外25MiB/张合同明确收在兼容层。
1219
- from tui_gateway.prompt_attachments import _ATTACH_BYTES_MAX_BYTES
1220
- policy["maxFileBytes"] = _ATTACH_BYTES_MAX_BYTES
1221
- else:
1222
- # 固定版标准MessageEvent原生消费文档;operator的prompt.submit仍只接受图片。
1223
- from .media_input import FILE_MIMES
1224
- policy["fileMimeTypes"] = sorted(FILE_MIMES)
1225
- return policy
1226
-
1227
- def selected_image_root(self):
1228
- from gateway.platforms.base import get_image_cache_dir
1229
- with self.owner_scope(self.authority()):
1230
- root = Path(get_image_cache_dir())
1231
- if not root.is_absolute() or root.resolve() != root or root.is_symlink():
1232
- raise RuntimeError("MEDIA_SCOPE_INVALID")
1233
- return str(root)
1234
-
1235
- def output_media_roots(self):
1236
- from gateway.platforms.base import get_image_cache_dir, get_document_cache_dir
1237
- with self.owner_scope(self.authority()):
1238
- roots = [Path(get_image_cache_dir()), Path(get_document_cache_dir()), *self.adapter.media_output_roots]
1239
- if any(not path.is_absolute() or path.resolve() != path or path.is_symlink()
1240
- or path in (Path("/"), Path.home(), Path(self.profile_home)) for path in roots):
1241
- raise RuntimeError("MEDIA_OUTPUT_ROOT_INVALID")
1242
- return tuple(roots)
1243
-
1244
- def extract_selected_response(self, response):
1245
- # selected原会话没有平台event;只在原profile作用域调用SDK公开parser,不复造私有分发事件。
1246
- with self.owner_scope(self.authority()):
1247
- media, body = self.adapter.extract_media(response)
1248
- images, body = self.adapter.extract_images(body)
1249
- local, body = self.adapter.extract_local_files(body)
1250
- body = self.adapter.strip_media_directives_for_display(body)
1251
- return {"text": body, "images": images, "paths": list(dict.fromkeys([path for path, _ in media] + local)),
1252
- "force_document": "[[as_document]]" in response}
1253
-
1254
- async def cache_output_image(self, url, limit):
1255
- from urllib.parse import urlsplit
1256
- from gateway.platforms.helpers import platform_http_client
1257
- from gateway.platforms.base import cache_image_from_bytes_async
1258
- from .media_input import image_mime, MIMES
1259
- parsed = urlsplit(url)
1260
- if (parsed.scheme not in ("http", "https") or not parsed.hostname or parsed.username is not None
1261
- or parsed.password is not None or type(limit) is not int or limit < 1):
1262
- raise RuntimeError("MEDIA_REMOTE_URL_INVALID")
1263
- # SDK公开client负责实际连接IP与每跳重定向;这里仅执行本插件已有输出上限。
1264
- with self.owner_scope(self.authority()):
1265
- async with platform_http_client(timeout=15.0, max_redirects=5) as client:
1266
- async with client.stream("GET", url, headers={"Accept": "image/*"}) as response:
1267
- response.raise_for_status()
1268
- try:
1269
- declared = int(response.headers.get("content-length", "0"))
1270
- except ValueError:
1271
- declared = 0
1272
- if declared > limit:
1273
- raise RuntimeError("MEDIA_OUTPUT_SIZE_INVALID")
1274
- chunks, total = [], 0
1275
- async for chunk in response.aiter_bytes():
1276
- total += len(chunk)
1277
- if total > limit:
1278
- raise RuntimeError("MEDIA_OUTPUT_SIZE_INVALID")
1279
- chunks.append(chunk)
1280
- data = b"".join(chunks)
1281
- mime = image_mime(data[:12])
1282
- if not mime:
1283
- raise RuntimeError("MEDIA_OUTPUT_MIME_INVALID")
1284
- extension = MIMES[mime]
1285
- path = await cache_image_from_bytes_async(data, ext=extension)
1286
- return {"path": path, "filename": "image" + extension}
1287
-
1288
- def delivery_event(self, record):
1289
- from hermes_state_runtime import get_session_admission
1290
- from gateway.session_envelope import restore_native_source
1291
- from gateway.platforms.event import MessageEvent, MessageType
1292
- if (record.get("legacy") or record.get("shared") or record.get("profile") != self.profile_home
1293
- or record.get("service_id") != self.adapter.service_id or not record.get("admission_id")):
1294
- return None
1295
- authority = self.authority()
1296
- with self.owner_scope(authority):
1297
- row = get_session_admission(authority.db, admission_id=record["admission_id"])
1298
- projected = self._project(row, record["input_id"])
1299
- if (projected is None or projected["admission_id"] != record["admission_id"]
1300
- or projected["conversation_id"] != record["native_id"] or projected["chat_id"] != record["chat_id"]):
1301
- return None
1302
- payload = row["payload"]; native = payload["native_text_v1"]
1303
- if (native.get("event", {}).get("message_id") != record["input_id"]
1304
- or native.get("event", {}).get("allow_gateway_control") is not False):
1305
- return None
1306
- source = restore_native_source(payload, self.adapter.gateway_runner)
1307
- if not self.validate_source(source):
1308
- return None
1309
- # 图片源只用于入站执行;展示解析保留原已证明身份,不因输入缓存回收重新读取图片。
1310
- return MessageEvent(text=payload["text"], source=source, message_id=record["input_id"],
1311
- message_type=MessageType(native.get("message_type", "text")), allow_gateway_control=False)
1312
-
1313
- def input_media_history(self, record):
1314
- """仅原准入有限字段证明历史注记;不读正文路径猜归属、不改原生历史。"""
1315
- from hermes_state_runtime import get_session_admission
1316
- if (record.get("legacy")
1317
- or record.get("profile") != self.profile_home
1318
- or record.get("service_id") != self.adapter.service_id
1319
- or not record.get("admission_id") or not record.get("input_media")):
1320
- return None
1321
- with self.owner_scope(self.authority()):
1322
- row = get_session_admission(self.authority().db, admission_id=record["admission_id"])
1323
- if (row is None or row.get("admission_id") != record["admission_id"]
1324
- or row.get("request_id") != record.get("input_id")
1325
- or row.get("target_session_id") != record.get("native_id")):
1326
- return None
1327
- payload = row.get("payload", {})
1328
- frozen = record["input_media"]
1329
- if record.get("shared"):
1330
- envelope = payload.get("attachments_v1", {})
1331
- if "native_text_v1" in payload:
1332
- return None
1333
- media, types = envelope.get("media"), envelope.get("media_types")
1334
- else:
1335
- native = payload.get("native_text_v1", {})
1336
- source, event = native.get("source", {}), native.get("event", {})
1337
- if (source.get("platform") != self.platform or source.get("chat_id") != record.get("chat_id")
1338
- or source.get("message_id") != record.get("input_id") or event.get("message_id") != record.get("input_id")):
1339
- return None
1340
- media, types = native.get("media"), event.get("media_types")
1341
- if (not isinstance(payload.get("text"), str) or type(media) is not list
1342
- or type(frozen) is not list or not 1 <= len(media) <= 10 or len(media) != len(frozen)
1343
- or types != [item.get("mimeType") for item in frozen]
1344
- or any(type(item) is not dict or not isinstance(item.get("path"), str)
1345
- or item.get("sha256") != original.get("sha256")
1346
- or item.get("size") != original.get("size") for item, original in zip(media, frozen))):
1347
- return None
1348
- text = payload["text"]
1349
- # 只根据原准入重建固定SDK的完整注记;不按正文子串清理用户字面内容。
1350
- from .media_input import MIMES, FILE_MIMES
1351
- if any(mime not in MIMES and mime not in FILE_MIMES for mime in types):
1352
- return None
1353
- rendered = text
1354
- if any(mime in FILE_MIMES for mime in types):
1355
- expected_flags = [None if mime in MIMES else False for mime in types]
1356
- if record.get("shared") or event.get("media_text_inlined") != expected_flags:
1357
- return None
1358
- from gateway.run import GatewayRunner
1359
- from types import SimpleNamespace
1360
- with self.owner_scope(self.authority()):
1361
- rendered = GatewayRunner._prepend_inbound_document_notes(SimpleNamespace(
1362
- media_urls=[item["path"] for item in media], media_types=types,
1363
- media_text_inlined=expected_flags), text)
1364
- images = [item for item, mime in zip(media, types) if mime in MIMES]
1365
- if images:
1366
- rendered = (rendered.strip() or "What do you see in this image?") + "\n\n"
1367
- rendered += "\n".join("[Image attached at: " + item["path"] + "]" for item in images)
1368
- rendered += "\n[screenshot]" * len(images)
1369
- if record.get("reply_context"):
1370
- if record.get("shared") and payload.get("cli_turn_v1", {}).get("api_text") != native_reply_text(record["reply_context"], text):
1371
- return None
1372
- rendered = native_reply_text(record["reply_context"], rendered)
1373
- return {"version": 1, "text": text, "rendered": rendered,
1374
- "sha256": [item["sha256"] for item in media]}
1375
-
1376
- def input_identity(self, event):
1377
- source = event.source
1378
- if (not self.validate_source(source)
1379
- or getattr(source.platform, "value", source.platform) != self.platform
1380
- or not isinstance(event.message_id, str) or not event.message_id
1381
- or source.message_id != event.message_id):
1382
- raise RuntimeError("FIFO_INPUT_SCOPE_MISMATCH")
1383
- return (str(Path(self.identity_of(source).runtime_home).resolve()),
1384
- source.chat_id, source.chat_type, source.user_id, source.thread_id,
1385
- event.message_id)
1386
-
1387
- async def prepare_input(self, event, *, runtime):
1388
- """完整宿主门禁先执行;已授权事件再使用原宿主FIFO标记,仍经标准handle_message。"""
1389
- adapter, runner = self.adapter, self.adapter.gateway_runner
1390
- if (hasattr(event, "_fifo_only") or event.internal is not False
1391
- or event.allow_gateway_control is not False
1392
- or asyncio.get_running_loop() is not adapter.owner_loop
1393
- or getattr(runner, "_running", False) is not True
1394
- or type(getattr(runner, "_startup_restore_in_progress", None)) is not bool
1395
- or runner._startup_restore_in_progress):
1396
- raise InputAdmissionRefused()
1397
- authority = self.authority()
1398
- lease = (adapter.runtime, adapter.host, adapter.bindings, adapter.service_id, authority,
1399
- authority.epoch, str(Path(adapter.profile).resolve()))
1400
- identity = getattr(runtime.client, "identity", None)
1401
- if (lease[0] is not runtime or not isinstance(identity, dict)
1402
- or identity.get("authority_epoch") != authority.epoch or lease[6] != self.profile_home):
1403
- raise RuntimeError("FIFO_INPUT_CONTEXT_CHANGED")
1404
- with self.owner_scope(authority):
1405
- expected = self.input_identity(event)
1406
- route = adapter._source_session_key(event.source)
1407
- stop_epoch = runner._route_stop_epoch(route)
1408
- # 固定源码在startup分支之前无await;True时不能让未授权事件进入恢复队列。
1409
- admitted = await runner._hm_admit_event(event)
1410
- if admitted is None:
1411
- # 宿主默认拒绝不在允许列表里的发送者,且在 ingress 就把事件丢掉。这与 hook 消费、
1412
- # 生命周期变化一样只表现为"没有返回",但原因不同:未授权是确定的拒绝,必须让客户端
1413
- # 看到可读失败(FN-171),不能和 unknown 混在一起。
1414
- rejection = self.ingress_rejection(event.source)
1415
- if rejection is not None:
1416
- raise rejection
1417
- raise InputAdmissionUnconfirmed("FIFO_INPUT_NOT_ADMITTED", "ingress-result")
1418
- current = (adapter.runtime, adapter.host, adapter.bindings, adapter.service_id, self.authority(),
1419
- authority.epoch, str(Path(adapter.profile).resolve()))
1420
- identity = getattr(runtime.client, "identity", None)
1421
- if (any(current[i] is not lease[i] for i in (0, 1, 2, 4)) or current[3] != lease[3]
1422
- or current[5:] != lease[5:] or not isinstance(identity, dict)
1423
- or identity.get("authority_epoch") != lease[5]
1424
- or getattr(runner, "_running", False) is not True
1425
- or getattr(runner, "_startup_restore_in_progress", None) is not False):
1426
- raise InputAdmissionUnconfirmed("FIFO_INPUT_CONTEXT_CHANGED", "after-ingress")
1427
- if runner._route_stop_epoch(route) != stop_epoch:
1428
- raise InputAdmissionUnconfirmed("FIFO_STOP_EPOCH_CHANGED", "after-ingress")
1429
- accepted_event, source, internal = admitted
1430
- if (internal is not False or accepted_event.internal is not False
1431
- or accepted_event.allow_gateway_control is not False
1432
- or hasattr(accepted_event, "_fifo_only")
1433
- or accepted_event.source is not source
1434
- or self.input_identity(accepted_event) != expected
1435
- or adapter._source_session_key(source) != route):
1436
- raise InputAdmissionUnconfirmed("FIFO_INPUT_SCOPE_MISMATCH", "after-ingress")
1437
- # 该标记会跳过第二次ingress,因此只允许在上述真实授权与原epoch核对后设置。
1438
- accepted_event._fifo_only = True
1439
- accepted_event._stop_epoch = stop_epoch
1440
- return accepted_event
1441
-
1442
- def prepared_input_guard(self, event, *, runtime):
1443
- """只校验刚完成完整门禁的原事件;首次配置的每个await继续使用同一栅栏。"""
1444
- adapter, runner = self.adapter, self.adapter.gateway_runner
1445
- authority = self.authority()
1446
- source = event.source
1447
- expected = self.input_identity(event)
1448
- route = adapter._source_session_key(source)
1449
- epoch = authority.epoch
1450
- stop_epoch = getattr(event, "_stop_epoch", None)
1451
- lease = (adapter.runtime, adapter.host, adapter.bindings, adapter.service_id,
1452
- str(Path(adapter.profile).resolve()), adapter.owner_loop)
1453
- instance = runtime.client.identity.get("instance_id")
1454
-
1455
- def check():
1456
- identity = runtime.client.identity
1457
- current = (adapter.runtime, adapter.host, adapter.bindings, adapter.service_id,
1458
- str(Path(adapter.profile).resolve()), adapter.owner_loop)
1459
- if (any(current[i] is not lease[i] for i in (0, 1, 2, 5)) or current[3:5] != lease[3:5]
1460
- or runtime is not lease[0] or adapter.gateway_runner is not runner
1461
- or getattr(adapter, "plugin_enabled", None) is not True or not isinstance(identity, dict)
1462
- or identity.get("instance_id") != instance or identity.get("authority_epoch") != epoch
1463
- or self.authority() is not authority or authority.epoch != epoch
1464
- or asyncio.get_running_loop() is not lease[5]
1465
- or getattr(runner, "_running", False) is not True
1466
- or getattr(runner, "_startup_restore_in_progress", None) is not False):
1467
- raise InputAdmissionUnconfirmed("FIFO_INPUT_CONTEXT_CHANGED", "initial-settings")
1468
- with self.owner_scope(authority):
1469
- try:
1470
- current_identity = self.input_identity(event)
1471
- current_route = adapter._source_session_key(source)
1472
- except (RuntimeError, ValueError):
1473
- raise InputAdmissionUnconfirmed("FIFO_INPUT_SCOPE_MISMATCH", "initial-settings") from None
1474
- if (event.source is not source or current_identity != expected
1475
- or current_route != route
1476
- or getattr(event, "_fifo_only", None) is not True
1477
- or getattr(event, "_stop_epoch", None) != stop_epoch):
1478
- raise InputAdmissionUnconfirmed("FIFO_INPUT_SCOPE_MISMATCH", "initial-settings")
1479
- if runner._route_stop_epoch(route) != stop_epoch:
1480
- raise InputAdmissionUnconfirmed("FIFO_STOP_EPOCH_CHANGED", "initial-settings")
1481
-
1482
- check()
1483
- return check
1484
-
1485
- def _project(self, row, input_id):
1486
- if row is None or row.get("request_id") != input_id:
1487
- return None
1488
- source = row.get("payload", {}).get("native_text_v1", {}).get("source", {})
1489
- if source.get("platform") != self.platform:
1490
- return None # 不把旧canonical会话冒认成本平台;迁移须先排空旧运行。
1491
- return {
1492
- "profile_home": self.profile_home,
1493
- "platform": self.platform,
1494
- "chat_id": source.get("chat_id"),
1495
- "conversation_id": row["target_session_id"],
1496
- "input_id": input_id,
1497
- "admission_id": row["admission_id"],
1498
- }
1499
-
1500
- def authorize_initial_source(self, source):
1501
- if not self.validate_source(source):
1502
- return False
1503
- with self.owner_scope(self.authority()):
1504
- return (
1505
- self.adapter._is_sender_authorized(
1506
- source.user_id, source.chat_type, source.chat_id
1507
- )
1508
- is True
1509
- )
1510
-
1511
- def current_initial_session(self, source):
1512
- if not self.validate_source(source):
1513
- raise RuntimeError("CROSS_PROFILE_ROUTE_UNSUPPORTED")
1514
- authority = self.authority()
1515
- with self.owner_scope(authority):
1516
- key = self.adapter._source_session_key(source)
1517
- native = self.adapter.gateway_runner.session_store.peek_session_id(key)
1518
- return authority.logical_owner(native) if native else None
1519
-
1520
- async def ensure_initial_session(self, source, *, check=None):
1521
- from .canonical_control import NativeControlError
1522
-
1523
- if asyncio.get_running_loop() is not self.adapter.owner_loop:
1524
- raise NativeControlError("INITIAL_SETTINGS_OWNER_LOOP_MISMATCH")
1525
- if self.authorize_initial_source(source) is not True:
1526
- raise NativeControlError("permission_denied")
1527
- authority = self.authority()
1528
- if check:
1529
- check()
1530
- with self.owner_scope(authority):
1531
- # SDK自己维护路由/保留行;磁盘预留离开loop,发布仍由原owner loop完成。
1532
- reservation = asyncio.create_task(
1533
- asyncio.to_thread(authority._reserve_route, source)
1534
- )
1535
- try:
1536
- native, route = await asyncio.shield(reservation)
1537
- except asyncio.CancelledError:
1538
- await asyncio.gather(reservation, return_exceptions=True)
1539
- raise
1540
- if check:
1541
- check()
1542
- if self.current_initial_session(source) != native:
1543
- raise NativeControlError("INITIAL_SETTINGS_SCOPE_CHANGED")
1544
- ref = authority._publish_route(source, native, route)
1545
- if ref.profile_id != self.profile_home or ref.session_id != native:
1546
- raise NativeControlError("INITIAL_SETTINGS_SCOPE_CHANGED")
1547
- return {"native_id": native, "route_key": route}
1548
-
1549
- def lookup_input(self, *, chat_id, input_id):
1550
- authority = self.authority()
1551
- source = self.adapter.build_source(
1552
- chat_id, chat_type="dm", user_id="owner", message_id=input_id
1553
- )
1554
- if not self.validate_source(source):
1555
- raise RuntimeError("CROSS_PROFILE_ROUTE_UNSUPPORTED")
1556
- with self.owner_scope(authority):
1557
- key = self.adapter._source_session_key(source)
1558
- session_id = self.adapter.gateway_runner.session_store.peek_session_id(key)
1559
- if not session_id:
1560
- return None
1561
- matches = [
1562
- row
1563
- for row in self.list_admissions(
1564
- authority.db, session_id=session_id, pending_only=False
1565
- )
1566
- if row.get("request_id") == input_id
1567
- ]
1568
- if len(matches) != 1:
1569
- return None
1570
- result = self._project(matches[0], input_id)
1571
- if result and result["chat_id"] != chat_id:
1572
- raise RuntimeError("RECEIPT_SCOPE_MISMATCH")
1573
- return result
1574
-
1575
- def control_key(self, binding, prompt_id, generation, epoch, kind):
1576
- return (self.adapter.service_id, binding["conversation_id"], binding["admission_id"],
1577
- binding["input_id"], epoch, generation, prompt_id, kind)
1578
-
1579
- def observe_control(self, binding, *, prompt_id, generation, epoch, kind):
1580
- # 不观察secret/sudo或未知请求;不注册回调、不替换resolver、不修改waiter。
1581
- if kind not in ("approval", "clarify") or binding["profile_home"] != self.profile_home:
1582
- raise PublicRuntimeUnavailable("CONTROL_OBSERVATION_SCOPE_INVALID")
1583
- from tools import approval as approvals
1584
- from tools import clarify_gateway as clarifies
1585
-
1586
- key = self.control_key(binding, prompt_id, generation, epoch, kind)
1587
- authority = self.authority()
1588
- if authority.epoch != epoch:
1589
- return None
1590
- observed = self.observed_controls.get(key)
1591
- if observed is None:
1592
- live = authority.sessions.get(binding["conversation_id"])
1593
- if live is None:
1594
- return None
1595
- with live.event_stream.lock:
1596
- active = live.event_stream.execution
1597
- current = live.controls.pending.get(prompt_id)
1598
- if (not current or not isinstance(active, dict) or active.get("admission_id") != binding["admission_id"]
1599
- or active.get("authority_epoch") != epoch
1600
- or authority.executing.get(binding["conversation_id"]) != generation):
1601
- return None
1602
- route, prompt = current
1603
- if (prompt.get("kind") != kind or prompt.get("execution_generation") != generation
1604
- or prompt_id in live.controls.remote_responders or (kind == "approval" and not isinstance(route, str))):
1605
- return None
1606
- lock = approvals._lock if kind == "approval" else clarifies._lock
1607
- with lock:
1608
- if kind == "approval":
1609
- entries = [entry for entry in approvals._gateway_queues.get(route, [])
1610
- if entry.data.get("request_id") == prompt_id]
1611
- if len(entries) != 1:
1612
- return None
1613
- entry = entries[0]
1614
- else:
1615
- entry = clarifies._entries.get(prompt_id)
1616
- if entry is None or entry is not route or entry.clarify_id != prompt_id:
1617
- return None
1618
- observed = (authority, entry, tuple(prompt["choices"]))
1619
- self.observed_controls[key] = observed
1620
- if observed[0] is not authority:
1621
- return None
1622
- _, entry, choices = observed
1623
- lock = approvals._lock if kind == "approval" else clarifies._lock
1624
- with lock:
1625
- if not entry.event.is_set():
1626
- return {"status": "pending"}
1627
- if kind == "approval":
1628
- answer = entry.result
1629
- if answer in choices:
1630
- return {"status": "resolved", "winner": answer}
1631
- if entry.expired:
1632
- return {"status": "expired"}
1633
- if entry.cancelled:
1634
- return {"status": "cancelled"}
1635
- else:
1636
- answer = entry.response
1637
- if answer == clarifies.CANCELLED:
1638
- return {"status": "cancelled"}
1639
- if isinstance(answer, str):
1640
- return {"status": "resolved", "winner": "" if answer == clarifies.SKIPPED else answer}
1641
- return {"status": "resolved", "resolution_unknown": True}
1642
-
1643
- def forget_control(self, binding, *, prompt_id, generation, epoch, kind):
1644
- self.observed_controls.pop(self.control_key(binding, prompt_id, generation, epoch, kind), None)
1645
-
1646
- def close_observations(self):
1647
- self.observed_controls.clear()
1648
-
1649
-
1650
- _AGENT_FILE_LIMIT = 128 * 1024
1651
- _AGENT_MANAGEMENT_LOCK = threading.RLock()
1652
- _agent_management_warning_emitted = False
1653
-
1654
-
1655
- def _agent_digest(value):
1656
- import hashlib
1657
- import json
1658
- return hashlib.sha256(json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode()).hexdigest()
1659
-
1660
-
1661
- def profile_agent_management(profile, *, patch=None, expected_version=None, prepare=None):
1662
- """固定dashboard同源配置/技能/工具集语义,只写当前物理Profile的原始配置。
1663
-
1664
- 工具集作用于fridaynext,避免照搬dashboard的cli目标;宿主私有接缝只留在此兼容层。
1665
- """
1666
- import copy
1667
- import json
1668
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
1669
- from agent.secret_scope import set_secret_scope, reset_secret_scope
1670
- from tui_gateway.launch_profile_policy import owner_secret_scope
1671
- from hermes_cli import config as config_mod, tools_config
1672
- from hermes_cli.skills_config import get_disabled_skills
1673
- from hermes_cli.approval_mode import VALID_APPROVAL_MODES
1674
- from tools.approval_context import _get_approval_mode
1675
- from tools.skills_tool import find_all_skills
1676
- from agent.skill_utils import ESSENTIAL_SKILLS
1677
- from toolsets import resolve_toolset
1678
- from .state import private_json
1679
-
1680
- global _agent_management_warning_emitted
1681
- if not _agent_management_warning_emitted:
1682
- _agent_management_warning_emitted = True
1683
- logger.warning("hermes.compat.agent_management_v0_22_5:复用固定dashboard配置/技能/工具集及owner凭据作用域接缝,非稳定管理SDK")
1684
- root = Path(profile).resolve()
1685
- presentation = root / ".fridaynext-agent-presentation.json"
1686
- token = set_hermes_home_override(root)
1687
- secret_token = None
1688
- try:
1689
- # 管理IPC不属于模型turn;多Profile模式下须显式绑定owner凭据,不能借用调用者或全局环境。
1690
- secret_token = set_secret_scope(owner_secret_scope(root), profile_home=str(root))
1691
- with _AGENT_MANAGEMENT_LOCK, config_mod._CONFIG_LOCK:
1692
- path = config_mod.get_config_path()
1693
- raw = config_mod.require_readable_config_before_write(path)
1694
- effective = config_mod.load_config()
1695
- if presentation.is_symlink() or presentation.exists() and presentation.stat().st_size > 4096:
1696
- raise ValueError("AGENT_PRESENTATION_UNREADABLE")
1697
- ui = json.loads(presentation.read_text()) if presentation.exists() else {}
1698
- if not isinstance(ui, dict) or any(not isinstance(x, str) for x in ui.values()):
1699
- raise ValueError("AGENT_PRESENTATION_UNREADABLE")
1700
- installed_skills = find_all_skills(skip_disabled=True)
1701
- resolved_ui = profile_agent_presentation(root)
1702
- # 全量技能选择必须绑定读取时的目录,不能把刚安装的未展示技能当作用户关闭。
1703
- inventory = sorted(row["name"] for row in installed_skills)
1704
- version = _agent_digest([str(root), raw, effective, ui, resolved_ui, inventory])
1705
- if patch is not None:
1706
- if version != expected_version:
1707
- return {"status": "conflict", "code": "AGENT_CONFIG_CHANGED"}
1708
- if not isinstance(patch, dict) or len(patch) != 1:
1709
- return {"status": "conflict", "code": "INVALID_AGENT_PATCH"}
1710
- target = copy.deepcopy(raw)
1711
- key, value = next(iter(patch.items()))
1712
- if key == "greeting" or key == "displayName":
1713
- limit = 60 if key == "greeting" else 80
1714
- if not isinstance(value, str) or len(value) > limit:
1715
- return {"status": "conflict", "code": "INVALID_AGENT_PRESENTATION"}
1716
- updated_ui = {**ui, key: value.strip()}
1717
- if prepare: prepare()
1718
- private_json(presentation, updated_ui)
1719
- else:
1720
- if config_mod.is_managed():
1721
- return {"status": "conflict", "code": "AGENT_CONFIG_READ_ONLY"}
1722
- if key == "permissionMode":
1723
- if value not in VALID_APPROVAL_MODES:
1724
- return {"status": "conflict", "code": "INVALID_APPROVAL_MODE"}
1725
- target.setdefault("approvals", {})["mode"] = value
1726
- elif key == "skills":
1727
- installed = set(inventory)
1728
- if not isinstance(value, list) or any(not isinstance(x, str) for x in value) or set(value) - installed:
1729
- return {"status": "conflict", "code": "INVALID_SKILL_SELECTION"}
1730
- desired = set(value)
1731
- if (installed & ESSENTIAL_SKILLS) - desired:
1732
- return {"status": "conflict", "code": "ESSENTIAL_SKILL_REQUIRED"}
1733
- skills = target.setdefault("skills", {})
1734
- # 未展示的技能保留;启用明确清除此Profile及当前平台的停用项。
1735
- disabled = get_disabled_skills(effective) - desired
1736
- disabled |= installed - desired
1737
- skills["disabled"] = sorted(disabled - ESSENTIAL_SKILLS)
1738
- platform_disabled = skills.get("platform_disabled", {})
1739
- if isinstance(platform_disabled, dict) and "fridaynext" in platform_disabled:
1740
- prior = platform_disabled["fridaynext"]
1741
- prior = [prior] if isinstance(prior, str) else prior or []
1742
- platform_disabled["fridaynext"] = sorted(set(prior) - desired)
1743
- elif key == "toolset":
1744
- if not isinstance(value, dict) or set(value) != {"id", "enabled"} or type(value["enabled"]) is not bool:
1745
- return {"status": "conflict", "code": "INVALID_TOOLSET_SELECTION"}
1746
- allowed = tools_config._checklist_toolset_keys("fridaynext")
1747
- name = value["id"]
1748
- if name not in allowed:
1749
- return {"status": "conflict", "code": "TOOLSET_NOT_AVAILABLE"}
1750
- enabled = tools_config._get_platform_tools(effective, "fridaynext", include_default_mcp_servers=False)
1751
- enabled.add(name) if value["enabled"] else enabled.discard(name)
1752
- # 保留MCP/未知条目;只替换当前平台的工具集,不改cli或其他Profile。
1753
- target.setdefault("platform_toolsets", {})["fridaynext"] = sorted(enabled)
1754
- target.setdefault("known_builtin_toolsets", {})["fridaynext"] = sorted(tools_config._configurable_keys())
1755
- target.setdefault("known_plugin_toolsets", {})["fridaynext"] = sorted(tools_config._get_plugin_toolset_keys())
1756
- if value["enabled"]:
1757
- agent = target.get("agent", {})
1758
- if isinstance(agent.get("disabled_toolsets"), list):
1759
- agent["disabled_toolsets"] = [x for x in agent["disabled_toolsets"] if x != name]
1760
- else:
1761
- return {"status": "conflict", "code": "INVALID_AGENT_PATCH"}
1762
- if prepare: prepare()
1763
- config_mod.atomic_config_replace(path, target)
1764
- return {"status": "applied"}
1765
-
1766
- disabled = get_disabled_skills(effective, "fridaynext")
1767
- skills = [{"id": row["name"], "description": row.get("description", ""), "source": "installed",
1768
- "editable": row["name"] not in ESSENTIAL_SKILLS} for row in installed_skills]
1769
- enabled = tools_config._get_platform_tools(effective, "fridaynext", include_default_mcp_servers=False)
1770
- toolsets = []
1771
- allowed = tools_config._checklist_toolset_keys("fridaynext")
1772
- for name, label, description in tools_config._get_effective_configurable_toolsets():
1773
- if name not in allowed:
1774
- continue
1775
- toolsets.append({"id": name, "label": tools_config.gui_toolset_label(label), "description": description,
1776
- "enabled": name in enabled, "configured": bool(tools_config._toolset_has_keys(name, effective)),
1777
- "source": "hermes-toolset", "inProfile": False})
1778
- defaults = profile_default_config(root)
1779
- return {"version": version, **resolved_ui,
1780
- "defaults": defaults, "permissionMode": _get_approval_mode(), "permissionModes": list(VALID_APPROVAL_MODES),
1781
- "skills": sorted(row["id"] for row in skills if row["id"] not in disabled), "availableSkills": skills,
1782
- "toolsets": toolsets, "writable": not config_mod.is_managed(),
1783
- "builtinMemory": effective.get("memory", {}).get("provider") in (None, "", "builtin")}
1784
- finally:
1785
- if secret_token is not None:
1786
- reset_secret_scope(secret_token)
1787
- reset_hermes_home_override(token)
1788
-
1789
-
1790
- def profile_agent_file(profile, name, *, content=None, expected_version=None, prepare=None):
1791
- """用目录fd限定三份真实资源;父目录被并发替换也不能跟随链接越出Profile。"""
1792
- import os
1793
- import stat
1794
- import uuid
1795
- mapping = {"SOUL.md": (None, "SOUL.md"), "MEMORY.md": ("memories", "MEMORY.md"), "USER.md": ("memories", "USER.md")}
1796
- if name not in mapping:
1797
- raise ValueError("INVALID_AGENT_FILE")
1798
- if content is not None and (not isinstance(content, str) or len(content.encode()) > _AGENT_FILE_LIMIT):
1799
- raise ValueError("INVALID_AGENT_FILE")
1800
- root = Path(profile).resolve()
1801
- folder, leaf = mapping[name]
1802
- flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW
1803
- with _AGENT_MANAGEMENT_LOCK:
1804
- root_fd = os.open(root, flags)
1805
- parent_fd = root_fd
1806
- try:
1807
- if folder:
1808
- try:
1809
- parent_fd = os.open(folder, flags, dir_fd=root_fd)
1810
- except FileNotFoundError:
1811
- if content is None:
1812
- return {"name": name, "exists": False, "content": "", "bytes": 0,
1813
- "version": _agent_digest([str(root), name, False, ""])}
1814
- os.mkdir(folder, mode=0o700, dir_fd=root_fd)
1815
- parent_fd = os.open(folder, flags, dir_fd=root_fd)
1816
- exists, data, mode = False, b"", 0o600
1817
- try:
1818
- fd = os.open(leaf, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=parent_fd)
1819
- with os.fdopen(fd, "rb") as stream:
1820
- info = os.fstat(stream.fileno())
1821
- if not stat.S_ISREG(info.st_mode) or info.st_size > _AGENT_FILE_LIMIT:
1822
- raise ValueError("INVALID_AGENT_FILE")
1823
- data = stream.read(_AGENT_FILE_LIMIT + 1)
1824
- mode, exists = stat.S_IMODE(info.st_mode), True
1825
- if len(data) > _AGENT_FILE_LIMIT:
1826
- raise ValueError("INVALID_AGENT_FILE")
1827
- except FileNotFoundError:
1828
- pass
1829
- except OSError:
1830
- raise ValueError("INVALID_AGENT_FILE") from None
1831
- version = _agent_digest([str(root), name, exists, data.hex()])
1832
- if content is None:
1833
- return {"name": name, "exists": exists, "content": data.decode("utf-8"), "bytes": len(data), "version": version}
1834
- if version != expected_version:
1835
- return {"status": "conflict", "code": "AGENT_FILE_CHANGED"}
1836
- if prepare: prepare()
1837
- temporary = ".fridaynext-" + uuid.uuid4().hex
1838
- try:
1839
- fd = os.open(temporary, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, mode, dir_fd=parent_fd)
1840
- with os.fdopen(fd, "wb") as stream:
1841
- stream.write(content.encode())
1842
- stream.flush()
1843
- os.fsync(stream.fileno())
1844
- os.replace(temporary, leaf, src_dir_fd=parent_fd, dst_dir_fd=parent_fd)
1845
- os.fsync(parent_fd)
1846
- finally:
1847
- try: os.unlink(temporary, dir_fd=parent_fd)
1848
- except FileNotFoundError: pass
1849
- return {"status": "applied", "value": {"ok": True, "name": name}}
1850
- except OSError:
1851
- raise ValueError("INVALID_AGENT_FILE") from None
1852
- finally:
1853
- if parent_fd != root_fd: os.close(parent_fd)
1854
- os.close(root_fd)
1855
-
1856
-
1857
- def profile_agent_file_names(profile):
1858
- """文件目录查询不启动宿主bootstrap,避免把缺失SOUL自动种成模板。"""
1859
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
1860
- from hermes_cli import config as config_mod
1861
- token = set_hermes_home_override(profile)
1862
- try:
1863
- raw = config_mod.require_readable_config_before_write(config_mod.get_config_path())
1864
- memory = raw.get("memory") or {}
1865
- return ["SOUL.md"] + (["MEMORY.md", "USER.md"] if memory.get("provider") in (None, "", "builtin") else [])
1866
- finally:
1867
- reset_hermes_home_override(token)
1868
-
1869
-
1870
- def profile_agent_presentation(profile):
1871
- """App显示覆盖优先,其次使用Hermes原生Profile展示元数据;不解析人设正文猜名字。"""
1872
- import json
1873
- from hermes_cli.profiles import read_profile_meta
1874
- root = Path(profile).resolve()
1875
- path = root / ".fridaynext-agent-presentation.json"
1876
- if path.is_symlink() or path.exists() and path.stat().st_size > 4096:
1877
- raise ValueError("AGENT_PRESENTATION_UNREADABLE")
1878
- ui = json.loads(path.read_text()) if path.exists() else {}
1879
- if not isinstance(ui, dict) or any(not isinstance(x, str) for x in ui.values()):
1880
- raise ValueError("AGENT_PRESENTATION_UNREADABLE")
1881
- native = read_profile_meta(root)
1882
- return {"name": ui.get("displayName") or native.get("display_name") or native.get("bot_title") or "HERMES",
1883
- "greeting": ui.get("greeting", "")}
1884
-
1885
-
1886
- def profile_agent_write_allowed(profile):
1887
- """沿用宿主托管配置的只读策略,不在App内绕开它。"""
1888
- from hermes_constants import set_hermes_home_override, reset_hermes_home_override
1889
- from hermes_cli import config as config_mod
1890
- token = set_hermes_home_override(profile)
1891
- try:
1892
- return not config_mod.is_managed()
1893
- finally:
1894
- reset_hermes_home_override(token)
1895
-
1896
-
1897
- # 只投影已经核对过的首批语义;注册表的其余内建项不因同名自动获得管理能力。
1898
- _SLASH_LOCAL = frozenset({"new", "stop", "model", "reasoning"})
1899
- _SLASH_READ = frozenset({"help", "commands", "status", "context", "usage", "version", "whoami", "profile", "insights"})
1900
-
1901
-
1902
- @contextmanager
1903
- def _slash_scope(adapter, source, cwd=None):
1904
- from gateway.run import _profile_runtime_scope
1905
- from gateway.session_commands import _session_workspace
1906
- from gateway.session_policy import policy_for_source
1907
- from agent.runtime_cwd import set_session_cwd, reset_session_cwd
1908
- from gateway.session_context import _SESSION_PLATFORM
1909
- platform_token = _SESSION_PLATFORM.set("fridaynext")
1910
- try:
1911
- with adapter.runtime.locator.owner_scope(adapter.runtime.locator.authority()), _profile_runtime_scope(adapter.profile):
1912
- # 未绑定目录时只发现本Profile,不借Gateway进程目录的项目技能。
1913
- token = set_session_cwd(cwd or str(adapter.profile)) if policy_for_source(adapter.gateway_runner, source) is None else None
1914
- try:
1915
- with _session_workspace(adapter.gateway_runner, source):
1916
- yield
1917
- finally:
1918
- if token is not None:
1919
- reset_session_cwd(token)
1920
- finally:
1921
- _SESSION_PLATFORM.reset(platform_token)
1922
-
1923
-
1924
- def slash_command_catalog(adapter, source, cwd=None):
1925
- """固定版registry和当前profile的原生可发现项;不运行命令或扫描别的Profile。"""
1926
- from hermes_cli.commands import COMMAND_REGISTRY
1927
- from hermes_cli.plugins import get_plugin_commands
1928
- from agent.skill_commands import get_skill_commands
1929
- from .canonical_control import NativeControlError
1930
- runner = getattr(adapter, "gateway_runner", None)
1931
- if (runner is None or adapter.runtime.validate_source(source) is not True
1932
- or adapter.runtime.locator.authorize_initial_source(source) is not True):
1933
- raise NativeControlError("COMMAND_PERMISSION_DENIED")
1934
- verified_source()
1935
- with _slash_scope(adapter, source, cwd=cwd):
1936
- def allowed(name):
1937
- return not runner._check_slash_access(source, name)
1938
- rows = []
1939
- for cmd in COMMAND_REGISTRY:
1940
- if cmd.name not in _SLASH_LOCAL | _SLASH_READ | {"compress"} or not allowed(cmd.name):
1941
- continue
1942
- kind = "local" if cmd.name in _SLASH_LOCAL else "compaction" if cmd.name == "compress" else "result"
1943
- args = []
1944
- if cmd.name in {"model", "reasoning", "help", "compress"}:
1945
- args = [{"name": "value", "required": False, "choices": []}]
1946
- rows.append({"name": cmd.name, "textAliases": list(cmd.aliases), "description": cmd.describe(),
1947
- "category": "options" if cmd.name in {"model", "reasoning"} else "session" if cmd.name in {"new", "stop", "compress"} else "status",
1948
- "tier": "essential" if cmd.name in {"new", "stop", "model", "reasoning"} else "power" if cmd.name in {"insights", "profile"} else "standard",
1949
- "kind": kind, "acceptsArgs": bool(args), "args": args})
1950
- seen = {name for row in rows for name in (row["name"], *row["textAliases"])}
1951
- for name, meta in (get_plugin_commands() or {}).items():
1952
- if (not isinstance(name, str) or not name or any(c.isspace() or c == "/" for c in name)
1953
- or name in seen or not isinstance(meta, dict) or not allowed(name)):
1954
- continue
1955
- rows.append({"name": name, "textAliases": [], "description": str(meta.get("description") or name),
1956
- "category": "tools", "tier": "standard", "kind": "result", "acceptsArgs": bool(meta.get("args_hint")),
1957
- "args": [{"name": str(meta["args_hint"]), "required": False, "choices": []}] if meta.get("args_hint") else []})
1958
- seen.add(name)
1959
- # 原生messaging目录不包含interactive-only插件技能;不扩大宿主平台权限。
1960
- for native_key, info in get_skill_commands().items():
1961
- name = native_key.removeprefix("/")
1962
- if name in seen or not allowed(name):
1963
- continue
1964
- rows.append({"name": name, "textAliases": [], "description": str(info.get("description") or name),
1965
- "category": "tools", "tier": "standard", "kind": "run", "acceptsArgs": True,
1966
- "args": [{"name": "instruction", "required": False, "choices": []}]})
1967
- return rows
1968
-
1969
-
1970
- def _slash_selection(adapter, source, text, cwd=None):
1971
- from .canonical_control import NativeControlError
1972
- parts = text[1:].split(None, 1)
1973
- if not parts:
1974
- raise NativeControlError("SLASH_COMMAND_UNSUPPORTED")
1975
- name, arg = parts[0].lower(), parts[1] if len(parts) > 1 else ""
1976
- command = next((row for row in slash_command_catalog(adapter, source, cwd=cwd)
1977
- if name == row["name"] or name in row["textAliases"]), None)
1978
- if command is None:
1979
- raise NativeControlError("SLASH_COMMAND_UNSUPPORTED")
1980
- if arg and command["name"] not in {"model", "reasoning", "help", "compress"} and command["category"] != "tools":
1981
- raise NativeControlError("COMMAND_ARGUMENT_UNSUPPORTED")
1982
- return command, arg
1983
-
1984
-
1985
- def prepare_slash_run(adapter, source, text, cwd=None):
1986
- from agent.skill_commands import build_skill_invocation_message
1987
- from .canonical_control import NativeControlError
1988
- command, arg = _slash_selection(adapter, source, text, cwd=cwd)
1989
- if command["kind"] != "run":
1990
- raise NativeControlError("COMMAND_IS_NOT_A_RUN")
1991
- with _slash_scope(adapter, source, cwd=cwd):
1992
- # 只解析刚由原生messaging目录确认的名字;不将任意未知命令交给模型解释。
1993
- message = build_skill_invocation_message("/" + command["name"], arg)
1994
- if not message:
1995
- raise NativeControlError("SLASH_COMMAND_UNSUPPORTED")
1996
- return {"allowed": True, "kind": "run", "message": message, "display": text}
1997
-
1998
-
1999
- async def execute_slash_command(adapter, source, text, *, has_session, check, cwd=None):
2000
- """已授权原生处理器接缝;不调用Agent循环,不依赖文本回流猜测终态。"""
2001
- from gateway.platforms.event import MessageEvent
2002
- from hermes_cli.commands import resolve_command
2003
- from hermes_cli.plugins import get_plugin_command_handler
2004
- from .canonical_control import NativeControlError
2005
- runner = adapter.gateway_runner
2006
- check()
2007
- command, _ = _slash_selection(adapter, source, text, cwd=cwd)
2008
- if command["kind"] == "run":
2009
- return {"kind": "run", "text": text}
2010
- if command["kind"] == "local":
2011
- return {"kind": "local", "text": text}
2012
- if not has_session and command["name"] not in {"help", "commands", "version", "whoami", "profile"}:
2013
- raise NativeControlError("COMMAND_SESSION_REQUIRED")
2014
- logger.warning("hermes.compat.slash_handlers_v0_22_5:固定GatewayRunner授权与原生处理器,非公开slash.exec平台等价")
2015
- event = MessageEvent(text=text, source=source, message_id=source.message_id, internal=False, allow_gateway_control=True)
2016
- with _slash_scope(adapter, source, cwd=cwd):
2017
- admitted = await runner._hm_admit_event(event)
2018
- check()
2019
- if (admitted is None or admitted[0].text != text or admitted[1] is not source or admitted[2] is not False):
2020
- raise NativeControlError("COMMAND_PERMISSION_DENIED")
2021
- event = admitted[0]
2022
- # ingress之后重查目录/权限,撤回的插件命令不能落入普通模型分支。
2023
- command, arg = _slash_selection(adapter, source, text, cwd=cwd)
2024
- refused = runner._check_slash_access(source, command["name"])
2025
- if refused:
2026
- raise NativeControlError("COMMAND_PERMISSION_DENIED")
2027
- definition = resolve_command(command["name"])
2028
- rejected = False
2029
- if definition is None:
2030
- handler = get_plugin_command_handler(command["name"])
2031
- if handler is None:
2032
- raise NativeControlError("SLASH_COMMAND_UNSUPPORTED")
2033
- route = adapter._source_session_key(source)
2034
- entry = await asyncio.to_thread(runner.session_store.lookup_by_session_key, route)
2035
- check()
2036
- output = await runner._hm_run_plugin_handler(handler, event, source, entry, args=arg)
2037
- else:
2038
- # 宿主自己的busy分派与处理器表;不以客户端可见状态代替原会话占用事实。
2039
- route = adapter._source_session_key(source)
2040
- if route in adapter._active_sessions:
2041
- rejected = runner._busy_slash_route(definition)[0] == "reject"
2042
- output = await runner._dispatch_busy_slash_command(event, definition, route, source)
2043
- else:
2044
- output = await runner._command_handler_table((command["name"],))[command["name"]](event)
2045
- check()
2046
- return {"kind": command["kind"], "text": str(getattr(output, "text", output) or ""),
2047
- **({"isError": True} if rejected else {})}
2048
-
2049
-
2050
- def public_slash_command_catalog(value):
2051
- """将公开local-session目录映射到首批合同;不复活远端未给出的名字。"""
2052
- from hermes_cli.commands import COMMAND_REGISTRY
2053
- from .canonical_control import NativeControlError
2054
- if not isinstance(value, dict) or not isinstance(value.get("pairs"), list) or not isinstance(value.get("commands"), dict):
2055
- raise NativeControlError("COMMAND_CATALOG_INVALID")
2056
- pairs = {item[0].removeprefix("/"): str(item[1]) for item in value["pairs"]
2057
- if isinstance(item, list) and len(item) == 2 and isinstance(item[0], str)}
2058
- metadata = value["commands"]
2059
- rows, seen = [], set()
2060
- for cmd in COMMAND_REGISTRY:
2061
- if cmd.name not in _SLASH_LOCAL | _SLASH_READ or (cmd.name not in pairs and "/" + cmd.name not in metadata):
2062
- continue
2063
- args = [{"name": "value", "required": False, "choices": []}] if cmd.name in {"model", "reasoning", "help"} else []
2064
- rows.append({"name": cmd.name, "textAliases": list(cmd.aliases), "description": pairs.get(cmd.name, cmd.describe()),
2065
- "category": "options" if cmd.name in {"model", "reasoning"} else "session" if cmd.name in {"new", "stop"} else "status",
2066
- "tier": "essential" if cmd.name in _SLASH_LOCAL else "standard", "kind": "local" if cmd.name in _SLASH_LOCAL else "result",
2067
- "acceptsArgs": bool(args), "args": args})
2068
- seen.update((cmd.name, *cmd.aliases))
2069
- plugins, skills = value.get("plugin_commands", {}), value.get("skills", {})
2070
- if not isinstance(plugins, dict) or not isinstance(skills, dict):
2071
- raise NativeControlError("COMMAND_CATALOG_INVALID")
2072
- for source, kind in ((plugins, "result"), (skills, "run")):
2073
- for key in source:
2074
- name = key.removeprefix("/")
2075
- if name in seen or name not in pairs:
2076
- continue
2077
- rows.append({"name": name, "textAliases": [], "description": pairs[name], "category": "tools", "tier": "standard",
2078
- "kind": kind, "acceptsArgs": True, "args": [{"name": "arguments", "required": False, "choices": []}]})
2079
- seen.add(name)
2080
- return rows