@abot-ai/runtime 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/README.md +2 -0
  2. package/dist/src/bridge/request-steering.js +60 -15
  3. package/dist/src/capabilities/normal-invocation/contracts.d.ts +3 -0
  4. package/dist/src/capabilities/normal-invocation/output-channels.d.ts +10 -0
  5. package/dist/src/capabilities/normal-invocation/output-channels.js +29 -0
  6. package/dist/src/capabilities/normal-invocation/validator.js +4 -2
  7. package/dist/src/capabilities/tool-types.d.ts +1 -1
  8. package/dist/src/cli/host-companion-bundle.mjs +7570 -6781
  9. package/dist/src/cli/host-companion-entry.js +5 -22
  10. package/dist/src/cli/host-companion-input.d.ts +3 -0
  11. package/dist/src/cli/host-companion-input.js +21 -0
  12. package/dist/src/cli/host-companion-lifecycle.d.ts +11 -0
  13. package/dist/src/cli/host-companion-lifecycle.js +32 -0
  14. package/dist/src/cli/host-companion-setup-target.d.ts +4 -0
  15. package/dist/src/cli/host-companion-setup-target.js +17 -0
  16. package/dist/src/cli/host-companion-startup.d.ts +2 -0
  17. package/dist/src/cli/host-companion-startup.js +7 -2
  18. package/dist/src/cli/host-companion.d.ts +6 -0
  19. package/dist/src/cli/host-companion.js +30 -27
  20. package/dist/src/cli/windows-companion-store-entry.d.ts +9 -0
  21. package/dist/src/cli/windows-companion-store-entry.js +67 -0
  22. package/dist/src/computer-access/command-output-capture.d.ts +37 -0
  23. package/dist/src/computer-access/command-output-capture.js +136 -0
  24. package/dist/src/computer-access/command-output-retention.d.ts +5 -0
  25. package/dist/src/computer-access/command-output-retention.js +90 -0
  26. package/dist/src/computer-access/command-output.d.ts +7 -0
  27. package/dist/src/computer-access/command-output.js +1 -0
  28. package/dist/src/computer-access/commands.d.ts +1 -0
  29. package/dist/src/computer-access/commands.js +1 -1
  30. package/dist/src/computer-access/companion/command-output-protocol.d.ts +12 -0
  31. package/dist/src/computer-access/companion/command-output-protocol.js +28 -0
  32. package/dist/src/computer-access/companion/command-output.d.ts +13 -0
  33. package/dist/src/computer-access/companion/command-output.js +110 -0
  34. package/dist/src/computer-access/companion/install-link-macos.d.ts +7 -0
  35. package/dist/src/computer-access/companion/install-link-macos.js +48 -0
  36. package/dist/src/computer-access/companion/install-link-registration.d.ts +4 -0
  37. package/dist/src/computer-access/companion/install-link-registration.js +184 -0
  38. package/dist/src/computer-access/companion/install-link-windows.d.ts +4 -0
  39. package/dist/src/computer-access/companion/install-link-windows.js +65 -0
  40. package/dist/src/computer-access/companion/install-link.d.ts +9 -0
  41. package/dist/src/computer-access/companion/install-link.js +54 -0
  42. package/dist/src/computer-access/companion/native-messages.js +3 -0
  43. package/dist/src/computer-access/companion/native-session.d.ts +1 -0
  44. package/dist/src/computer-access/companion/native-session.js +14 -2
  45. package/dist/src/computer-access/companion/native-supervisor.js +1 -0
  46. package/dist/src/computer-access/companion/notification-windows.d.ts +1 -1
  47. package/dist/src/computer-access/companion/notification-windows.js +8 -3
  48. package/dist/src/computer-access/companion/protocol.d.ts +1 -1
  49. package/dist/src/computer-access/companion/protocol.js +6 -0
  50. package/dist/src/computer-access/companion/release-version.d.ts +1 -1
  51. package/dist/src/computer-access/companion/release-version.js +1 -1
  52. package/dist/src/computer-access/companion/windows-store/connection-error.d.ts +7 -0
  53. package/dist/src/computer-access/companion/windows-store/connection-error.js +19 -0
  54. package/dist/src/computer-access/companion/windows-store/connection-link.d.ts +13 -0
  55. package/dist/src/computer-access/companion/windows-store/connection-link.js +109 -0
  56. package/dist/src/computer-access/companion/windows-store/identity.d.ts +13 -0
  57. package/dist/src/computer-access/companion/windows-store/identity.js +13 -0
  58. package/dist/src/computer-access/companion/windows-store/lifecycle.d.ts +5 -0
  59. package/dist/src/computer-access/companion/windows-store/lifecycle.js +90 -0
  60. package/dist/src/computer-access/contracts.d.ts +1 -1
  61. package/dist/src/computer-access/handlers.d.ts +2 -1
  62. package/dist/src/computer-access/handlers.js +5 -1
  63. package/dist/src/computer-access/process-capture.d.ts +6 -0
  64. package/dist/src/computer-access/process-capture.js +1 -0
  65. package/dist/src/computer-access/process-result.d.ts +2 -0
  66. package/dist/src/computer-access/process-result.js +14 -6
  67. package/dist/src/computer-access/process-runner.d.ts +2 -1
  68. package/dist/src/computer-access/process-runner.js +21 -13
  69. package/dist/src/model-gateway/server/configuration.d.ts +2 -0
  70. package/dist/src/model-gateway/server/configuration.js +73 -21
  71. package/dist/src/plugin-contract/install-source.d.ts +13 -0
  72. package/dist/src/plugin-contract/install-source.js +99 -0
  73. package/dist/src/plugin-contract/manifest.d.ts +2 -1
  74. package/dist/src/plugin-sdk/computer-access.d.ts +8 -0
  75. package/dist/src/plugin-sdk/computer-access.js +5 -0
  76. package/dist/src/runtime/adapters/in-memory-session-store.js +6 -16
  77. package/dist/src/runtime/admin/config-control.js +2 -1
  78. package/dist/src/runtime/automations/catalog.d.ts +3 -0
  79. package/dist/src/runtime/automations/catalog.js +1 -0
  80. package/dist/src/runtime/automations/model-dependency-projection.d.ts +2 -0
  81. package/dist/src/runtime/automations/service.d.ts +2 -0
  82. package/dist/src/runtime/capabilities/automation-builder/authoring-reference.d.ts +10 -5
  83. package/dist/src/runtime/capabilities/automation-builder/authoring-reference.js +8 -7
  84. package/dist/src/runtime/capabilities/automation-builder/payload-instructions.d.ts +2 -2
  85. package/dist/src/runtime/capabilities/automation-builder/payload-instructions.js +2 -2
  86. package/dist/src/runtime/capabilities/automation-builder/tool-contract.d.ts +2 -2
  87. package/dist/src/runtime/capabilities/automations/authoring-catalog.js +1 -1
  88. package/dist/src/runtime/capabilities/automations/authoring-preparation.d.ts +11 -5
  89. package/dist/src/runtime/capabilities/automations/tool-module.js +1 -1
  90. package/dist/src/runtime/capabilities/request-permission-catalog.d.ts +3 -1
  91. package/dist/src/runtime/capabilities/request-permission-catalog.js +21 -2
  92. package/dist/src/runtime/capabilities/request-permission-tool-registry.d.ts +2 -1
  93. package/dist/src/runtime/capabilities/request-permission-tool-registry.js +18 -10
  94. package/dist/src/runtime/capabilities/request-runtime-tool-registry.d.ts +2 -0
  95. package/dist/src/runtime/capabilities/request-runtime-tool-registry.js +1 -1
  96. package/dist/src/runtime/capabilities/scheduling/create-operations.d.ts +6 -0
  97. package/dist/src/runtime/config/builders.js +6 -5
  98. package/dist/src/runtime/config/effective-model-config-validation.js +4 -35
  99. package/dist/src/runtime/config/fields.js +15 -0
  100. package/dist/src/runtime/config/model-context-capacity.d.ts +20 -0
  101. package/dist/src/runtime/config/model-context-capacity.js +55 -0
  102. package/dist/src/runtime/config/model-execution-policy.d.ts +5 -1
  103. package/dist/src/runtime/config/model-execution-policy.js +16 -0
  104. package/dist/src/runtime/config/model-plugin-config.d.ts +8 -0
  105. package/dist/src/runtime/config/model-plugin-config.js +40 -0
  106. package/dist/src/runtime/config/schema.js +5 -1
  107. package/dist/src/runtime/config/validation/model-profile-validation.js +2 -0
  108. package/dist/src/runtime/config/validation/runtime-config-validation-contract.d.ts +3 -1
  109. package/dist/src/runtime/config/validation/runtime-config-validation-contract.js +3 -1
  110. package/dist/src/runtime/config/validation/runtime-root-section-validation.js +11 -4
  111. package/dist/src/runtime/config/validation/web-ui-config-validation.js +3 -2
  112. package/dist/src/runtime/config/web-ui.d.ts +5 -0
  113. package/dist/src/runtime/config/web-ui.js +5 -0
  114. package/dist/src/runtime/config.js +2 -0
  115. package/dist/src/runtime/local-application.d.ts +2 -0
  116. package/dist/src/runtime/local-host/app-owner.js +50 -6
  117. package/dist/src/runtime/local-host/app-request-control.d.ts +3 -1
  118. package/dist/src/runtime/local-host/app-request-control.js +91 -11
  119. package/dist/src/runtime/local-host/client-requests.js +32 -5
  120. package/dist/src/runtime/local-host/client-services.d.ts +2 -0
  121. package/dist/src/runtime/local-host/local-request-diagnostics.d.ts +9 -0
  122. package/dist/src/runtime/local-host/local-request-diagnostics.js +47 -0
  123. package/dist/src/runtime/local-host/saved-approvals.js +23 -2
  124. package/dist/src/runtime/model/model-selection.js +4 -1
  125. package/dist/src/runtime/observability/request-control-diagnostics.d.ts +6 -0
  126. package/dist/src/runtime/observability/request-control-diagnostics.js +52 -0
  127. package/dist/src/runtime/plugins/configuration-context.d.ts +9 -0
  128. package/dist/src/runtime/plugins/configuration-context.js +42 -0
  129. package/dist/src/runtime/plugins/configuration-settings.d.ts +2 -0
  130. package/dist/src/runtime/plugins/configuration-settings.js +26 -0
  131. package/dist/src/runtime/plugins/configuration-store.d.ts +23 -0
  132. package/dist/src/runtime/plugins/configuration-store.js +100 -0
  133. package/dist/src/runtime/plugins/configuration-write.d.ts +5 -0
  134. package/dist/src/runtime/plugins/configuration-write.js +58 -0
  135. package/dist/src/runtime/plugins/installation/archive.d.ts +2 -0
  136. package/dist/src/runtime/plugins/installation/archive.js +107 -0
  137. package/dist/src/runtime/plugins/installation/github-download.d.ts +9 -0
  138. package/dist/src/runtime/plugins/installation/github-download.js +72 -0
  139. package/dist/src/runtime/plugins/installation/installed-package.d.ts +9 -0
  140. package/dist/src/runtime/plugins/installation/installed-package.js +66 -0
  141. package/dist/src/runtime/plugins/installation/package.d.ts +45 -0
  142. package/dist/src/runtime/plugins/installation/package.js +79 -0
  143. package/dist/src/runtime/plugins/installation/portable-path.d.ts +2 -0
  144. package/dist/src/runtime/plugins/installation/portable-path.js +10 -0
  145. package/dist/src/runtime/plugins/installation/publication.d.ts +10 -0
  146. package/dist/src/runtime/plugins/installation/publication.js +17 -0
  147. package/dist/src/runtime/plugins/installation/service.d.ts +41 -0
  148. package/dist/src/runtime/plugins/installation/service.js +80 -0
  149. package/dist/src/runtime/plugins/loader.js +15 -29
  150. package/dist/src/runtime/plugins/manifest-projection.js +1 -0
  151. package/dist/src/runtime/plugins/manifest-validator.js +3 -0
  152. package/dist/src/runtime/plugins/module-cache.d.ts +2 -0
  153. package/dist/src/runtime/plugins/module-cache.js +19 -0
  154. package/dist/src/runtime/plugins/selection.d.ts +2 -0
  155. package/dist/src/runtime/plugins/selection.js +16 -11
  156. package/dist/src/runtime/ports.d.ts +6 -4
  157. package/dist/src/runtime/request/dependencies.d.ts +2 -1
  158. package/dist/src/runtime/request/execution-payload-compacted-evidence.d.ts +1 -1
  159. package/dist/src/runtime/request/handler.js +8 -0
  160. package/dist/src/runtime/request/prepared-execution.js +6 -1
  161. package/dist/src/runtime/request/request-steering.d.ts +4 -0
  162. package/dist/src/runtime/request/request-steering.js +37 -12
  163. package/dist/src/runtime/request/worker-capability-composition.d.ts +2 -0
  164. package/dist/src/runtime/request/worker-capability-composition.js +4 -1
  165. package/dist/src/runtime/scheduler/journal-index-state.d.ts +1 -1
  166. package/dist/src/sessions/assistant-initiative-message.d.ts +3 -0
  167. package/dist/src/sessions/assistant-initiative-message.js +12 -0
  168. package/dist/src/sessions/assistant-initiative.d.ts +2 -2
  169. package/dist/src/sessions/assistant-initiative.js +1 -7
  170. package/dist/src/sessions/durable-session-commit.d.ts +2 -1
  171. package/dist/src/sessions/durable-session-commit.js +6 -1
  172. package/dist/src/sessions/metadata/projection.d.ts +15 -0
  173. package/dist/src/sessions/metadata/projection.js +55 -0
  174. package/dist/src/sessions/metadata/publication.d.ts +12 -0
  175. package/dist/src/sessions/metadata/publication.js +78 -0
  176. package/dist/src/sessions/metadata/source-receipt.d.ts +5 -0
  177. package/dist/src/sessions/metadata/source-receipt.js +42 -0
  178. package/dist/src/sessions/metadata/store.d.ts +7 -0
  179. package/dist/src/sessions/metadata/store.js +119 -0
  180. package/dist/src/sessions/record/projection.d.ts +3 -1
  181. package/dist/src/sessions/record/projection.js +26 -18
  182. package/dist/src/sessions/request-lifecycle/service.js +3 -3
  183. package/dist/src/sessions/session-service.d.ts +2 -4
  184. package/dist/src/sessions/session-service.js +4 -16
  185. package/dist/src/sessions/session-store.d.ts +2 -1
  186. package/dist/src/sessions/session-store.js +9 -3
  187. package/dist/src/sessions/snapshot.d.ts +17 -0
  188. package/dist/src/sessions/snapshot.js +105 -0
  189. package/dist/src/sessions/types.d.ts +2 -0
  190. package/dist/src/shared/tool-selection.d.ts +2 -0
  191. package/dist/src/shared/tool-selection.js +7 -0
  192. package/dist/src/web-ui/app/ARCHITECTURE.md +14 -0
  193. package/dist/src/web-ui/app/app.js +6 -3
  194. package/dist/src/web-ui/app/components/config-workspace/config-model.js +2 -0
  195. package/dist/src/web-ui/app/components/config-workspace/model-plugin-permissions.js +130 -0
  196. package/dist/src/web-ui/app/components/config-workspace/model-plugin-selection.js +180 -0
  197. package/dist/src/web-ui/app/components/config-workspace/model-plugin-view-state.js +114 -0
  198. package/dist/src/web-ui/app/components/config-workspace/model-rendering.js +3 -0
  199. package/dist/src/web-ui/app/components/config-workspace/model-summary.js +39 -0
  200. package/dist/src/web-ui/app/components/config-workspace/summary-rendering.js +30 -0
  201. package/dist/src/web-ui/app/components/config-workspace/workspace-events.js +37 -0
  202. package/dist/src/web-ui/app/components/config-workspace/workspace-mutations.js +2 -0
  203. package/dist/src/web-ui/app/components/config-workspace/workspace-persistence.js +9 -1
  204. package/dist/src/web-ui/app/components/config-workspace/workspace-view.js +23 -67
  205. package/dist/src/web-ui/app/components/config-workspace.js +11 -2
  206. package/dist/src/web-ui/app/components/conversation-view.js +36 -5
  207. package/dist/src/web-ui/app/components/dashboard/recent-conversations.js +2 -1
  208. package/dist/src/web-ui/app/components/dashboard/workspace.js +2 -1
  209. package/dist/src/web-ui/app/components/operations-summary.js +105 -0
  210. package/dist/src/web-ui/app/components/passive-learning/home.js +1 -9
  211. package/dist/src/web-ui/app/components/plugins/configuration-draft.js +34 -0
  212. package/dist/src/web-ui/app/components/plugins/configuration-editor.js +147 -0
  213. package/dist/src/web-ui/app/components/plugins/configuration-fields.js +103 -0
  214. package/dist/src/web-ui/app/components/plugins/configuration-retained-secrets.js +20 -0
  215. package/dist/src/web-ui/app/components/plugins/configuration-settings.js +108 -0
  216. package/dist/src/web-ui/app/components/plugins/discovery-rendering.js +37 -0
  217. package/dist/src/web-ui/app/components/plugins/installation.js +212 -0
  218. package/dist/src/web-ui/app/components/plugins/manager.js +160 -6
  219. package/dist/src/web-ui/app/components/plugins/removal.js +130 -0
  220. package/dist/src/web-ui/app/components/plugins/rendering.js +14 -2
  221. package/dist/src/web-ui/app/components/plugins/summary.js +54 -0
  222. package/dist/src/web-ui/app/components/plugins/tabs.js +31 -0
  223. package/dist/src/web-ui/app/components/plugins/view-state.js +3 -1
  224. package/dist/src/web-ui/app/components/runtime-setup/connection-form.js +5 -2
  225. package/dist/src/web-ui/app/components/runtime-setup/connection-state.js +9 -1
  226. package/dist/src/web-ui/app/components/runtime-setup/context-window-feedback.js +71 -0
  227. package/dist/src/web-ui/app/components/runtime-setup/optional-steps.js +2 -0
  228. package/dist/src/web-ui/app/components/runtime-setup-guide.js +15 -3
  229. package/dist/src/web-ui/app/components/spark-chat/empty-state.js +1 -0
  230. package/dist/src/web-ui/app/components/spark-chat/panel.js +1 -0
  231. package/dist/src/web-ui/app/components/system-host/connection-card.js +35 -0
  232. package/dist/src/web-ui/app/components/system-host/macos-setup.js +1 -1
  233. package/dist/src/web-ui/app/components/system-host/manager.js +45 -12
  234. package/dist/src/web-ui/app/components/system-host/rendering.js +111 -106
  235. package/dist/src/web-ui/app/components/system-host/windows-store-setup.js +293 -0
  236. package/dist/src/web-ui/app/components/workspace-shell.js +6 -0
  237. package/dist/src/web-ui/app/computer-access-feature.js +22 -5
  238. package/dist/src/web-ui/app/configuration-feature.js +35 -2
  239. package/dist/src/web-ui/app/controllers/app-event-bindings.js +4 -1
  240. package/dist/src/web-ui/app/controllers/conversation-read-state-controller.d.ts +1 -0
  241. package/dist/src/web-ui/app/controllers/conversation-read-state-controller.js +7 -3
  242. package/dist/src/web-ui/app/controllers/conversation-request-hydration.js +88 -0
  243. package/dist/src/web-ui/app/controllers/conversation-session-controller.d.ts +9 -3
  244. package/dist/src/web-ui/app/controllers/conversation-session-controller.js +52 -144
  245. package/dist/src/web-ui/app/controllers/history-pagination.js +111 -0
  246. package/dist/src/web-ui/app/controllers/operations-controller.d.ts +12 -0
  247. package/dist/src/web-ui/app/controllers/operations-controller.js +28 -21
  248. package/dist/src/web-ui/app/controllers/runtime-onboarding-controller.d.ts +1 -0
  249. package/dist/src/web-ui/app/controllers/runtime-onboarding-controller.js +11 -0
  250. package/dist/src/web-ui/app/controllers/session-controller.js +10 -2
  251. package/dist/src/web-ui/app/controllers/session-list-pagination.js +71 -0
  252. package/dist/src/web-ui/app/controllers/session-sidebar-controller.js +6 -4
  253. package/dist/src/web-ui/app/controllers/spark-chat-reading.js +1 -0
  254. package/dist/src/web-ui/app/controllers/spark-chat-sync.js +24 -5
  255. package/dist/src/web-ui/app/controllers/workspace-route-controller.js +21 -19
  256. package/dist/src/web-ui/app/dashboard-feature.js +2 -2
  257. package/dist/src/web-ui/app/index.html +6 -2
  258. package/dist/src/web-ui/app/lib/history-page-messages.js +49 -0
  259. package/dist/src/web-ui/app/lib/request-lifecycle-view.js +8 -0
  260. package/dist/src/web-ui/app/lib/workspace-route.d.ts +3 -0
  261. package/dist/src/web-ui/app/lib/workspace-route.js +4 -0
  262. package/dist/src/web-ui/app/passive-learning-feature.js +0 -1
  263. package/dist/src/web-ui/app/runtime-onboarding-feature.js +3 -0
  264. package/dist/src/web-ui/app/schedules-feature.js +1 -1
  265. package/dist/src/web-ui/app/services/runtime-web-client/configuration.js +20 -0
  266. package/dist/src/web-ui/app/services/runtime-web-client/plugin-configuration.js +19 -0
  267. package/dist/src/web-ui/app/services/runtime-web-client/spark-chat.js +4 -4
  268. package/dist/src/web-ui/app/services/runtime-web-client/system-host.js +2 -0
  269. package/dist/src/web-ui/app/services/runtime-web-client.d.ts +6 -1
  270. package/dist/src/web-ui/app/services/runtime-web-client.js +12 -3
  271. package/dist/src/web-ui/app/spark-chat-feature.js +76 -19
  272. package/dist/src/web-ui/app/styles/11-product-links.css +30 -0
  273. package/dist/src/web-ui/app/styles/41-plugin-configuration.css +79 -0
  274. package/dist/src/web-ui/app/styles/41-plugin-discovery.css +132 -0
  275. package/dist/src/web-ui/app/styles/41-plugin-management.css +6 -0
  276. package/dist/src/web-ui/app/styles/42-model-plugin-permissions.css +173 -0
  277. package/dist/src/web-ui/app/styles/46-system-host.css +61 -107
  278. package/dist/src/web-ui/app/styles/47-config-controls.css +13 -1
  279. package/dist/src/web-ui/app/styles/54-spark-chat.css +33 -1
  280. package/dist/src/web-ui/app/styles.css +4 -0
  281. package/dist/src/web-ui/local-runtime/api-router.js +11 -6
  282. package/dist/src/web-ui/local-runtime/approval-request-attachment.js +14 -5
  283. package/dist/src/web-ui/local-runtime/configuration-activation-source.d.ts +1 -1
  284. package/dist/src/web-ui/local-runtime/configuration-activation-source.js +9 -3
  285. package/dist/src/web-ui/local-runtime/contracts.d.ts +4 -3
  286. package/dist/src/web-ui/local-runtime/environment-registry.d.ts +5 -1
  287. package/dist/src/web-ui/local-runtime/environment-registry.js +53 -11
  288. package/dist/src/web-ui/local-runtime/history-pagination.d.ts +16 -0
  289. package/dist/src/web-ui/local-runtime/history-pagination.js +20 -0
  290. package/dist/src/web-ui/local-runtime/plugin-configuration-routes.d.ts +16 -0
  291. package/dist/src/web-ui/local-runtime/plugin-configuration-routes.js +68 -0
  292. package/dist/src/web-ui/local-runtime/plugin-installation-routes.d.ts +16 -0
  293. package/dist/src/web-ui/local-runtime/plugin-installation-routes.js +96 -0
  294. package/dist/src/web-ui/local-runtime/plugin-management-routes.d.ts +8 -1
  295. package/dist/src/web-ui/local-runtime/plugin-management-routes.js +17 -0
  296. package/dist/src/web-ui/local-runtime/plugin-mutation-admission.d.ts +7 -0
  297. package/dist/src/web-ui/local-runtime/plugin-mutation-admission.js +17 -0
  298. package/dist/src/web-ui/local-runtime/plugin-removal-routes.d.ts +18 -0
  299. package/dist/src/web-ui/local-runtime/plugin-removal-routes.js +60 -0
  300. package/dist/src/web-ui/local-runtime/realtime-controller.js +41 -2
  301. package/dist/src/web-ui/local-runtime/request-cancellation-route.js +28 -1
  302. package/dist/src/web-ui/local-runtime/request-control-observation.d.ts +19 -0
  303. package/dist/src/web-ui/local-runtime/request-control-observation.js +80 -0
  304. package/dist/src/web-ui/local-runtime/request-execution.js +69 -37
  305. package/dist/src/web-ui/local-runtime/runtime-setup-context-window.d.ts +20 -0
  306. package/dist/src/web-ui/local-runtime/runtime-setup-context-window.js +44 -0
  307. package/dist/src/web-ui/local-runtime/runtime-setup-routes.js +2 -0
  308. package/dist/src/web-ui/local-runtime/runtime-setup-validation.js +9 -2
  309. package/dist/src/web-ui/local-runtime/session-routes.d.ts +1 -0
  310. package/dist/src/web-ui/local-runtime/session-routes.js +16 -4
  311. package/dist/src/web-ui/local-runtime/spark-chat-routes.js +4 -3
  312. package/dist/src/web-ui/plugin-capability-selection.js +4 -1
  313. package/dist/src/web-ui/plugin-configuration-input.d.ts +12 -0
  314. package/dist/src/web-ui/plugin-configuration-input.js +68 -0
  315. package/dist/src/web-ui/plugin-configuration-retained-secrets.d.ts +9 -0
  316. package/dist/src/web-ui/plugin-configuration-retained-secrets.js +48 -0
  317. package/dist/src/web-ui/plugin-configuration-service.d.ts +52 -0
  318. package/dist/src/web-ui/plugin-configuration-service.js +66 -0
  319. package/dist/src/web-ui/plugin-configuration-view.d.ts +25 -0
  320. package/dist/src/web-ui/plugin-configuration-view.js +45 -0
  321. package/dist/src/web-ui/plugin-disabled-selection.d.ts +7 -0
  322. package/dist/src/web-ui/plugin-disabled-selection.js +17 -0
  323. package/dist/src/web-ui/plugin-management-catalog.d.ts +3 -1
  324. package/dist/src/web-ui/plugin-management-catalog.js +11 -1
  325. package/dist/src/web-ui/plugin-management-selection.js +22 -9
  326. package/dist/src/web-ui/plugin-management-service.d.ts +5 -1
  327. package/dist/src/web-ui/plugin-management-service.js +11 -7
  328. package/dist/src/web-ui/plugin-removal-error.d.ts +7 -0
  329. package/dist/src/web-ui/plugin-removal-error.js +16 -0
  330. package/dist/src/web-ui/plugin-removal-service.d.ts +30 -0
  331. package/dist/src/web-ui/plugin-removal-service.js +109 -0
  332. package/dist/src/web-ui/runtime-setup-gateway.d.ts +6 -2
  333. package/dist/src/web-ui/runtime-setup-gateway.js +30 -10
  334. package/dist/src/web-ui/server.js +6 -2
  335. package/dist/src/web-ui/session-read-state/overview.d.ts +42 -0
  336. package/dist/src/web-ui/session-read-state/overview.js +16 -0
  337. package/dist/src/web-ui/session-read-state/pagination.d.ts +15 -0
  338. package/dist/src/web-ui/session-read-state/pagination.js +42 -0
  339. package/dist/src/web-ui/session-read-state/projection.d.ts +4 -3
  340. package/dist/src/web-ui/session-read-state/service.d.ts +213 -20
  341. package/dist/src/web-ui/session-read-state/service.js +25 -23
  342. package/dist/src/web-ui/session-read-state/visible-messages.d.ts +3 -3
  343. package/dist/src/web-ui/system-host-setup/companion-linux.js +1 -1
  344. package/dist/src/web-ui/system-host-setup/installer-contract.d.ts +1 -1
  345. package/dist/src/web-ui/system-host-setup/installer-contract.js +2 -2
  346. package/dist/src/web-ui/system-host-setup/installers.js +0 -7
  347. package/dist/src/web-ui/system-host-setup/local-connection.d.ts +4 -1
  348. package/dist/src/web-ui/system-host-setup/local-connection.js +10 -17
  349. package/dist/src/web-ui/system-host-setup/routes.d.ts +2 -0
  350. package/dist/src/web-ui/system-host-setup/routes.js +32 -9
  351. package/dist/src/web-ui/system-host-setup/setup-mutation.d.ts +9 -0
  352. package/dist/src/web-ui/system-host-setup/setup-mutation.js +27 -0
  353. package/dist/src/web-ui/system-host-setup/windows-store-route.d.ts +13 -0
  354. package/dist/src/web-ui/system-host-setup/windows-store-route.js +68 -0
  355. package/docs/configuration.md +46 -0
  356. package/docs/installation.md +45 -24
  357. package/docs/plugins.md +165 -2
  358. package/docs/projects-and-full-plus.md +2 -6
  359. package/docs/runtime-library.md +0 -1
  360. package/docs/windows-companion-store.md +127 -0
  361. package/package.json +3 -3
  362. package/plugins/document-reader/plugin.json +1 -0
  363. package/plugins/exec/plugin.json +3 -0
  364. package/plugins/filesystem/plugin.json +2 -0
  365. package/plugins/local-search/plugin.json +1 -0
  366. package/plugins/system/README.md +43 -3
  367. package/plugins/system/plugin.json +5 -0
  368. package/plugins/system/source/companion-command-output.ts +82 -0
  369. package/plugins/system/source/host-dispatch.ts +4 -0
  370. package/plugins/system/source/index.ts +11 -5
  371. package/plugins/system/source/local-command-output.ts +61 -0
  372. package/plugins/system/source/request-system-modules.ts +2 -0
  373. package/plugins/system/src/index.cjs +474 -39
  374. package/plugins/web/README.md +2 -2
  375. package/plugins/web/plugin.json +4 -0
  376. package/runtime.config.schema.json +25 -1
  377. package/src/runtime/README.md +12 -2
  378. package/dist/src/web-ui/system-host-setup/companion-windows.d.ts +0 -2
  379. package/dist/src/web-ui/system-host-setup/companion-windows.js +0 -108
  380. package/docs/publishing.md +0 -167
