pulseed 0.5.3 → 0.5.4

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 (512) hide show
  1. package/dist/base/state/state-manager-goal-state.d.ts +40 -0
  2. package/dist/base/state/state-manager-goal-state.d.ts.map +1 -0
  3. package/dist/base/state/state-manager-goal-state.js +235 -0
  4. package/dist/base/state/state-manager-goal-state.js.map +1 -0
  5. package/dist/base/state/state-manager.d.ts +0 -5
  6. package/dist/base/state/state-manager.d.ts.map +1 -1
  7. package/dist/base/state/state-manager.js +27 -273
  8. package/dist/base/state/state-manager.js.map +1 -1
  9. package/dist/base/types/goal-activation.d.ts +25 -0
  10. package/dist/base/types/goal-activation.d.ts.map +1 -0
  11. package/dist/base/types/goal-activation.js +9 -0
  12. package/dist/base/types/goal-activation.js.map +1 -0
  13. package/dist/interface/chat/chat-history.d.ts +129 -0
  14. package/dist/interface/chat/chat-history.d.ts.map +1 -1
  15. package/dist/interface/chat/chat-history.js +135 -0
  16. package/dist/interface/chat/chat-history.js.map +1 -1
  17. package/dist/interface/chat/chat-runner-command-helpers.d.ts +50 -0
  18. package/dist/interface/chat/chat-runner-command-helpers.d.ts.map +1 -0
  19. package/dist/interface/chat/chat-runner-command-helpers.js +189 -0
  20. package/dist/interface/chat/chat-runner-command-helpers.js.map +1 -0
  21. package/dist/interface/chat/chat-runner-commands.d.ts +76 -0
  22. package/dist/interface/chat/chat-runner-commands.d.ts.map +1 -0
  23. package/dist/interface/chat/chat-runner-commands.js +814 -0
  24. package/dist/interface/chat/chat-runner-commands.js.map +1 -0
  25. package/dist/interface/chat/chat-runner-event-bridge.d.ts +53 -0
  26. package/dist/interface/chat/chat-runner-event-bridge.d.ts.map +1 -0
  27. package/dist/interface/chat/chat-runner-event-bridge.js +311 -0
  28. package/dist/interface/chat/chat-runner-event-bridge.js.map +1 -0
  29. package/dist/interface/chat/chat-runner-routes.d.ts +67 -0
  30. package/dist/interface/chat/chat-runner-routes.d.ts.map +1 -0
  31. package/dist/interface/chat/chat-runner-routes.js +594 -0
  32. package/dist/interface/chat/chat-runner-routes.js.map +1 -0
  33. package/dist/interface/chat/chat-runner-runtime.d.ts +37 -0
  34. package/dist/interface/chat/chat-runner-runtime.d.ts.map +1 -0
  35. package/dist/interface/chat/chat-runner-runtime.js +236 -0
  36. package/dist/interface/chat/chat-runner-runtime.js.map +1 -0
  37. package/dist/interface/chat/chat-runner-state.d.ts +20 -0
  38. package/dist/interface/chat/chat-runner-state.d.ts.map +1 -0
  39. package/dist/interface/chat/chat-runner-state.js +157 -0
  40. package/dist/interface/chat/chat-runner-state.js.map +1 -0
  41. package/dist/interface/chat/chat-runner-support.d.ts +15 -0
  42. package/dist/interface/chat/chat-runner-support.d.ts.map +1 -0
  43. package/dist/interface/chat/chat-runner-support.js +116 -0
  44. package/dist/interface/chat/chat-runner-support.js.map +1 -0
  45. package/dist/interface/chat/chat-runner.d.ts +10 -153
  46. package/dist/interface/chat/chat-runner.d.ts.map +1 -1
  47. package/dist/interface/chat/chat-runner.js +299 -2642
  48. package/dist/interface/chat/chat-runner.js.map +1 -1
  49. package/dist/interface/chat/chat-session-store.d.ts +32 -0
  50. package/dist/interface/chat/chat-session-store.d.ts.map +1 -1
  51. package/dist/interface/chat/chat-session-store.js +100 -10
  52. package/dist/interface/chat/chat-session-store.js.map +1 -1
  53. package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
  54. package/dist/interface/chat/cross-platform-session.js +2 -5
  55. package/dist/interface/chat/cross-platform-session.js.map +1 -1
  56. package/dist/interface/chat/event-subscriber.d.ts.map +1 -1
  57. package/dist/interface/chat/event-subscriber.js +41 -0
  58. package/dist/interface/chat/event-subscriber.js.map +1 -1
  59. package/dist/interface/chat/ingress-router.d.ts +0 -25
  60. package/dist/interface/chat/ingress-router.d.ts.map +1 -1
  61. package/dist/interface/chat/ingress-router.js +12 -85
  62. package/dist/interface/chat/ingress-router.js.map +1 -1
  63. package/dist/interface/chat/tend-command.d.ts.map +1 -1
  64. package/dist/interface/chat/tend-command.js +2 -0
  65. package/dist/interface/chat/tend-command.js.map +1 -1
  66. package/dist/interface/cli/commands/daemon-shared.d.ts +32 -0
  67. package/dist/interface/cli/commands/daemon-shared.d.ts.map +1 -0
  68. package/dist/interface/cli/commands/daemon-shared.js +120 -0
  69. package/dist/interface/cli/commands/daemon-shared.js.map +1 -0
  70. package/dist/interface/cli/commands/daemon.d.ts +2 -2
  71. package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
  72. package/dist/interface/cli/commands/daemon.js +4 -120
  73. package/dist/interface/cli/commands/daemon.js.map +1 -1
  74. package/dist/interface/cli/commands/schedule/history.d.ts.map +1 -1
  75. package/dist/interface/cli/commands/schedule/history.js +5 -1
  76. package/dist/interface/cli/commands/schedule/history.js.map +1 -1
  77. package/dist/interface/cli/commands/schedule.js +34 -4
  78. package/dist/interface/cli/commands/schedule.js.map +1 -1
  79. package/dist/interface/tui/app.d.ts.map +1 -1
  80. package/dist/interface/tui/app.js +14 -1
  81. package/dist/interface/tui/app.js.map +1 -1
  82. package/dist/interface/tui/chat/suggestions.d.ts.map +1 -1
  83. package/dist/interface/tui/chat/suggestions.js +118 -4
  84. package/dist/interface/tui/chat/suggestions.js.map +1 -1
  85. package/dist/interface/tui/entry-approval.d.ts +8 -0
  86. package/dist/interface/tui/entry-approval.d.ts.map +1 -0
  87. package/dist/interface/tui/entry-approval.js +59 -0
  88. package/dist/interface/tui/entry-approval.js.map +1 -0
  89. package/dist/interface/tui/entry-daemon.d.ts +12 -0
  90. package/dist/interface/tui/entry-daemon.d.ts.map +1 -0
  91. package/dist/interface/tui/entry-daemon.js +74 -0
  92. package/dist/interface/tui/entry-daemon.js.map +1 -0
  93. package/dist/interface/tui/entry-deps.d.ts +22 -0
  94. package/dist/interface/tui/entry-deps.d.ts.map +1 -0
  95. package/dist/interface/tui/entry-deps.js +409 -0
  96. package/dist/interface/tui/entry-deps.js.map +1 -0
  97. package/dist/interface/tui/entry.d.ts +2 -4
  98. package/dist/interface/tui/entry.d.ts.map +1 -1
  99. package/dist/interface/tui/entry.js +10 -557
  100. package/dist/interface/tui/entry.js.map +1 -1
  101. package/dist/interface/tui/fullscreen-chat-render.d.ts +127 -0
  102. package/dist/interface/tui/fullscreen-chat-render.d.ts.map +1 -0
  103. package/dist/interface/tui/fullscreen-chat-render.js +667 -0
  104. package/dist/interface/tui/fullscreen-chat-render.js.map +1 -0
  105. package/dist/interface/tui/fullscreen-chat.d.ts +2 -111
  106. package/dist/interface/tui/fullscreen-chat.d.ts.map +1 -1
  107. package/dist/interface/tui/fullscreen-chat.js +4 -663
  108. package/dist/interface/tui/fullscreen-chat.js.map +1 -1
  109. package/dist/interface/tui/help-overlay.d.ts.map +1 -1
  110. package/dist/interface/tui/help-overlay.js +1 -1
  111. package/dist/interface/tui/help-overlay.js.map +1 -1
  112. package/dist/interface/tui/intent-recognizer.js +2 -2
  113. package/dist/interface/tui/intent-recognizer.js.map +1 -1
  114. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts.map +1 -1
  115. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js +8 -0
  116. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
  117. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.d.ts.map +1 -1
  118. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js +2 -1
  119. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js.map +1 -1
  120. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts +2 -0
  121. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts.map +1 -1
  122. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js +31 -0
  123. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js.map +1 -1
  124. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts +1 -0
  125. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts.map +1 -1
  126. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.js.map +1 -1
  127. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts +1 -0
  128. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts.map +1 -1
  129. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +36 -2
  130. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js.map +1 -1
  131. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts.map +1 -1
  132. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js +2 -1
  133. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js.map +1 -1
  134. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts +19 -0
  135. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts.map +1 -1
  136. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js +164 -14
  137. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js.map +1 -1
  138. package/dist/orchestrator/execution/reflection-generator.d.ts +1 -0
  139. package/dist/orchestrator/execution/reflection-generator.d.ts.map +1 -1
  140. package/dist/orchestrator/execution/reflection-generator.js +10 -1
  141. package/dist/orchestrator/execution/reflection-generator.js.map +1 -1
  142. package/dist/orchestrator/execution/task/task-context-enricher.d.ts +2 -0
  143. package/dist/orchestrator/execution/task/task-context-enricher.d.ts.map +1 -1
  144. package/dist/orchestrator/execution/task/task-context-enricher.js +9 -4
  145. package/dist/orchestrator/execution/task/task-context-enricher.js.map +1 -1
  146. package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts +5 -0
  147. package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts.map +1 -0
  148. package/dist/orchestrator/execution/task/task-execution-helpers-internal.js +6 -0
  149. package/dist/orchestrator/execution/task/task-execution-helpers-internal.js.map +1 -0
  150. package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
  151. package/dist/orchestrator/execution/task/task-generation.js +8 -3
  152. package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
  153. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts +73 -0
  154. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts.map +1 -0
  155. package/dist/orchestrator/execution/task/task-lifecycle-runner.js +184 -0
  156. package/dist/orchestrator/execution/task/task-lifecycle-runner.js.map +1 -0
  157. package/dist/orchestrator/execution/task/task-lifecycle.d.ts +7 -7
  158. package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
  159. package/dist/orchestrator/execution/task/task-lifecycle.js +37 -181
  160. package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
  161. package/dist/orchestrator/execution/task/task-verifier-internal.d.ts +2 -0
  162. package/dist/orchestrator/execution/task/task-verifier-internal.d.ts.map +1 -0
  163. package/dist/orchestrator/execution/task/task-verifier-internal.js +2 -0
  164. package/dist/orchestrator/execution/task/task-verifier-internal.js.map +1 -0
  165. package/dist/orchestrator/goal/goal-negotiator.d.ts.map +1 -1
  166. package/dist/orchestrator/goal/goal-negotiator.js +23 -3
  167. package/dist/orchestrator/goal/goal-negotiator.js.map +1 -1
  168. package/dist/orchestrator/loop/core-loop/contracts.d.ts +1 -0
  169. package/dist/orchestrator/loop/core-loop/contracts.d.ts.map +1 -1
  170. package/dist/orchestrator/loop/core-loop/contracts.js.map +1 -1
  171. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.d.ts +7 -0
  172. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.d.ts.map +1 -0
  173. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js +43 -0
  174. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js.map +1 -0
  175. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts +14 -0
  176. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts.map +1 -0
  177. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js +41 -0
  178. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js.map +1 -0
  179. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts +3 -2
  180. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts.map +1 -1
  181. package/dist/orchestrator/loop/core-loop/iteration-kernel.js +16 -87
  182. package/dist/orchestrator/loop/core-loop/iteration-kernel.js.map +1 -1
  183. package/dist/orchestrator/loop/core-loop/phase-policy.js +5 -5
  184. package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts +9 -0
  185. package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts.map +1 -0
  186. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js +297 -0
  187. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js.map +1 -0
  188. package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts +11 -0
  189. package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts.map +1 -0
  190. package/dist/orchestrator/loop/core-loop/task-cycle-wait.js +176 -0
  191. package/dist/orchestrator/loop/core-loop/task-cycle-wait.js.map +1 -0
  192. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +3 -15
  193. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -1
  194. package/dist/orchestrator/loop/core-loop/task-cycle.js +10 -444
  195. package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -1
  196. package/dist/orchestrator/loop/core-loop.d.ts +3 -0
  197. package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
  198. package/dist/orchestrator/loop/core-loop.js +4 -0
  199. package/dist/orchestrator/loop/core-loop.js.map +1 -1
  200. package/dist/orchestrator/strategy/portfolio-manager.d.ts +3 -2
  201. package/dist/orchestrator/strategy/portfolio-manager.d.ts.map +1 -1
  202. package/dist/orchestrator/strategy/portfolio-manager.js +16 -11
  203. package/dist/orchestrator/strategy/portfolio-manager.js.map +1 -1
  204. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts +1 -1
  205. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts.map +1 -1
  206. package/dist/orchestrator/strategy/portfolio-rebalance.js +31 -9
  207. package/dist/orchestrator/strategy/portfolio-rebalance.js.map +1 -1
  208. package/dist/orchestrator/strategy/strategy-manager-base.d.ts +12 -2
  209. package/dist/orchestrator/strategy/strategy-manager-base.d.ts.map +1 -1
  210. package/dist/orchestrator/strategy/strategy-manager-base.js +23 -7
  211. package/dist/orchestrator/strategy/strategy-manager-base.js.map +1 -1
  212. package/dist/orchestrator/strategy/strategy-manager.d.ts +1 -11
  213. package/dist/orchestrator/strategy/strategy-manager.d.ts.map +1 -1
  214. package/dist/orchestrator/strategy/strategy-manager.js +78 -19
  215. package/dist/orchestrator/strategy/strategy-manager.js.map +1 -1
  216. package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts +18 -0
  217. package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts.map +1 -0
  218. package/dist/platform/dream/dream-consolidator/fs-metrics.js +130 -0
  219. package/dist/platform/dream/dream-consolidator/fs-metrics.js.map +1 -0
  220. package/dist/platform/dream/dream-consolidator.d.ts +4 -14
  221. package/dist/platform/dream/dream-consolidator.d.ts.map +1 -1
  222. package/dist/platform/dream/dream-consolidator.js +46 -166
  223. package/dist/platform/dream/dream-consolidator.js.map +1 -1
  224. package/dist/platform/dream/dream-soil-sync.d.ts +1 -0
  225. package/dist/platform/dream/dream-soil-sync.d.ts.map +1 -1
  226. package/dist/platform/dream/dream-soil-sync.js +8 -1
  227. package/dist/platform/dream/dream-soil-sync.js.map +1 -1
  228. package/dist/platform/dream/dream-types.d.ts +5 -0
  229. package/dist/platform/dream/dream-types.d.ts.map +1 -1
  230. package/dist/platform/dream/dream-types.js +1 -0
  231. package/dist/platform/dream/dream-types.js.map +1 -1
  232. package/dist/platform/dream/playbook-memory.d.ts +4 -4
  233. package/dist/platform/drive/stall-detector/analysis.d.ts +5 -0
  234. package/dist/platform/drive/stall-detector/analysis.d.ts.map +1 -0
  235. package/dist/platform/drive/stall-detector/analysis.js +55 -0
  236. package/dist/platform/drive/stall-detector/analysis.js.map +1 -0
  237. package/dist/platform/drive/stall-detector/repetitive.d.ts +3 -0
  238. package/dist/platform/drive/stall-detector/repetitive.d.ts.map +1 -0
  239. package/dist/platform/drive/stall-detector/repetitive.js +72 -0
  240. package/dist/platform/drive/stall-detector/repetitive.js.map +1 -0
  241. package/dist/platform/drive/stall-detector/thresholds.d.ts +10 -0
  242. package/dist/platform/drive/stall-detector/thresholds.d.ts.map +1 -0
  243. package/dist/platform/drive/stall-detector/thresholds.js +61 -0
  244. package/dist/platform/drive/stall-detector/thresholds.js.map +1 -0
  245. package/dist/platform/drive/stall-detector.d.ts +2 -20
  246. package/dist/platform/drive/stall-detector.d.ts.map +1 -1
  247. package/dist/platform/drive/stall-detector.js +9 -202
  248. package/dist/platform/drive/stall-detector.js.map +1 -1
  249. package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts +55 -0
  250. package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts.map +1 -0
  251. package/dist/platform/knowledge/knowledge-manager-agent-memory.js +232 -0
  252. package/dist/platform/knowledge/knowledge-manager-agent-memory.js.map +1 -0
  253. package/dist/platform/knowledge/knowledge-manager-internals.d.ts +10 -0
  254. package/dist/platform/knowledge/knowledge-manager-internals.d.ts.map +1 -0
  255. package/dist/platform/knowledge/knowledge-manager-internals.js +43 -0
  256. package/dist/platform/knowledge/knowledge-manager-internals.js.map +1 -0
  257. package/dist/platform/knowledge/knowledge-manager-store.d.ts +13 -0
  258. package/dist/platform/knowledge/knowledge-manager-store.d.ts.map +1 -0
  259. package/dist/platform/knowledge/knowledge-manager-store.js +67 -0
  260. package/dist/platform/knowledge/knowledge-manager-store.js.map +1 -0
  261. package/dist/platform/knowledge/knowledge-manager.d.ts +6 -2
  262. package/dist/platform/knowledge/knowledge-manager.d.ts.map +1 -1
  263. package/dist/platform/knowledge/knowledge-manager.js +43 -344
  264. package/dist/platform/knowledge/knowledge-manager.js.map +1 -1
  265. package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts +4 -0
  266. package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts.map +1 -0
  267. package/dist/platform/knowledge/memory/memory-lifecycle-storage.js +106 -0
  268. package/dist/platform/knowledge/memory/memory-lifecycle-storage.js.map +1 -0
  269. package/dist/platform/knowledge/memory/memory-lifecycle.d.ts.map +1 -1
  270. package/dist/platform/knowledge/memory/memory-lifecycle.js +6 -112
  271. package/dist/platform/knowledge/memory/memory-lifecycle.js.map +1 -1
  272. package/dist/platform/observation/capability-detector/prompts.d.ts +18 -0
  273. package/dist/platform/observation/capability-detector/prompts.d.ts.map +1 -0
  274. package/dist/platform/observation/capability-detector/prompts.js +80 -0
  275. package/dist/platform/observation/capability-detector/prompts.js.map +1 -0
  276. package/dist/platform/observation/capability-detector/recommendations.d.ts +5 -0
  277. package/dist/platform/observation/capability-detector/recommendations.d.ts.map +1 -0
  278. package/dist/platform/observation/capability-detector/recommendations.js +76 -0
  279. package/dist/platform/observation/capability-detector/recommendations.js.map +1 -0
  280. package/dist/platform/observation/capability-detector/types.d.ts +112 -0
  281. package/dist/platform/observation/capability-detector/types.d.ts.map +1 -0
  282. package/dist/platform/observation/capability-detector/types.js +75 -0
  283. package/dist/platform/observation/capability-detector/types.js.map +1 -0
  284. package/dist/platform/observation/capability-detector.d.ts +4 -9
  285. package/dist/platform/observation/capability-detector.d.ts.map +1 -1
  286. package/dist/platform/observation/capability-detector.js +12 -212
  287. package/dist/platform/observation/capability-detector.js.map +1 -1
  288. package/dist/platform/observation/context-provider/collector.d.ts +13 -0
  289. package/dist/platform/observation/context-provider/collector.d.ts.map +1 -0
  290. package/dist/platform/observation/context-provider/collector.js +259 -0
  291. package/dist/platform/observation/context-provider/collector.js.map +1 -0
  292. package/dist/platform/observation/context-provider/search-terms.d.ts +2 -0
  293. package/dist/platform/observation/context-provider/search-terms.d.ts.map +1 -0
  294. package/dist/platform/observation/context-provider/search-terms.js +24 -0
  295. package/dist/platform/observation/context-provider/search-terms.js.map +1 -0
  296. package/dist/platform/observation/context-provider/shared.d.ts +17 -0
  297. package/dist/platform/observation/context-provider/shared.d.ts.map +1 -0
  298. package/dist/platform/observation/context-provider/shared.js +87 -0
  299. package/dist/platform/observation/context-provider/shared.js.map +1 -0
  300. package/dist/platform/observation/context-provider.d.ts +3 -28
  301. package/dist/platform/observation/context-provider.d.ts.map +1 -1
  302. package/dist/platform/observation/context-provider.js +7 -395
  303. package/dist/platform/observation/context-provider.js.map +1 -1
  304. package/dist/platform/soil/compiled-memory-projections.d.ts +2 -0
  305. package/dist/platform/soil/compiled-memory-projections.d.ts.map +1 -1
  306. package/dist/platform/soil/compiled-memory-projections.js +59 -0
  307. package/dist/platform/soil/compiled-memory-projections.js.map +1 -1
  308. package/dist/platform/soil/contracts.d.ts +2 -2
  309. package/dist/platform/soil/retriever.d.ts +25 -0
  310. package/dist/platform/soil/retriever.d.ts.map +1 -1
  311. package/dist/platform/soil/retriever.js +94 -5
  312. package/dist/platform/soil/retriever.js.map +1 -1
  313. package/dist/platform/soil/sqlite-repository-helpers.d.ts +80 -0
  314. package/dist/platform/soil/sqlite-repository-helpers.d.ts.map +1 -0
  315. package/dist/platform/soil/sqlite-repository-helpers.js +143 -0
  316. package/dist/platform/soil/sqlite-repository-helpers.js.map +1 -0
  317. package/dist/platform/soil/sqlite-repository-search.d.ts +8 -0
  318. package/dist/platform/soil/sqlite-repository-search.d.ts.map +1 -0
  319. package/dist/platform/soil/sqlite-repository-search.js +367 -0
  320. package/dist/platform/soil/sqlite-repository-search.js.map +1 -0
  321. package/dist/platform/soil/sqlite-repository-storage.d.ts +8 -0
  322. package/dist/platform/soil/sqlite-repository-storage.d.ts.map +1 -0
  323. package/dist/platform/soil/sqlite-repository-storage.js +278 -0
  324. package/dist/platform/soil/sqlite-repository-storage.js.map +1 -0
  325. package/dist/platform/soil/sqlite-repository.d.ts +1 -4
  326. package/dist/platform/soil/sqlite-repository.d.ts.map +1 -1
  327. package/dist/platform/soil/sqlite-repository.js +26 -820
  328. package/dist/platform/soil/sqlite-repository.js.map +1 -1
  329. package/dist/runtime/daemon/index.d.ts +1 -1
  330. package/dist/runtime/daemon/index.d.ts.map +1 -1
  331. package/dist/runtime/daemon/index.js +1 -1
  332. package/dist/runtime/daemon/index.js.map +1 -1
  333. package/dist/runtime/daemon/maintenance.d.ts +2 -10
  334. package/dist/runtime/daemon/maintenance.d.ts.map +1 -1
  335. package/dist/runtime/daemon/maintenance.js +14 -45
  336. package/dist/runtime/daemon/maintenance.js.map +1 -1
  337. package/dist/runtime/daemon/runner-bootstrap.d.ts +25 -0
  338. package/dist/runtime/daemon/runner-bootstrap.d.ts.map +1 -0
  339. package/dist/runtime/daemon/runner-bootstrap.js +77 -0
  340. package/dist/runtime/daemon/runner-bootstrap.js.map +1 -0
  341. package/dist/runtime/daemon/runner-commands.d.ts +7 -7
  342. package/dist/runtime/daemon/runner-commands.d.ts.map +1 -1
  343. package/dist/runtime/daemon/runner-commands.js +35 -20
  344. package/dist/runtime/daemon/runner-commands.js.map +1 -1
  345. package/dist/runtime/daemon/runner-goal-cycle.d.ts.map +1 -1
  346. package/dist/runtime/daemon/runner-goal-cycle.js +3 -5
  347. package/dist/runtime/daemon/runner-goal-cycle.js.map +1 -1
  348. package/dist/runtime/daemon/runner-resident-curiosity.d.ts +12 -0
  349. package/dist/runtime/daemon/runner-resident-curiosity.d.ts.map +1 -0
  350. package/dist/runtime/daemon/runner-resident-curiosity.js +155 -0
  351. package/dist/runtime/daemon/runner-resident-curiosity.js.map +1 -0
  352. package/dist/runtime/daemon/runner-resident-dream.d.ts +20 -0
  353. package/dist/runtime/daemon/runner-resident-dream.d.ts.map +1 -0
  354. package/dist/runtime/daemon/runner-resident-dream.js +148 -0
  355. package/dist/runtime/daemon/runner-resident-dream.js.map +1 -0
  356. package/dist/runtime/daemon/runner-resident-proactive.d.ts +4 -0
  357. package/dist/runtime/daemon/runner-resident-proactive.d.ts.map +1 -0
  358. package/dist/runtime/daemon/runner-resident-proactive.js +113 -0
  359. package/dist/runtime/daemon/runner-resident-proactive.js.map +1 -0
  360. package/dist/runtime/daemon/runner-resident-shared.d.ts +40 -0
  361. package/dist/runtime/daemon/runner-resident-shared.d.ts.map +1 -0
  362. package/dist/runtime/daemon/runner-resident-shared.js +101 -0
  363. package/dist/runtime/daemon/runner-resident-shared.js.map +1 -0
  364. package/dist/runtime/daemon/runner-resident.d.ts +4 -68
  365. package/dist/runtime/daemon/runner-resident.d.ts.map +1 -1
  366. package/dist/runtime/daemon/runner-resident.js +4 -506
  367. package/dist/runtime/daemon/runner-resident.js.map +1 -1
  368. package/dist/runtime/daemon/runner-runtime.d.ts +12 -0
  369. package/dist/runtime/daemon/runner-runtime.d.ts.map +1 -0
  370. package/dist/runtime/daemon/runner-runtime.js +43 -0
  371. package/dist/runtime/daemon/runner-runtime.js.map +1 -0
  372. package/dist/runtime/daemon/runner-startup.js +3 -4
  373. package/dist/runtime/daemon/runner-startup.js.map +1 -1
  374. package/dist/runtime/daemon/runner.d.ts +10 -23
  375. package/dist/runtime/daemon/runner.d.ts.map +1 -1
  376. package/dist/runtime/daemon/runner.js +27 -110
  377. package/dist/runtime/daemon/runner.js.map +1 -1
  378. package/dist/runtime/daemon/wait-deadline-resolver.d.ts +5 -2
  379. package/dist/runtime/daemon/wait-deadline-resolver.d.ts.map +1 -1
  380. package/dist/runtime/daemon/wait-deadline-resolver.js +55 -35
  381. package/dist/runtime/daemon/wait-deadline-resolver.js.map +1 -1
  382. package/dist/runtime/event/dispatcher.d.ts +0 -2
  383. package/dist/runtime/event/dispatcher.d.ts.map +1 -1
  384. package/dist/runtime/event/dispatcher.js +0 -4
  385. package/dist/runtime/event/dispatcher.js.map +1 -1
  386. package/dist/runtime/executor/goal-worker.d.ts +2 -1
  387. package/dist/runtime/executor/goal-worker.d.ts.map +1 -1
  388. package/dist/runtime/executor/goal-worker.js +2 -1
  389. package/dist/runtime/executor/goal-worker.js.map +1 -1
  390. package/dist/runtime/executor/loop-supervisor.d.ts +3 -0
  391. package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
  392. package/dist/runtime/executor/loop-supervisor.js +37 -11
  393. package/dist/runtime/executor/loop-supervisor.js.map +1 -1
  394. package/dist/runtime/schedule/engine-cron-reflection.d.ts +31 -0
  395. package/dist/runtime/schedule/engine-cron-reflection.d.ts.map +1 -0
  396. package/dist/runtime/schedule/engine-cron-reflection.js +229 -0
  397. package/dist/runtime/schedule/engine-cron-reflection.js.map +1 -0
  398. package/dist/runtime/schedule/engine-execution.d.ts +47 -0
  399. package/dist/runtime/schedule/engine-execution.d.ts.map +1 -0
  400. package/dist/runtime/schedule/engine-execution.js +424 -0
  401. package/dist/runtime/schedule/engine-execution.js.map +1 -0
  402. package/dist/runtime/schedule/engine-heartbeat.d.ts +5 -0
  403. package/dist/runtime/schedule/engine-heartbeat.d.ts.map +1 -0
  404. package/dist/runtime/schedule/engine-heartbeat.js +104 -0
  405. package/dist/runtime/schedule/engine-heartbeat.js.map +1 -0
  406. package/dist/runtime/schedule/engine-layers.d.ts +2 -0
  407. package/dist/runtime/schedule/engine-layers.d.ts.map +1 -1
  408. package/dist/runtime/schedule/engine-layers.js +12 -228
  409. package/dist/runtime/schedule/engine-layers.js.map +1 -1
  410. package/dist/runtime/schedule/engine-mutations.d.ts +37 -0
  411. package/dist/runtime/schedule/engine-mutations.d.ts.map +1 -0
  412. package/dist/runtime/schedule/engine-mutations.js +263 -0
  413. package/dist/runtime/schedule/engine-mutations.js.map +1 -0
  414. package/dist/runtime/schedule/engine.d.ts +11 -38
  415. package/dist/runtime/schedule/engine.d.ts.map +1 -1
  416. package/dist/runtime/schedule/engine.js +65 -810
  417. package/dist/runtime/schedule/engine.js.map +1 -1
  418. package/dist/runtime/schedule/history.d.ts +16 -0
  419. package/dist/runtime/schedule/history.d.ts.map +1 -1
  420. package/dist/runtime/schedule/history.js +8 -0
  421. package/dist/runtime/schedule/history.js.map +1 -1
  422. package/dist/runtime/schedule/index.d.ts +1 -0
  423. package/dist/runtime/schedule/index.d.ts.map +1 -1
  424. package/dist/runtime/schedule/index.js +1 -0
  425. package/dist/runtime/schedule/index.js.map +1 -1
  426. package/dist/runtime/schedule/legacy-cron-migration.d.ts +9 -0
  427. package/dist/runtime/schedule/legacy-cron-migration.d.ts.map +1 -0
  428. package/dist/runtime/schedule/legacy-cron-migration.js +89 -0
  429. package/dist/runtime/schedule/legacy-cron-migration.js.map +1 -0
  430. package/dist/runtime/schedule/wait-projection.d.ts +6 -0
  431. package/dist/runtime/schedule/wait-projection.d.ts.map +1 -0
  432. package/dist/runtime/schedule/wait-projection.js +102 -0
  433. package/dist/runtime/schedule/wait-projection.js.map +1 -0
  434. package/dist/runtime/session-registry/registry-helpers.d.ts +34 -0
  435. package/dist/runtime/session-registry/registry-helpers.d.ts.map +1 -0
  436. package/dist/runtime/session-registry/registry-helpers.js +241 -0
  437. package/dist/runtime/session-registry/registry-helpers.js.map +1 -0
  438. package/dist/runtime/session-registry/registry.d.ts.map +1 -1
  439. package/dist/runtime/session-registry/registry.js +14 -243
  440. package/dist/runtime/session-registry/registry.js.map +1 -1
  441. package/dist/runtime/session-registry/types.d.ts +36 -36
  442. package/dist/runtime/store/runtime-operation-schemas.d.ts +36 -36
  443. package/dist/runtime/store/runtime-schemas.d.ts +2 -2
  444. package/dist/runtime/types/daemon.d.ts +10 -0
  445. package/dist/runtime/types/daemon.d.ts.map +1 -1
  446. package/dist/runtime/types/daemon.js +2 -0
  447. package/dist/runtime/types/daemon.js.map +1 -1
  448. package/dist/runtime/types/schedule.d.ts +65 -0
  449. package/dist/runtime/types/schedule.d.ts.map +1 -1
  450. package/dist/runtime/types/schedule.js +5 -0
  451. package/dist/runtime/types/schedule.js.map +1 -1
  452. package/dist/tools/builtin/exports.d.ts +1 -0
  453. package/dist/tools/builtin/exports.d.ts.map +1 -1
  454. package/dist/tools/builtin/exports.js +1 -0
  455. package/dist/tools/builtin/exports.js.map +1 -1
  456. package/dist/tools/builtin/factory.d.ts +2 -0
  457. package/dist/tools/builtin/factory.d.ts.map +1 -1
  458. package/dist/tools/builtin/factory.js +8 -1
  459. package/dist/tools/builtin/factory.js.map +1 -1
  460. package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts +1 -0
  461. package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts.map +1 -1
  462. package/dist/tools/fs/FileValidationTool/protected-path-policy.js +17 -4
  463. package/dist/tools/fs/FileValidationTool/protected-path-policy.js.map +1 -1
  464. package/dist/tools/fs/ListDirTool/ListDirTool.js +1 -1
  465. package/dist/tools/fs/ListDirTool/ListDirTool.js.map +1 -1
  466. package/dist/tools/kaggle/paths.d.ts.map +1 -1
  467. package/dist/tools/kaggle/paths.js +6 -0
  468. package/dist/tools/kaggle/paths.js.map +1 -1
  469. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.d.ts.map +1 -1
  470. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js +23 -2
  471. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js.map +1 -1
  472. package/dist/tools/query/CodeSearchTool/CodeSearchTool.d.ts.map +1 -1
  473. package/dist/tools/query/CodeSearchTool/CodeSearchTool.js +24 -2
  474. package/dist/tools/query/CodeSearchTool/CodeSearchTool.js.map +1 -1
  475. package/dist/tools/query/SoilQueryTool/SoilQueryTool.d.ts.map +1 -1
  476. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js +43 -9
  477. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js.map +1 -1
  478. package/dist/tools/query/code-search-root.d.ts +8 -0
  479. package/dist/tools/query/code-search-root.d.ts.map +1 -0
  480. package/dist/tools/query/code-search-root.js +41 -0
  481. package/dist/tools/query/code-search-root.js.map +1 -0
  482. package/dist/tools/query/runtime-session-tools.d.ts +560 -0
  483. package/dist/tools/query/runtime-session-tools.d.ts.map +1 -0
  484. package/dist/tools/query/runtime-session-tools.js +1015 -0
  485. package/dist/tools/query/runtime-session-tools.js.map +1 -0
  486. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts +821 -0
  487. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts.map +1 -0
  488. package/dist/tools/runtime/LongRunningRuntimeTools.js +845 -0
  489. package/dist/tools/runtime/LongRunningRuntimeTools.js.map +1 -0
  490. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts +1 -0
  491. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts.map +1 -1
  492. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js +11 -0
  493. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js.map +1 -1
  494. package/dist/tools/system/ShellTool/ShellTool.d.ts.map +1 -1
  495. package/dist/tools/system/ShellTool/ShellTool.js +2 -1
  496. package/dist/tools/system/ShellTool/ShellTool.js.map +1 -1
  497. package/dist/tools/types.d.ts +2 -0
  498. package/dist/tools/types.d.ts.map +1 -1
  499. package/dist/tools/types.js.map +1 -1
  500. package/package.json +1 -1
  501. package/dist/base/types/cron.d.ts +0 -2
  502. package/dist/base/types/cron.d.ts.map +0 -1
  503. package/dist/base/types/cron.js +0 -3
  504. package/dist/base/types/cron.js.map +0 -1
  505. package/dist/runtime/cron-scheduler.d.ts +0 -13
  506. package/dist/runtime/cron-scheduler.d.ts.map +0 -1
  507. package/dist/runtime/cron-scheduler.js +0 -90
  508. package/dist/runtime/cron-scheduler.js.map +0 -1
  509. package/dist/runtime/types/cron.d.ts +0 -59
  510. package/dist/runtime/types/cron.d.ts.map +0 -1
  511. package/dist/runtime/types/cron.js +0 -13
  512. package/dist/runtime/types/cron.js.map +0 -1
