@elizaos/agent 2.0.3-beta.2 → 2.0.3-beta.3

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 (381) hide show
  1. package/__tests__/view-user-journeys.d.ts.map +1 -1
  2. package/__tests__/view-user-journeys.js +52 -41
  3. package/actions/context-signal.d.ts +2 -2
  4. package/actions/files.d.ts +9 -0
  5. package/actions/files.d.ts.map +1 -0
  6. package/actions/files.js +183 -0
  7. package/actions/index.d.ts +17 -17
  8. package/api/accounts-routes.d.ts +1 -1
  9. package/api/accounts-routes.js +1 -1
  10. package/api/agent-admin-routes.d.ts +1 -1
  11. package/api/agent-admin-routes.js +2 -2
  12. package/api/agent-model.d.ts +1 -1
  13. package/api/agent-status-routes.d.ts +1 -3
  14. package/api/agent-status-routes.d.ts.map +1 -1
  15. package/api/agent-status-routes.js +0 -2
  16. package/api/approval-routes.d.ts +38 -0
  17. package/api/approval-routes.d.ts.map +1 -0
  18. package/api/approval-routes.js +223 -0
  19. package/api/background-routes.d.ts +13 -0
  20. package/api/background-routes.d.ts.map +1 -0
  21. package/api/background-routes.js +91 -0
  22. package/api/binance-skill-helpers.d.ts +2 -2
  23. package/api/binance-skill-helpers.js +2 -2
  24. package/api/builtin-views.d.ts.map +1 -1
  25. package/api/builtin-views.js +44 -4
  26. package/api/character-routes.d.ts +1 -1
  27. package/api/chat-augmentation.d.ts.map +1 -1
  28. package/api/chat-augmentation.js +17 -0
  29. package/api/chat-routes.d.ts +29 -2
  30. package/api/chat-routes.d.ts.map +1 -1
  31. package/api/chat-routes.js +76 -1
  32. package/api/commands-routes.d.ts +10 -8
  33. package/api/commands-routes.d.ts.map +1 -1
  34. package/api/commands-routes.js +17 -59
  35. package/api/config-routes.d.ts +1 -1
  36. package/api/config-routes.d.ts.map +1 -1
  37. package/api/config-routes.js +0 -2
  38. package/api/connector-routes.d.ts +1 -1
  39. package/api/conversation-metadata.d.ts +1 -1
  40. package/api/conversation-metadata.d.ts.map +1 -1
  41. package/api/conversation-metadata.js +0 -1
  42. package/api/conversation-routes.d.ts +4 -3
  43. package/api/conversation-routes.d.ts.map +1 -1
  44. package/api/conversation-routes.js +34 -1
  45. package/api/documents-service-loader.d.ts +0 -4
  46. package/api/documents-service-loader.d.ts.map +1 -1
  47. package/api/documents-service-loader.js +0 -2
  48. package/api/files-routes.d.ts +14 -0
  49. package/api/files-routes.d.ts.map +1 -0
  50. package/api/files-routes.js +47 -0
  51. package/api/first-run-routes.d.ts +1 -1
  52. package/api/health-routes.d.ts +2 -2
  53. package/api/index.d.ts +40 -39
  54. package/api/index.d.ts.map +1 -1
  55. package/api/index.js +1 -0
  56. package/api/interactions-routes.d.ts +33 -0
  57. package/api/interactions-routes.d.ts.map +1 -0
  58. package/api/interactions-routes.js +63 -0
  59. package/api/media-runtime.d.ts +2 -1
  60. package/api/media-runtime.d.ts.map +1 -1
  61. package/api/media-runtime.js +64 -7
  62. package/api/media-store.d.ts +36 -0
  63. package/api/media-store.d.ts.map +1 -1
  64. package/api/media-store.js +141 -2
  65. package/api/memory-bounds.d.ts +0 -1
  66. package/api/memory-bounds.d.ts.map +1 -1
  67. package/api/memory-bounds.js +0 -1
  68. package/api/misc-routes.d.ts +1 -1
  69. package/api/model-provider-helpers.d.ts +2 -2
  70. package/api/model-provider-helpers.js +2 -2
  71. package/api/permissions-routes-extra.d.ts +1 -1
  72. package/api/permissions-routes.d.ts +1 -1
  73. package/api/permissions-routes.d.ts.map +1 -1
  74. package/api/permissions-routes.js +8 -7
  75. package/api/plugin-discovery-helpers.d.ts +5 -6
  76. package/api/plugin-discovery-helpers.d.ts.map +1 -1
  77. package/api/plugin-discovery-helpers.js +3 -4
  78. package/api/plugin-runtime-apply.d.ts +2 -2
  79. package/api/plugin-runtime-apply.d.ts.map +1 -1
  80. package/api/plugin-runtime-apply.js +74 -0
  81. package/api/provider-switch-config.d.ts +1 -1
  82. package/api/provider-switch-routes.d.ts +2 -2
  83. package/api/registry-routes.d.ts +1 -1
  84. package/api/registry-service.d.ts +1 -1
  85. package/api/remote-capability-routes.d.ts +2 -2
  86. package/api/remote-capability-routes.d.ts.map +1 -1
  87. package/api/remote-capability-routes.js +19 -0
  88. package/api/server-autonomy-helpers.d.ts +2 -2
  89. package/api/server-helpers-auth.d.ts +10 -0
  90. package/api/server-helpers-auth.d.ts.map +1 -1
  91. package/api/server-helpers-auth.js +16 -210
  92. package/api/server-helpers-config.d.ts +1 -1
  93. package/api/server-helpers-mcp.d.ts +2 -2
  94. package/api/server-helpers-plugin.d.ts +1 -1
  95. package/api/server-helpers-swarm.d.ts +3 -3
  96. package/api/server-helpers-swarm.d.ts.map +1 -1
  97. package/api/server-helpers-swarm.js +15 -5
  98. package/api/server-helpers-wallet.d.ts +1 -1
  99. package/api/server-helpers.d.ts +4 -4
  100. package/api/server-lazy-routes.d.ts +40 -38
  101. package/api/server-lazy-routes.d.ts.map +1 -1
  102. package/api/server-lazy-routes.js +7 -0
  103. package/api/server-route-dispatch.d.ts +2 -2
  104. package/api/server-route-dispatch.d.ts.map +1 -1
  105. package/api/server-route-dispatch.js +7 -0
  106. package/api/server-types.d.ts +9 -7
  107. package/api/server-types.d.ts.map +1 -1
  108. package/api/server.d.ts +19 -19
  109. package/api/server.d.ts.map +1 -1
  110. package/api/server.js +111 -17
  111. package/api/static-file-server.d.ts +2 -2
  112. package/api/static-file-server.js +2 -2
  113. package/api/subscription-routes.d.ts +4 -4
  114. package/api/subscription-routes.js +3 -4
  115. package/api/suggestions-routes.d.ts +1 -1
  116. package/api/suggestions-routes.d.ts.map +1 -1
  117. package/api/suggestions-routes.js +2 -3
  118. package/api/terminal-execution-routing.d.ts +1 -1
  119. package/api/training-service-like.d.ts +1 -1
  120. package/api/trajectory-fallback-routes.d.ts.map +1 -1
  121. package/api/trajectory-fallback-routes.js +21 -1
  122. package/api/update-routes.d.ts +1 -1
  123. package/api/view-registry-types.d.ts +1 -1
  124. package/api/views-registry.d.ts +14 -4
  125. package/api/views-registry.d.ts.map +1 -1
  126. package/api/views-registry.js +50 -26
  127. package/api/views-routes.d.ts +1 -1
  128. package/api/views-routes.d.ts.map +1 -1
  129. package/api/views-routes.js +131 -14
  130. package/api/views-search-index.d.ts +1 -1
  131. package/api/wallet-capability.d.ts +3 -3
  132. package/api/wallet-rpc.d.ts +1 -1
  133. package/api/wallet.d.ts +3 -3
  134. package/api/wallet.d.ts.map +1 -1
  135. package/api/wallet.js +4 -3
  136. package/api/workbench-context.d.ts +1 -1
  137. package/api/workbench-helpers.d.ts +3 -3
  138. package/api/workbench-helpers.js +3 -3
  139. package/api/workbench-routes.d.ts +2 -2
  140. package/api/workbench-vfs-routes.d.ts +1 -1
  141. package/api/ws-event-replay.d.ts +1 -2
  142. package/api/ws-event-replay.d.ts.map +1 -1
  143. package/api/ws-event-replay.js +1 -2
  144. package/api/x-relay-routes.d.ts +2 -2
  145. package/api/x402-route-validation.d.ts +4 -0
  146. package/api/x402-route-validation.d.ts.map +1 -0
  147. package/api/x402-route-validation.js +6 -0
  148. package/assets/view-heroes/background.png +0 -0
  149. package/auth/account-storage.d.ts +1 -1
  150. package/auth/anthropic.d.ts +1 -1
  151. package/auth/credentials.d.ts +2 -2
  152. package/auth/index.d.ts +7 -7
  153. package/auth/oauth-flow.d.ts +2 -2
  154. package/auth/openai-codex.d.ts +1 -1
  155. package/awareness/index.d.ts +1 -1
  156. package/config/config.js +0 -1
  157. package/config/env-vars.d.ts +1 -1
  158. package/config/env-vars.d.ts.map +1 -1
  159. package/config/env-vars.js +0 -1
  160. package/config/index.d.ts +10 -10
  161. package/config/model-metadata.d.ts +1 -1
  162. package/config/owner-contacts.d.ts +1 -1
  163. package/config/schema.d.ts +1 -1
  164. package/hooks/discovery.d.ts +1 -1
  165. package/hooks/eligibility.d.ts +2 -2
  166. package/hooks/index.d.ts +2 -2
  167. package/hooks/loader.d.ts +2 -2
  168. package/hooks/registry.d.ts +1 -1
  169. package/index.d.ts +87 -85
  170. package/index.d.ts.map +1 -1
  171. package/index.js +11 -3
  172. package/package.json +54 -44
  173. package/providers/media-provider.d.ts +1 -1
  174. package/providers/page-scoped-context.d.ts.map +1 -1
  175. package/providers/page-scoped-context.js +1 -70
  176. package/providers/relevant-conversations.d.ts.map +1 -1
  177. package/providers/relevant-conversations.js +8 -9
  178. package/providers/workspace.d.ts +1 -1
  179. package/runtime/actions/web-fetch.d.ts.map +1 -1
  180. package/runtime/actions/web-fetch.js +23 -3
  181. package/runtime/actions/web-search.d.ts +32 -0
  182. package/runtime/actions/web-search.d.ts.map +1 -0
  183. package/runtime/actions/web-search.js +245 -0
  184. package/runtime/advanced-capabilities-config.d.ts +1 -1
  185. package/runtime/boot-telemetry.d.ts +1 -1
  186. package/runtime/conversation-compactor-runtime.d.ts +1 -1
  187. package/runtime/conversation-compactor-runtime.js +1 -1
  188. package/runtime/conversation-compactor.d.ts +1 -1
  189. package/runtime/core-plugins.d.ts.map +1 -1
  190. package/runtime/core-plugins.js +9 -0
  191. package/runtime/custom-actions.d.ts +18 -9
  192. package/runtime/custom-actions.d.ts.map +1 -1
  193. package/runtime/custom-actions.js +85 -23
  194. package/runtime/eliza-plugin.d.ts.map +1 -1
  195. package/runtime/eliza-plugin.js +15 -1
  196. package/runtime/eliza.d.ts +9 -7
  197. package/runtime/eliza.d.ts.map +1 -1
  198. package/runtime/eliza.js +86 -23
  199. package/runtime/first-time-setup.d.ts +1 -3
  200. package/runtime/first-time-setup.d.ts.map +1 -1
  201. package/runtime/first-time-setup.js +0 -2
  202. package/runtime/index.d.ts +18 -18
  203. package/runtime/load-plugin-from-vfs.d.ts +2 -2
  204. package/runtime/mobile-dns.d.ts.map +1 -1
  205. package/runtime/mobile-dns.js +2 -5
  206. package/runtime/operations/classifier.d.ts +1 -1
  207. package/runtime/operations/cold-strategy.d.ts +1 -1
  208. package/runtime/operations/health-checks.d.ts +1 -1
  209. package/runtime/operations/health.d.ts +1 -1
  210. package/runtime/operations/index.d.ts +10 -10
  211. package/runtime/operations/manager.d.ts +3 -3
  212. package/runtime/operations/reload-hot.d.ts +1 -1
  213. package/runtime/operations/repository.d.ts +1 -1
  214. package/runtime/operations/vault-bridge.d.ts +1 -1
  215. package/runtime/plugin-collector.d.ts +6 -1
  216. package/runtime/plugin-collector.d.ts.map +1 -1
  217. package/runtime/plugin-collector.js +11 -28
  218. package/runtime/plugin-lifecycle.d.ts.map +1 -1
  219. package/runtime/plugin-lifecycle.js +1 -0
  220. package/runtime/plugin-resolver.d.ts +2 -2
  221. package/runtime/plugin-resolver.d.ts.map +1 -1
  222. package/runtime/plugin-resolver.js +113 -65
  223. package/runtime/plugin-types.d.ts +1 -1
  224. package/runtime/prompt-optimization.d.ts +4 -4
  225. package/runtime/remote-coding-runner-gate.d.ts +7 -0
  226. package/runtime/remote-coding-runner-gate.d.ts.map +1 -0
  227. package/runtime/remote-coding-runner-gate.js +36 -0
  228. package/runtime/roles/src/index.d.ts +4 -4
  229. package/runtime/roles.d.ts +2 -2
  230. package/runtime/sandbox-character.d.ts +1 -1
  231. package/runtime/tool-call-cache/cache.d.ts +1 -1
  232. package/runtime/tool-call-cache/disk-store.d.ts +1 -1
  233. package/runtime/tool-call-cache/index.d.ts +6 -6
  234. package/runtime/tool-call-cache/key.d.ts +1 -1
  235. package/runtime/tool-call-cache/redact.d.ts +1 -1
  236. package/runtime/tool-call-cache/registry.d.ts +1 -1
  237. package/runtime/tool-call-cache-wrapper.d.ts +7 -9
  238. package/runtime/tool-call-cache-wrapper.d.ts.map +1 -1
  239. package/runtime/tool-call-cache-wrapper.js +6 -11
  240. package/runtime/trajectory-export.d.ts +3 -3
  241. package/runtime/trajectory-internals.d.ts +2 -1
  242. package/runtime/trajectory-internals.d.ts.map +1 -1
  243. package/runtime/trajectory-persistence.d.ts +5 -5
  244. package/runtime/trajectory-steps-reader.d.ts +1 -1
  245. package/runtime/trajectory-steps-writer.d.ts +1 -1
  246. package/runtime/trajectory-storage.d.ts +4 -4
  247. package/runtime/view-action-affinity.d.ts +18 -15
  248. package/runtime/view-action-affinity.d.ts.map +1 -1
  249. package/runtime/view-action-affinity.js +26 -29
  250. package/runtime/web-search-tools.d.ts +4 -1
  251. package/runtime/web-search-tools.d.ts.map +1 -1
  252. package/runtime/web-search-tools.js +37 -9
  253. package/security/index.d.ts +3 -3
  254. package/services/approval/index.d.ts +9 -0
  255. package/services/approval/index.d.ts.map +1 -0
  256. package/services/approval/index.js +8 -0
  257. package/services/approval/service.d.ts +35 -0
  258. package/services/approval/service.d.ts.map +1 -0
  259. package/services/approval/service.js +40 -0
  260. package/services/approval/sql.d.ts +18 -0
  261. package/services/approval/sql.d.ts.map +1 -0
  262. package/services/approval/sql.js +104 -0
  263. package/services/approval/store.d.ts +39 -0
  264. package/services/approval/store.d.ts.map +1 -0
  265. package/services/approval/store.js +534 -0
  266. package/services/approval/types.d.ts +207 -0
  267. package/services/approval/types.d.ts.map +1 -0
  268. package/services/approval/types.js +34 -0
  269. package/services/character-persistence.d.ts +2 -2
  270. package/services/client-chat-sender.d.ts +1 -1
  271. package/services/config-plugin-manager.d.ts +2 -2
  272. package/services/connector-setup-service.d.ts +1 -1
  273. package/services/cove-quote-x509.d.ts +1 -1
  274. package/services/cove-quote.d.ts +2 -2
  275. package/services/dstack-tee-provider.d.ts +1 -1
  276. package/services/file-storage.d.ts +20 -0
  277. package/services/file-storage.d.ts.map +1 -0
  278. package/services/file-storage.js +70 -0
  279. package/services/global-pause/index.d.ts +8 -0
  280. package/services/global-pause/index.d.ts.map +1 -0
  281. package/services/global-pause/index.js +7 -0
  282. package/services/global-pause/service.d.ts +29 -0
  283. package/services/global-pause/service.d.ts.map +1 -0
  284. package/services/global-pause/service.js +34 -0
  285. package/services/global-pause/store.d.ts +31 -0
  286. package/services/global-pause/store.d.ts.map +1 -0
  287. package/services/global-pause/store.js +83 -0
  288. package/services/handoff/index.d.ts +8 -0
  289. package/services/handoff/index.d.ts.map +1 -0
  290. package/services/handoff/index.js +7 -0
  291. package/services/handoff/service.d.ts +29 -0
  292. package/services/handoff/service.d.ts.map +1 -0
  293. package/services/handoff/service.js +34 -0
  294. package/services/handoff/store.d.ts +76 -0
  295. package/services/handoff/store.d.ts.map +1 -0
  296. package/services/handoff/store.js +148 -0
  297. package/services/index.d.ts +30 -31
  298. package/services/index.d.ts.map +1 -1
  299. package/services/index.js +0 -6
  300. package/services/js-runtime-bridge.d.ts.map +1 -1
  301. package/services/js-runtime-bridge.js +8 -2
  302. package/services/knowledge-graph/index.d.ts +4 -4
  303. package/services/knowledge-graph/service.d.ts +2 -2
  304. package/services/pending-prompts/index.d.ts +8 -0
  305. package/services/pending-prompts/index.d.ts.map +1 -0
  306. package/services/pending-prompts/index.js +7 -0
  307. package/services/pending-prompts/service.d.ts +34 -0
  308. package/services/pending-prompts/service.d.ts.map +1 -0
  309. package/services/pending-prompts/service.js +68 -0
  310. package/services/pending-prompts/store.d.ts +70 -0
  311. package/services/pending-prompts/store.d.ts.map +1 -0
  312. package/services/pending-prompts/store.js +191 -0
  313. package/services/plugin-compiler.d.ts +1 -1
  314. package/services/plugin-installer.d.ts.map +1 -1
  315. package/services/plugin-installer.js +21 -11
  316. package/services/plugin-manager-types.d.ts +1 -1
  317. package/services/proactive-interaction-decider.d.ts +62 -11
  318. package/services/proactive-interaction-decider.d.ts.map +1 -1
  319. package/services/proactive-interaction-decider.js +223 -35
  320. package/services/push/apns-provider.d.ts +1 -1
  321. package/services/push/fcm-provider.d.ts +1 -1
  322. package/services/push/notification-push-service.d.ts +2 -2
  323. package/services/registry-client-app-meta.d.ts +1 -1
  324. package/services/registry-client-endpoints.d.ts +2 -2
  325. package/services/registry-client-local.d.ts +1 -1
  326. package/services/registry-client-network.d.ts +1 -1
  327. package/services/registry-client-queries.d.ts +1 -1
  328. package/services/registry-client.d.ts +3 -3
  329. package/services/relationships-graph.d.ts +1 -1
  330. package/services/remote-capability-cloud-sandbox.d.ts +3 -3
  331. package/services/remote-capability-endpoint-conformance.d.ts +1 -1
  332. package/services/remote-capability-endpoint-provider.d.ts +4 -4
  333. package/services/remote-capability-url-endpoint-providers.d.ts +1 -1
  334. package/services/remote-plugin-adapter.d.ts.map +1 -1
  335. package/services/remote-plugin-adapter.js +3 -0
  336. package/services/remote-plugin-bridge.d.ts.map +1 -1
  337. package/services/remote-plugin-bridge.js +97 -26
  338. package/services/remote-signing-service.d.ts +4 -4
  339. package/services/research-task-executor.d.ts +1 -1
  340. package/services/sandbox-manager.d.ts +1 -1
  341. package/services/self-updater.d.ts +1 -1
  342. package/services/self-updater.d.ts.map +1 -1
  343. package/services/self-updater.js +23 -9
  344. package/services/shell-execution-router.d.ts +1 -1
  345. package/services/shell-execution-router.d.ts.map +1 -1
  346. package/services/shell-execution-router.js +19 -2
  347. package/services/tee-boot-gate-state.d.ts +1 -1
  348. package/services/tee-boot-gate.d.ts +4 -4
  349. package/services/tee-confidential-inference.d.ts +3 -3
  350. package/services/tee-key-release.d.ts +2 -2
  351. package/services/tee-model-key-boot.d.ts +4 -4
  352. package/services/tee-policy.d.ts +1 -1
  353. package/services/tee-production-profile.d.ts +1 -1
  354. package/services/tee-release-policy.d.ts +1 -1
  355. package/services/tee-revocation.d.ts +2 -2
  356. package/services/tee-runtime-config.d.ts +1 -1
  357. package/services/tee-sealed-volume.d.ts +3 -3
  358. package/services/tee-signer-backend.d.ts +3 -3
  359. package/services/update-checker.d.ts +1 -1
  360. package/services/vault-signer-backend.d.ts +1 -1
  361. package/services/vfs-git.d.ts +1 -1
  362. package/test-support/index.d.ts +3 -3
  363. package/triggers/runtime.d.ts +1 -1
  364. package/triggers/scheduling.d.ts +3 -22
  365. package/triggers/scheduling.d.ts.map +1 -1
  366. package/triggers/scheduling.js +2 -214
  367. package/tui/agent-terminal-tui.d.ts.map +1 -1
  368. package/tui/agent-terminal-tui.js +174 -72
  369. package/types/index.d.ts +3 -3
  370. package/api/nfa-routes.d.ts +0 -6
  371. package/api/nfa-routes.d.ts.map +0 -1
  372. package/api/nfa-routes.js +0 -125
  373. package/api/server-auth.d.ts +0 -46
  374. package/api/server-auth.d.ts.map +0 -1
  375. package/api/server-auth.js +0 -504
  376. package/runtime/restart.d.ts +0 -9
  377. package/runtime/restart.d.ts.map +0 -1
  378. package/runtime/restart.js +0 -8
  379. package/test-utils/sqlite-compat.d.ts +0 -23
  380. package/test-utils/sqlite-compat.d.ts.map +0 -1
  381. package/test-utils/sqlite-compat.js +0 -214
