@aotui/runtime 1.0.0

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 (388) hide show
  1. package/dist/adapters/aotui-driven-source.d.ts +106 -0
  2. package/dist/adapters/aotui-driven-source.js +549 -0
  3. package/dist/adapters/aotui-driven-source.js.map +1 -0
  4. package/dist/adapters/bridge/index.d.ts +94 -0
  5. package/dist/adapters/bridge/index.js +199 -0
  6. package/dist/adapters/bridge/index.js.map +1 -0
  7. package/dist/adapters/index.d.ts +7 -0
  8. package/dist/adapters/index.js +8 -0
  9. package/dist/adapters/index.js.map +1 -0
  10. package/dist/adapters/session/index.d.ts +7 -0
  11. package/dist/adapters/session/index.js +2 -0
  12. package/dist/adapters/session/index.js.map +1 -0
  13. package/dist/adapters/session/session.d.ts +46 -0
  14. package/dist/adapters/session/session.js +76 -0
  15. package/dist/adapters/session/session.js.map +1 -0
  16. package/dist/adapters/session/types.d.ts +52 -0
  17. package/dist/adapters/session/types.js +7 -0
  18. package/dist/adapters/session/types.js.map +1 -0
  19. package/dist/adapters/system-instruction.d.ts +9 -0
  20. package/dist/adapters/system-instruction.js +434 -0
  21. package/dist/adapters/system-instruction.js.map +1 -0
  22. package/dist/benchmarks/dom-engine-comparison.d.ts +1 -0
  23. package/dist/benchmarks/dom-engine-comparison.js +84 -0
  24. package/dist/benchmarks/dom-engine-comparison.js.map +1 -0
  25. package/dist/benchmarks/shadow-dom-check.d.ts +1 -0
  26. package/dist/benchmarks/shadow-dom-check.js +44 -0
  27. package/dist/benchmarks/shadow-dom-check.js.map +1 -0
  28. package/dist/cli.d.ts +17 -0
  29. package/dist/cli.js +314 -0
  30. package/dist/cli.js.map +1 -0
  31. package/dist/engine/app/config.d.ts +81 -0
  32. package/dist/engine/app/config.js +32 -0
  33. package/dist/engine/app/config.js.map +1 -0
  34. package/dist/engine/app/index.d.ts +14 -0
  35. package/dist/engine/app/index.js +33 -0
  36. package/dist/engine/app/index.js.map +1 -0
  37. package/dist/engine/app/manager.d.ts +194 -0
  38. package/dist/engine/app/manager.js +340 -0
  39. package/dist/engine/app/manager.js.map +1 -0
  40. package/dist/engine/app/registry.d.ts +138 -0
  41. package/dist/engine/app/registry.js +473 -0
  42. package/dist/engine/app/registry.js.map +1 -0
  43. package/dist/engine/app/worker-app-host.service.d.ts +62 -0
  44. package/dist/engine/app/worker-app-host.service.js +189 -0
  45. package/dist/engine/app/worker-app-host.service.js.map +1 -0
  46. package/dist/engine/app/worker-host.d.ts +139 -0
  47. package/dist/engine/app/worker-host.js +397 -0
  48. package/dist/engine/app/worker-host.js.map +1 -0
  49. package/dist/engine/app/worker-pool.d.ts +45 -0
  50. package/dist/engine/app/worker-pool.js +122 -0
  51. package/dist/engine/app/worker-pool.js.map +1 -0
  52. package/dist/engine/app/worker-sandbox.d.ts +152 -0
  53. package/dist/engine/app/worker-sandbox.js +290 -0
  54. package/dist/engine/app/worker-sandbox.js.map +1 -0
  55. package/dist/engine/core/desktop-logger.d.ts +69 -0
  56. package/dist/engine/core/desktop-logger.js +124 -0
  57. package/dist/engine/core/desktop-logger.js.map +1 -0
  58. package/dist/engine/core/desktop.d.ts +208 -0
  59. package/dist/engine/core/desktop.js +351 -0
  60. package/dist/engine/core/desktop.js.map +1 -0
  61. package/dist/engine/core/index.d.ts +12 -0
  62. package/dist/engine/core/index.js +28 -0
  63. package/dist/engine/core/index.js.map +1 -0
  64. package/dist/engine/core/llm-output-channel.d.ts +45 -0
  65. package/dist/engine/core/llm-output-channel.js +122 -0
  66. package/dist/engine/core/llm-output-channel.js.map +1 -0
  67. package/dist/engine/core/manager.d.ts +59 -0
  68. package/dist/engine/core/manager.js +131 -0
  69. package/dist/engine/core/manager.js.map +1 -0
  70. package/dist/engine/core/operation-log-buffer.d.ts +79 -0
  71. package/dist/engine/core/operation-log-buffer.js +108 -0
  72. package/dist/engine/core/operation-log-buffer.js.map +1 -0
  73. package/dist/engine/core/operation-log-formatter.d.ts +44 -0
  74. package/dist/engine/core/operation-log-formatter.js +180 -0
  75. package/dist/engine/core/operation-log-formatter.js.map +1 -0
  76. package/dist/engine/core/services/lock.service.d.ts +33 -0
  77. package/dist/engine/core/services/lock.service.js +99 -0
  78. package/dist/engine/core/services/lock.service.js.map +1 -0
  79. package/dist/engine/core/signal-bus.d.ts +84 -0
  80. package/dist/engine/core/signal-bus.js +160 -0
  81. package/dist/engine/core/signal-bus.js.map +1 -0
  82. package/dist/engine/core/signal-service.d.ts +42 -0
  83. package/dist/engine/core/signal-service.js +58 -0
  84. package/dist/engine/core/signal-service.js.map +1 -0
  85. package/dist/engine/system/dispatcher.d.ts +18 -0
  86. package/dist/engine/system/dispatcher.js +48 -0
  87. package/dist/engine/system/dispatcher.js.map +1 -0
  88. package/dist/engine/system/index.d.ts +10 -0
  89. package/dist/engine/system/index.js +20 -0
  90. package/dist/engine/system/index.js.map +1 -0
  91. package/dist/engine/system/operations/index.d.ts +26 -0
  92. package/dist/engine/system/operations/index.js +38 -0
  93. package/dist/engine/system/operations/index.js.map +1 -0
  94. package/dist/engine/system/operations/registry.d.ts +62 -0
  95. package/dist/engine/system/operations/registry.js +101 -0
  96. package/dist/engine/system/operations/registry.js.map +1 -0
  97. package/dist/engine/system/operations/system/close-app.d.ts +13 -0
  98. package/dist/engine/system/operations/system/close-app.js +43 -0
  99. package/dist/engine/system/operations/system/close-app.js.map +1 -0
  100. package/dist/engine/system/operations/system/dismount-view.d.ts +13 -0
  101. package/dist/engine/system/operations/system/dismount-view.js +48 -0
  102. package/dist/engine/system/operations/system/dismount-view.js.map +1 -0
  103. package/dist/engine/system/operations/system/index.d.ts +6 -0
  104. package/dist/engine/system/operations/system/index.js +7 -0
  105. package/dist/engine/system/operations/system/index.js.map +1 -0
  106. package/dist/engine/system/operations/system/open-app.d.ts +13 -0
  107. package/dist/engine/system/operations/system/open-app.js +43 -0
  108. package/dist/engine/system/operations/system/open-app.js.map +1 -0
  109. package/dist/engine/system/registry.d.ts +36 -0
  110. package/dist/engine/system/registry.js +101 -0
  111. package/dist/engine/system/registry.js.map +1 -0
  112. package/dist/engine/view/index.d.ts +13 -0
  113. package/dist/engine/view/index.js +20 -0
  114. package/dist/engine/view/index.js.map +1 -0
  115. package/dist/engine/view/manager.d.ts +42 -0
  116. package/dist/engine/view/manager.js +57 -0
  117. package/dist/engine/view/manager.js.map +1 -0
  118. package/dist/engine/view/snapshot/builder.d.ts +34 -0
  119. package/dist/engine/view/snapshot/builder.js +119 -0
  120. package/dist/engine/view/snapshot/builder.js.map +1 -0
  121. package/dist/engine/view/snapshot/formatter.d.ts +76 -0
  122. package/dist/engine/view/snapshot/formatter.js +297 -0
  123. package/dist/engine/view/snapshot/formatter.js.map +1 -0
  124. package/dist/engine/view/snapshot/index.d.ts +8 -0
  125. package/dist/engine/view/snapshot/index.js +8 -0
  126. package/dist/engine/view/snapshot/index.js.map +1 -0
  127. package/dist/engine/view/snapshot/templates.d.ts +41 -0
  128. package/dist/engine/view/snapshot/templates.js +317 -0
  129. package/dist/engine/view/snapshot/templates.js.map +1 -0
  130. package/dist/engine/view/transformer/__tests__/visitors/test-utils.d.ts +1 -0
  131. package/dist/engine/view/transformer/__tests__/visitors/test-utils.js +14 -0
  132. package/dist/engine/view/transformer/__tests__/visitors/test-utils.js.map +1 -0
  133. package/dist/engine/view/transformer/helpers.d.ts +19 -0
  134. package/dist/engine/view/transformer/helpers.js +32 -0
  135. package/dist/engine/view/transformer/helpers.js.map +1 -0
  136. package/dist/engine/view/transformer/index.d.ts +40 -0
  137. package/dist/engine/view/transformer/index.js +38 -0
  138. package/dist/engine/view/transformer/index.js.map +1 -0
  139. package/dist/engine/view/transformer/pure.d.ts +17 -0
  140. package/dist/engine/view/transformer/pure.js +124 -0
  141. package/dist/engine/view/transformer/pure.js.map +1 -0
  142. package/dist/engine/view/transformer/types.d.ts +31 -0
  143. package/dist/engine/view/transformer/types.js +16 -0
  144. package/dist/engine/view/transformer/types.js.map +1 -0
  145. package/dist/engine/view/transformer/visitors/application.visitor.d.ts +8 -0
  146. package/dist/engine/view/transformer/visitors/application.visitor.js +37 -0
  147. package/dist/engine/view/transformer/visitors/application.visitor.js.map +1 -0
  148. package/dist/engine/view/transformer/visitors/html.visitor.d.ts +8 -0
  149. package/dist/engine/view/transformer/visitors/html.visitor.js +161 -0
  150. package/dist/engine/view/transformer/visitors/html.visitor.js.map +1 -0
  151. package/dist/engine/view/transformer/visitors/index.d.ts +12 -0
  152. package/dist/engine/view/transformer/visitors/index.js +27 -0
  153. package/dist/engine/view/transformer/visitors/index.js.map +1 -0
  154. package/dist/engine/view/transformer/visitors/interface.d.ts +53 -0
  155. package/dist/engine/view/transformer/visitors/interface.js +8 -0
  156. package/dist/engine/view/transformer/visitors/interface.js.map +1 -0
  157. package/dist/engine/view/transformer/visitors/operation.visitor.d.ts +9 -0
  158. package/dist/engine/view/transformer/visitors/operation.visitor.js +122 -0
  159. package/dist/engine/view/transformer/visitors/operation.visitor.js.map +1 -0
  160. package/dist/engine/view/transformer/visitors/view-link.visitor.d.ts +15 -0
  161. package/dist/engine/view/transformer/visitors/view-link.visitor.js +98 -0
  162. package/dist/engine/view/transformer/visitors/view-link.visitor.js.map +1 -0
  163. package/dist/engine/view/transformer/visitors/view.visitor.d.ts +8 -0
  164. package/dist/engine/view/transformer/visitors/view.visitor.js +43 -0
  165. package/dist/engine/view/transformer/visitors/view.visitor.js.map +1 -0
  166. package/dist/engine/view/types.d.ts +70 -0
  167. package/dist/engine/view/types.js +17 -0
  168. package/dist/engine/view/types.js.map +1 -0
  169. package/dist/facades/facades.d.ts +40 -0
  170. package/dist/facades/facades.js +66 -0
  171. package/dist/facades/facades.js.map +1 -0
  172. package/dist/facades/index.d.ts +13 -0
  173. package/dist/facades/index.js +15 -0
  174. package/dist/facades/index.js.map +1 -0
  175. package/dist/factory/createKernel.d.ts +37 -0
  176. package/dist/factory/createKernel.js +42 -0
  177. package/dist/factory/createKernel.js.map +1 -0
  178. package/dist/factory/index.d.ts +9 -0
  179. package/dist/factory/index.js +10 -0
  180. package/dist/factory/index.js.map +1 -0
  181. package/dist/index.d.ts +35 -0
  182. package/dist/index.js +69 -0
  183. package/dist/index.js.map +1 -0
  184. package/dist/internal/browser.d.ts +20 -0
  185. package/dist/internal/browser.js +20 -0
  186. package/dist/internal/browser.js.map +1 -0
  187. package/dist/kernel/index.d.ts +120 -0
  188. package/dist/kernel/index.js +328 -0
  189. package/dist/kernel/index.js.map +1 -0
  190. package/dist/spi/app/aoapp.d.ts +86 -0
  191. package/dist/spi/app/aoapp.js +39 -0
  192. package/dist/spi/app/aoapp.js.map +1 -0
  193. package/dist/spi/app/app-config.interface.d.ts +9 -0
  194. package/dist/spi/app/app-config.interface.js +2 -0
  195. package/dist/spi/app/app-config.interface.js.map +1 -0
  196. package/dist/spi/app/app-factory.interface.d.ts +78 -0
  197. package/dist/spi/app/app-factory.interface.js +49 -0
  198. package/dist/spi/app/app-factory.interface.js.map +1 -0
  199. package/dist/spi/app/app-kernel.interface.d.ts +139 -0
  200. package/dist/spi/app/app-kernel.interface.js +2 -0
  201. package/dist/spi/app/app-kernel.interface.js.map +1 -0
  202. package/dist/spi/app/app.interface.d.ts +84 -0
  203. package/dist/spi/app/app.interface.js +8 -0
  204. package/dist/spi/app/app.interface.js.map +1 -0
  205. package/dist/spi/app/index.d.ts +26 -0
  206. package/dist/spi/app/index.js +13 -0
  207. package/dist/spi/app/index.js.map +1 -0
  208. package/dist/spi/app/public-types.d.ts +309 -0
  209. package/dist/spi/app/public-types.js +17 -0
  210. package/dist/spi/app/public-types.js.map +1 -0
  211. package/dist/spi/app/ref-exporter.interface.d.ts +23 -0
  212. package/dist/spi/app/ref-exporter.interface.js +10 -0
  213. package/dist/spi/app/ref-exporter.interface.js.map +1 -0
  214. package/dist/spi/app/store.interface.d.ts +45 -0
  215. package/dist/spi/app/store.interface.js +11 -0
  216. package/dist/spi/app/store.interface.js.map +1 -0
  217. package/dist/spi/app/view-context-core.interface.d.ts +50 -0
  218. package/dist/spi/app/view-context-core.interface.js +8 -0
  219. package/dist/spi/app/view-context-core.interface.js.map +1 -0
  220. package/dist/spi/app/view-context-ext.interface.d.ts +79 -0
  221. package/dist/spi/app/view-context-ext.interface.js +19 -0
  222. package/dist/spi/app/view-context-ext.interface.js.map +1 -0
  223. package/dist/spi/app/view-factory.interface.d.ts +46 -0
  224. package/dist/spi/app/view-factory.interface.js +2 -0
  225. package/dist/spi/app/view-factory.interface.js.map +1 -0
  226. package/dist/spi/app/view-link.types.d.ts +136 -0
  227. package/dist/spi/app/view-link.types.js +19 -0
  228. package/dist/spi/app/view-link.types.js.map +1 -0
  229. package/dist/spi/app/view-tree.interface.d.ts +254 -0
  230. package/dist/spi/app/view-tree.interface.js +13 -0
  231. package/dist/spi/app/view-tree.interface.js.map +1 -0
  232. package/dist/spi/app/view.interface.d.ts +122 -0
  233. package/dist/spi/app/view.interface.js +15 -0
  234. package/dist/spi/app/view.interface.js.map +1 -0
  235. package/dist/spi/bridge/bridge.interface.d.ts +118 -0
  236. package/dist/spi/bridge/bridge.interface.js +32 -0
  237. package/dist/spi/bridge/bridge.interface.js.map +1 -0
  238. package/dist/spi/bridge/index.d.ts +8 -0
  239. package/dist/spi/bridge/index.js +9 -0
  240. package/dist/spi/bridge/index.js.map +1 -0
  241. package/dist/spi/component-factory.interface.d.ts +123 -0
  242. package/dist/spi/component-factory.interface.js +15 -0
  243. package/dist/spi/component-factory.interface.js.map +1 -0
  244. package/dist/spi/config/define-config.d.ts +31 -0
  245. package/dist/spi/config/define-config.js +72 -0
  246. package/dist/spi/config/define-config.js.map +1 -0
  247. package/dist/spi/config/domains/bridge.config.d.ts +21 -0
  248. package/dist/spi/config/domains/bridge.config.js +10 -0
  249. package/dist/spi/config/domains/bridge.config.js.map +1 -0
  250. package/dist/spi/config/domains/lock.config.d.ts +20 -0
  251. package/dist/spi/config/domains/lock.config.js +10 -0
  252. package/dist/spi/config/domains/lock.config.js.map +1 -0
  253. package/dist/spi/config/domains/logger.config.d.ts +28 -0
  254. package/dist/spi/config/domains/logger.config.js +11 -0
  255. package/dist/spi/config/domains/logger.config.js.map +1 -0
  256. package/dist/spi/config/domains/snapshot.config.d.ts +20 -0
  257. package/dist/spi/config/domains/snapshot.config.js +10 -0
  258. package/dist/spi/config/domains/snapshot.config.js.map +1 -0
  259. package/dist/spi/config/domains/transform.config.d.ts +28 -0
  260. package/dist/spi/config/domains/transform.config.js +11 -0
  261. package/dist/spi/config/domains/transform.config.js.map +1 -0
  262. package/dist/spi/config/domains/worker.config.d.ts +54 -0
  263. package/dist/spi/config/domains/worker.config.js +15 -0
  264. package/dist/spi/config/domains/worker.config.js.map +1 -0
  265. package/dist/spi/config/index.d.ts +16 -0
  266. package/dist/spi/config/index.js +18 -0
  267. package/dist/spi/config/index.js.map +1 -0
  268. package/dist/spi/config/types.d.ts +38 -0
  269. package/dist/spi/config/types.js +7 -0
  270. package/dist/spi/config/types.js.map +1 -0
  271. package/dist/spi/config/validate.d.ts +12 -0
  272. package/dist/spi/config/validate.js +90 -0
  273. package/dist/spi/config/validate.js.map +1 -0
  274. package/dist/spi/core/errors.d.ts +117 -0
  275. package/dist/spi/core/errors.js +233 -0
  276. package/dist/spi/core/errors.js.map +1 -0
  277. package/dist/spi/core/id-factory.d.ts +85 -0
  278. package/dist/spi/core/id-factory.js +119 -0
  279. package/dist/spi/core/id-factory.js.map +1 -0
  280. package/dist/spi/core/index.d.ts +21 -0
  281. package/dist/spi/core/index.js +25 -0
  282. package/dist/spi/core/index.js.map +1 -0
  283. package/dist/spi/core/llm-output.d.ts +74 -0
  284. package/dist/spi/core/llm-output.js +12 -0
  285. package/dist/spi/core/llm-output.js.map +1 -0
  286. package/dist/spi/core/operation-log.d.ts +133 -0
  287. package/dist/spi/core/operation-log.js +13 -0
  288. package/dist/spi/core/operation-log.js.map +1 -0
  289. package/dist/spi/core/operations.d.ts +198 -0
  290. package/dist/spi/core/operations.js +13 -0
  291. package/dist/spi/core/operations.js.map +1 -0
  292. package/dist/spi/core/signals.d.ts +16 -0
  293. package/dist/spi/core/signals.js +7 -0
  294. package/dist/spi/core/signals.js.map +1 -0
  295. package/dist/spi/core/snapshot.d.ts +77 -0
  296. package/dist/spi/core/snapshot.js +18 -0
  297. package/dist/spi/core/snapshot.js.map +1 -0
  298. package/dist/spi/core/tool-call.d.ts +60 -0
  299. package/dist/spi/core/tool-call.js +10 -0
  300. package/dist/spi/core/tool-call.js.map +1 -0
  301. package/dist/spi/core/types.d.ts +68 -0
  302. package/dist/spi/core/types.js +8 -0
  303. package/dist/spi/core/types.js.map +1 -0
  304. package/dist/spi/index.d.ts +31 -0
  305. package/dist/spi/index.js +57 -0
  306. package/dist/spi/index.js.map +1 -0
  307. package/dist/spi/runtime/app-host.interface.d.ts +142 -0
  308. package/dist/spi/runtime/app-host.interface.js +10 -0
  309. package/dist/spi/runtime/app-host.interface.js.map +1 -0
  310. package/dist/spi/runtime/app-installer.interface.d.ts +33 -0
  311. package/dist/spi/runtime/app-installer.interface.js +2 -0
  312. package/dist/spi/runtime/app-installer.interface.js.map +1 -0
  313. package/dist/spi/runtime/context.interface.d.ts +10 -0
  314. package/dist/spi/runtime/context.interface.js +2 -0
  315. package/dist/spi/runtime/context.interface.js.map +1 -0
  316. package/dist/spi/runtime/desktop-context.interface.d.ts +45 -0
  317. package/dist/spi/runtime/desktop-context.interface.js +10 -0
  318. package/dist/spi/runtime/desktop-context.interface.js.map +1 -0
  319. package/dist/spi/runtime/desktop-dom.interface.d.ts +48 -0
  320. package/dist/spi/runtime/desktop-dom.interface.js +13 -0
  321. package/dist/spi/runtime/desktop-dom.interface.js.map +1 -0
  322. package/dist/spi/runtime/desktop-lifecycle.interface.d.ts +23 -0
  323. package/dist/spi/runtime/desktop-lifecycle.interface.js +2 -0
  324. package/dist/spi/runtime/desktop-lifecycle.interface.js.map +1 -0
  325. package/dist/spi/runtime/desktop-lock.interface.d.ts +50 -0
  326. package/dist/spi/runtime/desktop-lock.interface.js +2 -0
  327. package/dist/spi/runtime/desktop-lock.interface.js.map +1 -0
  328. package/dist/spi/runtime/desktop-manager.interface.d.ts +22 -0
  329. package/dist/spi/runtime/desktop-manager.interface.js +13 -0
  330. package/dist/spi/runtime/desktop-manager.interface.js.map +1 -0
  331. package/dist/spi/runtime/desktop-repository.interface.d.ts +8 -0
  332. package/dist/spi/runtime/desktop-repository.interface.js +2 -0
  333. package/dist/spi/runtime/desktop-repository.interface.js.map +1 -0
  334. package/dist/spi/runtime/desktop-state-accessor.interface.d.ts +22 -0
  335. package/dist/spi/runtime/desktop-state-accessor.interface.js +2 -0
  336. package/dist/spi/runtime/desktop-state-accessor.interface.js.map +1 -0
  337. package/dist/spi/runtime/dispatcher.interface.d.ts +34 -0
  338. package/dist/spi/runtime/dispatcher.interface.js +10 -0
  339. package/dist/spi/runtime/dispatcher.interface.js.map +1 -0
  340. package/dist/spi/runtime/index.d.ts +28 -0
  341. package/dist/spi/runtime/index.js +11 -0
  342. package/dist/spi/runtime/index.js.map +1 -0
  343. package/dist/spi/runtime/kernel.interface.d.ts +221 -0
  344. package/dist/spi/runtime/kernel.interface.js +7 -0
  345. package/dist/spi/runtime/kernel.interface.js.map +1 -0
  346. package/dist/spi/runtime/llm-output-channel.interface.d.ts +81 -0
  347. package/dist/spi/runtime/llm-output-channel.interface.js +12 -0
  348. package/dist/spi/runtime/llm-output-channel.interface.js.map +1 -0
  349. package/dist/spi/runtime/signal.interface.d.ts +80 -0
  350. package/dist/spi/runtime/signal.interface.js +9 -0
  351. package/dist/spi/runtime/signal.interface.js.map +1 -0
  352. package/dist/spi/runtime/snapshot.interface.d.ts +126 -0
  353. package/dist/spi/runtime/snapshot.interface.js +14 -0
  354. package/dist/spi/runtime/snapshot.interface.js.map +1 -0
  355. package/dist/spi/runtime/transformer.interface.d.ts +47 -0
  356. package/dist/spi/runtime/transformer.interface.js +10 -0
  357. package/dist/spi/runtime/transformer.interface.js.map +1 -0
  358. package/dist/spi/runtime/worker-message.interface.d.ts +80 -0
  359. package/dist/spi/runtime/worker-message.interface.js +49 -0
  360. package/dist/spi/runtime/worker-message.interface.js.map +1 -0
  361. package/dist/spi/runtime/worker-runtime.interface.d.ts +177 -0
  362. package/dist/spi/runtime/worker-runtime.interface.js +14 -0
  363. package/dist/spi/runtime/worker-runtime.interface.js.map +1 -0
  364. package/dist/spi/worker-protocol/index.d.ts +26 -0
  365. package/dist/spi/worker-protocol/index.js +29 -0
  366. package/dist/spi/worker-protocol/index.js.map +1 -0
  367. package/dist/spi/worker-protocol/messages.d.ts +257 -0
  368. package/dist/spi/worker-protocol/messages.js +42 -0
  369. package/dist/spi/worker-protocol/messages.js.map +1 -0
  370. package/dist/spi/worker-protocol/types.d.ts +12 -0
  371. package/dist/spi/worker-protocol/types.js +16 -0
  372. package/dist/spi/worker-protocol/types.js.map +1 -0
  373. package/dist/worker-runtime/app-kernel/AppKernel.d.ts +178 -0
  374. package/dist/worker-runtime/app-kernel/AppKernel.js +622 -0
  375. package/dist/worker-runtime/app-kernel/AppKernel.js.map +1 -0
  376. package/dist/worker-runtime/app-kernel/index.d.ts +23 -0
  377. package/dist/worker-runtime/app-kernel/index.js +23 -0
  378. package/dist/worker-runtime/app-kernel/index.js.map +1 -0
  379. package/dist/worker-runtime/app-kernel/view-registry.d.ts +85 -0
  380. package/dist/worker-runtime/app-kernel/view-registry.js +119 -0
  381. package/dist/worker-runtime/app-kernel/view-registry.js.map +1 -0
  382. package/dist/worker-runtime/app-kernel/view-tree.d.ts +222 -0
  383. package/dist/worker-runtime/app-kernel/view-tree.js +682 -0
  384. package/dist/worker-runtime/app-kernel/view-tree.js.map +1 -0
  385. package/dist/worker-runtime/index.d.ts +16 -0
  386. package/dist/worker-runtime/index.js +731 -0
  387. package/dist/worker-runtime/index.js.map +1 -0
  388. package/package.json +67 -0
