@lotagate/cli 0.1.23 → 0.1.25

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 (607) hide show
  1. package/README.md +70 -3
  2. package/SECURITY.md +2 -0
  3. package/dist/application/agent/agent-history.d.ts +3 -0
  4. package/dist/application/agent/agent-history.js +5 -0
  5. package/dist/application/agent/agent-input-context.d.ts +12 -0
  6. package/dist/application/agent/agent-input-context.js +5 -0
  7. package/dist/application/agent/agent-limit.d.ts +3 -0
  8. package/dist/application/agent/agent-limit.js +1 -0
  9. package/dist/application/agent/agent-run-tracker.d.ts +30 -0
  10. package/dist/application/agent/agent-run-tracker.js +1 -0
  11. package/dist/application/agent/agent-runtime-context.d.ts +22 -0
  12. package/dist/application/agent/agent-runtime-context.js +1 -0
  13. package/dist/application/agent/agent-session-store.d.ts +19 -0
  14. package/dist/application/agent/agent-session-store.js +6 -0
  15. package/dist/application/agent/capability-profile.d.ts +55 -0
  16. package/dist/application/agent/capability-profile.js +1 -0
  17. package/dist/application/agent/cli-agent-execution-service.d.ts +110 -0
  18. package/dist/application/agent/cli-agent-execution-service.js +1 -0
  19. package/dist/application/agent/cli-agent-run-request.d.ts +12 -0
  20. package/dist/application/agent/cli-agent-run-request.js +0 -0
  21. package/dist/application/agent/context-compaction-persistence.d.ts +8 -0
  22. package/dist/application/agent/context-compaction-persistence.js +1 -0
  23. package/dist/application/agent/context-compaction.d.ts +21 -0
  24. package/dist/application/agent/context-compaction.js +7 -0
  25. package/dist/application/agent/interactive-agent-guidance.d.ts +5 -0
  26. package/dist/application/agent/interactive-agent-guidance.js +2 -0
  27. package/dist/application/agent/prompt-data-safety.d.ts +14 -0
  28. package/dist/application/agent/prompt-data-safety.js +4 -0
  29. package/dist/application/agent/scoped-tool-executor.d.ts +13 -0
  30. package/dist/application/agent/scoped-tool-executor.js +1 -0
  31. package/dist/application/agent/tool-catalog.d.ts +14 -0
  32. package/dist/application/agent/tool-catalog.js +1 -0
  33. package/dist/application/agent/tool-display.d.ts +7 -0
  34. package/dist/application/agent/tool-display.js +1 -0
  35. package/dist/application/agent/tool-hook-lifecycle.d.ts +19 -0
  36. package/dist/application/agent/tool-hook-lifecycle.js +1 -0
  37. package/dist/application/auth/authentication-service.d.ts +20 -0
  38. package/dist/application/auth/authentication-service.js +1 -0
  39. package/dist/application/chat/chat-service.d.ts +12 -0
  40. package/dist/application/chat/chat-service.js +1 -0
  41. package/dist/application/chat/pending-attachment-store.d.ts +12 -0
  42. package/dist/application/chat/pending-attachment-store.js +1 -0
  43. package/dist/application/commands/application-command-executor.d.ts +23 -0
  44. package/dist/application/commands/application-command-executor.js +3 -0
  45. package/dist/application/commands/cli-args.d.ts +6 -0
  46. package/dist/application/commands/cli-args.js +1 -0
  47. package/dist/application/commands/cli-command-services.d.ts +17 -0
  48. package/dist/application/commands/cli-command-services.js +33 -0
  49. package/dist/application/commands/command-cancellation.d.ts +6 -0
  50. package/dist/application/commands/command-cancellation.js +1 -0
  51. package/dist/application/commands/command-catalog.d.ts +6 -0
  52. package/dist/application/commands/command-catalog.js +1 -0
  53. package/dist/application/commands/command-contract.d.ts +60 -0
  54. package/dist/application/commands/command-contract.js +0 -0
  55. package/dist/application/commands/command-hints.d.ts +9 -0
  56. package/dist/application/commands/command-hints.js +1 -0
  57. package/dist/application/commands/command-output.d.ts +4 -0
  58. package/dist/application/commands/command-output.js +0 -0
  59. package/dist/application/commands/command-parser.d.ts +10 -0
  60. package/dist/application/commands/command-parser.js +1 -0
  61. package/dist/application/commands/command-presentation.d.ts +7 -0
  62. package/dist/application/commands/command-presentation.js +3 -0
  63. package/dist/application/commands/command-registry.d.ts +11 -0
  64. package/dist/application/commands/command-registry.js +1 -0
  65. package/dist/application/commands/command-runtime.d.ts +2 -0
  66. package/dist/application/commands/command-runtime.js +1 -0
  67. package/dist/application/commands/goal-command-handlers.d.ts +3 -0
  68. package/dist/application/commands/goal-command-handlers.js +7 -0
  69. package/dist/application/commands/media-command-handlers.d.ts +9 -0
  70. package/dist/application/commands/media-command-handlers.js +8 -0
  71. package/dist/application/commands/media-command-output.d.ts +11 -0
  72. package/dist/application/commands/media-command-output.js +1 -0
  73. package/dist/application/commands/memory-command-handler.d.ts +29 -0
  74. package/dist/application/commands/memory-command-handler.js +12 -0
  75. package/dist/application/commands/runtime-command-handlers.d.ts +7 -0
  76. package/dist/application/commands/runtime-command-handlers.js +14 -0
  77. package/dist/application/commands/stream-output.d.ts +4 -0
  78. package/dist/application/commands/stream-output.js +1 -0
  79. package/dist/application/commands/utility-commands.d.ts +6 -0
  80. package/dist/application/commands/utility-commands.js +10 -0
  81. package/dist/application/config/execution-config.d.ts +4 -0
  82. package/dist/application/config/execution-config.js +1 -0
  83. package/dist/application/extensions/extension-list-contract.d.ts +18 -0
  84. package/dist/application/extensions/extension-list-contract.js +0 -0
  85. package/dist/application/extensions/extension-list-formatters.d.ts +38 -0
  86. package/dist/application/extensions/extension-list-formatters.js +1 -0
  87. package/dist/application/extensions/extension-list-output.d.ts +3 -0
  88. package/dist/application/extensions/extension-list-output.js +3 -0
  89. package/dist/application/extensions/plugin-contribution-registry.d.ts +31 -0
  90. package/dist/application/extensions/plugin-contribution-registry.js +1 -0
  91. package/dist/application/extensions/plugin-detail-contract.d.ts +25 -0
  92. package/dist/application/extensions/plugin-detail-contract.js +0 -0
  93. package/dist/application/extensions/plugin-detail-service.d.ts +3 -0
  94. package/dist/application/extensions/plugin-detail-service.js +1 -0
  95. package/dist/application/extensions/skill-scope-store.d.ts +23 -0
  96. package/dist/application/extensions/skill-scope-store.js +1 -0
  97. package/dist/application/formatting/compact-number.d.ts +2 -0
  98. package/dist/application/formatting/compact-number.js +1 -0
  99. package/dist/application/formatting/compact-table.d.ts +22 -0
  100. package/dist/application/formatting/compact-table.js +2 -0
  101. package/dist/application/intent/completion-gate.d.ts +6 -0
  102. package/dist/application/intent/completion-gate.js +1 -0
  103. package/dist/application/intent/evidence-ledger.d.ts +21 -0
  104. package/dist/application/intent/evidence-ledger.js +1 -0
  105. package/dist/application/intent/evidence-recording-tool-executor.d.ts +16 -0
  106. package/dist/application/intent/evidence-recording-tool-executor.js +1 -0
  107. package/dist/application/intent/intent-compiler.d.ts +11 -0
  108. package/dist/application/intent/intent-compiler.js +2 -0
  109. package/dist/application/intent/intent-execution-gate.d.ts +11 -0
  110. package/dist/application/intent/intent-execution-gate.js +1 -0
  111. package/dist/application/intent/intent-host-context.d.ts +6 -0
  112. package/dist/application/intent/intent-host-context.js +1 -0
  113. package/dist/application/intent/intent-run-controller.d.ts +56 -0
  114. package/dist/application/intent/intent-run-controller.js +3 -0
  115. package/dist/application/intent/project-policy.d.ts +16 -0
  116. package/dist/application/intent/project-policy.js +1 -0
  117. package/dist/application/media/video-operation-poller.d.ts +5 -0
  118. package/dist/application/media/video-operation-poller.js +1 -0
  119. package/dist/application/memory/memory-capture-policy.d.ts +10 -0
  120. package/dist/application/memory/memory-capture-policy.js +1 -0
  121. package/dist/application/memory/memory-consolidation-service.d.ts +12 -0
  122. package/dist/application/memory/memory-consolidation-service.js +1 -0
  123. package/dist/application/memory/memory-context-assembler.d.ts +24 -0
  124. package/dist/application/memory/memory-context-assembler.js +1 -0
  125. package/dist/application/memory/memory-extractor.d.ts +21 -0
  126. package/dist/application/memory/memory-extractor.js +2 -0
  127. package/dist/application/memory/memory-service.d.ts +34 -0
  128. package/dist/application/memory/memory-service.js +1 -0
  129. package/dist/application/model/cached-model-catalog.d.ts +13 -0
  130. package/dist/application/model/cached-model-catalog.js +1 -0
  131. package/dist/application/model/initial-model-selection.d.ts +10 -0
  132. package/dist/application/model/initial-model-selection.js +1 -0
  133. package/dist/application/model/model-catalog-service.d.ts +6 -0
  134. package/dist/application/model/model-catalog-service.js +1 -0
  135. package/dist/application/model/model-context-window.d.ts +3 -0
  136. package/dist/application/model/model-context-window.js +1 -0
  137. package/dist/application/model/model-response-retry.d.ts +9 -0
  138. package/dist/application/model/model-response-retry.js +1 -0
  139. package/dist/application/orchestration/abortable-wait.d.ts +2 -0
  140. package/dist/application/orchestration/abortable-wait.js +1 -0
  141. package/dist/application/orchestration/cli-subagent-service.d.ts +73 -0
  142. package/dist/application/orchestration/cli-subagent-service.js +13 -0
  143. package/dist/application/orchestration/cli-turn-event-projector.d.ts +15 -0
  144. package/dist/application/orchestration/cli-turn-event-projector.js +1 -0
  145. package/dist/application/orchestration/cli-turn-events.d.ts +83 -0
  146. package/dist/application/orchestration/cli-turn-events.js +1 -0
  147. package/dist/application/orchestration/cli-turn-persistence.d.ts +6 -0
  148. package/dist/application/orchestration/cli-turn-persistence.js +1 -0
  149. package/dist/application/orchestration/goal-evaluator.d.ts +18 -0
  150. package/dist/application/orchestration/goal-evaluator.js +3 -0
  151. package/dist/application/orchestration/goal-input.d.ts +3 -0
  152. package/dist/application/orchestration/goal-input.js +1 -0
  153. package/dist/application/orchestration/goal-output.d.ts +2 -0
  154. package/dist/application/orchestration/goal-output.js +2 -0
  155. package/dist/application/orchestration/goal-runner.d.ts +22 -0
  156. package/dist/application/orchestration/goal-runner.js +10 -0
  157. package/dist/application/orchestration/goal-usage.d.ts +9 -0
  158. package/dist/application/orchestration/goal-usage.js +1 -0
  159. package/dist/application/orchestration/headless-agent-turn.d.ts +35 -0
  160. package/dist/application/orchestration/headless-agent-turn.js +4 -0
  161. package/dist/application/orchestration/subagent-coordinator.d.ts +41 -0
  162. package/dist/application/orchestration/subagent-coordinator.js +1 -0
  163. package/dist/application/orchestration/subagent-handoff.d.ts +3 -0
  164. package/dist/application/orchestration/subagent-handoff.js +3 -0
  165. package/dist/application/orchestration/subagent-tool-executor.d.ts +12 -0
  166. package/dist/application/orchestration/subagent-tool-executor.js +1 -0
  167. package/dist/application/orchestration/task-graph.d.ts +13 -0
  168. package/dist/application/orchestration/task-graph.js +1 -0
  169. package/dist/application/orchestration/task-scheduler.d.ts +18 -0
  170. package/dist/application/orchestration/task-scheduler.js +1 -0
  171. package/dist/application/project/project-trust-service.d.ts +13 -0
  172. package/dist/application/project/project-trust-service.js +1 -0
  173. package/dist/application/project-intelligence/project-intelligence-service.d.ts +14 -0
  174. package/dist/application/project-intelligence/project-intelligence-service.js +1 -0
  175. package/dist/application/protocol/browser-host-tool-executor.d.ts +41 -0
  176. package/dist/application/protocol/browser-host-tool-executor.js +2 -0
  177. package/dist/application/protocol/computer-host-tool-executor.d.ts +42 -0
  178. package/dist/application/protocol/computer-host-tool-executor.js +2 -0
  179. package/dist/application/protocol/desktop-agent-command.d.ts +9 -0
  180. package/dist/application/protocol/desktop-agent-command.js +3 -0
  181. package/dist/application/protocol/desktop-agent-request-parser.d.ts +186 -0
  182. package/dist/application/protocol/desktop-agent-request-parser.js +1 -0
  183. package/dist/application/protocol/desktop-approval-broker.d.ts +16 -0
  184. package/dist/application/protocol/desktop-approval-broker.js +1 -0
  185. package/dist/application/protocol/desktop-attachment-store.d.ts +16 -0
  186. package/dist/application/protocol/desktop-attachment-store.js +1 -0
  187. package/dist/application/protocol/desktop-command-catalog.d.ts +2 -0
  188. package/dist/application/protocol/desktop-command-catalog.js +1 -0
  189. package/dist/application/protocol/desktop-command-contract.d.ts +26 -0
  190. package/dist/application/protocol/desktop-command-contract.js +1 -0
  191. package/dist/application/protocol/desktop-command-executor.d.ts +17 -0
  192. package/dist/application/protocol/desktop-command-executor.js +1 -0
  193. package/dist/application/protocol/desktop-command-output.d.ts +15 -0
  194. package/dist/application/protocol/desktop-command-output.js +1 -0
  195. package/dist/application/protocol/desktop-execution-policy.d.ts +17 -0
  196. package/dist/application/protocol/desktop-execution-policy.js +1 -0
  197. package/dist/application/protocol/desktop-extension-request-handler.d.ts +14 -0
  198. package/dist/application/protocol/desktop-extension-request-handler.js +1 -0
  199. package/dist/application/protocol/desktop-extension-service.d.ts +44 -0
  200. package/dist/application/protocol/desktop-extension-service.js +3 -0
  201. package/dist/application/protocol/desktop-host-tool-executor.d.ts +63 -0
  202. package/dist/application/protocol/desktop-host-tool-executor.js +2 -0
  203. package/dist/application/protocol/desktop-intent-event-writer.d.ts +20 -0
  204. package/dist/application/protocol/desktop-intent-event-writer.js +1 -0
  205. package/dist/application/protocol/desktop-mcp-events.d.ts +10 -0
  206. package/dist/application/protocol/desktop-mcp-events.js +1 -0
  207. package/dist/application/protocol/desktop-orchestration-events.d.ts +2 -0
  208. package/dist/application/protocol/desktop-orchestration-events.js +2 -0
  209. package/dist/application/protocol/desktop-protocol-helpers.d.ts +13 -0
  210. package/dist/application/protocol/desktop-protocol-helpers.js +1 -0
  211. package/dist/application/protocol/document-host-tool-definitions.d.ts +4 -0
  212. package/dist/application/protocol/document-host-tool-definitions.js +1 -0
  213. package/dist/application/protocol/document-host-tool-executor.d.ts +49 -0
  214. package/dist/application/protocol/document-host-tool-executor.js +2 -0
  215. package/dist/application/protocol/json-line-writer.d.ts +9 -0
  216. package/dist/application/protocol/json-line-writer.js +2 -0
  217. package/dist/application/protocol/jsonl-agent-command.d.ts +3 -0
  218. package/dist/application/protocol/jsonl-agent-command.js +3 -0
  219. package/dist/application/protocol/jsonl-protocol.d.ts +82 -0
  220. package/dist/application/protocol/jsonl-protocol.js +2 -0
  221. package/dist/application/protocol/tool-image-content.d.ts +4 -0
  222. package/dist/application/protocol/tool-image-content.js +1 -0
  223. package/dist/application/security/delegated-worker-policy.d.ts +3 -0
  224. package/dist/application/security/delegated-worker-policy.js +1 -0
  225. package/dist/application/security/desktop-tool-scope-policy.d.ts +4 -0
  226. package/dist/application/security/desktop-tool-scope-policy.js +1 -0
  227. package/dist/application/security/tool-action-risk-analyzer.d.ts +13 -0
  228. package/dist/application/security/tool-action-risk-analyzer.js +1 -0
  229. package/dist/application/security/tool-approval-service.d.ts +37 -0
  230. package/dist/application/security/tool-approval-service.js +1 -0
  231. package/dist/application/security/tool-risk-classifier.d.ts +18 -0
  232. package/dist/application/security/tool-risk-classifier.js +1 -0
  233. package/dist/application/security/workspace-permission-policy.d.ts +10 -0
  234. package/dist/application/security/workspace-permission-policy.js +1 -0
  235. package/dist/application/session/project-session-access.d.ts +8 -0
  236. package/dist/application/session/project-session-access.js +1 -0
  237. package/dist/application/session/session-compaction-service.d.ts +10 -0
  238. package/dist/application/session/session-compaction-service.js +1 -0
  239. package/dist/application/session/session-turn-lifecycle.d.ts +5 -0
  240. package/dist/application/session/session-turn-lifecycle.js +1 -0
  241. package/dist/application/workspace/session-execution-workspace.d.ts +59 -0
  242. package/dist/application/workspace/session-execution-workspace.js +3 -0
  243. package/dist/application/workspace/workspace-file-index.d.ts +15 -0
  244. package/dist/application/workspace/workspace-file-index.js +1 -0
  245. package/dist/application/workspace/workspace-file-reference-resolver.d.ts +20 -0
  246. package/dist/application/workspace/workspace-file-reference-resolver.js +17 -0
  247. package/dist/application/workspace/workspace-instruction-loader.d.ts +8 -0
  248. package/dist/application/workspace/workspace-instruction-loader.js +1 -0
  249. package/dist/bootstrap/composition-root.d.ts +6 -0
  250. package/dist/bootstrap/composition-root.js +1 -0
  251. package/dist/bootstrap/global-cli-options.d.ts +6 -0
  252. package/dist/bootstrap/global-cli-options.js +1 -0
  253. package/dist/bootstrap/native-devtools-stub.d.ts +10 -0
  254. package/dist/bootstrap/native-devtools-stub.js +1 -0
  255. package/dist/bootstrap/native-entry.d.ts +1 -0
  256. package/dist/bootstrap/native-entry.js +2 -0
  257. package/dist/bootstrap/native-tiktoken.d.ts +4 -0
  258. package/dist/bootstrap/native-tiktoken.js +1 -0
  259. package/dist/bootstrap/runtime-factory.d.ts +41 -0
  260. package/dist/bootstrap/runtime-factory.js +1 -0
  261. package/dist/bootstrap/shutdown-manager.d.ts +11 -0
  262. package/dist/bootstrap/shutdown-manager.js +1 -0
  263. package/dist/bootstrap/startup-sequence.d.ts +5 -0
  264. package/dist/bootstrap/startup-sequence.js +1 -0
  265. package/dist/domain/auth/auth-profile.d.ts +14 -0
  266. package/dist/domain/auth/auth-profile.js +1 -0
  267. package/dist/domain/config/config-schema.d.ts +24 -0
  268. package/dist/domain/config/config-schema.js +1 -0
  269. package/dist/domain/errors/cli-command-hint.d.ts +5 -0
  270. package/dist/domain/errors/cli-command-hint.js +0 -0
  271. package/dist/domain/errors/cli-error.d.ts +35 -0
  272. package/dist/domain/errors/cli-error.js +1 -0
  273. package/dist/domain/errors/error-codes.d.ts +51 -0
  274. package/dist/domain/errors/error-codes.js +1 -0
  275. package/dist/domain/extensions/extension-scope.d.ts +3 -0
  276. package/dist/domain/extensions/extension-scope.js +1 -0
  277. package/dist/domain/extensions/extension-state.d.ts +5 -0
  278. package/dist/domain/extensions/extension-state.js +1 -0
  279. package/dist/domain/extensions/hook-manifest.d.ts +13 -0
  280. package/dist/domain/extensions/hook-manifest.js +1 -0
  281. package/dist/domain/extensions/host-tool-plugin-ids.d.ts +9 -0
  282. package/dist/domain/extensions/host-tool-plugin-ids.js +1 -0
  283. package/dist/domain/extensions/mcp-config.d.ts +35 -0
  284. package/dist/domain/extensions/mcp-config.js +1 -0
  285. package/dist/domain/extensions/plugin-agent-manifest.d.ts +8 -0
  286. package/dist/domain/extensions/plugin-agent-manifest.js +1 -0
  287. package/dist/domain/extensions/plugin-manifest.d.ts +23 -0
  288. package/dist/domain/extensions/plugin-manifest.js +1 -0
  289. package/dist/domain/extensions/skill-manifest.d.ts +10 -0
  290. package/dist/domain/extensions/skill-manifest.js +3 -0
  291. package/dist/domain/extensions/yaml-subset.d.ts +9 -0
  292. package/dist/domain/extensions/yaml-subset.js +2 -0
  293. package/dist/domain/filesystem/file-change-diff.d.ts +21 -0
  294. package/dist/domain/filesystem/file-change-diff.js +3 -0
  295. package/dist/domain/intent/intent-contract.d.ts +41 -0
  296. package/dist/domain/intent/intent-contract.js +1 -0
  297. package/dist/domain/media/gateway-media-contract.d.ts +23 -0
  298. package/dist/domain/media/gateway-media-contract.js +1 -0
  299. package/dist/domain/media/media-contract.d.ts +28 -0
  300. package/dist/domain/media/media-contract.js +0 -0
  301. package/dist/domain/media/media-execution-policy.d.ts +9 -0
  302. package/dist/domain/media/media-execution-policy.js +1 -0
  303. package/dist/domain/memory/memory-kinds.d.ts +15 -0
  304. package/dist/domain/memory/memory-kinds.js +1 -0
  305. package/dist/domain/memory/memory-retrieval-policy.d.ts +3 -0
  306. package/dist/domain/memory/memory-retrieval-policy.js +1 -0
  307. package/dist/domain/memory/memory-search.d.ts +33 -0
  308. package/dist/domain/memory/memory-search.js +2 -0
  309. package/dist/domain/memory/memory.d.ts +48 -0
  310. package/dist/domain/memory/memory.js +1 -0
  311. package/dist/domain/orchestration/goal.d.ts +58 -0
  312. package/dist/domain/orchestration/goal.js +1 -0
  313. package/dist/domain/orchestration/subagent-identity.d.ts +2 -0
  314. package/dist/domain/orchestration/subagent-identity.js +1 -0
  315. package/dist/domain/orchestration/subagent.d.ts +33 -0
  316. package/dist/domain/orchestration/subagent.js +0 -0
  317. package/dist/domain/orchestration/work-plan.d.ts +77 -0
  318. package/dist/domain/orchestration/work-plan.js +1 -0
  319. package/dist/domain/project/project-identity.d.ts +6 -0
  320. package/dist/domain/project/project-identity.js +1 -0
  321. package/dist/domain/runtime/assistant-delta-normalizer.d.ts +11 -0
  322. package/dist/domain/runtime/assistant-delta-normalizer.js +1 -0
  323. package/dist/domain/runtime/resource-limits.d.ts +75 -0
  324. package/dist/domain/runtime/resource-limits.js +1 -0
  325. package/dist/domain/session/attachment.d.ts +13 -0
  326. package/dist/domain/session/attachment.js +0 -0
  327. package/dist/domain/session/session-schema.d.ts +6 -0
  328. package/dist/domain/session/session-schema.js +1 -0
  329. package/dist/domain/session/session.d.ts +27 -0
  330. package/dist/domain/session/session.js +0 -0
  331. package/dist/domain/settings/settings-document.d.ts +8 -0
  332. package/dist/domain/settings/settings-document.js +1 -0
  333. package/dist/domain/validation/record-schema.d.ts +4 -0
  334. package/dist/domain/validation/record-schema.js +1 -0
  335. package/dist/domain/workspace/workspace-settings.d.ts +12 -0
  336. package/dist/domain/workspace/workspace-settings.js +1 -0
  337. package/dist/infrastructure/agent-sdk/agent-instance-factory.d.ts +22 -0
  338. package/dist/infrastructure/agent-sdk/agent-instance-factory.js +1 -0
  339. package/dist/infrastructure/agent-sdk/model-tool-name-mapper.d.ts +13 -0
  340. package/dist/infrastructure/agent-sdk/model-tool-name-mapper.js +1 -0
  341. package/dist/infrastructure/agent-sdk/tool-calling-completion-client.d.ts +4 -0
  342. package/dist/infrastructure/agent-sdk/tool-calling-completion-client.js +1 -0
  343. package/dist/infrastructure/agent-sdk/tool-calling-model-client.d.ts +11 -0
  344. package/dist/infrastructure/agent-sdk/tool-calling-model-client.js +1 -0
  345. package/dist/infrastructure/cache/cache-policy.d.ts +7 -0
  346. package/dist/infrastructure/cache/cache-policy.js +1 -0
  347. package/dist/infrastructure/cache/file-cache-store.d.ts +17 -0
  348. package/dist/infrastructure/cache/file-cache-store.js +2 -0
  349. package/dist/infrastructure/clipboard/clipboard-adapter-factory.d.ts +11 -0
  350. package/dist/infrastructure/clipboard/clipboard-adapter-factory.js +1 -0
  351. package/dist/infrastructure/clipboard/clipboard-policy.d.ts +8 -0
  352. package/dist/infrastructure/clipboard/clipboard-policy.js +1 -0
  353. package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.d.ts +10 -0
  354. package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.js +1 -0
  355. package/dist/infrastructure/clipboard/image-normalizer.d.ts +12 -0
  356. package/dist/infrastructure/clipboard/image-normalizer.js +1 -0
  357. package/dist/infrastructure/clipboard/windows-clipboard-adapter.d.ts +7 -0
  358. package/dist/infrastructure/clipboard/windows-clipboard-adapter.js +1 -0
  359. package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.d.ts +7 -0
  360. package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.js +1 -0
  361. package/dist/infrastructure/config/config-loader.d.ts +19 -0
  362. package/dist/infrastructure/config/config-loader.js +2 -0
  363. package/dist/infrastructure/config/environment-values.d.ts +2 -0
  364. package/dist/infrastructure/config/environment-values.js +1 -0
  365. package/dist/infrastructure/credentials/composite-credential-store.d.ts +11 -0
  366. package/dist/infrastructure/credentials/composite-credential-store.js +1 -0
  367. package/dist/infrastructure/credentials/encrypted-file-credential-store.d.ts +17 -0
  368. package/dist/infrastructure/credentials/encrypted-file-credential-store.js +3 -0
  369. package/dist/infrastructure/credentials/environment-credential-store.d.ts +11 -0
  370. package/dist/infrastructure/credentials/environment-credential-store.js +1 -0
  371. package/dist/infrastructure/credentials/secret-input.d.ts +7 -0
  372. package/dist/infrastructure/credentials/secret-input.js +3 -0
  373. package/dist/infrastructure/extensions/composite-mcp-config-store.d.ts +9 -0
  374. package/dist/infrastructure/extensions/composite-mcp-config-store.js +1 -0
  375. package/dist/infrastructure/extensions/extension-directory-reader.d.ts +2 -0
  376. package/dist/infrastructure/extensions/extension-directory-reader.js +1 -0
  377. package/dist/infrastructure/extensions/extension-integrity.d.ts +7 -0
  378. package/dist/infrastructure/extensions/extension-integrity.js +1 -0
  379. package/dist/infrastructure/extensions/extension-source-resolver.d.ts +6 -0
  380. package/dist/infrastructure/extensions/extension-source-resolver.js +1 -0
  381. package/dist/infrastructure/extensions/file-mcp-config-store.d.ts +15 -0
  382. package/dist/infrastructure/extensions/file-mcp-config-store.js +2 -0
  383. package/dist/infrastructure/extensions/hook-runtime.d.ts +18 -0
  384. package/dist/infrastructure/extensions/hook-runtime.js +1 -0
  385. package/dist/infrastructure/extensions/mcp-runtime.d.ts +51 -0
  386. package/dist/infrastructure/extensions/mcp-runtime.js +1 -0
  387. package/dist/infrastructure/extensions/plugin-agent-discovery.d.ts +4 -0
  388. package/dist/infrastructure/extensions/plugin-agent-discovery.js +1 -0
  389. package/dist/infrastructure/extensions/plugin-discovery.d.ts +5 -0
  390. package/dist/infrastructure/extensions/plugin-discovery.js +1 -0
  391. package/dist/infrastructure/extensions/plugin-manager.d.ts +23 -0
  392. package/dist/infrastructure/extensions/plugin-manager.js +2 -0
  393. package/dist/infrastructure/extensions/skill-discovery.d.ts +4 -0
  394. package/dist/infrastructure/extensions/skill-discovery.js +1 -0
  395. package/dist/infrastructure/extensions/skill-installer.d.ts +9 -0
  396. package/dist/infrastructure/extensions/skill-installer.js +1 -0
  397. package/dist/infrastructure/extensions/skill-manager.d.ts +22 -0
  398. package/dist/infrastructure/extensions/skill-manager.js +2 -0
  399. package/dist/infrastructure/extensions/skill-roots.d.ts +19 -0
  400. package/dist/infrastructure/extensions/skill-roots.js +1 -0
  401. package/dist/infrastructure/extensions/skill-tool-executor.d.ts +18 -0
  402. package/dist/infrastructure/extensions/skill-tool-executor.js +2 -0
  403. package/dist/infrastructure/filesystem/atomic-file-store.d.ts +17 -0
  404. package/dist/infrastructure/filesystem/atomic-file-store.js +1 -0
  405. package/dist/infrastructure/filesystem/bounded-file-reader.d.ts +6 -0
  406. package/dist/infrastructure/filesystem/bounded-file-reader.js +1 -0
  407. package/dist/infrastructure/filesystem/bounded-json-reader.d.ts +1 -0
  408. package/dist/infrastructure/filesystem/bounded-json-reader.js +1 -0
  409. package/dist/infrastructure/filesystem/fs-errors.d.ts +2 -0
  410. package/dist/infrastructure/filesystem/fs-errors.js +1 -0
  411. package/dist/infrastructure/filesystem/gateway-media-input-reader.d.ts +12 -0
  412. package/dist/infrastructure/filesystem/gateway-media-input-reader.js +1 -0
  413. package/dist/infrastructure/filesystem/local-filesystem-tool-executor.d.ts +22 -0
  414. package/dist/infrastructure/filesystem/local-filesystem-tool-executor.js +3 -0
  415. package/dist/infrastructure/filesystem/path-resolver.d.ts +20 -0
  416. package/dist/infrastructure/filesystem/path-resolver.js +1 -0
  417. package/dist/infrastructure/filesystem/workspace-media-artifact-store.d.ts +13 -0
  418. package/dist/infrastructure/filesystem/workspace-media-artifact-store.js +1 -0
  419. package/dist/infrastructure/logging/daily-rotating-file-writer.d.ts +26 -0
  420. package/dist/infrastructure/logging/daily-rotating-file-writer.js +2 -0
  421. package/dist/infrastructure/logging/log-redactor.d.ts +2 -0
  422. package/dist/infrastructure/logging/log-redactor.js +1 -0
  423. package/dist/infrastructure/logging/logging-policy.d.ts +6 -0
  424. package/dist/infrastructure/logging/logging-policy.js +1 -0
  425. package/dist/infrastructure/logging/structured-logger.d.ts +24 -0
  426. package/dist/infrastructure/logging/structured-logger.js +4 -0
  427. package/dist/infrastructure/memory/file-memory-store.d.ts +37 -0
  428. package/dist/infrastructure/memory/file-memory-store.js +11 -0
  429. package/dist/infrastructure/network/safe-media-downloader.d.ts +23 -0
  430. package/dist/infrastructure/network/safe-media-downloader.js +1 -0
  431. package/dist/infrastructure/platform/host-platform.d.ts +14 -0
  432. package/dist/infrastructure/platform/host-platform.js +1 -0
  433. package/dist/infrastructure/platform/host-process.d.ts +29 -0
  434. package/dist/infrastructure/platform/host-process.js +1 -0
  435. package/dist/infrastructure/platform/platform-paths.d.ts +25 -0
  436. package/dist/infrastructure/platform/platform-paths.js +1 -0
  437. package/dist/infrastructure/platform/process-termination.d.ts +4 -0
  438. package/dist/infrastructure/platform/process-termination.js +1 -0
  439. package/dist/infrastructure/platform/read-only-executable.d.ts +3 -0
  440. package/dist/infrastructure/platform/read-only-executable.js +1 -0
  441. package/dist/infrastructure/project/file-project-trust-store.d.ts +12 -0
  442. package/dist/infrastructure/project/file-project-trust-store.js +2 -0
  443. package/dist/infrastructure/sdk/chat-completion-adapter.d.ts +8 -0
  444. package/dist/infrastructure/sdk/chat-completion-adapter.js +1 -0
  445. package/dist/infrastructure/sdk/lotagate-client-factory.d.ts +3 -0
  446. package/dist/infrastructure/sdk/lotagate-client-factory.js +1 -0
  447. package/dist/infrastructure/sdk/model-catalog-adapter.d.ts +19 -0
  448. package/dist/infrastructure/sdk/model-catalog-adapter.js +1 -0
  449. package/dist/infrastructure/sdk/sdk-media-gateway-client.d.ts +20 -0
  450. package/dist/infrastructure/sdk/sdk-media-gateway-client.js +1 -0
  451. package/dist/infrastructure/sessions/file-goal-store.d.ts +21 -0
  452. package/dist/infrastructure/sessions/file-goal-store.js +1 -0
  453. package/dist/infrastructure/sessions/file-session-store.d.ts +47 -0
  454. package/dist/infrastructure/sessions/file-session-store.js +4 -0
  455. package/dist/infrastructure/sessions/project-session-paths.d.ts +17 -0
  456. package/dist/infrastructure/sessions/project-session-paths.js +1 -0
  457. package/dist/infrastructure/sessions/session-index.d.ts +16 -0
  458. package/dist/infrastructure/sessions/session-index.js +3 -0
  459. package/dist/infrastructure/sessions/session-journal.d.ts +22 -0
  460. package/dist/infrastructure/sessions/session-journal.js +6 -0
  461. package/dist/infrastructure/sessions/subagent-journal-store.d.ts +28 -0
  462. package/dist/infrastructure/sessions/subagent-journal-store.js +2 -0
  463. package/dist/infrastructure/shell/shell-tool-executor.d.ts +17 -0
  464. package/dist/infrastructure/shell/shell-tool-executor.js +2 -0
  465. package/dist/infrastructure/tokens/tiktoken-token-estimator.d.ts +18 -0
  466. package/dist/infrastructure/tokens/tiktoken-token-estimator.js +1 -0
  467. package/dist/infrastructure/workspace/workspace-settings-store.d.ts +9 -0
  468. package/dist/infrastructure/workspace/workspace-settings-store.js +4 -0
  469. package/dist/main.d.ts +7 -0
  470. package/dist/main.js +3 -0
  471. package/dist/ports/cache-store.d.ts +10 -0
  472. package/dist/ports/cache-store.js +0 -0
  473. package/dist/ports/chat-model.d.ts +30 -0
  474. package/dist/ports/chat-model.js +0 -0
  475. package/dist/ports/clipboard-adapter.d.ts +7 -0
  476. package/dist/ports/clipboard-adapter.js +0 -0
  477. package/dist/ports/clipboard-text-adapter.d.ts +3 -0
  478. package/dist/ports/clipboard-text-adapter.js +0 -0
  479. package/dist/ports/credential-store.d.ts +7 -0
  480. package/dist/ports/credential-store.js +0 -0
  481. package/dist/ports/goal-store.d.ts +12 -0
  482. package/dist/ports/goal-store.js +0 -0
  483. package/dist/ports/logger.d.ts +8 -0
  484. package/dist/ports/logger.js +0 -0
  485. package/dist/ports/media-gateway-client.d.ts +54 -0
  486. package/dist/ports/media-gateway-client.js +0 -0
  487. package/dist/ports/memory-store.d.ts +26 -0
  488. package/dist/ports/memory-store.js +0 -0
  489. package/dist/ports/model-completion-client.d.ts +8 -0
  490. package/dist/ports/model-completion-client.js +0 -0
  491. package/dist/ports/model-diagnostics.d.ts +17 -0
  492. package/dist/ports/model-diagnostics.js +0 -0
  493. package/dist/ports/project-trust-store.d.ts +12 -0
  494. package/dist/ports/project-trust-store.js +0 -0
  495. package/dist/ports/session-store.d.ts +58 -0
  496. package/dist/ports/session-store.js +0 -0
  497. package/dist/ports/subagent-lifecycle.d.ts +31 -0
  498. package/dist/ports/subagent-lifecycle.js +0 -0
  499. package/dist/ports/tool-activity.d.ts +13 -0
  500. package/dist/ports/tool-activity.js +0 -0
  501. package/dist/presentation/themes/theme.d.ts +19 -0
  502. package/dist/presentation/themes/theme.js +1 -0
  503. package/dist/presentation/tui/agent-initialization-renderer.d.ts +4 -0
  504. package/dist/presentation/tui/agent-initialization-renderer.js +1 -0
  505. package/dist/presentation/tui/context-display.d.ts +21 -0
  506. package/dist/presentation/tui/context-display.js +2 -0
  507. package/dist/presentation/tui/formatters.d.ts +6 -0
  508. package/dist/presentation/tui/formatters.js +1 -0
  509. package/dist/presentation/tui/ink/choice-window.d.ts +5 -0
  510. package/dist/presentation/tui/ink/choice-window.js +1 -0
  511. package/dist/presentation/tui/ink/components/activity-animation.d.ts +3 -0
  512. package/dist/presentation/tui/ink/components/activity-animation.js +1 -0
  513. package/dist/presentation/tui/ink/components/activity-entry.d.ts +6 -0
  514. package/dist/presentation/tui/ink/components/activity-entry.js +1 -0
  515. package/dist/presentation/tui/ink/components/activity-status.d.ts +10 -0
  516. package/dist/presentation/tui/ink/components/activity-status.js +1 -0
  517. package/dist/presentation/tui/ink/components/choice-modal.d.ts +11 -0
  518. package/dist/presentation/tui/ink/components/choice-modal.js +1 -0
  519. package/dist/presentation/tui/ink/components/composer.d.ts +40 -0
  520. package/dist/presentation/tui/ink/components/composer.js +8 -0
  521. package/dist/presentation/tui/ink/components/file-diff.d.ts +6 -0
  522. package/dist/presentation/tui/ink/components/file-diff.js +1 -0
  523. package/dist/presentation/tui/ink/components/modal.d.ts +8 -0
  524. package/dist/presentation/tui/ink/components/modal.js +2 -0
  525. package/dist/presentation/tui/ink/components/shimmer-text.d.ts +8 -0
  526. package/dist/presentation/tui/ink/components/shimmer-text.js +1 -0
  527. package/dist/presentation/tui/ink/components/subagent-activity.d.ts +11 -0
  528. package/dist/presentation/tui/ink/components/subagent-activity.js +1 -0
  529. package/dist/presentation/tui/ink/components/transcript.d.ts +39 -0
  530. package/dist/presentation/tui/ink/components/transcript.js +5 -0
  531. package/dist/presentation/tui/ink/components/welcome-panel.d.ts +6 -0
  532. package/dist/presentation/tui/ink/components/welcome-panel.js +1 -0
  533. package/dist/presentation/tui/ink/lotagate-tui.d.ts +6 -0
  534. package/dist/presentation/tui/ink/lotagate-tui.js +2 -0
  535. package/dist/presentation/tui/ink/markdown-inline-renderer.d.ts +4 -0
  536. package/dist/presentation/tui/ink/markdown-inline-renderer.js +1 -0
  537. package/dist/presentation/tui/ink/markdown-inline.d.ts +13 -0
  538. package/dist/presentation/tui/ink/markdown-inline.js +1 -0
  539. package/dist/presentation/tui/ink/markdown-message.d.ts +6 -0
  540. package/dist/presentation/tui/ink/markdown-message.js +2 -0
  541. package/dist/presentation/tui/ink/markdown-table.d.ts +16 -0
  542. package/dist/presentation/tui/ink/markdown-table.js +1 -0
  543. package/dist/presentation/tui/ink/tui-bridge.d.ts +193 -0
  544. package/dist/presentation/tui/ink/tui-bridge.js +1 -0
  545. package/dist/presentation/tui/terminal-capabilities.d.ts +15 -0
  546. package/dist/presentation/tui/terminal-capabilities.js +1 -0
  547. package/dist/presentation/tui/terminal-mouse.d.ts +5 -0
  548. package/dist/presentation/tui/terminal-mouse.js +1 -0
  549. package/dist/presentation/tui/terminal-screen.d.ts +10 -0
  550. package/dist/presentation/tui/terminal-screen.js +1 -0
  551. package/dist/presentation/tui/tui-agent-event-runner.d.ts +29 -0
  552. package/dist/presentation/tui/tui-agent-event-runner.js +1 -0
  553. package/dist/presentation/tui/tui-application-contract.d.ts +10 -0
  554. package/dist/presentation/tui/tui-application-contract.js +1 -0
  555. package/dist/presentation/tui/tui-application.d.ts +64 -0
  556. package/dist/presentation/tui/tui-application.js +3 -0
  557. package/dist/presentation/tui/tui-clipboard-paste-handlers.d.ts +11 -0
  558. package/dist/presentation/tui/tui-clipboard-paste-handlers.js +1 -0
  559. package/dist/presentation/tui/tui-command-context.d.ts +3 -0
  560. package/dist/presentation/tui/tui-command-context.js +0 -0
  561. package/dist/presentation/tui/tui-command-executor.d.ts +38 -0
  562. package/dist/presentation/tui/tui-command-executor.js +4 -0
  563. package/dist/presentation/tui/tui-command-host-factory.d.ts +40 -0
  564. package/dist/presentation/tui/tui-command-host-factory.js +1 -0
  565. package/dist/presentation/tui/tui-context-compaction.d.ts +5 -0
  566. package/dist/presentation/tui/tui-context-compaction.js +1 -0
  567. package/dist/presentation/tui/tui-context-service.d.ts +34 -0
  568. package/dist/presentation/tui/tui-context-service.js +2 -0
  569. package/dist/presentation/tui/tui-extension-loader.d.ts +21 -0
  570. package/dist/presentation/tui/tui-extension-loader.js +1 -0
  571. package/dist/presentation/tui/tui-file-suggestions.d.ts +3 -0
  572. package/dist/presentation/tui/tui-file-suggestions.js +1 -0
  573. package/dist/presentation/tui/tui-goal-controller.d.ts +14 -0
  574. package/dist/presentation/tui/tui-goal-controller.js +1 -0
  575. package/dist/presentation/tui/tui-initial-model.d.ts +3 -0
  576. package/dist/presentation/tui/tui-initial-model.js +1 -0
  577. package/dist/presentation/tui/tui-lifecycle-actions.d.ts +13 -0
  578. package/dist/presentation/tui/tui-lifecycle-actions.js +1 -0
  579. package/dist/presentation/tui/tui-manual-compaction.d.ts +18 -0
  580. package/dist/presentation/tui/tui-manual-compaction.js +1 -0
  581. package/dist/presentation/tui/tui-media-model-selection.d.ts +12 -0
  582. package/dist/presentation/tui/tui-media-model-selection.js +1 -0
  583. package/dist/presentation/tui/tui-prompt-dispatcher.d.ts +16 -0
  584. package/dist/presentation/tui/tui-prompt-dispatcher.js +1 -0
  585. package/dist/presentation/tui/tui-skill-controller.d.ts +11 -0
  586. package/dist/presentation/tui/tui-skill-controller.js +3 -0
  587. package/dist/presentation/tui/tui-tool-approval.d.ts +22 -0
  588. package/dist/presentation/tui/tui-tool-approval.js +1 -0
  589. package/dist/version.d.ts +1 -0
  590. package/dist/version.js +1 -0
  591. package/package.json +12 -10
  592. package/skills/architecture-review/SKILL.md +41 -14
  593. package/skills/code-review/SKILL.md +41 -12
  594. package/skills/debugging/SKILL.md +49 -12
  595. package/skills/documentation/SKILL.md +43 -9
  596. package/skills/feature-implementation/SKILL.md +58 -19
  597. package/skills/api-contract-review/SKILL.md +0 -17
  598. package/skills/database-review/SKILL.md +0 -17
  599. package/skills/dependency-review/SKILL.md +0 -16
  600. package/skills/frontend-review/SKILL.md +0 -18
  601. package/skills/incident-response/SKILL.md +0 -18
  602. package/skills/performance-review/SKILL.md +0 -17
  603. package/skills/refactor/SKILL.md +0 -23
  604. package/skills/release-readiness/SKILL.md +0 -16
  605. package/skills/security-review/SKILL.md +0 -16
  606. package/skills/test-plan/SKILL.md +0 -22
  607. package/skills/verify/SKILL.md +0 -13
