@abot-ai/runtime 1.5.0 → 1.6.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 (984) hide show
  1. package/dist/src/bridge/start-agent-bridge.js +22 -0
  2. package/dist/src/capabilities/normal-invocation/contracts.d.ts +11 -0
  3. package/dist/src/capabilities/normal-invocation/contracts.js +1 -0
  4. package/dist/src/capabilities/normal-invocation/validator.js +40 -4
  5. package/dist/src/capabilities/result-budget.d.ts +17 -0
  6. package/dist/src/capabilities/result-budget.js +21 -0
  7. package/dist/src/capabilities/tool-context-text.d.ts +16 -0
  8. package/dist/src/capabilities/tool-context-text.js +30 -0
  9. package/dist/src/capabilities/tool-definition-validator/definition-parser.js +6 -0
  10. package/dist/src/capabilities/tool-definition-validator/event-input-text-options.js +3 -2
  11. package/dist/src/capabilities/tool-event-input-text.d.ts +1 -0
  12. package/dist/src/capabilities/tool-event-input-text.js +2 -1
  13. package/dist/src/capabilities/tool-executor.d.ts +3 -1
  14. package/dist/src/capabilities/tool-executor.js +29 -50
  15. package/dist/src/capabilities/tool-interruption.d.ts +3 -0
  16. package/dist/src/capabilities/tool-interruption.js +6 -0
  17. package/dist/src/capabilities/tool-result-normalization.d.ts +18 -0
  18. package/dist/src/capabilities/tool-result-normalization.js +68 -0
  19. package/dist/src/capabilities/tool-types.d.ts +25 -2
  20. package/dist/src/cli/host-companion-bundle.mjs +474 -212
  21. package/dist/src/cli/host-companion.js +6 -0
  22. package/dist/src/cli/host-permissions.d.ts +7 -0
  23. package/dist/src/cli/host-permissions.js +24 -0
  24. package/dist/src/computer-access/companion/native-messages.js +1 -0
  25. package/dist/src/computer-access/companion/native-permissions.d.ts +14 -0
  26. package/dist/src/computer-access/companion/native-permissions.js +49 -0
  27. package/dist/src/computer-access/companion/native-session.js +4 -0
  28. package/dist/src/computer-access/companion/notification-installation.js +2 -15
  29. package/dist/src/computer-access/companion/notification-macos-bundle.d.ts +3 -0
  30. package/dist/src/computer-access/companion/notification-macos-bundle.js +84 -0
  31. package/dist/src/computer-access/companion/notification-macos.js +1 -1
  32. package/dist/src/computer-access/companion/notification-protocol.d.ts +1 -1
  33. package/dist/src/computer-access/companion/notification-protocol.js +20 -1
  34. package/dist/src/computer-access/companion/notification-readiness.js +2 -1
  35. package/dist/src/computer-access/companion/permission-protocol.d.ts +22 -0
  36. package/dist/src/computer-access/companion/permission-protocol.js +45 -0
  37. package/dist/src/computer-access/companion/protocol.d.ts +2 -1
  38. package/dist/src/computer-access/companion/protocol.js +3 -0
  39. package/dist/src/computer-access/companion/release-version.d.ts +1 -1
  40. package/dist/src/computer-access/companion/release-version.js +1 -1
  41. package/dist/src/computer-access/companion/spark-notification-query.d.ts +2 -0
  42. package/dist/src/computer-access/companion/spark-notification-query.js +62 -0
  43. package/dist/src/computer-access/computer/macos-desktop.js +1 -1
  44. package/dist/src/computer-access/computer/macos-input.js +2 -5
  45. package/dist/src/computer-access/computer/macos-permission-helper.d.ts +4 -0
  46. package/dist/src/computer-access/computer/macos-permission-helper.js +38 -0
  47. package/dist/src/computer-access/host-observation.d.ts +3 -3
  48. package/dist/src/computer-access/native-permission-contract.d.ts +23 -0
  49. package/dist/src/computer-access/native-permission-contract.js +38 -0
  50. package/dist/src/model-gateway/policy/invocation-policy.js +10 -1
  51. package/dist/src/model-gateway/providers/openai/payload.js +8 -0
  52. package/dist/src/model-gateway/structured-output/ollama-format.js +5 -0
  53. package/dist/src/model-gateway/structured-output/openai-format.js +5 -0
  54. package/dist/src/model-gateway/types.d.ts +3 -0
  55. package/dist/src/plugin-contract/manifest.d.ts +2 -1
  56. package/dist/src/plugin-sdk/context-text-result.d.ts +10 -0
  57. package/dist/src/plugin-sdk/context-text-result.js +19 -0
  58. package/dist/src/plugin-sdk/index.d.ts +1 -0
  59. package/dist/src/plugin-sdk/index.js +1 -0
  60. package/dist/src/plugin-sdk/results.d.ts +7 -4
  61. package/dist/src/plugin-sdk/results.js +35 -10
  62. package/dist/src/runtime/adapters/co-worker-resources.d.ts +2 -0
  63. package/dist/src/runtime/adapters/co-worker-resources.js +2 -2
  64. package/dist/src/runtime/adapters/file-session-store.js +6 -0
  65. package/dist/src/runtime/adapters/in-memory-session-store.js +14 -1
  66. package/dist/src/runtime/adapters/long-term-memory/onboarding-service.d.ts +2 -1
  67. package/dist/src/runtime/adapters/long-term-memory/onboarding-service.js +5 -4
  68. package/dist/src/runtime/adapters/passive-learning-runtime.d.ts +2 -1
  69. package/dist/src/runtime/adapters/passive-learning-runtime.js +1 -1
  70. package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/prepared-execution.js +77 -26
  71. package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/result-budget.d.ts +11 -0
  72. package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/result-budget.js +30 -0
  73. package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/contracts.d.ts +28 -1
  74. package/dist/src/runtime/adapters/registered-tool-payload-plan.d.ts +3 -3
  75. package/dist/src/runtime/adapters/registered-tool-payload-plan.js +4 -4
  76. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/contracts.d.ts +2 -0
  77. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-authoring-result.js +4 -18
  78. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/prepared-execution.js +3 -3
  79. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/result-envelope.d.ts +13 -0
  80. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/result-envelope.js +15 -0
  81. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/result-evidence.d.ts +3 -7
  82. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/result-evidence.js +6 -38
  83. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/result-observer.d.ts +2 -1
  84. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/result-observer.js +14 -6
  85. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/result-references.d.ts +9 -0
  86. package/dist/src/runtime/adapters/registered-tool-worker-capabilities/result-references.js +29 -0
  87. package/dist/src/runtime/adapters/registered-tool-worker-capabilities.js +1 -0
  88. package/dist/src/runtime/adapters/scheduler-executor-dispatch.d.ts +11 -0
  89. package/dist/src/runtime/adapters/scheduler-executor-dispatch.js +10 -0
  90. package/dist/src/runtime/adapters/scheduler-runtime.d.ts +3 -1
  91. package/dist/src/runtime/adapters/scheduler-runtime.js +28 -12
  92. package/dist/src/runtime/automations/agent-assignment.d.ts +8 -0
  93. package/dist/src/runtime/automations/agent-assignment.js +29 -0
  94. package/dist/src/runtime/automations/agent-request-failure.d.ts +2 -0
  95. package/dist/src/runtime/automations/agent-request-failure.js +74 -0
  96. package/dist/src/runtime/automations/agent-session-lifetime.d.ts +11 -0
  97. package/dist/src/runtime/automations/agent-session-lifetime.js +46 -0
  98. package/dist/src/runtime/automations/agent-step-executor.d.ts +35 -0
  99. package/dist/src/runtime/automations/agent-step-executor.js +278 -0
  100. package/dist/src/runtime/automations/agent-tool-scope.d.ts +4 -0
  101. package/dist/src/runtime/automations/agent-tool-scope.js +73 -0
  102. package/dist/src/runtime/automations/archive-management.d.ts +26 -0
  103. package/dist/src/runtime/automations/archive-management.js +50 -0
  104. package/dist/src/runtime/automations/binding-resolution.d.ts +28 -0
  105. package/dist/src/runtime/automations/binding-resolution.js +115 -0
  106. package/dist/src/runtime/automations/branch-result-projection.d.ts +4 -0
  107. package/dist/src/runtime/automations/branch-result-projection.js +15 -0
  108. package/dist/src/runtime/automations/catalog.d.ts +76 -0
  109. package/dist/src/runtime/automations/catalog.js +67 -0
  110. package/dist/src/runtime/automations/definition-contracts.d.ts +128 -0
  111. package/dist/src/runtime/automations/definition-contracts.js +1 -0
  112. package/dist/src/runtime/automations/definition-input.d.ts +3 -0
  113. package/dist/src/runtime/automations/definition-input.js +283 -0
  114. package/dist/src/runtime/automations/dependency-fingerprint.d.ts +9 -0
  115. package/dist/src/runtime/automations/dependency-fingerprint.js +55 -0
  116. package/dist/src/runtime/automations/draft-batch-aliases.d.ts +12 -0
  117. package/dist/src/runtime/automations/draft-batch-aliases.js +94 -0
  118. package/dist/src/runtime/automations/draft-batch.d.ts +29 -0
  119. package/dist/src/runtime/automations/draft-batch.js +147 -0
  120. package/dist/src/runtime/automations/draft-management.d.ts +53 -0
  121. package/dist/src/runtime/automations/draft-management.js +164 -0
  122. package/dist/src/runtime/automations/draft-mutations.d.ts +29 -0
  123. package/dist/src/runtime/automations/draft-mutations.js +219 -0
  124. package/dist/src/runtime/automations/draft-restoration.d.ts +11 -0
  125. package/dist/src/runtime/automations/draft-restoration.js +44 -0
  126. package/dist/src/runtime/automations/effect-admission-lifetime.d.ts +9 -0
  127. package/dist/src/runtime/automations/effect-admission-lifetime.js +31 -0
  128. package/dist/src/runtime/automations/failure-policy.d.ts +8 -0
  129. package/dist/src/runtime/automations/failure-policy.js +9 -0
  130. package/dist/src/runtime/automations/graph-executor.d.ts +23 -0
  131. package/dist/src/runtime/automations/graph-executor.js +227 -0
  132. package/dist/src/runtime/automations/graph-validation.d.ts +29 -0
  133. package/dist/src/runtime/automations/graph-validation.js +271 -0
  134. package/dist/src/runtime/automations/input-batch-selection.d.ts +7 -0
  135. package/dist/src/runtime/automations/input-batch-selection.js +42 -0
  136. package/dist/src/runtime/automations/input-capacity.d.ts +9 -0
  137. package/dist/src/runtime/automations/input-capacity.js +38 -0
  138. package/dist/src/runtime/automations/input-ledger.d.ts +45 -0
  139. package/dist/src/runtime/automations/input-ledger.js +147 -0
  140. package/dist/src/runtime/automations/late-settlement.d.ts +9 -0
  141. package/dist/src/runtime/automations/late-settlement.js +42 -0
  142. package/dist/src/runtime/automations/limits.d.ts +25 -0
  143. package/dist/src/runtime/automations/limits.js +41 -0
  144. package/dist/src/runtime/automations/model-capacity.d.ts +9 -0
  145. package/dist/src/runtime/automations/model-capacity.js +67 -0
  146. package/dist/src/runtime/automations/model-dependency-projection.d.ts +56 -0
  147. package/dist/src/runtime/automations/model-dependency-projection.js +88 -0
  148. package/dist/src/runtime/automations/node-transactions.d.ts +57 -0
  149. package/dist/src/runtime/automations/node-transactions.js +223 -0
  150. package/dist/src/runtime/automations/occurrence-preparation.d.ts +12 -0
  151. package/dist/src/runtime/automations/occurrence-preparation.js +257 -0
  152. package/dist/src/runtime/automations/permission-grants.d.ts +27 -0
  153. package/dist/src/runtime/automations/permission-grants.js +72 -0
  154. package/dist/src/runtime/automations/persistence.d.ts +9 -0
  155. package/dist/src/runtime/automations/persistence.js +13 -0
  156. package/dist/src/runtime/automations/publication-validation.d.ts +16 -0
  157. package/dist/src/runtime/automations/publication-validation.js +162 -0
  158. package/dist/src/runtime/automations/publication.d.ts +33 -0
  159. package/dist/src/runtime/automations/publication.js +97 -0
  160. package/dist/src/runtime/automations/replay-preparation.d.ts +7 -0
  161. package/dist/src/runtime/automations/replay-preparation.js +59 -0
  162. package/dist/src/runtime/automations/result-capacity.d.ts +5 -0
  163. package/dist/src/runtime/automations/result-capacity.js +9 -0
  164. package/dist/src/runtime/automations/result-publication.d.ts +10 -0
  165. package/dist/src/runtime/automations/result-publication.js +21 -0
  166. package/dist/src/runtime/automations/result-store.d.ts +17 -0
  167. package/dist/src/runtime/automations/result-store.js +109 -0
  168. package/dist/src/runtime/automations/retention.d.ts +12 -0
  169. package/dist/src/runtime/automations/retention.js +134 -0
  170. package/dist/src/runtime/automations/run-file-binding.d.ts +3 -0
  171. package/dist/src/runtime/automations/run-file-binding.js +19 -0
  172. package/dist/src/runtime/automations/run-output-summary.d.ts +25 -0
  173. package/dist/src/runtime/automations/run-output-summary.js +54 -0
  174. package/dist/src/runtime/automations/run-report.d.ts +83 -0
  175. package/dist/src/runtime/automations/run-report.js +121 -0
  176. package/dist/src/runtime/automations/runtime-executor.d.ts +16 -0
  177. package/dist/src/runtime/automations/runtime-executor.js +260 -0
  178. package/dist/src/runtime/automations/saved-agent-management.d.ts +16 -0
  179. package/dist/src/runtime/automations/saved-agent-management.js +94 -0
  180. package/dist/src/runtime/automations/service.d.ts +286 -0
  181. package/dist/src/runtime/automations/service.js +330 -0
  182. package/dist/src/runtime/automations/snapshot-staging.d.ts +13 -0
  183. package/dist/src/runtime/automations/snapshot-staging.js +126 -0
  184. package/dist/src/runtime/automations/source-attachment-access.d.ts +23 -0
  185. package/dist/src/runtime/automations/source-attachment-access.js +70 -0
  186. package/dist/src/runtime/automations/source-discovery.d.ts +25 -0
  187. package/dist/src/runtime/automations/source-discovery.js +179 -0
  188. package/dist/src/runtime/automations/starter-template-builder.d.ts +5 -0
  189. package/dist/src/runtime/automations/starter-template-builder.js +78 -0
  190. package/dist/src/runtime/automations/starter-template-contracts.d.ts +42 -0
  191. package/dist/src/runtime/automations/starter-template-contracts.js +1 -0
  192. package/dist/src/runtime/automations/starter-template-definitions.d.ts +3 -0
  193. package/dist/src/runtime/automations/starter-template-definitions.js +100 -0
  194. package/dist/src/runtime/automations/starter-template-showcases.d.ts +3 -0
  195. package/dist/src/runtime/automations/starter-template-showcases.js +154 -0
  196. package/dist/src/runtime/automations/starter-template-structure.d.ts +4 -0
  197. package/dist/src/runtime/automations/starter-template-structure.js +11 -0
  198. package/dist/src/runtime/automations/starter-templates.d.ts +20 -0
  199. package/dist/src/runtime/automations/starter-templates.js +75 -0
  200. package/dist/src/runtime/automations/step-evidence-effects.d.ts +46 -0
  201. package/dist/src/runtime/automations/step-evidence-effects.js +173 -0
  202. package/dist/src/runtime/automations/step-evidence-inputs.d.ts +22 -0
  203. package/dist/src/runtime/automations/step-evidence-inputs.js +105 -0
  204. package/dist/src/runtime/automations/step-evidence-output.d.ts +17 -0
  205. package/dist/src/runtime/automations/step-evidence-output.js +43 -0
  206. package/dist/src/runtime/automations/step-evidence.d.ts +24 -0
  207. package/dist/src/runtime/automations/step-evidence.js +53 -0
  208. package/dist/src/runtime/automations/step-interruption.d.ts +3 -0
  209. package/dist/src/runtime/automations/step-interruption.js +26 -0
  210. package/dist/src/runtime/automations/step-runner.d.ts +57 -0
  211. package/dist/src/runtime/automations/step-runner.js +278 -0
  212. package/dist/src/runtime/automations/storage-records.d.ts +133 -0
  213. package/dist/src/runtime/automations/storage-records.js +286 -0
  214. package/dist/src/runtime/automations/terminal-admission-receipt.d.ts +12 -0
  215. package/dist/src/runtime/automations/terminal-admission-receipt.js +39 -0
  216. package/dist/src/runtime/automations/tool-lifetimes.d.ts +13 -0
  217. package/dist/src/runtime/automations/tool-lifetimes.js +56 -0
  218. package/dist/src/runtime/automations/tool-step-executor.d.ts +32 -0
  219. package/dist/src/runtime/automations/tool-step-executor.js +136 -0
  220. package/dist/src/runtime/automations/tool-step-outcome.d.ts +24 -0
  221. package/dist/src/runtime/automations/tool-step-outcome.js +32 -0
  222. package/dist/src/runtime/automations/trigger-schedule.d.ts +7 -0
  223. package/dist/src/runtime/automations/trigger-schedule.js +19 -0
  224. package/dist/src/runtime/automations/working-directory.d.ts +3 -0
  225. package/dist/src/runtime/automations/working-directory.js +13 -0
  226. package/dist/src/runtime/capabilities/automation-builder/authoring-reference.d.ts +422 -0
  227. package/dist/src/runtime/capabilities/automation-builder/authoring-reference.js +130 -0
  228. package/dist/src/runtime/capabilities/automation-builder/creation-recipe.d.ts +9 -0
  229. package/dist/src/runtime/capabilities/automation-builder/creation-recipe.js +155 -0
  230. package/dist/src/runtime/capabilities/automation-builder/payload-instructions.d.ts +6 -0
  231. package/dist/src/runtime/capabilities/automation-builder/payload-instructions.js +6 -0
  232. package/dist/src/runtime/capabilities/automation-builder/payload-schema.d.ts +3 -0
  233. package/dist/src/runtime/capabilities/automation-builder/payload-schema.js +105 -0
  234. package/dist/src/runtime/capabilities/automation-builder/tool-contract.d.ts +65 -0
  235. package/dist/src/runtime/capabilities/automation-builder/tool-contract.js +27 -0
  236. package/dist/src/runtime/capabilities/automation-builder/tool-module.d.ts +4 -0
  237. package/dist/src/runtime/capabilities/automation-builder/tool-module.js +108 -0
  238. package/dist/src/runtime/capabilities/automations/authoring-catalog-contract.d.ts +78 -0
  239. package/dist/src/runtime/capabilities/automations/authoring-catalog-contract.js +28 -0
  240. package/dist/src/runtime/capabilities/automations/authoring-catalog.d.ts +320 -0
  241. package/dist/src/runtime/capabilities/automations/authoring-catalog.js +158 -0
  242. package/dist/src/runtime/capabilities/automations/authoring-input-contracts.d.ts +140 -0
  243. package/dist/src/runtime/capabilities/automations/authoring-input-contracts.js +36 -0
  244. package/dist/src/runtime/capabilities/automations/authoring-inputs.d.ts +9 -0
  245. package/dist/src/runtime/capabilities/automations/authoring-inputs.js +86 -0
  246. package/dist/src/runtime/capabilities/automations/authoring-preparation-limits.d.ts +5 -0
  247. package/dist/src/runtime/capabilities/automations/authoring-preparation-limits.js +5 -0
  248. package/dist/src/runtime/capabilities/automations/authoring-preparation.d.ts +483 -0
  249. package/dist/src/runtime/capabilities/automations/authoring-preparation.js +51 -0
  250. package/dist/src/runtime/capabilities/automations/draft-index.d.ts +14 -0
  251. package/dist/src/runtime/capabilities/automations/draft-index.js +26 -0
  252. package/dist/src/runtime/capabilities/automations/draft-operation-refs.d.ts +11 -0
  253. package/dist/src/runtime/capabilities/automations/draft-operation-refs.js +37 -0
  254. package/dist/src/runtime/capabilities/automations/draft-receipt-admission.d.ts +24 -0
  255. package/dist/src/runtime/capabilities/automations/draft-receipt-admission.js +36 -0
  256. package/dist/src/runtime/capabilities/automations/event-presentation.d.ts +3 -0
  257. package/dist/src/runtime/capabilities/automations/event-presentation.js +18 -0
  258. package/dist/src/runtime/capabilities/automations/model-tool-contract.d.ts +3 -0
  259. package/dist/src/runtime/capabilities/automations/model-tool-contract.js +34 -0
  260. package/dist/src/runtime/capabilities/automations/tool-contract.d.ts +3 -0
  261. package/dist/src/runtime/capabilities/automations/tool-contract.js +65 -0
  262. package/dist/src/runtime/capabilities/automations/tool-module.d.ts +4 -0
  263. package/dist/src/runtime/capabilities/automations/tool-module.js +286 -0
  264. package/dist/src/runtime/capabilities/runtime-path-namespace.d.ts +6 -0
  265. package/dist/src/runtime/capabilities/runtime-path-namespace.js +48 -0
  266. package/dist/src/runtime/capabilities/runtime-target-path.d.ts +1 -0
  267. package/dist/src/runtime/capabilities/runtime-target-path.js +16 -8
  268. package/dist/src/runtime/capabilities/scheduling/create-operations.d.ts +6 -0
  269. package/dist/src/runtime/capabilities/scheduling/job-list-page.d.ts +4 -1
  270. package/dist/src/runtime/composition.d.ts +5 -2
  271. package/dist/src/runtime/context/canonical-capability-result.d.ts +4 -0
  272. package/dist/src/runtime/context/canonical-capability-result.js +80 -0
  273. package/dist/src/runtime/context/capability-brief-readmission.js +2 -5
  274. package/dist/src/runtime/context/capability-result-compaction-source.d.ts +12 -0
  275. package/dist/src/runtime/context/capability-result-compaction-source.js +61 -0
  276. package/dist/src/runtime/context/compacted-capability-result-receipt.d.ts +7 -0
  277. package/dist/src/runtime/context/compacted-capability-result-receipt.js +29 -0
  278. package/dist/src/runtime/context/compaction-source-invariant.d.ts +6 -0
  279. package/dist/src/runtime/context/compaction-source-invariant.js +12 -0
  280. package/dist/src/runtime/context/execution-compacted-evidence.d.ts +29 -0
  281. package/dist/src/runtime/context/execution-compacted-evidence.js +87 -0
  282. package/dist/src/runtime/context/execution-compaction-objective.d.ts +11 -0
  283. package/dist/src/runtime/context/execution-compaction-objective.js +12 -0
  284. package/dist/src/runtime/context/model-step-compaction.d.ts +9 -0
  285. package/dist/src/runtime/context/model-step-compaction.js +115 -128
  286. package/dist/src/runtime/context/operation-supervision-compacted-evidence.d.ts +37 -0
  287. package/dist/src/runtime/context/operation-supervision-compacted-evidence.js +69 -0
  288. package/dist/src/runtime/context/operation-supervision-evidence-binding.d.ts +29 -0
  289. package/dist/src/runtime/context/operation-supervision-evidence-binding.js +66 -0
  290. package/dist/src/runtime/context/operation-supervision-evidence-projection.d.ts +5 -0
  291. package/dist/src/runtime/context/operation-supervision-evidence-projection.js +133 -0
  292. package/dist/src/runtime/context/operation-supervision-evidence.d.ts +2 -1
  293. package/dist/src/runtime/context/operation-supervision-evidence.js +38 -37
  294. package/dist/src/runtime/context/request-tool-results-checkpoint.d.ts +3 -0
  295. package/dist/src/runtime/context/request-tool-results-checkpoint.js +126 -0
  296. package/dist/src/runtime/context/request-tool-results-message-binding.d.ts +1 -0
  297. package/dist/src/runtime/context/request-tool-results-message-binding.js +10 -0
  298. package/dist/src/runtime/context/request-tool-results-supersession.d.ts +9 -0
  299. package/dist/src/runtime/context/request-tool-results-supersession.js +78 -0
  300. package/dist/src/runtime/context/request-tool-results.d.ts +3 -9
  301. package/dist/src/runtime/context/request-tool-results.js +15 -181
  302. package/dist/src/runtime/context/runtime-filesystem-scope.d.ts +21 -0
  303. package/dist/src/runtime/context/runtime-filesystem-scope.js +51 -0
  304. package/dist/src/runtime/context/semantic-compaction/checkpoint-message.d.ts +3 -0
  305. package/dist/src/runtime/context/semantic-compaction/checkpoint-message.js +22 -0
  306. package/dist/src/runtime/context/semantic-compaction/contracts.d.ts +0 -3
  307. package/dist/src/runtime/context/semantic-compaction/contracts.js +9 -20
  308. package/dist/src/runtime/context/semantic-compaction/dependency-results.js +15 -1
  309. package/dist/src/runtime/context/semantic-compaction/evidence-scope.d.ts +7 -0
  310. package/dist/src/runtime/context/semantic-compaction/evidence-scope.js +7 -0
  311. package/dist/src/runtime/context/semantic-compaction/format.d.ts +2 -1
  312. package/dist/src/runtime/context/semantic-compaction/format.js +27 -19
  313. package/dist/src/runtime/context/semantic-compaction/generation-contracts.d.ts +18 -0
  314. package/dist/src/runtime/context/semantic-compaction/generation-contracts.js +1 -0
  315. package/dist/src/runtime/context/semantic-compaction/generation-input.d.ts +11 -0
  316. package/dist/src/runtime/context/semantic-compaction/generation-input.js +74 -0
  317. package/dist/src/runtime/context/semantic-compaction/generation-source-registration.d.ts +3 -0
  318. package/dist/src/runtime/context/semantic-compaction/generation-source-registration.js +12 -0
  319. package/dist/src/runtime/context/semantic-compaction/output-validation.d.ts +10 -0
  320. package/dist/src/runtime/context/semantic-compaction/output-validation.js +75 -0
  321. package/dist/src/runtime/context/semantic-compaction/parser.d.ts +2 -2
  322. package/dist/src/runtime/context/semantic-compaction/parser.js +13 -26
  323. package/dist/src/runtime/context/semantic-compaction/prompt.js +18 -5
  324. package/dist/src/runtime/context/semantic-compaction/repair-headroom.d.ts +4 -3
  325. package/dist/src/runtime/context/semantic-compaction/repair-headroom.js +10 -4
  326. package/dist/src/runtime/context/semantic-compaction/replacement-budget.d.ts +25 -0
  327. package/dist/src/runtime/context/semantic-compaction/replacement-budget.js +55 -0
  328. package/dist/src/runtime/context/semantic-compaction/run.d.ts +3 -14
  329. package/dist/src/runtime/context/semantic-compaction/run.js +27 -186
  330. package/dist/src/runtime/context/semantic-compaction/scope-quarantine.d.ts +17 -0
  331. package/dist/src/runtime/context/semantic-compaction/scope-quarantine.js +37 -0
  332. package/dist/src/runtime/context/semantic-compaction/snapshot.d.ts +5 -1
  333. package/dist/src/runtime/context/semantic-compaction/snapshot.js +10 -2
  334. package/dist/src/runtime/context/semantic-compaction/source-registration.d.ts +3 -0
  335. package/dist/src/runtime/context/semantic-compaction/source-registration.js +34 -0
  336. package/dist/src/runtime/context/semantic-compaction/source-slots.d.ts +5 -0
  337. package/dist/src/runtime/context/semantic-compaction/source-slots.js +4 -0
  338. package/dist/src/runtime/context/semantic-compaction/store.d.ts +6 -1
  339. package/dist/src/runtime/context/semantic-compaction/store.js +54 -9
  340. package/dist/src/runtime/context/semantic-compaction/super-child-result-source.d.ts +8 -0
  341. package/dist/src/runtime/context/semantic-compaction/super-child-result-source.js +50 -0
  342. package/dist/src/runtime/context/semantic-compaction/super-operation-source.d.ts +8 -0
  343. package/dist/src/runtime/context/semantic-compaction/super-operation-source.js +99 -0
  344. package/dist/src/runtime/context/semantic-compaction/super-reviewer-source.d.ts +16 -0
  345. package/dist/src/runtime/context/semantic-compaction/super-reviewer-source.js +37 -0
  346. package/dist/src/runtime/context/semantic-compaction/super-source-integrity.d.ts +21 -0
  347. package/dist/src/runtime/context/semantic-compaction/super-source-integrity.js +169 -0
  348. package/dist/src/runtime/context/semantic-compaction/super-source-message.d.ts +4 -0
  349. package/dist/src/runtime/context/semantic-compaction/super-source-message.js +23 -0
  350. package/dist/src/runtime/context/session-memory/model-step-controller.js +34 -20
  351. package/dist/src/runtime/context/session-memory/selection.js +0 -2
  352. package/dist/src/runtime/context/spark-conversation-policy.d.ts +4 -0
  353. package/dist/src/runtime/context/spark-conversation-policy.js +16 -0
  354. package/dist/src/runtime/context/super-compaction-failure-owner.d.ts +10 -0
  355. package/dist/src/runtime/context/super-compaction-failure-owner.js +64 -0
  356. package/dist/src/runtime/context/super-context-failure.d.ts +28 -0
  357. package/dist/src/runtime/context/super-context-failure.js +37 -0
  358. package/dist/src/runtime/context/super-context-policy.d.ts +3 -0
  359. package/dist/src/runtime/context/super-context-policy.js +35 -0
  360. package/dist/src/runtime/context/super-request-tool-results-checkpoint.d.ts +6 -0
  361. package/dist/src/runtime/context/super-request-tool-results-checkpoint.js +29 -0
  362. package/dist/src/runtime/context/super-worker-compaction-failure.d.ts +5 -0
  363. package/dist/src/runtime/context/super-worker-compaction-failure.js +19 -0
  364. package/dist/src/runtime/context/super-worker-compaction-projection.d.ts +8 -0
  365. package/dist/src/runtime/context/super-worker-compaction-projection.js +41 -0
  366. package/dist/src/runtime/context/super-worker-compaction-sidecar.d.ts +21 -0
  367. package/dist/src/runtime/context/super-worker-compaction-sidecar.js +67 -0
  368. package/dist/src/runtime/context/verified-compaction-projection.d.ts +7 -0
  369. package/dist/src/runtime/context/verified-compaction-projection.js +16 -0
  370. package/dist/src/runtime/default-environment-adapters.d.ts +4 -0
  371. package/dist/src/runtime/default-environment-adapters.js +7 -1
  372. package/dist/src/runtime/local-application.d.ts +277 -0
  373. package/dist/src/runtime/local-application.js +7 -0
  374. package/dist/src/runtime/local-host/app-learning-dispatch.js +0 -8
  375. package/dist/src/runtime/local-host/app-native-permissions.d.ts +20 -0
  376. package/dist/src/runtime/local-host/app-native-permissions.js +76 -0
  377. package/dist/src/runtime/local-host/app-owner.js +12 -1
  378. package/dist/src/runtime/local-host/app-request-control.d.ts +1 -0
  379. package/dist/src/runtime/local-host/app-request-control.js +5 -0
  380. package/dist/src/runtime/local-host/app-service-dispatch.d.ts +2 -1
  381. package/dist/src/runtime/local-host/app-service-dispatch.js +31 -0
  382. package/dist/src/runtime/local-host/client-learning.d.ts +1 -1
  383. package/dist/src/runtime/local-host/client-learning.js +0 -1
  384. package/dist/src/runtime/local-host/client-native-permissions.d.ts +4 -0
  385. package/dist/src/runtime/local-host/client-native-permissions.js +37 -0
  386. package/dist/src/runtime/local-host/client-services.d.ts +273 -0
  387. package/dist/src/runtime/local-host/client-services.js +3 -2
  388. package/dist/src/runtime/local-host/learning-preferences-input.js +1 -0
  389. package/dist/src/runtime/model/context-compaction-admission.d.ts +21 -0
  390. package/dist/src/runtime/model/context-compaction-admission.js +214 -0
  391. package/dist/src/runtime/model/context-compaction-contracts.d.ts +32 -0
  392. package/dist/src/runtime/model/context-compaction-contracts.js +1 -0
  393. package/dist/src/runtime/model/context-compaction-diagnostics.d.ts +33 -0
  394. package/dist/src/runtime/model/context-compaction-diagnostics.js +97 -0
  395. package/dist/src/runtime/model/context-compaction-stage-plan.d.ts +3 -0
  396. package/dist/src/runtime/model/context-compaction-stage-plan.js +28 -0
  397. package/dist/src/runtime/model/input-token-count.d.ts +1 -0
  398. package/dist/src/runtime/model/input-token-count.js +4 -1
  399. package/dist/src/runtime/model/invoke-step.js +80 -126
  400. package/dist/src/runtime/model/invoke-structured-step.d.ts +1 -1
  401. package/dist/src/runtime/model/invoke-structured-step.js +3 -2
  402. package/dist/src/runtime/model/model-context-assessment.d.ts +17 -0
  403. package/dist/src/runtime/model/model-context-assessment.js +51 -0
  404. package/dist/src/runtime/model/model-context-budget.js +1 -0
  405. package/dist/src/runtime/model/model-step-acceptance.d.ts +4 -0
  406. package/dist/src/runtime/model/model-step-acceptance.js +28 -0
  407. package/dist/src/runtime/model/model-step-port.d.ts +4 -15
  408. package/dist/src/runtime/model/model-step-steering.d.ts +14 -1
  409. package/dist/src/runtime/model/model-step-steering.js +23 -0
  410. package/dist/src/runtime/orchestration/capability-adapters/result.d.ts +4 -1
  411. package/dist/src/runtime/orchestration/capability-adapters/result.js +11 -7
  412. package/dist/src/runtime/orchestration/role-calls/child-return.d.ts +5 -1
  413. package/dist/src/runtime/orchestration/role-calls/child-return.js +2 -2
  414. package/dist/src/runtime/orchestration/worker-capabilities/binding/invocation-preparation.js +1 -8
  415. package/dist/src/runtime/orchestration/worker-capabilities/contracts.d.ts +3 -4
  416. package/dist/src/runtime/orchestration/worker-capabilities/contracts.js +1 -1
  417. package/dist/src/runtime/orchestration/worker-capabilities/execution/context-projection.js +2 -1
  418. package/dist/src/runtime/orchestration/worker-capabilities/payload-assignment-validation.js +9 -9
  419. package/dist/src/runtime/orchestration/worker-capabilities/payload-author.js +9 -33
  420. package/dist/src/runtime/orchestration/worker-capabilities/payload-body-normalization.d.ts +12 -0
  421. package/dist/src/runtime/orchestration/worker-capabilities/payload-body-normalization.js +80 -0
  422. package/dist/src/runtime/orchestration/worker-capabilities/payload-compaction-transport.d.ts +3 -0
  423. package/dist/src/runtime/orchestration/worker-capabilities/payload-compaction-transport.js +14 -0
  424. package/dist/src/runtime/orchestration/worker-capabilities/payload-context-snapshot.d.ts +2 -0
  425. package/dist/src/runtime/orchestration/worker-capabilities/payload-context-snapshot.js +12 -0
  426. package/dist/src/runtime/orchestration/worker-capabilities/payload-contracts.d.ts +5 -1
  427. package/dist/src/runtime/orchestration/worker-capabilities/payload-instructions.js +1 -1
  428. package/dist/src/runtime/passive-learning/background-dependencies.d.ts +0 -1
  429. package/dist/src/runtime/passive-learning/contracts.d.ts +2 -3
  430. package/dist/src/runtime/passive-learning/proactive/agent.d.ts +3 -0
  431. package/dist/src/runtime/passive-learning/proactive/agent.js +36 -14
  432. package/dist/src/runtime/passive-learning/proactive/contracts.d.ts +7 -1
  433. package/dist/src/runtime/passive-learning/proactive/contracts.js +8 -1
  434. package/dist/src/runtime/passive-learning/proactive/conversation-style-prompt.d.ts +1 -0
  435. package/dist/src/runtime/passive-learning/proactive/conversation-style-prompt.js +6 -0
  436. package/dist/src/runtime/passive-learning/proactive/conversation-style-reference.d.ts +30 -0
  437. package/dist/src/runtime/passive-learning/proactive/conversation-style-reference.js +61 -0
  438. package/dist/src/runtime/passive-learning/proactive/handoff-brief.d.ts +1 -0
  439. package/dist/src/runtime/passive-learning/proactive/handoff-brief.js +4 -0
  440. package/dist/src/runtime/passive-learning/proactive/model-output.d.ts +1 -1
  441. package/dist/src/runtime/passive-learning/proactive/model-output.js +5 -4
  442. package/dist/src/runtime/passive-learning/proactive/model.d.ts +7 -1
  443. package/dist/src/runtime/passive-learning/proactive/model.js +58 -32
  444. package/dist/src/runtime/passive-learning/proactive/prompt.d.ts +1 -1
  445. package/dist/src/runtime/passive-learning/proactive/prompt.js +4 -2
  446. package/dist/src/runtime/passive-learning/proactive/staged-authoring.d.ts +14 -0
  447. package/dist/src/runtime/passive-learning/proactive/staged-authoring.js +27 -0
  448. package/dist/src/runtime/passive-learning/proactive/staged-context.d.ts +13 -0
  449. package/dist/src/runtime/passive-learning/proactive/staged-context.js +39 -4
  450. package/dist/src/runtime/passive-learning/proactive/staged-contract.d.ts +3 -0
  451. package/dist/src/runtime/passive-learning/proactive/staged-contract.js +4 -0
  452. package/dist/src/runtime/passive-learning/proactive/staged-format.d.ts +5 -1
  453. package/dist/src/runtime/passive-learning/proactive/staged-format.js +2 -4
  454. package/dist/src/runtime/passive-learning/proactive/staged-output.d.ts +3 -4
  455. package/dist/src/runtime/passive-learning/proactive/staged-output.js +13 -5
  456. package/dist/src/runtime/passive-learning/proactive/staged-progress-store.d.ts +0 -1
  457. package/dist/src/runtime/passive-learning/proactive/staged-progress-store.js +2 -18
  458. package/dist/src/runtime/passive-learning/proactive/staged-prompt.d.ts +3 -1
  459. package/dist/src/runtime/passive-learning/proactive/staged-prompt.js +13 -4
  460. package/dist/src/runtime/passive-learning/proactive/staged-review.d.ts +1 -1
  461. package/dist/src/runtime/passive-learning/proactive/staged-review.js +10 -11
  462. package/dist/src/runtime/passive-learning/proactive/store.d.ts +1 -1
  463. package/dist/src/runtime/passive-learning/proactive/store.js +11 -5
  464. package/dist/src/runtime/passive-learning/review-progress.d.ts +1 -1
  465. package/dist/src/runtime/passive-learning/review-progress.js +2 -2
  466. package/dist/src/runtime/passive-learning/service-status.js +2 -2
  467. package/dist/src/runtime/passive-learning/service.js +0 -6
  468. package/dist/src/runtime/passive-learning/spark-chat-preferences.d.ts +3 -0
  469. package/dist/src/runtime/passive-learning/spark-chat-preferences.js +8 -0
  470. package/dist/src/runtime/passive-learning/staged-review-call.d.ts +3 -0
  471. package/dist/src/runtime/passive-learning/staged-review-call.js +19 -13
  472. package/dist/src/runtime/passive-learning/store.js +4 -0
  473. package/dist/src/runtime/plugins/manifest-projection.js +4 -0
  474. package/dist/src/runtime/plugins/manifest-validator.js +7 -0
  475. package/dist/src/runtime/ports.d.ts +14 -1
  476. package/dist/src/runtime/request/approval-wait/activation-events.d.ts +5 -0
  477. package/dist/src/runtime/request/approval-wait/activation-events.js +4 -3
  478. package/dist/src/runtime/request/approval-wait/snapshot.d.ts +1 -1
  479. package/dist/src/runtime/request/approval-wait/snapshot.js +1 -0
  480. package/dist/src/runtime/request/approval-wait/super-compaction-restore.d.ts +20 -0
  481. package/dist/src/runtime/request/approval-wait/super-compaction-restore.js +61 -0
  482. package/dist/src/runtime/request/automation-output-contract.d.ts +6 -0
  483. package/dist/src/runtime/request/automation-output-contract.js +33 -0
  484. package/dist/src/runtime/request/contracts.d.ts +16 -0
  485. package/dist/src/runtime/request/execution-agent-root-execution.js +2 -0
  486. package/dist/src/runtime/request/execution-facets.js +7 -0
  487. package/dist/src/runtime/request/execution-payload-compacted-evidence.d.ts +64 -0
  488. package/dist/src/runtime/request/execution-payload-compacted-evidence.js +46 -0
  489. package/dist/src/runtime/request/execution-scope-surfaces.d.ts +2 -0
  490. package/dist/src/runtime/request/execution-scope-surfaces.js +28 -0
  491. package/dist/src/runtime/request/execution-scope.d.ts +8 -2
  492. package/dist/src/runtime/request/execution-scope.js +14 -2
  493. package/dist/src/runtime/request/handler.d.ts +7 -0
  494. package/dist/src/runtime/request/handler.js +196 -35
  495. package/dist/src/runtime/request/locked-request-steering.d.ts +3 -0
  496. package/dist/src/runtime/request/locked-request-steering.js +12 -0
  497. package/dist/src/runtime/request/policy-degraded-finalization.d.ts +10 -0
  498. package/dist/src/runtime/request/policy-degraded-finalization.js +27 -0
  499. package/dist/src/runtime/request/prepared-execution.d.ts +10 -1
  500. package/dist/src/runtime/request/prepared-execution.js +43 -8
  501. package/dist/src/runtime/request/request-steering.d.ts +1 -1
  502. package/dist/src/runtime/request/result.d.ts +3 -0
  503. package/dist/src/runtime/request/role-executor-composition.js +4 -3
  504. package/dist/src/runtime/request/root-contract.d.ts +2 -0
  505. package/dist/src/runtime/request/root-execution-kernel.js +10 -9
  506. package/dist/src/runtime/request/root-invalid-output.js +16 -1
  507. package/dist/src/runtime/request/session-admission.d.ts +6 -0
  508. package/dist/src/runtime/request/session-admission.js +47 -14
  509. package/dist/src/runtime/request/super-checkpoint-quarantine.d.ts +8 -0
  510. package/dist/src/runtime/request/super-checkpoint-quarantine.js +76 -0
  511. package/dist/src/runtime/request/super-context-failure-executor.d.ts +4 -0
  512. package/dist/src/runtime/request/super-context-failure-executor.js +68 -0
  513. package/dist/src/runtime/request/super-context-failure-integrity.d.ts +16 -0
  514. package/dist/src/runtime/request/super-context-failure-integrity.js +130 -0
  515. package/dist/src/runtime/request/super-context-scope.d.ts +9 -0
  516. package/dist/src/runtime/request/super-context-scope.js +65 -0
  517. package/dist/src/runtime/request/super-failure-explanation.d.ts +22 -0
  518. package/dist/src/runtime/request/super-failure-explanation.js +77 -0
  519. package/dist/src/runtime/request/super-failure-message.d.ts +10 -0
  520. package/dist/src/runtime/request/super-failure-message.js +40 -0
  521. package/dist/src/runtime/request/super-payload-context-failure.d.ts +11 -0
  522. package/dist/src/runtime/request/super-payload-context-failure.js +55 -0
  523. package/dist/src/runtime/request/super-root-failure-finalization.d.ts +23 -0
  524. package/dist/src/runtime/request/super-root-failure-finalization.js +112 -0
  525. package/dist/src/runtime/request/worker-capability-composition.d.ts +2 -0
  526. package/dist/src/runtime/request/worker-capability-composition.js +4 -1
  527. package/dist/src/runtime/request/worker-capability-payload.d.ts +2 -1
  528. package/dist/src/runtime/request/worker-capability-payload.js +74 -48
  529. package/dist/src/runtime/runtime-environment.d.ts +3 -1
  530. package/dist/src/runtime/runtime-environment.js +167 -1
  531. package/dist/src/runtime/scheduler/automation-job-management.d.ts +12 -0
  532. package/dist/src/runtime/scheduler/automation-job-management.js +288 -0
  533. package/dist/src/runtime/scheduler/automation-rerun.d.ts +6 -0
  534. package/dist/src/runtime/scheduler/automation-rerun.js +95 -0
  535. package/dist/src/runtime/scheduler/automation-run-budget.d.ts +4 -0
  536. package/dist/src/runtime/scheduler/automation-run-budget.js +16 -0
  537. package/dist/src/runtime/scheduler/automation-run-change-events.d.ts +11 -0
  538. package/dist/src/runtime/scheduler/automation-run-change-events.js +77 -0
  539. package/dist/src/runtime/scheduler/automation-run-completion.d.ts +11 -0
  540. package/dist/src/runtime/scheduler/automation-run-completion.js +93 -0
  541. package/dist/src/runtime/scheduler/automation-run-control.d.ts +3 -0
  542. package/dist/src/runtime/scheduler/automation-run-control.js +48 -0
  543. package/dist/src/runtime/scheduler/automation-run-records.d.ts +5 -0
  544. package/dist/src/runtime/scheduler/automation-run-records.js +37 -0
  545. package/dist/src/runtime/scheduler/automation-schedule.d.ts +10 -0
  546. package/dist/src/runtime/scheduler/automation-schedule.js +48 -0
  547. package/dist/src/runtime/scheduler/automation-scheduler-engine.d.ts +4 -0
  548. package/dist/src/runtime/scheduler/automation-scheduler-engine.js +188 -0
  549. package/dist/src/runtime/scheduler/automation-snapshot-validation.d.ts +3 -0
  550. package/dist/src/runtime/scheduler/automation-snapshot-validation.js +106 -0
  551. package/dist/src/runtime/scheduler/contracts.d.ts +143 -3
  552. package/dist/src/runtime/scheduler/file-store.js +15 -1
  553. package/dist/src/runtime/scheduler/job-management.js +3 -2
  554. package/dist/src/runtime/scheduler/journal-automation-index.d.ts +23 -0
  555. package/dist/src/runtime/scheduler/journal-automation-index.js +205 -0
  556. package/dist/src/runtime/scheduler/journal-automation-transaction.d.ts +11 -0
  557. package/dist/src/runtime/scheduler/journal-automation-transaction.js +90 -0
  558. package/dist/src/runtime/scheduler/journal-checkpoint.js +5 -2
  559. package/dist/src/runtime/scheduler/journal-head.d.ts +1 -1
  560. package/dist/src/runtime/scheduler/journal-head.js +2 -2
  561. package/dist/src/runtime/scheduler/journal-index-state.d.ts +21 -10
  562. package/dist/src/runtime/scheduler/journal-index-state.js +76 -17
  563. package/dist/src/runtime/scheduler/journal-index.d.ts +9 -3
  564. package/dist/src/runtime/scheduler/journal-index.js +84 -9
  565. package/dist/src/runtime/scheduler/journal-store.d.ts +9 -1
  566. package/dist/src/runtime/scheduler/journal-store.js +110 -7
  567. package/dist/src/runtime/scheduler/journal-transaction.d.ts +7 -4
  568. package/dist/src/runtime/scheduler/journal-transaction.js +13 -2
  569. package/dist/src/runtime/scheduler/next-occurrence.js +2 -0
  570. package/dist/src/runtime/scheduler/run-completion.js +2 -1
  571. package/dist/src/runtime/scheduler/run-records.js +8 -3
  572. package/dist/src/runtime/scheduler/schedule-update.d.ts +2 -2
  573. package/dist/src/runtime/scheduler/schedule-validation.d.ts +2 -2
  574. package/dist/src/runtime/scheduler/schedule-validation.js +2 -0
  575. package/dist/src/runtime/scheduler/scheduler-engine.js +24 -8
  576. package/dist/src/runtime/scheduler/scheduler-service.d.ts +4 -1
  577. package/dist/src/runtime/scheduler/scheduler-service.js +83 -10
  578. package/dist/src/runtime/scheduler/scheduler-target.d.ts +9 -0
  579. package/dist/src/runtime/scheduler/scheduler-target.js +41 -0
  580. package/dist/src/runtime/scheduler/service-context.d.ts +6 -2
  581. package/dist/src/runtime/scheduler/service-context.js +6 -3
  582. package/dist/src/runtime/scheduler/snapshot-validation.d.ts +3 -3
  583. package/dist/src/runtime/scheduler/snapshot-validation.js +21 -1
  584. package/dist/src/runtime/scheduler/startup-recovery.d.ts +1 -1
  585. package/dist/src/runtime/scheduler/startup-recovery.js +15 -2
  586. package/dist/src/runtime/scheduler/working-store.js +8 -0
  587. package/dist/src/runtime/session/request-session.d.ts +1 -0
  588. package/dist/src/runtime/session/request-session.js +1 -0
  589. package/dist/src/runtime/session/session-deletion-boundary.d.ts +1 -1
  590. package/dist/src/runtime/session/session-deletion-boundary.js +6 -2
  591. package/dist/src/runtime/session/session-lifecycle-store.d.ts +4 -1
  592. package/dist/src/runtime/session/session-lifecycle-store.js +32 -4
  593. package/dist/src/runtime/session/spark-session-attachments.d.ts +4 -0
  594. package/dist/src/runtime/session/spark-session-attachments.js +28 -0
  595. package/dist/src/runtime/session/spark-session-cleanup-receipt.d.ts +7 -0
  596. package/dist/src/runtime/session/spark-session-cleanup-receipt.js +61 -0
  597. package/dist/src/runtime/session/spark-session-clear.d.ts +6 -0
  598. package/dist/src/runtime/session/spark-session-clear.js +36 -0
  599. package/dist/src/runtime/session/terminal-response.d.ts +21 -0
  600. package/dist/src/runtime/session/terminal-response.js +38 -0
  601. package/dist/src/runtime/steps/auditor-decision/advisory-receipt.d.ts +1 -0
  602. package/dist/src/runtime/steps/auditor-decision/advisory-receipt.js +12 -0
  603. package/dist/src/runtime/steps/auditor-decision/contracts.d.ts +4 -0
  604. package/dist/src/runtime/steps/auditor-decision/evidence-coverage.js +5 -5
  605. package/dist/src/runtime/steps/auditor-decision/evidence-inventory.d.ts +2 -1
  606. package/dist/src/runtime/steps/auditor-decision/evidence-inventory.js +12 -1
  607. package/dist/src/runtime/steps/auditor-decision/evidence-representation.d.ts +8 -2
  608. package/dist/src/runtime/steps/auditor-decision/evidence-representation.js +14 -1
  609. package/dist/src/runtime/steps/auditor-decision/input.d.ts +2 -0
  610. package/dist/src/runtime/steps/auditor-decision/input.js +12 -3
  611. package/dist/src/runtime/steps/auditor-decision/projection.js +20 -1
  612. package/dist/src/runtime/steps/auditor-decision/prompt.js +6 -6
  613. package/dist/src/runtime/steps/auditor-decision/run.js +2 -3
  614. package/dist/src/runtime/steps/capability-execution-instructions.d.ts +5 -0
  615. package/dist/src/runtime/steps/capability-execution-instructions.js +5 -0
  616. package/dist/src/runtime/steps/degraded-finalization/contract.d.ts +3 -0
  617. package/dist/src/runtime/steps/degraded-finalization/fallback.js +14 -4
  618. package/dist/src/runtime/steps/degraded-finalization/input.js +11 -1
  619. package/dist/src/runtime/steps/degraded-finalization/output-limit-cause.d.ts +4 -0
  620. package/dist/src/runtime/steps/degraded-finalization/output-limit-cause.js +17 -0
  621. package/dist/src/runtime/steps/degraded-finalization/prompt.js +4 -1
  622. package/dist/src/runtime/steps/degraded-finalization/super.d.ts +20 -0
  623. package/dist/src/runtime/steps/degraded-finalization/super.js +128 -0
  624. package/dist/src/runtime/steps/execution-agent/capability-decision-parsing.d.ts +1 -0
  625. package/dist/src/runtime/steps/execution-agent/capability-decision-parsing.js +21 -3
  626. package/dist/src/runtime/steps/execution-agent/capability-invocation-contract.d.ts +1 -1
  627. package/dist/src/runtime/steps/execution-agent/capability-invocation-contract.js +4 -2
  628. package/dist/src/runtime/steps/execution-agent/capability-selection-schema.d.ts +3 -0
  629. package/dist/src/runtime/steps/execution-agent/capability-selection-schema.js +72 -0
  630. package/dist/src/runtime/steps/execution-agent/compaction.d.ts +5 -2
  631. package/dist/src/runtime/steps/execution-agent/compaction.js +10 -4
  632. package/dist/src/runtime/steps/execution-agent/contracts.d.ts +14 -2
  633. package/dist/src/runtime/steps/execution-agent/controls-compacted-evidence.d.ts +16 -0
  634. package/dist/src/runtime/steps/execution-agent/controls-compacted-evidence.js +67 -0
  635. package/dist/src/runtime/steps/execution-agent/controls-evidence-contract.d.ts +21 -0
  636. package/dist/src/runtime/steps/execution-agent/controls-evidence-contract.js +64 -0
  637. package/dist/src/runtime/steps/execution-agent/controls-evidence.d.ts +32 -0
  638. package/dist/src/runtime/steps/execution-agent/controls-evidence.js +119 -0
  639. package/dist/src/runtime/steps/execution-agent/decision-parsing.js +1 -0
  640. package/dist/src/runtime/steps/execution-agent/format.d.ts +2 -0
  641. package/dist/src/runtime/steps/execution-agent/format.js +9 -68
  642. package/dist/src/runtime/steps/execution-agent/input.js +19 -2
  643. package/dist/src/runtime/steps/execution-agent/prompt.d.ts +1 -0
  644. package/dist/src/runtime/steps/execution-agent/prompt.js +15 -2
  645. package/dist/src/runtime/steps/execution-agent/refinement-input.d.ts +32 -0
  646. package/dist/src/runtime/steps/execution-agent/refinement-input.js +146 -0
  647. package/dist/src/runtime/steps/execution-agent/refinement-prompt.d.ts +1 -0
  648. package/dist/src/runtime/steps/execution-agent/refinement-prompt.js +11 -0
  649. package/dist/src/runtime/steps/execution-agent/refinement.d.ts +4 -4
  650. package/dist/src/runtime/steps/execution-agent/refinement.js +18 -108
  651. package/dist/src/runtime/steps/execution-agent/response-input.js +13 -6
  652. package/dist/src/runtime/steps/execution-agent/response-prompt.js +1 -1
  653. package/dist/src/runtime/steps/execution-agent/response-run.js +19 -5
  654. package/dist/src/runtime/steps/execution-agent/run.js +9 -3
  655. package/dist/src/runtime/steps/execution-agent/state-context.d.ts +1 -1
  656. package/dist/src/runtime/steps/execution-agent/state-context.js +20 -5
  657. package/dist/src/runtime/steps/planner-decision/input.js +7 -0
  658. package/dist/src/runtime/steps/planner-decision/resume.d.ts +2 -1
  659. package/dist/src/runtime/steps/planner-decision/resume.js +3 -3
  660. package/dist/src/runtime/steps/planner-decision/run.js +13 -0
  661. package/dist/src/runtime/steps/planner-graph/prompt.js +2 -0
  662. package/dist/src/runtime/steps/planner-graph/run.js +1 -0
  663. package/dist/src/runtime/steps/reviewer-decision/projection.js +5 -0
  664. package/dist/src/runtime/steps/reviewer-decision/run.js +13 -0
  665. package/dist/src/runtime/steps/supervisor-decision/input.d.ts +1 -1
  666. package/dist/src/runtime/steps/supervisor-decision/input.js +2 -0
  667. package/dist/src/runtime/steps/supervisor-decision/run.js +14 -0
  668. package/dist/src/runtime/steps/supervisor-decision/working-directory.d.ts +2 -0
  669. package/dist/src/runtime/steps/supervisor-decision/working-directory.js +6 -0
  670. package/dist/src/runtime/steps/supervisor-response/input.d.ts +1 -1
  671. package/dist/src/runtime/steps/supervisor-response/input.js +14 -7
  672. package/dist/src/runtime/steps/supervisor-response/run.js +39 -9
  673. package/dist/src/runtime/steps/worker-decision/compaction-integrity.d.ts +11 -0
  674. package/dist/src/runtime/steps/worker-decision/compaction-integrity.js +40 -0
  675. package/dist/src/runtime/steps/worker-decision/input/reference-context.js +7 -0
  676. package/dist/src/runtime/steps/worker-decision/input/types.d.ts +4 -1
  677. package/dist/src/runtime/steps/worker-decision/prompt.js +9 -2
  678. package/dist/src/runtime/steps/worker-decision/result-author.js +4 -0
  679. package/dist/src/runtime/steps/worker-decision/run.js +12 -49
  680. package/dist/src/runtime/steps/worker-decision/worker-handoff-compaction.d.ts +4 -0
  681. package/dist/src/runtime/steps/worker-decision/worker-handoff-compaction.js +69 -0
  682. package/dist/src/sessions/assistant-initiative-append.d.ts +14 -0
  683. package/dist/src/sessions/assistant-initiative-append.js +64 -0
  684. package/dist/src/sessions/assistant-initiative.d.ts +4 -0
  685. package/dist/src/sessions/assistant-initiative.js +7 -1
  686. package/dist/src/sessions/automation-session-origin.d.ts +34 -0
  687. package/dist/src/sessions/automation-session-origin.js +78 -0
  688. package/dist/src/sessions/automation-session-store.d.ts +12 -0
  689. package/dist/src/sessions/automation-session-store.js +129 -0
  690. package/dist/src/sessions/index.d.ts +1 -0
  691. package/dist/src/sessions/index.js +3 -0
  692. package/dist/src/sessions/memory/source.d.ts +1 -1
  693. package/dist/src/sessions/memory/source.js +4 -11
  694. package/dist/src/sessions/project-binding.d.ts +1 -0
  695. package/dist/src/sessions/record/projection.d.ts +1 -0
  696. package/dist/src/sessions/record/projection.js +4 -0
  697. package/dist/src/sessions/session-service.d.ts +9 -0
  698. package/dist/src/sessions/session-service.js +53 -4
  699. package/dist/src/sessions/spark-handoff-brief.d.ts +3 -0
  700. package/dist/src/sessions/spark-handoff-brief.js +9 -0
  701. package/dist/src/sessions/spark-session.d.ts +13 -0
  702. package/dist/src/sessions/spark-session.js +25 -0
  703. package/dist/src/sessions/types.d.ts +5 -0
  704. package/dist/src/web-ui/app/ARCHITECTURE.md +89 -0
  705. package/dist/src/web-ui/app/app-bootstrap.js +24 -2
  706. package/dist/src/web-ui/app/app-dom.js +5 -0
  707. package/dist/src/web-ui/app/app-realtime-transport.js +27 -2
  708. package/dist/src/web-ui/app/app.js +5 -10
  709. package/dist/src/web-ui/app/automations-feature.js +103 -0
  710. package/dist/src/web-ui/app/components/automations/archive-actions.js +20 -0
  711. package/dist/src/web-ui/app/components/automations/authoring-entry.js +25 -0
  712. package/dist/src/web-ui/app/components/automations/binding-editor.js +101 -0
  713. package/dist/src/web-ui/app/components/automations/binding-fields.js +166 -0
  714. package/dist/src/web-ui/app/components/automations/chat-run-projection.js +280 -0
  715. package/dist/src/web-ui/app/components/automations/draft-recovery-actions.js +28 -0
  716. package/dist/src/web-ui/app/components/automations/editor-action-icons.js +18 -0
  717. package/dist/src/web-ui/app/components/automations/editor-actions.js +57 -0
  718. package/dist/src/web-ui/app/components/automations/editor.js +218 -0
  719. package/dist/src/web-ui/app/components/automations/failure-presentation.js +299 -0
  720. package/dist/src/web-ui/app/components/automations/library-tabs.js +45 -0
  721. package/dist/src/web-ui/app/components/automations/list.js +58 -0
  722. package/dist/src/web-ui/app/components/automations/live-view.js +39 -0
  723. package/dist/src/web-ui/app/components/automations/node-inspector.js +251 -0
  724. package/dist/src/web-ui/app/components/automations/permission-selection.js +37 -0
  725. package/dist/src/web-ui/app/components/automations/rerun-confirmation.js +16 -0
  726. package/dist/src/web-ui/app/components/automations/run-output-view.js +100 -0
  727. package/dist/src/web-ui/app/components/automations/run-report-view.js +224 -0
  728. package/dist/src/web-ui/app/components/automations/run-step-selection.js +7 -0
  729. package/dist/src/web-ui/app/components/automations/run-steps-view.js +33 -0
  730. package/dist/src/web-ui/app/components/automations/run.js +38 -0
  731. package/dist/src/web-ui/app/components/automations/schema-literal-inputs.js +212 -0
  732. package/dist/src/web-ui/app/components/automations/step-editor-dialog.js +243 -0
  733. package/dist/src/web-ui/app/components/automations/step-preview.js +48 -0
  734. package/dist/src/web-ui/app/components/automations/template-gallery.js +74 -0
  735. package/dist/src/web-ui/app/components/automations/timeline-camera.js +219 -0
  736. package/dist/src/web-ui/app/components/automations/timeline.js +141 -0
  737. package/dist/src/web-ui/app/components/automations/tool-identity.js +25 -0
  738. package/dist/src/web-ui/app/components/automations/workspace.js +462 -0
  739. package/dist/src/web-ui/app/components/composer-context-window.js +24 -13
  740. package/dist/src/web-ui/app/components/config-workspace/model-rendering.js +2 -2
  741. package/dist/src/web-ui/app/components/conversation-activity.d.ts +2 -28
  742. package/dist/src/web-ui/app/components/conversation-activity.js +23 -60
  743. package/dist/src/web-ui/app/components/conversation-status.js +3 -2
  744. package/dist/src/web-ui/app/components/conversation-view.js +36 -14
  745. package/dist/src/web-ui/app/components/dashboard/automations.js +28 -0
  746. package/dist/src/web-ui/app/components/dashboard/workspace.js +9 -0
  747. package/dist/src/web-ui/app/components/notifications/dom.js +1 -1
  748. package/dist/src/web-ui/app/components/notifications/feedback.js +34 -0
  749. package/dist/src/web-ui/app/components/notifications/pagination.js +13 -0
  750. package/dist/src/web-ui/app/components/notifications/presentation.js +25 -4
  751. package/dist/src/web-ui/app/components/notifications/tabs.js +49 -0
  752. package/dist/src/web-ui/app/components/notifications/workspace.js +19 -26
  753. package/dist/src/web-ui/app/components/onboarding-workspace-access.js +1 -1
  754. package/dist/src/web-ui/app/components/passive-learning/agent-state.js +0 -5
  755. package/dist/src/web-ui/app/components/passive-learning/agent-view.js +1 -1
  756. package/dist/src/web-ui/app/components/passive-learning/home.js +0 -4
  757. package/dist/src/web-ui/app/components/passive-learning/memory.js +0 -3
  758. package/dist/src/web-ui/app/components/passive-learning/settings-view.js +2 -2
  759. package/dist/src/web-ui/app/components/passive-learning/workspace-view.js +3 -3
  760. package/dist/src/web-ui/app/components/runtime-setup/optional-steps.js +7 -1
  761. package/dist/src/web-ui/app/components/runtime-setup-guide.d.ts +5 -1
  762. package/dist/src/web-ui/app/components/runtime-setup-guide.js +6 -3
  763. package/dist/src/web-ui/app/components/schedules/details.js +3 -2
  764. package/dist/src/web-ui/app/components/schedules/form.js +4 -4
  765. package/dist/src/web-ui/app/components/spark-chat/empty-state.js +45 -0
  766. package/dist/src/web-ui/app/components/spark-chat/handoff-actions.js +59 -0
  767. package/dist/src/web-ui/app/components/spark-chat/mascot-activity.js +27 -0
  768. package/dist/src/web-ui/app/components/spark-chat/motion.js +52 -0
  769. package/dist/src/web-ui/app/components/spark-chat/panel.js +109 -0
  770. package/dist/src/web-ui/app/components/spark-chat/placement.js +198 -0
  771. package/dist/src/web-ui/app/components/spark-chat/results.js +44 -0
  772. package/dist/src/web-ui/app/components/spark-chat/settings.js +84 -0
  773. package/dist/src/web-ui/app/components/system-host/macos-permission-preparation.js +83 -0
  774. package/dist/src/web-ui/app/components/system-host/macos-permission-rendering.js +85 -0
  775. package/dist/src/web-ui/app/components/system-host/macos-permission-scopes.js +51 -0
  776. package/dist/src/web-ui/app/components/system-host/manager.js +34 -0
  777. package/dist/src/web-ui/app/components/system-host/rendering.js +12 -4
  778. package/dist/src/web-ui/app/components/workspace-shell.js +39 -6
  779. package/dist/src/web-ui/app/computer-access-feature.js +5 -0
  780. package/dist/src/web-ui/app/configuration-feature.js +1 -0
  781. package/dist/src/web-ui/app/controllers/app-event-bindings.js +24 -2
  782. package/dist/src/web-ui/app/controllers/automation-draft-actions.js +153 -0
  783. package/dist/src/web-ui/app/controllers/automation-management-actions.js +75 -0
  784. package/dist/src/web-ui/app/controllers/automation-mutation-lifecycle.js +32 -0
  785. package/dist/src/web-ui/app/controllers/automation-read-projection.js +63 -0
  786. package/dist/src/web-ui/app/controllers/automation-run-actions.js +54 -0
  787. package/dist/src/web-ui/app/controllers/automation-view-scope.js +19 -0
  788. package/dist/src/web-ui/app/controllers/automations-controller.js +395 -0
  789. package/dist/src/web-ui/app/controllers/composer-queue-controller.d.ts +1 -0
  790. package/dist/src/web-ui/app/controllers/composer-queue-controller.js +18 -12
  791. package/dist/src/web-ui/app/controllers/conversation-session-controller.js +38 -15
  792. package/dist/src/web-ui/app/controllers/conversation-view-feature.js +1 -14
  793. package/dist/src/web-ui/app/controllers/dashboard-controller.js +42 -1
  794. package/dist/src/web-ui/app/controllers/notifications-controller.js +1 -1
  795. package/dist/src/web-ui/app/controllers/passive-learning-controller.js +33 -85
  796. package/dist/src/web-ui/app/controllers/projects-controller.d.ts +2 -0
  797. package/dist/src/web-ui/app/controllers/projects-controller.js +53 -18
  798. package/dist/src/web-ui/app/controllers/realtime-event-controller.js +42 -160
  799. package/dist/src/web-ui/app/controllers/request-lifecycle-controller.js +2 -0
  800. package/dist/src/web-ui/app/controllers/runtime-onboarding-controller.d.ts +4 -1
  801. package/dist/src/web-ui/app/controllers/runtime-onboarding-controller.js +14 -3
  802. package/dist/src/web-ui/app/controllers/schedules-controller.js +11 -19
  803. package/dist/src/web-ui/app/controllers/spark-chat-notices.js +34 -0
  804. package/dist/src/web-ui/app/controllers/spark-chat-reading.js +145 -0
  805. package/dist/src/web-ui/app/controllers/spark-chat-sync.js +151 -0
  806. package/dist/src/web-ui/app/controllers/spark-handoff-navigation.js +32 -0
  807. package/dist/src/web-ui/app/controllers/workspace-route-controller.js +21 -1
  808. package/dist/src/web-ui/app/dashboard-feature.js +0 -1
  809. package/dist/src/web-ui/app/index.html +12 -10
  810. package/dist/src/web-ui/app/lib/automation-binding-producers.js +47 -0
  811. package/dist/src/web-ui/app/lib/automation-graph-position.js +19 -0
  812. package/dist/src/web-ui/app/lib/automation-parallel-depth.js +19 -0
  813. package/dist/src/web-ui/app/lib/configuration-pages.js +3 -5
  814. package/dist/src/web-ui/app/lib/context-compaction-state.d.ts +41 -0
  815. package/dist/src/web-ui/app/lib/context-compaction-state.js +172 -0
  816. package/dist/src/web-ui/app/lib/context-window-measurement.d.ts +33 -0
  817. package/dist/src/web-ui/app/lib/context-window-measurement.js +99 -0
  818. package/dist/src/web-ui/app/lib/context-window-replay.d.ts +32 -0
  819. package/dist/src/web-ui/app/lib/context-window-replay.js +38 -0
  820. package/dist/src/web-ui/app/lib/context-window-snapshot-order.d.ts +16 -8
  821. package/dist/src/web-ui/app/lib/context-window-snapshot-order.js +29 -9
  822. package/dist/src/web-ui/app/lib/context-window-state.d.ts +80 -0
  823. package/dist/src/web-ui/app/lib/context-window-state.js +341 -0
  824. package/dist/src/web-ui/app/lib/conversation-status-model.js +15 -3
  825. package/dist/src/web-ui/app/lib/realtime-message.js +9 -0
  826. package/dist/src/web-ui/app/lib/schedule-conversation-presentation.js +19 -0
  827. package/dist/src/web-ui/app/lib/schedule-presentation.js +2 -2
  828. package/dist/src/web-ui/app/lib/spark-chat-address.js +22 -0
  829. package/dist/src/web-ui/app/lib/spark-chat-presentation.js +16 -0
  830. package/dist/src/web-ui/app/lib/spark-chat-read-state.js +13 -0
  831. package/dist/src/web-ui/app/lib/spark-proposal-message.js +7 -0
  832. package/dist/src/web-ui/app/lib/tool-activity-event.d.ts +1 -0
  833. package/dist/src/web-ui/app/lib/tool-activity-event.js +6 -2
  834. package/dist/src/web-ui/app/lib/tool-activity-model.js +1 -0
  835. package/dist/src/web-ui/app/lib/tool-approval-acknowledgement.js +7 -0
  836. package/dist/src/web-ui/app/lib/tool-automation-activity-fields.js +59 -0
  837. package/dist/src/web-ui/app/lib/tool-process-activity-fields.js +1 -1
  838. package/dist/src/web-ui/app/lib/workspace-change.js +2 -2
  839. package/dist/src/web-ui/app/lib/workspace-route.d.ts +3 -0
  840. package/dist/src/web-ui/app/lib/workspace-route.js +13 -2
  841. package/dist/src/web-ui/app/notifications-feature.js +13 -0
  842. package/dist/src/web-ui/app/passive-learning-feature.js +5 -30
  843. package/dist/src/web-ui/app/projects-feature.js +16 -5
  844. package/dist/src/web-ui/app/runtime-onboarding-feature.js +1 -0
  845. package/dist/src/web-ui/app/services/client-preferences.d.ts +0 -2
  846. package/dist/src/web-ui/app/services/client-preferences.js +0 -2
  847. package/dist/src/web-ui/app/services/runtime-web-client/automations.d.ts +36 -0
  848. package/dist/src/web-ui/app/services/runtime-web-client/automations.js +63 -0
  849. package/dist/src/web-ui/app/services/runtime-web-client/learning.js +0 -9
  850. package/dist/src/web-ui/app/services/runtime-web-client/spark-chat.d.ts +22 -0
  851. package/dist/src/web-ui/app/services/runtime-web-client/spark-chat.js +29 -0
  852. package/dist/src/web-ui/app/services/runtime-web-client/system-host.js +4 -2
  853. package/dist/src/web-ui/app/services/runtime-web-client.d.ts +24 -4
  854. package/dist/src/web-ui/app/services/runtime-web-client.js +5 -1
  855. package/dist/src/web-ui/app/spark-chat-conversation.js +217 -0
  856. package/dist/src/web-ui/app/spark-chat-feature.js +187 -0
  857. package/dist/src/web-ui/app/spark-mascot.svg +12 -0
  858. package/dist/src/web-ui/app/styles/11-workspace-header-width.css +48 -14
  859. package/dist/src/web-ui/app/styles/11-workspace-rail.css +6 -0
  860. package/dist/src/web-ui/app/styles/19-dashboard-automations.css +32 -0
  861. package/dist/src/web-ui/app/styles/41-co-worker-agent.css +6 -25
  862. package/dist/src/web-ui/app/styles/46-system-host.css +17 -0
  863. package/dist/src/web-ui/app/styles/48-notifications.css +14 -8
  864. package/dist/src/web-ui/app/styles/50-automations.css +353 -0
  865. package/dist/src/web-ui/app/styles/51-automation-editor-actions.css +35 -0
  866. package/dist/src/web-ui/app/styles/51-automation-templates.css +39 -0
  867. package/dist/src/web-ui/app/styles/52-automation-reports.css +84 -0
  868. package/dist/src/web-ui/app/styles/52-automation-step-editor.css +73 -0
  869. package/dist/src/web-ui/app/styles/53-automation-schema-inputs.css +21 -0
  870. package/dist/src/web-ui/app/styles/54-spark-chat.css +111 -0
  871. package/dist/src/web-ui/app/styles/94-automations-responsive.css +35 -0
  872. package/dist/src/web-ui/app/styles.css +9 -1
  873. package/dist/src/web-ui/app/ui-behavior.js +1 -0
  874. package/dist/src/web-ui/local-runtime/api-router.d.ts +2 -0
  875. package/dist/src/web-ui/local-runtime/api-router.js +18 -0
  876. package/dist/src/web-ui/local-runtime/automation-routes.d.ts +27 -0
  877. package/dist/src/web-ui/local-runtime/automation-routes.js +227 -0
  878. package/dist/src/web-ui/local-runtime/environment-registry.d.ts +4 -0
  879. package/dist/src/web-ui/local-runtime/environment-registry.js +5 -0
  880. package/dist/src/web-ui/local-runtime/learning-notifications.js +1 -1
  881. package/dist/src/web-ui/local-runtime/learning-routes.js +0 -22
  882. package/dist/src/web-ui/local-runtime/request-execution.js +35 -0
  883. package/dist/src/web-ui/local-runtime/session-routes.js +32 -2
  884. package/dist/src/web-ui/local-runtime/setup-embedding-config-repository.d.ts +6 -0
  885. package/dist/src/web-ui/local-runtime/setup-embedding-config-repository.js +25 -0
  886. package/dist/src/web-ui/local-runtime/setup-embedding-service.js +2 -0
  887. package/dist/src/web-ui/local-runtime/spark-chat-admission.d.ts +7 -0
  888. package/dist/src/web-ui/local-runtime/spark-chat-admission.js +37 -0
  889. package/dist/src/web-ui/local-runtime/spark-chat-configuration.d.ts +8 -0
  890. package/dist/src/web-ui/local-runtime/spark-chat-configuration.js +16 -0
  891. package/dist/src/web-ui/local-runtime/spark-chat-handoff.d.ts +4 -0
  892. package/dist/src/web-ui/local-runtime/spark-chat-handoff.js +84 -0
  893. package/dist/src/web-ui/local-runtime/spark-chat-routes.d.ts +19 -0
  894. package/dist/src/web-ui/local-runtime/spark-chat-routes.js +62 -0
  895. package/dist/src/web-ui/local-runtime-backend.d.ts +4 -0
  896. package/dist/src/web-ui/local-runtime-backend.js +3 -0
  897. package/dist/src/web-ui/notifications/automation-event-projection.d.ts +3 -0
  898. package/dist/src/web-ui/notifications/automation-event-projection.js +57 -0
  899. package/dist/src/web-ui/notifications/contracts.d.ts +20 -5
  900. package/dist/src/web-ui/notifications/contracts.js +7 -1
  901. package/dist/src/web-ui/notifications/conversation-source.d.ts +6 -0
  902. package/dist/src/web-ui/notifications/conversation-source.js +26 -0
  903. package/dist/src/web-ui/notifications/event-fields.d.ts +3 -0
  904. package/dist/src/web-ui/notifications/event-fields.js +12 -0
  905. package/dist/src/web-ui/notifications/event-projection.d.ts +2 -1
  906. package/dist/src/web-ui/notifications/event-projection.js +22 -20
  907. package/dist/src/web-ui/notifications/service.js +33 -2
  908. package/dist/src/web-ui/notifications/storage-schema.js +118 -21
  909. package/dist/src/web-ui/server.js +1 -1
  910. package/dist/src/web-ui/session-read-state/service.d.ts +39 -0
  911. package/dist/src/web-ui/session-read-state/service.js +20 -2
  912. package/dist/src/web-ui/session-read-state/store.d.ts +2 -0
  913. package/dist/src/web-ui/session-read-state/store.js +7 -0
  914. package/dist/src/web-ui/session-read-state/visible-messages.d.ts +30 -0
  915. package/dist/src/web-ui/session-read-state/visible-messages.js +119 -0
  916. package/dist/src/web-ui/system-host-service.d.ts +4 -1
  917. package/dist/src/web-ui/system-host-service.js +14 -3
  918. package/dist/src/web-ui/system-host-setup/local-request-authority.d.ts +3 -0
  919. package/dist/src/web-ui/system-host-setup/local-request-authority.js +15 -0
  920. package/dist/src/web-ui/system-host-setup/local-setup-availability.js +2 -12
  921. package/dist/src/web-ui/system-host-setup/native-permission-route.d.ts +26 -0
  922. package/dist/src/web-ui/system-host-setup/native-permission-route.js +96 -0
  923. package/dist/src/web-ui/system-host-setup/permission-route.d.ts +13 -0
  924. package/dist/src/web-ui/system-host-setup/permission-route.js +102 -0
  925. package/docs/installation.md +41 -9
  926. package/docs/plugins.md +53 -11
  927. package/docs/runtime-public-contracts.md +7 -2
  928. package/docs/tool-execution-result-evidence-contract.md +11 -4
  929. package/package.json +1 -1
  930. package/plugins/capability-brief/src/index.cjs +85 -37
  931. package/plugins/code-outline/source/index.ts +7 -2
  932. package/plugins/code-outline/src/index.cjs +91 -39
  933. package/plugins/document-reader/plugin.json +18 -3
  934. package/plugins/document-reader/skills/document_reader_skill/SKILL.md +6 -6
  935. package/plugins/document-reader/source/source-resolution.ts +1 -1
  936. package/plugins/document-reader/src/index.cjs +86 -38
  937. package/plugins/exec/plugin.json +3 -3
  938. package/plugins/exec/source/handlers.ts +78 -20
  939. package/plugins/exec/source/output-contracts.ts +45 -0
  940. package/plugins/exec/source/output-files.ts +161 -0
  941. package/plugins/exec/source/output-maintenance.ts +60 -0
  942. package/plugins/exec/source/output-range-reader.ts +97 -0
  943. package/plugins/exec/source/output-retention.ts +34 -0
  944. package/plugins/exec/source/output-snapshot.ts +54 -0
  945. package/plugins/exec/source/output-store.ts +182 -0
  946. package/plugins/exec/source/output-utf8-boundary.ts +14 -0
  947. package/plugins/exec/source/output-writer.ts +131 -0
  948. package/plugins/exec/source/process-manager.ts +142 -70
  949. package/plugins/exec/source/process-output-buffer.ts +13 -18
  950. package/plugins/exec/source/process-output.ts +158 -0
  951. package/plugins/exec/source/request-resources.ts +28 -12
  952. package/plugins/exec/source/result-presentation.ts +39 -39
  953. package/plugins/exec/source/retained-output-failure.ts +51 -0
  954. package/plugins/exec/source/settings.ts +9 -10
  955. package/plugins/exec/source/terminal-delivery.ts +49 -0
  956. package/plugins/exec/source/types.ts +12 -1
  957. package/plugins/exec/src/index.cjs +1112 -188
  958. package/plugins/filesystem/plugin.json +5 -5
  959. package/plugins/filesystem/skills/read_file_skill/SKILL.md +1 -1
  960. package/plugins/filesystem/src/index.cjs +85 -37
  961. package/plugins/json-inspector/source/index.ts +7 -2
  962. package/plugins/json-inspector/src/index.cjs +91 -39
  963. package/plugins/local-search/source/index.ts +9 -4
  964. package/plugins/local-search/src/index.cjs +93 -41
  965. package/plugins/memory/src/index.cjs +85 -37
  966. package/plugins/project-orientation/source/index.ts +9 -4
  967. package/plugins/project-orientation/src/index.cjs +93 -41
  968. package/plugins/system/plugin.json +2 -2
  969. package/plugins/system/source/computer/observation-output.ts +1 -1
  970. package/plugins/system/src/index.cjs +88 -43
  971. package/plugins/system-probe/source/index.ts +7 -2
  972. package/plugins/system-probe/src/index.cjs +91 -39
  973. package/plugins/web/README.md +9 -0
  974. package/plugins/web/source/plugin.ts +5 -3
  975. package/plugins/web/source/research.ts +7 -7
  976. package/plugins/web/src/index.cjs +96 -43
  977. package/src/runtime/README.md +100 -11
  978. package/src/runtime/scheduler/README.md +63 -0
  979. package/dist/src/web-ui/app/components/passive-learning/proposal-notifications.js +0 -106
  980. package/dist/src/web-ui/app/components/passive-learning/proposal-read-state.js +0 -23
  981. package/dist/src/web-ui/app/components/passive-learning/proposal-view.js +0 -23
  982. package/dist/src/web-ui/app/components/spark-conversation-actions.js +0 -62
  983. package/dist/src/web-ui/app/services/spark-conversation-preferences.js +0 -27
  984. package/dist/src/web-ui/app/styles/29-spark-conversation.css +0 -19
