@lotagate/cli 0.1.22 → 0.1.23

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 (490) hide show
  1. package/package.json +7 -7
  2. package/scripts/install-native.mjs +11 -11
  3. package/dist/application/agent/agent-history.d.ts +0 -3
  4. package/dist/application/agent/agent-history.js +0 -81
  5. package/dist/application/agent/agent-input-context.d.ts +0 -9
  6. package/dist/application/agent/agent-input-context.js +0 -12
  7. package/dist/application/agent/agent-limit.d.ts +0 -3
  8. package/dist/application/agent/agent-limit.js +0 -12
  9. package/dist/application/agent/agent-run-tracker.d.ts +0 -30
  10. package/dist/application/agent/agent-run-tracker.js +0 -68
  11. package/dist/application/agent/agent-session-store.d.ts +0 -19
  12. package/dist/application/agent/agent-session-store.js +0 -74
  13. package/dist/application/agent/capability-profile.d.ts +0 -37
  14. package/dist/application/agent/capability-profile.js +0 -13
  15. package/dist/application/agent/cli-agent-execution-service.d.ts +0 -81
  16. package/dist/application/agent/cli-agent-execution-service.js +0 -279
  17. package/dist/application/agent/context-compaction-persistence.d.ts +0 -8
  18. package/dist/application/agent/context-compaction-persistence.js +0 -27
  19. package/dist/application/agent/context-compaction.d.ts +0 -20
  20. package/dist/application/agent/context-compaction.js +0 -114
  21. package/dist/application/agent/prompt-data-safety.d.ts +0 -14
  22. package/dist/application/agent/prompt-data-safety.js +0 -38
  23. package/dist/application/agent/safe-system-prompt.d.ts +0 -3
  24. package/dist/application/agent/safe-system-prompt.js +0 -19
  25. package/dist/application/agent/scoped-tool-executor.d.ts +0 -13
  26. package/dist/application/agent/scoped-tool-executor.js +0 -32
  27. package/dist/application/agent/system-prompt-builder.d.ts +0 -14
  28. package/dist/application/agent/system-prompt-builder.js +0 -199
  29. package/dist/application/agent/tool-catalog.d.ts +0 -14
  30. package/dist/application/agent/tool-catalog.js +0 -30
  31. package/dist/application/agent/tool-display.d.ts +0 -6
  32. package/dist/application/agent/tool-display.js +0 -59
  33. package/dist/application/agent/tool-hook-lifecycle.d.ts +0 -19
  34. package/dist/application/agent/tool-hook-lifecycle.js +0 -85
  35. package/dist/application/auth/authentication-service.d.ts +0 -20
  36. package/dist/application/auth/authentication-service.js +0 -44
  37. package/dist/application/chat/chat-service.d.ts +0 -12
  38. package/dist/application/chat/chat-service.js +0 -19
  39. package/dist/application/chat/pending-attachment-store.d.ts +0 -12
  40. package/dist/application/chat/pending-attachment-store.js +0 -28
  41. package/dist/application/commands/application-command-executor.d.ts +0 -20
  42. package/dist/application/commands/application-command-executor.js +0 -66
  43. package/dist/application/commands/cli-args.d.ts +0 -6
  44. package/dist/application/commands/cli-args.js +0 -43
  45. package/dist/application/commands/cli-command-services.d.ts +0 -16
  46. package/dist/application/commands/cli-command-services.js +0 -405
  47. package/dist/application/commands/command-catalog.d.ts +0 -6
  48. package/dist/application/commands/command-catalog.js +0 -159
  49. package/dist/application/commands/command-contract.d.ts +0 -58
  50. package/dist/application/commands/command-contract.js +0 -1
  51. package/dist/application/commands/command-hints.d.ts +0 -9
  52. package/dist/application/commands/command-hints.js +0 -17
  53. package/dist/application/commands/command-output.d.ts +0 -4
  54. package/dist/application/commands/command-output.js +0 -1
  55. package/dist/application/commands/command-parser.d.ts +0 -10
  56. package/dist/application/commands/command-parser.js +0 -155
  57. package/dist/application/commands/command-presentation.d.ts +0 -7
  58. package/dist/application/commands/command-presentation.js +0 -131
  59. package/dist/application/commands/command-registry.d.ts +0 -11
  60. package/dist/application/commands/command-registry.js +0 -64
  61. package/dist/application/commands/command-runtime.d.ts +0 -2
  62. package/dist/application/commands/command-runtime.js +0 -3
  63. package/dist/application/commands/goal-command-handlers.d.ts +0 -3
  64. package/dist/application/commands/goal-command-handlers.js +0 -120
  65. package/dist/application/commands/media-command-handlers.d.ts +0 -9
  66. package/dist/application/commands/media-command-handlers.js +0 -307
  67. package/dist/application/commands/media-command-output.d.ts +0 -11
  68. package/dist/application/commands/media-command-output.js +0 -8
  69. package/dist/application/commands/runtime-command-handlers.d.ts +0 -7
  70. package/dist/application/commands/runtime-command-handlers.js +0 -177
  71. package/dist/application/commands/stream-output.d.ts +0 -4
  72. package/dist/application/commands/stream-output.js +0 -10
  73. package/dist/application/commands/utility-commands.d.ts +0 -6
  74. package/dist/application/commands/utility-commands.js +0 -81
  75. package/dist/application/config/execution-config.d.ts +0 -4
  76. package/dist/application/config/execution-config.js +0 -6
  77. package/dist/application/extensions/extension-list-contract.d.ts +0 -13
  78. package/dist/application/extensions/extension-list-contract.js +0 -1
  79. package/dist/application/extensions/extension-list-formatters.d.ts +0 -31
  80. package/dist/application/extensions/extension-list-formatters.js +0 -98
  81. package/dist/application/extensions/extension-list-output.d.ts +0 -3
  82. package/dist/application/extensions/extension-list-output.js +0 -7
  83. package/dist/application/extensions/plugin-contribution-registry.d.ts +0 -15
  84. package/dist/application/extensions/plugin-contribution-registry.js +0 -80
  85. package/dist/application/extensions/skill-scope-store.d.ts +0 -23
  86. package/dist/application/extensions/skill-scope-store.js +0 -33
  87. package/dist/application/formatting/compact-number.d.ts +0 -2
  88. package/dist/application/formatting/compact-number.js +0 -18
  89. package/dist/application/formatting/compact-table.d.ts +0 -22
  90. package/dist/application/formatting/compact-table.js +0 -49
  91. package/dist/application/media/video-operation-poller.d.ts +0 -5
  92. package/dist/application/media/video-operation-poller.js +0 -42
  93. package/dist/application/model/cached-model-catalog.d.ts +0 -13
  94. package/dist/application/model/cached-model-catalog.js +0 -31
  95. package/dist/application/model/initial-model-selection.d.ts +0 -10
  96. package/dist/application/model/initial-model-selection.js +0 -11
  97. package/dist/application/model/model-catalog-service.d.ts +0 -6
  98. package/dist/application/model/model-catalog-service.js +0 -13
  99. package/dist/application/model/model-context-window.d.ts +0 -3
  100. package/dist/application/model/model-context-window.js +0 -23
  101. package/dist/application/orchestration/cli-subagent-service.d.ts +0 -70
  102. package/dist/application/orchestration/cli-subagent-service.js +0 -328
  103. package/dist/application/orchestration/cli-turn-event-projector.d.ts +0 -12
  104. package/dist/application/orchestration/cli-turn-event-projector.js +0 -81
  105. package/dist/application/orchestration/cli-turn-events.d.ts +0 -76
  106. package/dist/application/orchestration/cli-turn-events.js +0 -39
  107. package/dist/application/orchestration/cli-turn-persistence.d.ts +0 -6
  108. package/dist/application/orchestration/cli-turn-persistence.js +0 -14
  109. package/dist/application/orchestration/goal-evaluator.d.ts +0 -18
  110. package/dist/application/orchestration/goal-evaluator.js +0 -88
  111. package/dist/application/orchestration/goal-input.d.ts +0 -3
  112. package/dist/application/orchestration/goal-input.js +0 -19
  113. package/dist/application/orchestration/goal-output.d.ts +0 -2
  114. package/dist/application/orchestration/goal-output.js +0 -11
  115. package/dist/application/orchestration/goal-runner.d.ts +0 -22
  116. package/dist/application/orchestration/goal-runner.js +0 -153
  117. package/dist/application/orchestration/goal-usage.d.ts +0 -9
  118. package/dist/application/orchestration/goal-usage.js +0 -19
  119. package/dist/application/orchestration/headless-agent-turn.d.ts +0 -32
  120. package/dist/application/orchestration/headless-agent-turn.js +0 -82
  121. package/dist/application/orchestration/plan-generator.d.ts +0 -7
  122. package/dist/application/orchestration/plan-generator.js +0 -34
  123. package/dist/application/orchestration/subagent-coordinator.d.ts +0 -33
  124. package/dist/application/orchestration/subagent-coordinator.js +0 -28
  125. package/dist/application/orchestration/subagent-handoff.d.ts +0 -2
  126. package/dist/application/orchestration/subagent-handoff.js +0 -68
  127. package/dist/application/orchestration/subagent-tool-executor.d.ts +0 -12
  128. package/dist/application/orchestration/subagent-tool-executor.js +0 -93
  129. package/dist/application/orchestration/task-assessment.d.ts +0 -4
  130. package/dist/application/orchestration/task-assessment.js +0 -35
  131. package/dist/application/orchestration/task-graph.d.ts +0 -13
  132. package/dist/application/orchestration/task-graph.js +0 -56
  133. package/dist/application/orchestration/task-scheduler.d.ts +0 -18
  134. package/dist/application/orchestration/task-scheduler.js +0 -88
  135. package/dist/application/project/project-trust-service.d.ts +0 -13
  136. package/dist/application/project/project-trust-service.js +0 -74
  137. package/dist/application/protocol/browser-host-tool-executor.d.ts +0 -41
  138. package/dist/application/protocol/browser-host-tool-executor.js +0 -88
  139. package/dist/application/protocol/desktop-agent-command.d.ts +0 -9
  140. package/dist/application/protocol/desktop-agent-command.js +0 -663
  141. package/dist/application/protocol/desktop-attachment-store.d.ts +0 -16
  142. package/dist/application/protocol/desktop-attachment-store.js +0 -82
  143. package/dist/application/protocol/desktop-command-catalog.d.ts +0 -2
  144. package/dist/application/protocol/desktop-command-catalog.js +0 -19
  145. package/dist/application/protocol/desktop-command-contract.d.ts +0 -22
  146. package/dist/application/protocol/desktop-command-contract.js +0 -3
  147. package/dist/application/protocol/desktop-command-executor.d.ts +0 -16
  148. package/dist/application/protocol/desktop-command-executor.js +0 -47
  149. package/dist/application/protocol/desktop-command-output.d.ts +0 -15
  150. package/dist/application/protocol/desktop-command-output.js +0 -24
  151. package/dist/application/protocol/desktop-execution-policy.d.ts +0 -17
  152. package/dist/application/protocol/desktop-execution-policy.js +0 -49
  153. package/dist/application/protocol/desktop-host-tool-executor.d.ts +0 -57
  154. package/dist/application/protocol/desktop-host-tool-executor.js +0 -53
  155. package/dist/application/protocol/desktop-orchestration-events.d.ts +0 -5
  156. package/dist/application/protocol/desktop-orchestration-events.js +0 -37
  157. package/dist/application/protocol/json-line-writer.d.ts +0 -9
  158. package/dist/application/protocol/json-line-writer.js +0 -19
  159. package/dist/application/protocol/jsonl-agent-command.d.ts +0 -3
  160. package/dist/application/protocol/jsonl-agent-command.js +0 -97
  161. package/dist/application/protocol/jsonl-protocol.d.ts +0 -52
  162. package/dist/application/protocol/jsonl-protocol.js +0 -170
  163. package/dist/application/security/desktop-tool-scope-policy.d.ts +0 -3
  164. package/dist/application/security/desktop-tool-scope-policy.js +0 -52
  165. package/dist/application/security/tool-action-risk-analyzer.d.ts +0 -13
  166. package/dist/application/security/tool-action-risk-analyzer.js +0 -64
  167. package/dist/application/security/tool-approval-service.d.ts +0 -35
  168. package/dist/application/security/tool-approval-service.js +0 -97
  169. package/dist/application/security/tool-risk-classifier.d.ts +0 -11
  170. package/dist/application/security/tool-risk-classifier.js +0 -65
  171. package/dist/application/security/workspace-permission-policy.d.ts +0 -10
  172. package/dist/application/security/workspace-permission-policy.js +0 -50
  173. package/dist/application/session/project-session-access.d.ts +0 -8
  174. package/dist/application/session/project-session-access.js +0 -19
  175. package/dist/application/session/session-compaction-service.d.ts +0 -10
  176. package/dist/application/session/session-compaction-service.js +0 -43
  177. package/dist/application/session/session-turn-lifecycle.d.ts +0 -5
  178. package/dist/application/session/session-turn-lifecycle.js +0 -31
  179. package/dist/application/workspace/workspace-file-index.d.ts +0 -15
  180. package/dist/application/workspace/workspace-file-index.js +0 -60
  181. package/dist/application/workspace/workspace-file-reference-resolver.d.ts +0 -14
  182. package/dist/application/workspace/workspace-file-reference-resolver.js +0 -123
  183. package/dist/application/workspace/workspace-instruction-loader.d.ts +0 -8
  184. package/dist/application/workspace/workspace-instruction-loader.js +0 -55
  185. package/dist/bootstrap/composition-root.d.ts +0 -6
  186. package/dist/bootstrap/composition-root.js +0 -4
  187. package/dist/bootstrap/global-cli-options.d.ts +0 -6
  188. package/dist/bootstrap/global-cli-options.js +0 -29
  189. package/dist/bootstrap/native-devtools-stub.d.ts +0 -10
  190. package/dist/bootstrap/native-devtools-stub.js +0 -10
  191. package/dist/bootstrap/native-entry.d.ts +0 -1
  192. package/dist/bootstrap/native-entry.js +0 -6
  193. package/dist/bootstrap/native-tiktoken.d.ts +0 -4
  194. package/dist/bootstrap/native-tiktoken.js +0 -5
  195. package/dist/bootstrap/runtime-factory.d.ts +0 -35
  196. package/dist/bootstrap/runtime-factory.js +0 -44
  197. package/dist/bootstrap/shutdown-manager.d.ts +0 -10
  198. package/dist/bootstrap/shutdown-manager.js +0 -14
  199. package/dist/bootstrap/startup-sequence.d.ts +0 -5
  200. package/dist/bootstrap/startup-sequence.js +0 -10
  201. package/dist/domain/auth/auth-profile.d.ts +0 -14
  202. package/dist/domain/auth/auth-profile.js +0 -39
  203. package/dist/domain/config/config-schema.d.ts +0 -17
  204. package/dist/domain/config/config-schema.js +0 -105
  205. package/dist/domain/errors/cli-command-hint.d.ts +0 -5
  206. package/dist/domain/errors/cli-command-hint.js +0 -1
  207. package/dist/domain/errors/cli-error.d.ts +0 -35
  208. package/dist/domain/errors/cli-error.js +0 -129
  209. package/dist/domain/errors/error-codes.d.ts +0 -46
  210. package/dist/domain/errors/error-codes.js +0 -45
  211. package/dist/domain/extensions/extension-scope.d.ts +0 -3
  212. package/dist/domain/extensions/extension-scope.js +0 -23
  213. package/dist/domain/extensions/extension-state.d.ts +0 -5
  214. package/dist/domain/extensions/extension-state.js +0 -11
  215. package/dist/domain/extensions/hook-manifest.d.ts +0 -10
  216. package/dist/domain/extensions/hook-manifest.js +0 -23
  217. package/dist/domain/extensions/mcp-config.d.ts +0 -18
  218. package/dist/domain/extensions/mcp-config.js +0 -111
  219. package/dist/domain/extensions/plugin-manifest.d.ts +0 -11
  220. package/dist/domain/extensions/plugin-manifest.js +0 -43
  221. package/dist/domain/extensions/skill-manifest.d.ts +0 -10
  222. package/dist/domain/extensions/skill-manifest.js +0 -51
  223. package/dist/domain/filesystem/file-change-diff.d.ts +0 -21
  224. package/dist/domain/filesystem/file-change-diff.js +0 -60
  225. package/dist/domain/media/gateway-media-contract.d.ts +0 -23
  226. package/dist/domain/media/gateway-media-contract.js +0 -163
  227. package/dist/domain/media/media-contract.d.ts +0 -28
  228. package/dist/domain/media/media-contract.js +0 -1
  229. package/dist/domain/media/media-execution-policy.d.ts +0 -9
  230. package/dist/domain/media/media-execution-policy.js +0 -31
  231. package/dist/domain/orchestration/goal.d.ts +0 -58
  232. package/dist/domain/orchestration/goal.js +0 -113
  233. package/dist/domain/orchestration/subagent-identity.d.ts +0 -2
  234. package/dist/domain/orchestration/subagent-identity.js +0 -8
  235. package/dist/domain/orchestration/subagent.d.ts +0 -33
  236. package/dist/domain/orchestration/subagent.js +0 -1
  237. package/dist/domain/orchestration/task.d.ts +0 -31
  238. package/dist/domain/orchestration/task.js +0 -1
  239. package/dist/domain/project/project-identity.d.ts +0 -6
  240. package/dist/domain/project/project-identity.js +0 -4
  241. package/dist/domain/runtime/assistant-delta-normalizer.d.ts +0 -11
  242. package/dist/domain/runtime/assistant-delta-normalizer.js +0 -19
  243. package/dist/domain/runtime/resource-limits.d.ts +0 -60
  244. package/dist/domain/runtime/resource-limits.js +0 -60
  245. package/dist/domain/session/attachment.d.ts +0 -13
  246. package/dist/domain/session/attachment.js +0 -1
  247. package/dist/domain/session/session-schema.d.ts +0 -6
  248. package/dist/domain/session/session-schema.js +0 -28
  249. package/dist/domain/session/session.d.ts +0 -27
  250. package/dist/domain/session/session.js +0 -1
  251. package/dist/domain/settings/settings-document.d.ts +0 -8
  252. package/dist/domain/settings/settings-document.js +0 -36
  253. package/dist/domain/validation/record-schema.d.ts +0 -4
  254. package/dist/domain/validation/record-schema.js +0 -9
  255. package/dist/domain/workspace/workspace-settings.d.ts +0 -12
  256. package/dist/domain/workspace/workspace-settings.js +0 -44
  257. package/dist/infrastructure/agent-sdk/agent-instance-factory.d.ts +0 -22
  258. package/dist/infrastructure/agent-sdk/agent-instance-factory.js +0 -31
  259. package/dist/infrastructure/agent-sdk/tool-calling-model-client.d.ts +0 -11
  260. package/dist/infrastructure/agent-sdk/tool-calling-model-client.js +0 -447
  261. package/dist/infrastructure/cache/cache-policy.d.ts +0 -7
  262. package/dist/infrastructure/cache/cache-policy.js +0 -18
  263. package/dist/infrastructure/cache/file-cache-store.d.ts +0 -17
  264. package/dist/infrastructure/cache/file-cache-store.js +0 -121
  265. package/dist/infrastructure/clipboard/clipboard-adapter-factory.d.ts +0 -11
  266. package/dist/infrastructure/clipboard/clipboard-adapter-factory.js +0 -98
  267. package/dist/infrastructure/clipboard/clipboard-policy.d.ts +0 -8
  268. package/dist/infrastructure/clipboard/clipboard-policy.js +0 -19
  269. package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.d.ts +0 -10
  270. package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.js +0 -94
  271. package/dist/infrastructure/clipboard/image-normalizer.d.ts +0 -12
  272. package/dist/infrastructure/clipboard/image-normalizer.js +0 -78
  273. package/dist/infrastructure/clipboard/windows-clipboard-adapter.d.ts +0 -7
  274. package/dist/infrastructure/clipboard/windows-clipboard-adapter.js +0 -66
  275. package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.d.ts +0 -7
  276. package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.js +0 -70
  277. package/dist/infrastructure/config/config-loader.d.ts +0 -19
  278. package/dist/infrastructure/config/config-loader.js +0 -76
  279. package/dist/infrastructure/config/environment-values.d.ts +0 -2
  280. package/dist/infrastructure/config/environment-values.js +0 -7
  281. package/dist/infrastructure/credentials/composite-credential-store.d.ts +0 -11
  282. package/dist/infrastructure/credentials/composite-credential-store.js +0 -32
  283. package/dist/infrastructure/credentials/encrypted-file-credential-store.d.ts +0 -17
  284. package/dist/infrastructure/credentials/encrypted-file-credential-store.js +0 -181
  285. package/dist/infrastructure/credentials/environment-credential-store.d.ts +0 -11
  286. package/dist/infrastructure/credentials/environment-credential-store.js +0 -37
  287. package/dist/infrastructure/credentials/secret-input.d.ts +0 -7
  288. package/dist/infrastructure/credentials/secret-input.js +0 -44
  289. package/dist/infrastructure/extensions/composite-mcp-config-store.d.ts +0 -9
  290. package/dist/infrastructure/extensions/composite-mcp-config-store.js +0 -10
  291. package/dist/infrastructure/extensions/extension-directory-reader.d.ts +0 -2
  292. package/dist/infrastructure/extensions/extension-directory-reader.js +0 -15
  293. package/dist/infrastructure/extensions/extension-source-resolver.d.ts +0 -6
  294. package/dist/infrastructure/extensions/extension-source-resolver.js +0 -126
  295. package/dist/infrastructure/extensions/file-mcp-config-store.d.ts +0 -15
  296. package/dist/infrastructure/extensions/file-mcp-config-store.js +0 -66
  297. package/dist/infrastructure/extensions/hook-runtime.d.ts +0 -18
  298. package/dist/infrastructure/extensions/hook-runtime.js +0 -66
  299. package/dist/infrastructure/extensions/mcp-runtime.d.ts +0 -12
  300. package/dist/infrastructure/extensions/mcp-runtime.js +0 -52
  301. package/dist/infrastructure/extensions/plugin-discovery.d.ts +0 -5
  302. package/dist/infrastructure/extensions/plugin-discovery.js +0 -52
  303. package/dist/infrastructure/extensions/plugin-manager.d.ts +0 -26
  304. package/dist/infrastructure/extensions/plugin-manager.js +0 -139
  305. package/dist/infrastructure/extensions/skill-discovery.d.ts +0 -4
  306. package/dist/infrastructure/extensions/skill-discovery.js +0 -29
  307. package/dist/infrastructure/extensions/skill-installer.d.ts +0 -8
  308. package/dist/infrastructure/extensions/skill-installer.js +0 -88
  309. package/dist/infrastructure/extensions/skill-manager.d.ts +0 -22
  310. package/dist/infrastructure/extensions/skill-manager.js +0 -67
  311. package/dist/infrastructure/extensions/skill-roots.d.ts +0 -19
  312. package/dist/infrastructure/extensions/skill-roots.js +0 -25
  313. package/dist/infrastructure/extensions/skill-tool-executor.d.ts +0 -18
  314. package/dist/infrastructure/extensions/skill-tool-executor.js +0 -53
  315. package/dist/infrastructure/filesystem/atomic-file-store.d.ts +0 -12
  316. package/dist/infrastructure/filesystem/atomic-file-store.js +0 -106
  317. package/dist/infrastructure/filesystem/bounded-file-reader.d.ts +0 -6
  318. package/dist/infrastructure/filesystem/bounded-file-reader.js +0 -24
  319. package/dist/infrastructure/filesystem/bounded-json-reader.d.ts +0 -1
  320. package/dist/infrastructure/filesystem/bounded-json-reader.js +0 -7
  321. package/dist/infrastructure/filesystem/fs-errors.d.ts +0 -2
  322. package/dist/infrastructure/filesystem/fs-errors.js +0 -6
  323. package/dist/infrastructure/filesystem/gateway-media-input-reader.d.ts +0 -12
  324. package/dist/infrastructure/filesystem/gateway-media-input-reader.js +0 -49
  325. package/dist/infrastructure/filesystem/local-filesystem-tool-executor.d.ts +0 -21
  326. package/dist/infrastructure/filesystem/local-filesystem-tool-executor.js +0 -176
  327. package/dist/infrastructure/filesystem/path-resolver.d.ts +0 -20
  328. package/dist/infrastructure/filesystem/path-resolver.js +0 -119
  329. package/dist/infrastructure/filesystem/workspace-media-artifact-store.d.ts +0 -13
  330. package/dist/infrastructure/filesystem/workspace-media-artifact-store.js +0 -152
  331. package/dist/infrastructure/logging/daily-rotating-file-writer.d.ts +0 -20
  332. package/dist/infrastructure/logging/daily-rotating-file-writer.js +0 -75
  333. package/dist/infrastructure/logging/log-redactor.d.ts +0 -2
  334. package/dist/infrastructure/logging/log-redactor.js +0 -26
  335. package/dist/infrastructure/logging/logging-policy.d.ts +0 -6
  336. package/dist/infrastructure/logging/logging-policy.js +0 -6
  337. package/dist/infrastructure/logging/structured-logger.d.ts +0 -24
  338. package/dist/infrastructure/logging/structured-logger.js +0 -40
  339. package/dist/infrastructure/network/safe-media-downloader.d.ts +0 -23
  340. package/dist/infrastructure/network/safe-media-downloader.js +0 -239
  341. package/dist/infrastructure/platform/host-platform.d.ts +0 -14
  342. package/dist/infrastructure/platform/host-platform.js +0 -23
  343. package/dist/infrastructure/platform/host-process.d.ts +0 -17
  344. package/dist/infrastructure/platform/host-process.js +0 -116
  345. package/dist/infrastructure/platform/platform-paths.d.ts +0 -25
  346. package/dist/infrastructure/platform/platform-paths.js +0 -33
  347. package/dist/infrastructure/project/file-project-trust-store.d.ts +0 -12
  348. package/dist/infrastructure/project/file-project-trust-store.js +0 -59
  349. package/dist/infrastructure/sdk/chat-completion-adapter.d.ts +0 -8
  350. package/dist/infrastructure/sdk/chat-completion-adapter.js +0 -115
  351. package/dist/infrastructure/sdk/lotagate-client-factory.d.ts +0 -3
  352. package/dist/infrastructure/sdk/lotagate-client-factory.js +0 -8
  353. package/dist/infrastructure/sdk/model-catalog-adapter.d.ts +0 -19
  354. package/dist/infrastructure/sdk/model-catalog-adapter.js +0 -28
  355. package/dist/infrastructure/sdk/sdk-media-gateway-client.d.ts +0 -20
  356. package/dist/infrastructure/sdk/sdk-media-gateway-client.js +0 -97
  357. package/dist/infrastructure/sessions/file-goal-store.d.ts +0 -21
  358. package/dist/infrastructure/sessions/file-goal-store.js +0 -160
  359. package/dist/infrastructure/sessions/file-session-store.d.ts +0 -48
  360. package/dist/infrastructure/sessions/file-session-store.js +0 -525
  361. package/dist/infrastructure/sessions/project-session-paths.d.ts +0 -17
  362. package/dist/infrastructure/sessions/project-session-paths.js +0 -41
  363. package/dist/infrastructure/sessions/session-index.d.ts +0 -16
  364. package/dist/infrastructure/sessions/session-index.js +0 -84
  365. package/dist/infrastructure/sessions/session-journal.d.ts +0 -22
  366. package/dist/infrastructure/sessions/session-journal.js +0 -137
  367. package/dist/infrastructure/sessions/subagent-journal-store.d.ts +0 -28
  368. package/dist/infrastructure/sessions/subagent-journal-store.js +0 -30
  369. package/dist/infrastructure/shell/shell-tool-executor.d.ts +0 -17
  370. package/dist/infrastructure/shell/shell-tool-executor.js +0 -115
  371. package/dist/infrastructure/tokens/tiktoken-token-estimator.d.ts +0 -18
  372. package/dist/infrastructure/tokens/tiktoken-token-estimator.js +0 -48
  373. package/dist/infrastructure/workspace/workspace-settings-store.d.ts +0 -9
  374. package/dist/infrastructure/workspace/workspace-settings-store.js +0 -75
  375. package/dist/main.d.ts +0 -7
  376. package/dist/main.js +0 -66
  377. package/dist/ports/cache-store.d.ts +0 -10
  378. package/dist/ports/cache-store.js +0 -1
  379. package/dist/ports/chat-model.d.ts +0 -30
  380. package/dist/ports/chat-model.js +0 -1
  381. package/dist/ports/clipboard-adapter.d.ts +0 -7
  382. package/dist/ports/clipboard-adapter.js +0 -1
  383. package/dist/ports/clipboard-text-adapter.d.ts +0 -3
  384. package/dist/ports/clipboard-text-adapter.js +0 -1
  385. package/dist/ports/credential-store.d.ts +0 -7
  386. package/dist/ports/credential-store.js +0 -1
  387. package/dist/ports/goal-store.d.ts +0 -12
  388. package/dist/ports/goal-store.js +0 -1
  389. package/dist/ports/logger.d.ts +0 -8
  390. package/dist/ports/logger.js +0 -1
  391. package/dist/ports/media-gateway-client.d.ts +0 -54
  392. package/dist/ports/media-gateway-client.js +0 -1
  393. package/dist/ports/model-diagnostics.d.ts +0 -17
  394. package/dist/ports/model-diagnostics.js +0 -1
  395. package/dist/ports/project-trust-store.d.ts +0 -12
  396. package/dist/ports/project-trust-store.js +0 -1
  397. package/dist/ports/session-store.d.ts +0 -58
  398. package/dist/ports/session-store.js +0 -1
  399. package/dist/ports/subagent-lifecycle.d.ts +0 -31
  400. package/dist/ports/subagent-lifecycle.js +0 -1
  401. package/dist/ports/tool-activity.d.ts +0 -13
  402. package/dist/ports/tool-activity.js +0 -1
  403. package/dist/presentation/themes/theme.d.ts +0 -19
  404. package/dist/presentation/themes/theme.js +0 -8
  405. package/dist/presentation/tui/agent-initialization-renderer.d.ts +0 -4
  406. package/dist/presentation/tui/agent-initialization-renderer.js +0 -37
  407. package/dist/presentation/tui/context-display.d.ts +0 -21
  408. package/dist/presentation/tui/context-display.js +0 -33
  409. package/dist/presentation/tui/formatters.d.ts +0 -6
  410. package/dist/presentation/tui/formatters.js +0 -60
  411. package/dist/presentation/tui/ink/choice-window.d.ts +0 -5
  412. package/dist/presentation/tui/ink/choice-window.js +0 -5
  413. package/dist/presentation/tui/ink/components/activity-entry.d.ts +0 -6
  414. package/dist/presentation/tui/ink/components/activity-entry.js +0 -16
  415. package/dist/presentation/tui/ink/components/activity-status.d.ts +0 -10
  416. package/dist/presentation/tui/ink/components/activity-status.js +0 -21
  417. package/dist/presentation/tui/ink/components/choice-modal.d.ts +0 -11
  418. package/dist/presentation/tui/ink/components/choice-modal.js +0 -29
  419. package/dist/presentation/tui/ink/components/composer.d.ts +0 -40
  420. package/dist/presentation/tui/ink/components/composer.js +0 -271
  421. package/dist/presentation/tui/ink/components/file-diff.d.ts +0 -6
  422. package/dist/presentation/tui/ink/components/file-diff.js +0 -34
  423. package/dist/presentation/tui/ink/components/modal.d.ts +0 -8
  424. package/dist/presentation/tui/ink/components/modal.js +0 -110
  425. package/dist/presentation/tui/ink/components/shimmer-text.d.ts +0 -6
  426. package/dist/presentation/tui/ink/components/shimmer-text.js +0 -9
  427. package/dist/presentation/tui/ink/components/subagent-activity.d.ts +0 -11
  428. package/dist/presentation/tui/ink/components/subagent-activity.js +0 -61
  429. package/dist/presentation/tui/ink/components/transcript.d.ts +0 -39
  430. package/dist/presentation/tui/ink/components/transcript.js +0 -121
  431. package/dist/presentation/tui/ink/components/welcome-panel.d.ts +0 -6
  432. package/dist/presentation/tui/ink/components/welcome-panel.js +0 -20
  433. package/dist/presentation/tui/ink/lotagate-tui.d.ts +0 -6
  434. package/dist/presentation/tui/ink/lotagate-tui.js +0 -136
  435. package/dist/presentation/tui/ink/markdown-inline-renderer.d.ts +0 -4
  436. package/dist/presentation/tui/ink/markdown-inline-renderer.js +0 -20
  437. package/dist/presentation/tui/ink/markdown-inline.d.ts +0 -13
  438. package/dist/presentation/tui/ink/markdown-inline.js +0 -91
  439. package/dist/presentation/tui/ink/markdown-message.d.ts +0 -6
  440. package/dist/presentation/tui/ink/markdown-message.js +0 -66
  441. package/dist/presentation/tui/ink/markdown-table.d.ts +0 -16
  442. package/dist/presentation/tui/ink/markdown-table.js +0 -77
  443. package/dist/presentation/tui/ink/tui-bridge.d.ts +0 -195
  444. package/dist/presentation/tui/ink/tui-bridge.js +0 -289
  445. package/dist/presentation/tui/terminal-capabilities.d.ts +0 -15
  446. package/dist/presentation/tui/terminal-capabilities.js +0 -7
  447. package/dist/presentation/tui/terminal-mouse.d.ts +0 -5
  448. package/dist/presentation/tui/terminal-mouse.js +0 -19
  449. package/dist/presentation/tui/terminal-screen.d.ts +0 -10
  450. package/dist/presentation/tui/terminal-screen.js +0 -23
  451. package/dist/presentation/tui/tui-agent-event-runner.d.ts +0 -24
  452. package/dist/presentation/tui/tui-agent-event-runner.js +0 -69
  453. package/dist/presentation/tui/tui-application-contract.d.ts +0 -10
  454. package/dist/presentation/tui/tui-application-contract.js +0 -8
  455. package/dist/presentation/tui/tui-application.d.ts +0 -62
  456. package/dist/presentation/tui/tui-application.js +0 -675
  457. package/dist/presentation/tui/tui-attachment-input.d.ts +0 -2
  458. package/dist/presentation/tui/tui-attachment-input.js +0 -5
  459. package/dist/presentation/tui/tui-clipboard-paste-handlers.d.ts +0 -11
  460. package/dist/presentation/tui/tui-clipboard-paste-handlers.js +0 -25
  461. package/dist/presentation/tui/tui-command-context.d.ts +0 -3
  462. package/dist/presentation/tui/tui-command-context.js +0 -1
  463. package/dist/presentation/tui/tui-command-executor.d.ts +0 -38
  464. package/dist/presentation/tui/tui-command-executor.js +0 -214
  465. package/dist/presentation/tui/tui-command-host-factory.d.ts +0 -40
  466. package/dist/presentation/tui/tui-command-host-factory.js +0 -23
  467. package/dist/presentation/tui/tui-context-compaction.d.ts +0 -5
  468. package/dist/presentation/tui/tui-context-compaction.js +0 -22
  469. package/dist/presentation/tui/tui-context-service.d.ts +0 -34
  470. package/dist/presentation/tui/tui-context-service.js +0 -126
  471. package/dist/presentation/tui/tui-file-suggestions.d.ts +0 -3
  472. package/dist/presentation/tui/tui-file-suggestions.js +0 -8
  473. package/dist/presentation/tui/tui-goal-controller.d.ts +0 -14
  474. package/dist/presentation/tui/tui-goal-controller.js +0 -52
  475. package/dist/presentation/tui/tui-initial-model.d.ts +0 -3
  476. package/dist/presentation/tui/tui-initial-model.js +0 -28
  477. package/dist/presentation/tui/tui-lifecycle-actions.d.ts +0 -13
  478. package/dist/presentation/tui/tui-lifecycle-actions.js +0 -45
  479. package/dist/presentation/tui/tui-manual-compaction.d.ts +0 -18
  480. package/dist/presentation/tui/tui-manual-compaction.js +0 -31
  481. package/dist/presentation/tui/tui-media-model-selection.d.ts +0 -12
  482. package/dist/presentation/tui/tui-media-model-selection.js +0 -38
  483. package/dist/presentation/tui/tui-prompt-dispatcher.d.ts +0 -16
  484. package/dist/presentation/tui/tui-prompt-dispatcher.js +0 -38
  485. package/dist/presentation/tui/tui-skill-controller.d.ts +0 -11
  486. package/dist/presentation/tui/tui-skill-controller.js +0 -13
  487. package/dist/presentation/tui/tui-tool-approval.d.ts +0 -22
  488. package/dist/presentation/tui/tui-tool-approval.js +0 -73
  489. package/dist/version.d.ts +0 -1
  490. package/dist/version.js +0 -1