@@ -0,0 +1 @@
1
+ import{parseDesktopExecutionPolicy as y}from"./desktop-execution-policy.js";import{RESOURCE_LIMITS as s}from"../../domain/runtime/resource-limits.js";function L(e){if(!i(e)||e.version!==1||!u(e.id)||!i(e.params)||typeof e.method!="string")throw o("Invalid Desktop protocol request.");const t=e.id,n=e.method,r=e.params;if(n==="initialize"||n==="session.list"||n==="model.list"||n==="auth.status"||n==="command.list"||n==="shutdown")return{version:1,id:t,method:n,params:r};if(n==="session.create")return{version:1,id:t,method:n,params:{...d(r,"model"),...d(r,"name")}};if(n==="session.resume")return{version:1,id:t,method:n,params:{sessionId:a(r,"sessionId")}};if(n==="extension.listPublicPlugins")return{version:1,id:t,method:n,params:{root:l(r,"root")}};if(n==="extension.resolvePublicPluginSource")return{version:1,id:t,method:n,params:{root:l(r,"root"),name:m(r,"name","public plugin")}};if(n==="extension.readPublicPluginContribution")return{version:1,id:t,method:n,params:{root:l(r,"root"),pluginName:m(r,"pluginName","plugin"),kind:v(r),sourceName:m(r,"sourceName","extension")}};if(n==="extension.readDetail")return{version:1,id:t,method:n,params:B(r)};if(n==="extension.readPluginIcon")return{version:1,id:t,method:n,params:{name:m(r,"name","plugin"),scope:x(r,"scope")}};if(n==="title.generate")return{version:1,id:t,method:n,params:{prompt:I(r),...d(r,"model")}};if(n==="attachment.begin")return{version:1,id:t,method:n,params:{attachmentId:a(r,"attachmentId"),name:q(r),mimeType:A(r),sizeBytes:z(r)}};if(n==="attachment.chunk")return{version:1,id:t,method:n,params:{attachmentId:a(r,"attachmentId"),index:P(r),dataBase64:j(r)}};if(n==="attachment.complete")return{version:1,id:t,method:n,params:{attachmentId:a(r,"attachmentId")}};if(n==="turn.start")return{version:1,id:t,method:n,params:{sessionId:a(r,"sessionId"),prompt:I(r),...d(r,"model"),...d(r,"reasoningEffort"),...d(r,"runId"),...d(r,"taskId"),...S(r),...$(r),execution:N(r)}};if(n==="turn.cancel")return{version:1,id:t,method:n,params:{turnId:a(r,"turnId")}};if(n==="approval.respond")return{version:1,id:t,method:n,params:{approvalId:a(r,"approvalId"),approved:g(r,"approved")}};if(n==="trust.respond")return{version:1,id:t,method:n,params:{trustRequestId:a(r,"trustRequestId"),trusted:g(r,"trusted")}};if(n==="command.execute")return{version:1,id:t,method:n,params:w(r)};if(n==="command.cancel")return{version:1,id:t,method:n,params:{commandId:a(r,"commandId")}};throw o("Unsupported Desktop protocol method.")}function R(e){return!i(e)||e.version!==1||e.type!=="host.response"||e.tool!=="browser"||!u(e.requestId)||typeof e.ok!="boolean"?!1:e.error===void 0||i(e.error)}function C(e){return!i(e)||e.version!==1||e.type!=="host.response"||!["filesystem","shell","git","artifact"].includes(String(e.tool))||!u(e.requestId)||typeof e.ok!="boolean"?!1:e.error===void 0||i(e.error)}function K(e){return!i(e)||e.version!==1||e.type!=="host.response"||e.tool!=="computer"||!u(e.requestId)||typeof e.ok!="boolean"?!1:e.error===void 0||i(e.error)}function M(e){return!i(e)||e.version!==1||e.type!=="host.response"||e.tool!=="document"||!u(e.requestId)||typeof e.ok!="boolean"?!1:e.error===void 0||i(e.error)}function w(e){const t=a(e,"actionId"),n=e.positionals;if(!Array.isArray(n)||n.some(c=>typeof c!="string"||Buffer.byteLength(c,"utf8")>s.jsonlPromptBytes))throw o("Invalid command positionals.");const r=e.options;if(!i(r)||Object.entries(r).some(([c,p])=>!u(c)||typeof p!="string"&&typeof p!="boolean"||typeof p=="string"&&Buffer.byteLength(p,"utf8")>s.jsonlPromptBytes))throw o("Invalid command options.");const f=e.secrets;if(f===void 0)return{actionId:t,positionals:n,options:r};if(t!=="auth.login.direct"||!i(f)||Object.keys(f).some(c=>c!=="apiKey")||typeof f.apiKey!="string"||f.apiKey.length===0||Buffer.byteLength(f.apiKey,"utf8")>s.jsonlPromptBytes)throw o("Invalid command secrets.");return{actionId:t,positionals:n,options:r,secrets:{apiKey:f.apiKey}}}function a(e,t){const n=e[t];if(!u(n))throw o(`Invalid ${t}.`);return n}function l(e,t){const n=e[t];if(typeof n!="string"||n.trim().length===0||n.includes("\0")||Buffer.byteLength(n,"utf8")>s.jsonlPathBytes)throw o(`Invalid ${t}.`);return n}function m(e,t,n){const r=e[t];if(typeof r!="string"||!/^[a-z0-9][a-z0-9-]{0,63}$/u.test(r))throw o(`Invalid ${n} name.`);return r}function b(e,t){const n=e[t];if(typeof n!="string"||n.length===0||n.length>256||n.includes("\0")||!/^[a-z0-9][a-z0-9:_-]*$/u.test(n))throw o("Invalid extension name.");return n}function v(e){const t=e.kind;if(t!=="skill"&&t!=="mcp"&&t!=="hook")throw o("Invalid extension kind.");return t}function x(e,t){const n=e[t];if(n!=="user"&&n!=="project")throw o(`Invalid ${t}.`);return n}function B(e){const t=e.kind;if(t!=="hook"&&t!=="skill"&&t!=="plugin"&&t!=="mcp")throw o("Invalid extension kind.");const n=e.scope;if(n!==void 0&&n!=="user"&&n!=="project"&&n!=="plugin"&&n!=="builtin")throw o("Invalid extension scope.");const r=b(e,"name");return{kind:t,name:r,...n===void 0?{}:{scope:n},...h(e,"pluginName"),...k(e,"pluginScope"),...h(e,"sourceName")}}function h(e,t){const n=e[t];if(n===void 0)return{};if(typeof n!="string"||!/^[a-z0-9][a-z0-9-]{0,63}$/u.test(n))throw o(`Invalid ${t}.`);return{[t]:n}}function k(e,t){const n=e[t];if(n===void 0)return{};if(n!=="user"&&n!=="project")throw o(`Invalid ${t}.`);return{[t]:n}}function I(e){const t=e.prompt;if(typeof t!="string"||t.trim().length===0||Buffer.byteLength(t,"utf8")>s.jsonlPromptBytes)throw o("Invalid prompt.");return t}function g(e,t){if(typeof e[t]!="boolean")throw o(`Invalid ${t}.`);return e[t]}function d(e,t){const n=e[t];if(n===void 0)return{};if(typeof n!="string"||n.length===0||Buffer.byteLength(n,"utf8")>s.jsonlIdBytes)throw o(`Invalid ${t}.`);return{[t]:n}}function q(e){const t=e.name;if(typeof t!="string"||t.length===0||t.length>200||t.includes("\0"))throw o("Invalid attachment name.");return t}function A(e){const t=e.mimeType;if(typeof t!="string"||!/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*$/u.test(t)||Buffer.byteLength(t,"utf8")>s.jsonlIdBytes)throw o("Invalid attachment MIME type.");return t}function z(e){const t=e.sizeBytes;if(typeof t!="number"||!Number.isSafeInteger(t)||t<=0||t>s.maxAttachmentBytes)throw o("Invalid attachment size.");return t}function P(e){const t=e.index;if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw o("Invalid attachment chunk index.");return t}function j(e){const t=e.dataBase64;if(typeof t!="string"||t.length===0||Buffer.byteLength(t,"utf8")>Math.ceil(s.desktopAttachmentChunkBytes/3)*4+4)throw o("Invalid attachment chunk.");return t}function S(e){const t=e.attachmentIds;if(t===void 0)return{};if(!Array.isArray(t)||t.length>s.pendingAttachments||t.some(n=>!u(n))||new Set(t).size!==t.length)throw o("Invalid attachment ids.");return{attachmentIds:t}}function $(e){const t=e.skills;if(t===void 0)return{};if(!Array.isArray(t)||t.length>32||t.some(n=>!u(n))||new Set(t).size!==t.length)throw o("Invalid skills.");return{skills:t}}function N(e){return y(e.execution)}function u(e){return typeof e=="string"&&e.length>0&&Buffer.byteLength(e,"utf8")<=s.jsonlIdBytes}function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function o(e){return new Error(e)}export{R as isBrowserHostResponse,K as isComputerHostResponse,C as isDesktopHostResponse,M as isDocumentHostResponse,L as parseDesktopRequest};
@@ -0,0 +1,16 @@
1
+ import type { ToolApprovalRequest } from '@lotagate/agent-sdk';
2
+ import type { DesktopExecutionPolicy } from './desktop-execution-policy.js';
3
+ /** Owns Desktop approval/trust waiters and their AbortSignal lifecycle. */
4
+ export declare class DesktopApprovalBroker {
5
+ private readonly writeEvent;
6
+ private readonly approvals;
7
+ private readonly trusts;
8
+ constructor(writeEvent: (event: string, data: Record<string, unknown>) => Promise<void>);
9
+ waitForApproval(request: ToolApprovalRequest, sessionId: string, turnId: string, signal: AbortSignal, executionBoundary: DesktopExecutionPolicy['isolation'], fallbackReason?: string): Promise<boolean>;
10
+ waitForTrust(trustRequestId: string, signal: AbortSignal): Promise<boolean>;
11
+ respondApproval(approvalId: string, approved: boolean): boolean;
12
+ respondTrust(trustRequestId: string, trusted: boolean): boolean;
13
+ close(): void;
14
+ private wait;
15
+ private respond;
16
+ }
@@ -0,0 +1 @@
1
+ import{randomUUID as n}from"node:crypto";import{actionDisplayName as p,actionKind as l}from"../orchestration/cli-turn-events.js";import{describeApproval as v}from"./desktop-protocol-helpers.js";class m{writeEvent;approvals=new Map;trusts=new Map;constructor(t){this.writeEvent=t}async waitForApproval(t,r,e,o,a,s){const i=n();return await this.writeEvent("approval.requested",{approvalId:i,turnId:e,sessionId:r,toolName:t.toolName,displayName:p(t.toolName),kind:l(t.toolName,t.toolInfo?.source),detail:v(t),executionBoundary:a,...s===void 0?{}:{fallbackReason:s}}),this.wait(this.approvals,i,o)}waitForTrust(t,r){return this.wait(this.trusts,t,r)}respondApproval(t,r){return this.respond(this.approvals,t,r)}respondTrust(t,r){return this.respond(this.trusts,t,r)}close(){for(const t of[...this.approvals.values(),...this.trusts.values()])t.resolve(!1);this.approvals.clear(),this.trusts.clear()}wait(t,r,e){return new Promise(o=>{const a=()=>s(!1),s=i=>{t.delete(r),e.removeEventListener("abort",a),o(i)};if(e.aborted){s(!1);return}e.addEventListener("abort",a,{once:!0}),t.set(r,{resolve:s,signal:e,onAbort:a})})}respond(t,r,e){const o=t.get(r);return o===void 0?!1:(o.resolve(e),!0)}}export{m as DesktopApprovalBroker};
@@ -0,0 +1,16 @@
1
+ import type { AttachmentPayload } from '../../domain/session/attachment.js';
2
+ export declare class DesktopAttachmentStore {
3
+ private readonly pending;
4
+ private readonly completed;
5
+ begin(input: {
6
+ id: string;
7
+ name: string;
8
+ mimeType: string;
9
+ sizeBytes: number;
10
+ }): void;
11
+ appendChunk(id: string, index: number, encoded: string): void;
12
+ complete(id: string): void;
13
+ take(ids: readonly string[]): AttachmentPayload[];
14
+ clear(): void;
15
+ private totalReservedBytes;
16
+ }
@@ -0,0 +1 @@
1
+ import{CLI_ERROR_CODES as s}from"../../domain/errors/error-codes.js";import{CliError as c}from"../../domain/errors/cli-error.js";import{createImageAttachment as d,normalizeImage as r}from"../../infrastructure/clipboard/image-normalizer.js";import{RESOURCE_LIMITS as m}from"../../domain/runtime/resource-limits.js";class u{pending=new Map;completed=new Map;begin(e){if(!p(e.id)||!A(e.name)||!T(e.mimeType))throw i(s.ATTACHMENT_INVALID_IMAGE,"Invalid desktop attachment metadata.","The attachment metadata is invalid.");if(!Number.isSafeInteger(e.sizeBytes)||e.sizeBytes<=0||e.sizeBytes>m.maxAttachmentBytes)throw i(s.ATTACHMENT_TOO_LARGE,"Desktop attachment size is outside the allowed range.","The attachment exceeds the maximum allowed size.",!0);if(this.pending.has(e.id)||this.completed.has(e.id))throw i(s.ATTACHMENT_INVALID_IMAGE,"Desktop attachment id is already in use.","This attachment has already been uploaded.");if(this.totalReservedBytes()+e.sizeBytes>m.pendingAttachmentTotalBytes||this.pending.size+this.completed.size>=m.pendingAttachments)throw i(s.ATTACHMENT_TOO_LARGE,"Desktop attachment limits exceeded.","Too many or too-large attachments are pending.",!0);this.pending.set(e.id,{id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes,nextIndex:0,receivedBytes:0,chunks:[]})}appendChunk(e,t,o){const n=this.pending.get(e);if(n===void 0)throw i(s.ATTACHMENT_INVALID_IMAGE,"Desktop attachment upload was not started.","The attachment upload is not active.");if(!Number.isSafeInteger(t)||t!==n.nextIndex)throw i(s.ATTACHMENT_INVALID_IMAGE,"Desktop attachment chunk order is invalid.","The attachment upload is out of order.");const h=l(o);if(h.byteLength===0||h.byteLength>m.desktopAttachmentChunkBytes||n.receivedBytes+h.byteLength>n.sizeBytes)throw i(s.ATTACHMENT_TOO_LARGE,"Desktop attachment chunk exceeds its declared size.","The attachment upload is invalid or too large.",!0);n.chunks.push(h),n.receivedBytes+=h.byteLength,n.nextIndex+=1}complete(e){const t=this.pending.get(e);if(t===void 0)throw i(s.ATTACHMENT_INVALID_IMAGE,"Desktop attachment upload was not started.","The attachment upload is not active.");if(t.receivedBytes!==t.sizeBytes)throw i(s.ATTACHMENT_INVALID_IMAGE,"Desktop attachment upload is incomplete.","The attachment upload did not finish.");const o=Buffer.concat(t.chunks);if(t.mimeType.startsWith("image/")){const n=r(o,t.mimeType),h=d(n,"file",t.id);this.completed.set(e,{attachment:{...h,name:t.name},bytes:n.bytes})}else this.completed.set(e,{attachment:{id:t.id,name:t.name,mimeType:t.mimeType,sizeBytes:o.byteLength,source:"file"},bytes:o});this.pending.delete(e)}take(e){if(new Set(e).size!==e.length)throw i(s.ATTACHMENT_INVALID_IMAGE,"Desktop attachment ids must be unique.","An attachment was referenced more than once.");const t=e.map(o=>{const n=this.completed.get(o);if(n===void 0)throw i(s.ATTACHMENT_INVALID_IMAGE,"Desktop attachment is not complete.","Complete the attachment upload before sending the prompt.");return n});return e.forEach(o=>this.completed.delete(o)),t}clear(){this.pending.clear(),this.completed.clear()}totalReservedBytes(){let e=0;for(const t of this.pending.values())e+=t.sizeBytes;for(const t of this.completed.values())e+=t.bytes.byteLength;return e}}function l(a){if(!/^[A-Za-z0-9+/]*={0,2}$/u.test(a)||a.length===0||a.length%4!==0)throw i(s.ATTACHMENT_INVALID_IMAGE,"Desktop attachment chunk is not valid Base64.","The attachment upload is invalid.");return Buffer.from(a,"base64")}function p(a){return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u.test(a)}function A(a){return a.length>0&&a.length<=200&&!a.includes("\0")}function T(a){return a.length<=m.jsonlIdBytes&&/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*$/u.test(a)}function i(a,e,t,o=!1){return new c(a,e,{category:"attachment",userMessage:t,retryable:o})}export{u as DesktopAttachmentStore};
@@ -0,0 +1,2 @@
1
+ import type { DesktopCommandListResult } from './desktop-command-contract.js';
2
+ export declare function getDesktopCommandCatalog(): DesktopCommandListResult;
@@ -0,0 +1 @@
1
+ import{COMMAND_REGISTRY as r}from"../commands/command-runtime.js";import{isDesktopCommandExposed as t}from"./desktop-command-contract.js";function n(){return{commands:r.list("direct").filter(t).map(e)}}function e(m){return{id:m.id,path:m.path,summary:m.summary,...m.arguments===void 0?{}:{arguments:m.arguments},...m.options===void 0?{}:{options:m.options}}}export{n as getDesktopCommandCatalog};
@@ -0,0 +1,26 @@
1
+ import type { CommandActionSpec, CommandArgumentSpec, CommandOptionSpec } from '../commands/command-contract.js';
2
+ export interface DesktopCommandDescriptor {
3
+ readonly id: string;
4
+ readonly path: readonly string[];
5
+ readonly summary: string;
6
+ readonly arguments?: readonly CommandArgumentSpec[];
7
+ readonly options?: readonly CommandOptionSpec[];
8
+ }
9
+ export interface DesktopCommandListResult {
10
+ readonly commands: readonly DesktopCommandDescriptor[];
11
+ }
12
+ export interface DesktopCommandInvocation {
13
+ readonly actionId: string;
14
+ readonly positionals: readonly string[];
15
+ readonly options: Readonly<Record<string, string | boolean>>;
16
+ /** Secrets are transported out-of-band from regular command options. */
17
+ readonly secrets?: Readonly<{
18
+ apiKey?: string;
19
+ }>;
20
+ }
21
+ export interface DesktopCommandExecutionResult {
22
+ readonly accepted: true;
23
+ readonly commandId: string;
24
+ readonly actionId: string;
25
+ }
26
+ export declare function isDesktopCommandExposed(action: CommandActionSpec): boolean;
@@ -0,0 +1 @@
1
+ function s(e){return e.surfaces.includes("direct")&&e.desktop?.exposed!==!1}export{s as isDesktopCommandExposed};
@@ -0,0 +1,17 @@
1
+ import type { CliRuntime } from '../../bootstrap/runtime-factory.js';
2
+ import type { DesktopCommandInvocation } from './desktop-command-contract.js';
3
+ import { type DesktopCommandOutputSink } from './desktop-command-output.js';
4
+ export interface DesktopCommandExecutorOptions {
5
+ readonly runtime: CliRuntime;
6
+ readonly cwd: string;
7
+ readonly invocation: DesktopCommandInvocation;
8
+ readonly signal: AbortSignal;
9
+ readonly output: DesktopCommandOutputSink;
10
+ readonly activity?: DesktopCommandActivitySink;
11
+ readonly onActivityError?: (error: unknown) => void;
12
+ }
13
+ export interface DesktopCommandActivitySink {
14
+ started(key: string, label: string): Promise<void>;
15
+ completed(key: string, isError: boolean): Promise<void>;
16
+ }
17
+ export declare function executeDesktopCommand(options: DesktopCommandExecutorOptions): Promise<number>;
@@ -0,0 +1 @@
1
+ import{executeApplicationCommand as r}from"../commands/application-command-executor.js";import{COMMAND_REGISTRY as a}from"../commands/command-runtime.js";import{parseCommandInvocationForAction as m}from"../commands/command-parser.js";import{CliError as s}from"../../domain/errors/cli-error.js";import{CLI_ERROR_CODES as d}from"../../domain/errors/error-codes.js";import{isDesktopCommandExposed as p}from"./desktop-command-contract.js";import{DesktopCommandOutput as u}from"./desktop-command-output.js";async function b(t){const i=l(t.invocation),o=new u(t.output),e={runtime:t.runtime,cwd:t.cwd,output:o,...t.invocation.secrets===void 0?{}:{secrets:t.invocation.secrets},writableOutput:o.writable,signal:t.signal,...t.activity===void 0?{}:{activity:f(t.activity,t.onActivityError)}};try{const n=await r(i,e);return await o.flush(),n}finally{await o.flush(),o.writable.destroy()}}function l(t){const i=a.get(t.actionId);if(i===void 0||!p(i))throw new s(d.INVALID_ARGUMENT,`Command action '${t.actionId}' is not available through the Desktop protocol.`,{category:"command",userMessage:`The command '${t.actionId}' is not available in the Desktop application.`});const o=new Map(Object.entries(t.options));return m(t.actionId,t.positionals,o,"direct",a)}function f(t,i){return{start(o,e){return c(t.started(o,e),i),{complete:n=>c(t.completed(o,n),i)}}}}function c(t,i){Promise.resolve(t).catch(o=>i?.(o))}export{b as executeDesktopCommand};
@@ -0,0 +1,15 @@
1
+ import { Writable } from 'node:stream';
2
+ import type { CommandOutput } from '../commands/command-output.js';
3
+ export interface DesktopCommandOutputSink {
4
+ write(content: string, structured?: object): Promise<void>;
5
+ }
6
+ /** Adapts existing command output to ordered JSONL command.output events. */
7
+ export declare class DesktopCommandOutput implements CommandOutput {
8
+ private readonly _sink;
9
+ private _pending;
10
+ readonly writable: Writable;
11
+ constructor(_sink: DesktopCommandOutputSink);
12
+ write(value: string): void;
13
+ writeStructured<T extends object>(value: T, fallbackText?: string): void;
14
+ flush(): Promise<void>;
15
+ }
@@ -0,0 +1 @@
1
+ import{Writable as e}from"node:stream";class h{_sink;_pending=Promise.resolve();writable=new e({write:(i,t,n)=>{this.write(String(i)),n()}});constructor(i){this._sink=i}write(i){this._pending=this._pending.then(()=>this._sink.write(i))}writeStructured(i,t){this._pending=this._pending.then(()=>this._sink.write(t??"",i))}async flush(){await this._pending}}export{h as DesktopCommandOutput};
@@ -0,0 +1,17 @@
1
+ export type DesktopPermissionPolicy = 'ask' | 'allowlist' | 'review' | 'autonomous';
2
+ export type DesktopBrowserAccess = 'disabled' | 'read-only' | 'interactive' | 'autonomous';
3
+ export interface DesktopExecutionPolicy {
4
+ readonly permissionPolicy: DesktopPermissionPolicy;
5
+ readonly allowedTools?: readonly string[];
6
+ readonly browserAccess: DesktopBrowserAccess;
7
+ readonly isolation: 'sandbox' | 'host';
8
+ readonly hostFallback: 'ask' | 'deny' | 'allow';
9
+ readonly timeoutMs: number;
10
+ readonly retryAttempt?: number;
11
+ }
12
+ /**
13
+ * Parses the required Desktop-only execution context at the CLI boundary.
14
+ * Standalone CLI commands use a separate protocol and never provide this
15
+ * object. Unknown fields are ignored so the new contract can grow additively.
16
+ */
17
+ export declare function parseDesktopExecutionPolicy(value: unknown): DesktopExecutionPolicy;
@@ -0,0 +1 @@
1
+ import{RESOURCE_LIMITS as f}from"../../domain/runtime/resource-limits.js";function y(o){if(!w(o))throw new Error("Invalid Desktop execution policy.");const r=e(o.permissionPolicy,["ask","allowlist","review","autonomous"],"permissionPolicy"),t=e(o.browserAccess,["disabled","read-only","interactive","autonomous"],"browserAccess"),n=e(o.isolation,["sandbox","host"],"isolation"),d=e(o.hostFallback,["ask","deny","allow"],"hostFallback"),s=o.allowedTools===void 0?void 0:p(o.allowedTools),l=c(o.timeoutMs,1e4,7200*1e3,"timeoutMs"),i=o.retryAttempt===void 0?void 0:c(o.retryAttempt,0,3,"retryAttempt");return{permissionPolicy:r,...s===void 0?{}:{allowedTools:s},browserAccess:t,isolation:n,hostFallback:d,timeoutMs:l,...i===void 0?{}:{retryAttempt:i}}}function p(o){if(!Array.isArray(o)||o.length>128)throw new Error("Invalid Desktop allowedTools.");const r=o.map(t=>{if(typeof t!="string"||t.trim().length===0||Buffer.byteLength(t,"utf8")>f.jsonlIdBytes)throw new Error("Invalid Desktop allowedTools entry.");return t.trim()});if(new Set(r).size!==r.length)throw new Error("Desktop allowedTools must not contain duplicates.");return r}function e(o,r,t){if(typeof o!="string"||!r.includes(o))throw new Error(`Invalid Desktop ${t}.`);return o}function c(o,r,t,n){if(typeof o!="number"||!Number.isSafeInteger(o)||o<r||o>t)throw new Error(`Invalid Desktop ${n}.`);return o}function w(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}export{y as parseDesktopExecutionPolicy};
@@ -0,0 +1,14 @@
1
+ import type { DesktopExtensionService } from './desktop-extension-service.js';
2
+ import type { DesktopRequest } from './desktop-agent-request-parser.js';
3
+ type ExtensionRequest = Extract<DesktopRequest, {
4
+ method: 'extension.listPublicPlugins' | 'extension.resolvePublicPluginSource' | 'extension.readPublicPluginContribution' | 'extension.readDetail' | 'extension.readPluginIcon';
5
+ }>;
6
+ /** Keeps CLI-owned extension request dispatch separate from the agent turn lifecycle. */
7
+ export declare class DesktopExtensionRequestHandler {
8
+ private readonly service;
9
+ private readonly respond;
10
+ private readonly cwd;
11
+ constructor(service: DesktopExtensionService, respond: (request: DesktopRequest, result: unknown) => Promise<void>, cwd: string);
12
+ handle(request: ExtensionRequest): Promise<void>;
13
+ }
14
+ export {};
@@ -0,0 +1 @@
1
+ class e{service;respond;cwd;constructor(i,a,s){this.service=i,this.respond=a,this.cwd=s}async handle(i){switch(i.method){case"extension.listPublicPlugins":return this.respond(i,await this.service.listPublicPlugins(i.params.root));case"extension.resolvePublicPluginSource":return this.respond(i,{path:await this.service.resolvePublicPluginSource(i.params.root,i.params.name)});case"extension.readPublicPluginContribution":return this.respond(i,await this.service.readPublicPluginContribution(i.params.root,i.params.pluginName,i.params.kind,i.params.sourceName));case"extension.readDetail":return this.respond(i,await this.service.readDetail(this.cwd,i.params));case"extension.readPluginIcon":return this.respond(i,await this.service.readPluginIcon(this.cwd,i.params.name,i.params.scope))}}}export{e as DesktopExtensionRequestHandler};
@@ -0,0 +1,44 @@
1
+ type Detail = {
2
+ content: string;
3
+ format: 'json' | 'markdown' | 'text';
4
+ editable: boolean;
5
+ fileName?: string;
6
+ };
7
+ type PublicContribution = {
8
+ kind: 'skill' | 'mcp' | 'hook' | 'agent';
9
+ sourceName: string;
10
+ description: string;
11
+ };
12
+ type PublicPlugin = {
13
+ directory: string;
14
+ name: string;
15
+ displayName?: string;
16
+ version: string;
17
+ description: string;
18
+ author?: string;
19
+ license?: string;
20
+ homepage?: string;
21
+ privacyPolicy?: string;
22
+ termsOfService?: string;
23
+ icon?: string;
24
+ contributions: readonly PublicContribution[];
25
+ };
26
+ /** CLI-owned extension reads exposed only through the Desktop JSONL protocol. */
27
+ export declare class DesktopExtensionService {
28
+ listPublicPlugins(root: string): Promise<readonly PublicPlugin[]>;
29
+ resolvePublicPluginSource(root: string, name: string): Promise<string>;
30
+ readPublicPluginContribution(root: string, pluginName: string, kind: 'skill' | 'mcp' | 'hook', sourceName: string): Promise<Detail>;
31
+ readDetail(cwd: string, input: {
32
+ kind: 'hook' | 'skill' | 'plugin' | 'mcp';
33
+ name: string;
34
+ scope?: 'user' | 'project' | 'plugin' | 'builtin';
35
+ pluginName?: string;
36
+ pluginScope?: 'user' | 'project';
37
+ sourceName?: string;
38
+ }): Promise<Detail>;
39
+ readPluginIcon(cwd: string, name: string, scope: 'user' | 'project'): Promise<{
40
+ mimeType: 'image/svg+xml';
41
+ data: string;
42
+ } | undefined>;
43
+ }
44
+ export {};
@@ -0,0 +1,3 @@
1
+ import{fileURLToPath as I}from"node:url";import d from"node:fs/promises";import n from"node:path";import{PLUGIN_LAYOUT as c}from"../../domain/extensions/plugin-manifest.js";import{PluginDiscovery as j}from"../../infrastructure/extensions/plugin-discovery.js";import{PluginAgentDiscovery as F}from"../../infrastructure/extensions/plugin-agent-discovery.js";import{SkillDiscovery as T}from"../../infrastructure/extensions/skill-discovery.js";import{discoverHooks as A}from"../../infrastructure/extensions/hook-runtime.js";import{loadPluginMcpConfig as R}from"../extensions/plugin-contribution-registry.js";import{readFileBounded as v}from"../../infrastructure/filesystem/bounded-file-reader.js";import{readJsonFileBounded as O}from"../../infrastructure/filesystem/bounded-json-reader.js";import{RESOURCE_LIMITS as x}from"../../domain/runtime/resource-limits.js";import{resolvePlatformPaths as M,resolveProjectConfigPaths as D}from"../../infrastructure/platform/platform-paths.js";const _=2*1024*1024,B=256*1024;class ot{async listPublicPlugins(o){const t=await d.realpath(o),r=await new j().discover([t]);return Promise.all(r.map(async i=>{const s=await P(i.directory),a=await new T().discover([n.join(i.directory,c.skillsDirectory)]),u=await R([i]),p=await A(n.join(i.directory,c.hooksDirectory)),C=await new F().discover(n.join(i.directory,c.agentsDirectory)),$=[...a.map(l=>({kind:"skill",sourceName:l.name,description:l.description})),...u.contributions.map(l=>({kind:"mcp",sourceName:l.sourceName,description:z(u.config[l.qualifiedName]?.config)})),...p.map(l=>({kind:"hook",sourceName:l.id,description:`${l.event} hook`})),...C.map(l=>({kind:"agent",sourceName:l.name,description:l.description}))].sort((l,k)=>l.kind.localeCompare(k.kind)||l.sourceName.localeCompare(k.sourceName));return{directory:n.basename(i.directory),name:i.name,...i.displayName===void 0?{}:{displayName:i.displayName},version:i.version,description:i.description??"No description provided.",...i.author===void 0?{}:{author:i.author},...i.license===void 0?{}:{license:i.license},homepage:i.homepage??"https://lotagate.com/",privacyPolicy:"https://lotagate.com/privacy",termsOfService:"https://lotagate.com/terms",...s===void 0?{}:{icon:`data:${s.mimeType};base64,${s.data}`},contributions:$}}))}async resolvePublicPluginSource(o,t){m(t,"public plugin");const r=await d.realpath(o),i=n.resolve(r,t);w(r,i);const s=await d.lstat(i);if(!s.isDirectory()||s.isSymbolicLink())throw new Error(`Public plugin source is invalid: ${t}.`);const a=await d.realpath(i);w(r,a);const u=await d.lstat(n.join(a,c.markerDirectory,c.manifestFile));if(!u.isFile()||u.isSymbolicLink())throw new Error(`Public plugin manifest is missing: ${t}.`);return a}async readPublicPluginContribution(o,t,r,i){const s=await this.resolvePublicPluginSource(o,t);m(i,r);const a=r==="skill"?{path:n.join(s,c.skillsDirectory,i,"SKILL.md"),format:"markdown"}:r==="hook"?{path:n.join(s,c.hooksDirectory,`${i}.json`),format:"json"}:{path:n.join(s,c.mcpDirectory,`${i}.json`),format:"json"};return await E(s,a.path),{content:r==="mcp"?await S(a.path,i,!0):await f(a.path),format:a.format,editable:!1,...r==="mcp"?{}:{fileName:n.basename(a.path)}}}async readDetail(o,t){if(t.scope==="builtin"&&t.kind==="skill"){m(t.name,"skill");const p=n.join(U(),t.name,"SKILL.md");return await J(p)?{content:await f(p),format:"markdown",editable:!1,fileName:"SKILL.md"}:y()}const r=await d.realpath(o),i=t.scope==="plugin"?t.pluginName===void 0?void 0:await g(r,t.pluginName,t.pluginScope):t.kind==="plugin"&&t.scope!=="builtin"?await g(r,t.name,t.scope==="user"?"user":"project"):void 0;if(t.kind==="plugin"&&t.scope!=="plugin"&&t.scope!=="builtin")return i===void 0?y():N(n.join(i,c.markerDirectory,c.manifestFile),"json",!0);if(t.scope!=="plugin"||i===void 0||t.pluginName===void 0)return y();if(t.kind==="plugin")return N(n.join(i,c.markerDirectory,c.manifestFile),"json",!1);const s=t.sourceName??t.name.split(":").slice(1).join(":");m(s,t.kind);const a=t.kind==="skill"?{path:n.join(i,c.skillsDirectory,s,"SKILL.md"),format:"markdown"}:t.kind==="hook"?{path:n.join(i,c.hooksDirectory,`${s}.json`),format:"json"}:{path:n.join(i,c.mcpDirectory,`${s}.json`),format:"json"};return await E(i,a.path),{content:t.kind==="mcp"?await S(a.path,s,!0):await f(a.path),format:a.format,editable:!1,...t.kind==="mcp"?{}:{fileName:n.basename(a.path)}}}async readPluginIcon(o,t,r){const i=await g(await d.realpath(o),t,r);return i===void 0?void 0:P(i)}}async function g(e,o,t){m(o,"plugin");const r=M(),i=t==="project"?[D(e).pluginsDir]:t==="user"?[r.pluginsDir]:[D(e).pluginsDir,r.pluginsDir];return(await new j().discover(i)).find(a=>a.name===o)?.directory}async function N(e,o,t){return{content:await f(e),format:o,editable:t,fileName:n.basename(e)}}async function f(e){const o=await v(e,_);if(o.truncated)throw new Error("The extension detail is too large to display.");return o.bytes.toString("utf8")}async function S(e,o,t){const r=await O(e,x.mcpConfigBytes);if(!b(r))throw new Error("Extension configuration must be a JSON object.");if(t)return`${JSON.stringify(h(r),null,2)}
2
+ `;if(!b(r[o]))throw new Error(`MCP server ${o} was not found in its configuration file.`);return`${JSON.stringify(h(r[o]),null,2)}
3
+ `}async function P(e){const o=n.join(e,"icon.svg");try{const t=await v(o,B);if(t.truncated)return;const r=t.bytes.toString("utf8");return!/^\s*<svg(?:\s|>)/iu.test(r)||/<script\b|\bon[a-z]+\s*=|javascript:/iu.test(r)?void 0:{mimeType:"image/svg+xml",data:t.bytes.toString("base64")}}catch(t){if(L(t))return;throw t}}async function E(e,o){w(e,n.resolve(e,n.relative(e,o)));const t=await d.lstat(o);if(!t.isFile()||t.isSymbolicLink())throw new Error("Extension contribution is invalid.");w(e,await d.realpath(o))}function y(){return{content:"This item is provided by the CLI and has no editable project file.",format:"text",editable:!1}}function U(){return n.resolve(n.dirname(I(import.meta.url)),"../../../skills")}function m(e,o){if(!/^[a-z0-9][a-z0-9-]{0,63}$/u.test(e))throw new Error(`Invalid ${o} name.`)}function w(e,o){const t=n.relative(e,o);if(t.length===0||t.startsWith("..")||n.isAbsolute(t))throw new Error("Extension path is outside its owning directory.")}function z(e){return e?.type==="stdio"||e?.type==="http"||e?.type==="sse"?`${e.type} MCP server`:"MCP server contribution"}function h(e,o){return typeof e=="string"&&o!==void 0&&/(token|secret|password|api[-_]?key|authorization)/iu.test(o)?"[REDACTED]":Array.isArray(e)?e.map(t=>h(t)):b(e)?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,h(r,t)])):e}function b(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function L(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}async function J(e){try{return(await d.lstat(e)).isFile()}catch(o){if(L(o))return!1;throw o}}export{ot as DesktopExtensionService};
@@ -0,0 +1,63 @@
1
+ import type { ToolDefinition } from '@lotagate/sdk';
2
+ import type { ToolExecutionContext, ToolExecutor, ToolInfo, ToolResult } from '@lotagate/agent-sdk';
3
+ import type { ToolActivityObserver } from '../../ports/tool-activity.js';
4
+ import type { ToolApprovalRequest } from '@lotagate/agent-sdk';
5
+ import type { FileChangeDiff } from '../../domain/filesystem/file-change-diff.js';
6
+ export type DesktopHostExecutionTool = 'filesystem' | 'shell' | 'git' | 'artifact';
7
+ export interface DesktopHostExecutionRequest {
8
+ version: 1;
9
+ type: 'host.request';
10
+ requestId: string;
11
+ tool: DesktopHostExecutionTool;
12
+ sessionId: string;
13
+ runId: string;
14
+ action: string;
15
+ params: Record<string, unknown>;
16
+ executionBoundary: 'sandbox' | 'host';
17
+ hostFallback: 'ask' | 'deny' | 'allow';
18
+ projectRoot?: string;
19
+ executionCwd?: string;
20
+ executionWorkspaceId?: string;
21
+ }
22
+ export interface DesktopHostExecutionResponse {
23
+ version: 1;
24
+ type: 'host.response';
25
+ requestId: string;
26
+ tool: DesktopHostExecutionTool;
27
+ ok: boolean;
28
+ result?: unknown;
29
+ error?: {
30
+ code: string;
31
+ category: string;
32
+ message: string;
33
+ retryable: boolean;
34
+ };
35
+ executionBoundary?: 'sandbox' | 'host';
36
+ fallbackReason?: string;
37
+ fileChange?: FileChangeDiff;
38
+ }
39
+ export type DesktopHostInvoker = (request: DesktopHostExecutionRequest, signal?: AbortSignal) => Promise<DesktopHostExecutionResponse>;
40
+ /**
41
+ * Routes Desktop-only host operations through the versioned host protocol.
42
+ * Standalone CLI callers never provide this executor and continue to use the
43
+ * local filesystem and shell executors.
44
+ */
45
+ export declare class DesktopHostToolExecutor implements ToolExecutor {
46
+ private readonly options;
47
+ private readonly definitions;
48
+ constructor(options: {
49
+ request: DesktopHostInvoker;
50
+ executionBoundary: 'sandbox' | 'host';
51
+ hostFallback: 'ask' | 'deny' | 'allow';
52
+ projectRoot?: string;
53
+ executionCwd?: string;
54
+ executionWorkspaceId?: string;
55
+ onWrite?: (change: FileChangeDiff) => void | Promise<void>;
56
+ onFallbackApproval?: (request: ToolApprovalRequest, reason: string) => boolean | Promise<boolean>;
57
+ onActivity?: ToolActivityObserver;
58
+ });
59
+ listTools(): readonly ToolDefinition[];
60
+ getToolInfo(toolName: string): ToolInfo | undefined;
61
+ execute(toolName: string, input: Record<string, unknown>, context: ToolExecutionContext): Promise<ToolResult>;
62
+ private request;
63
+ }
@@ -0,0 +1,2 @@
1
+ import{randomUUID as f}from"node:crypto";import{isReadOnlyShellRequest as p}from"../security/tool-risk-classifier.js";import{resolveWorkspacePath as h}from"../../infrastructure/filesystem/path-resolver.js";import{readOnlyArguments as m,resolveReadOnlyExecutable as y}from"../../infrastructure/platform/read-only-executable.js";import{filesystemToolDefinitions as g}from"../../infrastructure/filesystem/local-filesystem-tool-executor.js";import{shellToolDefinitions as x}from"../../infrastructure/shell/shell-tool-executor.js";import{formatFilesystemActivityName as b,formatShellCommandForDisplay as C}from"../agent/tool-display.js";import{normalizePowerShellScriptInput as E}from"../../infrastructure/platform/host-process.js";import{detectHostPlatform as k}from"../../infrastructure/platform/host-platform.js";class q{options;definitions=[...g(),...x()];constructor(t){this.options=t}listTools(){return this.definitions}getToolInfo(t){if(this.definitions.some(o=>c(o)===t))return{toolName:t,source:t==="shell.exec"?"shell":"filesystem",executorId:"desktop-host-execution",metadata:{boundary:this.options.executionBoundary}}}async execute(t,o,n){if(!this.definitions.some(e=>c(e)===t))return{content:`Unknown Desktop host tool: ${t}`,isError:!0};const i=t==="shell.exec"?"shell":"filesystem";let r;try{r=t==="shell.exec"?E(o,k()):o}catch(e){return{content:e instanceof Error?e.message:"Invalid shell.exec PowerShell script.",isError:!0}}if(t==="shell.exec"&&await p(r.command,r.args,n,h,r.cwd)){const e=r.command,a=await y(e,n.workspaceRoot??n.cwd??process.cwd());if(a===void 0)return{content:"Read-only executable is no longer available.",isError:!0};r={...r,command:a,args:m(e,r.args)}}const l=t==="shell.exec"&&typeof r.command=="string"?C(r.command,Array.isArray(r.args)?r.args.filter(e=>typeof e=="string"):[]):b(t,r.path),u=this.options.onActivity?.start({key:`${n.runId}:${t}`,toolName:t,source:i,label:l});try{let e=await this.options.request(this.request(i,t,r,n),n.signal);if(!e.ok&&e.error?.code==="SANDBOX_FALLBACK_REQUIRED"&&this.options.hostFallback==="ask"){const d=this.getToolInfo(t);(await this.options.onFallbackApproval?.({toolName:t,input:r,context:n,...d===void 0?{}:{toolInfo:d}},e.error.message)??!1)&&(e=await this.options.request({...this.request(i,t,r,n),executionBoundary:"host",hostFallback:"deny"},n.signal))}if(!e.ok)return u?.complete(!0),{content:e.error?.message??"Desktop rejected the execution request.",isError:!0,metadata:{code:e.error?.code??"HOST_EXECUTION_ERROR",boundary:e.executionBoundary??this.options.executionBoundary,retryable:e.error?.retryable??!1}};const a=O(i,e.result);if(a!==void 0){const d={code:a.code,boundary:e.executionBoundary??this.options.executionBoundary,retryable:a.retryable,...a.exitCode===void 0?{}:{exitCode:a.exitCode}};return u?.complete(!0,d),{content:a.message,isError:!0,metadata:d}}return u?.complete(!1,e.fileChange===void 0?void 0:{fileChange:{path:e.fileChange.path,additions:e.fileChange.additions,deletions:e.fileChange.deletions}}),e.fileChange!==void 0&&await this.options.onWrite?.(e.fileChange),{content:I(e.result,n.maxResultBytes),isError:!1,metadata:{boundary:e.executionBoundary??this.options.executionBoundary,...e.fallbackReason===void 0?{}:{fallbackReason:e.fallbackReason}}}}catch(e){return u?.complete(!0),{content:e instanceof Error?e.message:"Desktop execution failed.",isError:!0,metadata:{boundary:this.options.executionBoundary}}}}request(t,o,n,i){return{version:1,type:"host.request",requestId:f(),tool:t,sessionId:i.sessionId,runId:i.runId,action:o,params:n,executionBoundary:this.options.executionBoundary,hostFallback:this.options.hostFallback,...this.options.projectRoot===void 0?{}:{projectRoot:this.options.projectRoot},...this.options.executionCwd===void 0?{}:{executionCwd:this.options.executionCwd},...this.options.executionWorkspaceId===void 0?{}:{executionWorkspaceId:this.options.executionWorkspaceId}}}}function c(s){return"function"in s?s.function.name:void 0}function I(s,t){const o=typeof s=="string"?s:JSON.stringify(s??null);return Buffer.byteLength(o,"utf8")<=t?o:`${o.slice(0,Math.max(0,t-12))}
2
+ [truncated]`}function O(s,t){if(s!=="shell"||typeof t!="object"||t===null||Array.isArray(t))return;const o=t,n=typeof o.stderr=="string"?o.stderr.trim():"",i=typeof o.stdout=="string"?o.stdout.trim():"";if(o.cancelled===!0)return{code:"HOST_EXECUTION_CANCELLED",message:n||"Desktop host execution was cancelled.",retryable:!1};if(o.timedOut===!0)return{code:"HOST_EXECUTION_TIMEOUT",message:n||"Desktop host execution timed out.",retryable:!0};if(o.error===!0)return{code:"HOST_EXECUTION_PROCESS_ERROR",message:n||"Desktop host process failed to start or communicate.",retryable:!0};if(Object.hasOwn(o,"exitCode")&&o.exitCode!==0){const r=typeof o.exitCode=="number"?o.exitCode:null;return{code:"HOST_COMMAND_FAILED",message:n||i||`Desktop host command exited with code ${String(r)}.`,retryable:!1,exitCode:r}}}export{q as DesktopHostToolExecutor};
@@ -0,0 +1,20 @@
1
+ import type { IntentLifecycleEvent } from '../intent/intent-run-controller.js';
2
+ export interface DesktopIntentEventWriterOptions {
3
+ readonly writeEvent: (event: string, data: Record<string, unknown>) => Promise<void>;
4
+ readonly log: (message: string, details: Record<string, unknown>) => void;
5
+ }
6
+ /** Projects host-owned intent state into the stable Desktop event contract. */
7
+ export declare class DesktopIntentEventWriter {
8
+ private readonly options;
9
+ private readonly progress;
10
+ constructor(options: DesktopIntentEventWriterOptions);
11
+ clear(turnId: string): void;
12
+ write(event: IntentLifecycleEvent, sessionId: string, turnId: string): Promise<void>;
13
+ private writeCompiled;
14
+ private writeEvidence;
15
+ private writeVerificationRequired;
16
+ private writeBlocked;
17
+ private nextVersion;
18
+ private setActiveStep;
19
+ private evidenceStep;
20
+ }
@@ -0,0 +1 @@
1
+ class o{options;progress=new Map;constructor(i){this.options=i}clear(i){this.progress.delete(i)}async write(i,t,e){if(this.options.log("Intent lifecycle updated.",{lifecycle:i.type,intentId:i.contract.id,sessionId:t,turnId:e,...i.type==="intent.evidence"?{evidenceKind:i.evidence.kind,evidenceStatus:i.evidence.status}:{},...i.type==="intent.verification.required"||i.type==="intent.blocked"?{missingCount:i.missing.length}:{}}),i.type==="intent.compiled")return this.writeCompiled(i,t,e);if(i.type==="intent.evidence")return this.writeEvidence(i,t,e);if(i.type==="intent.verification.required")return this.writeVerificationRequired(i,t,e);if(i.type==="intent.blocked")return this.writeBlocked(i,t,e);await this.options.writeEvent("intent.completed",{turnId:e,sessionId:t,intentId:i.contract.id});for(const n of i.contract.steps)await this.options.writeEvent("work.task.completed",{turnId:e,sessionId:t,planId:i.contract.id,version:this.nextVersion(e),stepId:n.id});await this.options.writeEvent("work.plan.completed",{turnId:e,sessionId:t,planId:i.contract.id,version:this.nextVersion(e)}),this.clear(e)}async writeCompiled(i,t,e){const n=i.contract.steps[0]?.id;n!==void 0&&(this.progress.set(e,{version:1,activeStepId:n}),await this.options.writeEvent("intent.compiled",{turnId:e,sessionId:t,contract:i.contract}),await this.options.writeEvent("work.plan.created",{turnId:e,sessionId:t,planId:i.contract.id,version:1,goal:i.contract.objective,language:"und",totalSteps:i.contract.steps.length,steps:i.contract.steps.map((c,r)=>({index:r,id:c.id,title:c.title,description:c.title,dependencies:[],scope:[],acceptanceCriteria:c.acceptanceCriteria,verificationHints:c.requiresVerification?["Host-observed verification required"]:[],evidenceIds:[],status:r===0?"active":"queued"}))}))}async writeEvidence(i,t,e){const n=this.evidenceStep(e,i.contract,i.evidence.kind);await this.options.writeEvent("intent.evidence.recorded",{turnId:e,sessionId:t,intentId:i.contract.id,evidence:i.evidence}),await this.options.writeEvent("work.evidence.recorded",{turnId:e,sessionId:t,planId:i.contract.id,version:this.nextVersion(e),evidence:{id:i.evidence.id,stepId:n,kind:i.evidence.kind==="tool"?"runtime":i.evidence.kind,summary:i.evidence.summary,status:i.evidence.status,...i.evidence.command===void 0?{}:{command:i.evidence.command},...i.evidence.paths===void 0?{}:{paths:i.evidence.paths},...i.evidence.exitCode===void 0?{}:{exitCode:i.evidence.exitCode},createdAt:i.evidence.timestamp}})}async writeVerificationRequired(i,t,e){await this.options.writeEvent("intent.verification.required",{turnId:e,sessionId:t,intentId:i.contract.id,missing:i.missing});const n=i.contract.steps.find(c=>c.requiresVerification);n!==void 0&&(this.setActiveStep(e,n.id),await this.options.writeEvent("work.task.started",{turnId:e,sessionId:t,planId:i.contract.id,version:this.nextVersion(e),stepId:n.id}))}async writeBlocked(i,t,e){await this.options.writeEvent("intent.blocked",{turnId:e,sessionId:t,intentId:i.contract.id,missing:i.missing}),await this.options.writeEvent("work.plan.blocked",{turnId:e,sessionId:t,planId:i.contract.id,version:this.nextVersion(e),reason:i.missing.join(", ")}),this.clear(e)}nextVersion(i){const t=this.progress.get(i);return t===void 0?1:(t.version+=1,t.version)}setActiveStep(i,t){const e=this.progress.get(i);e!==void 0&&(e.activeStepId=t)}evidenceStep(i,t,e){return e==="test"||e==="typecheck"||e==="lint"||e==="build"||e==="runtime"?t.steps.find(n=>n.requiresVerification)?.id??t.steps.at(-1)?.id??t.steps[0].id:this.progress.get(i)?.activeStepId??t.steps[0].id}}export{o as DesktopIntentEventWriter};
@@ -0,0 +1,10 @@
1
+ import type { AgentEvent } from '@lotagate/agent-sdk';
2
+ import type { McpRuntimeEvent } from '../../infrastructure/extensions/mcp-runtime.js';
3
+ type DesktopMcpEvent = Extract<AgentEvent, {
4
+ type: 'mcp.server.status' | 'mcp.tool.catalog.updated';
5
+ }> | McpRuntimeEvent;
6
+ export declare function desktopMcpEvent(event: DesktopMcpEvent, sessionId: string, turnId: string): {
7
+ name: string;
8
+ data: Record<string, unknown>;
9
+ };
10
+ export {};
@@ -0,0 +1 @@
1
+ function t(r,o,a){if(r.type==="mcp.tool.catalog.updated")return{name:"mcp.tool.catalog.updated",data:{sessionId:o,turnId:a,serverId:r.serverId,toolCount:"toolCount"in r?r.toolCount:r.tools.length,...r.error===void 0?{}:{error:u(r.error),retryable:!0}}};const s=r.summary.status==="closed"?"disconnected":r.summary.status==="created"?"connecting":r.summary.status;return{name:`mcp.server.${s}`,data:{sessionId:o,turnId:a,serverId:r.summary.serverId,status:s,...!("latencyMs"in r.summary)||r.summary.latencyMs===void 0?{}:{latencyMs:r.summary.latencyMs},...r.summary.protocolEra===void 0?{}:{protocolEra:r.summary.protocolEra},...r.summary.protocolVersion===void 0?{}:{protocolVersion:r.summary.protocolVersion},...r.summary.error===void 0?{}:{error:u(r.summary.error),retryable:!0}}}}function u(r){return r.message.replace(/(api[-_ ]?key|authorization|bearer|token|password)\s*[:=]\s*[^\s,;]+/giu,"$1=[REDACTED]").slice(0,1024)}export{t as desktopMcpEvent};
@@ -0,0 +1,2 @@
1
+ import type { SubagentLifecycleEvent } from '../../ports/subagent-lifecycle.js';
2
+ export declare function subagentDesktopPayload(event: SubagentLifecycleEvent, turnId?: string): Record<string, unknown>;
@@ -0,0 +1,2 @@
1
+ function u(d,s){return{...s===void 0?{}:{turnId:s},sessionId:d.sessionId,id:d.id,displayName:d.displayName,task:o(d.task,16384),mode:d.mode,model:d.model,status:d.status,background:d.background,timestamp:d.timestamp,...d.durationMs===void 0?{}:{durationMs:d.durationMs},...d.summary===void 0?{}:{summary:o(d.summary,24576)},...d.lastAction===void 0?{}:{lastAction:d.lastAction},...d.handoff===void 0?{}:{handoff:d.handoff}}}function o(d,s){const a=Buffer.from(d,"utf8");return a.byteLength<=s?d:`${a.subarray(0,s).toString("utf8")}
2
+ [truncated]`}export{u as subagentDesktopPayload};
@@ -0,0 +1,13 @@
1
+ import type { ToolApprovalRequest } from '@lotagate/agent-sdk';
2
+ import type { SessionMetadata } from '../../domain/session/session.js';
3
+ import type { CliApprovalMode } from '../security/tool-approval-service.js';
4
+ import type { DesktopExecutionPolicy } from './desktop-execution-policy.js';
5
+ export declare function desktopApprovalMode(policy: DesktopExecutionPolicy['permissionPolicy']): CliApprovalMode;
6
+ export declare function toDesktopError(error: unknown): {
7
+ code: string;
8
+ category: string;
9
+ message: string;
10
+ retryable: boolean;
11
+ };
12
+ export declare function sessionResult(session: SessionMetadata): Record<string, unknown>;
13
+ export declare function describeApproval(request: ToolApprovalRequest): Record<string, unknown>;
@@ -0,0 +1 @@
1
+ import{asCliError as n}from"../../domain/errors/cli-error.js";import{formatShellCommandForDisplay as s,formatToolActivityName as i}from"../agent/tool-display.js";function p(e){return e==="allowlist"?"auto":e==="review"?"review":e==="autonomous"?"autonomous":"ask"}function l(e){if(typeof e=="object"&&e!==null){const r=e;if(typeof r.code=="string"&&typeof r.category=="string"&&typeof r.userMessage=="string"&&typeof r.retryable=="boolean")return{code:r.code,category:r.category,message:r.userMessage,retryable:r.retryable}}const t=n(e);return{code:t.code,category:t.category,message:t.userMessage,retryable:t.retryable}}function u(e){return{session:e}}function f(e){if(e.toolName==="filesystem.write")return{summary:`Write workspace file: ${o(e.input.path)}`,path:o(e.input.path)};if(e.toolName==="shell.exec"){const t=typeof e.input.command=="string"?e.input.command:"",r=Array.isArray(e.input.args)?e.input.args.filter(a=>typeof a=="string"):[];return{summary:`Run command: ${s(t,r,240)}`,command:t,args:r}}return{summary:`This ${i(e.toolName)} operation may change workspace or external state.`}}function o(e){return String(e??"").replace(/Bearer\s+[^\s]+/giu,"Bearer [REDACTED]").replace(/sk-[A-Za-z0-9_-]{8,}/gu,"[REDACTED]").slice(0,240)}export{f as describeApproval,p as desktopApprovalMode,u as sessionResult,l as toDesktopError};
@@ -0,0 +1,4 @@
1
+ import type { ToolDefinition } from '@lotagate/sdk';
2
+ export declare const DOCUMENT_FORMATS: readonly ["pdf", "pptx", "excel", "docs"];
3
+ export type DocumentFormat = typeof DOCUMENT_FORMATS[number];
4
+ export declare const DOCUMENT_TOOL_DEFINITIONS: readonly ToolDefinition[];
@@ -0,0 +1 @@
1
+ const k=["pdf","pptx","excel","docs"],t={path:n("Workspace-relative or absolute document path."),handleId:n("Document handle returned by the open tool."),outputPath:n("Optional workspace-relative output path.")},m=[a("pdf.open","Open a PDF document and return a governed document handle.",{path:t.path},["path"]),a("pdf.create","Create a new PDF document at the requested path.",{path:t.path,title:n("Optional document title.")},["path"]),a("pdf.inspect","Inspect PDF metadata and page count.",{handleId:t.handleId},["handleId"]),a("pdf.validate","Validate the PDF signature and readable structure.",{path:t.path},["path"]),a("pdf.readText","Extract bounded text from selected PDF pages.",{handleId:t.handleId,pages:o("Optional zero-based page numbers.")},["handleId"]),a("pdf.render","Render selected PDF pages to image artifacts.",{handleId:t.handleId,pages:o("Optional zero-based page numbers."),outputPath:t.outputPath},["handleId"]),a("pdf.extractTables","Extract table-like text from selected PDF pages.",{handleId:t.handleId,pages:o("Optional zero-based page numbers.")},["handleId"]),a("pdf.recognizeText","Recognize text from selected PDF pages with bounded line metadata.",{handleId:t.handleId,pages:o("Optional zero-based page numbers."),language:n("Optional BCP-47 OCR language tag.")},["handleId"]),a("pdf.search","Search PDF text and return bounded page matches.",{handleId:t.handleId,query:n("Text to find."),pages:o("Optional zero-based page numbers."),maxResults:d("Maximum matches to return.")},["handleId","query"]),a("pdf.extractImages","Extract embedded PDF images to a workspace directory.",{handleId:t.handleId,outputPath:t.outputPath,pages:o("Optional zero-based page numbers.")},["handleId","outputPath"]),a("pdf.manageBookmarks","Read or update PDF outline bookmarks.",{handleId:t.handleId,operation:l(["list","add","update","delete"],"Bookmark operation."),bookmark:i("Bookmark definition for add, update, or delete.")},["handleId","operation"]),a("pdf.extractLinks","Extract links from selected PDF pages.",{handleId:t.handleId,pages:o("Optional zero-based page numbers.")},["handleId"]),a("pdf.extractAnnotations","Extract annotations from a PDF.",{handleId:t.handleId,pages:o("Optional zero-based page numbers.")},["handleId"]),a("pdf.manageAttachments","List, extract, attach, or remove PDF file attachments.",{handleId:t.handleId,operation:l(["list","extract","attach","delete"],"Attachment operation."),outputPath:t.outputPath,sourcePath:t.path,name:n("Attachment name.")},["handleId","operation"]),a("pdf.flattenForms","Flatten PDF form fields into page content.",{handleId:t.handleId,outputPath:t.outputPath},["handleId"]),a("pdf.optimize","Optimize a PDF into a separate output artifact.",{handleId:t.handleId,outputPath:t.outputPath,options:i("Optimization options.")},["handleId","outputPath"]),a("pdf.addPageNumbers","Add page numbers to a PDF into a separate output artifact.",{handleId:t.handleId,outputPath:t.outputPath,options:i("Page number placement and formatting options.")},["handleId","outputPath"]),a("pdf.insertPages","Insert pages from another PDF before a page index.",{handleId:t.handleId,sourcePath:t.path,beforePage:d("Zero-based insertion page.")},["handleId","sourcePath","beforePage"]),a("pdf.deletePages","Delete selected pages from a PDF.",{handleId:t.handleId,pages:o("Zero-based page numbers.")},["handleId","pages"]),a("pdf.reorderPages","Reorder all PDF pages using a zero-based permutation.",{handleId:t.handleId,order:o("Complete zero-based page permutation.")},["handleId","order"]),a("pdf.rotatePages","Rotate selected PDF pages.",{handleId:t.handleId,pages:o("Zero-based page numbers."),degrees:l(["90","180","270"],"Clockwise rotation.")},["handleId","pages","degrees"]),a("pdf.merge","Merge PDFs into a new output document.",{paths:h("Input PDF paths."),outputPath:t.outputPath},["paths","outputPath"]),a("pdf.split","Split selected PDF pages into a new output document.",{handleId:t.handleId,pages:o("Zero-based page numbers."),outputPath:t.outputPath},["handleId","pages","outputPath"]),a("pdf.addText","Add positioned text to a PDF page.",{handleId:t.handleId,page:d("Zero-based page number."),text:n("Text to add."),x:d("Horizontal PDF coordinate."),y:d("Vertical PDF coordinate.")},["handleId","page","text","x","y"]),a("pdf.addImage","Add an image to a PDF page.",{handleId:t.handleId,page:d("Zero-based page number."),imagePath:t.path,x:d("Horizontal PDF coordinate."),y:d("Vertical PDF coordinate."),width:d("Image width."),height:d("Image height.")},["handleId","page","imagePath","x","y","width","height"]),a("pdf.annotate","Add a PDF annotation.",{handleId:t.handleId,page:d("Zero-based page number."),text:n("Annotation text."),x:d("Horizontal PDF coordinate."),y:d("Vertical PDF coordinate.")},["handleId","page","text","x","y"]),a("pdf.readForm","Read PDF form fields.",{handleId:t.handleId},["handleId"]),a("pdf.fillForm","Fill PDF form fields.",{handleId:t.handleId,values:i("Field names and values.")},["handleId","values"]),a("pdf.redact","Redact selected rectangular areas in a PDF.",{handleId:t.handleId,areas:x("Page and rectangle definitions.")},["handleId","areas"]),a("pdf.save","Save changes to an opened PDF document.",{handleId:t.handleId,outputPath:t.outputPath},["handleId"]),a("pdf.close","Close an opened PDF document handle.",{handleId:t.handleId},["handleId"])],g=u("pptx","slide",[["duplicateSlide","Duplicate a presentation slide."],["importSlides","Import slides from another presentation."],["arrangeElements","Align, distribute, group, or reorder slide elements."],["findReplace","Find and replace text across presentation slides."],["extractText","Extract bounded text from selected presentation slides."],["manageMedia","List, insert, update, or delete presentation media."],["manageHyperlinks","List, set, or clear presentation hyperlinks."],["manageTransitions","Inspect or update slide transitions."],["manageLayouts","List or apply presentation slide layouts."],["readSlide","Read slide text and element metadata."],["addSlide","Add a slide."],["deleteSlide","Delete a slide."],["reorderSlides","Reorder slides."],["updateSlide","Update slide metadata."],["addElement","Add a slide element."],["updateElement","Update a slide element."],["deleteElement","Delete a slide element."],["setTheme","Set the presentation theme."],["setNotes","Set speaker notes."],["render","Render slides to image artifacts."],["exportPdf","Export the presentation as PDF."]]),I=u("excel","range",[["find","Find text or values in a workbook."],["manageNamedRange","Create, inspect, update, or delete a workbook named range."],["setDataValidation","Set or clear data validation on a worksheet range."],["managePivotTable","Create, refresh, inspect, or delete a pivot table."],["readFormulas","Read formulas and calculated values from a worksheet range."],["manageConditionalFormatting","List, set, or clear conditional formatting rules."],["manageSheetView","Inspect or update worksheet view settings."],["manageComments","List, add, update, or delete cell comments."],["manageProtection","Inspect, protect, or unprotect workbook or worksheet protection."],["readRange","Read a worksheet range."],["writeRange","Write values to a worksheet range."],["clearRange","Clear a worksheet range."],["addSheet","Add a worksheet."],["updateSheet","Rename or update a worksheet."],["deleteSheet","Delete a worksheet."],["editRows","Insert or delete worksheet rows."],["editColumns","Insert or delete worksheet columns."],["formatRange","Format a worksheet range."],["manageTable","Create or update a table."],["manageChart","Create or update a chart."],["sortRange","Sort a worksheet range."],["filterRange","Apply or clear a worksheet filter."],["recalculate","Recalculate workbook formulas."],["render","Render a worksheet to an image artifact."],["importCsv","Import CSV data into a worksheet."],["exportCsv","Export a worksheet as CSV."],["exportPdf","Export a workbook or worksheet as PDF."]]),f=u("docs","content",[["manageTable","Create, inspect, update, or delete a document table."],["manageImage","Insert, inspect, update, or delete a document image."],["fillTemplate","Fill tagged document content controls from structured values."],["updateFields","Update document fields."],["inspectStructure","Read document paragraphs, headings, tables, and sections."],["manageBookmarks","List, add, update, or delete document bookmarks."],["manageHyperlinks","List, add, update, or delete document hyperlinks."],["manageLists","Inspect or apply document list formatting."],["manageFootnotes","List, add, or delete document footnotes."],["readContent","Read document content and structure."],["insertContent","Insert content at a document position."],["updateContent","Update a document range."],["deleteContent","Delete a document range."],["findReplace","Find and replace document text."],["setStyles","Apply document styles."],["setSection","Update section settings."],["setHeaderFooter","Update a header or footer."],["manageComments","Create or update document comments."],["manageRevisions","Inspect or manage document revisions."],["render","Render document pages to image artifacts."],["exportPdf","Export the document as PDF."]]),F=[...m,...g,...I,...f];function u(e,s,p){return[a(`${e}.open`,`Open a ${e.toUpperCase()} document and return a governed document handle.`,{path:t.path},["path"]),a(`${e}.create`,`Create a new ${e.toUpperCase()} document at the requested path.`,{path:t.path,title:n("Optional document title.")},["path"]),a(`${e}.inspect`,`Inspect ${e.toUpperCase()} metadata.`,{handleId:t.handleId},["handleId"]),a(`${e}.validate`,`Validate ${e.toUpperCase()} structure.`,{path:t.path},["path"]),...p.map(([r,c])=>a(`${e}.${r}`,c,P(e,r,s),b(r))),a(`${e}.save`,`Save changes to an opened ${e.toUpperCase()} document.`,{handleId:t.handleId,outputPath:t.outputPath},["handleId"]),a(`${e}.close`,`Close an opened ${e.toUpperCase()} document handle.`,{handleId:t.handleId},["handleId"])]}function P(e,s,p){const r={handleId:t.handleId,outputPath:t.outputPath,sourcePath:t.path,sheet:n("Worksheet name."),sheetName:n("New worksheet name."),slide:d("Zero-based slide number."),pages:o("Optional zero-based item indexes."),range:n(`Target ${p} reference.`),start:d("Document character start."),end:d("Document character end."),find:n("Text to find."),replace:n("Replacement text."),content:n("Text or serialized content."),text:n("Text value."),values:i("Structured values."),options:i("Format-specific options."),operation:n("Format-specific operation."),name:n("Named item identifier."),formula:n("Formula or source expression."),formula1:n("Primary validation formula."),formula2:n("Secondary validation formula."),index:d("Zero-based item index."),position:d("Zero-based destination position."),elementIds:h("Element identifiers."),alignment:l(["left","center","right","top","middle","bottom"],"Alignment operation."),distribution:l(["horizontal","vertical"],"Distribution direction."),imagePath:t.path,mediaPath:t.path,width:d("Width in document units."),height:d("Height in document units."),altText:n("Alternative text."),tableName:n("Table or pivot table name."),sourceRange:n("Source worksheet range."),query:n("Search query."),maxResults:d("Maximum result count."),rowStart:d("Zero-based first row."),rowCount:d("Maximum rows."),columnStart:d("Zero-based first column."),columnCount:d("Maximum columns."),bookmark:i("Bookmark definition."),property:n("Property name."),expected:n("Expected value."),level:d("List or outline level."),target:n("Bookmark, hyperlink, or list target."),address:n("Hyperlink destination."),password:n("Protection password when required."),kind:n("Protection target kind."),style:n("Document style name."),listType:l(["bullet","number"],"List type."),effect:d("PowerPoint transition effect code.")};return e==="pptx"&&(r.elementId=n("Slide element identifier.")),r}function b(e){return e==="readSlide"?["handleId","slide"]:e==="readRange"||e==="writeRange"||e==="clearRange"||e==="formatRange"?["handleId","range"]:e==="duplicateSlide"?["handleId","slide"]:e==="importSlides"?["handleId","sourcePath"]:e==="arrangeElements"?["handleId","slide","elementIds","operation"]:e==="findReplace"?["handleId","find","replace"]:e==="find"?["handleId","query"]:e==="setDataValidation"?["handleId","range","operation"]:e==="manageNamedRange"||e==="setDataValidation"||e==="managePivotTable"||e==="manageTable"||e==="manageImage"?["handleId","operation"]:e==="fillTemplate"?["handleId","values"]:e==="updateFields"?["handleId"]:e==="extractText"?["handleId"]:e==="readFormulas"?["handleId","range"]:e==="manageMedia"||e==="manageHyperlinks"||e==="manageTransitions"||e==="manageLayouts"||e==="manageConditionalFormatting"||e==="manageSheetView"||e==="manageComments"||e==="manageProtection"||e==="manageBookmarks"||e==="manageLists"||e==="manageFootnotes"||e==="inspectStructure"?["handleId","operation"]:e==="exportCsv"||e==="exportPdf"||e==="render"?["handleId"]:["handleId"]}function a(e,s,p,r){return{type:"function",function:{name:e,description:s,parameters:{type:"object",properties:p,required:r,additionalProperties:!1}}}}function n(e){return{type:"string",description:e}}function d(e){return{type:"number",description:e}}function l(e,s){return{type:"string",enum:[...e],description:s}}function o(e){return{type:"array",items:{type:"integer"},description:e}}function h(e){return{type:"array",items:{type:"string"},description:e}}function i(e){return{type:"object",additionalProperties:!0,description:e}}function x(e){return{type:"array",items:{type:"object",additionalProperties:!0},description:e}}export{k as DOCUMENT_FORMATS,F as DOCUMENT_TOOL_DEFINITIONS};
@@ -0,0 +1,49 @@
1
+ import type { ToolDefinition } from '@lotagate/sdk';
2
+ import type { ToolExecutionContext, ToolExecutor, ToolInfo, ToolResult } from '@lotagate/agent-sdk';
3
+ import type { ToolActivityObserver } from '../../ports/tool-activity.js';
4
+ import { type DocumentFormat } from './document-host-tool-definitions.js';
5
+ export type DocumentHostTool = 'document';
6
+ export interface DocumentHostRequest {
7
+ version: 1;
8
+ type: 'host.request';
9
+ requestId: string;
10
+ tool: DocumentHostTool;
11
+ sessionId: string;
12
+ runId: string;
13
+ action: string;
14
+ params: Record<string, unknown>;
15
+ executionBoundary: 'host';
16
+ hostFallback: 'deny';
17
+ projectRoot?: string;
18
+ executionCwd?: string;
19
+ executionWorkspaceId?: string;
20
+ }
21
+ export interface DocumentHostResponse {
22
+ version: 1;
23
+ type: 'host.response';
24
+ requestId: string;
25
+ tool: DocumentHostTool;
26
+ ok: boolean;
27
+ result?: unknown;
28
+ error?: {
29
+ code: string;
30
+ category: string;
31
+ message: string;
32
+ retryable: boolean;
33
+ };
34
+ }
35
+ export type DocumentHostInvoker = (request: DocumentHostRequest, signal?: AbortSignal) => Promise<DocumentHostResponse>;
36
+ export declare function documentToolDefinitions(): readonly ToolDefinition[];
37
+ export declare function documentToolDefinitionsForFormats(formats: readonly DocumentFormat[]): readonly ToolDefinition[];
38
+ export declare class DocumentHostToolExecutor implements ToolExecutor {
39
+ private readonly options;
40
+ private readonly definitions;
41
+ constructor(options: {
42
+ request: DocumentHostInvoker;
43
+ formats?: readonly DocumentFormat[];
44
+ onActivity?: ToolActivityObserver;
45
+ });
46
+ listTools(): readonly ToolDefinition[];
47
+ getToolInfo(toolName: string): ToolInfo | undefined;
48
+ execute(toolName: string, input: Record<string, unknown>, context: ToolExecutionContext): Promise<ToolResult>;
49
+ }
@@ -0,0 +1,2 @@
1
+ import{randomUUID as a}from"node:crypto";import{DOCUMENT_TOOL_DEFINITIONS as i}from"./document-host-tool-definitions.js";function l(){return i}function c(o){const e=new Set(o.map(r=>`${r}.`));return i.filter(r=>[...e].some(t=>u(r)?.startsWith(t)===!0))}class p{options;definitions;constructor(e){this.options=e,this.definitions=e.formats===void 0?i:c(e.formats)}listTools(){return this.definitions}getToolInfo(e){if(!this.definitions.some(t=>u(t)===e))return;const r=/\.(?:open|inspect|validate|readText|readSlide|readRange|readContent|extractTables|recognizeText|search|extractImages|extractLinks|extractAnnotations|readForm|find|readFormulas|inspectStructure|manageRevisions)$/u.test(e);return{toolName:e,source:"custom",executorId:"desktop-document-host",metadata:{risk:r?"read":"unknown"}}}async execute(e,r,t){if(!this.definitions.some(n=>u(n)===e))return{content:`Unknown document tool: ${e}`,isError:!0};const s=this.options.onActivity?.start({key:`${t.runId}:${e}`,toolName:e,source:"custom",label:e.replace(/\./u," ")});try{const n=await this.options.request({version:1,type:"host.request",requestId:a(),tool:"document",sessionId:t.sessionId,runId:t.runId,action:e,params:r,executionBoundary:"host",hostFallback:"deny",...t.workspaceRoot===void 0?{}:{projectRoot:t.workspaceRoot},...t.cwd===void 0?{}:{executionCwd:t.cwd}},t.signal);return n.ok?(s?.complete(!1),{content:d(n.result,t.maxResultBytes),isError:!1,metadata:{document:!0}}):(s?.complete(!0),{content:n.error?.message??"Desktop rejected the document action.",isError:!0,metadata:{code:n.error?.code??"DOCUMENT_HOST_ERROR",retryable:n.error?.retryable??!1}})}catch(n){return s?.complete(!0),{content:n instanceof Error?n.message:"Document host request failed.",isError:!0}}}}function u(o){return"function"in o?o.function.name:void 0}function d(o,e){const r=typeof o=="string"?o:JSON.stringify(o??null);return Buffer.byteLength(r,"utf8")<=e?r:`${r.slice(0,Math.max(0,e-12))}
2
+ [truncated]`}export{p as DocumentHostToolExecutor,l as documentToolDefinitions,c as documentToolDefinitionsForFormats};
@@ -0,0 +1,9 @@
1
+ import type { Writable } from 'node:stream';
2
+ /** Serializes protocol messages in order and applies Writable backpressure. */
3
+ export declare class JsonLineWriter<T> {
4
+ private readonly output;
5
+ private tail;
6
+ constructor(output: Writable);
7
+ write(value: T): Promise<void>;
8
+ flush(): Promise<void>;
9
+ }
@@ -0,0 +1,2 @@
1
+ import{once as r}from"node:events";class o{output;tail=Promise.resolve();constructor(t){this.output=t}write(t){const i=this.tail.then(async()=>{this.output.write(`${JSON.stringify(t)}
2
+ `)||await r(this.output,"drain")});return this.tail=i.catch(()=>{}),i}async flush(){await this.tail}}export{o as JsonLineWriter};
@@ -0,0 +1,3 @@
1
+ import type { Readable, Writable } from 'node:stream';
2
+ import type { createCompositionRoot } from '../../bootstrap/composition-root.js';
3
+ export declare function runAgentCommand(positionals: readonly string[], runtime: ReturnType<typeof createCompositionRoot>, cwd: string, stdin: Readable, stdout: Writable): Promise<number>;
@@ -0,0 +1,3 @@
1
+ import{AuthenticationService as A}from"../auth/authentication-service.js";import{JsonlProtocolRunner as k}from"./jsonl-protocol.js";import{createLotaGateClient as O}from"../../infrastructure/sdk/lotagate-client-factory.js";import{CliError as C}from"../../domain/errors/cli-error.js";import{CLI_ERROR_CODES as d}from"../../domain/errors/error-codes.js";import{prepareCliAgent as _}from"../agent/cli-agent-execution-service.js";import{AgentRunTracker as x}from"../agent/agent-run-tracker.js";import{loadExecutionConfig as P}from"../config/execution-config.js";import{agentLimitNotice as T,classifyAgentLimit as b}from"../agent/agent-limit.js";import{runDesktopAgentCommand as v}from"./desktop-agent-command.js";async function $(E,t,r,h,w){const N=E[0]??"stdio";if(N==="desktop")return v(t,r,h,w);if(N!=="stdio")throw new C(d.INVALID_ARGUMENT,"Unsupported agent action.",{category:"arguments",userMessage:"Use `lotagate agent stdio` or `lotagate agent desktop`."});const a=await P(t,r);if(a.config.model===null)throw new C(d.MODEL_NOT_FOUND,"No model is selected.",{category:"model",userMessage:"Select a model before running the stdio agent."});const M=a.config.profile??A.defaultProfileName(),y=await t.auth.requireCredential(M);return(await new k(async function*(f,R){const i=f.params.model??a.config.model;t.logger.info("Protocol agent request started.",{model:i,promptLength:f.params.prompt.length});const s=new x,L=o=>{s.observeModel(o),t.logger.debug("Model turn completed.",{model:o.model,stream:o.stream,contentLength:o.contentLength,toolCallCount:o.toolCallCount,toolNames:o.toolNames,finishReason:o.finishReason})},m=await _({runtime:t,projectRoot:r,executionCwd:r,model:i,client:O(y.profile,y.apiKey),profile:"protocol-safe",approvalMode:a.config.approvalMode,onModelComplete:L});let g=!1,n="",l,c;try{const o=await m.buildInput(f.params.prompt);for await(const e of m.run({input:o.input,userInput:o.userInput,...o.workspaceContext===void 0?{}:{workspaceContext:o.workspaceContext},model:i,signal:R}))if(s.observe(e),e.type==="tool.called"&&t.logger.info("Agent tool called.",{toolName:e.toolName}),e.type==="tool.completed"&&t.logger.info("Agent tool completed.",{toolName:e.toolName,isError:e.isError}),e.type==="model.delta"&&e.content.length>0?(g=!0,n+=e.content,yield{type:"delta",content:e.content}):e.type==="session.completed"&&(l=e.content),e.type==="session.failed"){const p=b(e.error);if(p===void 0)throw e.error;c=T(p);break}if(c!==void 0){const e=n.length===0?c:`
2
+
3
+ ${c}`;g=!0,n+=e,l=n,yield{type:"delta",content:e}}const u=l===void 0||l.trim().length===0?n:l;if(u.trim().length===0){const e=s.snapshot();e.toolCalls>0&&s.markStuck();const p=e.toolCalls>0?d.MODEL_EMPTY_FINAL:d.MODEL_PROTOCOL_EMPTY_RESPONSE;throw new C(p,"Agent completed without a final text response.",{category:"model",userMessage:"The model completed without a final text response.",retryable:!0,details:{toolCalls:e.toolCalls,toolCompletions:e.toolCompletions,toolNames:e.toolNames,finishReason:e.lastFinishReason}})}g||(yield{type:"delta",content:u}),yield{type:"completed",content:u},t.logger.info("Protocol agent request completed.",{model:i})}finally{await m.close()}}).run(h,w)).errorCount===0?0:1}export{$ as runAgentCommand};