@@ -206,12 +206,8 @@ system action. Cancellation or revocation attempts to stop an in-flight command,
206
206
  but effects already performed are not rolled back. If a connection is lost during
207
207
  execution, inspect the actual host state before trying the action again.
208
208
 
209
- ## Validation status
209
+ ## Platform validation
210
210
 
211
- Implementation and validation progress are recorded in the task journal. Native
212
- Mac QA is performed separately with the owner; mocked platform tests are not a
213
- claim that an actual Mac was tested. No release or installation update is implied
214
- by changes in a development worktree.
215
211
  Native Windows/macOS companion installation, login startup and visible-application
216
- QA remain separate checks on the real desktop systems; Linux protocol and package
212
+ behavior require checks on the target systems; Linux protocol and package
217
213
  tests do not establish those results.
@@ -13,7 +13,6 @@ For invariant coverage, see
13
13
  [runtime-invariant-coverage.md](runtime-invariant-coverage.md).
14
14
  For bridge/runtime ownership, see [bridge-compatibility.md](bridge-compatibility.md).
15
15
  For current limitations, see [known-limitations.md](known-limitations.md).
16
- For package and publication gates, see [publishing.md](publishing.md).
17
16
 
18
17
  ## Basic Composition
19
18
 
@@ -0,0 +1,127 @@
1
+ # Windows Companion Store delivery
2
+
3
+ ## Current status
4
+
5
+ **ABot AI Companion** is available from
6
+ [Microsoft Store](https://apps.microsoft.com/detail/9PK2FDQQLQS9), product ID
7
+ `9PK2FDQQLQS9`. Runtime 1.7.0 provides the guided connection flow described below.
8
+
9
+ The Store app and Runtime have separate releases.
10
+
11
+ ## Connection experience
12
+
13
+ The Web UI links to the Store for one installation. The user returns to ABot,
14
+ requests a connection link and explicitly opens Companion. Companion shows the
15
+ Runtime address and asks for confirmation before pairing. Users who already
16
+ installed Companion go directly to connecting. The Web UI confirms the live
17
+ connection after pairing.
18
+
19
+ Before **Allow connection** is enabled, users must select an initially unchecked
20
+ acknowledgment of the described computer access and data sharing. The dialog
21
+ links to the [software terms](https://abot-ai.com/terms/#software) and
22
+ [privacy policy](https://abot-ai.com/privacy/#software); opening either link does
23
+ not grant consent. Task permissions and optional SPARK controls remain separate.
24
+ Disconnecting does not erase data already sent to the Runtime or other services.
25
+
26
+ For a paired computer that is offline, **Open Companion** uses the fixed
27
+ `abot-companion://open` activation without creating an invitation. It opens the
28
+ saved connection or explains how to re-pair when local credentials are missing.
29
+ **Set up again** requires confirmation, revokes the old server pairing using
30
+ the existing endpoint, then requests a fresh invitation. An upgrade invitation
31
+ never substitutes for a new pairing grant when local credentials are missing.
32
+ After explicit consent, a fresh connection consumes the new grant even when an
33
+ old local credential remains. The previous owned process is stopped before that
34
+ exchange. A failed exchange preserves the saved credential but does not restart
35
+ the previous process;
36
+ an upgrade continues to use the matching saved host identity.
37
+
38
+ Every user installs the same package. The personalized, expiring invitation is
39
+ sent through the `abot-companion:` protocol after installation. It carries the
40
+ existing pairing or upgrade grant, not a second authentication scheme. The Web UI
41
+ keeps it only in the current surface, clears it after connection or expiry, and
42
+ does not save it to browser storage. Do not put connection links in logs, support
43
+ reports or screenshots.
44
+
45
+ The current invitation contract accepts a local HTTP loopback Runtime address.
46
+ Docker must publish its Web UI port on the Windows host's loopback; other setups
47
+ must expose the Runtime through an appropriate local forward. Opening ABot on a
48
+ different computer does not make that remote Runtime address a valid invitation.
49
+
50
+ ## Shared components
51
+
52
+ | Owner | Responsibility |
53
+ | --- | --- |
54
+ | Shared Web UI connection manager | Connection status, readiness polling, unpairing and onboarding lifecycle. |
55
+ | Windows Store UI module and route | Store link, temporary invitation and explicit launch. The route uses the existing pairing store. |
56
+ | Windows desktop shell | Display connection status and consent, activate links and call the bundled Node entry. |
57
+ | Shared Companion and CLI lifecycle | Pairing credentials, command and desktop capabilities, connection protocol, reconnect behavior and permission checks. |
58
+ | Windows Store lifecycle adapter and MSIX package | Windows package activation, startup integration, notification identity and package updates. |
59
+
60
+ The desktop shell does not implement another pairing store or copy the Companion
61
+ protocol. Shared fixes belong in the shared Companion implementation; Windows
62
+ presentation and package integration stay in the Windows adapter. The package
63
+ contains the runtime dependencies needed for connection.
64
+
65
+ The Store integration changes Windows delivery. Native macOS connection, manual
66
+ Mac connection, Linux setup and WSL command routing keep their existing owners
67
+ and behavior. A WSL Runtime can use the Windows desktop Companion without a WSL
68
+ restart.
69
+
70
+ ## Version and update ownership
71
+
72
+ The **MSIX package version** orders Windows package updates. The **Companion
73
+ release version**, owned by `src/computer-access/companion/release-version.ts`,
74
+ describes the Companion behavior expected by the Runtime. These are different
75
+ values: a packaging or shell-only rebuild can require a newer MSIX version
76
+ without changing the Companion release contract.
77
+
78
+ If the Runtime requires a Companion release newer than the installed package,
79
+ the invitation is rejected with a request to update through Microsoft Store.
80
+ The Store supplies the replacement package; the Runtime does not overwrite
81
+ Store-owned executable files. Store updates are intended to preserve the user's
82
+ saved pairing.
83
+
84
+ The Store identity is owned by
85
+ `src/computer-access/companion/windows-store/identity.ts`. Packaging and the
86
+ Companion must use this same identity. Do not create another copy of protocol
87
+ version or package identity policy in the Web UI or desktop shell.
88
+
89
+ ## Build from source
90
+
91
+ Build Companion from this repository.
92
+ The build uses the pinned Windows Node.js distributions, checking the archive
93
+ hash before extracting only `node.exe` and its license. Supply an explicit
94
+ four-part Store version with a zero last component.
95
+
96
+ ```sh
97
+ npx tsx scripts/build-windows-companion-store.ts \
98
+ --output-dir <new-layout-directory> \
99
+ --node-archive <verified-node-windows-zip> \
100
+ --version <major.minor.patch.0> --architecture x64
101
+ ```
102
+
103
+ Then, in Windows PowerShell, use the .NET Framework compiler and an authentic
104
+ Microsoft Windows SDK `MakeAppx.exe`:
105
+
106
+ ```powershell
107
+ ./scripts/build-windows-companion-store.ps1 `
108
+ -LayoutDirectory <layout-directory> `
109
+ -MakeAppxPath <local-windows-sdk-makeappx-path> `
110
+ -OutputPath <new-msix-path>
111
+ ```
112
+
113
+ Keep the SDK tools on a local Windows volume. Package inputs and output can
114
+ remain in the WSL checkout. The output is unsigned and is not installed,
115
+ registered, signed or submitted by these scripts.
116
+
117
+ ## Package contents
118
+
119
+ The public source includes the Windows shell and packaging scripts. The MSIX
120
+ contains the compiled shell, bundled shared Companion, pinned Node executable,
121
+ licenses, icons and Windows manifest. The Store package and Node executable are
122
+ not part of the Runtime npm package.
123
+
124
+ Pairing invitations are generated when the user requests a connection. They are
125
+ never baked into the Store package. Local configurations, API keys, saved pairing
126
+ and logs must stay outside the Store package. Store product and publisher identity
127
+ values are public package metadata, not authentication credentials.
package/package.json CHANGED
@@ -95,11 +95,11 @@
95
95
  "docs/bridge-compatibility.md",
96
96
  "docs/configuration.md",
97
97
  "docs/installation.md",
98
+ "docs/windows-companion-store.md",
98
99
  "docs/known-limitations.md",
99
100
  "docs/long-term-memory.md",
100
101
  "docs/plugins.md",
101
102
  "docs/projects-and-full-plus.md",
102
- "docs/publishing.md",
103
103
  "docs/running-locally.md",
104
104
  "docs/runtime-invariant-coverage.md",
105
105
  "docs/runtime-library.md",
@@ -128,7 +128,7 @@
128
128
  "plugins/system-probe/",
129
129
  "plugins/web/"
130
130
  ],
131
- "homepage": "https://github.com/Dorshitrit/abot-runtime#readme",
131
+ "homepage": "https://abot-ai.com/",
132
132
  "keywords": [
133
133
  "llm",
134
134
  "runtime",
@@ -181,5 +181,5 @@
181
181
  },
182
182
  "type": "module",
183
183
  "types": "./dist/src/runtime/index.d.ts",
184
- "version": "1.6.0"
184
+ "version": "1.7.0"
185
185
  }
@@ -42,6 +42,7 @@
42
42
  "operations": {
43
43
  "read_document": {
44
44
  "summary": "Extract document text, not source code. For .js, .ts, .html, .css and other code files, use read_one_file or inspect_target when available. Accepts only PDF, DOCX, XLSX, PPTX, TXT, CSV, MD, JSON and RTF; returns one bounded character window.",
45
+ "outputChannels": {"text": "content", "data": "metadata"},
45
46
  "attachmentInput": {
46
47
  "param": "source",
47
48
  "acceptedMimeTypes": [
@@ -42,6 +42,7 @@
42
42
  "operations": {
43
43
  "execute_command": {
44
44
  "summary": "Execute one trusted non-interactive /bin/bash command in an explicit existing directory. This sensitive operation requires exact-action approval in Ask/Full and runs automatically in FULL+. The OS user permissions still apply; the selected folder is not a sandbox.",
45
+ "outputChannels": {"text": "metadata", "data": "metadata"},
45
46
  "input": {
46
47
  "type": "object",
47
48
  "additionalProperties": false,
@@ -75,6 +76,7 @@
75
76
  "operations": {
76
77
  "wait_for_process": {
77
78
  "summary": "Wait for the next bounded observation from one running exec process without restarting it.",
79
+ "outputChannels": {"text": "metadata", "data": "metadata"},
78
80
  "input": {
79
81
  "type": "object",
80
82
  "additionalProperties": false,
@@ -111,6 +113,7 @@
111
113
  "operations": {
112
114
  "cancel_process": {
113
115
  "summary": "Stop one active exec process and report its final state.",
116
+ "outputChannels": {"text": "metadata", "data": "metadata"},
114
117
  "input": {
115
118
  "type": "object",
116
119
  "additionalProperties": false,
@@ -35,6 +35,7 @@
35
35
  "operations": {
36
36
  "inspect_target": {
37
37
  "summary": "Read a bounded line-numbered window from source code or another text file, or inspect a directory sample. Choose a locator or numeric lines; locator takes precedence. Results declare truncation explicitly.",
38
+ "outputChannels": {"text": "content", "data": "conditional"},
38
39
  "input": {
39
40
  "type": "object",
40
41
  "additionalProperties": false,
@@ -194,6 +195,7 @@
194
195
  "operations": {
195
196
  "read_one_file": {
196
197
  "summary": "Read one source-code or text file, including JS, TS, Python, HTML and CSS. Returns complete content within the read budget or an explicitly truncated head/tail view.",
198
+ "outputChannels": {"text": "content", "data": "metadata"},
197
199
  "input": {
198
200
  "type": "object",
199
201
  "additionalProperties": false,
@@ -37,6 +37,7 @@
37
37
  "operations": {
38
38
  "search_local_files": {
39
39
  "summary": "Find bounded filename or exact-content matches beneath the current Worker root. Omit path or use '.' for that root; use only relative subpaths (or workspace/... when configured).",
40
+ "outputChannels": {"text": "content", "data": "metadata"},
40
41
  "input": {
41
42
  "type": "object",
42
43
  "additionalProperties": false,
@@ -9,6 +9,49 @@ configuration. Ask and Full retain exact-action approvals; Full+ retains its nor
9
9
  approval policy. OS accessibility, screen-recording and portal permissions still
10
10
  apply. An available shell or connected companion does not prove desktop readiness.
11
11
 
12
+ ## Local command output
13
+
14
+ Local `system_command` execution, including Windows through WSL interop, writes
15
+ stdout and stderr to private files under the plugin state directory. Capture
16
+ uses bounded stream buffers with disk backpressure. The completed observation is
17
+ then loaded for delivery; full text is still materialized in memory at that point.
18
+ The existing SDK context-text contract lets the Runtime admit or compact that
19
+ text using its normal model-context budget. Small-result text is unchanged.
20
+
21
+ `extensions["ai.abot.runtime"].settings.defaults.outputRetentionMs` in the plugin's
22
+ `plugin.json` controls retention; the default is seven days after capture completes. Cleanup protects active captures and removes expired
23
+ captures during plugin initialization and periodic maintenance. Reads do not renew
24
+ retention. Completed captures keep the retention recorded at creation across
25
+ Companion reconnects and later configuration changes. Each capture has an opaque
26
+ ID, byte counts and a saved process receipt;
27
+ files are private implementation storage, not user-authored artifacts or model
28
+ instructions. No wait/cancel operation or automatic command replay is added.
29
+
30
+ A storage failure before dispatch prevents the command from starting. A capture
31
+ write failure stops observation of that command and reports incomplete output;
32
+ external descendants are not assumed terminated. Delivery failures retain the
33
+ capture receipt, recorded helper PID, process status and exit code when available.
34
+ This does not grant a new model-facing operation for reading retained captures.
35
+
36
+ Application launch, target probes and desktop images retain their existing behavior.
37
+
38
+ ## Companion command output
39
+
40
+ Updated companions advertise `system_command_output_v1`. SYSTEM then uses private
41
+ capture/read/close operations over the existing connection: the Companion stores
42
+ both streams in its private state directory using the same capture implementation,
43
+ returns the process receipt, and serves 64 KiB byte chunks. SYSTEM verifies the
44
+ capture ID, stream, offset, byte count and SHA-256 before delivering text through
45
+ the existing context-text contract. UTF-8 characters may cross chunk boundaries.
46
+ The model receives one tool result; transport chunks do not invoke a model.
47
+
48
+ Output references belong to the authenticated Companion connection. Transfers
49
+ protect their captures from expiry until closed or disconnected; the configured
50
+ SYSTEM retention then continues on disk. A failed transfer preserves the command
51
+ receipt and never repeats execution. Old companions keep their existing bounded
52
+ command path. This transfer does not add model-facing tools or change screenshot
53
+ handling, and final text delivery still materializes the streams in memory.
54
+
12
55
  ## Shared connection
13
56
 
14
57
  Use **Home → Computer access** for one installation shared
@@ -108,6 +151,3 @@ source compilation where available. They prove transport, identity, cancellation
108
151
  image lifetime and projection invariants. Interactive acceptance on each actual OS,
109
152
  permission configuration, compositor and provider remains a distinct live check;
110
153
  unit checks alone do not establish all native integrations work on a user's machine.
111
- The Windows helper has been compiled on Windows; its interactive behavior has not
112
- been exercised. macOS native compilation and interactive Linux/macOS checks remain
113
- unverified in this Windows/WSL development environment.
@@ -7,6 +7,11 @@
7
7
  "ai.abot.runtime": {
8
8
  "version": 1,
9
9
  "entrypoint": "./src/index.cjs",
10
+ "settings": {
11
+ "defaults": {
12
+ "outputRetentionMs": 604800000
13
+ }
14
+ },
10
15
  "catalogGroups": [
11
16
  "system"
12
17
  ],
@@ -0,0 +1,82 @@
1
+ import { createHash } from "node:crypto";
2
+ import { StringDecoder } from "node:string_decoder";
3
+ import { deliverPluginTextResult, failureResult, type ToolExecutionContext,
4
+ type ToolImplementationOutput } from "../../../src/plugin-sdk/index.js";
5
+ import { SYSTEM_OUTPUT_CAPABILITY, SYSTEM_OUTPUT_CHUNK_BYTES, readSystemOutputTransfer,
6
+ type ComputerAccessConnection, type HostOperation } from "../../../src/plugin-sdk/computer-access.js";
7
+ import type { SystemRequestRoute } from "./request-target-snapshot.js";
8
+
9
+ type CompanionRoute = Extract<SystemRequestRoute, { kind: "companion" }>;
10
+ type Transfer = ReturnType<typeof readSystemOutputTransfer>;
11
+ type HostCall = (operation: HostOperation, params: Record<string, unknown>, signal?: AbortSignal) => Promise<ToolImplementationOutput>;
12
+
13
+ export function supportsCompanionCommandOutput(route: CompanionRoute): boolean {
14
+ return route.capabilities?.includes(SYSTEM_OUTPUT_CAPABILITY) === true;
15
+ }
16
+
17
+ /** Transfer is private adapter IO; the model receives one settled tool result. */
18
+ export async function executeCompanionCommand(input: {
19
+ rootDir: string;
20
+ route: CompanionRoute;
21
+ connection: ComputerAccessConnection;
22
+ params: Record<string, unknown>;
23
+ outputRetentionMs?: number;
24
+ context?: ToolExecutionContext;
25
+ }): Promise<ToolImplementationOutput> {
26
+ const { route, context } = input;
27
+ const call: HostCall = (operation, params, signal) => input.connection.executeHostOperation(input.rootDir, {
28
+ hostId: route.hostId, connectionId: route.connectionId, operation,
29
+ params: { ...params, target: route.target }, ...(signal ? { abortSignal: signal } : {}),
30
+ });
31
+ const receipt = await call("system_command_capture", {
32
+ ...input.params, ...(input.outputRetentionMs !== undefined ? { outputRetentionMs: input.outputRetentionMs } : {}),
33
+ }, context?.abortSignal);
34
+ if (!receipt.data?.outputTransfer && !receipt.ok) return receipt;
35
+ let transfer: Transfer | undefined;
36
+ try {
37
+ transfer = readSystemOutputTransfer(receipt.data?.outputTransfer);
38
+ const stdout = await readStream(call, transfer, "stdout", context?.abortSignal);
39
+ const stderr = await readStream(call, transfer, "stderr", context?.abortSignal);
40
+ const { outputTransfer: _transfer, ...data } = receipt.data ?? {};
41
+ const delivered = deliverPluginTextResult({ ...receipt, stdout, stderr: stderr || receipt.stderr,
42
+ data: { ...data, outputDelivery: "complete", summaryOmittedChars: { stdout: stdout.length, stderr: stderr.length } },
43
+ }, ["stdout", "stderr"], context?.resultBudget);
44
+ if (delivered.errorCode === "plugin_result_too_large") return transferFailure(receipt, context);
45
+ return delivered;
46
+ } catch {
47
+ return transferFailure(receipt, context);
48
+ } finally {
49
+ if (transfer) await call("system_command_output_close", { captureId: transfer.id }, AbortSignal.timeout(3_000)).catch(() => undefined);
50
+ }
51
+ }
52
+
53
+ async function readStream(call: HostCall, transfer: Transfer, stream: "stdout" | "stderr", signal?: AbortSignal): Promise<string> {
54
+ const size = stream === "stdout" ? transfer.stdoutBytes : transfer.stderrBytes;
55
+ const digest = stream === "stdout" ? transfer.stdoutSha256 : transfer.stderrSha256;
56
+ const hash = createHash("sha256");
57
+ const decoder = new StringDecoder("utf8");
58
+ let text = "";
59
+ for (let offset = 0; offset < size; offset += SYSTEM_OUTPUT_CHUNK_BYTES) {
60
+ signal?.throwIfAborted();
61
+ const part = await call("system_command_output", { captureId: transfer.id, stream, offset }, signal);
62
+ if (!part.ok) throw new Error("system_output_transfer_failed");
63
+ const data = part.data;
64
+ if (data?.captureId !== transfer.id || data.stream !== stream || data.offset !== offset) throw new Error("system_output_chunk_binding_invalid");
65
+ if (typeof data.bytes !== "string" || data.bytes.length > SYSTEM_OUTPUT_CHUNK_BYTES * 2) throw new Error("system_output_chunk_invalid");
66
+ const bytes = Buffer.from(data.bytes, "base64");
67
+ if (bytes.toString("base64") !== data.bytes) throw new Error("system_output_chunk_invalid");
68
+ if (bytes.length !== Math.min(SYSTEM_OUTPUT_CHUNK_BYTES, size - offset)) throw new Error("system_output_chunk_size_invalid");
69
+ hash.update(bytes);
70
+ text += decoder.write(bytes);
71
+ }
72
+ if (hash.digest("hex") !== digest) throw new Error("system_output_digest_invalid");
73
+ return text + decoder.end();
74
+ }
75
+
76
+ function transferFailure(receipt: ToolImplementationOutput, context?: ToolExecutionContext): ToolImplementationOutput {
77
+ return failureResult({ errorCode: "system_output_delivery_pending",
78
+ message: "The command settled, but its retained output could not be delivered completely. Process receipt is preserved; the command was not replayed.",
79
+ ...(receipt.exitCode !== undefined ? { exitCode: receipt.exitCode } : {}),
80
+ data: { ...receipt.data, outputDelivery: "pending", commandOk: receipt.ok, commandErrorCode: receipt.errorCode ?? null },
81
+ }, context?.resultBudget);
82
+ }
@@ -1,3 +1,4 @@
1
+ import { executeCompanionCommand, supportsCompanionCommandOutput } from "./companion-command-output.js";
1
2
  import type { ComputerAccessConnection } from "../../../src/plugin-sdk/computer-access.js";
2
3
  import {
3
4
  failureResult,
@@ -32,6 +33,7 @@ export function createBoundSystemHandlers(
32
33
  snapshot: SystemTargetSnapshot;
33
34
  nativeHandlers: Readonly<Record<string, ToolImplementation>>;
34
35
  connection: SystemHostConnection;
36
+ outputRetentionMs?: number;
35
37
  }>,
36
38
  ): Record<string, ToolImplementation> {
37
39
  return Object.fromEntries(
@@ -67,6 +69,8 @@ function boundOperation(
67
69
  const route = requireSystemRequestRoute(input.snapshot, params.target);
68
70
  if (route.kind === "native")
69
71
  return await input.nativeHandlers[operation]!(params, context);
72
+ if (operation === "system_command" && supportsCompanionCommandOutput(route))
73
+ return await executeCompanionCommand({ ...input, route, params, context });
70
74
  return await input.connection.executeHostOperation(input.rootDir, {
71
75
  hostId: route.hostId,
72
76
  connectionId: route.connectionId,
@@ -1,10 +1,16 @@
1
1
  import { defineRuntimePlugin } from "../../../src/plugin-sdk/index.js";
2
2
  import { createSystemHandlers } from "../../../src/plugin-sdk/computer-access.js";
3
3
  import { prepareSystemRequestModules } from "./request-system-modules.js";
4
+ import { createLocalSystemCommandOutput, systemCommandOutputRetentionMs } from "./local-command-output.js";
4
5
  import { unboundComputerHandlers } from "./computer/request-modules.js";
5
6
 
6
- export default defineRuntimePlugin(({ rootDir }) => ({
7
- handlers: { ...createSystemHandlers(), ...unboundComputerHandlers() },
8
- prepareRequest: (modules, preparation) =>
9
- prepareSystemRequestModules(rootDir, modules, {}, preparation),
10
- }));
7
+ export default defineRuntimePlugin((context) => {
8
+ const output = createLocalSystemCommandOutput(context);
9
+ return {
10
+ handlers: { ...createSystemHandlers(undefined, undefined, output), ...unboundComputerHandlers() },
11
+ prepareRequest: (modules, preparation) => prepareSystemRequestModules(context.rootDir, modules, {
12
+ outputRetentionMs: systemCommandOutputRetentionMs(context),
13
+ createNativeHandlers: (resolve) => createSystemHandlers(undefined, resolve, output),
14
+ }, preparation),
15
+ };
16
+ });
@@ -0,0 +1,61 @@
1
+ import { join } from "node:path";
2
+ import { deliverPluginTextResult, failureResult, readBoundedInteger, type RuntimePluginLoadContext,
3
+ type ToolExecutionContext, type ToolImplementationOutput } from "../../../src/plugin-sdk/index.js";
4
+ import { buildSystemProcessResult, runSystemProcess, type SystemCommandOutputFactory,
5
+ type SystemProcessResult, type SystemTarget } from "../../../src/plugin-sdk/computer-access.js";
6
+ import { createSystemOutputCapture, type SystemOutputReceipt } from "../../../src/plugin-sdk/computer-access.js";
7
+ import { DEFAULT_SYSTEM_OUTPUT_RETENTION_MS, scheduleSystemOutputCleanup } from "../../../src/plugin-sdk/computer-access.js";
8
+
9
+ type Capture = Awaited<ReturnType<typeof createSystemOutputCapture>>;
10
+ const CONTEXT_STREAMS = Object.freeze(["stdout", "stderr"] as const);
11
+
12
+ export function createLocalSystemCommandOutput(plugin: RuntimePluginLoadContext): SystemCommandOutputFactory {
13
+ const root = join(plugin.stateDir, "command-output");
14
+ const retentionMs = systemCommandOutputRetentionMs(plugin);
15
+ scheduleSystemOutputCleanup(root, retentionMs);
16
+ return (context) => {
17
+ let captured: Capture | undefined;
18
+ return {
19
+ async run(input) {
20
+ if (input.abortSignal?.aborted) return runSystemProcess(input);
21
+ captured = await createSystemOutputCapture(root, retentionMs);
22
+ let result: SystemProcessResult;
23
+ try { result = await runSystemProcess(input, captured.capture); }
24
+ catch (error) { await captured.finish(); throw error; }
25
+ const streams = await captured.finish(result);
26
+ return { ...result, stdout: streams.stdout, stderr: streams.stderr || result.stderr,
27
+ outputTruncated: Boolean(captured.failure) };
28
+ },
29
+ async present(target, result) {
30
+ if (captured?.failure) return outputFailure(target, result, context, captured.receipt, captured.failure);
31
+ const receipt = buildSystemProcessResult(target, result, "command_process_completion");
32
+ const delivered = deliverPluginTextResult({ ...receipt,
33
+ data: { ...receipt.data, ...(captured?.receipt ? { outputCapture: captured.receipt } : {}) } }, CONTEXT_STREAMS, context?.resultBudget);
34
+ if (delivered.errorCode === "plugin_result_too_large")
35
+ return outputFailure(target, result, context, captured?.receipt);
36
+ return delivered;
37
+ },
38
+ };
39
+ };
40
+ }
41
+
42
+ function outputFailure(target: SystemTarget, result: SystemProcessResult, context?: ToolExecutionContext,
43
+ capture?: SystemOutputReceipt, storageFailure?: string): ToolImplementationOutput {
44
+ return failureResult({
45
+ errorCode: storageFailure ? "system_output_storage_failed" : "system_output_delivery_pending",
46
+ message: "The command was dispatched. Its output could not be delivered completely; do not repeat the command just to retrieve output. Inspect the process receipt and retained capture.",
47
+ ...(result.exitCode !== null ? { exitCode: result.exitCode } : {}),
48
+ data: { target: target.id, transport: target.transport, processStatus: result.status,
49
+ spawnedProcess: result.spawnedProcess ?? null, exitCode: result.exitCode,
50
+ outputCapture: capture ?? null, ...(storageFailure ? { storageFailure } : {}),
51
+ outputDelivery: "pending", evidenceScope: "command_process_completion", independentOutcomeCheck: "not_performed",
52
+ observationMeta: { kind: "volatile_external", carryPolicy: "never" } },
53
+ }, context?.resultBudget);
54
+ }
55
+
56
+ export function systemCommandOutputRetentionMs(plugin: RuntimePluginLoadContext): number {
57
+ return readBoundedInteger(plugin.config?.outputRetentionMs, {
58
+ name: "outputRetentionMs", defaultValue: DEFAULT_SYSTEM_OUTPUT_RETENTION_MS,
59
+ minimum: 1, maximum: Number.MAX_SAFE_INTEGER,
60
+ });
61
+ }
@@ -34,6 +34,7 @@ import {
34
34
  export type SystemRequestDependencies = Readonly<{
35
35
  observeTargets?: () => Promise<SystemTargetObservation>;
36
36
  connection?: SystemHostConnection;
37
+ outputRetentionMs?: number;
37
38
  createNativeHandlers?: (
38
39
  resolveTarget: (id: SystemTargetId) => Promise<SystemTarget>,
39
40
  ) => Record<string, ToolImplementation>;
@@ -76,6 +77,7 @@ export async function prepareSystemRequestModules(
76
77
  snapshot,
77
78
  connection,
78
79
  nativeHandlers,
80
+ outputRetentionMs: dependencies.outputRetentionMs,
79
81
  });
80
82
  return Object.freeze([
81
83
  ...modules