@xopcai/xopc 0.0.303 → 0.0.306

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 (363) hide show
  1. package/README.md +4 -4
  2. package/README.zh-CN.md +4 -4
  3. package/dist/browser-ext/dist/assets/{auth-B_9ZuGDx.js → auth-C3yV1y_l.js} +67 -22
  4. package/dist/browser-ext/dist/background.js +4 -4
  5. package/dist/browser-ext/dist/sidepanel.html +1 -1
  6. package/dist/browser-ext/dist/sidepanel.js +3 -3
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/extensions/feishu/xopc.extension.json +0 -3
  9. package/dist/extensions/telegram/xopc.extension.json +1 -4
  10. package/dist/extensions/weixin/xopc.extension.json +0 -3
  11. package/dist/gateway/static/root/assets/{activity-store-DCi5rh4e.js → activity-store-DLtim-_I.js} +1 -1
  12. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Ch3DzUvP.js → agent-avatar-dicebear-iQXtiilH.js} +1 -1
  13. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CxOv4ivK.js +1 -0
  14. package/dist/gateway/static/root/assets/agents-DzKx7z3k.js +1 -0
  15. package/dist/gateway/static/root/assets/{api-CAV9PN9i.js → api-DfSU0-lD.js} +1 -1
  16. package/dist/gateway/static/root/assets/api-gpHh07OL.js +1 -0
  17. package/dist/gateway/static/root/assets/app-management-settings-panel-BpYFKz7B.js +1 -0
  18. package/dist/gateway/static/root/assets/{appearance-settings-izNAyDhW.js → appearance-settings-BQfR5vrq.js} +1 -1
  19. package/dist/gateway/static/root/assets/apps-page-BceB7JHZ.js +1 -0
  20. package/dist/gateway/static/root/assets/{archive-plugin-BKGzaVvM.js → archive-plugin-BxOvZ-ZX.js} +1 -1
  21. package/dist/gateway/static/root/assets/{attachment-load-8bARdLnp.js → attachment-load-B0FzTMAJ.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automations-page-BAEenyzx.js → automations-page-BpXuPaPg.js} +1 -1
  23. package/dist/gateway/static/root/assets/automations-workspace-Cn_p8zY_.js +6 -0
  24. package/dist/gateway/static/root/assets/{binary-plugins-Cv3GS9Eo.js → binary-plugins-BP7wfpqy.js} +1 -1
  25. package/dist/gateway/static/root/assets/{block-editor-D4ZIVQbk.css → block-editor-BdOTO0Yo.css} +1 -1
  26. package/dist/gateway/static/root/assets/{block-editor-DUeb92LG.js → block-editor-oMLvdnOQ.js} +3 -3
  27. package/dist/gateway/static/root/assets/{browser-automation-inputs-BGT0xoTv.js → browser-automation-inputs-DTxSZ00u.js} +1 -1
  28. package/dist/gateway/static/root/assets/{browser-automations-page-D1O22WIf.js → browser-automations-page-IbJnwEY4.js} +2 -2
  29. package/dist/gateway/static/root/assets/browser-settings-page-CCUO3G23.js +3 -0
  30. package/dist/gateway/static/root/assets/button-CS04eWY9.js +1 -0
  31. package/dist/gateway/static/root/assets/capabilities-settings-panel-BjMb5H2_.js +8 -0
  32. package/dist/gateway/static/root/assets/channels-settings-P22-_i13.js +1 -0
  33. package/dist/gateway/static/root/assets/{channels-status-swr-C_icwbWj.js → channels-status-swr-D2AmAoty.js} +1 -1
  34. package/dist/gateway/static/root/assets/{chat-terminal-dock-D-JYPVYl.js → chat-terminal-dock-B-yI3Mi1.js} +2 -2
  35. package/dist/gateway/static/root/assets/{computer-settings-page-Bcfp948A.js → computer-settings-page-CWx_jnng.js} +1 -1
  36. package/dist/gateway/static/root/assets/connectors-page-BLgPORmH.js +2 -0
  37. package/dist/gateway/static/root/assets/cron-expression-DMRRL4Zg.js +2 -0
  38. package/dist/gateway/static/root/assets/date-picker-BSwL0e6E.js +1 -0
  39. package/dist/gateway/static/root/assets/{dependency-picker-UtoUm57Q.js → dependency-picker-BQTspLzC.js} +1 -1
  40. package/dist/gateway/static/root/assets/{desktop-pet-Bryx7gRM.js → desktop-pet-C3lFxDF6.js} +1 -1
  41. package/dist/gateway/static/root/assets/desktop-pet-settings-Y8pjpXFE.js +1 -0
  42. package/dist/gateway/static/root/assets/device-pairing-wizard-DM4_GMzo.js +1 -0
  43. package/dist/gateway/static/root/assets/{extension-debug-page-DQlFTVBx.js → extension-debug-page-CVGiGVcR.js} +1 -1
  44. package/dist/gateway/static/root/assets/{extension-page-BSsqRDXh.js → extension-page-g3JtCP_y.js} +1 -1
  45. package/dist/gateway/static/root/assets/{extension-settings-page-DbVZv9ve.js → extension-settings-page-CjpoKV1f.js} +1 -1
  46. package/dist/gateway/static/root/assets/{gateway-config-swr-D5AM8cyQ.js → gateway-config-swr-BSvXXpKM.js} +1 -1
  47. package/dist/gateway/static/root/assets/gateway-realtime-BDCpS7U1.js +1 -0
  48. package/dist/gateway/static/root/assets/gateway-realtime-store-BGmP1obI.js +1 -0
  49. package/dist/gateway/static/root/assets/gateway-settings-CYG9WCZn.js +1 -0
  50. package/dist/gateway/static/root/assets/{gateway-startup-retry-CSJWdnFs.js → gateway-startup-retry-Caf8g3sC.js} +1 -1
  51. package/dist/gateway/static/root/assets/{heartbeat-settings-Cxowc29b.js → heartbeat-settings-Cl834-SS.js} +1 -1
  52. package/dist/gateway/static/root/assets/home-page-CB_XVtIM.js +1 -0
  53. package/dist/gateway/static/root/assets/{image-generation-api-BNh604hw.js → image-generation-api-BwEWBUVC.js} +1 -1
  54. package/dist/gateway/static/root/assets/imports-page-CoMlgSIA.js +1 -0
  55. package/dist/gateway/static/root/assets/index-CI37dTAn.css +1 -0
  56. package/dist/gateway/static/root/assets/index-Do9MltC4.js +79 -0
  57. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CNq5D4pe.js +1 -0
  58. package/dist/gateway/static/root/assets/local-app-workbench-page-BxQlEje6.js +2 -0
  59. package/dist/gateway/static/root/assets/{local-apps-page-CXPaPDGm.js → local-apps-page-DQnRA598.js} +1 -1
  60. package/dist/gateway/static/root/assets/{locale-store-DLK05Y1a.js → locale-store-D16nmbaN.js} +1 -1
  61. package/dist/gateway/static/root/assets/logs-page-CT5GrcMs.js +2 -0
  62. package/dist/gateway/static/root/assets/management-settings-DKcO5fQ-.js +1 -0
  63. package/dist/gateway/static/root/assets/{markdown-view-B8maDRWh.js → markdown-view-DCp4BlZP.js} +2 -2
  64. package/dist/gateway/static/root/assets/{media-plugins-tSJ0CvcX.js → media-plugins-Cy64sn_C.js} +1 -1
  65. package/dist/gateway/static/root/assets/messages-C-9oo69N.js +3 -0
  66. package/dist/gateway/static/root/assets/note-detail-panel-5dc3LKTL.js +5 -0
  67. package/dist/gateway/static/root/assets/notes-page-AbwxgXuG.js +8 -0
  68. package/dist/gateway/static/root/assets/{page-tabs-CQx6H-GS.js → page-tabs-CgEoHSVT.js} +1 -1
  69. package/dist/gateway/static/root/assets/{popover-select-DldSX8GX.js → popover-select-9i-ZtHXL.js} +1 -1
  70. package/dist/gateway/static/root/assets/{preview-open-alternatives-A3-bVtdy.js → preview-open-alternatives-Ck2uKTbf.js} +1 -1
  71. package/dist/gateway/static/root/assets/{proactive-page-D46cR3sf.js → proactive-page-Dr1mCJhZ.js} +1 -1
  72. package/dist/gateway/static/root/assets/{product-open-page-CujZXOea.js → product-open-page-DbZvJ5GE.js} +1 -1
  73. package/dist/gateway/static/root/assets/project-detail-page-DnE1zI1c.js +1 -0
  74. package/dist/gateway/static/root/assets/projects-page-BD0nLYxk.js +1 -0
  75. package/dist/gateway/static/root/assets/{registry-api-BMFL4vis.js → registry-api-DcQdwpPu.js} +1 -1
  76. package/dist/gateway/static/root/assets/remote-access-hub-TYuE6A3S.js +1 -0
  77. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CR0qvq9C.js → runtime-tools-settings-panel-CPwdgWKo.js} +2 -2
  78. package/dist/gateway/static/root/assets/{schema-form-BUD9lLEE.js → schema-form-8psK4cFO.js} +1 -1
  79. package/dist/gateway/static/root/assets/sessions-page-BcWDQQFX.js +1 -0
  80. package/dist/gateway/static/root/assets/settings-advanced-gate-DzGQX6Hq.js +1 -0
  81. package/dist/gateway/static/root/assets/{settings-form-section-BZPCUH6a.js → settings-form-section-D_Gsz5rl.js} +1 -1
  82. package/dist/gateway/static/root/assets/{settings-page-XoHmqIdm.js → settings-page-C_Tj_mkZ.js} +1 -1
  83. package/dist/gateway/static/root/assets/setup-status-panel-CE2X89qN.js +1 -0
  84. package/dist/gateway/static/root/assets/share-preview-page-B_M_oPsT.js +2 -0
  85. package/dist/gateway/static/root/assets/shares-settings-BL4H9Iym.js +1 -0
  86. package/dist/gateway/static/root/assets/skill-reload-api-WMKIgUOp.js +1 -0
  87. package/dist/gateway/static/root/assets/skills-page-DYgwzl5B.js +2 -0
  88. package/dist/gateway/static/root/assets/{skills-page.utils-CH-quGxZ.js → skills-page.utils-Cuh6s2HM.js} +1 -1
  89. package/dist/gateway/static/root/assets/{system-settings-panel-CGC7eBso.js → system-settings-panel-aassGyNb.js} +1 -1
  90. package/dist/gateway/static/root/assets/task-detail-page-BjeRslap.js +1 -0
  91. package/dist/gateway/static/root/assets/theme-store-RUBQBsFP.js +1 -0
  92. package/dist/gateway/static/root/assets/tunnel-api-DJYcPWIV.js +1 -0
  93. package/dist/gateway/static/root/assets/{use-autosave-BydB6x2K.js → use-autosave-QGYG7oMZ.js} +1 -1
  94. package/dist/gateway/static/root/assets/user-model-page-PrRsd4go.js +2 -0
  95. package/dist/gateway/static/root/assets/{voice-api-key-field-CPUDBcag.js → voice-api-key-field-D1s0gIRW.js} +1 -1
  96. package/dist/gateway/static/root/assets/{voice-config-api-bZqN8-UF.js → voice-config-api-D2goEn5e.js} +1 -1
  97. package/dist/gateway/static/root/assets/{work-discovery-overlay-D_FmJbGH.js → work-discovery-overlay-DkFW9aJ6.js} +1 -1
  98. package/dist/gateway/static/root/assets/workflow-run-setup-panel-BYToUPUY.js +3 -0
  99. package/dist/gateway/static/root/assets/workflows-page-Z8iZe9YP.js +6 -0
  100. package/dist/gateway/static/root/index.html +14 -12
  101. package/dist/package.js +1 -1
  102. package/dist/packages/gateway-contract/src/device-pairing.js +100 -7
  103. package/dist/packages/gateway-contract/src/gateway-scopes.js +53 -0
  104. package/dist/packages/gateway-contract/src/index.js +2 -0
  105. package/dist/packages/realtime-client/src/index.js +14 -2
  106. package/dist/packages/realtime-protocol/src/index.js +18 -14
  107. package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
  108. package/dist/src/agent/agent-manager.d.ts +2 -0
  109. package/dist/src/agent/agent-manager.js +40 -12
  110. package/dist/src/agent/agent-scope.d.ts +4 -1
  111. package/dist/src/agent/agent-scope.js +19 -3
  112. package/dist/src/agent/commands/command-isolation.js +11 -9
  113. package/dist/src/agent/commands/command-registry.js +18 -33
  114. package/dist/src/agent/context/audit.js +12 -2
  115. package/dist/src/agent/context/coordinator.d.ts +13 -3
  116. package/dist/src/agent/context/coordinator.js +27 -11
  117. package/dist/src/agent/context/execution-context.js +42 -22
  118. package/dist/src/agent/context/execution-context.types.d.ts +4 -2
  119. package/dist/src/agent/context/execution-scope.d.ts +2 -2
  120. package/dist/src/agent/context/execution-scope.js +1 -1
  121. package/dist/src/agent/context/project-context.d.ts +2 -2
  122. package/dist/src/agent/context/project-context.js +3 -3
  123. package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
  124. package/dist/src/agent/embedded/run-for-session.js +7 -1
  125. package/dist/src/agent/inbound/attachment-pipeline.d.ts +2 -0
  126. package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
  127. package/dist/src/agent/inbound/inbound-loop.js +1 -0
  128. package/dist/src/agent/inbound/turn-dispatcher.js +3 -3
  129. package/dist/src/agent/mcp/mcp-stdio-transport.js +5 -2
  130. package/dist/src/agent/memory/compaction-promotion.js +7 -2
  131. package/dist/src/agent/memory/create-memory-manager.js +1 -0
  132. package/dist/src/agent/memory/manager.d.ts +6 -0
  133. package/dist/src/agent/memory/manager.js +74 -39
  134. package/dist/src/agent/memory/runtime.d.ts +3 -3
  135. package/dist/src/agent/memory/runtime.js +11 -4
  136. package/dist/src/agent/orchestration/agent-orchestrator.js +4 -1
  137. package/dist/src/agent/prompt/cache-boundary.d.ts +2 -0
  138. package/dist/src/agent/prompt/cache-boundary.js +10 -1
  139. package/dist/src/agent/service/build-direct-message-content.d.ts +1 -0
  140. package/dist/src/agent/service/build-direct-message-content.js +2 -1
  141. package/dist/src/agent/service/direct-turn-helpers.js +3 -2
  142. package/dist/src/agent/service/process-direct-streaming.d.ts +3 -1
  143. package/dist/src/agent/service/process-direct-streaming.js +3 -2
  144. package/dist/src/agent/service/webchat-tts.d.ts +0 -4
  145. package/dist/src/agent/service/webchat-tts.js +20 -19
  146. package/dist/src/agent/tools/factory.js +3 -3
  147. package/dist/src/agent/tools/knowledge-memory-tool.d.ts +2 -2
  148. package/dist/src/agent/tools/knowledge-memory-tool.js +7 -7
  149. package/dist/src/browser/native-messaging-host.js +2 -2
  150. package/dist/src/channels/attachments/voice-stt-webchat.d.ts +3 -0
  151. package/dist/src/channels/attachments/voice-stt-webchat.js +22 -9
  152. package/dist/src/cli/commands/agent.js +2 -0
  153. package/dist/src/cli/commands/config.js +8 -9
  154. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  155. package/dist/src/cli/commands/extension-marketplace.js +69 -44
  156. package/dist/src/cli/commands/extension-pack.js +0 -2
  157. package/dist/src/cli/commands/extension.js +4 -25
  158. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  159. package/dist/src/cli/commands/onboard/gateway.js +2 -1
  160. package/dist/src/cli/commands/update.js +1 -1
  161. package/dist/src/cli/utils/init-workspace-core.js +5 -2
  162. package/dist/src/config/index.js +2 -2
  163. package/dist/src/config/loader.d.ts +1 -0
  164. package/dist/src/config/loader.js +14 -1
  165. package/dist/src/config/schema.d.ts +10 -3
  166. package/dist/src/config/schema.js +9 -1
  167. package/dist/src/execution-environments/local-worktree-manager.js +17 -15
  168. package/dist/src/execution-environments/store.js +4 -2
  169. package/dist/src/execution-environments/types.d.ts +3 -0
  170. package/dist/src/execution-environments/types.js +2 -1
  171. package/dist/src/execution-environments/worktree-safety.d.ts +8 -0
  172. package/dist/src/execution-environments/worktree-safety.js +43 -0
  173. package/dist/src/extensions/activation-planner.d.ts +1 -1
  174. package/dist/src/extensions/activation-planner.js +1 -1
  175. package/dist/src/extensions/api-version.d.ts +4 -0
  176. package/dist/src/extensions/api-version.js +15 -0
  177. package/dist/src/extensions/api.d.ts +3 -9
  178. package/dist/src/extensions/api.js +26 -32
  179. package/dist/src/extensions/config-validation.d.ts +8 -0
  180. package/dist/src/extensions/config-validation.js +25 -0
  181. package/dist/src/extensions/extension-registry-impl.d.ts +20 -9
  182. package/dist/src/extensions/extension-registry-impl.js +79 -11
  183. package/dist/src/extensions/hooks.d.ts +1 -1
  184. package/dist/src/extensions/index.d.ts +2 -1
  185. package/dist/src/extensions/install-transaction.d.ts +2 -0
  186. package/dist/src/extensions/install-transaction.js +32 -21
  187. package/dist/src/extensions/install.js +18 -1
  188. package/dist/src/extensions/loader.d.ts +5 -5
  189. package/dist/src/extensions/loader.js +109 -47
  190. package/dist/src/extensions/lockfile.d.ts +3 -5
  191. package/dist/src/extensions/lockfile.js +41 -14
  192. package/dist/src/extensions/normalize-manifest.js +6 -60
  193. package/dist/src/extensions/sdk/index.d.ts +3 -2
  194. package/dist/src/extensions/sdk/index.js +2 -2
  195. package/dist/src/extensions/sdk/testing.js +0 -4
  196. package/dist/src/extensions/security.js +5 -7
  197. package/dist/src/extensions/types/core.d.ts +0 -5
  198. package/dist/src/extensions/types/index.d.ts +1 -1
  199. package/dist/src/extensions/types/manifest.d.ts +1 -25
  200. package/dist/src/extensions/types/providers.d.ts +1 -1
  201. package/dist/src/extensions/types/registration.d.ts +0 -12
  202. package/dist/src/extensions/update.js +71 -30
  203. package/dist/src/gateway/heartbeat/service.js +2 -2
  204. package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -1
  205. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +47 -10
  206. package/dist/src/gateway/hono/routes/devices.js +10 -7
  207. package/dist/src/gateway/hono/routes/endpoint-compatibility.js +6 -0
  208. package/dist/src/gateway/hono/routes/extension-gateway.js +0 -33
  209. package/dist/src/gateway/hono/routes/imports.js +1 -1
  210. package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -1
  211. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  212. package/dist/src/gateway/hono/routes/realtime.js +30 -8
  213. package/dist/src/gateway/hono/routes/update.js +2 -2
  214. package/dist/src/gateway/hono/routes/user-model.js +25 -6
  215. package/dist/src/gateway/index.js +5 -2
  216. package/dist/src/gateway/lock.d.ts +2 -0
  217. package/dist/src/gateway/lock.js +31 -14
  218. package/dist/src/gateway/run-loop.js +3 -2
  219. package/dist/src/gateway/security/gateway-scopes.d.ts +2 -5
  220. package/dist/src/gateway/security/gateway-scopes.js +3 -45
  221. package/dist/src/gateway/security/index.js +2 -1
  222. package/dist/src/gateway/service.js +11 -7
  223. package/dist/src/heartbeat/index.js +1 -1
  224. package/dist/src/imports/importService.d.ts +1 -1
  225. package/dist/src/imports/inventory.js +16 -2
  226. package/dist/src/imports/productImport.js +5 -5
  227. package/dist/src/imports/types.d.ts +3 -3
  228. package/dist/src/infra/exec.d.ts +2 -2
  229. package/dist/src/infra/exec.js +32 -27
  230. package/dist/src/infra/gateway-processes.js +1 -1
  231. package/dist/src/infra/run-command.js +15 -50
  232. package/dist/src/infra/update-restart.js +1 -1
  233. package/dist/src/infra/update-runner.js +2 -2
  234. package/dist/src/infra/update-startup.js +1 -1
  235. package/dist/src/knowledge/connected-knowledge-pipeline.js +13 -3
  236. package/dist/src/knowledge-memory/domain.d.ts +17 -1
  237. package/dist/src/knowledge-memory/index.js +2 -2
  238. package/dist/src/knowledge-memory/repository.d.ts +26 -4
  239. package/dist/src/knowledge-memory/repository.js +171 -36
  240. package/dist/src/mcp/channel-bridge.js +7 -3
  241. package/dist/src/media-understanding/registry.js +6 -1
  242. package/dist/src/migrations/knowledge-memory-read-policy-config.d.ts +2 -0
  243. package/dist/src/migrations/knowledge-memory-read-policy-config.js +48 -0
  244. package/dist/src/migrations/runner.js +2 -1
  245. package/dist/src/process/bounded-output.d.ts +10 -0
  246. package/dist/src/process/bounded-output.js +41 -0
  247. package/dist/src/process/kill-tree.d.ts +6 -17
  248. package/dist/src/process/kill-tree.js +43 -75
  249. package/dist/src/process/process-spec.d.ts +39 -0
  250. package/dist/src/process/process-spec.js +13 -0
  251. package/dist/src/process/run-process.d.ts +4 -0
  252. package/dist/src/process/run-process.js +97 -0
  253. package/dist/src/providers/plugin-registry.d.ts +1 -1
  254. package/dist/src/providers/plugin-registry.js +6 -0
  255. package/dist/src/realtime/runtime.js +3 -1
  256. package/dist/src/session/store.js +1 -1
  257. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  258. package/dist/src/storage/sqlite/index.d.ts +1 -1
  259. package/dist/src/storage/sqlite/index.js +2 -2
  260. package/dist/src/storage/sqlite/migrations/180_execution_environment_ownership.sql +7 -0
  261. package/dist/src/storage/sqlite/migrations/181_knowledge_item_status_events.sql +12 -0
  262. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  263. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  264. package/dist/src/storage/sqlite/schema.js +1 -1
  265. package/dist/src/storage/sqlite/schema.sql +13 -0
  266. package/dist/src/storage/sqlite/transcript-repository.d.ts +4 -0
  267. package/dist/src/storage/sqlite/transcript-repository.js +36 -1
  268. package/dist/src/tui/backends/embedded-backend.d.ts +24 -8
  269. package/dist/src/tui/backends/embedded-backend.js +114 -10
  270. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +18 -0
  271. package/dist/src/tui/backends/gateway-realtime-backend.js +32 -5
  272. package/dist/src/tui/components/assistant-message.d.ts +4 -1
  273. package/dist/src/tui/components/assistant-message.js +10 -2
  274. package/dist/src/tui/components/cell-render-mode.d.ts +4 -0
  275. package/dist/src/tui/components/cell-render-mode.js +1 -0
  276. package/dist/src/tui/components/chat-log.d.ts +17 -4
  277. package/dist/src/tui/components/chat-log.js +68 -50
  278. package/dist/src/tui/components/custom-editor.d.ts +2 -2
  279. package/dist/src/tui/components/custom-editor.js +5 -1
  280. package/dist/src/tui/components/pending-input-preview.d.ts +9 -0
  281. package/dist/src/tui/components/pending-input-preview.js +33 -0
  282. package/dist/src/tui/components/semantic-cell.d.ts +17 -0
  283. package/dist/src/tui/components/semantic-cell.js +29 -0
  284. package/dist/src/tui/components/tool-execution.d.ts +5 -1
  285. package/dist/src/tui/components/tool-execution.js +33 -10
  286. package/dist/src/tui/components/transcript-overlay.d.ts +29 -0
  287. package/dist/src/tui/components/transcript-overlay.js +114 -0
  288. package/dist/src/tui/components/tui-bottom-bar.js +3 -1
  289. package/dist/src/tui/components/user-message.d.ts +5 -1
  290. package/dist/src/tui/components/user-message.js +12 -1
  291. package/dist/src/tui/extension-host/load-extensions.d.ts +1 -1
  292. package/dist/src/tui/extension-host/runtime-context.js +2 -1
  293. package/dist/src/tui/extension-host/runtime.d.ts +1 -1
  294. package/dist/src/tui/format-tui-hotkeys.js +8 -1
  295. package/dist/src/tui/tui-agent-events.js +31 -0
  296. package/dist/src/tui/tui-backend.d.ts +23 -11
  297. package/dist/src/tui/tui-backend.js +1 -9
  298. package/dist/src/tui/tui-chat-input-state.d.ts +25 -0
  299. package/dist/src/tui/tui-chat-input-state.js +36 -0
  300. package/dist/src/tui/tui-command-formatters.js +2 -1
  301. package/dist/src/tui/tui-commands.js +1 -1
  302. package/dist/src/tui/tui-types.d.ts +2 -1
  303. package/dist/src/tui/tui-types.js +2 -1
  304. package/dist/src/tui/tui.js +122 -30
  305. package/dist/src/tui/xopc-tui-keybindings.d.ts +23 -3
  306. package/dist/src/tui/xopc-tui-keybindings.js +22 -2
  307. package/dist/src/user-context/access-policy.d.ts +2 -2
  308. package/dist/src/user-context/access-policy.js +10 -2
  309. package/dist/src/user-context/config.d.ts +23 -6
  310. package/dist/src/user-context/config.js +54 -7
  311. package/dist/src/voice/platform-streams.js +11 -1
  312. package/dist/src/voice/realtime/omniEngine.js +13 -1
  313. package/dist/src/voice/realtime/runtime.js +2 -1
  314. package/dist/src/voice/tts/audio.js +1 -1
  315. package/dist/src/voice/tts/speech-registry.js +6 -1
  316. package/package.json +7 -5
  317. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-4oGrNj3m.js +0 -1
  318. package/dist/gateway/static/root/assets/agents-DXHD-ST3.js +0 -1
  319. package/dist/gateway/static/root/assets/api-fPapljyb.js +0 -1
  320. package/dist/gateway/static/root/assets/app-management-settings-panel-CdXnNtTg.js +0 -1
  321. package/dist/gateway/static/root/assets/apps-page-BQb3RCga.js +0 -1
  322. package/dist/gateway/static/root/assets/automations-workspace-5vTl4x0h.js +0 -6
  323. package/dist/gateway/static/root/assets/browser-settings-page-CH9prS-f.js +0 -3
  324. package/dist/gateway/static/root/assets/button-CGlRPNzi.js +0 -1
  325. package/dist/gateway/static/root/assets/capabilities-settings-panel-DMURlZbj.js +0 -8
  326. package/dist/gateway/static/root/assets/channels-settings-CFBS3Yqy.js +0 -1
  327. package/dist/gateway/static/root/assets/connectors-page-DI1c3BMz.js +0 -2
  328. package/dist/gateway/static/root/assets/cron-expression-BJMBFKCh.js +0 -2
  329. package/dist/gateway/static/root/assets/date-picker-BFRIn5y9.js +0 -1
  330. package/dist/gateway/static/root/assets/desktop-pet-settings-DFsyEJUr.js +0 -1
  331. package/dist/gateway/static/root/assets/device-pairing-wizard-C3TQVPRy.js +0 -1
  332. package/dist/gateway/static/root/assets/gateway-settings-DUqVsB3X.js +0 -1
  333. package/dist/gateway/static/root/assets/home-page-CLkumXdN.js +0 -1
  334. package/dist/gateway/static/root/assets/imports-page-DXNfRmk9.js +0 -1
  335. package/dist/gateway/static/root/assets/index-BLRIcVQa.css +0 -1
  336. package/dist/gateway/static/root/assets/index-gheM453N.js +0 -79
  337. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-5Hcec8Xf.js +0 -1
  338. package/dist/gateway/static/root/assets/local-app-workbench-page-BDg1-fcw.js +0 -2
  339. package/dist/gateway/static/root/assets/logs-page-BWZc5jwO.js +0 -2
  340. package/dist/gateway/static/root/assets/management-settings-COa3PhMs.js +0 -1
  341. package/dist/gateway/static/root/assets/messages-C9h8SImu.js +0 -3
  342. package/dist/gateway/static/root/assets/note-detail-panel-D_YGzNcR.js +0 -5
  343. package/dist/gateway/static/root/assets/notes-page-D1f2oI2-.js +0 -8
  344. package/dist/gateway/static/root/assets/project-detail-page-CRlD_Rwv.js +0 -1
  345. package/dist/gateway/static/root/assets/projects-page-mmX0SavY.js +0 -1
  346. package/dist/gateway/static/root/assets/remote-access-hub-Cqr3K6T5.js +0 -1
  347. package/dist/gateway/static/root/assets/sessions-page-CPkvbdJP.js +0 -1
  348. package/dist/gateway/static/root/assets/settings-advanced-gate-Cu0DAbeH.js +0 -1
  349. package/dist/gateway/static/root/assets/setup-status-panel-D8fQF1jZ.js +0 -1
  350. package/dist/gateway/static/root/assets/share-preview-page-BgHqwTuT.js +0 -2
  351. package/dist/gateway/static/root/assets/shares-settings-Id4vRHzI.js +0 -1
  352. package/dist/gateway/static/root/assets/skill-reload-api-BB2Fj_di.js +0 -1
  353. package/dist/gateway/static/root/assets/skills-page-BAwF4LpS.js +0 -2
  354. package/dist/gateway/static/root/assets/task-detail-page-BVjw812D.js +0 -1
  355. package/dist/gateway/static/root/assets/theme-store-KfFEGMlp.js +0 -1
  356. package/dist/gateway/static/root/assets/tunnel-api-Do98Xk05.js +0 -1
  357. package/dist/gateway/static/root/assets/user-model-page-Nv68a4ak.js +0 -2
  358. package/dist/gateway/static/root/assets/workflow-run-setup-panel-1lZ_btki.js +0 -3
  359. package/dist/gateway/static/root/assets/workflows-page-DFOhccm3.js +0 -6
  360. package/dist/src/extensions/when-context.d.ts +0 -6
  361. package/dist/src/extensions/when-context.js +0 -26
  362. package/dist/src/extensions/when-expression.d.ts +0 -11
  363. package/dist/src/extensions/when-expression.js +0 -213
