@lotagate/cli 0.1.22 → 0.1.24

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 { McpClientManager } from '@lotagate/agent-sdk';
2
- import { CliError } from '../../domain/errors/cli-error.js';
3
- import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
4
- import { FileMcpConfigStore } from './file-mcp-config-store.js';
5
- export class McpRuntime {
6
- storeFactory;
7
- manager;
8
- constructor(storeFactory = (cwd) => new FileMcpConfigStore(cwd)) {
9
- this.storeFactory = storeFactory;
10
- }
11
- async connectConfigured(cwd, trusted) {
12
- if (!trusted)
13
- throw new CliError(CLI_ERROR_CODES.PROJECT_TRUST_REQUIRED, 'MCP connections require project trust.', { category: 'project', userMessage: 'Trust the project before connecting to MCP servers.' });
14
- const configured = await this.storeFactory(cwd).list();
15
- const servers = toAgentMcpConfig(configured);
16
- await this.close();
17
- // Reconnect and transport policy remain owned by Agent SDK so all CLI entry
18
- // points use the same lifecycle semantics.
19
- this.manager = new McpClientManager(servers);
20
- return this.manager.connectAll();
21
- }
22
- get client() { return this.manager; }
23
- async close() {
24
- const manager = this.manager;
25
- this.manager = undefined;
26
- if (manager !== undefined)
27
- await manager.disconnectAll();
28
- }
29
- }
30
- export function toAgentMcpConfig(config) {
31
- const result = {};
32
- for (const [name, entry] of Object.entries(config)) {
33
- if (!entry.enabled)
34
- continue;
35
- result[name] = cloneMcpServerConfig(entry.config);
36
- }
37
- return result;
38
- }
39
- function cloneMcpServerConfig(config) {
40
- if (config.type === 'stdio') {
41
- return {
42
- ...config,
43
- ...(config.args === undefined ? {} : { args: [...config.args] }),
44
- ...(config.env === undefined ? {} : { env: { ...config.env } }),
45
- };
46
- }
47
- return {
48
- ...config,
49
- ...(config.headers === undefined ? {} : { headers: { ...config.headers } }),
50
- ...(config.auth?.type === 'bearer' ? { auth: { ...config.auth } } : {}),
51
- };
52
- }
@@ -1,5 +0,0 @@
1
- import { type PluginManifest } from '../../domain/extensions/plugin-manifest.js';
2
- export declare class PluginDiscovery {
3
- discover(roots: readonly string[]): Promise<readonly PluginManifest[]>;
4
- }
5
- export declare function validatePluginManifest(manifest: PluginManifest): Promise<void>;
@@ -1,52 +0,0 @@
1
- import fs from 'node:fs/promises';
2
- import path from 'node:path';
3
- import { parsePluginManifest } from '../../domain/extensions/plugin-manifest.js';
4
- import { CliError } from '../../domain/errors/cli-error.js';
5
- import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
6
- import { isFileNotFound } from '../filesystem/fs-errors.js';
7
- import { readJsonFileBounded } from '../filesystem/bounded-json-reader.js';
8
- import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
9
- import { listExtensionDirectories } from './extension-directory-reader.js';
10
- export class PluginDiscovery {
11
- async discover(roots) {
12
- const plugins = [];
13
- for (const root of roots) {
14
- for (const directory of await listExtensionDirectories(root)) {
15
- const manifestPath = path.join(directory, '.lotagate-plugin', 'plugin.json');
16
- try {
17
- const manifest = parsePluginManifest(await readJsonFileBounded(manifestPath, RESOURCE_LIMITS.pluginManifestBytes), directory);
18
- await validatePluginManifest(manifest);
19
- plugins.push(manifest);
20
- }
21
- catch (error) {
22
- if (!isFileNotFound(error))
23
- throw error;
24
- }
25
- }
26
- }
27
- return plugins.sort((left, right) => left.name.localeCompare(right.name));
28
- }
29
- }
30
- export async function validatePluginManifest(manifest) {
31
- const pluginRoot = await fs.realpath(manifest.directory);
32
- for (const relative of [manifest.skillsDirectory, manifest.agentsDirectory, manifest.hooksDirectory, manifest.mcpConfig]) {
33
- if (relative === undefined)
34
- continue;
35
- if (path.isAbsolute(relative) || relative.split(/[\\/]/u).includes('..'))
36
- throw new CliError(CLI_ERROR_CODES.PLUGIN_MANIFEST_INVALID, `Plugin path escapes plugin directory: ${relative}`, { category: 'extension', userMessage: 'Plugin manifest contains a path outside the plugin directory.' });
37
- const candidate = path.resolve(pluginRoot, relative);
38
- try {
39
- const stat = await fs.lstat(candidate);
40
- if (stat.isSymbolicLink())
41
- throw new Error('symbolic-link');
42
- const canonical = await fs.realpath(candidate);
43
- if (canonical !== pluginRoot && !canonical.startsWith(`${pluginRoot}${path.sep}`))
44
- throw new Error('outside-root');
45
- }
46
- catch (error) {
47
- if (isFileNotFound(error))
48
- continue;
49
- throw new CliError(CLI_ERROR_CODES.PLUGIN_MANIFEST_INVALID, `Plugin path is not contained in the plugin directory: ${relative}`, { category: 'extension', userMessage: 'Plugin manifest contains an unsafe path.', cause: error });
50
- }
51
- }
52
- }
@@ -1,26 +0,0 @@
1
- import { type PluginManifest } from '../../domain/extensions/plugin-manifest.js';
2
- export interface InstalledPlugin {
3
- manifest: PluginManifest;
4
- enabled: boolean;
5
- integrity?: string;
6
- }
7
- export interface PluginInstallOptions {
8
- sha256?: string;
9
- signature?: string;
10
- publicKeyPem?: string;
11
- }
12
- export interface PluginListOptions {
13
- verifyIntegrity?: boolean;
14
- }
15
- export declare class PluginManager {
16
- private readonly root;
17
- private readonly statePath;
18
- constructor(root: string);
19
- list(roots?: readonly string[], options?: PluginListOptions): Promise<readonly InstalledPlugin[]>;
20
- install(source: string, options?: PluginInstallOptions): Promise<InstalledPlugin>;
21
- uninstall(name: string): Promise<boolean>;
22
- setEnabled(name: string, enabled: boolean): Promise<void>;
23
- private readState;
24
- private writeState;
25
- }
26
- export declare function hashDirectory(directory: string): Promise<string>;
@@ -1,139 +0,0 @@
1
- import crypto from 'node:crypto';
2
- import fs from 'node:fs/promises';
3
- import path from 'node:path';
4
- import { parsePluginManifest } from '../../domain/extensions/plugin-manifest.js';
5
- import { CliError } from '../../domain/errors/cli-error.js';
6
- import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
7
- import { PluginDiscovery, validatePluginManifest } from './plugin-discovery.js';
8
- import { atomicWriteFile, withFileLock } from '../filesystem/atomic-file-store.js';
9
- import { isAlreadyExists, isFileNotFound } from '../filesystem/fs-errors.js';
10
- import { readJsonFileBounded } from '../filesystem/bounded-json-reader.js';
11
- import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
12
- import { parseExtensionState } from '../../domain/extensions/extension-state.js';
13
- export class PluginManager {
14
- root;
15
- statePath;
16
- constructor(root) {
17
- this.root = root;
18
- this.statePath = path.join(root, 'state.json');
19
- }
20
- async list(roots = [this.root], options = {}) {
21
- const state = await this.readState();
22
- const discovered = await new PluginDiscovery().discover(roots);
23
- const plugins = [];
24
- for (const manifest of discovered) {
25
- const integrity = options.verifyIntegrity === false ? undefined : await hashDirectory(manifest.directory);
26
- plugins.push({ manifest, enabled: state[manifest.name]?.enabled !== false, ...(integrity === undefined ? {} : { integrity }) });
27
- }
28
- return plugins;
29
- }
30
- async install(source, options = {}) {
31
- const sourceDirectory = path.resolve(source);
32
- const manifestPath = path.join(sourceDirectory, '.lotagate-plugin', 'plugin.json');
33
- const manifest = parsePluginManifest(await readJsonFileBounded(manifestPath, RESOURCE_LIMITS.pluginManifestBytes), sourceDirectory);
34
- await validatePluginManifest(manifest);
35
- const integrity = await hashDirectory(sourceDirectory);
36
- if (options.sha256 !== undefined && normalizeDigest(options.sha256) !== integrity)
37
- throw invalidInstall('Plugin checksum does not match --sha256.');
38
- if (options.signature !== undefined || options.publicKeyPem !== undefined) {
39
- if (options.signature === undefined || options.publicKeyPem === undefined)
40
- throw invalidInstall('Signature verification requires both --signature and --public-key.');
41
- const verified = crypto.verify(null, Buffer.from(integrity, 'utf8'), options.publicKeyPem, Buffer.from(options.signature, 'base64'));
42
- if (!verified)
43
- throw invalidInstall('Plugin signature verification failed.');
44
- }
45
- await fs.mkdir(this.root, { recursive: true });
46
- const destination = path.join(this.root, safePluginDirectoryName(manifest.name));
47
- const temporary = `${destination}.tmp-${crypto.randomUUID()}`;
48
- try {
49
- await fs.cp(sourceDirectory, temporary, { recursive: true, force: false, errorOnExist: true });
50
- await validatePluginManifest({ ...manifest, directory: temporary });
51
- const temporaryIntegrity = await hashDirectory(temporary);
52
- if (temporaryIntegrity !== integrity)
53
- throw invalidInstall('Plugin changed while it was being installed.');
54
- await fs.rename(temporary, destination).catch(async (error) => {
55
- if (!isAlreadyExists(error))
56
- throw error;
57
- await fs.rm(destination, { recursive: true, force: true });
58
- await fs.rename(temporary, destination);
59
- });
60
- await this.setEnabled(manifest.name, true);
61
- return { manifest: { ...manifest, directory: destination }, enabled: true, integrity: temporaryIntegrity };
62
- }
63
- finally {
64
- await fs.rm(temporary, { recursive: true, force: true });
65
- }
66
- }
67
- async uninstall(name) {
68
- const plugin = (await this.list([this.root], { verifyIntegrity: false })).find((item) => item.manifest.name === name);
69
- if (plugin === undefined)
70
- return false;
71
- await fs.rm(plugin.manifest.directory, { recursive: true, force: true });
72
- await withFileLock(this.statePath, async () => { const state = await this.readState(); delete state[name]; await this.writeState(state); });
73
- return true;
74
- }
75
- async setEnabled(name, enabled) {
76
- await withFileLock(this.statePath, async () => {
77
- const state = await this.readState();
78
- state[name] = { enabled };
79
- await this.writeState(state);
80
- });
81
- }
82
- async readState() {
83
- try {
84
- return parseExtensionState(await readJsonFileBounded(this.statePath, RESOURCE_LIMITS.workspaceSettingsBytes));
85
- }
86
- catch (error) {
87
- if (isFileNotFound(error))
88
- return {};
89
- throw error;
90
- }
91
- }
92
- async writeState(state) {
93
- await atomicWriteFile(this.statePath, `${JSON.stringify(state, null, 2)}\n`);
94
- }
95
- }
96
- export async function hashDirectory(directory) {
97
- const hash = crypto.createHash('sha256');
98
- let totalBytes = 0;
99
- for (const file of await filesRecursively(directory)) {
100
- const relative = path.relative(directory, file).split(path.sep).join('/');
101
- const stat = await fs.stat(file);
102
- if (stat.size > MAX_PLUGIN_FILE_BYTES)
103
- throw invalidInstall('Plugin file exceeds the integrity scan limit.');
104
- totalBytes += stat.size;
105
- if (totalBytes > MAX_PLUGIN_TOTAL_BYTES)
106
- throw invalidInstall('Plugin exceeds the total integrity scan limit.');
107
- hash.update(relative);
108
- hash.update('\0');
109
- hash.update(await fs.readFile(file));
110
- hash.update('\0');
111
- }
112
- return hash.digest('hex');
113
- }
114
- const MAX_PLUGIN_FILES = 5_000;
115
- const MAX_PLUGIN_FILE_BYTES = 10 * 1024 * 1024;
116
- const MAX_PLUGIN_TOTAL_BYTES = 50 * 1024 * 1024;
117
- const MAX_PLUGIN_DEPTH = 32;
118
- async function filesRecursively(directory, depth = 0, state = { files: 0 }) {
119
- if (depth > MAX_PLUGIN_DEPTH)
120
- throw invalidInstall('Plugin directory nesting exceeds the integrity scan limit.');
121
- const result = [];
122
- for (const entry of (await fs.readdir(directory, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name))) {
123
- const file = path.join(directory, entry.name);
124
- if (entry.isSymbolicLink())
125
- throw invalidInstall('Plugin packages must not contain symbolic links.');
126
- if (entry.isDirectory())
127
- result.push(...await filesRecursively(file, depth + 1, state));
128
- else if (entry.isFile()) {
129
- result.push(file);
130
- state.files += 1;
131
- if (state.files > MAX_PLUGIN_FILES)
132
- throw invalidInstall('Plugin contains too many files for the integrity scan.');
133
- }
134
- }
135
- return result;
136
- }
137
- function safePluginDirectoryName(name) { return `plugin-${Buffer.from(name, 'utf8').toString('base64url')}`; }
138
- function normalizeDigest(value) { return value.trim().toLowerCase().replace(/^sha256[:-]/u, ''); }
139
- function invalidInstall(message) { return new CliError(CLI_ERROR_CODES.PLUGIN_MANIFEST_INVALID, message, { category: 'extension', userMessage: `Unable to install plugin: ${message}` }); }
@@ -1,4 +0,0 @@
1
- import { type SkillManifest } from '../../domain/extensions/skill-manifest.js';
2
- export declare class SkillDiscovery {
3
- discover(roots: readonly string[]): Promise<readonly SkillManifest[]>;
4
- }
@@ -1,29 +0,0 @@
1
- import path from 'node:path';
2
- import { parseSkillDocument } from '../../domain/extensions/skill-manifest.js';
3
- import { isFileNotFound } from '../filesystem/fs-errors.js';
4
- import { readFileBounded } from '../filesystem/bounded-file-reader.js';
5
- import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
6
- import { listExtensionDirectories } from './extension-directory-reader.js';
7
- export class SkillDiscovery {
8
- async discover(roots) {
9
- const skills = new Map();
10
- for (const root of roots) {
11
- for (const directory of await listExtensionDirectories(root)) {
12
- const skillFile = path.join(directory, 'SKILL.md');
13
- try {
14
- const content = await readFileBounded(skillFile, RESOURCE_LIMITS.skillDocumentBytes);
15
- if (content.truncated)
16
- throw new Error('Skill document exceeds the supported size.');
17
- const skill = parseSkillDocument(content.bytes.toString('utf8'), directory);
18
- if (!skills.has(skill.name))
19
- skills.set(skill.name, skill);
20
- }
21
- catch (error) {
22
- if (!isFileNotFound(error))
23
- throw error;
24
- }
25
- }
26
- }
27
- return [...skills.values()].sort((left, right) => left.name.localeCompare(right.name));
28
- }
29
- }
@@ -1,8 +0,0 @@
1
- import { type SkillManifest } from '../../domain/extensions/skill-manifest.js';
2
- export interface InstalledSkill {
3
- manifest: SkillManifest;
4
- integrity: string;
5
- }
6
- export declare class SkillInstaller {
7
- install(source: string, root: string): Promise<InstalledSkill | undefined>;
8
- }
@@ -1,88 +0,0 @@
1
- import fs from 'node:fs/promises';
2
- import crypto from 'node:crypto';
3
- import path from 'node:path';
4
- import { parseSkillDocument } from '../../domain/extensions/skill-manifest.js';
5
- import { CliError } from '../../domain/errors/cli-error.js';
6
- import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
7
- import { hashDirectory } from './plugin-manager.js';
8
- import { isFileNotFound } from '../filesystem/fs-errors.js';
9
- import { readFileBounded } from '../filesystem/bounded-file-reader.js';
10
- import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
11
- export class SkillInstaller {
12
- async install(source, root) {
13
- if (await hasPluginManifest(source))
14
- return undefined;
15
- const sourceDirectory = await resolveSkillDirectory(path.resolve(source));
16
- if (sourceDirectory === undefined)
17
- return undefined;
18
- const skillFile = await readFileBounded(path.join(sourceDirectory, 'SKILL.md'), RESOURCE_LIMITS.skillDocumentBytes);
19
- if (skillFile.truncated)
20
- throw invalidSkillSource('Skill document exceeds the supported size.');
21
- const manifest = parseSkillDocument(skillFile.bytes.toString('utf8'), sourceDirectory);
22
- const sourceIntegrity = await hashDirectory(sourceDirectory);
23
- await fs.mkdir(root, { recursive: true });
24
- const destination = path.join(root, manifest.name);
25
- const temporary = `${destination}.tmp-${crypto.randomUUID()}`;
26
- try {
27
- await fs.cp(sourceDirectory, temporary, { recursive: true, force: false, errorOnExist: true });
28
- const temporaryIntegrity = await hashDirectory(temporary);
29
- if (temporaryIntegrity !== sourceIntegrity)
30
- throw new Error('Skill changed while it was being installed.');
31
- await fs.rm(destination, { recursive: true, force: true });
32
- await fs.rename(temporary, destination);
33
- return { manifest: { ...manifest, directory: destination }, integrity: temporaryIntegrity };
34
- }
35
- finally {
36
- await fs.rm(temporary, { recursive: true, force: true });
37
- }
38
- }
39
- }
40
- async function hasPluginManifest(source) {
41
- try {
42
- const stat = await fs.stat(path.join(source, '.lotagate-plugin', 'plugin.json'));
43
- return stat.isFile();
44
- }
45
- catch (error) {
46
- if (!isFileNotFound(error))
47
- throw error;
48
- return false;
49
- }
50
- }
51
- async function resolveSkillDirectory(source) {
52
- try {
53
- const stat = await fs.stat(path.join(source, 'SKILL.md'));
54
- if (stat.isFile())
55
- return source;
56
- }
57
- catch (error) {
58
- if (!isFileNotFound(error))
59
- throw error;
60
- }
61
- let entries;
62
- try {
63
- entries = await fs.readdir(source, { withFileTypes: true });
64
- }
65
- catch (error) {
66
- if (isFileNotFound(error))
67
- return undefined;
68
- throw error;
69
- }
70
- const candidates = [];
71
- for (const entry of entries.filter((item) => item.isDirectory())) {
72
- try {
73
- const stat = await fs.stat(path.join(source, entry.name, 'SKILL.md'));
74
- if (stat.isFile())
75
- candidates.push(path.join(source, entry.name));
76
- }
77
- catch (error) {
78
- if (!isFileNotFound(error))
79
- throw error;
80
- }
81
- }
82
- if (candidates.length > 1)
83
- throw invalidSkillSource('Source contains multiple skills. Pass the individual skill directory.');
84
- return candidates[0];
85
- }
86
- function invalidSkillSource(message) {
87
- return new CliError(CLI_ERROR_CODES.SKILL_FRONTMATTER_INVALID, message, { category: 'extension', userMessage: `Unable to install skill: ${message}` });
88
- }
@@ -1,22 +0,0 @@
1
- import type { SkillManifest } from '../../domain/extensions/skill-manifest.js';
2
- import type { SkillRootScope } from './skill-roots.js';
3
- export type ScopedSkill = SkillManifest & {
4
- skillKey: string;
5
- enabled: boolean;
6
- scope: SkillRootScope['scope'];
7
- root: string;
8
- statePath: string;
9
- pluginName?: string;
10
- };
11
- export interface ScopedSkillListOptions {
12
- includeShadowed?: boolean;
13
- }
14
- export declare class SkillManager {
15
- private readonly statePath;
16
- constructor(statePath: string);
17
- listScoped(scopes: readonly SkillRootScope[], options?: ScopedSkillListOptions): Promise<readonly ScopedSkill[]>;
18
- setEnabled(name: string, enabled: boolean, statePath?: string): Promise<void>;
19
- remove(name: string, root: string, statePath?: string): Promise<boolean>;
20
- private readState;
21
- private writeState;
22
- }
@@ -1,67 +0,0 @@
1
- import fs from 'node:fs/promises';
2
- import { SkillDiscovery } from './skill-discovery.js';
3
- import { atomicWriteFile, withFileLock } from '../filesystem/atomic-file-store.js';
4
- import { isFileNotFound } from '../filesystem/fs-errors.js';
5
- import { readJsonFileBounded } from '../filesystem/bounded-json-reader.js';
6
- import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
7
- import { parseExtensionState } from '../../domain/extensions/extension-state.js';
8
- export class SkillManager {
9
- statePath;
10
- constructor(statePath) {
11
- this.statePath = statePath;
12
- }
13
- async listScoped(scopes, options = {}) {
14
- const states = new Map();
15
- const result = [];
16
- const claimedNames = new Set();
17
- const pluginNames = new Set();
18
- for (const scope of scopes) {
19
- if (!states.has(scope.statePath))
20
- states.set(scope.statePath, await this.readState(scope.statePath));
21
- const state = states.get(scope.statePath);
22
- for (const skill of await new SkillDiscovery().discover([scope.root])) {
23
- const isPlugin = scope.scope === 'plugin';
24
- const shadowed = claimedNames.has(skill.name) || (!isPlugin && scope.scope === 'builtin' && pluginNames.has(skill.name));
25
- if (options.includeShadowed !== true && shadowed)
26
- continue;
27
- if (isPlugin)
28
- pluginNames.add(skill.name);
29
- else if (scope.scope !== 'builtin')
30
- claimedNames.add(skill.name);
31
- const skillKey = isPlugin ? `${scope.pluginName ?? 'plugin'}:${skill.name}` : skill.name;
32
- result.push({ ...skill, skillKey, enabled: state[skillKey]?.enabled !== false, scope: scope.scope, root: scope.root, statePath: scope.statePath, ...(scope.pluginName === undefined ? {} : { pluginName: scope.pluginName }) });
33
- }
34
- }
35
- return result;
36
- }
37
- async setEnabled(name, enabled, statePath = this.statePath) {
38
- await withFileLock(statePath, async () => {
39
- const state = await this.readState(statePath);
40
- state[name] = { enabled };
41
- await this.writeState(state, statePath);
42
- });
43
- }
44
- async remove(name, root, statePath = this.statePath) {
45
- const skill = (await new SkillDiscovery().discover([root])).find((item) => item.name === name || `${item.name}` === name);
46
- if (skill === undefined)
47
- return false;
48
- await fs.rm(skill.directory, { recursive: true, force: true });
49
- await withFileLock(statePath, async () => {
50
- const state = await this.readState(statePath);
51
- delete state[name];
52
- await this.writeState(state, statePath);
53
- });
54
- return true;
55
- }
56
- async readState(statePath = this.statePath) {
57
- try {
58
- return parseExtensionState(await readJsonFileBounded(statePath, RESOURCE_LIMITS.workspaceSettingsBytes));
59
- }
60
- catch (error) {
61
- if (isFileNotFound(error))
62
- return {};
63
- throw error;
64
- }
65
- }
66
- async writeState(state, statePath = this.statePath) { await atomicWriteFile(statePath, `${JSON.stringify(state, null, 2)}\n`); }
67
- }
@@ -1,19 +0,0 @@
1
- import type { ExtensionScope } from '../../domain/extensions/extension-scope.js';
2
- export interface SkillRootScope {
3
- scope: ExtensionScope | 'plugin' | 'builtin';
4
- root: string;
5
- statePath: string;
6
- pluginName?: string;
7
- }
8
- export interface PluginSkillRoot {
9
- root: string;
10
- pluginName: string;
11
- }
12
- /**
13
- * Returns skill roots in precedence order: project, user, enabled plugins,
14
- * then immutable package-provided skills. SkillManager keeps project/user
15
- * definitions authoritative while qualifying plugin identities so independent
16
- * plugins can expose the same raw skill name safely.
17
- */
18
- export declare function resolveSkillRootScopes(cwd: string, globalConfigDir: string, pluginSkillRoots?: readonly PluginSkillRoot[]): readonly SkillRootScope[];
19
- export declare function builtinSkillsDirectory(executablePath?: string): string;
@@ -1,25 +0,0 @@
1
- import path from 'node:path';
2
- import { existsSync } from 'node:fs';
3
- import { fileURLToPath } from 'node:url';
4
- /**
5
- * Returns skill roots in precedence order: project, user, enabled plugins,
6
- * then immutable package-provided skills. SkillManager keeps project/user
7
- * definitions authoritative while qualifying plugin identities so independent
8
- * plugins can expose the same raw skill name safely.
9
- */
10
- export function resolveSkillRootScopes(cwd, globalConfigDir, pluginSkillRoots = []) {
11
- const projectRoot = path.join(cwd, '.lotagate', 'skills');
12
- const userStatePath = path.join(globalConfigDir, 'skills-state.json');
13
- return [
14
- { scope: 'project', root: projectRoot, statePath: path.join(cwd, '.lotagate', 'skills-state.json') },
15
- { scope: 'user', root: path.join(globalConfigDir, 'skills'), statePath: userStatePath },
16
- ...pluginSkillRoots.map(({ root, pluginName }) => ({ scope: 'plugin', root, pluginName, statePath: userStatePath })),
17
- { scope: 'builtin', root: builtinSkillsDirectory(), statePath: userStatePath },
18
- ];
19
- }
20
- export function builtinSkillsDirectory(executablePath = process.execPath) {
21
- const nativeDistributionSkills = path.resolve(path.dirname(executablePath), '..', 'skills');
22
- if (existsSync(nativeDistributionSkills))
23
- return nativeDistributionSkills;
24
- return fileURLToPath(new URL('../../../skills/', import.meta.url));
25
- }
@@ -1,18 +0,0 @@
1
- import type { ToolDefinition } from '@lotagate/sdk';
2
- import type { ToolExecutionContext, ToolExecutor, ToolInfo, ToolResult } from '@lotagate/agent-sdk';
3
- import type { SkillManifest } from '../../domain/extensions/skill-manifest.js';
4
- import type { SkillScopeStore } from '../../application/extensions/skill-scope-store.js';
5
- /** Exposes the same skill capability definitions to runtime and context accounting. */
6
- export declare function skillToolDefinitions(): readonly ToolDefinition[];
7
- /** Presents validated, model-invocable skills as lazy agent tools. */
8
- export declare class SkillToolExecutor implements ToolExecutor {
9
- private readonly scopes;
10
- private readonly skills;
11
- constructor(skills: readonly (SkillManifest & {
12
- enabled: boolean;
13
- skillKey?: string;
14
- })[], scopes: SkillScopeStore);
15
- listTools(): readonly ToolDefinition[];
16
- getToolInfo(toolName: string): ToolInfo | undefined;
17
- execute(toolName: string, input: Record<string, unknown>, context: ToolExecutionContext): Promise<ToolResult>;
18
- }
@@ -1,53 +0,0 @@
1
- const SKILL_TOOLS = [
2
- toolDefinition('skill.list', 'List enabled skills available to the agent.', { type: 'object', properties: {}, additionalProperties: false }),
3
- toolDefinition('skill.load', 'Load instructions for one enabled skill by name when its description matches the task.', {
4
- type: 'object',
5
- properties: { name: { type: 'string', description: 'Enabled skill name.' } },
6
- required: ['name'],
7
- additionalProperties: false,
8
- }),
9
- ];
10
- /** Exposes the same skill capability definitions to runtime and context accounting. */
11
- export function skillToolDefinitions() { return SKILL_TOOLS; }
12
- /** Presents validated, model-invocable skills as lazy agent tools. */
13
- export class SkillToolExecutor {
14
- scopes;
15
- skills;
16
- constructor(skills, scopes) {
17
- this.scopes = scopes;
18
- this.skills = skills.filter((skill) => skill.enabled && skill.modelInvocable);
19
- }
20
- listTools() { return skillToolDefinitions(); }
21
- getToolInfo(toolName) {
22
- return SKILL_TOOLS.some((tool) => getToolName(tool) === toolName)
23
- ? { toolName, source: 'custom', executorId: 'skill-catalog', metadata: { category: 'skill', risk: 'read' } }
24
- : undefined;
25
- }
26
- async execute(toolName, input, context) {
27
- if (toolName === 'skill.list') {
28
- return result(JSON.stringify(this.skills.map((skill) => ({ name: skill.skillKey ?? skill.name, description: skill.description }))));
29
- }
30
- if (toolName !== 'skill.load')
31
- return error(`Unknown skill tool: ${toolName}`);
32
- const name = input['name'];
33
- if (typeof name !== 'string')
34
- return error('skill.load requires a skill name.');
35
- const skill = this.skills.find((candidate) => (candidate.skillKey ?? candidate.name) === name);
36
- if (skill === undefined)
37
- return error(`Skill is unavailable: ${name}`);
38
- this.scopes.activate(context.runId, skill);
39
- return result(boundText(skill.body, context.maxResultBytes));
40
- }
41
- }
42
- function toolDefinition(name, description, parameters) {
43
- return { type: 'function', function: { name, description, parameters } };
44
- }
45
- function getToolName(tool) {
46
- return 'function' in tool ? tool.function.name : undefined;
47
- }
48
- function result(content) { return { content, isError: false }; }
49
- function error(content) { return { content, isError: true }; }
50
- function boundText(content, maxBytes) {
51
- const bytes = Buffer.from(content, 'utf8');
52
- return bytes.byteLength <= maxBytes ? content : `${bytes.subarray(0, maxBytes).toString('utf8')}\n[truncated]`;
53
- }
@@ -1,12 +0,0 @@
1
- import fs from 'node:fs/promises';
2
- /** Writes a file through a same-directory temporary file and rename. */
3
- export declare function atomicWriteFile(filePath: string, data: string | Uint8Array, mode?: number): Promise<void>;
4
- /** Creates an advisory lock and removes it again when lock metadata cannot be persisted. */
5
- export declare function acquireAdvisoryFileLock(lockPath: string): Promise<fs.FileHandle>;
6
- /** Closes an advisory lock handle and removes its lock file even when close fails. */
7
- export declare function releaseAdvisoryFileLock(handle: fs.FileHandle, lockPath: string): Promise<void>;
8
- /** Serializes mutations across CLI processes using an advisory lock file. */
9
- export declare function withFileLock<T>(filePath: string, operation: () => Promise<T>, options?: {
10
- timeoutMs?: number;
11
- staleMs?: number;
12
- }): Promise<T>;