@@ -2699,7 +2699,7 @@ import { lookup as lookupHost } from "node:dns/promises";
2699
2699
  import { isIP } from "node:net";
2700
2700
 
2701
2701
  // src/computer-access/companion/protocol.ts
2702
- var DESKTOP_NOTIFICATION_OPERATION = "desktop_notification";
2702
+ var DESKTOP_NOTIFICATION_OPERATION = "desktop_notification", MACOS_PERMISSION_OPERATION = "macos_permissions";
2703
2703
  var HOST_SOCKET_PATH = "/system-host/connect";
2704
2704
  var HOST_OPERATIONS = [
2705
2705
  "system_targets",
@@ -2715,7 +2715,7 @@ function isHostOperation(value) {
2715
2715
  return HOST_OPERATIONS.some((operation) => operation === value);
2716
2716
  }
2717
2717
  function isHostWireOperation(value) {
2718
- return isHostOperation(value) || value === DESKTOP_NOTIFICATION_OPERATION ? !0 : COMPUTER_HOST_OPERATIONS.some((operation) => operation === value);
2718
+ return isHostOperation(value) || value === DESKTOP_NOTIFICATION_OPERATION || value === MACOS_PERMISSION_OPERATION ? !0 : COMPUTER_HOST_OPERATIONS.some((operation) => operation === value);
2719
2719
  }
2720
2720
  function isHostRecord(value) {
2721
2721
  return value === null || typeof value != "object" ? !1 : !Array.isArray(value);
@@ -2805,10 +2805,10 @@ function hasSameNativeConnection(a, b) {
2805
2805
  function isAbsentFile(error) {
2806
2806
  return isHostRecord(error) && error.code === "ENOENT";
2807
2807
  }
2808
- function createNativeHostState(directory, access4) {
2808
+ function createNativeHostState(directory, access5) {
2809
2809
  let connectionPath = join(directory, "connection.json"), statusPath = join(directory, "status.json");
2810
2810
  async function inspectPrivate(path) {
2811
- await access4.ensureDirectory(directory);
2811
+ await access5.ensureDirectory(directory);
2812
2812
  let stat2 = await lstat(path).catch((error) => {
2813
2813
  if (!isAbsentFile(error))
2814
2814
  throw error;
@@ -2816,7 +2816,7 @@ function createNativeHostState(directory, access4) {
2816
2816
  if (stat2) {
2817
2817
  if (!stat2.isFile() || stat2.isSymbolicLink())
2818
2818
  throw new Error("Host companion state must be a private regular file.");
2819
- return await access4.assertFile(path, stat2), stat2;
2819
+ return await access5.assertFile(path, stat2), stat2;
2820
2820
  }
2821
2821
  }
2822
2822
  async function readPrivate(path) {
@@ -2828,7 +2828,7 @@ function createNativeHostState(directory, access4) {
2828
2828
  }
2829
2829
  }
2830
2830
  async function writePrivate(path, value) {
2831
- await access4.ensureDirectory(directory), await readPrivate(path);
2831
+ await access5.ensureDirectory(directory), await readPrivate(path);
2832
2832
  let temporary = `${path}.${randomUUID()}.tmp`;
2833
2833
  try {
2834
2834
  await writeFile(temporary, JSON.stringify(value) + `
@@ -2836,7 +2836,7 @@ function createNativeHostState(directory, access4) {
2836
2836
  encoding: "utf8",
2837
2837
  mode: 384,
2838
2838
  flag: "wx"
2839
- }), await access4.assertFile(temporary, await lstat(temporary)), await rename(temporary, path);
2839
+ }), await access5.assertFile(temporary, await lstat(temporary)), await rename(temporary, path);
2840
2840
  } finally {
2841
2841
  await unlink(temporary).catch((error) => {
2842
2842
  if (!isAbsentFile(error)) throw error;
@@ -2894,7 +2894,7 @@ import { homedir as homedir4 } from "node:os";
2894
2894
  // src/computer-access/companion/notification-installation.ts
2895
2895
  import { randomUUID as randomUUID4 } from "node:crypto";
2896
2896
  import {
2897
- lstat as lstat3,
2897
+ lstat as lstat4,
2898
2898
  mkdir as mkdir2,
2899
2899
  open,
2900
2900
  readFile as readFile4,
@@ -2902,7 +2902,7 @@ import {
2902
2902
  rm as rm2,
2903
2903
  writeFile as writeFile4
2904
2904
  } from "node:fs/promises";
2905
- import { dirname as dirname3, isAbsolute, join as join6 } from "node:path";
2905
+ import { dirname as dirname3, isAbsolute, join as join7 } from "node:path";
2906
2906
 
2907
2907
  // src/computer-access/companion/notification-directory.ts
2908
2908
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -3291,7 +3291,7 @@ function sourceUrlAllowed(value) {
3291
3291
  var origin = connection.url.replace(/^ws:/, 'http:').replace(/^wss:/, 'https:');
3292
3292
  if (value.indexOf(origin + '/') !== 0) return false;
3293
3293
  var path = value.slice(origin.length).split('?')[0];
3294
- return ['/chat', '/notifications', '/home', '/learning'].indexOf(path) !== -1;
3294
+ return ['/chat', '/notifications', '/home', '/learning', '/automations'].indexOf(path) !== -1;
3295
3295
  }
3296
3296
  ObjC.registerSubclass({
3297
3297
  name: 'ABotDesktopNotificationDelegate',
@@ -3414,12 +3414,50 @@ function run(args) {
3414
3414
  }
3415
3415
  `;
3416
3416
 
3417
+ // src/computer-access/companion/spark-notification-query.ts
3418
+ var SPARK_NOTIFICATION_QUERY_KEYS = /* @__PURE__ */ new Set([
3419
+ "environment",
3420
+ "spark",
3421
+ "message",
3422
+ "messageCreatedAt",
3423
+ "request"
3424
+ ]);
3425
+ function hasSingleAllowedSparkParameters(parameters) {
3426
+ for (let key of parameters.keys())
3427
+ if (!SPARK_NOTIFICATION_QUERY_KEYS.has(key) || parameters.getAll(key).length !== 1) return !1;
3428
+ return !0;
3429
+ }
3430
+ function isSparkNotificationReference(value) {
3431
+ return value === null || value.trim() !== value || !value.length || value.length > 512 ? !1 : !/[\u0000-\u001f\u007f]/u.test(value);
3432
+ }
3433
+ function hasCanonicalSparkMessageTimestamp(value) {
3434
+ if (value === null) return !1;
3435
+ let timestamp = Number(value);
3436
+ return !Number.isSafeInteger(timestamp) || timestamp < 0 ? !1 : String(timestamp) === value;
3437
+ }
3438
+ function hasSparkMessageReference(parameters) {
3439
+ return ["message", "messageCreatedAt", "request"].some(
3440
+ (key) => parameters.has(key)
3441
+ );
3442
+ }
3443
+ function hasBoundSparkNotificationQuery(url) {
3444
+ if (url.pathname !== "/home") return !1;
3445
+ let parameters = url.searchParams;
3446
+ if (!hasSingleAllowedSparkParameters(parameters) || !isSparkNotificationReference(parameters.get("environment")) || parameters.get("spark") !== "1") return !1;
3447
+ if (!hasSparkMessageReference(parameters)) return !0;
3448
+ if (!isSparkNotificationReference(parameters.get("message")) || !hasCanonicalSparkMessageTimestamp(parameters.get("messageCreatedAt")))
3449
+ return !1;
3450
+ let request = parameters.get("request");
3451
+ return request === null ? !0 : isSparkNotificationReference(request);
3452
+ }
3453
+
3417
3454
  // src/computer-access/companion/notification-protocol.ts
3418
3455
  var DESKTOP_NOTIFICATION_CAPABILITY = "desktop_notifications_v1", DESKTOP_NOTIFICATION_PATHS = [
3419
3456
  "/chat",
3420
3457
  "/notifications",
3421
3458
  "/home",
3422
- "/learning"
3459
+ "/learning",
3460
+ "/automations"
3423
3461
  ];
3424
3462
  function notificationRuntimeOrigin(runtimeUrl) {
3425
3463
  let url = new URL(runtimeUrl);
@@ -3427,6 +3465,15 @@ function notificationRuntimeOrigin(runtimeUrl) {
3427
3465
  throw new Error("notification_runtime_invalid");
3428
3466
  return url.origin;
3429
3467
  }
3468
+ function hasBoundAutomationRunQuery(url) {
3469
+ let keys = ["environment", "automation", "run"];
3470
+ for (let key of keys)
3471
+ if (url.searchParams.getAll(key).length !== 1 || !url.searchParams.get(key)) return !1;
3472
+ return [...url.searchParams.keys()].every((key) => keys.includes(key));
3473
+ }
3474
+ function hasAllowedNotificationQuery(url) {
3475
+ return url.pathname === "/automations" ? hasBoundAutomationRunQuery(url) : url.searchParams.has("spark") ? hasBoundSparkNotificationQuery(url) : [...url.searchParams.keys()].every((key) => ["environment", "session"].includes(key));
3476
+ }
3430
3477
  function resolveNotificationSourceUrl(value, runtimeUrl) {
3431
3478
  if (typeof value != "string") throw new Error("notification_url_invalid");
3432
3479
  if (value.length > 4096) throw new Error("notification_url_invalid");
@@ -3440,9 +3487,7 @@ function resolveNotificationSourceUrl(value, runtimeUrl) {
3440
3487
  throw new Error("notification_url_invalid");
3441
3488
  if (!DESKTOP_NOTIFICATION_PATHS.some((path) => path === url.pathname))
3442
3489
  throw new Error("notification_url_path_invalid");
3443
- if ([...url.searchParams.keys()].some(
3444
- (key) => !["environment", "session"].includes(key)
3445
- ))
3490
+ if (!hasAllowedNotificationQuery(url))
3446
3491
  throw new Error("notification_url_query_invalid");
3447
3492
  return url.toString();
3448
3493
  }
@@ -3475,6 +3520,86 @@ function readDesktopNotification(value, platform, runtimeUrl) {
3475
3520
  };
3476
3521
  }
3477
3522
 
3523
+ // src/computer-access/companion/notification-macos-bundle.ts
3524
+ import { constants } from "node:fs";
3525
+ import { access, lstat as lstat3 } from "node:fs/promises";
3526
+ import { join as join6 } from "node:path";
3527
+ var MAC_NOTIFICATION_PLIST_SCRIPT = String.raw`
3528
+ ObjC.import('Foundation');
3529
+ function run(argv) {
3530
+ var plist = $.NSMutableDictionary.alloc.initWithContentsOfFile($(argv[0]));
3531
+ if (!plist) throw new Error('notification_bundle_plist_invalid');
3532
+ if (argv[1]) {
3533
+ var updates = JSON.parse(argv[1]);
3534
+ Object.keys(updates).forEach(function(key) {
3535
+ plist.setObjectForKey($(updates[key]), $(key));
3536
+ });
3537
+ if (!plist.writeToFileAtomically($(argv[0]), true))
3538
+ throw new Error('notification_bundle_plist_write_failed');
3539
+ }
3540
+ return JSON.stringify({
3541
+ executable: ObjC.unwrap(plist.objectForKey('CFBundleExecutable')),
3542
+ identifier: ObjC.unwrap(plist.objectForKey('CFBundleIdentifier'))
3543
+ });
3544
+ }
3545
+ `;
3546
+ function isBundleExecutableName(value) {
3547
+ return typeof value != "string" || value.length === 0 || value === "." || value === ".." ? !1 : !/[\\/\u0000-\u001f\u007f]/.test(value);
3548
+ }
3549
+ async function assertBundleDirectory(path) {
3550
+ let stat2 = await lstat3(path);
3551
+ if (!stat2.isDirectory() || stat2.isSymbolicLink())
3552
+ throw new Error("notification_bundle_directory_invalid");
3553
+ }
3554
+ async function assertBundleFile(path) {
3555
+ let stat2 = await lstat3(path);
3556
+ if (!stat2.isFile() || stat2.isSymbolicLink())
3557
+ throw new Error("notification_bundle_file_invalid");
3558
+ }
3559
+ async function readBundleMetadata(app, run, signal) {
3560
+ await assertBundleDirectory(app), await assertBundleDirectory(join6(app, "Contents")), await assertBundleDirectory(join6(app, "Contents", "MacOS"));
3561
+ let plist = join6(app, "Contents", "Info.plist");
3562
+ return await assertBundleFile(plist), JSON.parse(await run({
3563
+ file: "/usr/bin/osascript",
3564
+ args: ["-l", "JavaScript", "-e", MAC_NOTIFICATION_PLIST_SCRIPT, plist],
3565
+ signal
3566
+ }));
3567
+ }
3568
+ async function assertBundleExecutable(app, executable) {
3569
+ if (!isBundleExecutableName(executable))
3570
+ throw new Error("notification_bundle_executable_invalid");
3571
+ let path = join6(app, "Contents", "MacOS", executable);
3572
+ await assertBundleFile(path), await access(path, constants.X_OK);
3573
+ }
3574
+ async function assertMacNotificationBundle(app, run, signal) {
3575
+ let metadata = await readBundleMetadata(app, run, signal);
3576
+ if (metadata.identifier !== NOTIFICATION_APP_ID)
3577
+ throw new Error("notification_bundle_identity_invalid");
3578
+ await assertBundleExecutable(app, metadata.executable);
3579
+ }
3580
+ async function configureMacNotificationBundle(app, run) {
3581
+ let metadata = await readBundleMetadata(app, run);
3582
+ await assertBundleExecutable(app, metadata.executable), await run({
3583
+ file: "/usr/bin/osascript",
3584
+ args: [
3585
+ "-l",
3586
+ "JavaScript",
3587
+ "-e",
3588
+ MAC_NOTIFICATION_PLIST_SCRIPT,
3589
+ join6(app, "Contents", "Info.plist"),
3590
+ JSON.stringify({
3591
+ CFBundleIdentifier: NOTIFICATION_APP_ID,
3592
+ CFBundleName: "ABot",
3593
+ CFBundleDisplayName: "ABot",
3594
+ LSUIElement: !0,
3595
+ OSAAppletStayOpen: !0,
3596
+ OSAAppletShowStartupScreen: !1,
3597
+ NSHighResolutionCapable: !0
3598
+ })
3599
+ ]
3600
+ }), await assertMacNotificationBundle(app, run);
3601
+ }
3602
+
3478
3603
  // src/computer-access/companion/notification-installation.ts
3479
3604
  function notificationLocationsFromStartup(startup) {
3480
3605
  return {
@@ -3485,8 +3610,8 @@ function notificationLocationsFromStartup(startup) {
3485
3610
  };
3486
3611
  }
3487
3612
  function linuxNotificationDesktopPath(locations) {
3488
- let dataHome = locations.xdgDataHome && isAbsolute(locations.xdgDataHome) ? locations.xdgDataHome : join6(locations.homeDir, ".local", "share");
3489
- return join6(dataHome, "applications", NOTIFICATION_APP_ID + ".desktop");
3613
+ let dataHome = locations.xdgDataHome && isAbsolute(locations.xdgDataHome) ? locations.xdgDataHome : join7(locations.homeDir, ".local", "share");
3614
+ return join7(dataHome, "applications", NOTIFICATION_APP_ID + ".desktop");
3490
3615
  }
3491
3616
  function desktopArgument(value) {
3492
3617
  return '"' + value.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("%", "%%").replaceAll("$", "\\$").replaceAll("`", "\\`") + '"';
@@ -3508,7 +3633,7 @@ function renderLinuxNotificationDesktop(runtimeUrl) {
3508
3633
  `);
3509
3634
  }
3510
3635
  async function assertLinuxDesktopOwnership(path) {
3511
- let stat2 = await lstat3(path).catch((error) => {
3636
+ let stat2 = await lstat4(path).catch((error) => {
3512
3637
  if (error.code !== "ENOENT")
3513
3638
  throw error;
3514
3639
  });
@@ -3519,12 +3644,6 @@ async function assertLinuxDesktopOwnership(path) {
3519
3644
  throw new Error("notification_registration_not_owned");
3520
3645
  return !0;
3521
3646
  }
3522
- function macNotificationPlist() {
3523
- return `<?xml version="1.0" encoding="UTF-8"?>
3524
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3525
- <plist version="1.0"><dict><key>CFBundleExecutable</key><string>applet</string><key>CFBundleIdentifier</key><string>` + NOTIFICATION_APP_ID + `</string><key>CFBundleName</key><string>ABot</string><key>CFBundleDisplayName</key><string>ABot</string><key>CFBundlePackageType</key><string>APPL</string><key>CFBundleSignature</key><string>aplt</string><key>CFBundleVersion</key><string>1</string><key>CFBundleShortVersionString</key><string>1.0</string><key>CFBundleIconFile</key><string>applet</string><key>LSUIElement</key><true/><key>OSAAppletStayOpen</key><true/><key>OSAAppletShowStartupScreen</key><false/><key>NSHighResolutionCapable</key><true/></dict></plist>
3526
- `;
3527
- }
3528
3647
  async function stopMacNotificationApp(locations, run) {
3529
3648
  await run({
3530
3649
  file: "/usr/bin/osascript",
@@ -3538,17 +3657,14 @@ async function stopMacNotificationApp(locations, run) {
3538
3657
  });
3539
3658
  }
3540
3659
  async function installMacNotificationApp(locations, run) {
3541
- let directory = notificationInstallDirectory(locations), source = join6(directory, "notification-helper.js"), temporary = join6(directory, "ABot.next.app"), app = macNotificationAppPath(locations);
3660
+ let directory = notificationInstallDirectory(locations), source = join7(directory, "notification-helper.js"), temporary = join7(directory, "ABot.next.app"), app = macNotificationAppPath(locations);
3542
3661
  await writeFile4(source, renderMacNotificationApplet(locations.stateDir), {
3543
3662
  mode: 384
3544
3663
  }), await rm2(temporary, { recursive: !0, force: !0 }), await run({
3545
3664
  file: "/usr/bin/osacompile",
3546
3665
  args: ["-l", "JavaScript", "-s", "-o", temporary, source],
3547
3666
  timeoutMs: 3e4
3548
- }), await writeFile4(
3549
- join6(temporary, "Contents", "Info.plist"),
3550
- macNotificationPlist()
3551
- ), await run({
3667
+ }), await configureMacNotificationBundle(temporary, run), await run({
3552
3668
  file: "/usr/bin/codesign",
3553
3669
  args: [
3554
3670
  "--force",
@@ -3566,12 +3682,12 @@ async function installMacNotificationApp(locations, run) {
3566
3682
  }
3567
3683
  async function installDesktopNotificationIdentity(startup, runtimeUrl, run = runNotificationProcess) {
3568
3684
  let locations = notificationLocationsFromStartup(startup), directory = notificationInstallDirectory(locations);
3569
- await ensureOwnedNotificationDirectory(locations, run), await rm2(join6(directory, ".ready"), { force: !0 }), await mkdir2(join6(directory, "pending"), { recursive: !0, mode: 448 }), await registerDesktopNotificationIdentity(
3685
+ await ensureOwnedNotificationDirectory(locations, run), await rm2(join7(directory, ".ready"), { force: !0 }), await mkdir2(join7(directory, "pending"), { recursive: !0, mode: 448 }), await registerDesktopNotificationIdentity(
3570
3686
  startup.platform,
3571
3687
  locations,
3572
3688
  runtimeUrl,
3573
3689
  run
3574
- ), await writeFile4(join6(directory, ".ready"), startup.platform, { mode: 384 });
3690
+ ), await writeFile4(join7(directory, ".ready"), startup.platform, { mode: 384 });
3575
3691
  }
3576
3692
  async function registerDesktopNotificationIdentity(platform, locations, runtimeUrl, run) {
3577
3693
  if (platform === "win32") {
@@ -3593,7 +3709,7 @@ async function registerDesktopNotificationIdentity(platform, locations, runtimeU
3593
3709
  throw new Error("notification_platform_unsupported");
3594
3710
  }
3595
3711
  async function uninstallMacNotificationApp(locations, run) {
3596
- let app = macNotificationAppPath(locations), stat2 = await lstat3(app).catch((error) => {
3712
+ let app = macNotificationAppPath(locations), stat2 = await lstat4(app).catch((error) => {
3597
3713
  if (error.code !== "ENOENT")
3598
3714
  throw error;
3599
3715
  });
@@ -3652,7 +3768,7 @@ async function uninstallDesktopNotificationIdentity(startup, run = runNotificati
3652
3768
  }
3653
3769
 
3654
3770
  // src/cli/host-companion.ts
3655
- import { join as join19 } from "node:path";
3771
+ import { join as join20 } from "node:path";
3656
3772
  import { createInterface } from "node:readline/promises";
3657
3773
  import { stdin, stdout } from "node:process";
3658
3774
  import { fileURLToPath } from "node:url";
@@ -3660,14 +3776,14 @@ import { fileURLToPath } from "node:url";
3660
3776
  // src/computer-access/companion/autostart.ts
3661
3777
  import { execFile } from "node:child_process";
3662
3778
  import {
3663
- lstat as lstat4,
3779
+ lstat as lstat5,
3664
3780
  mkdir as mkdir3,
3665
3781
  readFile as readFile5,
3666
3782
  rename as rename3,
3667
3783
  unlink as unlink4,
3668
3784
  writeFile as writeFile5
3669
3785
  } from "node:fs/promises";
3670
- import { dirname as dirname4, join as join7, posix } from "node:path";
3786
+ import { dirname as dirname4, join as join8, posix } from "node:path";
3671
3787
  import { promisify } from "node:util";
3672
3788
  import { randomUUID as randomUUID5 } from "node:crypto";
3673
3789
  var executeFile = promisify(execFile), LABEL = "com.abot.host-companion", OWNER_MARKER = "ABot managed native host companion";
@@ -3692,18 +3808,18 @@ function vbsString(value) {
3692
3808
  return `"${value.replaceAll('"', '""')}"`;
3693
3809
  }
3694
3810
  function linuxConfigHome(options) {
3695
- return options.xdgConfigHome ? posix.isAbsolute(options.xdgConfigHome) ? options.xdgConfigHome : join7(options.homeDir, ".config") : join7(options.homeDir, ".config");
3811
+ return options.xdgConfigHome ? posix.isAbsolute(options.xdgConfigHome) ? options.xdgConfigHome : join8(options.homeDir, ".config") : join8(options.homeDir, ".config");
3696
3812
  }
3697
3813
  function nativeAutostartFile(options) {
3698
3814
  if (options.platform === "linux")
3699
- return join7(linuxConfigHome(options), "autostart", `${LABEL}.desktop`);
3815
+ return join8(linuxConfigHome(options), "autostart", `${LABEL}.desktop`);
3700
3816
  if (options.platform === "darwin")
3701
- return join7(options.homeDir, "Library", "LaunchAgents", `${LABEL}.plist`);
3817
+ return join8(options.homeDir, "Library", "LaunchAgents", `${LABEL}.plist`);
3702
3818
  if (options.platform !== "win32")
3703
3819
  throw new Error("Automatic host startup supports Windows and macOS only.");
3704
3820
  if (!options.appData)
3705
3821
  throw new Error("Windows APPDATA is unavailable for current-user startup.");
3706
- return join7(
3822
+ return join8(
3707
3823
  options.appData,
3708
3824
  "Microsoft",
3709
3825
  "Windows",
@@ -3753,8 +3869,8 @@ X-GNOME-Autostart-enabled=true
3753
3869
  <key>LimitLoadToSessionType</key><string>Aqua</string>
3754
3870
  <key>ProcessType</key><string>Interactive</string>
3755
3871
  <key>WorkingDirectory</key><string>${xmlText(options.homeDir)}</string>
3756
- <key>StandardOutPath</key><string>${xmlText(join7(options.stateDir, "agent.log"))}</string>
3757
- <key>StandardErrorPath</key><string>${xmlText(join7(options.stateDir, "agent.log"))}</string>
3872
+ <key>StandardOutPath</key><string>${xmlText(join8(options.stateDir, "agent.log"))}</string>
3873
+ <key>StandardErrorPath</key><string>${xmlText(join8(options.stateDir, "agent.log"))}</string>
3758
3874
  </dict></plist>
3759
3875
  `;
3760
3876
  }
@@ -3762,7 +3878,7 @@ function errorCode(error) {
3762
3878
  return error && typeof error == "object" && "code" in error ? error.code : void 0;
3763
3879
  }
3764
3880
  async function existingOwnedRegistration(path) {
3765
- let stat2 = await lstat4(path).catch((error) => {
3881
+ let stat2 = await lstat5(path).catch((error) => {
3766
3882
  if (errorCode(error) !== "ENOENT")
3767
3883
  throw error;
3768
3884
  });
@@ -3853,34 +3969,9 @@ function nativeOperatingSystem(platform) {
3853
3969
  var import_stream = __toESM(require_stream(), 1), import_extension = __toESM(require_extension(), 1), import_permessage_deflate = __toESM(require_permessage_deflate(), 1), import_receiver = __toESM(require_receiver(), 1), import_sender = __toESM(require_sender(), 1), import_subprotocol = __toESM(require_subprotocol(), 1), import_websocket = __toESM(require_websocket(), 1), import_websocket_server = __toESM(require_websocket_server(), 1);
3854
3970
  var wrapper_default = import_websocket.default;
3855
3971
 
3856
- // src/computer-access/companion/native-loopback-lookup.ts
3857
- function matchesLookupFamily(address, family) {
3858
- return family === 4 || family === "IPv4" ? address.family === 4 : family === 6 || family === "IPv6" ? address.family === 6 : family === void 0 || family === 0;
3859
- }
3860
- function nativeLoopbackSocketOptions(endpoint) {
3861
- let expectedHostname = new URL(endpoint.url).hostname.toLowerCase();
3862
- return {
3863
- family: 0,
3864
- autoSelectFamily: !0,
3865
- autoSelectFamilyAttemptTimeout: 250,
3866
- lookup(hostname2, options, callback) {
3867
- if (!(hostname2.toLowerCase() === expectedHostname)) {
3868
- callback(Object.assign(new Error("Unexpected Runtime lookup hostname."), { code: "ENOTFOUND" }), []);
3869
- return;
3870
- }
3871
- let addresses = endpoint.addresses.filter((address) => matchesLookupFamily(address, options.family));
3872
- if (addresses.length === 0) {
3873
- callback(Object.assign(new Error("No validated Runtime address for this family."), { code: "ENOTFOUND" }), []);
3874
- return;
3875
- }
3876
- if (options.all) {
3877
- callback(null, addresses.map(({ address, family }) => ({ address, family })));
3878
- return;
3879
- }
3880
- callback(null, addresses[0].address, addresses[0].family);
3881
- }
3882
- };
3883
- }
3972
+ // src/computer-access/companion/native-permissions.ts
3973
+ import { execFile as execFile3 } from "node:child_process";
3974
+ import { promisify as promisify3 } from "node:util";
3884
3975
 
3885
3976
  // src/plugin-sdk/parameters.ts
3886
3977
  var PluginParameterError = class extends TypeError {
@@ -3946,8 +4037,21 @@ function runtimeToolPathErrorCode(error) {
3946
4037
  return error.code;
3947
4038
  }
3948
4039
 
4040
+ // src/capabilities/tool-context-text.ts
4041
+ function hasValidToolContextText(carrier) {
4042
+ let fields = carrier.contextTextFields;
4043
+ if (fields === void 0) return !0;
4044
+ if (!Array.isArray(fields) || fields.length === 0 || fields.length > 3 || new Set(fields).size !== fields.length) return !1;
4045
+ for (let field of fields)
4046
+ if (!isContextTextField(field) || typeof carrier[field] != "string") return !1;
4047
+ return !0;
4048
+ }
4049
+ function isContextTextField(value) {
4050
+ return value === "output" || value === "stdout" || value === "stderr";
4051
+ }
4052
+
3949
4053
  // src/plugin-sdk/results.ts
3950
- var PLUGIN_RESULT_SERIALIZED_MAX_BYTES = 128 * 1024;
4054
+ var PLUGIN_RESULT_SERIALIZED_MAX_BYTES = 262144;
3951
4055
  function resultBoundsFailure(code, message) {
3952
4056
  return {
3953
4057
  ok: !1,
@@ -3957,56 +4061,75 @@ function resultBoundsFailure(code, message) {
3957
4061
  errorCode: code
3958
4062
  };
3959
4063
  }
3960
- function enforcePluginResultByteBudget(result) {
3961
- let serialized;
4064
+ function enforcePluginResultByteBudget(result, resultBudget) {
4065
+ let requiresContextTextHost = !1, serializedBytes, envelopeBytes, maxBytes = PLUGIN_RESULT_SERIALIZED_MAX_BYTES, fitsDeclaredBudget = !0;
3962
4066
  try {
4067
+ if (!hasValidToolContextText(result))
4068
+ return resultBoundsFailure(
4069
+ "plugin_context_text_invalid",
4070
+ "The plugin declared invalid context text fields."
4071
+ );
4072
+ if (requiresContextTextHost = result.contextTextFields !== void 0, requiresContextTextHost && resultBudget?.acceptsContextText !== !0)
4073
+ return resultBoundsFailure(
4074
+ "plugin_context_text_unavailable",
4075
+ "The host does not support context-managed tool text."
4076
+ );
3963
4077
  let candidate = JSON.stringify(result);
3964
4078
  if (candidate === void 0)
3965
4079
  return resultBoundsFailure(
3966
4080
  "plugin_result_not_json_safe",
3967
4081
  "The plugin produced a result that is not JSON-safe."
3968
4082
  );
3969
- serialized = candidate;
4083
+ let assessment = resultBudget?.assess(result);
4084
+ serializedBytes = assessment?.serializedBytes ?? Buffer.byteLength(candidate, "utf8"), envelopeBytes = assessment?.envelopeBytes ?? serializedBytes, maxBytes = Math.min(assessment?.maxBytes ?? maxBytes, maxBytes), fitsDeclaredBudget = assessment?.fits ?? !0;
3970
4085
  } catch {
3971
4086
  return resultBoundsFailure(
3972
4087
  "plugin_result_not_json_safe",
3973
4088
  "The plugin produced a result that is not JSON-safe."
3974
4089
  );
3975
4090
  }
3976
- return Buffer.byteLength(serialized, "utf8") > PLUGIN_RESULT_SERIALIZED_MAX_BYTES ? resultBoundsFailure(
3977
- "plugin_result_too_large",
3978
- `The plugin result exceeds the ${PLUGIN_RESULT_SERIALIZED_MAX_BYTES}-byte safety limit.`
3979
- ) : result;
3980
- }
3981
- function successResult(input) {
3982
- return enforcePluginResultByteBudget({
3983
- ok: !0,
3984
- ...input.media !== void 0 ? { media: input.media } : {},
3985
- output: input.output,
3986
- producedNewInformation: input.producedNewInformation ?? !0,
3987
- ...input.progress !== void 0 ? { progress: input.progress } : {},
3988
- ...input.actions !== void 0 ? { actions: input.actions } : {},
3989
- ...input.exitCode !== void 0 ? { exitCode: input.exitCode } : {},
3990
- ...input.stdout !== void 0 ? { stdout: input.stdout } : {},
3991
- ...input.stderr !== void 0 ? { stderr: input.stderr } : {},
3992
- ...input.data !== void 0 ? { data: input.data } : {}
3993
- });
4091
+ if (!(fitsDeclaredBudget && envelopeBytes <= maxBytes)) {
4092
+ let message = requiresContextTextHost ? `The plugin result envelope is ${envelopeBytes} bytes (${serializedBytes} total bytes) and exceeds the ${maxBytes}-byte delivery limit.` : `The plugin result is ${serializedBytes} bytes and exceeds the ${maxBytes}-byte delivery limit.`;
4093
+ return resultBoundsFailure("plugin_result_too_large", message);
4094
+ }
4095
+ return result;
3994
4096
  }
3995
- function failureResult(input) {
3996
- return enforcePluginResultByteBudget({
3997
- ok: !1,
3998
- ...input.media !== void 0 ? { media: input.media } : {},
3999
- output: input.output ?? input.message,
4000
- producedNewInformation: !1,
4001
- ...input.progress !== void 0 ? { progress: input.progress } : {},
4002
- ...input.actions !== void 0 ? { actions: input.actions } : {},
4003
- ...input.exitCode !== void 0 ? { exitCode: input.exitCode } : {},
4004
- ...input.stdout !== void 0 ? { stdout: input.stdout } : {},
4005
- ...input.stderr !== void 0 ? { stderr: input.stderr } : {},
4006
- ...input.data !== void 0 ? { data: input.data } : {},
4007
- error: input.message,
4008
- errorCode: input.errorCode
4009
- });
4097
+ function successResult(input, resultBudget) {
4098
+ return enforcePluginResultByteBudget(
4099
+ {
4100
+ ok: !0,
4101
+ ...input.media !== void 0 ? { media: input.media } : {},
4102
+ output: input.output,
4103
+ producedNewInformation: input.producedNewInformation ?? !0,
4104
+ ...input.progress !== void 0 ? { progress: input.progress } : {},
4105
+ ...input.actions !== void 0 ? { actions: input.actions } : {},
4106
+ ...input.exitCode !== void 0 ? { exitCode: input.exitCode } : {},
4107
+ ...input.stdout !== void 0 ? { stdout: input.stdout } : {},
4108
+ ...input.stderr !== void 0 ? { stderr: input.stderr } : {},
4109
+ ...input.data !== void 0 ? { data: input.data } : {}
4110
+ },
4111
+ resultBudget
4112
+ );
4113
+ }
4114
+ function failureResult(input, resultBudget) {
4115
+ return enforcePluginResultByteBudget(
4116
+ {
4117
+ ok: !1,
4118
+ ...input.interruption ? { interruption: input.interruption } : {},
4119
+ ...input.media !== void 0 ? { media: input.media } : {},
4120
+ output: input.output ?? input.message,
4121
+ producedNewInformation: !1,
4122
+ ...input.progress !== void 0 ? { progress: input.progress } : {},
4123
+ ...input.actions !== void 0 ? { actions: input.actions } : {},
4124
+ ...input.exitCode !== void 0 ? { exitCode: input.exitCode } : {},
4125
+ ...input.stdout !== void 0 ? { stdout: input.stdout } : {},
4126
+ ...input.stderr !== void 0 ? { stderr: input.stderr } : {},
4127
+ ...input.data !== void 0 ? { data: input.data } : {},
4128
+ error: input.message,
4129
+ errorCode: input.errorCode
4130
+ },
4131
+ resultBudget
4132
+ );
4010
4133
  }
4011
4134
  function failureFromError(error, options) {
4012
4135
  let pathCode = runtimeToolPathErrorCode(error), parameterCode = isPluginParameterError(error) ? error.code : void 0, errorCode2 = pathCode ?? parameterCode ?? options.fallbackCode, message = pathCode ?? parameterCode ?? options.fallbackMessage;
@@ -4017,6 +4140,145 @@ function failureFromError(error, options) {
4017
4140
  });
4018
4141
  }
4019
4142
 
4143
+ // src/computer-access/computer/macos-permission-helper.ts
4144
+ var MACOS_PERMISSION_GATE = String.raw`
4145
+ func prepareMacPermissions(
4146
+ action: String,
4147
+ screenGranted: () -> Bool,
4148
+ accessibilityGranted: () -> Bool,
4149
+ requestScreen: () -> Void,
4150
+ requestAccessibility: () -> Void
4151
+ ) -> [String: String] {
4152
+ if action == "screen_recording" && !screenGranted() { requestScreen() }
4153
+ if action == "accessibility" && !accessibilityGranted() { requestAccessibility() }
4154
+ return ["screenRecording": screenGranted() ? "granted" : "required",
4155
+ "accessibility": accessibilityGranted() ? "granted" : "required"]
4156
+ }
4157
+ `, MACOS_PERMISSION_INPUT = String.raw`
4158
+ let action = CommandLine.arguments.last ?? "check"
4159
+ guard ["check", "screen_recording", "accessibility"].contains(action) else { exit(2) }
4160
+ `, MACOS_PERMISSION_HELPER = String.raw`
4161
+ import Foundation
4162
+ import CoreGraphics
4163
+ import ApplicationServices
4164
+ ${MACOS_PERMISSION_GATE}
4165
+ ${MACOS_PERMISSION_INPUT}
4166
+ let result = prepareMacPermissions(
4167
+ action: action,
4168
+ screenGranted: { CGPreflightScreenCaptureAccess() },
4169
+ accessibilityGranted: { AXIsProcessTrusted() },
4170
+ requestScreen: { _ = CGRequestScreenCaptureAccess() },
4171
+ requestAccessibility: {
4172
+ let options = [kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String: true] as CFDictionary
4173
+ _ = AXIsProcessTrustedWithOptions(options)
4174
+ }
4175
+ )
4176
+ let data = try JSONSerialization.data(withJSONObject: result)
4177
+ print(String(data: data, encoding: .utf8)!)
4178
+ `;
4179
+
4180
+ // src/computer-access/computer/macos-prerequisites.ts
4181
+ import { execFile as execFile2 } from "node:child_process";
4182
+ import { access as access2 } from "node:fs/promises";
4183
+ import { promisify as promisify2 } from "node:util";
4184
+ var executeFile2 = promisify2(execFile2);
4185
+ async function missingMacosComputerPrerequisite() {
4186
+ try {
4187
+ let version = await executeFile2("/usr/bin/sw_vers", ["-productVersion"], {
4188
+ timeout: 1e3,
4189
+ maxBuffer: 1024
4190
+ }), major = Number(version.stdout.trim().split(".")[0]);
4191
+ if (!Number.isInteger(major) || major < 14)
4192
+ return "macos14_computer_backend_required";
4193
+ let directory = await executeFile2("/usr/bin/xcode-select", ["-p"], {
4194
+ timeout: 1e3,
4195
+ maxBuffer: 4096
4196
+ });
4197
+ await access2(directory.stdout.trim());
4198
+ return;
4199
+ } catch {
4200
+ return "macos_swift_developer_tools_required";
4201
+ }
4202
+ }
4203
+
4204
+ // src/computer-access/companion/permission-protocol.ts
4205
+ var MACOS_PERMISSION_CAPABILITY = "macos_permission_preflight_v1";
4206
+ function isMacPermissionAction(value) {
4207
+ return !isHostRecord(value) || Object.keys(value).some((key) => !["action", "permission"].includes(key)) ? !1 : value.action === "check" ? !Object.hasOwn(value, "permission") : value.action !== "request" ? !1 : value.permission === "screen_recording" || value.permission === "accessibility";
4208
+ }
4209
+ function isMacPermissionStatus(value) {
4210
+ return !isHostRecord(value) || Object.keys(value).some((key) => !["screenRecording", "accessibility"].includes(key)) || value.screenRecording !== "granted" && value.screenRecording !== "required" ? !1 : value.accessibility === "granted" || value.accessibility === "required";
4211
+ }
4212
+
4213
+ // src/computer-access/companion/native-permissions.ts
4214
+ var executeFile3 = promisify3(execFile3);
4215
+ async function prepareMacPermissions(action, signal, dependencies = {}) {
4216
+ if ((dependencies.platform ?? process.platform) !== "darwin")
4217
+ throw new Error("macos_permissions_platform_required");
4218
+ if (!isMacPermissionAction(action)) throw new Error("macos_permissions_input_invalid");
4219
+ signal?.throwIfAborted();
4220
+ let prerequisite = await (dependencies.prerequisite ?? missingMacosComputerPrerequisite)();
4221
+ if (prerequisite) throw new Error(prerequisite);
4222
+ let requested = action.action === "request" ? action.permission : "check", output = await (dependencies.execute ?? executeFile3)(
4223
+ "/usr/bin/swift",
4224
+ ["-swift-version", "5", "-e", MACOS_PERMISSION_HELPER, requested],
4225
+ { timeout: 45e3, maxBuffer: 16384, encoding: "utf8", signal }
4226
+ ), permissions = JSON.parse(String(output.stdout));
4227
+ if (!isMacPermissionStatus(permissions)) throw new Error("macos_permissions_result_invalid");
4228
+ return {
4229
+ permissions,
4230
+ executablePath: process.execPath,
4231
+ restartMayBeRequired: requested === "screen_recording"
4232
+ };
4233
+ }
4234
+ function createNativePermissionHandlers(platform, prepare = prepareMacPermissions) {
4235
+ return platform !== "macos" ? {} : {
4236
+ [MACOS_PERMISSION_OPERATION]: async (params, context) => {
4237
+ let { target, ...action } = params;
4238
+ if (target !== "macos" || !isMacPermissionAction(action))
4239
+ return failureResult({ errorCode: "macos_permissions_input_invalid", message: "Choose a permission check or one explicit permission request." });
4240
+ try {
4241
+ let result = await prepare(action, context?.abortSignal);
4242
+ return successResult({ output: "Mac permission preparation completed.", data: result });
4243
+ } catch {
4244
+ return failureResult({
4245
+ errorCode: "macos_permissions_check_failed",
4246
+ message: "Permission preparation could not complete. Check that macOS 14 or later and Swift developer tools are available, then check again. No desktop content was collected."
4247
+ });
4248
+ }
4249
+ }
4250
+ };
4251
+ }
4252
+
4253
+ // src/computer-access/companion/native-loopback-lookup.ts
4254
+ function matchesLookupFamily(address, family) {
4255
+ return family === 4 || family === "IPv4" ? address.family === 4 : family === 6 || family === "IPv6" ? address.family === 6 : family === void 0 || family === 0;
4256
+ }
4257
+ function nativeLoopbackSocketOptions(endpoint) {
4258
+ let expectedHostname = new URL(endpoint.url).hostname.toLowerCase();
4259
+ return {
4260
+ family: 0,
4261
+ autoSelectFamily: !0,
4262
+ autoSelectFamilyAttemptTimeout: 250,
4263
+ lookup(hostname2, options, callback) {
4264
+ if (!(hostname2.toLowerCase() === expectedHostname)) {
4265
+ callback(Object.assign(new Error("Unexpected Runtime lookup hostname."), { code: "ENOTFOUND" }), []);
4266
+ return;
4267
+ }
4268
+ let addresses = endpoint.addresses.filter((address) => matchesLookupFamily(address, options.family));
4269
+ if (addresses.length === 0) {
4270
+ callback(Object.assign(new Error("No validated Runtime address for this family."), { code: "ENOTFOUND" }), []);
4271
+ return;
4272
+ }
4273
+ if (options.all) {
4274
+ callback(null, addresses.map(({ address, family }) => ({ address, family })));
4275
+ return;
4276
+ }
4277
+ callback(null, addresses[0].address, addresses[0].family);
4278
+ }
4279
+ };
4280
+ }
4281
+
4020
4282
  // src/computer-access/companion/notification-linux.ts
4021
4283
  import { spawn as spawn2 } from "node:child_process";
4022
4284
  function notificationMarkupText(value) {
@@ -4169,24 +4431,22 @@ var LinuxNotificationRenderer = class {
4169
4431
  };
4170
4432
 
4171
4433
  // src/computer-access/companion/notification-readiness.ts
4172
- import { access, readFile as readFile6 } from "node:fs/promises";
4173
- import { join as join8 } from "node:path";
4434
+ import { access as access3, readFile as readFile6 } from "node:fs/promises";
4435
+ import { join as join9 } from "node:path";
4174
4436
  async function hasDesktopNotificationSupport(platform, locations, run = runNotificationProcess, signal) {
4175
4437
  signal?.throwIfAborted();
4176
4438
  try {
4177
4439
  if (!await hasOwnedNotificationDirectory(locations)) return !1;
4178
4440
  let ready = await readFile6(
4179
- join8(notificationInstallDirectory(locations), ".ready"),
4441
+ join9(notificationInstallDirectory(locations), ".ready"),
4180
4442
  "utf8"
4181
4443
  ), expected = { windows: "win32", macos: "darwin", linux: "linux" }[platform];
4182
4444
  if (ready !== expected) return !1;
4183
4445
  if (platform === "windows") return !0;
4184
4446
  if (platform === "macos")
4185
- return await access(
4186
- join8(macNotificationAppPath(locations), "Contents", "MacOS", "applet")
4187
- ), !0;
4447
+ return await assertMacNotificationBundle(macNotificationAppPath(locations), run, signal), !0;
4188
4448
  if (!process.env.DISPLAY && !process.env.WAYLAND_DISPLAY) return !1;
4189
- await access(linuxNotificationDesktopPath(locations)), signal?.throwIfAborted();
4449
+ await access3(linuxNotificationDesktopPath(locations)), signal?.throwIfAborted();
4190
4450
  let help = await run({ file: "notify-send", args: ["--help"], signal });
4191
4451
  return signal?.throwIfAborted(), ["--wait", "--action", "--print-id"].every(
4192
4452
  (option) => help.includes(option)
@@ -4298,9 +4558,9 @@ async function createNativeNotificationSession(platform, runtimeUrl, locations =
4298
4558
  import { createHash, randomUUID as randomUUID7 } from "node:crypto";
4299
4559
 
4300
4560
  // src/computer-access/targets.ts
4301
- import { constants } from "node:fs";
4302
- import { access as access2 } from "node:fs/promises";
4303
- import { delimiter, join as join9 } from "node:path";
4561
+ import { constants as constants2 } from "node:fs";
4562
+ import { access as access4 } from "node:fs/promises";
4563
+ import { delimiter, join as join10 } from "node:path";
4304
4564
 
4305
4565
  // src/computer-access/contracts.ts
4306
4566
  var SystemOperationError = class extends Error {
@@ -4444,11 +4704,11 @@ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }`;
4444
4704
  async function findExecutable(name, additional = []) {
4445
4705
  let candidates = [
4446
4706
  ...additional,
4447
- ...(process.env.PATH ?? "").split(delimiter).filter(Boolean).map((directory) => join9(directory, name))
4707
+ ...(process.env.PATH ?? "").split(delimiter).filter(Boolean).map((directory) => join10(directory, name))
4448
4708
  ];
4449
4709
  for (let candidate of candidates)
4450
4710
  try {
4451
- return await access2(candidate, constants.X_OK), candidate;
4711
+ return await access4(candidate, constants2.X_OK), candidate;
4452
4712
  } catch {
4453
4713
  }
4454
4714
  }
@@ -4465,7 +4725,7 @@ async function resolveSystemTarget(id, run = runSystemProcess) {
4465
4725
  "system_target_unavailable",
4466
4726
  "No Windows execution transport is available on this host."
4467
4727
  );
4468
- let canonicalShell = nativeWindows ? join9(
4728
+ let canonicalShell = nativeWindows ? join10(
4469
4729
  process.env.SystemRoot ?? "C:\\Windows",
4470
4730
  "System32",
4471
4731
  "WindowsPowerShell",
@@ -4502,7 +4762,7 @@ function isNativeUnixTarget(id) {
4502
4762
  }
4503
4763
  async function resolveNativeUnixTarget(id) {
4504
4764
  try {
4505
- await access2("/bin/bash", constants.X_OK);
4765
+ await access4("/bin/bash", constants2.X_OK);
4506
4766
  } catch {
4507
4767
  throw new SystemOperationError(
4508
4768
  "system_target_unavailable",
@@ -5904,7 +6164,7 @@ func capability(_ available: Bool,_ reason: String = "",supported: Bool = true)
5904
6164
  return result
5905
6165
  }
5906
6166
  func rectJSON(_ rect: CGRect) -> [String:Any] {
5907
- return ["x":rect.minX,"y":rect.minY,"width":rect.width,"height":rect.height]
6167
+ return ["x":Double(rect.minX),"y":Double(rect.minY),"width":Double(rect.width),"height":Double(rect.height)]
5908
6168
  }
5909
6169
  func boundedText(_ value:String,_ limit:Int=256) -> String {
5910
6170
  var result="",length=0
@@ -6209,12 +6469,9 @@ final class CancellationFlag {
6209
6469
  }
6210
6470
  }
6211
6471
  }
6212
- let keyCodes:[String:CGKeyCode] = ["a":0,"s":1,"d":2,"f":3,"h":4,"g":5,"z":6,"x":7,"c":8,"v":9,"b":11,"q":12,"w":13,"e":14,"r":15,"y":16,"t":17,"1":18,"2":19,"3":20,"4":21,"6":22,"5":23,"=":24,"9":25,"7":26,"-":27,"8":28,"0":29,"]":30,"o":31,"u":32,"[":33,"i":34,"p":35,"l":37,"j":38,"'":39,"k":40,";":41,"\\":42,",":43,"/":44,"n":45,"m":46,".":47,"\u{60}":50,"Enter":36,"Return":36,"Tab":48,"Space":49,"Backspace":51,"Delete":117,"Esc":53,"Escape":53,"Meta":55,"Super":55,"Command":55,"Shift":56,"Alt":58,"Option":58,"Ctrl":59,"Control":59,"F1":122,"F2":120,"F3":99,"F4":118,"F5":96,"F6":97,"F7":98,"F8":100,"F9":101,"F10":109,"F11":103,"F12":111,"Home":115,"End":119,"PageUp":116,"PageDown":121,"ArrowLeft":123,"ArrowRight":124,"ArrowDown":125,"ArrowUp":126]
6472
+ let keyCodes:[String:CGKeyCode] = ["a":0,"s":1,"d":2,"f":3,"h":4,"g":5,"z":6,"x":7,"c":8,"v":9,"b":11,"q":12,"w":13,"e":14,"r":15,"y":16,"t":17,"1":18,"2":19,"3":20,"4":21,"6":22,"5":23,"=":24,"9":25,"7":26,"-":27,"8":28,"0":29,"]":30,"o":31,"u":32,"[":33,"i":34,"p":35,"l":37,"j":38,"'":39,"k":40,";":41,"\\":42,",":43,"/":44,"n":45,"m":46,".":47,"\u{60}":50,"enter":36,"return":36,"tab":48,"space":49,"backspace":51,"delete":117,"esc":53,"escape":53,"meta":55,"super":55,"command":55,"cmd":55,"shift":56,"alt":58,"option":58,"ctrl":59,"control":59,"f1":122,"f2":120,"f3":99,"f4":118,"f5":96,"f6":97,"f7":98,"f8":100,"f9":101,"f10":109,"f11":103,"f12":111,"home":115,"end":119,"pageup":116,"pagedown":121,"arrowleft":123,"arrowright":124,"arrowdown":125,"arrowup":126]
6213
6473
  func nativeKey(_ value:String) throws -> CGKeyCode {
6214
- if let key=keyCodes[value] {
6215
- return key
6216
- }
6217
- if value.count==1,let key=keyCodes[value.lowercased()] {
6474
+ if let key=keyCodes[value.lowercased()] {
6218
6475
  return key
6219
6476
  }
6220
6477
  throw NativeFailure("macos_key_unsupported")
@@ -6597,30 +6854,6 @@ RunLoop.main.run()
6597
6854
  ].join(`
6598
6855
  `);
6599
6856
 
6600
- // src/computer-access/computer/macos-prerequisites.ts
6601
- import { execFile as execFile2 } from "node:child_process";
6602
- import { access as access3 } from "node:fs/promises";
6603
- import { promisify as promisify2 } from "node:util";
6604
- var executeFile2 = promisify2(execFile2);
6605
- async function missingMacosComputerPrerequisite() {
6606
- try {
6607
- let version = await executeFile2("/usr/bin/sw_vers", ["-productVersion"], {
6608
- timeout: 1e3,
6609
- maxBuffer: 1024
6610
- }), major = Number(version.stdout.trim().split(".")[0]);
6611
- if (!Number.isInteger(major) || major < 14)
6612
- return "macos14_computer_backend_required";
6613
- let directory = await executeFile2("/usr/bin/xcode-select", ["-p"], {
6614
- timeout: 1e3,
6615
- maxBuffer: 4096
6616
- });
6617
- await access3(directory.stdout.trim());
6618
- return;
6619
- } catch {
6620
- return "macos_swift_developer_tools_required";
6621
- }
6622
- }
6623
-
6624
6857
  // src/computer-access/computer/macos-backend.ts
6625
6858
  function createMacosComputerBackend(target) {
6626
6859
  if (target.id !== "macos" || target.transport !== "native")
@@ -9093,7 +9326,7 @@ var NativeObservationSession = class {
9093
9326
  // src/computer-access/application-catalog.ts
9094
9327
  import { readdir, readFile as readFile7 } from "node:fs/promises";
9095
9328
  import { homedir as homedir3 } from "node:os";
9096
- import { basename as basename3, join as join10 } from "node:path";
9329
+ import { basename as basename3, join as join11 } from "node:path";
9097
9330
  var CATALOG_ENTRY_LIMIT = 2e3;
9098
9331
  function isAbsentOptionalCatalogRoot(error, depth) {
9099
9332
  return depth !== 0 || !(error instanceof Error) ? !1 : "code" in error && error.code === "ENOENT";
@@ -9121,7 +9354,7 @@ async function collectApplicationPaths(roots, extension2) {
9121
9354
  complete = !1;
9122
9355
  break;
9123
9356
  }
9124
- let absolute = join10(current.path, entry.name);
9357
+ let absolute = join11(current.path, entry.name);
9125
9358
  if (entry.name.endsWith(extension2)) {
9126
9359
  paths.push(absolute);
9127
9360
  continue;
@@ -9200,7 +9433,7 @@ async function readSystemApplications(target, run) {
9200
9433
  let roots2 = [
9201
9434
  "/Applications",
9202
9435
  "/System/Applications",
9203
- join10(homedir3(), "Applications")
9436
+ join11(homedir3(), "Applications")
9204
9437
  ], catalog2 = await collectApplicationPaths(roots2, ".app");
9205
9438
  return {
9206
9439
  applications: catalog2.paths.map((id) => ({
@@ -9217,8 +9450,8 @@ async function readSystemApplications(target, run) {
9217
9450
  }
9218
9451
  };
9219
9452
  }
9220
- let dataHome = process.env.XDG_DATA_HOME ?? join10(homedir3(), ".local", "share"), dataDirs = (process.env.XDG_DATA_DIRS ?? "/usr/local/share:/usr/share").split(":"), roots = [dataHome, ...dataDirs].map(
9221
- (directory) => join10(directory, "applications")
9453
+ let dataHome = process.env.XDG_DATA_HOME ?? join11(homedir3(), ".local", "share"), dataDirs = (process.env.XDG_DATA_DIRS ?? "/usr/local/share:/usr/share").split(":"), roots = [dataHome, ...dataDirs].map(
9454
+ (directory) => join11(directory, "applications")
9222
9455
  ), catalog = await collectApplicationPaths(roots, ".desktop"), applications = [], complete = catalog.complete;
9223
9456
  for (let path of catalog.paths) {
9224
9457
  let content;
@@ -9729,6 +9962,7 @@ function readNativeServerMessage(text) {
9729
9962
  };
9730
9963
  }
9731
9964
  var NATIVE_OPERATION_FIELDS = {
9965
+ macos_permissions: ["target", "action", "permission"],
9732
9966
  desktop_notification: ["target", "notificationId", "title", "body", "url"],
9733
9967
  system_targets: [],
9734
9968
  system_command: ["target", "command", "cwd", "elevated", "timeout_ms"],
@@ -9788,7 +10022,8 @@ async function connectNativeHost(options) {
9788
10022
  let handlers = options.handlers ?? {
9789
10023
  ...createSystemHandlers(),
9790
10024
  ...computers.handlers(),
9791
- ...notifications.handlers()
10025
+ ...notifications.handlers(),
10026
+ ...createNativePermissionHandlers(options.identity.os)
9792
10027
  };
9793
10028
  return new Promise((resolve2) => {
9794
10029
  let socket = new wrapper_default(endpoint.url, {
@@ -9935,9 +10170,10 @@ async function connectNativeHost(options) {
9935
10170
  capabilities: [
9936
10171
  OBSERVATION_CAPABILITY,
9937
10172
  COMPUTER_CAPABILITY,
10173
+ ...options.identity.os === "macos" ? [MACOS_PERMISSION_CAPABILITY] : [],
9938
10174
  ...advertisedNotificationReady ? [DESKTOP_NOTIFICATION_CAPABILITY] : []
9939
10175
  ],
9940
- companionVersion: 6,
10176
+ companionVersion: 10,
9941
10177
  ...hostId ? { hostId } : {}
9942
10178
  });
9943
10179
  }), socket.on("message", (data, binary) => {
@@ -10064,10 +10300,10 @@ async function runNativeHostSupervisor(options) {
10064
10300
  }
10065
10301
 
10066
10302
  // src/computer-access/companion/process-owner-identity.ts
10067
- import { execFile as execFile3 } from "node:child_process";
10303
+ import { execFile as execFile4 } from "node:child_process";
10068
10304
  import { readFile as readFile8 } from "node:fs/promises";
10069
- import { promisify as promisify3 } from "node:util";
10070
- var executeFile3 = promisify3(execFile3), WINDOWS_OWNER_SCRIPT = `
10305
+ import { promisify as promisify4 } from "node:util";
10306
+ var executeFile4 = promisify4(execFile4), WINDOWS_OWNER_SCRIPT = `
10071
10307
  $ErrorActionPreference = 'Stop'
10072
10308
  $targetPid = [int]$env:ABOT_HOST_OWNER_PID
10073
10309
  $target = Get-Process -Id $targetPid -ErrorAction Stop
@@ -10183,7 +10419,7 @@ var nativeProbe = createProcessOwnerIdentityProbe({
10183
10419
  platform: process.platform,
10184
10420
  currentPid: process.pid,
10185
10421
  readText: (path) => readFile8(path, "utf8"),
10186
- execute: async (file, args, options) => (await executeFile3(file, [...args], options)).stdout,
10422
+ execute: async (file, args, options) => (await executeFile4(file, [...args], options)).stdout,
10187
10423
  processIsAlive: observePidLiveness
10188
10424
  }), readProcessOwnerIdentity = nativeProbe.readProcessOwnerIdentity, isProcessOwnerAlive = nativeProbe.isProcessOwnerAlive, requireCurrentProcessOwnerIdentity = nativeProbe.requireCurrentProcessOwnerIdentity;
10189
10425
 
@@ -10192,7 +10428,7 @@ import { randomUUID as randomUUID9 } from "node:crypto";
10192
10428
 
10193
10429
  // src/runtime/adapters/long-term-memory/file-lock/cleanup.ts
10194
10430
  import { rmdir, unlink as unlink5 } from "node:fs/promises";
10195
- import { join as join11 } from "node:path";
10431
+ import { join as join12 } from "node:path";
10196
10432
 
10197
10433
  // src/runtime/adapters/long-term-memory/file-lock/contracts.ts
10198
10434
  var LEASE_DIRECTORY_NAME = "lease", OWNER_FILE_PATTERN = /^owner-([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})\.json$/iu;
@@ -10209,7 +10445,7 @@ function fileSystemErrorCode(error) {
10209
10445
  // src/runtime/adapters/long-term-memory/file-lock/cleanup.ts
10210
10446
  async function removeObservedOwner(lockPath, observedOwnerFileName) {
10211
10447
  try {
10212
- await unlink5(join11(lockPath, LEASE_DIRECTORY_NAME, observedOwnerFileName));
10448
+ await unlink5(join12(lockPath, LEASE_DIRECTORY_NAME, observedOwnerFileName));
10213
10449
  } catch (error) {
10214
10450
  if (fileSystemErrorCode(error) === "ENOENT") return !1;
10215
10451
  throw error;
@@ -10217,7 +10453,7 @@ async function removeObservedOwner(lockPath, observedOwnerFileName) {
10217
10453
  return removeEmptyLockTree(lockPath, !0);
10218
10454
  }
10219
10455
  async function removeEmptyLockTree(lockPath, hasLeaseDirectory) {
10220
- return hasLeaseDirectory && !await removeDirectoryIfEmpty(join11(lockPath, LEASE_DIRECTORY_NAME)) ? !1 : removeDirectoryIfEmpty(lockPath);
10456
+ return hasLeaseDirectory && !await removeDirectoryIfEmpty(join12(lockPath, LEASE_DIRECTORY_NAME)) ? !1 : removeDirectoryIfEmpty(lockPath);
10221
10457
  }
10222
10458
  async function removeDirectoryIfEmpty(path) {
10223
10459
  try {
@@ -10245,7 +10481,7 @@ async function removeStagingLock(stagingPath, stagingOwnerPath) {
10245
10481
 
10246
10482
  // src/runtime/adapters/long-term-memory/file-lock/install.ts
10247
10483
  import { mkdir as mkdir4, open as open2, rename as rename4 } from "node:fs/promises";
10248
- import { join as join12 } from "node:path";
10484
+ import { join as join13 } from "node:path";
10249
10485
 
10250
10486
  // src/runtime/adapters/long-term-memory/file-lock/owner-identity.ts
10251
10487
  function isLockOwnerIdentity(value) {
@@ -10259,7 +10495,7 @@ function hasValidOptionalLockOwnerIdentity(value) {
10259
10495
  async function installLockDirectory(lockPath, token, ownerIdentity) {
10260
10496
  if (!hasValidOptionalLockOwnerIdentity(ownerIdentity))
10261
10497
  throw new Error("file_lock_owner_identity_invalid");
10262
- let stagingPath = `${lockPath}.${process.pid}.${token}.pending`, stagingOwnerPath = join12(stagingPath, ownerFileName(token)), handle, claimedLockPath = !1, installed = !1;
10498
+ let stagingPath = `${lockPath}.${process.pid}.${token}.pending`, stagingOwnerPath = join13(stagingPath, ownerFileName(token)), handle, claimedLockPath = !1, installed = !1;
10263
10499
  try {
10264
10500
  await mkdir4(stagingPath, { mode: 448 }), handle = await open2(stagingOwnerPath, "wx", 384), await handle.writeFile(
10265
10501
  JSON.stringify({
@@ -10269,7 +10505,7 @@ async function installLockDirectory(lockPath, token, ownerIdentity) {
10269
10505
  ...ownerIdentity === void 0 ? {} : { ownerIdentity }
10270
10506
  }),
10271
10507
  "utf8"
10272
- ), await handle.sync(), await handle.close(), handle = void 0, await mkdir4(lockPath, { mode: 448 }), claimedLockPath = !0, await rename4(stagingPath, join12(lockPath, LEASE_DIRECTORY_NAME)), installed = !0;
10508
+ ), await handle.sync(), await handle.close(), handle = void 0, await mkdir4(lockPath, { mode: 448 }), claimedLockPath = !0, await rename4(stagingPath, join13(lockPath, LEASE_DIRECTORY_NAME)), installed = !0;
10273
10509
  } finally {
10274
10510
  await handle?.close().catch(() => {
10275
10511
  }), installed || (await removeStagingLock(stagingPath, stagingOwnerPath), claimedLockPath && await removeDirectoryIfEmpty(lockPath));
@@ -10277,19 +10513,19 @@ async function installLockDirectory(lockPath, token, ownerIdentity) {
10277
10513
  }
10278
10514
 
10279
10515
  // src/runtime/adapters/long-term-memory/file-lock/snapshot.ts
10280
- import { lstat as lstat5, readdir as readdir2 } from "node:fs/promises";
10281
- import { join as join14 } from "node:path";
10516
+ import { lstat as lstat6, readdir as readdir2 } from "node:fs/promises";
10517
+ import { join as join15 } from "node:path";
10282
10518
 
10283
10519
  // src/runtime/adapters/long-term-memory/file-lock/owner-record.ts
10284
- import { constants as constants2 } from "node:fs";
10520
+ import { constants as constants3 } from "node:fs";
10285
10521
  import { open as open3 } from "node:fs/promises";
10286
- import { join as join13 } from "node:path";
10522
+ import { join as join14 } from "node:path";
10287
10523
  async function readOwnerRecord(lockPath, entryName, expectedToken, directoryModifiedAtMs) {
10288
10524
  let handle;
10289
10525
  try {
10290
10526
  handle = await open3(
10291
- join13(lockPath, LEASE_DIRECTORY_NAME, entryName),
10292
- constants2.O_RDONLY | constants2.O_NOFOLLOW
10527
+ join14(lockPath, LEASE_DIRECTORY_NAME, entryName),
10528
+ constants3.O_RDONLY | constants3.O_NOFOLLOW
10293
10529
  );
10294
10530
  let before = await handle.stat({ bigint: !0 }), modifiedAtMs = Math.max(
10295
10531
  directoryModifiedAtMs,
@@ -10406,16 +10642,16 @@ async function readLockSnapshot(lockPath) {
10406
10642
  }
10407
10643
  async function readLockInfo(lockPath) {
10408
10644
  try {
10409
- return await lstat5(lockPath);
10645
+ return await lstat6(lockPath);
10410
10646
  } catch (error) {
10411
10647
  if (fileSystemErrorCode(error) === "ENOENT") return;
10412
10648
  throw error;
10413
10649
  }
10414
10650
  }
10415
10651
  async function readLeaseSnapshot(lockPath, lockModifiedAtMs) {
10416
- let leasePath = join14(lockPath, LEASE_DIRECTORY_NAME), leaseInfo, leaseEntries;
10652
+ let leasePath = join15(lockPath, LEASE_DIRECTORY_NAME), leaseInfo, leaseEntries;
10417
10653
  try {
10418
- if (leaseInfo = await lstat5(leasePath), !leaseInfo.isDirectory())
10654
+ if (leaseInfo = await lstat6(leasePath), !leaseInfo.isDirectory())
10419
10655
  return invalidLeaseSnapshot(lockModifiedAtMs);
10420
10656
  leaseEntries = await readdir2(leasePath, { withFileTypes: !0 });
10421
10657
  } catch (error) {
@@ -10453,15 +10689,15 @@ function invalidLeaseSnapshot(modifiedAtMs) {
10453
10689
 
10454
10690
  // src/runtime/adapters/long-term-memory/file-lock/synchronous-release.ts
10455
10691
  import { rmdirSync, unlinkSync } from "node:fs";
10456
- import { join as join15 } from "node:path";
10692
+ import { join as join16 } from "node:path";
10457
10693
  function removeObservedOwnerSynchronously(lockPath, observedOwnerFileName) {
10458
10694
  try {
10459
- unlinkSync(join15(lockPath, LEASE_DIRECTORY_NAME, observedOwnerFileName));
10695
+ unlinkSync(join16(lockPath, LEASE_DIRECTORY_NAME, observedOwnerFileName));
10460
10696
  } catch (error) {
10461
10697
  if (fileSystemErrorCode(error) === "ENOENT") return !1;
10462
10698
  throw error;
10463
10699
  }
10464
- return removeReleasedDirectory(join15(lockPath, LEASE_DIRECTORY_NAME)) ? removeReleasedDirectory(lockPath) : !1;
10700
+ return removeReleasedDirectory(join16(lockPath, LEASE_DIRECTORY_NAME)) ? removeReleasedDirectory(lockPath) : !1;
10465
10701
  }
10466
10702
  function removeReleasedDirectory(path) {
10467
10703
  try {
@@ -10537,13 +10773,13 @@ function delay3(milliseconds) {
10537
10773
  }
10538
10774
 
10539
10775
  // src/runtime/local-host/private-directory.ts
10540
- import { lstat as lstat6, mkdir as mkdir5, mkdtemp, rename as rename5, rmdir as rmdir2 } from "node:fs/promises";
10541
- import { basename as basename4, dirname as dirname5, join as join16 } from "node:path";
10776
+ import { lstat as lstat7, mkdir as mkdir5, mkdtemp, rename as rename5, rmdir as rmdir2 } from "node:fs/promises";
10777
+ import { basename as basename4, dirname as dirname5, join as join17 } from "node:path";
10542
10778
 
10543
10779
  // src/runtime/local-host/windows-private-access.ts
10544
- import { execFile as execFile4 } from "node:child_process";
10545
- import { promisify as promisify4 } from "node:util";
10546
- var execute2 = promisify4(execFile4), privateAccessScript = `
10780
+ import { execFile as execFile5 } from "node:child_process";
10781
+ import { promisify as promisify5 } from "node:util";
10782
+ var execute2 = promisify5(execFile5), privateAccessScript = `
10547
10783
  $ErrorActionPreference = 'Stop'
10548
10784
  $target = $env:ABOT_LOCAL_HOST_PRIVATE_PATH
10549
10785
  $current = [System.Security.Principal.WindowsIdentity]::GetCurrent().User
@@ -10611,7 +10847,7 @@ async function assertPrivateRuntimeAccess(path, stat2, errorCode2, newlyCreatedD
10611
10847
  // src/runtime/local-host/private-directory.ts
10612
10848
  async function ensurePrivateRuntimeDirectory(directory) {
10613
10849
  process.platform === "win32" ? await installWindowsPrivateDirectory(directory) : await mkdir5(directory, { recursive: !0, mode: 448 });
10614
- let stat2 = await lstat6(directory);
10850
+ let stat2 = await lstat7(directory);
10615
10851
  if (!stat2.isDirectory() || stat2.isSymbolicLink())
10616
10852
  throw new Error("local_runtime_directory_not_private");
10617
10853
  await assertPrivateRuntimeAccess(
@@ -10625,7 +10861,7 @@ async function installWindowsPrivateDirectory(directory) {
10625
10861
  let parent = dirname5(directory);
10626
10862
  await mkdir5(parent, { recursive: !0 });
10627
10863
  let temporary = await mkdtemp(
10628
- join16(parent, `.${basename4(directory)}.private-`)
10864
+ join17(parent, `.${basename4(directory)}.private-`)
10629
10865
  );
10630
10866
  try {
10631
10867
  await verifyWindowsPrivateAccess(temporary, !0);
@@ -10644,7 +10880,7 @@ async function installWindowsPrivateDirectory(directory) {
10644
10880
  }
10645
10881
  async function hasExistingPath(path) {
10646
10882
  try {
10647
- return await lstat6(path), !0;
10883
+ return await lstat7(path), !0;
10648
10884
  } catch (error) {
10649
10885
  if (isMissingPath(error)) return !1;
10650
10886
  throw error;
@@ -10666,11 +10902,11 @@ async function readNativeCompanionBuildId(cliPath) {
10666
10902
  }
10667
10903
 
10668
10904
  // src/computer-access/companion/native-replacement.ts
10669
- import { execFile as execFile5 } from "node:child_process";
10670
- import { join as join17 } from "node:path";
10905
+ import { execFile as execFile6 } from "node:child_process";
10906
+ import { join as join18 } from "node:path";
10671
10907
  import { setTimeout as delay4 } from "node:timers/promises";
10672
- import { promisify as promisify5 } from "node:util";
10673
- var executeFile4 = promisify5(execFile5), STOP_WAIT_MS = 1e4;
10908
+ import { promisify as promisify6 } from "node:util";
10909
+ var executeFile5 = promisify6(execFile6), STOP_WAIT_MS = 1e4;
10674
10910
  function replacementFailure(reason) {
10675
10911
  return new Error(
10676
10912
  `The running Host Companion could not be safely replaced (${reason}). Close the existing Host Companion, then run the updated setup again. The saved pairing was not changed.`
@@ -10741,12 +10977,12 @@ async function stopOwnedNativeCompanion(stateDir, overrides = {}) {
10741
10977
  process.kill(pid, signal);
10742
10978
  },
10743
10979
  execute: async (file, args, options) => {
10744
- await executeFile4(file, [...args], options);
10980
+ await executeFile5(file, [...args], options);
10745
10981
  },
10746
10982
  now: Date.now,
10747
10983
  delay: delay4,
10748
10984
  ...overrides
10749
- }, lockPath = join17(stateDir, "agent"), initial = await readReplacementLock(lockPath, dependencies);
10985
+ }, lockPath = join18(stateDir, "agent"), initial = await readReplacementLock(lockPath, dependencies);
10750
10986
  if (!initial || isReclaimableLockWithoutRecord(initial)) return;
10751
10987
  let owner = requireRecordedOwner(initial);
10752
10988
  if (!await verifyLiveCompanionOwner(owner, dependencies)) return;
@@ -10765,13 +11001,13 @@ async function stopOwnedNativeCompanion(stateDir, overrides = {}) {
10765
11001
  }
10766
11002
 
10767
11003
  // src/computer-access/companion/native-runtime-installation.ts
10768
- import { execFile as execFile6 } from "node:child_process";
11004
+ import { execFile as execFile7 } from "node:child_process";
10769
11005
  import { createHash as createHash4, randomUUID as randomUUID10 } from "node:crypto";
10770
- import { constants as constants3 } from "node:fs";
10771
- import { lstat as lstat7, open as open4, rename as rename6, unlink as unlink6 } from "node:fs/promises";
10772
- import { join as join18 } from "node:path";
10773
- import { promisify as promisify6 } from "node:util";
10774
- var executeFile5 = promisify6(execFile6), NATIVE_RUNTIME_INSTALLATION_FAILURE = "The Mac companion runtime could not be prepared safely. The saved pairing was not changed. Check the local Node.js installation and run setup again.";
11006
+ import { constants as constants4 } from "node:fs";
11007
+ import { lstat as lstat8, open as open4, rename as rename6, unlink as unlink6 } from "node:fs/promises";
11008
+ import { join as join19 } from "node:path";
11009
+ import { promisify as promisify7 } from "node:util";
11010
+ var executeFile6 = promisify7(execFile7), NATIVE_RUNTIME_INSTALLATION_FAILURE = "The Mac companion runtime could not be prepared safely. The saved pairing was not changed. Check the local Node.js installation and run setup again.";
10775
11011
  function runtimeInstallationFailure() {
10776
11012
  return new Error(NATIVE_RUNTIME_INSTALLATION_FAILURE);
10777
11013
  }
@@ -10802,19 +11038,19 @@ async function streamRuntimeDigest(handle) {
10802
11038
  return hash.digest("hex");
10803
11039
  }
10804
11040
  async function readRuntimeFile(path, managed) {
10805
- let stat2 = await lstat7(path).catch((error) => {
11041
+ let stat2 = await lstat8(path).catch((error) => {
10806
11042
  if (!isAbsentRuntimePath(error))
10807
11043
  throw error;
10808
11044
  });
10809
11045
  if (!stat2) return;
10810
11046
  if (managed && await requireManagedRuntimeFile(path, stat2), !managed && !hasTrustedRuntimeSource(stat2))
10811
11047
  throw runtimeInstallationFailure();
10812
- let handle = await open4(path, constants3.O_RDONLY | constants3.O_NOFOLLOW);
11048
+ let handle = await open4(path, constants4.O_RDONLY | constants4.O_NOFOLLOW);
10813
11049
  try {
10814
11050
  if (!hasSameRuntimeIdentity(stat2, await handle.stat()))
10815
11051
  throw runtimeInstallationFailure();
10816
11052
  let digest = await streamRuntimeDigest(handle);
10817
- if (!hasSameRuntimeIdentity(stat2, await handle.stat()) || !hasSameRuntimeIdentity(stat2, await lstat7(path)))
11053
+ if (!hasSameRuntimeIdentity(stat2, await handle.stat()) || !hasSameRuntimeIdentity(stat2, await lstat8(path)))
10818
11054
  throw runtimeInstallationFailure();
10819
11055
  return { stat: stat2, digest };
10820
11056
  } finally {
@@ -10838,13 +11074,13 @@ async function requireRuntimeVersion(path, expected, dependencies) {
10838
11074
  throw runtimeInstallationFailure();
10839
11075
  }
10840
11076
  async function copyRuntimeSource(source, staged, expected) {
10841
- let input = await open4(source, constants3.O_RDONLY | constants3.O_NOFOLLOW);
11077
+ let input = await open4(source, constants4.O_RDONLY | constants4.O_NOFOLLOW);
10842
11078
  try {
10843
11079
  if (!hasSameRuntimeIdentity(expected.stat, await input.stat()))
10844
11080
  throw runtimeInstallationFailure();
10845
11081
  let output = await open4(
10846
11082
  staged,
10847
- constants3.O_WRONLY | constants3.O_CREAT | constants3.O_EXCL | constants3.O_NOFOLLOW,
11083
+ constants4.O_WRONLY | constants4.O_CREAT | constants4.O_EXCL | constants4.O_NOFOLLOW,
10848
11084
  384
10849
11085
  );
10850
11086
  try {
@@ -10874,19 +11110,19 @@ async function requireUnchangedRuntimeTarget(path, expected) {
10874
11110
  }
10875
11111
  async function requireUnchangedRuntimeDirectory(path, expected) {
10876
11112
  await ensurePrivateRuntimeDirectory(path);
10877
- let current = await lstat7(path);
11113
+ let current = await lstat8(path);
10878
11114
  if (expected.dev !== current.dev || expected.ino !== current.ino) throw runtimeInstallationFailure();
10879
11115
  }
10880
11116
  async function installManagedRuntime(startup, dependencies) {
10881
11117
  await ensurePrivateRuntimeDirectory(startup.stateDir);
10882
- let stateIdentity = await lstat7(startup.stateDir), directory = join18(startup.stateDir, "runtime");
11118
+ let stateIdentity = await lstat8(startup.stateDir), directory = join19(startup.stateDir, "runtime");
10883
11119
  await ensurePrivateRuntimeDirectory(directory);
10884
- let directoryIdentity = await lstat7(directory), target = join18(directory, "node"), source = await readRuntimeFile(startup.nodePath, !1);
11120
+ let directoryIdentity = await lstat8(directory), target = join19(directory, "node"), source = await readRuntimeFile(startup.nodePath, !1);
10885
11121
  if (!source) throw runtimeInstallationFailure();
10886
11122
  let existing = await readRuntimeFile(target, !0), expectedVersion = await runtimeVersion(startup.nodePath, dependencies);
10887
11123
  if (existing?.digest === source.digest)
10888
11124
  return await requireRuntimeVersion(target, expectedVersion, dependencies), await requireUnchangedRuntimeDirectory(startup.stateDir, stateIdentity), await requireUnchangedRuntimeDirectory(directory, directoryIdentity), await requireUnchangedRuntimeTarget(target, existing), target;
10889
- let staged = join18(directory, ".node-" + randomUUID10() + ".tmp");
11125
+ let staged = join19(directory, ".node-" + randomUUID10() + ".tmp");
10890
11126
  try {
10891
11127
  await copyRuntimeSource(startup.nodePath, staged, source);
10892
11128
  let stagedFile = await readRuntimeFile(staged, !0);
@@ -10902,7 +11138,7 @@ async function installManagedRuntime(startup, dependencies) {
10902
11138
  async function prepareNativeCompanionRuntime(startup, overrides = {}) {
10903
11139
  if (startup.platform !== "darwin") return startup;
10904
11140
  let dependencies = {
10905
- execute: async (file, args, options) => (await executeFile5(file, [...args], options)).stdout,
11141
+ execute: async (file, args, options) => (await executeFile6(file, [...args], options)).stdout,
10906
11142
  ...overrides
10907
11143
  };
10908
11144
  try {
@@ -10984,6 +11220,27 @@ function resolveHostCompanionSetupUrl(saved, requestedUrl, upgradeHostId) {
10984
11220
  return saved.url;
10985
11221
  }
10986
11222
 
11223
+ // src/cli/host-permissions.ts
11224
+ function permissionCliAction(args) {
11225
+ if (args.length === 0) return { action: "check" };
11226
+ if (args.length !== 2 || args[0] !== "--request")
11227
+ throw new Error("Usage: abot host permissions [--request screen-recording|accessibility]");
11228
+ if (args[1] === "screen-recording") return { action: "request", permission: "screen_recording" };
11229
+ if (args[1] === "accessibility") return { action: "request", permission: "accessibility" };
11230
+ throw new Error("Usage: abot host permissions [--request screen-recording|accessibility]");
11231
+ }
11232
+ async function runHostPermissionsCli(args, dependencies = {}) {
11233
+ let action = permissionCliAction(args);
11234
+ if ((dependencies.platform ?? process.platform) !== "darwin")
11235
+ throw new Error("Mac permission preparation is available only on macOS.");
11236
+ let result = await (dependencies.prepare ?? prepareMacPermissions)(action);
11237
+ (dependencies.print ?? console.log)(JSON.stringify({
11238
+ scope: "calling_application",
11239
+ ...result,
11240
+ guidance: "These permissions belong to the Terminal/app running this command, not the installed companion. Run ABot from this same application. If macOS asks you to quit and reopen it, do so before starting a model session, then check again. App-specific Automation permissions are separate."
11241
+ }, null, 2));
11242
+ }
11243
+
10987
11244
  // src/cli/host-companion.ts
10988
11245
  function printHostHelp() {
10989
11246
  console.log(
@@ -10991,6 +11248,7 @@ function printHostHelp() {
10991
11248
  "Usage:",
10992
11249
  " abot host connect --url http://localhost:5177",
10993
11250
  " abot host status",
11251
+ " abot host permissions [--request screen-recording|accessibility]",
10994
11252
  " abot host disconnect",
10995
11253
  " abot host uninstall",
10996
11254
  " abot host run",
@@ -11005,7 +11263,7 @@ function printHostHelp() {
11005
11263
  );
11006
11264
  }
11007
11265
  function nativeState() {
11008
- return createNativeHostState(join19(homedir4(), ".abot", "host-companion"), {
11266
+ return createNativeHostState(join20(homedir4(), ".abot", "host-companion"), {
11009
11267
  ensureDirectory: ensurePrivateRuntimeDirectory,
11010
11268
  assertFile: (path, stat2) => assertPrivateRuntimeAccess(
11011
11269
  path,
@@ -11093,7 +11351,7 @@ async function runHost(state, options) {
11093
11351
  autostartOptions(state, options).cliPath
11094
11352
  ), ownerIdentity = await requireCurrentProcessOwnerIdentity(), release2;
11095
11353
  try {
11096
- release2 = await acquireFileLock(join19(state.directory, "agent"), {
11354
+ release2 = await acquireFileLock(join20(state.directory, "agent"), {
11097
11355
  waitMs: 0,
11098
11356
  releaseMode: "synchronous",
11099
11357
  ownerIdentity,
@@ -11120,7 +11378,7 @@ async function runHost(state, options) {
11120
11378
  async function disconnectHost(state) {
11121
11379
  await state.remove(), await uninstallNativeAutostart(autostartOptions(state)), await uninstallDesktopNotificationIdentity(autostartOptions(state));
11122
11380
  let ownerIdentity = await requireCurrentProcessOwnerIdentity();
11123
- await (await acquireFileLock(join19(state.directory, "agent"), {
11381
+ await (await acquireFileLock(join20(state.directory, "agent"), {
11124
11382
  waitMs: 5e3,
11125
11383
  releaseMode: "synchronous",
11126
11384
  ownerIdentity,
@@ -11135,6 +11393,10 @@ async function runHostCompanionCli(args, options = {}) {
11135
11393
  printHostHelp();
11136
11394
  return;
11137
11395
  }
11396
+ if (command === "permissions") {
11397
+ await runHostPermissionsCli(rest);
11398
+ return;
11399
+ }
11138
11400
  let state = nativeState();
11139
11401
  if (command === "connect") {
11140
11402
  await connectHost(rest, state, options);