@@ -3,8 +3,8 @@ import { init_logger } from "../../utils/logger.js";
3
3
  import { transcriptRowsToClientHistory } from "../../session/client-history.js";
4
4
  import { parseModelRef } from "../../agent/models/selection.js";
5
5
  import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
6
- import { gatewayCredentialAuthorization } from "../../gateway/credential.js";
7
6
  import { RealtimeClient } from "../../../packages/realtime-client/src/index.js";
7
+ import { gatewayCredentialAuthorization } from "../../gateway/credential.js";
8
8
  import { buildTuiTranscriptTree, transcriptTreeEntryIdToRowNumber } from "../tui-transcript-tree.js";
9
9
  import { computeTuiSessionStats } from "../tui-session-stats.js";
10
10
  import { createRequire } from "node:module";
@@ -224,7 +224,8 @@ var GatewayRealtimeBackend = class {
224
224
  const json = await res.json();
225
225
  return {
226
226
  ok: json.ok === true,
227
- effectiveDelivery: json.payload?.effectiveDelivery
227
+ effectiveDelivery: json.payload?.effectiveDelivery,
228
+ state: json.payload?.state
228
229
  };
229
230
  } catch {
230
231
  return { ok: false };
@@ -235,6 +236,28 @@ var GatewayRealtimeBackend = class {
235
236
  if (!res.ok) throw new Error(`Input state failed (${res.status})`);
236
237
  return (await res.json()).payload;
237
238
  }
239
+ async updateChatInput(opts) {
240
+ const res = await gatewayFetch(this.baseUrl, `/api/sessions/${encodeURIComponent(opts.conversationId)}/inputs/${encodeURIComponent(opts.inputId)}`, this.credential, {
241
+ method: "PATCH",
242
+ body: JSON.stringify({
243
+ version: opts.version,
244
+ content: opts.content
245
+ })
246
+ });
247
+ const json = await res.json().catch(() => ({}));
248
+ return {
249
+ ok: res.ok && json.ok === true,
250
+ state: json.payload
251
+ };
252
+ }
253
+ async removeChatInput(opts) {
254
+ const res = await gatewayFetch(this.baseUrl, `/api/sessions/${encodeURIComponent(opts.conversationId)}/inputs/${encodeURIComponent(opts.inputId)}?version=${opts.version}`, this.credential, { method: "DELETE" });
255
+ const json = await res.json().catch(() => ({}));
256
+ return {
257
+ ok: res.ok && json.ok === true,
258
+ state: json.payload
259
+ };
260
+ }
238
261
  async getStartupResources(conversationId) {
239
262
  const empty = {
240
263
  context: [],
@@ -726,12 +749,16 @@ var GatewayRealtimeBackend = class {
726
749
  method: "POST",
727
750
  body: JSON.stringify({
728
751
  clientId: this.clientId,
729
- clientKind: "tui"
752
+ clientKind: "tui",
753
+ protocolVersion: 2
730
754
  })
731
755
  });
732
756
  const body = await response.json().catch(() => null);
733
- if (!response.ok || !body?.payload?.ticket) throw new Error(body?.error?.message ?? `Realtime ticket failed (${response.status})`);
734
- return body.payload.ticket;
757
+ if (!response.ok || !body?.payload?.ticket || !body.payload.realtime) throw new Error(body?.error?.message ?? `Realtime ticket failed (${response.status})`);
758
+ return {
759
+ ticket: body.payload.ticket,
760
+ realtime: body.payload.realtime
761
+ };
735
762
  },
736
763
  createWebSocket: (url) => new WebSocket(url),
737
764
  onStateChange: (state, error) => {
@@ -1,21 +1,24 @@
1
1
  import type { AgentMessage } from '@earendil-works/pi-agent-core';
2
2
  import { Container } from '@earendil-works/pi-tui';
3
+ import type { CellRenderMode, ModeAwareCell } from './cell-render-mode.js';
3
4
  export type AssistantMessageOptions = {
4
5
  hideThinkingBlock?: boolean;
5
6
  hiddenThinkingLabel?: string;
6
7
  };
7
8
  export declare function createAssistantMessageFromText(text: string): AgentMessage;
8
- export declare class AssistantMessageComponent extends Container {
9
+ export declare class AssistantMessageComponent extends Container implements ModeAwareCell {
9
10
  private readonly contentContainer;
10
11
  private message;
11
12
  private linkedToolCall;
12
13
  private hideThinkingBlock;
13
14
  private hiddenThinkingLabel;
15
+ private renderMode;
14
16
  constructor(message?: AgentMessage, options?: AssistantMessageOptions);
15
17
  updateContent(message: AgentMessage): void;
16
18
  setHasToolCalls(hasTools: boolean): void;
17
19
  setHideThinkingBlock(hide: boolean): void;
18
20
  setHiddenThinkingLabel(label: string): void;
21
+ setRenderMode(mode: CellRenderMode): void;
19
22
  invalidate(): void;
20
23
  render(width: number): string[];
21
24
  private refresh;
@@ -101,6 +101,7 @@ var AssistantMessageComponent = class extends Container {
101
101
  linkedToolCall = false;
102
102
  hideThinkingBlock = false;
103
103
  hiddenThinkingLabel = "Thinking...";
104
+ renderMode = "compact";
104
105
  constructor(message, options = {}) {
105
106
  super();
106
107
  this.hideThinkingBlock = options.hideThinkingBlock ?? false;
@@ -126,11 +127,17 @@ var AssistantMessageComponent = class extends Container {
126
127
  this.hiddenThinkingLabel = label;
127
128
  this.refresh();
128
129
  }
130
+ setRenderMode(mode) {
131
+ if (this.renderMode === mode) return;
132
+ this.renderMode = mode;
133
+ this.refresh();
134
+ }
129
135
  invalidate() {
130
136
  super.invalidate();
131
137
  this.refresh();
132
138
  }
133
139
  render(width) {
140
+ if (this.renderMode === "raw") return new Text(JSON.stringify(this.message ?? {}, null, 2), 0, 0).render(width);
134
141
  const lines = super.render(width);
135
142
  if (hasToolCalls(this.message) || this.linkedToolCall || lines.length === 0) return lines;
136
143
  lines[0] = OSC133_ZONE_START + lines[0];
@@ -155,7 +162,8 @@ var AssistantMessageComponent = class extends Container {
155
162
  for (let i = 0; i < blocks.length; i++) {
156
163
  const block = blocks[i];
157
164
  if (block.type === "text") {
158
- const text = compactToolAdjacentText(blockText(block, "text"), this.linkedToolCall).trim();
165
+ const sourceText = blockText(block, "text");
166
+ const text = (this.renderMode === "compact" ? compactToolAdjacentText(sourceText, this.linkedToolCall) : sourceText).trim();
159
167
  if (!text) continue;
160
168
  if (renderedVisible > 0) this.contentContainer.addChild(new Spacer(1));
161
169
  this.contentContainer.addChild(new Markdown(text, 1, 0, markdownTheme, { color: (line) => theme.assistantText(line) }, { preserveOrderedListMarkers: true }));
@@ -164,7 +172,7 @@ var AssistantMessageComponent = class extends Container {
164
172
  const thinking = blockText(block, "thinking").trim();
165
173
  if (!thinking) continue;
166
174
  if (renderedVisible > 0) this.contentContainer.addChild(new Spacer(1));
167
- const text = this.hideThinkingBlock ? this.hiddenThinkingLabel : thinking;
175
+ const text = this.renderMode === "compact" && this.hideThinkingBlock ? this.hiddenThinkingLabel : thinking;
168
176
  this.contentContainer.addChild(new Markdown(text, 1, 0, markdownTheme, { color: (line) => theme.dim(theme.italic(line)) }, { preserveOrderedListMarkers: true }));
169
177
  renderedVisible++;
170
178
  } else if (block.type === "image" || block.type === "image_url") {
@@ -0,0 +1,4 @@
1
+ export type CellRenderMode = 'compact' | 'transcript' | 'raw';
2
+ export interface ModeAwareCell {
3
+ setRenderMode(mode: CellRenderMode): void;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,8 @@ import { type CustomMessageSummary } from './custom-message.js';
8
8
  import type { TuiMessageRenderer } from '../../extensions/types/tui.js';
9
9
  import { type ToolExecutionOptions } from './tool-execution.js';
10
10
  import type { TuiBranchSummary, TuiCompactionResult } from '../tui-backend.js';
11
+ import type { CellRenderMode } from './cell-render-mode.js';
12
+ import { type SemanticCellData } from './semantic-cell.js';
11
13
  export type ChatLogEntryMeta = {
12
14
  displayIndex?: number;
13
15
  historyIndex?: number;
@@ -22,11 +24,12 @@ export declare class ChatLog extends Container {
22
24
  private branchBlocks;
23
25
  private branchMessageBlocks;
24
26
  private customBlocks;
27
+ private semanticCells;
25
28
  private customMessageRenderers;
26
29
  private assistantMessages;
27
- private streamingRuns;
30
+ private activeAssistantByRun;
28
31
  /** After finalizeAssistant, late tool execution events can still arrive; keep the bubble to link tools. */
29
- private assistantAnchorByRunId;
32
+ private committedAssistantByRun;
30
33
  private runsWithTools;
31
34
  private toolsExpanded;
32
35
  private showThinking;
@@ -39,9 +42,10 @@ export declare class ChatLog extends Container {
39
42
  private entryRecords;
40
43
  private viewportRowsProvider;
41
44
  private historyViewDisplayIndex;
45
+ private renderMode;
46
+ private readonly activeCells;
47
+ private readonly committedCells;
42
48
  constructor(keybindings?: KeybindingsManager);
43
- private pruneOverflow;
44
- private dropReferences;
45
49
  private append;
46
50
  clearAll(): void;
47
51
  private createAssistantMessage;
@@ -52,6 +56,7 @@ export declare class ChatLog extends Container {
52
56
  addBranchSummary(summary: TuiBranchSummary): void;
53
57
  addBranchMessageSummary(summary: BranchMessageSummary): void;
54
58
  addCustomMessage(summary: CustomMessageSummary): void;
59
+ upsertSemanticCell(id: string, data: SemanticCellData): void;
55
60
  setCustomMessageRenderer(customType: string, renderer: TuiMessageRenderer | undefined): void;
56
61
  addUser(text: string | unknown[], meta?: ChatLogEntryMeta): void;
57
62
  /** Stream local `!command` output in a bordered block. */
@@ -72,6 +77,14 @@ export declare class ChatLog extends Container {
72
77
  setShowThinking(showThinking: boolean): void;
73
78
  setHiddenThinkingLabel(label?: string): void;
74
79
  setToolImageOptions(options: ToolExecutionOptions): void;
80
+ setRenderMode(mode: CellRenderMode): void;
81
+ getRenderMode(): CellRenderMode;
82
+ private applyRenderMode;
83
+ getCellLifecycleCounts(): {
84
+ active: number;
85
+ committed: number;
86
+ };
87
+ private commitCell;
75
88
  getLastAssistantText(): string;
76
89
  setViewportRowsProvider(provider: (() => number) | undefined): void;
77
90
  jumpToDisplayIndex(displayIndex: number): boolean;
@@ -8,9 +8,9 @@ import { CompactionSummaryComponent } from "./compaction-summary.js";
8
8
  import { CustomMessageComponent } from "./custom-message.js";
9
9
  import { ToolExecutionComponent } from "./tool-execution.js";
10
10
  import { UserMessageComponent } from "./user-message.js";
11
+ import { SemanticCellComponent } from "./semantic-cell.js";
11
12
  import { Container, Spacer, Text } from "@earendil-works/pi-tui";
12
13
  //#region src/tui/components/chat-log.ts
13
- const MAX_COMPONENTS = 180;
14
14
  function assistantPlainText(message) {
15
15
  const content = message.content;
16
16
  if (typeof content === "string") return content;
@@ -28,11 +28,12 @@ var ChatLog = class extends Container {
28
28
  branchBlocks = [];
29
29
  branchMessageBlocks = [];
30
30
  customBlocks = [];
31
+ semanticCells = /* @__PURE__ */ new Map();
31
32
  customMessageRenderers = /* @__PURE__ */ new Map();
32
33
  assistantMessages = [];
33
- streamingRuns = /* @__PURE__ */ new Map();
34
+ activeAssistantByRun = /* @__PURE__ */ new Map();
34
35
  /** After finalizeAssistant, late tool execution events can still arrive; keep the bubble to link tools. */
35
- assistantAnchorByRunId = /* @__PURE__ */ new Map();
36
+ committedAssistantByRun = /* @__PURE__ */ new Map();
36
37
  runsWithTools = /* @__PURE__ */ new Set();
37
38
  toolsExpanded = false;
38
39
  showThinking = true;
@@ -45,44 +46,22 @@ var ChatLog = class extends Container {
45
46
  entryRecords = [];
46
47
  viewportRowsProvider;
47
48
  historyViewDisplayIndex = null;
49
+ renderMode = "compact";
50
+ activeCells = /* @__PURE__ */ new Set();
51
+ committedCells = /* @__PURE__ */ new Set();
48
52
  constructor(keybindings) {
49
53
  super();
50
54
  this.keybindings = keybindings;
51
55
  if (keybindings) this.toolImageOptions.keybindings = keybindings;
52
56
  }
53
- pruneOverflow() {
54
- while (this.children.length > MAX_COMPONENTS) {
55
- const oldest = this.children[0];
56
- if (!oldest) return;
57
- this.removeChild(oldest);
58
- this.dropReferences(oldest);
59
- }
60
- }
61
- dropReferences(component) {
62
- for (const [id, tool] of this.toolById.entries()) if (tool === component) this.toolById.delete(id);
63
- for (const [runId, msg] of this.streamingRuns.entries()) if (msg === component) this.streamingRuns.delete(runId);
64
- for (const [runId, msg] of this.assistantAnchorByRunId.entries()) if (msg === component) this.assistantAnchorByRunId.delete(runId);
65
- this.bashBlocks = this.bashBlocks.filter((entry) => entry !== component);
66
- this.compactionBlocks = this.compactionBlocks.filter((entry) => entry !== component);
67
- this.branchBlocks = this.branchBlocks.filter((entry) => entry !== component);
68
- this.branchMessageBlocks = this.branchMessageBlocks.filter((entry) => entry !== component);
69
- this.customBlocks = this.customBlocks.filter((entry) => entry !== component);
70
- this.assistantMessages = this.assistantMessages.filter((entry) => entry !== component);
71
- if (this.lastStatusEntry === component) {
72
- this.lastStatusEntry = null;
73
- this.lastStatusText = null;
74
- }
75
- for (const [runId, status] of this.workflowStatusByRunId.entries()) if (status.entry === component) this.workflowStatusByRunId.delete(runId);
76
- this.entryRecords = this.entryRecords.filter((entry) => entry.component !== component);
77
- if (!this.findEntryRecord(this.historyViewDisplayIndex)) this.historyViewDisplayIndex = null;
78
- }
79
- append(component, meta) {
57
+ append(component, meta, lifecycle = "committed") {
80
58
  this.addChild(component);
59
+ (lifecycle === "active" ? this.activeCells : this.committedCells).add(component);
81
60
  if (meta) this.entryRecords.push({
82
61
  component,
83
62
  ...meta
84
63
  });
85
- this.pruneOverflow();
64
+ this.applyRenderMode(component);
86
65
  }
87
66
  clearAll() {
88
67
  this.clear();
@@ -92,9 +71,10 @@ var ChatLog = class extends Container {
92
71
  this.branchBlocks = [];
93
72
  this.branchMessageBlocks = [];
94
73
  this.customBlocks = [];
74
+ this.semanticCells.clear();
95
75
  this.assistantMessages = [];
96
- this.streamingRuns.clear();
97
- this.assistantAnchorByRunId.clear();
76
+ this.activeAssistantByRun.clear();
77
+ this.committedAssistantByRun.clear();
98
78
  this.runsWithTools.clear();
99
79
  this.lastAssistantText = "";
100
80
  this.lastStatusEntry = null;
@@ -102,6 +82,8 @@ var ChatLog = class extends Container {
102
82
  this.workflowStatusByRunId.clear();
103
83
  this.entryRecords = [];
104
84
  this.historyViewDisplayIndex = null;
85
+ this.activeCells.clear();
86
+ this.committedCells.clear();
105
87
  }
106
88
  createAssistantMessage(message) {
107
89
  const component = new AssistantMessageComponent(message, {
@@ -159,31 +141,42 @@ var ChatLog = class extends Container {
159
141
  this.append(component);
160
142
  }
161
143
  addBranchMessageSummary(summary) {
162
- this.assistantAnchorByRunId.clear();
144
+ this.committedAssistantByRun.clear();
163
145
  const component = new BranchMessageSummaryComponent(summary, this.keybindings);
164
146
  component.setExpanded(this.toolsExpanded);
165
147
  this.branchMessageBlocks.push(component);
166
148
  this.append(component);
167
149
  }
168
150
  addCustomMessage(summary) {
169
- this.assistantAnchorByRunId.clear();
151
+ this.committedAssistantByRun.clear();
170
152
  const component = new CustomMessageComponent(summary, this.customMessageRenderers.get(summary.customType));
171
153
  component.setExpanded(this.toolsExpanded);
172
154
  this.customBlocks.push(component);
173
155
  this.append(component);
174
156
  }
157
+ upsertSemanticCell(id, data) {
158
+ const existing = this.semanticCells.get(id);
159
+ if (existing) {
160
+ existing.update(data);
161
+ existing.invalidate();
162
+ return;
163
+ }
164
+ const component = new SemanticCellComponent(data);
165
+ this.semanticCells.set(id, component);
166
+ this.append(component);
167
+ }
175
168
  setCustomMessageRenderer(customType, renderer) {
176
169
  if (renderer) this.customMessageRenderers.set(customType, renderer);
177
170
  else this.customMessageRenderers.delete(customType);
178
171
  for (const block of this.customBlocks) if (block.matchesCustomType(customType)) block.setRenderer(renderer);
179
172
  }
180
173
  addUser(text, meta) {
181
- this.assistantAnchorByRunId.clear();
174
+ this.committedAssistantByRun.clear();
182
175
  this.append(new UserMessageComponent(text), meta);
183
176
  }
184
177
  /** Stream local `!command` output in a bordered block. */
185
178
  addBashExecution(command, ui, excludeFromContext) {
186
- this.assistantAnchorByRunId.clear();
179
+ this.committedAssistantByRun.clear();
187
180
  const component = new BashExecutionComponent(command, ui, excludeFromContext, this.keybindings);
188
181
  component.setExpanded(this.toolsExpanded);
189
182
  this.bashBlocks.push(component);
@@ -192,7 +185,7 @@ var ChatLog = class extends Container {
192
185
  }
193
186
  /** Replay a completed shell execution from persisted transcript history. */
194
187
  addBashSummary(summary) {
195
- this.assistantAnchorByRunId.clear();
188
+ this.committedAssistantByRun.clear();
196
189
  const component = new BashSummaryComponent(summary, this.keybindings);
197
190
  component.setExpanded(this.toolsExpanded);
198
191
  this.bashBlocks.push(component);
@@ -201,7 +194,7 @@ var ChatLog = class extends Container {
201
194
  startAssistant(message, runId) {
202
195
  const text = assistantPlainText(message);
203
196
  if (text.trim()) this.lastAssistantText = text;
204
- const existing = this.streamingRuns.get(runId);
197
+ const existing = this.activeAssistantByRun.get(runId);
205
198
  if (existing) {
206
199
  existing.updateContent(message);
207
200
  existing.setHasToolCalls(this.runsWithTools.has(runId));
@@ -209,13 +202,13 @@ var ChatLog = class extends Container {
209
202
  }
210
203
  const component = this.createAssistantMessage(message);
211
204
  component.setHasToolCalls(this.runsWithTools.has(runId));
212
- this.streamingRuns.set(runId, component);
213
- this.append(component);
205
+ this.activeAssistantByRun.set(runId, component);
206
+ this.append(component, void 0, "active");
214
207
  }
215
208
  updateAssistant(message, runId) {
216
209
  const text = assistantPlainText(message);
217
210
  if (text.trim()) this.lastAssistantText = text;
218
- const existing = this.streamingRuns.get(runId);
211
+ const existing = this.activeAssistantByRun.get(runId);
219
212
  if (!existing) {
220
213
  this.startAssistant(message, runId);
221
214
  return;
@@ -226,24 +219,26 @@ var ChatLog = class extends Container {
226
219
  finalizeAssistant(message, runId, meta) {
227
220
  const text = assistantPlainText(message);
228
221
  if (text.trim()) this.lastAssistantText = text;
229
- const existing = this.streamingRuns.get(runId);
222
+ const existing = this.activeAssistantByRun.get(runId);
230
223
  if (existing) {
231
224
  existing.updateContent(message);
232
225
  existing.setHasToolCalls(this.runsWithTools.has(runId));
233
- this.streamingRuns.delete(runId);
234
- this.assistantAnchorByRunId.set(runId, existing);
226
+ this.activeAssistantByRun.delete(runId);
227
+ this.committedAssistantByRun.set(runId, existing);
228
+ this.commitCell(existing);
235
229
  return;
236
230
  }
237
231
  const finalMessage = this.createAssistantMessage(message);
238
232
  finalMessage.setHasToolCalls(this.runsWithTools.has(runId));
239
233
  this.append(finalMessage, meta);
240
- if (text.trim()) this.assistantAnchorByRunId.set(runId, finalMessage);
234
+ if (text.trim()) this.committedAssistantByRun.set(runId, finalMessage);
241
235
  }
242
236
  dropAssistant(runId) {
243
- const existing = this.streamingRuns.get(runId);
237
+ const existing = this.activeAssistantByRun.get(runId);
244
238
  if (!existing) return;
245
239
  this.removeChild(existing);
246
- this.streamingRuns.delete(runId);
240
+ this.activeAssistantByRun.delete(runId);
241
+ this.activeCells.delete(existing);
247
242
  }
248
243
  startTool(toolCallId, toolName, args, runId) {
249
244
  const existing = this.toolById.get(toolCallId);
@@ -255,8 +250,8 @@ var ChatLog = class extends Container {
255
250
  const component = new ToolExecutionComponent(toolName, toolCallId, args, { ...this.toolImageOptions });
256
251
  component.setExpanded(this.toolsExpanded);
257
252
  this.toolById.set(toolCallId, component);
258
- (this.streamingRuns.get(runId) ?? this.assistantAnchorByRunId.get(runId))?.setHasToolCalls(true);
259
- this.append(component);
253
+ (this.activeAssistantByRun.get(runId) ?? this.committedAssistantByRun.get(runId))?.setHasToolCalls(true);
254
+ this.append(component, void 0, "active");
260
255
  }
261
256
  markToolExecutionStarted(toolCallId) {
262
257
  const existing = this.toolById.get(toolCallId);
@@ -272,6 +267,7 @@ var ChatLog = class extends Container {
272
267
  const existing = this.toolById.get(toolCallId);
273
268
  if (!existing) return;
274
269
  existing.updateResult(result, isPartial, isError);
270
+ if (!isPartial) this.commitCell(existing);
275
271
  }
276
272
  updateToolDetails(toolCallId, details) {
277
273
  const existing = this.toolById.get(toolCallId);
@@ -307,6 +303,28 @@ var ChatLog = class extends Container {
307
303
  };
308
304
  for (const tool of this.toolById.values()) tool.setImageOptions(this.toolImageOptions);
309
305
  }
306
+ setRenderMode(mode) {
307
+ if (this.renderMode === mode) return;
308
+ this.renderMode = mode;
309
+ for (const child of this.children) this.applyRenderMode(child);
310
+ this.invalidate();
311
+ }
312
+ getRenderMode() {
313
+ return this.renderMode;
314
+ }
315
+ applyRenderMode(component) {
316
+ component.setRenderMode?.(this.renderMode);
317
+ }
318
+ getCellLifecycleCounts() {
319
+ return {
320
+ active: this.activeCells.size,
321
+ committed: this.committedCells.size
322
+ };
323
+ }
324
+ commitCell(component) {
325
+ if (!this.activeCells.delete(component)) return;
326
+ this.committedCells.add(component);
327
+ }
310
328
  getLastAssistantText() {
311
329
  return this.lastAssistantText;
312
330
  }
@@ -5,14 +5,14 @@ import type { XopcTuiAppKeybinding } from '../xopc-tui-keybindings.js';
5
5
  */
6
6
  export declare class CustomEditor extends Editor {
7
7
  private readonly keybindings;
8
- readonly actionHandlers: Map<XopcTuiAppKeybinding, () => void>;
8
+ readonly actionHandlers: Map<XopcTuiAppKeybinding, () => boolean | void>;
9
9
  onEscape?: () => void;
10
10
  onCtrlD?: () => void;
11
11
  onCtrlC?: () => void;
12
12
  onPasteImage?: () => void;
13
13
  onExtensionShortcut?: (data: string) => boolean;
14
14
  constructor(tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager, options?: EditorOptions);
15
- onAction(action: XopcTuiAppKeybinding, handler: () => void): void;
15
+ onAction(action: XopcTuiAppKeybinding, handler: () => boolean | void): void;
16
16
  replaceHistory(itemsNewestFirst: string[]): void;
17
17
  handleInput(data: string): void;
18
18
  }
@@ -51,7 +51,11 @@ var CustomEditor = class extends Editor {
51
51
  for (const [action, handler] of this.actionHandlers) {
52
52
  if (action === "app.interrupt" || action === "app.exit") continue;
53
53
  if (this.keybindings.matches(data, action)) {
54
- (action === "app.clear" ? this.onCtrlC ?? handler : handler)();
54
+ if (action === "app.message.followUp" && this.isShowingAutocomplete()) {
55
+ super.handleInput(data);
56
+ return;
57
+ }
58
+ if ((action === "app.clear" ? this.onCtrlC ?? handler : handler)() === false) super.handleInput(data);
55
59
  return;
56
60
  }
57
61
  }
@@ -0,0 +1,9 @@
1
+ import type { Component, KeybindingsManager } from '@earendil-works/pi-tui';
2
+ import { type TuiChatInputState } from '../tui-chat-input-state.js';
3
+ export declare class PendingInputPreview implements Component {
4
+ private readonly getState;
5
+ private readonly keybindings;
6
+ constructor(getState: () => TuiChatInputState, keybindings: KeybindingsManager);
7
+ invalidate(): void;
8
+ render(width: number): string[];
9
+ }
@@ -0,0 +1,33 @@
1
+ import { theme } from "../theme.js";
2
+ import { formatKeyIds } from "../format-tui-hotkeys.js";
3
+ import { findLastEditableChatInput, isPendingChatInput } from "../tui-chat-input-state.js";
4
+ import { sanitizeStatusText } from "./tui-bottom-bar.js";
5
+ import { truncateToWidth } from "@earendil-works/pi-tui";
6
+ //#region src/tui/components/pending-input-preview.ts
7
+ function labelForInput(input) {
8
+ if (input.status === "injecting") return "Steering";
9
+ if (input.requestedDelivery === "steer" && input.effectiveDelivery === "next") return "Deferred steer";
10
+ if (input.status === "interrupted") return "Interrupted";
11
+ return "Follow-up";
12
+ }
13
+ var PendingInputPreview = class {
14
+ constructor(getState, keybindings) {
15
+ this.getState = getState;
16
+ this.keybindings = keybindings;
17
+ }
18
+ invalidate() {}
19
+ render(width) {
20
+ const state = this.getState();
21
+ const inputs = state.inputs.filter(isPendingChatInput);
22
+ if (inputs.length === 0) return [];
23
+ const actions = findLastEditableChatInput(state) ? ` · ${formatKeyIds(this.keybindings, "app.message.editQueued", { capitalize: true })} edit last · ${formatKeyIds(this.keybindings, "app.message.deleteQueued", { capitalize: true })} remove last` : "";
24
+ const lines = [truncateToWidth(theme.dim(`Pending inputs (${inputs.length})${actions}`), width, theme.dim("…"))];
25
+ for (const input of inputs) {
26
+ const content = sanitizeStatusText(input.content) || "(empty)";
27
+ lines.push(truncateToWidth(theme.dim(` ${labelForInput(input)}: ${content}`), width, theme.dim("…")));
28
+ }
29
+ return lines;
30
+ }
31
+ };
32
+ //#endregion
33
+ export { PendingInputPreview };
@@ -0,0 +1,17 @@
1
+ import { Container } from '@earendil-works/pi-tui';
2
+ import type { CellRenderMode, ModeAwareCell } from './cell-render-mode.js';
3
+ export type SemanticCellKind = 'plan' | 'web' | 'approval' | 'question' | 'mcp';
4
+ export interface SemanticCellData {
5
+ kind: SemanticCellKind;
6
+ title: string;
7
+ lines?: string[];
8
+ raw?: unknown;
9
+ }
10
+ export declare class SemanticCellComponent extends Container implements ModeAwareCell {
11
+ private data;
12
+ private renderMode;
13
+ constructor(data: SemanticCellData);
14
+ update(data: SemanticCellData): void;
15
+ setRenderMode(mode: CellRenderMode): void;
16
+ render(width: number): string[];
17
+ }
@@ -0,0 +1,29 @@
1
+ import { theme } from "../theme.js";
2
+ import { Container, Spacer, Text } from "@earendil-works/pi-tui";
3
+ //#region src/tui/components/semantic-cell.ts
4
+ var SemanticCellComponent = class extends Container {
5
+ renderMode = "compact";
6
+ constructor(data) {
7
+ super();
8
+ this.data = data;
9
+ }
10
+ update(data) {
11
+ this.data = data;
12
+ }
13
+ setRenderMode(mode) {
14
+ this.renderMode = mode;
15
+ }
16
+ render(width) {
17
+ if (this.renderMode === "raw") return new Text(JSON.stringify(this.data.raw ?? this.data, null, 2), 0, 0).render(width);
18
+ const body = new Container();
19
+ body.addChild(new Spacer(1));
20
+ body.addChild(new Text(theme.bold(theme.accent(`${this.data.kind.toUpperCase()} · ${this.data.title}`)), 1, 0));
21
+ const lines = this.data.lines ?? [];
22
+ const visible = this.renderMode === "compact" ? lines.slice(0, 4) : lines;
23
+ for (const line of visible) body.addChild(new Text(theme.dim(line), 3, 0));
24
+ if (visible.length < lines.length) body.addChild(new Text(theme.dim(`… ${lines.length - visible.length} more`), 3, 0));
25
+ return body.render(width);
26
+ }
27
+ };
28
+ //#endregion
29
+ export { SemanticCellComponent };
@@ -1,6 +1,7 @@
1
1
  import { Container, type KeybindingsManager } from '@earendil-works/pi-tui';
2
2
  import type { AgentToolResult } from '@earendil-works/pi-agent-core';
3
3
  import { type TuiToolContentBlock } from '../tui-tool-result.js';
4
+ import type { CellRenderMode, ModeAwareCell } from './cell-render-mode.js';
4
5
  export interface ToolExecutionOptions {
5
6
  showImages?: boolean;
6
7
  imageWidthCells?: number;
@@ -12,7 +13,7 @@ export declare function getToolResultDisplayText(content: TuiToolContentBlock[],
12
13
  showImages: boolean;
13
14
  supportsInlineImages: boolean;
14
15
  }): string;
15
- export declare class ToolExecutionComponent extends Container {
16
+ export declare class ToolExecutionComponent extends Container implements ModeAwareCell {
16
17
  private contentContainer;
17
18
  private contentText;
18
19
  private collapsedOutputComponent;
@@ -45,11 +46,14 @@ export declare class ToolExecutionComponent extends Container {
45
46
  private executionStarted;
46
47
  private startedAt;
47
48
  private completedAt;
49
+ private renderMode;
48
50
  constructor(toolName: string, toolCallId: string, args: unknown, options?: ToolExecutionOptions);
49
51
  setArgs(args: unknown): void;
50
52
  markExecutionStarted(): void;
51
53
  setArgsComplete(): void;
52
54
  setExpanded(expanded: boolean): void;
55
+ setRenderMode(mode: CellRenderMode): void;
56
+ render(width: number): string[];
53
57
  updateResult(result: AgentToolResult<any> | unknown, isPartial?: boolean, isError?: boolean): void;
54
58
  setImageOptions(options: ToolExecutionOptions): void;
55
59
  setPartialDetails(details: unknown): void;