@@ -1,222 +1,10 @@
1
+ import { computeNextCronRunAtMs, DISABLED_TRIGGER_INTERVAL_MS, MAX_TRIGGER_INTERVAL_MS, MIN_TRIGGER_INTERVAL_MS, normalizeTriggerIntervalMs, parseCronExpression, parseScheduledAtIso, resolveTriggerTiming, } from "@elizaos/core";
1
2
  import { TRIGGER_SCHEMA_VERSION, } from "./types.js";
2
- export const MIN_TRIGGER_INTERVAL_MS = 60_000;
3
- export const MAX_TRIGGER_INTERVAL_MS = 31 * 24 * 60 * 60 * 1000;
4
- export const DISABLED_TRIGGER_INTERVAL_MS = 365 * 24 * 60 * 60 * 1000;
3
+ export { computeNextCronRunAtMs, DISABLED_TRIGGER_INTERVAL_MS, MAX_TRIGGER_INTERVAL_MS, MIN_TRIGGER_INTERVAL_MS, normalizeTriggerIntervalMs, parseCronExpression, parseScheduledAtIso, resolveTriggerTiming, };
5
4
  export const MAX_TRIGGER_RUN_HISTORY = 100;
6
- const CRON_FIELDS = 5;
7
- const CRON_SCAN_WINDOW_MS = 366 * 24 * 60 * 60 * 1000;
8
- const CRON_MINUTE_MS = 60_000;
9
- const CRON_RANGES = [
10
- { min: 0, max: 59 },
11
- { min: 0, max: 23 },
12
- { min: 1, max: 31 },
13
- { min: 1, max: 12 },
14
- { min: 0, max: 6 },
15
- ];
16
- function parseInteger(raw) {
17
- if (!/^-?\d+$/.test(raw))
18
- return null;
19
- const value = Number(raw);
20
- if (!Number.isFinite(value))
21
- return null;
22
- return value;
23
- }
24
- function clamp(value, min, max) {
25
- if (value < min)
26
- return min;
27
- if (value > max)
28
- return max;
29
- return value;
30
- }
31
5
  export function normalizeText(value) {
32
6
  return value.trim().replace(/\s+/g, " ");
33
7
  }