@@ -0,0 +1,667 @@
1
+ import { copyToClipboard } from "./clipboard.js";
2
+ import { theme } from "./theme.js";
3
+ import { CARET_MARKER, } from "./cursor-tracker.js";
4
+ import { measureCharWidth, measureTextWidth } from "./text-width.js";
5
+ import { getMatchingSuggestions } from "./chat/suggestions.js";
6
+ const DEFAULT_PROMPT = "◉";
7
+ const BASH_PROMPT = "!";
8
+ const SUGGESTION_HINT = " arrows to navigate, tab/enter to select, esc to dismiss";
9
+ const INPUT_MARGIN = 4;
10
+ const SELECTION_BACKGROUND = theme.text;
11
+ const SELECTION_FOREGROUND = "#1F2329";
12
+ const FAKE_CURSOR_GLYPH = "▌";
13
+ const COLLAPSED_PASTE_MIN_CHARS = 120;
14
+ const COLLAPSED_PASTE_MIN_MULTILINE_CHARS = 40;
15
+ function charWidth(ch) {
16
+ return measureCharWidth(ch);
17
+ }
18
+ function stringWidth(text) {
19
+ return measureTextWidth(text);
20
+ }
21
+ function trimToWidth(text, width) {
22
+ if (width <= 0)
23
+ return "";
24
+ let out = "";
25
+ let used = 0;
26
+ for (const ch of text) {
27
+ const next = charWidth(ch);
28
+ if (used + next > width)
29
+ break;
30
+ out += ch;
31
+ used += next;
32
+ }
33
+ return out;
34
+ }
35
+ function padToWidth(text, width) {
36
+ const trimmed = trimToWidth(text, width);
37
+ const padding = Math.max(0, width - stringWidth(trimmed));
38
+ return trimmed + " ".repeat(padding);
39
+ }
40
+ function getPromptLabel(bashMode) {
41
+ return bashMode ? BASH_PROMPT : DEFAULT_PROMPT;
42
+ }
43
+ function getPlaceholder(bashMode) {
44
+ return bashMode ? "! for bash mode" : "/ for commands";
45
+ }
46
+ function formatSuggestionLabel(suggestion) {
47
+ return suggestion.type === "goal"
48
+ ? ` ${suggestion.name} ${suggestion.description.padEnd(20)} [goal]`
49
+ : ` ${suggestion.name.padEnd(20)}${suggestion.description}`;
50
+ }
51
+ function countTextLines(text) {
52
+ return text.length === 0 ? 0 : text.split("\n").length;
53
+ }
54
+ export function shouldCollapsePastedText(rawInput, normalizedInput) {
55
+ const isBracketedPaste = rawInput.includes("[200~") || rawInput.includes("\u001b[200~");
56
+ if (normalizedInput.length >= COLLAPSED_PASTE_MIN_CHARS) {
57
+ return true;
58
+ }
59
+ if (normalizedInput.includes("\n") && normalizedInput.length >= COLLAPSED_PASTE_MIN_MULTILINE_CHARS) {
60
+ return true;
61
+ }
62
+ return isBracketedPaste && normalizedInput.length >= COLLAPSED_PASTE_MIN_MULTILINE_CHARS;
63
+ }
64
+ export function buildCollapsedPasteRange(text, start) {
65
+ const lineCount = countTextLines(text);
66
+ const charCount = Array.from(text).length;
67
+ const label = lineCount > 1
68
+ ? `[pasted ${lineCount} lines, ${charCount} chars]`
69
+ : `[pasted ${charCount} chars]`;
70
+ return {
71
+ start,
72
+ end: start + text.length,
73
+ label,
74
+ };
75
+ }
76
+ export function normalizeSelection(selection) {
77
+ if (!selection || selection.anchor === selection.focus) {
78
+ return null;
79
+ }
80
+ return {
81
+ start: Math.min(selection.anchor, selection.focus),
82
+ end: Math.max(selection.anchor, selection.focus),
83
+ };
84
+ }
85
+ export function getSelectedInputText(input, selection) {
86
+ const range = normalizeSelection(selection);
87
+ return range ? input.slice(range.start, range.end) : "";
88
+ }
89
+ export async function copySelectedInputText(input, selection, copy = copyToClipboard) {
90
+ const selectedText = getSelectedInputText(input, selection);
91
+ if (!selectedText) {
92
+ return { ok: false };
93
+ }
94
+ return copy(selectedText);
95
+ }
96
+ export function formatCopyToast(charCount, result) {
97
+ const suffix = result.method ? ` via ${result.method}` : "";
98
+ return `copied ${charCount} chars${suffix}`;
99
+ }
100
+ function pushSegment(segments, text, style = {}) {
101
+ if (text.length === 0)
102
+ return;
103
+ const previous = segments[segments.length - 1];
104
+ if (previous &&
105
+ previous.color === style.color &&
106
+ previous.backgroundColor === style.backgroundColor &&
107
+ previous.bold === style.bold &&
108
+ previous.dim === style.dim) {
109
+ previous.text += text;
110
+ return;
111
+ }
112
+ segments.push({ text, ...style });
113
+ }
114
+ function buildInputRows(input, cursorOffset, contentWidth, placeholder, selection, collapsedPaste) {
115
+ if (contentWidth <= 0) {
116
+ return {
117
+ rows: [{
118
+ cells: [{
119
+ text: CARET_MARKER,
120
+ width: 0,
121
+ offsetBefore: cursorOffset,
122
+ offsetAfter: cursorOffset,
123
+ }],
124
+ startOffset: cursorOffset,
125
+ endOffset: cursorOffset,
126
+ }],
127
+ };
128
+ }
129
+ if (input.length === 0) {
130
+ const cells = [{
131
+ text: CARET_MARKER,
132
+ width: 0,
133
+ offsetBefore: 0,
134
+ offsetAfter: 0,
135
+ }];
136
+ for (const ch of trimToWidth(placeholder, Math.max(0, contentWidth - 1))) {
137
+ cells.push({
138
+ text: ch,
139
+ width: charWidth(ch),
140
+ offsetBefore: 0,
141
+ offsetAfter: 0,
142
+ placeholder: true,
143
+ });
144
+ }
145
+ return {
146
+ rows: [{
147
+ cells,
148
+ startOffset: 0,
149
+ endOffset: 0,
150
+ }],
151
+ };
152
+ }
153
+ const rows = [];
154
+ let currentCells = [];
155
+ let currentWidth = 0;
156
+ let rowStartOffset = 0;
157
+ let rowEndOffset = 0;
158
+ const activeCollapsedPaste = collapsedPaste
159
+ && !(cursorOffset > collapsedPaste.start && cursorOffset < collapsedPaste.end)
160
+ && !(selection && selection.start < collapsedPaste.end && selection.end > collapsedPaste.start)
161
+ ? collapsedPaste
162
+ : null;
163
+ const pushRow = () => {
164
+ rows.push({
165
+ cells: currentCells,
166
+ startOffset: rowStartOffset,
167
+ endOffset: rowEndOffset,
168
+ });
169
+ currentCells = [];
170
+ currentWidth = 0;
171
+ };
172
+ let offset = 0;
173
+ while (offset <= input.length) {
174
+ if (offset === cursorOffset) {
175
+ if (currentWidth >= contentWidth && currentCells.length > 0) {
176
+ pushRow();
177
+ rowStartOffset = offset;
178
+ rowEndOffset = offset;
179
+ }
180
+ currentCells.push({
181
+ text: CARET_MARKER,
182
+ width: 0,
183
+ offsetBefore: offset,
184
+ offsetAfter: offset,
185
+ });
186
+ }
187
+ if (offset === input.length) {
188
+ break;
189
+ }
190
+ if (activeCollapsedPaste && offset === activeCollapsedPaste.start) {
191
+ const label = stringWidth(activeCollapsedPaste.label) <= contentWidth
192
+ ? activeCollapsedPaste.label
193
+ : trimToWidth("[paste]", contentWidth);
194
+ const labelWidth = stringWidth(label);
195
+ if (currentWidth + labelWidth > contentWidth && currentCells.length > 0) {
196
+ pushRow();
197
+ rowStartOffset = offset;
198
+ rowEndOffset = offset;
199
+ }
200
+ currentCells.push({
201
+ text: label,
202
+ width: labelWidth,
203
+ offsetBefore: activeCollapsedPaste.start,
204
+ offsetAfter: activeCollapsedPaste.end,
205
+ dim: true,
206
+ });
207
+ currentWidth += labelWidth;
208
+ rowEndOffset = activeCollapsedPaste.end;
209
+ offset = activeCollapsedPaste.end;
210
+ continue;
211
+ }
212
+ const codePoint = input.codePointAt(offset) ?? 0;
213
+ const ch = String.fromCodePoint(codePoint);
214
+ const nextOffset = offset + ch.length;
215
+ if (ch === "\n") {
216
+ pushRow();
217
+ rowStartOffset = nextOffset;
218
+ rowEndOffset = nextOffset;
219
+ offset = nextOffset;
220
+ continue;
221
+ }
222
+ const width = charWidth(ch);
223
+ if (currentWidth + width > contentWidth && currentCells.length > 0) {
224
+ pushRow();
225
+ rowStartOffset = offset;
226
+ rowEndOffset = offset;
227
+ }
228
+ currentCells.push({
229
+ text: ch,
230
+ width,
231
+ offsetBefore: offset,
232
+ offsetAfter: nextOffset,
233
+ selected: selection !== null &&
234
+ offset < selection.end &&
235
+ nextOffset > selection.start,
236
+ });
237
+ currentWidth += width;
238
+ rowEndOffset = nextOffset;
239
+ offset = nextOffset;
240
+ }
241
+ rows.push({
242
+ cells: currentCells,
243
+ startOffset: rowStartOffset,
244
+ endOffset: rowEndOffset,
245
+ });
246
+ return { rows };
247
+ }
248
+ function buildInputContentSegments(row, contentWidth, bashMode) {
249
+ const segments = [];
250
+ const defaultColor = bashMode ? theme.command : undefined;
251
+ let usedWidth = 0;
252
+ for (const cell of row.cells) {
253
+ if (cell.text === CARET_MARKER) {
254
+ pushSegment(segments, FAKE_CURSOR_GLYPH, {
255
+ color: theme.text,
256
+ bold: true,
257
+ });
258
+ usedWidth += 1;
259
+ continue;
260
+ }
261
+ usedWidth += cell.width;
262
+ if (cell.selected) {
263
+ pushSegment(segments, cell.text, {
264
+ color: SELECTION_FOREGROUND,
265
+ backgroundColor: SELECTION_BACKGROUND,
266
+ });
267
+ continue;
268
+ }
269
+ pushSegment(segments, cell.text, {
270
+ color: defaultColor,
271
+ dim: cell.placeholder || cell.dim,
272
+ });
273
+ }
274
+ if (usedWidth < contentWidth) {
275
+ pushSegment(segments, " ".repeat(contentWidth - usedWidth), {
276
+ color: defaultColor,
277
+ });
278
+ }
279
+ return segments;
280
+ }
281
+ function compareBodySelectionPoints(a, b) {
282
+ if (a.rowIndex !== b.rowIndex) {
283
+ return a.rowIndex - b.rowIndex;
284
+ }
285
+ return a.offset - b.offset;
286
+ }
287
+ export function normalizeBodySelection(selection) {
288
+ if (!selection || compareBodySelectionPoints(selection.anchor, selection.focus) === 0) {
289
+ return null;
290
+ }
291
+ return compareBodySelectionPoints(selection.anchor, selection.focus) <= 0
292
+ ? { start: selection.anchor, end: selection.focus }
293
+ : { start: selection.focus, end: selection.anchor };
294
+ }
295
+ function getBodySelectionForRow(selection, rowIndex, textLength) {
296
+ if (!selection || rowIndex < selection.start.rowIndex || rowIndex > selection.end.rowIndex) {
297
+ return null;
298
+ }
299
+ const start = rowIndex === selection.start.rowIndex ? selection.start.offset : 0;
300
+ const end = rowIndex === selection.end.rowIndex ? selection.end.offset : textLength;
301
+ if (start === end)
302
+ return null;
303
+ return { start: Math.max(0, start), end: Math.min(textLength, end) };
304
+ }
305
+ function getDisplayOffsetForText(text, col) {
306
+ if (col <= 0)
307
+ return 0;
308
+ let usedWidth = 0;
309
+ let offset = 0;
310
+ for (const ch of text) {
311
+ const width = charWidth(ch);
312
+ const midpoint = usedWidth + width / 2;
313
+ if (col <= midpoint)
314
+ return offset;
315
+ offset += ch.length;
316
+ usedWidth += width;
317
+ if (col <= usedWidth)
318
+ return offset;
319
+ }
320
+ return text.length;
321
+ }
322
+ function applySelectionToTextSegments(text, selection, style) {
323
+ if (!selection) {
324
+ return [{ text, ...style }];
325
+ }
326
+ const segments = [];
327
+ const before = text.slice(0, selection.start);
328
+ const selected = text.slice(selection.start, selection.end);
329
+ const after = text.slice(selection.end);
330
+ pushSegment(segments, before, style);
331
+ pushSegment(segments, selected, {
332
+ ...style,
333
+ color: SELECTION_FOREGROUND,
334
+ backgroundColor: SELECTION_BACKGROUND,
335
+ });
336
+ pushSegment(segments, after, style);
337
+ return segments;
338
+ }
339
+ export function getSelectedBodyText(rows, selection) {
340
+ const range = normalizeBodySelection(selection);
341
+ if (!range)
342
+ return "";
343
+ const selectedRows = [];
344
+ for (let rowIndex = range.start.rowIndex; rowIndex <= range.end.rowIndex; rowIndex += 1) {
345
+ const row = rows[rowIndex];
346
+ if (!row || row.kind === "spacer")
347
+ continue;
348
+ const rowRange = getBodySelectionForRow(range, rowIndex, row.text.length);
349
+ if (!rowRange)
350
+ continue;
351
+ selectedRows.push(row.text.slice(rowRange.start, rowRange.end).trimEnd());
352
+ }
353
+ return selectedRows.join("\n").trim();
354
+ }
355
+ export function extractClickableTargetAt(text, offset) {
356
+ const patterns = [
357
+ /https?:\/\/[^\s)>\]}]+/g,
358
+ /(?:\.{1,2}\/|\/)[^\s:]+(?::\d+)?/g,
359
+ ];
360
+ for (const pattern of patterns) {
361
+ for (const match of text.matchAll(pattern)) {
362
+ const value = match[0];
363
+ const start = match.index ?? 0;
364
+ const end = start + value.length;
365
+ if (offset >= start && offset <= end) {
366
+ return value;
367
+ }
368
+ }
369
+ }
370
+ return null;
371
+ }
372
+ export function formatTranscript(messages) {
373
+ return messages
374
+ .map((message) => {
375
+ const label = message.role === "user" ? "User" : "PulSeed";
376
+ return `${label}:\n${message.text.trimEnd()}`;
377
+ })
378
+ .join("\n\n");
379
+ }
380
+ function wrapPlainTextToRows(text, width) {
381
+ const rows = [];
382
+ for (const sourceLine of text.split("\n")) {
383
+ if (sourceLine.length === 0) {
384
+ rows.push("");
385
+ continue;
386
+ }
387
+ let current = "";
388
+ let currentWidth = 0;
389
+ for (const ch of sourceLine) {
390
+ const widthOfChar = charWidth(ch);
391
+ if (currentWidth + widthOfChar > width && current.length > 0) {
392
+ rows.push(current);
393
+ current = "";
394
+ currentWidth = 0;
395
+ }
396
+ current += ch;
397
+ currentWidth += widthOfChar;
398
+ }
399
+ rows.push(current);
400
+ }
401
+ return rows;
402
+ }
403
+ export function buildTranscriptRows(messages, cols) {
404
+ const rows = [];
405
+ for (const message of messages) {
406
+ const label = message.role === "user" ? "User" : "PulSeed";
407
+ rows.push(...wrapPlainTextToRows(`${label}:`, cols));
408
+ rows.push(...wrapPlainTextToRows(message.text.trimEnd(), cols));
409
+ rows.push("");
410
+ }
411
+ return rows;
412
+ }
413
+ export function buildTranscriptRenderLines(args) {
414
+ const { messages, cols, rows, scrollOffset, searchQuery, searchMode, status } = args;
415
+ const bodyRows = Math.max(1, rows - 2);
416
+ const transcriptRows = buildTranscriptRows(messages, cols);
417
+ const maxScrollOffset = Math.max(0, transcriptRows.length - bodyRows);
418
+ const clampedOffset = Math.max(0, Math.min(maxScrollOffset, scrollOffset));
419
+ const visibleRows = transcriptRows.slice(clampedOffset, clampedOffset + bodyRows);
420
+ const lines = [{
421
+ key: "transcript-header",
422
+ text: padToWidth("transcript / search n/N next [ write scrollback v editor Esc return", cols),
423
+ color: theme.command,
424
+ }];
425
+ visibleRows.forEach((row, index) => {
426
+ lines.push({
427
+ key: `transcript-${clampedOffset + index}`,
428
+ text: padToWidth(row, cols),
429
+ backgroundColor: searchQuery.length > 0 && row.toLowerCase().includes(searchQuery.toLowerCase())
430
+ ? "#3A3A22"
431
+ : undefined,
432
+ });
433
+ });
434
+ while (lines.length < rows - 1) {
435
+ lines.push({ key: `transcript-filler-${lines.length}`, text: " ".repeat(cols) });
436
+ }
437
+ lines.push({
438
+ key: "transcript-footer",
439
+ text: padToWidth(searchMode
440
+ ? `/${searchQuery}`
441
+ : status
442
+ ? status
443
+ : `${clampedOffset + 1}-${Math.min(clampedOffset + bodyRows, transcriptRows.length)} / ${transcriptRows.length}`, cols),
444
+ dim: !searchMode && !status,
445
+ color: searchMode ? theme.command : undefined,
446
+ });
447
+ return { lines: lines.slice(0, rows), totalRows: transcriptRows.length, maxScrollOffset };
448
+ }
449
+ export function getCursorPositionFromComposerLayout(layout) {
450
+ for (let rowIndex = 0; rowIndex < layout.rows.length; rowIndex += 1) {
451
+ const row = layout.rows[rowIndex];
452
+ if (!row)
453
+ continue;
454
+ let colOffset = 0;
455
+ for (const cell of row.cells) {
456
+ if (cell.text === CARET_MARKER) {
457
+ return {
458
+ x: layout.contentStartCol + colOffset - 1,
459
+ y: layout.startLine + rowIndex - 1,
460
+ };
461
+ }
462
+ colOffset += cell.width;
463
+ }
464
+ }
465
+ return null;
466
+ }
467
+ export function buildComposerLines(args) {
468
+ const { cols, input, cursorOffset, bashMode, emptyHint, matches, selectedIdx, copyToast, selection, collapsedPaste, } = args;
469
+ const lines = [];
470
+ lines.push({
471
+ key: "copy-toast",
472
+ text: padToWidth(copyToast ?? "", cols),
473
+ color: copyToast ? "cyan" : undefined,
474
+ });
475
+ const innerWidth = Math.max(1, cols - 2);
476
+ const promptLabel = getPromptLabel(bashMode);
477
+ const prompt = `${promptLabel} `;
478
+ const promptWidth = stringWidth(prompt);
479
+ const contentWidth = Math.max(1, innerWidth - INPUT_MARGIN - promptWidth);
480
+ const inputRender = buildInputRows(input, cursorOffset, contentWidth, getPlaceholder(bashMode), selection, collapsedPaste);
481
+ const inputRows = inputRender.rows;
482
+ lines.push({
483
+ key: "composer-top",
484
+ text: padToWidth(`┌${"─".repeat(Math.max(0, cols - 2))}┐`, cols),
485
+ color: bashMode ? theme.command : theme.border,
486
+ });
487
+ inputRows.forEach((row, index) => {
488
+ const segments = [];
489
+ const borderColor = bashMode ? theme.command : undefined;
490
+ const promptColor = bashMode ? theme.command : theme.userPrompt;
491
+ pushSegment(segments, "│ ", { color: borderColor });
492
+ if (index === 0) {
493
+ pushSegment(segments, promptLabel, { color: promptColor, bold: true });
494
+ pushSegment(segments, " ", { color: promptColor, bold: true });
495
+ }
496
+ else {
497
+ pushSegment(segments, " ".repeat(promptWidth), { color: borderColor });
498
+ }
499
+ segments.push(...buildInputContentSegments(row, contentWidth, bashMode));
500
+ pushSegment(segments, " │", { color: borderColor });
501
+ lines.push({
502
+ key: `composer-row-${index}`,
503
+ segments,
504
+ protected: true,
505
+ });
506
+ });
507
+ lines.push({
508
+ key: "composer-bottom",
509
+ text: padToWidth(`└${"─".repeat(Math.max(0, cols - 2))}┘`, cols),
510
+ color: bashMode ? theme.command : theme.border,
511
+ });
512
+ if (bashMode) {
513
+ lines.push({
514
+ key: "bash-hint",
515
+ text: padToWidth("! for bash mode", cols),
516
+ color: theme.command,
517
+ });
518
+ }
519
+ if (emptyHint) {
520
+ lines.push({
521
+ key: "empty-hint",
522
+ text: padToWidth(" Type a message or /help for commands", cols),
523
+ dim: true,
524
+ });
525
+ }
526
+ if (matches.length > 0) {
527
+ matches.forEach((suggestion, index) => {
528
+ lines.push({
529
+ key: `suggestion-${index}`,
530
+ text: padToWidth(formatSuggestionLabel(suggestion), cols),
531
+ color: index === selectedIdx ? theme.selected : undefined,
532
+ bold: index === selectedIdx,
533
+ dim: index !== selectedIdx,
534
+ });
535
+ });
536
+ lines.push({
537
+ key: "suggestion-hint",
538
+ text: padToWidth(SUGGESTION_HINT, cols),
539
+ dim: true,
540
+ });
541
+ }
542
+ return {
543
+ lines,
544
+ inputRows,
545
+ inputRowStartIndex: 2,
546
+ contentStartCol: 3 + promptWidth,
547
+ };
548
+ }
549
+ function renderMessageRow(row, cols, rowIndex, bodySelection) {
550
+ if (row.kind === "spacer") {
551
+ return { key: row.key, text: " ".repeat(cols) };
552
+ }
553
+ const selection = getBodySelectionForRow(bodySelection, rowIndex, row.text.length);
554
+ if (selection) {
555
+ const text = padToWidth(row.text, cols);
556
+ return {
557
+ key: row.key,
558
+ segments: applySelectionToTextSegments(text, selection, {
559
+ color: row.color,
560
+ backgroundColor: row.backgroundColor,
561
+ bold: row.bold,
562
+ dim: row.dim,
563
+ }),
564
+ };
565
+ }
566
+ return {
567
+ key: row.key,
568
+ text: padToWidth(row.text, cols),
569
+ color: row.color,
570
+ backgroundColor: row.backgroundColor,
571
+ bold: row.bold,
572
+ dim: row.dim,
573
+ };
574
+ }
575
+ export function buildFullscreenChatRenderLines({ availableCols, availableRows, viewport, composerLines, isProcessing, spinnerGlyph, spinnerVerb, bodySelection, transcriptStatus, }) {
576
+ const lines = [];
577
+ lines.push({
578
+ key: "indicator-top",
579
+ text: padToWidth(viewport.hiddenAboveRows > 0 ? `↑ ${viewport.hiddenAboveRows} earlier lines` : "", availableCols),
580
+ dim: true,
581
+ });
582
+ const renderedRows = viewport.rows.map((row, index) => (renderMessageRow(row, availableCols, index, bodySelection ?? null)));
583
+ const fillerCount = Math.max(0, viewport.maxVisibleRows - renderedRows.length);
584
+ for (let index = 0; index < fillerCount; index += 1) {
585
+ lines.push({ key: `filler-${index}`, text: " ".repeat(availableCols) });
586
+ }
587
+ lines.push(...renderedRows);
588
+ lines.push({
589
+ key: "indicator-bottom",
590
+ text: padToWidth(viewport.hiddenBelowRows > 0 ? `↓ ${viewport.hiddenBelowRows} newer lines` : "", availableCols),
591
+ dim: true,
592
+ });
593
+ lines.push({
594
+ key: "processing",
595
+ text: padToWidth(transcriptStatus ?? (isProcessing ? `${spinnerGlyph} ${spinnerVerb}...` : ""), availableCols),
596
+ color: isProcessing ? theme.command : undefined,
597
+ dim: !isProcessing && !transcriptStatus,
598
+ });
599
+ lines.push(...composerLines);
600
+ while (lines.length < availableRows) {
601
+ lines.push({
602
+ key: `tail-filler-${lines.length}`,
603
+ text: " ".repeat(availableCols),
604
+ });
605
+ }
606
+ return lines.slice(0, availableRows);
607
+ }
608
+ export function getMouseOffsetFromComposer(layout, x, y, clampOutside) {
609
+ if (layout.rows.length === 0) {
610
+ return null;
611
+ }
612
+ let rowIndex = y - layout.startLine;
613
+ if (rowIndex < 0) {
614
+ if (!clampOutside)
615
+ return null;
616
+ rowIndex = 0;
617
+ }
618
+ if (rowIndex >= layout.rows.length) {
619
+ if (!clampOutside)
620
+ return null;
621
+ rowIndex = layout.rows.length - 1;
622
+ }
623
+ const row = layout.rows[rowIndex];
624
+ if (!row) {
625
+ return null;
626
+ }
627
+ if (row.startOffset === row.endOffset) {
628
+ return row.startOffset;
629
+ }
630
+ const localCol = x - layout.contentStartCol;
631
+ if (localCol <= 0) {
632
+ return row.startOffset;
633
+ }
634
+ let usedWidth = 0;
635
+ for (const cell of row.cells) {
636
+ if (cell.placeholder || cell.width <= 0) {
637
+ continue;
638
+ }
639
+ const midpoint = usedWidth + cell.width / 2;
640
+ if (localCol <= midpoint) {
641
+ return cell.offsetBefore;
642
+ }
643
+ usedWidth += cell.width;
644
+ if (localCol <= usedWidth) {
645
+ return cell.offsetAfter;
646
+ }
647
+ }
648
+ return row.endOffset;
649
+ }
650
+ export function getMousePositionFromBody(rows, x, y, fillerRows) {
651
+ const rowIndex = y - 2 - fillerRows;
652
+ if (rowIndex < 0 || rowIndex >= rows.length) {
653
+ return null;
654
+ }
655
+ const row = rows[rowIndex];
656
+ if (!row || row.kind === "spacer") {
657
+ return null;
658
+ }
659
+ return {
660
+ rowIndex,
661
+ offset: getDisplayOffsetForText(row.text, x - 1),
662
+ };
663
+ }
664
+ export function getSuggestions(input, goalNames) {
665
+ return getMatchingSuggestions(input, goalNames);
666
+ }
667
+ //# sourceMappingURL=fullscreen-chat-render.js.map