@@ -1,52 +0,0 @@
1
- import type { Readable, Writable } from 'node:stream';
2
- export declare const JSONL_PROTOCOL_VERSION: 1;
3
- export interface JsonlExecRequest {
4
- version: typeof JSONL_PROTOCOL_VERSION;
5
- id: string;
6
- method: 'exec';
7
- params: {
8
- prompt: string;
9
- model?: string;
10
- };
11
- }
12
- export interface JsonlCancelRequest {
13
- version: typeof JSONL_PROTOCOL_VERSION;
14
- id: string;
15
- method: 'cancel';
16
- params: {
17
- requestId: string;
18
- };
19
- }
20
- export type JsonlRequest = JsonlExecRequest | JsonlCancelRequest;
21
- export interface JsonlErrorPayload {
22
- code: string;
23
- category: string;
24
- message: string;
25
- retryable: boolean;
26
- }
27
- export type JsonlEvent = {
28
- version: typeof JSONL_PROTOCOL_VERSION;
29
- id: string;
30
- type: 'started' | 'delta' | 'completed' | 'error';
31
- content?: string;
32
- error?: JsonlErrorPayload;
33
- };
34
- export interface JsonlProtocolOptions {
35
- maxLineBytes?: number;
36
- maxInFlight?: number;
37
- }
38
- export interface JsonlProtocolResult {
39
- errorCount: number;
40
- }
41
- export type JsonlExecutor = (request: JsonlExecRequest, signal: AbortSignal) => AsyncIterable<{
42
- type: 'delta' | 'completed';
43
- content?: string;
44
- }>;
45
- export declare class JsonlProtocolRunner {
46
- private readonly executor;
47
- private readonly options;
48
- constructor(executor: JsonlExecutor, options?: JsonlProtocolOptions);
49
- run(input: Readable, output: Writable): Promise<JsonlProtocolResult>;
50
- private executeOne;
51
- }
52
- export declare function readLinesBounded(input: Readable, maxBytes: number): AsyncGenerator<string>;
@@ -1,170 +0,0 @@
1
- import { once } from 'node:events';
2
- import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
3
- export const JSONL_PROTOCOL_VERSION = 1;
4
- export class JsonlProtocolRunner {
5
- executor;
6
- options;
7
- constructor(executor, options = {}) {
8
- this.executor = executor;
9
- this.options = options;
10
- }
11
- async run(input, output) {
12
- const controllers = new Map();
13
- const active = new Set();
14
- const maxLineBytes = this.options.maxLineBytes ?? RESOURCE_LIMITS.jsonlLineBytes;
15
- const maxInFlight = this.options.maxInFlight ?? RESOURCE_LIMITS.jsonlMaxInFlight;
16
- let errorCount = 0;
17
- try {
18
- for await (const line of readLinesBounded(input, maxLineBytes)) {
19
- if (Buffer.byteLength(line, 'utf8') > maxLineBytes) {
20
- errorCount += 1;
21
- await writeJsonl(output, errorEvent('unknown', protocolError('JSONL_REQUEST_TOO_LARGE', 'Request line exceeds the maximum size.')));
22
- continue;
23
- }
24
- let request;
25
- try {
26
- request = parseRequest(JSON.parse(line));
27
- }
28
- catch (error) {
29
- errorCount += 1;
30
- await writeJsonl(output, errorEvent('unknown', toJsonlError(error)));
31
- continue;
32
- }
33
- if (request.method === 'cancel') {
34
- controllers.get(request.params.requestId)?.abort();
35
- continue;
36
- }
37
- if (controllers.has(request.id)) {
38
- errorCount += 1;
39
- await writeJsonl(output, errorEvent(request.id, protocolError('JSONL_DUPLICATE_REQUEST', 'Request id is already in flight.')));
40
- continue;
41
- }
42
- if (active.size >= maxInFlight) {
43
- errorCount += 1;
44
- await writeJsonl(output, errorEvent(request.id, protocolError('JSONL_OVERLOADED', 'Too many in-flight requests.', true)));
45
- continue;
46
- }
47
- const controller = new AbortController();
48
- controllers.set(request.id, controller);
49
- const operation = this.executeOne(request, controller.signal, output).then((succeeded) => { if (!succeeded)
50
- errorCount += 1; }).finally(() => { controllers.delete(request.id); active.delete(operation); });
51
- active.add(operation);
52
- }
53
- await Promise.allSettled(active);
54
- }
55
- catch (error) {
56
- if (!(error instanceof JsonlLimitError))
57
- throw error;
58
- errorCount += 1;
59
- await writeJsonl(output, errorEvent('unknown', toJsonlError(error)));
60
- }
61
- finally {
62
- for (const controller of controllers.values())
63
- controller.abort();
64
- await Promise.allSettled([...active]);
65
- }
66
- return { errorCount };
67
- }
68
- async executeOne(request, signal, output) {
69
- try {
70
- await writeJsonl(output, { version: JSONL_PROTOCOL_VERSION, id: request.id, type: 'started' });
71
- for await (const event of this.executor(request, signal))
72
- await writeJsonl(output, { version: JSONL_PROTOCOL_VERSION, id: request.id, type: event.type, ...(event.content === undefined ? {} : { content: event.content }) });
73
- return true;
74
- }
75
- catch (error) {
76
- await writeJsonl(output, errorEvent(request.id, toJsonlError(error)));
77
- return false;
78
- }
79
- }
80
- }
81
- function parseRequest(value) {
82
- if (typeof value !== 'object' || value === null)
83
- throw invalidRequest('Request must be an object.');
84
- const record = value;
85
- if (record['version'] !== 1 || typeof record['id'] !== 'string' || record['id'].length === 0 || Buffer.byteLength(record['id'], 'utf8') > RESOURCE_LIMITS.jsonlIdBytes || typeof record['method'] !== 'string' || typeof record['params'] !== 'object' || record['params'] === null)
86
- throw invalidRequest('Invalid JSONL request envelope.');
87
- if (record['method'] === 'cancel') {
88
- const params = record['params'];
89
- if (typeof params['requestId'] !== 'string' || params['requestId'].length === 0 || Buffer.byteLength(params['requestId'], 'utf8') > RESOURCE_LIMITS.jsonlIdBytes)
90
- throw invalidRequest('Invalid cancel request.');
91
- return { version: JSONL_PROTOCOL_VERSION, id: record['id'], method: 'cancel', params: { requestId: params['requestId'] } };
92
- }
93
- if (record['method'] !== 'exec')
94
- throw invalidRequest('Unsupported JSONL method.');
95
- const params = record['params'];
96
- if (typeof params['prompt'] !== 'string' || params['prompt'].trim().length === 0 || Buffer.byteLength(params['prompt'], 'utf8') > RESOURCE_LIMITS.jsonlPromptBytes || (params['model'] !== undefined && (typeof params['model'] !== 'string' || Buffer.byteLength(params['model'], 'utf8') > RESOURCE_LIMITS.jsonlIdBytes)))
97
- throw invalidRequest('Invalid exec params.');
98
- return { version: JSONL_PROTOCOL_VERSION, id: record['id'], method: 'exec', params: { prompt: params['prompt'], ...(params['model'] === undefined ? {} : { model: params['model'] }) } };
99
- }
100
- async function writeJsonl(output, event) {
101
- if (output.write(`${JSON.stringify(event)}\n`))
102
- return;
103
- await once(output, 'drain');
104
- }
105
- function errorEvent(id, error) {
106
- return { version: JSONL_PROTOCOL_VERSION, id, type: 'error', error };
107
- }
108
- function invalidRequest(message) {
109
- return new JsonlProtocolError(protocolError('JSONL_INVALID_REQUEST', message));
110
- }
111
- function protocolError(code, message, retryable = false) {
112
- return { code, category: 'protocol', message, retryable };
113
- }
114
- function toJsonlError(error) {
115
- if (error instanceof JsonlProtocolError)
116
- return error.payload;
117
- if (isCliErrorLike(error)) {
118
- return {
119
- code: error.code,
120
- category: error.category,
121
- message: error.userMessage,
122
- retryable: error.retryable,
123
- };
124
- }
125
- return protocolError('CLI_INTERNAL_ERROR', 'The request could not be completed. Retry the request or inspect CLI diagnostics.', true);
126
- }
127
- function isCliErrorLike(value) {
128
- if (typeof value !== 'object' || value === null)
129
- return false;
130
- const error = value;
131
- return typeof error['code'] === 'string' && typeof error['category'] === 'string' && typeof error['userMessage'] === 'string' && typeof error['retryable'] === 'boolean';
132
- }
133
- class JsonlProtocolError extends Error {
134
- payload;
135
- constructor(payload) {
136
- super(payload.message);
137
- this.payload = payload;
138
- }
139
- }
140
- class JsonlLimitError extends JsonlProtocolError {
141
- constructor(message) { super(protocolError('JSONL_REQUEST_TOO_LARGE', message)); }
142
- }
143
- export async function* readLinesBounded(input, maxBytes) {
144
- let parts = [];
145
- let lineBytes = 0;
146
- for await (const chunk of input) {
147
- const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
148
- let start = 0;
149
- while (start < buffer.byteLength) {
150
- const newline = buffer.indexOf(0x0a, start);
151
- const end = newline < 0 ? buffer.byteLength : newline;
152
- const segment = buffer.subarray(start, end);
153
- if (lineBytes + segment.byteLength > maxBytes)
154
- throw new JsonlLimitError('Request line exceeds the maximum size.');
155
- if (segment.byteLength > 0)
156
- parts.push(segment);
157
- lineBytes += segment.byteLength;
158
- if (newline < 0)
159
- break;
160
- const line = Buffer.concat(parts, lineBytes);
161
- const content = line[line.byteLength - 1] === 0x0d ? line.subarray(0, line.byteLength - 1) : line;
162
- yield content.toString('utf8');
163
- parts = [];
164
- lineBytes = 0;
165
- start = newline + 1;
166
- }
167
- }
168
- if (lineBytes > 0)
169
- yield Buffer.concat(parts, lineBytes).toString('utf8');
170
- }
@@ -1,3 +0,0 @@
1
- import type { ToolApprovalRequest } from '@lotagate/agent-sdk';
2
- /** Matches Desktop's stable capability scopes against concrete CLI requests. */
3
- export declare function matchesDesktopToolScope(request: ToolApprovalRequest, scopes: readonly string[]): boolean;
@@ -1,52 +0,0 @@
1
- import { isReadOnlyShellRequest } from './tool-risk-classifier.js';
2
- /** Matches Desktop's stable capability scopes against concrete CLI requests. */
3
- export function matchesDesktopToolScope(request, scopes) {
4
- return scopes.some((scope) => matchesScope(scope, request));
5
- }
6
- function matchesScope(scope, request) {
7
- const toolName = request.toolName;
8
- if (scope === toolName)
9
- return true;
10
- if (scope === 'filesystem.read')
11
- return toolName === 'filesystem.read' || toolName === 'filesystem.list' || toolName === 'filesystem.exists';
12
- if (scope === 'filesystem.write')
13
- return toolName === 'filesystem.write';
14
- if (toolName !== 'shell.exec')
15
- return matchesBrowserScope(scope, toolName);
16
- const command = shellCommand(request.input);
17
- const args = shellArgs(request.input);
18
- if (command === undefined || args === undefined)
19
- return false;
20
- if (scope === 'terminal.read')
21
- return isReadOnlyShellRequest(command, args);
22
- if (scope === 'terminal.execute')
23
- return true;
24
- if (!isGitCommand(command, args))
25
- return false;
26
- const subcommand = gitSubcommand(args);
27
- if (scope === 'git.read')
28
- return subcommand !== undefined && READ_ONLY_GIT_COMMANDS.has(subcommand) && isReadOnlyShellRequest(command, args);
29
- if (scope === 'git.stage')
30
- return subcommand === 'add';
31
- if (scope === 'git.commit')
32
- return subcommand === 'commit';
33
- if (scope === 'git.push')
34
- return subcommand === 'push';
35
- return false;
36
- }
37
- function matchesBrowserScope(scope, toolName) {
38
- if (!toolName.startsWith('browser.'))
39
- return false;
40
- if (scope === 'browser.navigate')
41
- return ['browser.navigate', 'browser.back', 'browser.forward', 'browser.reload'].includes(toolName);
42
- if (scope === 'browser.inspect')
43
- return ['browser.inspect', 'browser.inspectElement', 'browser.console', 'browser.network', 'browser.accessibility', 'browser.setViewport', 'browser.resetViewport', 'browser.screenshot', 'browser.tabs', 'browser.readField'].includes(toolName);
44
- if (scope === 'browser.interact')
45
- return !['browser.navigate', 'browser.inspect', 'browser.inspectElement', 'browser.console', 'browser.network', 'browser.accessibility', 'browser.setViewport', 'browser.resetViewport', 'browser.screenshot', 'browser.tabs', 'browser.readField'].includes(toolName);
46
- return false;
47
- }
48
- function shellCommand(input) { return typeof input['command'] === 'string' ? input['command'].trim() : undefined; }
49
- function shellArgs(input) { const args = input['args']; return Array.isArray(args) && args.every((value) => typeof value === 'string') ? args : undefined; }
50
- function isGitCommand(command, args) { return (command.split(/[\\/]/u).at(-1) ?? '').replace(/\.(?:exe|cmd|bat)$/iu, '').toLowerCase() === 'git' && gitSubcommand(args) !== undefined; }
51
- function gitSubcommand(args) { return args.find((value) => !value.startsWith('-'))?.toLowerCase(); }
52
- const READ_ONLY_GIT_COMMANDS = new Set(['status', 'diff', 'log', 'show', 'branch', 'tag', 'remote', 'rev-parse', 'ls-files']);
@@ -1,13 +0,0 @@
1
- import type { ToolApprovalRequest } from '@lotagate/agent-sdk';
2
- export type ToolActionRisk = 'review' | 'deny';
3
- export interface ToolActionRiskAssessment {
4
- risk: ToolActionRisk;
5
- category: 'sensitive-target' | 'download-and-execute' | 'credential-exfiltration' | 'hidden-control-data';
6
- reason: string;
7
- }
8
- /**
9
- * Performs a small, deterministic preflight at the CLI action boundary.
10
- * This is intentionally additive: the approval policy remains authoritative,
11
- * and the analyzer never treats a model-provided description as permission.
12
- */
13
- export declare function assessToolAction(request: ToolApprovalRequest): ToolActionRiskAssessment | undefined;
@@ -1,64 +0,0 @@
1
- /**
2
- * Performs a small, deterministic preflight at the CLI action boundary.
3
- * This is intentionally additive: the approval policy remains authoritative,
4
- * and the analyzer never treats a model-provided description as permission.
5
- */
6
- export function assessToolAction(request) {
7
- const target = typeof request.input['path'] === 'string' ? request.input['path'].trim() : undefined;
8
- if (target !== undefined && isSensitiveTarget(target)) {
9
- return { risk: 'review', category: 'sensitive-target', reason: 'sensitive-target-review' };
10
- }
11
- const commandLine = shellCommandLine(request);
12
- if (commandLine !== undefined) {
13
- if (DOWNLOAD_AND_EXECUTE.test(commandLine))
14
- return { risk: 'review', category: 'download-and-execute', reason: 'download-and-execute-review' };
15
- if (CREDENTIAL_EXFILTRATION.test(commandLine))
16
- return { risk: 'deny', category: 'credential-exfiltration', reason: 'credential-exfiltration-deny' };
17
- }
18
- if (containsHiddenControlData(request))
19
- return { risk: 'review', category: 'hidden-control-data', reason: 'hidden-control-data-review' };
20
- return undefined;
21
- }
22
- function shellCommandLine(request) {
23
- if (request.toolName !== 'shell.exec')
24
- return undefined;
25
- const command = request.input['command'];
26
- const args = request.input['args'];
27
- if (typeof command !== 'string' || !Array.isArray(args) || args.some((value) => typeof value !== 'string'))
28
- return undefined;
29
- return [command, ...args].join(' ');
30
- }
31
- function isSensitiveTarget(target) {
32
- const normalized = target.replace(/\\/gu, '/').toLowerCase();
33
- return normalized === '.env'
34
- || normalized.endsWith('/.env')
35
- || normalized.includes('/.git/config')
36
- || normalized.includes('/.git/credentials')
37
- || normalized.includes('/.lotagate/auth')
38
- || normalized.includes('/.lotagate/credentials')
39
- || normalized.includes('/.codex/auth')
40
- || normalized.includes('/.ssh/')
41
- || normalized.endsWith('/id_rsa')
42
- || normalized.endsWith('/id_ed25519');
43
- }
44
- function containsHiddenControlData(request) {
45
- return flattenStrings(request.input).some((value) => [...value].some((character) => HIDDEN_CONTROL_POINTS.has(character.codePointAt(0) ?? 0)));
46
- }
47
- function flattenStrings(value) {
48
- if (typeof value === 'string')
49
- return [value];
50
- if (Array.isArray(value))
51
- return value.flatMap(flattenStrings);
52
- if (value !== null && typeof value === 'object')
53
- return Object.values(value).flatMap(flattenStrings);
54
- return [];
55
- }
56
- const DOWNLOAD_AND_EXECUTE = /(?:curl|wget|invoke-webrequest|irm)\b[^\n|]*\|\s*(?:sh|bash|zsh|pwsh|powershell|cmd)\b|(?:powershell|pwsh)\b[^\n]*-(?:enc|encodedcommand)\b|\b(?:invoke-expression|iex)\b/iu;
57
- const CREDENTIAL_EXFILTRATION = /(?:curl|wget|invoke-webrequest|irm)\b[^\n]*(?:api[_-]?key|token|secret|password|credential|\.env|process\.env|\$env:)/iu;
58
- const HIDDEN_CONTROL_POINTS = new Set([
59
- 0x061c,
60
- 0x200b, 0x200c, 0x200d, 0x200e, 0x200f,
61
- 0x202a, 0x202b, 0x202c, 0x202d, 0x202e,
62
- 0x2060, 0x2061, 0x2062, 0x2063, 0x2064, 0x2066, 0x2067, 0x2069, 0x206a, 0x206b, 0x206c, 0x206d, 0x206e, 0x206f,
63
- 0xfeff,
64
- ]);
@@ -1,35 +0,0 @@
1
- import type { ToolApprovalRequest, ToolPolicyOptions } from '@lotagate/agent-sdk';
2
- import type { SkillScopeStore } from '../extensions/skill-scope-store.js';
3
- import type { WorkspacePermissionPolicy } from '../../domain/workspace/workspace-settings.js';
4
- export type CliApprovalMode = 'ask' | 'auto' | 'deny' | 'review' | 'autonomous';
5
- export interface ToolApprovalServiceOptions {
6
- mode: CliApprovalMode;
7
- trustedProject: boolean;
8
- prompt?: (request: ToolApprovalRequest) => boolean | Promise<boolean>;
9
- rememberApproval?: (request: ToolApprovalRequest) => void | Promise<void>;
10
- onRememberApprovalFailure?: (request: ToolApprovalRequest, error: unknown) => void | Promise<void>;
11
- audit?: (decision: ToolApprovalDecision) => void | Promise<void>;
12
- skillScopes?: SkillScopeStore;
13
- workspacePermissions?: WorkspacePermissionPolicy;
14
- desktopToolScopes?: readonly string[];
15
- }
16
- export interface ToolApprovalDecision {
17
- toolName: string;
18
- source?: string;
19
- decision: 'allow' | 'deny';
20
- reason: string;
21
- skillName?: string;
22
- riskCategory?: string;
23
- }
24
- export declare class ToolApprovalService {
25
- private readonly options;
26
- constructor(options: ToolApprovalServiceOptions);
27
- policy(): Pick<ToolPolicyOptions, 'authorizationRules' | 'authorizationObserver' | 'requireApproval' | 'approvalHandler'>;
28
- private authorizeDesktopScope;
29
- private authorizeWorkspace;
30
- private authorizeActionRisk;
31
- private authorizeSkill;
32
- private requestApproval;
33
- private rememberApproval;
34
- private observe;
35
- }
@@ -1,97 +0,0 @@
1
- import { requiresMutationApproval } from './tool-risk-classifier.js';
2
- import { assessToolAction } from './tool-action-risk-analyzer.js';
3
- import { workspacePermissionDecision } from './workspace-permission-policy.js';
4
- import { matchesDesktopToolScope } from './desktop-tool-scope-policy.js';
5
- export class ToolApprovalService {
6
- options;
7
- constructor(options) {
8
- this.options = options;
9
- }
10
- policy() {
11
- const authorizationRules = [
12
- ...(this.options.desktopToolScopes === undefined ? [] : [{ id: 'desktop-tool-scope', authorize: (request) => this.authorizeDesktopScope(request) }]),
13
- ...(this.options.skillScopes === undefined ? [] : [{ id: 'cli-skill-scope', authorize: (request) => this.authorizeSkill(request) }]),
14
- { id: 'cli-action-risk', authorize: (request) => this.authorizeActionRisk(request) },
15
- { id: 'cli-workspace-policy', authorize: (request) => this.authorizeWorkspace(request) },
16
- ];
17
- return {
18
- authorizationRules,
19
- authorizationObserver: (event) => this.observe(event),
20
- // Agent SDK's approval flag applies to every tool invocation. Keep the
21
- // decision in the CLI authorization rule so read-only filesystem tools
22
- // remain non-interactive while mutations retain an explicit prompt.
23
- requireApproval: false,
24
- };
25
- }
26
- authorizeDesktopScope(request) {
27
- return matchesDesktopToolScope(request, this.options.desktopToolScopes ?? [])
28
- ? { decision: 'allow', reason: 'desktop-tool-scope-allow' }
29
- : { decision: 'deny', reason: 'desktop-tool-scope-deny' };
30
- }
31
- async authorizeWorkspace(request) {
32
- if (!this.options.trustedProject)
33
- return { decision: 'deny', reason: 'project-untrusted' };
34
- if (this.options.mode === 'deny')
35
- return { decision: 'deny', reason: 'mode-deny' };
36
- if (this.options.mode === 'review')
37
- return this.requestApproval(request, 'review-policy');
38
- const configured = this.options.workspacePermissions === undefined
39
- ? undefined
40
- : workspacePermissionDecision(this.options.workspacePermissions, request.toolName, request.input);
41
- if (configured === 'deny')
42
- return { decision: 'deny', reason: 'workspace-policy-deny' };
43
- if (configured === 'allow')
44
- return { decision: 'allow', reason: 'workspace-policy-allow' };
45
- if (configured === 'ask')
46
- return this.requestApproval(request, 'workspace-policy-ask');
47
- if (requiresMutationApproval(request) && this.options.mode !== 'autonomous')
48
- return this.requestApproval(request, 'mutation-approval');
49
- return { decision: 'allow', reason: this.options.mode === 'auto' ? 'mode-auto' : 'read-only' };
50
- }
51
- async authorizeActionRisk(request) {
52
- const assessment = assessToolAction(request);
53
- if (assessment === undefined)
54
- return { decision: 'allow', reason: 'action-risk-clear' };
55
- if (assessment.risk === 'deny')
56
- return { decision: 'deny', reason: assessment.reason, metadata: { riskCategory: assessment.category } };
57
- const approved = await this.options.prompt?.(request) ?? false;
58
- return approved
59
- ? { decision: 'allow', reason: `${assessment.reason}-allow`, metadata: { riskCategory: assessment.category } }
60
- : { decision: 'deny', reason: `${assessment.reason}-deny`, metadata: { riskCategory: assessment.category } };
61
- }
62
- authorizeSkill(request) {
63
- const scope = this.options.skillScopes?.get(request.context.runId);
64
- if (scope === undefined || isSkillControlTool(request.toolName))
65
- return { decision: 'allow', reason: 'skill-policy-not-active' };
66
- if (!scope.allowedTools.includes(request.toolName))
67
- return { decision: 'deny', reason: 'skill-policy-deny', metadata: { skillName: scope.skillName } };
68
- return { decision: 'allow', reason: 'skill-policy-allow', metadata: { skillName: scope.skillName } };
69
- }
70
- async requestApproval(request, reason) {
71
- const approved = await this.options.prompt?.(request) ?? false;
72
- if (approved)
73
- await this.rememberApproval(request);
74
- return approved
75
- ? { decision: 'allow', reason: `${reason}-allow` }
76
- : { decision: 'deny', reason: `${reason}-deny` };
77
- }
78
- async rememberApproval(request) {
79
- try {
80
- await this.options.rememberApproval?.(request);
81
- }
82
- catch (error) {
83
- try {
84
- await this.options.onRememberApprovalFailure?.(request, error);
85
- }
86
- catch { /* Observability must not turn an already-approved action into a failed action. */ }
87
- }
88
- }
89
- async observe(event) {
90
- const skillName = typeof event.metadata?.['skillName'] === 'string' ? event.metadata['skillName'] : undefined;
91
- const riskCategory = typeof event.metadata?.['riskCategory'] === 'string' ? event.metadata['riskCategory'] : undefined;
92
- await this.options.audit?.({ toolName: event.toolName, ...(event.source === undefined ? {} : { source: event.source }), decision: event.decision, reason: event.reason, ...(skillName === undefined ? {} : { skillName }), ...(riskCategory === undefined ? {} : { riskCategory }) });
93
- }
94
- }
95
- function isSkillControlTool(toolName) {
96
- return toolName === 'skill.list' || toolName === 'skill.load';
97
- }
@@ -1,11 +0,0 @@
1
- import type { ToolApprovalRequest } from '@lotagate/agent-sdk';
2
- export type ToolRisk = 'read' | 'write' | 'unknown';
3
- /** Classifies a tool request conservatively before it crosses the approval boundary. */
4
- export declare function classifyToolRisk(request: ToolApprovalRequest): ToolRisk;
5
- export declare function requiresMutationApproval(request: ToolApprovalRequest): boolean;
6
- /**
7
- * Returns true only for commands whose executable and arguments are known not
8
- * to mutate files or execute a helper. Unknown shell invocations deliberately
9
- * require approval instead of relying on an executable-name allowlist.
10
- */
11
- export declare function isReadOnlyShellRequest(commandValue: unknown, inputArgs: unknown): boolean;
@@ -1,65 +0,0 @@
1
- /** Classifies a tool request conservatively before it crosses the approval boundary. */
2
- export function classifyToolRisk(request) {
3
- const declared = request.toolInfo?.metadata?.['risk'];
4
- if ((request.toolInfo?.source === 'filesystem' || request.toolInfo?.executorId === 'desktop-browser-host') && (declared === 'read' || declared === 'write' || declared === 'unknown'))
5
- return declared;
6
- if (request.toolName === 'filesystem.read' || request.toolName === 'filesystem.list' || request.toolName === 'filesystem.exists' || request.toolName === 'skill.list' || request.toolName === 'skill.load' || request.toolName === 'agent.wait')
7
- return 'read';
8
- if (request.toolName === 'agent.spawn')
9
- return request.input['mode'] === 'worker' ? 'unknown' : 'read';
10
- if (request.toolName === 'filesystem.write' || /(?:^|[._-])(delete|remove|move|copy|rename)(?:$|[._-])/iu.test(request.toolName))
11
- return 'write';
12
- if (request.toolName === 'shell.exec')
13
- return isReadOnlyShellRequest(request.input['command'], request.input['args']) ? 'read' : 'unknown';
14
- return 'unknown';
15
- }
16
- export function requiresMutationApproval(request) {
17
- return classifyToolRisk(request) !== 'read';
18
- }
19
- /**
20
- * Returns true only for commands whose executable and arguments are known not
21
- * to mutate files or execute a helper. Unknown shell invocations deliberately
22
- * require approval instead of relying on an executable-name allowlist.
23
- */
24
- export function isReadOnlyShellRequest(commandValue, inputArgs) {
25
- if (typeof commandValue !== 'string' || !Array.isArray(inputArgs) || inputArgs.some((value) => typeof value !== 'string'))
26
- return false;
27
- const command = commandValue.trim();
28
- const args = inputArgs;
29
- const executable = command.split(/[\\/]/u).at(-1)?.toLowerCase().replace(/\.(?:exe|cmd|bat|ps1)$/u, '') ?? '';
30
- const normalizedArgs = args.map((value) => value.toLowerCase());
31
- if (READ_ONLY_EXECUTABLES.has(executable))
32
- return !containsUnsafeReadOnlyFlag(executable, normalizedArgs);
33
- return executable === 'git' && isReadOnlyGit(normalizedArgs);
34
- }
35
- function isReadOnlyGit(args) {
36
- if (args.some((value) => GIT_GLOBAL_EXECUTION_FLAGS.has(value) || value.startsWith('--config-env=') || value.startsWith('-c')))
37
- return false;
38
- const subcommand = args.find((value) => !value.startsWith('-'));
39
- if (subcommand === undefined || !READ_ONLY_GIT_COMMANDS.has(subcommand))
40
- return false;
41
- if (args.some((value) => MUTATING_GIT_FLAGS.has(value)))
42
- return false;
43
- if ((subcommand === 'remote' || subcommand === 'tag') && args.some((value) => MUTATING_GIT_SUBCOMMANDS.has(value)))
44
- return false;
45
- const subcommandIndex = args.indexOf(subcommand);
46
- const trailing = args.slice(subcommandIndex + 1).filter((value) => !value.startsWith('-'));
47
- if ((subcommand === 'branch' || subcommand === 'tag' || subcommand === 'remote') && trailing.length > 0)
48
- return false;
49
- if (args.some((value) => GIT_UNSAFE_READ_FLAGS.has(value) || value.startsWith('--output=')))
50
- return false;
51
- return true;
52
- }
53
- const READ_ONLY_EXECUTABLES = new Set([
54
- 'cat', 'type', 'more', 'head', 'tail', 'rg', 'grep', 'ls', 'dir', 'pwd', 'where', 'which', 'stat', 'wc', 'uniq', 'file',
55
- ]);
56
- const READ_ONLY_GIT_COMMANDS = new Set(['status', 'diff', 'log', 'show', 'branch', 'tag', 'remote', 'rev-parse', 'ls-files']);
57
- const MUTATING_GIT_FLAGS = new Set(['-d', '-D', '-m', '-M', '-c', '-C', '--delete', '--move', '--force', '--unset-upstream']);
58
- const MUTATING_GIT_SUBCOMMANDS = new Set(['add', 'remove', 'rename', 'set-url', 'set-head', 'delete', '-d']);
59
- const GIT_GLOBAL_EXECUTION_FLAGS = new Set(['-c', '--config-env', '--exec-path']);
60
- const GIT_UNSAFE_READ_FLAGS = new Set(['-o', '--output', '--ext-diff', '--textconv']);
61
- function containsUnsafeReadOnlyFlag(executable, args) {
62
- if (executable === 'rg')
63
- return args.some((value) => value === '--pre' || value.startsWith('--pre='));
64
- return false;
65
- }
@@ -1,10 +0,0 @@
1
- import type { WorkspacePermissionPolicy } from '../../domain/workspace/workspace-settings.js';
2
- export declare function workspacePermissionDecision(policy: WorkspacePermissionPolicy, toolName: string, input: Readonly<Record<string, unknown>>): 'allow' | 'ask' | 'deny' | undefined;
3
- /**
4
- * Returns the narrowest readable rule that represents an approved request.
5
- * File operations are scoped to their path. Shell operations are scoped to
6
- * the executable and its first subcommand so approval does not persist raw
7
- * arguments (which may contain secrets or large file contents). Generated
8
- * rules are exact; wildcard rules remain an explicit user configuration.
9
- */
10
- export declare function permissionRuleForRequest(toolName: string, input: Readonly<Record<string, unknown>>): string;
@@ -1,50 +0,0 @@
1
- export function workspacePermissionDecision(policy, toolName, input) {
2
- const candidates = permissionCandidates(toolName, input);
3
- if (policy.deny.some((rule) => candidates.some((candidate) => matches(rule, candidate))))
4
- return 'deny';
5
- if (policy.ask.some((rule) => candidates.some((candidate) => matches(rule, candidate))))
6
- return 'ask';
7
- if (policy.allow.some((rule) => candidates.some((candidate) => matches(rule, candidate))))
8
- return 'allow';
9
- return undefined;
10
- }
11
- /**
12
- * Returns the narrowest readable rule that represents an approved request.
13
- * File operations are scoped to their path. Shell operations are scoped to
14
- * the executable and its first subcommand so approval does not persist raw
15
- * arguments (which may contain secrets or large file contents). Generated
16
- * rules are exact; wildcard rules remain an explicit user configuration.
17
- */
18
- export function permissionRuleForRequest(toolName, input) {
19
- if (typeof input['path'] === 'string' && input['path'].trim().length > 0) {
20
- return `${toolName}:${input['path'].trim()}`;
21
- }
22
- if (typeof input['command'] === 'string' && input['command'].trim().length > 0) {
23
- const command = input['command'].trim();
24
- const args = Array.isArray(input['args']) ? input['args'].filter((value) => typeof value === 'string' && value.trim().length > 0) : [];
25
- const subcommand = args.find((value) => !value.startsWith('-'))?.trim();
26
- return `${toolName}:${command}${subcommand === undefined ? '' : ` ${subcommand}`}`;
27
- }
28
- return toolName;
29
- }
30
- function permissionCandidates(toolName, input) {
31
- const candidates = [toolName];
32
- if (typeof input['command'] === 'string') {
33
- const args = Array.isArray(input['args']) ? input['args'].filter((value) => typeof value === 'string') : [];
34
- candidates.push(`${toolName}:${input['command']}${args.length === 0 ? '' : ` ${args.join(' ')}`}`);
35
- const subcommand = args.find((value) => !value.startsWith('-'));
36
- if (subcommand !== undefined)
37
- candidates.push(`${toolName}:${input['command']} ${subcommand}`);
38
- }
39
- if (typeof input['path'] === 'string')
40
- candidates.push(`${toolName}:${input['path']}`);
41
- return candidates;
42
- }
43
- function matches(rule, candidate) {
44
- if (rule === candidate)
45
- return true;
46
- if (!rule.includes('*'))
47
- return false;
48
- const escaped = rule.replace(/[.+?^${}()|[\]\\]/gu, '\\$&').replaceAll('*', '.*');
49
- return new RegExp(`^${escaped}$`, 'u').test(candidate);
50
- }
@@ -1,8 +0,0 @@
1
- import type { SessionMetadata } from '../../domain/session/session.js';
2
- import type { SessionStore } from '../../ports/session-store.js';
3
- /** Enforces project ownership before a session can be read or mutated. */
4
- export declare class ProjectSessionAccess {
5
- private readonly sessionStore;
6
- constructor(sessionStore: SessionStore);
7
- require(sessionId: string, projectFingerprint: string): Promise<SessionMetadata>;
8
- }