34
- function parseCronPart(part, range) {
35
- const output = new Set();
36
- const chunks = part.split(",");
37
- for (const chunkRaw of chunks) {
38
- const chunk = chunkRaw.trim();
39
- if (!chunk)
40
- return null;
41
- const [baseRaw, stepRaw, extraStep] = chunk.split("/");
42
- if (baseRaw === undefined || extraStep !== undefined)
43
- return null;
44
- const step = stepRaw === undefined ? 1 : parseInteger(stepRaw.trim());
45
- if (step === null || step <= 0)
46
- return null;
47
- const base = baseRaw.trim();
48
- if (base === "*") {
49
- for (let value = range.min; value <= range.max; value += step) {
50
- output.add(value);
51
- }
52
- continue;
53
- }
54
- const [rangeStartRaw, rangeEndRaw, extraRange] = base.split("-");
55
- if (rangeStartRaw === undefined || extraRange !== undefined)
56
- return null;
57
- if (rangeEndRaw === undefined) {
58
- const single = parseInteger(rangeStartRaw.trim());
59
- if (single === null)
60
- return null;
61
- if (single < range.min || single > range.max)
62
- return null;
63
- output.add(single);
64
- continue;
65
- }
66
- const start = parseInteger(rangeStartRaw.trim());
67
- const end = parseInteger(rangeEndRaw.trim());
68
- if (start === null || end === null)
69
- return null;
70
- if (start > end)
71
- return null;
72
- if (start < range.min || end > range.max)
73
- return null;
74
- for (let value = start; value <= end; value += step) {
75
- output.add(value);
76
- }
77
- }
78
- return output.size > 0 ? output : null;
79
- }
80
- export function parseCronExpression(expression) {
81
- const trimmed = expression.trim();
82
- if (!trimmed)
83
- return null;
84
- const parts = trimmed.split(/\s+/);
85
- if (parts.length !== CRON_FIELDS)
86
- return null;
87
- const [minuteExpr, hourExpr, dayOfMonthExpr, monthExpr, dayOfWeekExpr] = parts;
88
- if (minuteExpr === undefined ||
89
- hourExpr === undefined ||
90
- dayOfMonthExpr === undefined ||
91
- monthExpr === undefined ||
92
- dayOfWeekExpr === undefined) {
93
- return null;
94
- }
95
- const minute = parseCronPart(minuteExpr, CRON_RANGES[0]);
96
- const hour = parseCronPart(hourExpr, CRON_RANGES[1]);
97
- const dayOfMonth = parseCronPart(dayOfMonthExpr, CRON_RANGES[2]);
98
- const month = parseCronPart(monthExpr, CRON_RANGES[3]);
99
- const dayOfWeek = parseCronPart(dayOfWeekExpr, CRON_RANGES[4]);
100
- if (!minute || !hour || !dayOfMonth || !month || !dayOfWeek) {
101
- return null;
102
- }
103
- return {
104
- minute,
105
- hour,
106
- dayOfMonth,
107
- month,
108
- dayOfWeek,
109
- };
110
- }
111
- function cronMatchesUTC(schedule, candidateMs) {
112
- const candidate = new Date(candidateMs);
113
- return (schedule.minute.has(candidate.getUTCMinutes()) &&
114
- schedule.hour.has(candidate.getUTCHours()) &&
115
- schedule.dayOfMonth.has(candidate.getUTCDate()) &&
116
- schedule.month.has(candidate.getUTCMonth() + 1) &&
117
- schedule.dayOfWeek.has(candidate.getUTCDay()));
118
- }
119
- function getTimezoneOffsetMs(timezone, atMs) {
120
- if (!timezone || timezone === "UTC")
121
- return 0;
122
- try {
123
- const formatter = new Intl.DateTimeFormat("en-US", {
124
- timeZone: timezone,
125
- year: "numeric",
126
- month: "2-digit",
127
- day: "2-digit",
128
- hour: "2-digit",
129
- minute: "2-digit",
130
- second: "2-digit",
131
- hour12: false,
132
- });
133
- const parts = formatter.formatToParts(new Date(atMs));
134
- const get = (type) => {
135
- const part = parts.find((p) => p.type === type);
136
- return part ? Number(part.value) : 0;
137
- };
138
- const tzDate = Date.UTC(get("year"), get("month") - 1, get("day"), get("hour"), get("minute"), get("second"));
139
- return tzDate - atMs;
140
- }
141
- catch {
142
- return 0;
143
- }
144
- }
145
- function cronMatches(schedule, candidateMs, timezone) {
146
- if (!timezone || timezone === "UTC") {
147
- return cronMatchesUTC(schedule, candidateMs);
148
- }
149
- const offsetMs = getTimezoneOffsetMs(timezone, candidateMs);
150
- const wallClockMs = candidateMs + offsetMs;
151
- return cronMatchesUTC(schedule, wallClockMs);
152
- }
153
- export function computeNextCronRunAtMs(expression, fromMs, timezone) {
154
- const schedule = parseCronExpression(expression);
155
- if (!schedule)
156
- return null;
157
- const start = Math.floor(fromMs / CRON_MINUTE_MS) * CRON_MINUTE_MS;
158
- const cutoff = start + CRON_SCAN_WINDOW_MS;
159
- for (let candidate = start + CRON_MINUTE_MS; candidate <= cutoff; candidate += CRON_MINUTE_MS) {
160
- if (cronMatches(schedule, candidate, timezone)) {
161
- return candidate;
162
- }
163
- }
164
- return null;
165
- }
166
- export function parseScheduledAtIso(scheduledAtIso) {
167
- const parsed = Date.parse(scheduledAtIso);
168
- if (!Number.isFinite(parsed))
169
- return null;
170
- return parsed;
171
- }
172
- export function normalizeTriggerIntervalMs(intervalMs) {
173
- if (!Number.isFinite(intervalMs))
174
- return MIN_TRIGGER_INTERVAL_MS;
175
- const rounded = Math.floor(intervalMs);
176
- return clamp(rounded, MIN_TRIGGER_INTERVAL_MS, MAX_TRIGGER_INTERVAL_MS);
177
- }
178
- export function resolveTriggerTiming(trigger, nowMs) {
179
- if (!trigger.enabled)
180
- return null;
181
- if (trigger.triggerType === "interval") {
182
- const intervalMs = normalizeTriggerIntervalMs(trigger.intervalMs ?? 0);
183
- return {
184
- updatedAt: nowMs,
185
- updateIntervalMs: intervalMs,
186
- nextRunAtMs: nowMs + intervalMs,
187
- };
188
- }
189
- if (trigger.triggerType === "once") {
190
- const scheduledAt = trigger.scheduledAtIso
191
- ? parseScheduledAtIso(trigger.scheduledAtIso)
192
- : null;
193
- if (scheduledAt === null)
194
- return null;
195
- const nextRunAtMs = Math.max(nowMs, scheduledAt);
196
- return {
197
- updatedAt: nowMs,
198
- updateIntervalMs: Math.max(0, nextRunAtMs - nowMs),
199
- nextRunAtMs,
200
- };
201
- }
202
- if (trigger.triggerType === "event") {
203
- return {
204
- updatedAt: nowMs,
205
- updateIntervalMs: DISABLED_TRIGGER_INTERVAL_MS,
206
- nextRunAtMs: nowMs + DISABLED_TRIGGER_INTERVAL_MS,
207
- };
208
- }
209
- const nextRunAtMs = trigger.cronExpression
210
- ? computeNextCronRunAtMs(trigger.cronExpression, nowMs, trigger.timezone)
211
- : null;
212
- if (nextRunAtMs === null)
213
- return null;
214
- return {
215
- updatedAt: nowMs,
216
- updateIntervalMs: Math.max(0, nextRunAtMs - nowMs),
217
- nextRunAtMs,
218
- };
219
- }
220
8
  export function buildTriggerMetadata(params) {
221
9
  const timing = resolveTriggerTiming(params.trigger, params.nowMs);
222
10
  if (!timing)
@@ -1 +1 @@
1
- {"version":3,"file":"agent-terminal-tui.d.ts","sourceRoot":"","sources":["../../src/tui/agent-terminal-tui.ts"],"names":[],"mappings":"AAKA,OAAO,EAYL,KAAK,QAAQ,EAGd,MAAM,cAAc,CAAC;AAiBtB,UAAU,uBAAuB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAqbD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB;AAED,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,uBAA4B,GACpC,sBAAsB,GAAG,IAAI,CA2B/B"}
1
+ {"version":3,"file":"agent-terminal-tui.d.ts","sourceRoot":"","sources":["../../src/tui/agent-terminal-tui.ts"],"names":[],"mappings":"AAKA,OAAO,EAaL,KAAK,QAAQ,EAGd,MAAM,cAAc,CAAC;AAiBtB,UAAU,uBAAuB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAoiBD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB;AAED,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,uBAA4B,GACpC,sBAAsB,GAAG,IAAI,CA2B/B"}
@@ -1,5 +1,5 @@
1
1
  import { resolveApiBindHost, resolveDesktopApiPort, resolveServerOnlyPort, } from "@elizaos/shared";
2
- import { ansi, CombinedAutocompleteProvider, darkTheme, Editor, getTerminalView, hasTerminalView, ProcessTerminal, SelectList, TUI, truncateToWidth, } from "@elizaos/tui";
2
+ import { ansi, CombinedAutocompleteProvider, darkTheme, Editor, getTerminalView, getTerminalViewFactory, hasTerminalView, ProcessTerminal, SelectList, TUI, truncateToWidth, } from "@elizaos/tui";
3
3
  import { matchSlashInput, resolveSlashDispatch, toSlashCommands, } from "./slash-commands.js";
4
4
  import { isTerminalTuiEnabled } from "./tui-enabled.js";
5
5
  const selectTheme = {
@@ -34,6 +34,20 @@ async function readJson(fetchImpl, apiBaseUrl, path, init) {
34
34
  }
35
35
  return (await response.json());
36
36
  }
37
+ /**
38
+ * The persistent shell layout: a mounted spatial-view block on top with a
39
+ * fixed chat composer pinned to the bottom rows, both always visible.
40
+ *
41
+ * Mode collapses to where the *view block* is: the default `list` (registered
42
+ * tui views to pick from), `view` (a mounted spatial/registered view rendering
43
+ * inline), or `search` (filter the list). Chat is never a mode — the composer
44
+ * is always rendered last.
45
+ *
46
+ * Focus has two targets: `view` routes Tab/arrows/Enter to the mounted view's
47
+ * controls (and the top-level keybindings `/ r 1-9 q`), while `composer` sends
48
+ * every printable char + Enter to the chat input. Ctrl+L toggles between them;
49
+ * Esc from the composer returns focus to the view block.
50
+ */
37
51
  class AgentTerminalView {
38
52
  tui;
39
53
  apiBaseUrl;
@@ -42,9 +56,11 @@ class AgentTerminalView {
42
56
  views = [];
43
57
  selectedView = null;
44
58
  status = "starting terminal tui";
45
- mode = "views";
46
- /** The registered terminal view rendered inline in `detail` mode. */
47
- detailView = null;
59
+ mode = "list";
60
+ /** The registered terminal view rendered inline in `view` mode. */
61
+ mountedView = null;
62
+ /** Which surface receives keyboard input: the view block or the composer. */
63
+ focusTarget = "composer";
48
64
  searchQuery = "";
49
65
  viewList = new SelectList([], 12, selectTheme);
50
66
  chatInput;
@@ -57,6 +73,8 @@ class AgentTerminalView {
57
73
  this.fetchImpl = fetchImpl;
58
74
  this.onExit = onExit;
59
75
  this.chatInput = new Editor(tui, editorTheme, { paddingX: 0 });
76
+ // The composer owns input by default so a user can type immediately.
77
+ this.chatInput.focused = true;
60
78
  this.viewList.onSelect = (item) => {
61
79
  const view = this.views.find((candidate) => candidate.id === item.value);
62
80
  if (view)
@@ -120,15 +138,15 @@ class AgentTerminalView {
120
138
  this.tui.requestRender();
121
139
  }
122
140
  }
123
- render(width) {
124
- if (this.mode === "detail" && this.detailView) {
141
+ /** Lines for the view block (everything above the pinned composer). */
142
+ renderViewBlock(width) {
143
+ if (this.mode === "view" && this.mountedView) {
125
144
  const header = [
126
145
  ansi.bold(`elizaOS terminal tui · ${this.selectedView?.label ?? "view"}`),
127
- ansi.dim("esc/q returns to views · this is the live view render"),
146
+ ansi.dim(`${this.focusTarget === "view" ? "tab/↑↓ focus · enter activates" : "ctrl+l focuses the view"} · esc/q closes`),
128
147
  "",
129
148
  ];
130
- const body = this.detailView.render(width);
131
- return [...header, ...body].map((line) => truncateToWidth(line, width));
149
+ return [...header, ...this.mountedView.render(width)];
132
150
  }
133
151
  const selected = this.selectedView
134
152
  ? `${this.selectedView.label} (${this.selectedView.path ?? this.selectedView.id})`
@@ -139,51 +157,84 @@ class AgentTerminalView {
139
157
  `status: ${this.status}`,
140
158
  `selected: ${selected}`,
141
159
  "",
142
- "shortcuts: ↑/↓ select enter open 1-9 quick-open r refresh / search c chat q quit",
143
- "chat: type after pressing c, enter sends, esc returns to views",
160
+ "shortcuts: ↑/↓ select enter open 1-9 quick-open r refresh / search ctrl+l focus q quit",
144
161
  "",
145
162
  ];
146
- if (this.mode === "chat") {
147
- const hint = this.commands.length > 0
148
- ? ansi.dim("type / for commands · enter sends · esc returns to views")
149
- : ansi.dim("enter sends · esc returns to views");
150
- lines.push(ansi.cyan("chat composer"), this.lastChatLine, hint, "");
151
- lines.push(...this.chatInput.render(width));
152
- // Guard every line to the terminal width — the TUI render loop throws on
153
- // any overflow (e.g. the shortcuts line on an 80-col terminal).
154
- return lines.map((line) => truncateToWidth(line, width));
155
- }
156
163
  if (this.mode === "search") {
157
164
  lines.push(ansi.cyan("search views"), `filter: ${this.searchQuery || ansi.dim("(type to filter)")}`, ansi.dim("enter opens highlighted view; esc clears search"), "");
158
165
  }
159
166
  lines.push(ansi.cyan("registered tui views"));
160
167
  lines.push(...this.viewList.render(width));
161
- return lines.map((line) => truncateToWidth(line, width));
168
+ return lines;
169
+ }
170
+ /** The chat composer block, always pinned to the bottom rows. */
171
+ renderComposer(width) {
172
+ const focusedComposer = this.focusTarget === "composer";
173
+ const hint = this.commands.length > 0
174
+ ? "type / for commands · enter sends · ctrl+l focuses the view"
175
+ : "enter sends · ctrl+l focuses the view";
176
+ const label = focusedComposer
177
+ ? ansi.cyan("chat")
178
+ : ansi.dim("chat (ctrl+l to type)");
179
+ return [
180
+ ansi.dim("─".repeat(Math.max(1, width))),
181
+ label,
182
+ this.lastChatLine,
183
+ ansi.dim(hint),
184
+ ...this.chatInput.render(width),
185
+ ];
186
+ }
187
+ render(width) {
188
+ const composer = this.renderComposer(width);
189
+ // Reserve the bottom rows for the composer; the view block fills the rest of
190
+ // the visible viewport so the composer is pinned to the last rows. Falls
191
+ // back to a generous default height when the terminal size is unknown.
192
+ const height = this.tui.terminal.rows || 24;
193
+ const viewHeight = Math.max(1, height - composer.length);
194
+ let viewBlock = this.renderViewBlock(width);
195
+ if (viewBlock.length > viewHeight) {
196
+ // Keep the most recent / focused content visible by trimming the top.
197
+ viewBlock = viewBlock.slice(viewBlock.length - viewHeight);
198
+ }
199
+ else {
200
+ while (viewBlock.length < viewHeight)
201
+ viewBlock.push("");
202
+ }
203
+ return [...viewBlock, ...composer].map((line) => truncateToWidth(line, width));
162
204
  }
163
205
  handleInput(data) {
164
- if (this.mode === "detail") {
165
- // Esc / q / Ctrl+C return to the view list; everything else drives the
166
- // inline view so it stays interactive.
167
- if (data === "" || data === "q" || data === "") {
168
- this.mode = "views";
169
- this.detailView = null;
170
- this.status = `${this.views.length} tui views ready`;
171
- this.tui.requestRender();
172
- return;
173
- }
174
- this.detailView?.handleInput?.(data);
175
- this.tui.requestRender();
206
+ // Ctrl+L toggles which surface owns the keyboard (view block <-> composer).
207
+ if (data === " ") {
208
+ this.setFocus(this.focusTarget === "composer" ? "view" : "composer");
176
209
  return;
177
210
  }
178
- if (this.mode === "chat") {
179
- this.handleChatInput(data);
211
+ // Ctrl+C always exits the whole TUI regardless of focus.
212
+ if (data === "") {
213
+ this.onExit?.();
214
+ return;
215
+ }
216
+ if (this.focusTarget === "composer") {
217
+ this.handleComposerInput(data);
180
218
  return;
181
219
  }
220
+ // -- view-focused: top-level keybindings + the mounted view / list --------
182
221
  if (this.mode === "search") {
183
222
  this.handleSearchInput(data);
184
223
  return;
185
224
  }
186
- if (data === "\u0003" || data === "q") {
225
+ if (this.mode === "view" && this.mountedView) {
226
+ // Esc / q close the mounted view back to the list; everything else drives
227
+ // the inline view so it stays interactive (tab/arrows/enter activate).
228
+ if (data === "" || data === "q") {
229
+ this.closeMountedView();
230
+ return;
231
+ }
232
+ this.mountedView.handleInput?.(data);
233
+ this.tui.requestRender();
234
+ return;
235
+ }
236
+ // List mode, view-focused.
237
+ if (data === "q") {
187
238
  this.onExit?.();
188
239
  return;
189
240
  }
@@ -191,13 +242,9 @@ class AgentTerminalView {
191
242
  void this.refreshViews();
192
243
  return;
193
244
  }
194
- if (data === "c") {
195
- this.enterChatMode();
196
- return;
197
- }
198
- // Bare `/` enters view-search mode (a top-level keybinding). The Editor's
199
- // own `/`-at-line-start slash menu lives inside the composer and only
200
- // fires once chat mode owns the input, so the two never collide.
245
+ // Bare slash enters view-search mode (a top-level keybinding while the view
246
+ // block is focused). The composer slash menu is unaffected -- it only fires
247
+ // once the composer owns the input.
201
248
  if (data === "/") {
202
249
  this.mode = "search";
203
250
  this.status = "filtering tui views";
@@ -213,60 +260,115 @@ class AgentTerminalView {
213
260
  }
214
261
  this.viewList.handleInput(data);
215
262
  }
216
- enterChatMode() {
217
- this.mode = "chat";
218
- // Keep focus on the view so Escape/Ctrl+C can return to views; the Editor
219
- // renders its cursor off its own `focused` flag, which we drive manually.
220
- this.chatInput.focused = true;
221
- this.tui.requestRender();
222
- }
223
- exitChatMode() {
224
- this.mode = "views";
225
- this.chatInput.focused = false;
226
- this.tui.requestRender();
227
- }
228
- handleChatInput(data) {
263
+ /** Route a keystroke into the always-on composer. */
264
+ handleComposerInput(data) {
229
265
  // Escape with an open dropdown closes the dropdown (handled by the Editor)
230
- // rather than exiting chat mode, so one Escape doesn't do two things.
231
- if (data === "\u001b" && this.chatInput.isShowingAutocomplete()) {
266
+ // rather than moving focus, so one Escape does not do two things.
267
+ if (data === "" && this.chatInput.isShowingAutocomplete()) {
232
268
  this.chatInput.handleInput(data);
233
269
  this.tui.requestRender();
234
270
  return;
235
271
  }
236
- // Escape (no dropdown) and Ctrl+C return to the view list instead of
237
- // tearing down the whole TUI.
238
- if (data === "\u001b" || data === "\u0003") {
239
- this.exitChatMode();
272
+ // Escape (no dropdown) hands focus back to the view block.
273
+ if (data === "") {
274
+ this.setFocus("view");
240
275
  return;
241
276
  }
242
277
  this.chatInput.handleInput(data);
243
278
  this.tui.requestRender();
244
279
  }
280
+ /** Move keyboard focus between the view block and the composer. */
281
+ setFocus(target) {
282
+ this.focusTarget = target;
283
+ this.chatInput.focused = target === "composer";
284
+ this.tui.requestRender();
285
+ }
286
+ /** Unmount the active view and return to the list (view block stays focused). */
287
+ closeMountedView() {
288
+ this.mode = "list";
289
+ this.mountedView = null;
290
+ this.status = `${this.views.length} tui views ready`;
291
+ this.tui.requestRender();
292
+ }
245
293
  invalidate() {
246
294
  this.viewList.invalidate();
295
+ this.mountedView?.invalidate?.();
247
296
  }
248
297
  async openView(view) {
249
298
  this.selectedView = view;
299
+ this.mode = this.mode === "search" ? "list" : this.mode;
250
300
  // A plugin-registered terminal view renders its real content inline — the
251
301
  // first time a `viewType: "tui"` view actually renders in the terminal,
252
- // rather than only navigating the GUI shell.
253
- const registered = getTerminalView(view.id);
254
- if (registered) {
255
- this.detailView = registered;
256
- this.mode = "detail";
302
+ // rather than only navigating the GUI shell. Mount via the view's factory
303
+ // (when one is registered) so we can supply `onActivate`: a focused button
304
+ // activation in the view dispatches the view-scoped action to the agent.
305
+ // Fall back to the cached default component for legacy registrations.
306
+ const factory = getTerminalViewFactory(view.id);
307
+ const mounted = factory
308
+ ? factory({ onActivate: (elementId) => this.activateElement(elementId) })
309
+ : getTerminalView(view.id);
310
+ if (mounted) {
311
+ this.mountedView = mounted;
312
+ this.mode = "view";
313
+ // Surface focus to the view block so its controls are immediately
314
+ // tab/enter-drivable; the composer stays one Ctrl+L away.
315
+ this.setFocus("view");
257
316
  this.status = `viewing ${view.label}`;
317
+ // Tell the runtime which view is active so the activate endpoint can
318
+ // resolve elements and the planner upweights its scoped actions. Best
319
+ // effort; the inline render does not depend on it.
320
+ void this.navigateView(view, { silent: true });
258
321
  this.tui.requestRender();
259
322
  return;
260
323
  }
261
324
  this.status = `opening ${view.label}`;
262
325
  this.tui.requestRender();
326
+ await this.navigateView(view, { silent: false });
327
+ }
328
+ /** POST the navigate event so the runtime marks this view active. */
329
+ async navigateView(view, { silent }) {
263
330
  try {
264
331
  await readJson(this.fetchImpl, this.apiBaseUrl, `/api/views/${encodeURIComponent(view.id)}/navigate?viewType=tui`, { method: "POST", body: JSON.stringify({ viewType: "tui" }) });
265
- this.status = `opened ${view.label}`;
332
+ if (!silent)
333
+ this.status = `opened ${view.label}`;
334
+ }
335
+ catch (error) {
336
+ if (!silent) {
337
+ this.status =
338
+ error instanceof Error
339
+ ? error.message
340
+ : `failed to open ${view.label}`;
341
+ }
342
+ }
343
+ finally {
344
+ this.tui.requestRender();
345
+ }
346
+ }
347
+ /**
348
+ * A focused control in the mounted view was activated — dispatch it to the
349
+ * agent via POST /api/views/:id/activate, which resolves the element to its
350
+ * view-scoped action (CLICK_ELEMENT semantics) and runs it. The view's local
351
+ * onPress already fired (state change) inside the spatial component; this is
352
+ * the agent-facing half. Fire-and-forget; surfaced in the status line.
353
+ */
354
+ async activateElement(elementId) {
355
+ const view = this.selectedView;
356
+ if (!view)
357
+ return;
358
+ this.status = `activating ${elementId}…`;
359
+ this.tui.requestRender();
360
+ try {
361
+ await readJson(this.fetchImpl, this.apiBaseUrl, `/api/views/${encodeURIComponent(view.id)}/activate?viewType=tui`, {
362
+ method: "POST",
363
+ body: JSON.stringify({ elementId, viewType: "tui" }),
364
+ });
365
+ this.status = `activated ${elementId}`;
266
366
  }
267
367
  catch (error) {
268
368
  this.status =
269
- error instanceof Error ? error.message : `failed to open ${view.label}`;
369
+ error instanceof Error
370
+ ? `activate failed: ${error.message}`
371
+ : `activate failed: ${elementId}`;
270
372
  }
271
373
  finally {
272
374
  this.tui.requestRender();
@@ -274,7 +376,7 @@ class AgentTerminalView {
274
376
  }
275
377
  handleSearchInput(data) {
276
378
  if (data === "\u001b") {
277
- this.mode = "views";
379
+ this.mode = "list";
278
380
  this.searchQuery = "";
279
381
  this.viewList.setFilter("");
280
382
  this.status = `${this.views.length} tui views ready`;
@@ -286,7 +388,7 @@ class AgentTerminalView {
286
388
  const view = selected
287
389
  ? this.views.find((candidate) => candidate.id === selected.value)
288
390
  : null;
289
- this.mode = "views";
391
+ this.mode = "list";
290
392
  if (view)
291
393
  void this.openView(view);
292
394
  return;
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./agent-skills.ts";
2
- export * from "./config-like.ts";
3
- export * from "./trajectory.ts";
1
+ export * from "./agent-skills.js";
2
+ export * from "./config-like.js";
3
+ export * from "./trajectory.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +0,0 @@
1
- import { type RouteRequestMeta } from "@elizaos/core";
2
- import type { RouteHelpers } from "@elizaos/shared";
3
- export interface NfaRouteContext extends RouteRequestMeta, Pick<RouteHelpers, "json" | "error"> {
4
- }
5
- export declare function handleNfaRoutes(ctx: NfaRouteContext): Promise<boolean>;
6
- //# sourceMappingURL=nfa-routes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nfa-routes.d.ts","sourceRoot":"","sources":["../../src/api/nfa-routes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAoCpD,MAAM,WAAW,eACf,SAAQ,gBAAgB,EACtB,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;CAAG;AAuB3C,wBAAsB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA+F5E"}