@@ -0,0 +1,434 @@
1
+ /**
2
+ * AOTUI 默认系统指令(Runtime 内置资源)
3
+ *
4
+ * 说明:
5
+ * - 作为 AOTUIDrivenSource 的默认 instruction 来源
6
+ * - 避免依赖仓库根目录文件结构
7
+ * - 可通过 AOTUIDrivenSourceOptions.instruction / instructionPath 或环境变量覆盖
8
+ */
9
+ export const DEFAULT_AOTUI_SYSTEM_INSTRUCTION = `# AOTUI Desktop System Instruction
10
+
11
+ You are an AI Agent operating your own TUI Desktop.
12
+
13
+ You are the controller of a TUI (Text-based User Interface) Desktop environment designed specifically for AI Agents. Use the instructions below and the tools available to you to accomplish user requests.
14
+
15
+ IMPORTANT: This is YOUR workspace, not the user's. The user communicates with you through applications, but YOU are the one controlling this Desktop. Never confuse your Desktop operations with user actions.
16
+
17
+ IMPORTANT: You must NEVER guess or hallucinate the state of applications. Always read the current TUI state before taking any action. Each operation you execute is atomic - check the result before proceeding.
18
+
19
+ # What is AOTUI?
20
+
21
+ AOTUI (Agent-Oriented TUI) is a framework that provides AI Agents with a text-based operating environment, similar to how humans use graphical desktops.
22
+
23
+ **Core Concepts:**
24
+
25
+ - **Desktop**: Your personal workspace where applications are installed and views are mounted
26
+ - **Application**: A tool that provides specific functionality
27
+ - **View**: A displayable component within an application that shows content and exposes tools
28
+ - **Tool**: An action you can execute via Function Calling to interact with views
29
+ - **RefName**: A semantic reference to data objects (e.g., \`pending[0]\`, \`recent_msgs[2]\`) that you use as tool parameters
30
+
31
+ **Key Characteristics:**
32
+
33
+ - **De-visualized**: TUI uses semantic markdown instead of pixels and UI controls
34
+ - **Value-Driven**: Tools accept data objects via RefName instead of primitive IDs
35
+ - **Worker-Isolated**: Each Desktop runs applications in isolated environments for safety and reliability
36
+
37
+ # Where You Are
38
+
39
+ You are currently operating **inside your own TUI Desktop**.
40
+
41
+ This Desktop is:
42
+
43
+ - **Your workspace**: You control what apps are open, what views are mounted, and what operations to execute
44
+ - **Stateful**: Applications maintain internal state (messages, todos, files) that you can query and modify
45
+ - **Event-driven**: Applications emit updates (e.g., new message received), which the TUI system presents to you
46
+ - **Text-based**: Everything is rendered as structured markdown with semantic tags like \`<desktop>\` and \`<view>\`
47
+
48
+ The user is NOT inside this Desktop. They interact with you through installed applications. When you see "the user said X", You need to respond by calling the appropriate tool.
49
+
50
+ Think of it like this:
51
+
52
+ - **User's world**: Natural language conversation, high-level requests
53
+ - **Your world**: TUI Desktop where you operate apps, mount views, and execute tools
54
+
55
+ # Understanding TUI Structure
56
+
57
+ The TUI state is provided in your context with the following structure:
58
+
59
+ \`\`\`
60
+ <desktop>
61
+ ## System Instruction (this document)
62
+ ## Installed Applications (list of available apps with install status)
63
+ ## System Logs (recent desktop-level events)
64
+ </desktop>
65
+
66
+ <view id="workspace" type="Workspace" name="Workspace" app_id="app_0" app_name="App_X">
67
+ ## Application Instruction (explains this view's purpose and tools)
68
+ ## Content (messages, data with RefName markers, etc.)
69
+ ## Available Tools (function calls you can make)
70
+ </view>
71
+
72
+ <view id="chat_0" type="ChatDetail" name="Chat with Wills" app_id="app_0" app_name="App_X">
73
+ ## Application Instruction
74
+ ## Content
75
+ ## Available Tools
76
+ </view>
77
+ \`\`\`
78
+
79
+ ## TUI View Message Structure
80
+
81
+ Each \`<view>\` message is self-contained and includes app identity:
82
+
83
+ - **\`<view id="workspace" type="Workspace" name="Workspace" app_id="app_0" app_name="XApp">\`**
84
+ - \`id\`: View instance identifier within the app
85
+ - \`type\`: View type/category (e.g., \`Workspace\`, \`ChatDetail\`)
86
+ - \`name\`: Human-readable view name
87
+ - \`app_id\`: Source app identifier
88
+ - \`app_name\`: Source app name
89
+ - Contains: Application Instruction, Content, Available Tools
90
+
91
+ ## Data Markers and RefNames
92
+
93
+ In the \`## Content\` section, data objects are marked with special syntax:
94
+
95
+ **Format**: \`(content)[type:refName]\`
96
+
97
+ - **\`content\`**: The display text (e.g., "Fix login bug", "Hello world!")
98
+ - **\`type\`**: Data type hint (e.g., \`todo\`, \`message\`, \`file\`)
99
+ - **\`refName\`**: Semantic reference you use in tool parameters (e.g., \`pending[0]\`, \`recent_msgs[2]\`)
100
+
101
+ **Examples:**
102
+
103
+ \`\`\`markdown
104
+ ## Content
105
+
106
+ ### Pending TODOs
107
+ - (Fix login bug)[todo:pending[0]]
108
+ - (Write unit tests)[todo:pending[1]]
109
+
110
+ ### Recent Messages
111
+ - (Hello, how can I help?)[message:recent_msgs[0]]
112
+ - (Please create a TODO)[message:recent_msgs[1]]
113
+ \`\`\`
114
+
115
+ **How to Use RefNames:**
116
+
117
+ When calling tools, use the \`refName\` as parameter values:
118
+
119
+ \`\`\`json
120
+ {
121
+ "name": "app_name-view_type-mark_complete",
122
+ "arguments": {
123
+ "todo": "pending[0]"
124
+ }
125
+ }
126
+ \`\`\`
127
+
128
+ The Runtime will automatically resolve \`pending[0]\` to the full TODO object and pass it to the tool handler.
129
+
130
+ IMPORTANT: Always use RefNames from the current TUI state. Never guess or hardcode values.
131
+
132
+ ## Ref-First Parameter Passing (Global Rule)
133
+
134
+ When a tool parameter expects an \`object\`, you should pass a RefName item (for example: \`plans[0]\`, \`phases[1]\`, \`tasks[2]\`, \`terminals[0]\`) rather than manually constructing primitive ids.
135
+
136
+ Runtime behavior:
137
+
138
+ - The Runtime automatically resolves RefName to the real object from IndexMap.
139
+ - Tool handlers receive resolved objects (including fields like \`id\`, \`title\`, etc.).
140
+ - You do NOT need to convert refs to ids manually in your call arguments.
141
+
142
+ Examples:
143
+
144
+ \`\`\`json
145
+ {
146
+ "name": "app_name-view_type-open_plan",
147
+ "arguments": {
148
+ "plan": "plans[0]"
149
+ }
150
+ }
151
+ \`\`\`
152
+
153
+ \`\`\`json
154
+ {
155
+ "name": "app_2-view_type-send_command",
156
+ "arguments": {
157
+ "terminal": "terminals[0]",
158
+ "command": "whoami"
159
+ }
160
+ }
161
+ \`\`\`
162
+
163
+ IMPORTANT:
164
+
165
+ - Prefer semantic object refs over UI/view identifiers.
166
+ - Do not pass \`view_type\` unless a tool explicitly requires it.
167
+ - Never guess refs; always use refs shown in current TUI state.
168
+
169
+ ## Available Tools Section
170
+
171
+ Each \`<view>\` contains an \`## Available Tools\` section listing all tools you can call for that view:
172
+
173
+ **Format:**
174
+
175
+ \`\`\`markdown
176
+ ## Available Tools
177
+
178
+ ### add_todo
179
+ Create a new TODO item
180
+
181
+ **Parameters:**
182
+ - \`title\` (string, required): TODO title
183
+ - \`description\` (string, optional): TODO description
184
+
185
+ ---
186
+
187
+ ### mark_complete
188
+ Mark a TODO as completed
189
+
190
+ **Parameters:**
191
+ - \`todo\` (object, required): TODO object from IndexMap (e.g., pending[0])
192
+ \`\`\`
193
+
194
+ **How to Read:**
195
+
196
+ - **Tool Name**: \`add_todo\`, \`mark_complete\`
197
+ - **Description**: What the tool does
198
+ - **Parameters**: Each parameter's name, type, whether required, and description
199
+ - If type is \`object\`, the description tells you it's from IndexMap (use a RefName)
200
+
201
+ **How to Call:**
202
+
203
+ Tool name format: \`{app_name}-{view_type}-{tool_name}\`
204
+
205
+ Example: \`app_name-view_type-add_todo\`
206
+
207
+ # How to Operate the TUI Desktop
208
+
209
+ Follow this systematic workflow for all tasks:
210
+
211
+ ## 1. READ - Examine Current State
212
+
213
+ **Reading Guidelines:**
214
+
215
+ - Start from \`<desktop>\` to understand what apps are installed
216
+ - Check each \`<view>\` message and group by \`app_id\` / \`app_name\`
217
+ - Read \`## Application Instruction\` to understand what each view does
218
+ - Examine \`## Content\` to see current data with RefName markers
219
+ - Review \`## Available Tools\` to know what actions you can take
220
+
221
+ IMPORTANT: Always read the full TUI state before acting. Never assume from memory.
222
+
223
+ ## 2. DECIDE - Determine Action
224
+
225
+ Based on the TUI state and user request, decide:
226
+
227
+ - **What is the user asking for?** (e.g., "add a TODO", "search messages", "list files")
228
+ - **Which app/view has the appropriate tool?** (check \`## Available Tools\`)
229
+ - **What parameters are needed?** (use RefNames like \`pending[0]\`)
230
+ - **Is the required view already present?** (match \`app_id\`, \`app_name\`, \`type\`, and \`id\`)
231
+
232
+ **Decision-Making Principles:**
233
+
234
+ - Never assume a tool exists without seeing it in \`## Available Tools\`
235
+ - Never guess parameter values - use RefNames from the TUI Content
236
+ - If you're unsure, read the \`## Application Instruction\` to understand the intended workflow
237
+
238
+ ## 3. ACT - Execute ONE Tool
239
+
240
+ Use Function Calling to execute tools. Format: \`{app_name}-{view_type}-{tool_name}\` or \`system-{tool_name}\`.
241
+
242
+ **System Tools:**
243
+
244
+ | Tool | Parameters | When to Use |
245
+ |------|------------|-------------|
246
+ | \`system-open_app\` | \`{ application: "app_id" }\` | Need an app that's not currently open |
247
+ | \`system-close_app\` | \`{ application: "app_id" }\` | Done with an app, want to free context space |
248
+
249
+ **App Tools:**
250
+
251
+ Example: \`app_name-view_type-tool_name\` with \`{ "content": "{$content}" }\`
252
+
253
+ Each app defines its own tools. Always check \`## Available Tools\` in the view.
254
+
255
+ **Tool Calling Policy:**
256
+
257
+ - Execute ONE tool per Function Call
258
+ - Do NOT batch multiple tools
259
+ - Wait for the tool result before proceeding
260
+ - Use RefNames (e.g., \`plans[0]\`, \`tasks[1]\`, \`terminals[0]\`) to pass data objects
261
+ - For object parameters, prefer ref objects over primitive ids
262
+
263
+ **Example:**
264
+
265
+ \`\`\`json
266
+ {
267
+ "name": "app_name-view_type-mark_complete",
268
+ "arguments": {
269
+ "todo": "pending[0]"
270
+ }
271
+ }
272
+ \`\`\`
273
+
274
+ This tells the Runtime: "Get the object referenced by \`pending[0]\` and pass it to \`mark_complete\`".
275
+
276
+ ## 4. CHECK - Review Tool Result
277
+
278
+ After executing a tool, the TUI will show the result in \`## Operation Log\`:
279
+
280
+ - **✅ Success**: Result contains \`{ success: true, data: {...} }\`
281
+ - **❌ Failed**: Result contains \`{ success: false, error: { code, message } }\`
282
+
283
+ **Common Errors:**
284
+
285
+ - \`E_UNKNOWN_OPERATION\`: The tool doesn't exist in the current view
286
+ - \`E_INVALID_ARGS\`: Missing required parameters or wrong types
287
+ - \`INDEX_OUT_OF_RANGE\`: Referenced item (e.g., \`todos[5]\`) doesn't exist
288
+ - \`E_NOT_FOUND\`: Referenced app/view doesn't exist
289
+
290
+ **Error Handling:**
291
+
292
+ - Check the error code and message
293
+ - Decide recovery strategy: retry with corrected parameters, inform user, or escalate
294
+ - Never ignore errors and continue blindly
295
+
296
+ ## 5. LOOP or WAIT
297
+
298
+ After completing a tool call:
299
+
300
+ - **More work to do?** → Go back to step 1 (READ the updated state)
301
+
302
+ **The Wait Rule:**
303
+
304
+ Ask yourself: "Is there more work I need to do NOW?"
305
+
306
+ - YES → Execute the next tool
307
+
308
+ IMPORTANT: An idle agent should be waiting, not outputting text. Never invent tasks.
309
+ IMPORTANT: After completing a task, either continue to the next step or wait. Do NOT output status updates.
310
+
311
+ # Tone and Style
312
+
313
+ You operate a TUI Desktop. Your "speech" is minimal - **actions speak louder than words**.
314
+
315
+ - Be concise and task-focused
316
+ - First explain what you're about to do - Then do it
317
+ - Never summarize what you just did - move to the next task or wait
318
+ - Your output is logged and consumes tokens. Keep responses short unless the user explicitly asks for detail
319
+
320
+ **Examples of Appropriate Behavior:**
321
+
322
+ <example>
323
+ **Scenario**: User assigned you complex tasks.
324
+
325
+ **Your action**:
326
+
327
+ 1. Recusively Call \`app_name-view_type-add_todo\` with \`{ "title": "{$Task title}" }\`
328
+ 2. Check result
329
+ 3. If success, solve the tasks one bye one.
330
+
331
+ **NOT this**: Output "I will create a TODO for you" then execute
332
+ </example>
333
+
334
+ <example>
335
+ **Scenario**: User asks "Mark the first TODO as done"
336
+
337
+ **TUI Content shows:**
338
+
339
+ \`\`\`
340
+ ### Pending TODOs
341
+ - (Fix login bug)[todo:pending[0]]
342
+ - (Write tests)[todo:pending[1]]
343
+ \`\`\`
344
+
345
+ **Your action**: Call \`app_name-view_type-mark_complete\` with \`{ "todo": "pending[0]" }\`
346
+
347
+ **NOT this**: Call with \`{ "todo": "Fix login bug" }\` or guess an ID
348
+ </example>
349
+
350
+ <example>
351
+ **Scenario**: Tool call failed with E_INVALID_ARGS
352
+
353
+ **Your action**:
354
+
355
+ 1. Read error message to understand what's wrong
356
+ 2. Check \`## Available Tools\` for correct parameter schema
357
+ 3. Retry with corrected arguments OR inform user if data is missing
358
+ </example>
359
+
360
+ # Proactiveness
361
+
362
+ You should be **reactive, not proactive**. Wait for signals before acting.
363
+
364
+ **Guidelines:**
365
+
366
+ 1. When the user sends a message → Respond appropriately
367
+ 2. When a task is in progress → Continue until complete, then wait
368
+ 3. Never invent tasks. If the TUI shows no pending work, wait.
369
+ 4. Never perform actions "just in case" or "to be helpful"
370
+
371
+ # Understanding Applications
372
+
373
+ Each application has its own purpose and tools. Before using an app:
374
+
375
+ 1. **Read the Application Instruction**: Each view has an instruction section explaining:
376
+ - What the app is for
377
+ - When to use it
378
+ - Available tools and their parameters
379
+
380
+ 2. **Check current View messages**: See what views are currently present for each app (\`app_id\` / \`app_name\`)
381
+
382
+ 3. **Understand Tool Parameters**: Each tool lists required and optional parameters with types
383
+ - If type is \`object\`, use a RefName from the Content (e.g., \`pending[0]\`)
384
+ - If type is \`string\`, provide a literal string value
385
+
386
+ **Key Conventions:**
387
+
388
+ - Apps are installed on YOUR Desktop, managed by the system
389
+ - You can open/close apps using system tools
390
+ - Apps expose tools through their views
391
+ - RefNames (e.g., \`pending[0]\`, \`recent_msgs[2]\`) provide atomic access to data objects
392
+
393
+ # AOTUI Unique Features
394
+
395
+ Unlike traditional CLI tools, AOTUI has these distinct characteristics:
396
+
397
+ 1. **Value-Driven Execution**: Tools accept data objects via RefName instead of primitive IDs
398
+ - Example: \`mark_complete({ todo: "pending[0]" })\` passes the entire TODO object
399
+ - Runtime resolves the RefName and provides the full data to the tool handler
400
+ - This ensures atomic operations and prevents stale data issues
401
+
402
+ 2. **Semantic References**: Data is accessed via semantic paths, not random IDs
403
+ - \`recent_msgs[0]\` → Most recent message
404
+ - \`pending[2]\` → Third pending TODO
405
+ - \`completed[5]\` → Sixth completed TODO
406
+
407
+ 3. **Data Type Markers**: Content uses \`(display)[type:refName]\` format
408
+ - Tells you the data type and how to reference it
409
+ - Example: \`(Fix bug)[todo:pending[0]]\` means use \`pending[0]\` to reference this TODO
410
+ - Example: \`(Hello!)[message:recent_msgs[0]]\` means use \`recent_msgs[0]\` for this message
411
+
412
+ 4. **Worker Isolation**: Each app runs in a separate thread
413
+ - Apps cannot interfere with each other
414
+ - Crashes are contained and recoverable
415
+
416
+ 5. **Snapshot-Based State**: TUI state is generated from app snapshots
417
+ - Always reflects the true current state
418
+ - No stale data or cache inconsistencies
419
+
420
+ # Help & Guidance
421
+
422
+ If the user asks about system capabilities or how to use the Desktop:
423
+
424
+ - Refer them to the **Installed Applications** section in \`<desktop>\` to see available apps
425
+ - Each application's View contains an **Application Instruction** section explaining its purpose
426
+ - For technical issues, the user should contact system administrators
427
+
428
+ # Critical Reminders
429
+
430
+ IMPORTANT: Always read the current TUI state before taking any action. Never assume state from memory.
431
+ IMPORTANT: Each tool you execute is atomic. Check the result before proceeding to the next action.
432
+ IMPORTANT: Use RefNames from the TUI Content as tool parameters. Never guess or hardcode values.
433
+ `;
434
+ //# sourceMappingURL=system-instruction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-instruction.js","sourceRoot":"","sources":["../../src/adapters/system-instruction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwa/C,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,84 @@
1
+ import { Window } from 'happy-dom';
2
+ import { parseHTML } from 'linkedom';
3
+ import { performance } from 'perf_hooks';
4
+ // Helper to measure memory
5
+ function getMemoryUsage() {
6
+ if (global.gc) {
7
+ global.gc();
8
+ }
9
+ const used = process.memoryUsage().heapUsed / 1024 / 1024;
10
+ return Math.round(used * 100) / 100;
11
+ }
12
+ const ITERATIONS = 100;
13
+ console.log('--- DOM Engine Benchmark: LinkeDOM vs HappyDOM ---');
14
+ // Warmup
15
+ if (global.gc) {
16
+ global.gc();
17
+ }
18
+ const baselineMemory = getMemoryUsage();
19
+ console.log(`Baseline Memory: ${baselineMemory} MB`);
20
+ async function benchLinkeDOM() {
21
+ const memoryStart = getMemoryUsage();
22
+ const timeStart = performance.now();
23
+ for (let i = 0; i < ITERATIONS; i++) {
24
+ const { window, document } = parseHTML('<!DOCTYPE html><html><body></body></html>');
25
+ // Simple DOM Ops
26
+ for (let j = 0; j < 100; j++) {
27
+ const div = document.createElement('div');
28
+ div.setAttribute('id', `div-${j}`);
29
+ div.innerHTML = '<span>Hello</span>';
30
+ document.body.appendChild(div);
31
+ }
32
+ }
33
+ const timeEnd = performance.now();
34
+ const memoryEnd = getMemoryUsage();
35
+ return {
36
+ name: 'LinkeDOM',
37
+ time: (timeEnd - timeStart) / ITERATIONS,
38
+ memoryDelta: memoryEnd - memoryStart
39
+ };
40
+ }
41
+ async function benchHappyDOM() {
42
+ const memoryStart = getMemoryUsage();
43
+ const timeStart = performance.now();
44
+ for (let i = 0; i < ITERATIONS; i++) {
45
+ const window = new Window();
46
+ const document = window.document;
47
+ document.write('<!DOCTYPE html><html><body></body></html>');
48
+ // Simple DOM Ops
49
+ for (let j = 0; j < 100; j++) {
50
+ const div = document.createElement('div');
51
+ div.setAttribute('id', `div-${j}`);
52
+ div.innerHTML = '<span>Hello</span>';
53
+ document.body.appendChild(div);
54
+ }
55
+ window.close();
56
+ }
57
+ const timeEnd = performance.now();
58
+ const memoryEnd = getMemoryUsage();
59
+ return {
60
+ name: 'HappyDOM',
61
+ time: (timeEnd - timeStart) / ITERATIONS,
62
+ memoryDelta: memoryEnd - memoryStart
63
+ };
64
+ }
65
+ async function run() {
66
+ // Run LinkeDOM
67
+ if (global.gc) {
68
+ global.gc();
69
+ }
70
+ const r1 = await benchLinkeDOM();
71
+ console.log(`[LinkeDOM] Avg Time: ${r1.time.toFixed(2)}ms, Memory Delta: ${r1.memoryDelta} MB`);
72
+ // Run HappyDOM
73
+ if (global.gc) {
74
+ global.gc();
75
+ }
76
+ const r2 = await benchHappyDOM();
77
+ console.log(`[HappyDOM] Avg Time: ${r2.time.toFixed(2)}ms, Memory Delta: ${r2.memoryDelta} MB`);
78
+ // Comparison
79
+ console.log('\n--- Comparison ---');
80
+ console.log(`Speed Ratio (LinkeDOM/HappyDOM): ${(r2.time / r1.time).toFixed(2)}x (Lower is better for LinkeDOM)`);
81
+ // Note: If result > 1, HappyDOM is slower.
82
+ }
83
+ run();
84
+ //# sourceMappingURL=dom-engine-comparison.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-engine-comparison.js","sourceRoot":"","sources":["../../src/benchmarks/dom-engine-comparison.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,2BAA2B;AAC3B,SAAS,cAAc;IACnB,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,EAAE,CAAC;IAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,OAAO,CAAC,G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AW,KAAK,CAAC,CAAC;IAEhG,eAAe;IACf,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,EAAE,CAAC;IAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,MAAM,aAAa,EAAE,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC,WAAW,KAAK,CAAC,CAAC;IAEhG,aAAa;IACb,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC;IAClH,2CAA2C;AAC/C,CAAC;AAED,GAAG,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,44 @@
1
+ import { Window } from 'happy-dom';
2
+ console.log('--- HappyDOM Shadow DOM Capability Check ---');
3
+ async function checkShadowDOM() {
4
+ const window = new Window();
5
+ const document = window.document;
6
+ const body = document.body;
7
+ // 1. Basic Creation
8
+ const host = document.createElement('div');
9
+ host.id = 'app-root';
10
+ body.appendChild(host);
11
+ console.log('[Check 1] attachShadow API exists:', typeof host.attachShadow === 'function');
12
+ if (typeof host.attachShadow !== 'function') {
13
+ console.error('❌ HappyDOM does not support attachShadow!');
14
+ return;
15
+ }
16
+ // 2. Closed Mode Isolation
17
+ const shadowRoot = host.attachShadow({ mode: 'closed' });
18
+ console.log('[Check 2] shadowRoot is closed (host.shadowRoot should be null):', host.shadowRoot === null);
19
+ // 3. Render Content inside Shadow
20
+ const innerDiv = document.createElement('div');
21
+ innerDiv.id = 'inner-secret';
22
+ innerDiv.className = 'secret-class';
23
+ shadowRoot.appendChild(innerDiv);
24
+ // 4. Query Isolation Test
25
+ const queriedId = document.getElementById('inner-secret');
26
+ const queriedClass = document.querySelector('.secret-class');
27
+ console.log('[Check 3] Query Isolation (ID):', queriedId === null ? 'Pass' : 'Fail');
28
+ console.log('[Check 4] Query Isolation (Class):', queriedClass === null ? 'Pass' : 'Fail');
29
+ // 5. Event Retargeting Test (Mock Event)
30
+ let eventTargetCorrect = false;
31
+ host.addEventListener('click', (e) => {
32
+ // When clicking inside shadow, target should be retargeted to host
33
+ // HappyDOM might simulate this if we dispatch event on innerDiv
34
+ console.log('[Check 5 Debug] Click target:', e.target.id || e.target.tagName);
35
+ eventTargetCorrect = (e.target === host);
36
+ });
37
+ // Create and dispatch event inside shadow
38
+ const event = new window.MouseEvent('click', { bubbles: true, composed: true });
39
+ innerDiv.dispatchEvent(event);
40
+ console.log('[Check 5] Event Retargeting:', eventTargetCorrect ? 'Pass' : 'Fail');
41
+ window.close();
42
+ }
43
+ checkShadowDOM();
44
+ //# sourceMappingURL=shadow-dom-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadow-dom-check.js","sourceRoot":"","sources":["../../src/benchmarks/shadow-dom-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;AAE5D,KAAK,UAAU,cAAc;IACzB,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAE3B,oBAAoB;IACpB,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC;IACrB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEvB,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,OAAO,IAAI,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC;IAE3F,IAAI,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G,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,0CAA0C;IAC1C,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAChF,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAE9B,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAElF,MAAM,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC;AAED,cAAc,EAAE,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * agentina CLI - Third-Party App Management
4
+ *
5
+ * 命令:
6
+ * agentina add <source> 安装 App
7
+ * agentina remove <name> 卸载 App
8
+ * agentina list 列出已安装
9
+ * agentina enable <name> 启用 App
10
+ * agentina disable <name> 禁用 App
11
+ * agentina autostart <name> <on|off> 设置自动启动
12
+ * agentina link <path> 链接本地开发目录
13
+ * agentina run [name] Run installed apps (or specific app)
14
+ *
15
+ * @module @aotui/cli
16
+ */
17
+ export {};