@lotagate/cli 0.1.20 → 0.1.22
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.
- package/dist/application/agent/agent-history.d.ts +3 -0
- package/dist/application/agent/agent-history.js +81 -0
- package/dist/application/agent/agent-input-context.d.ts +9 -0
- package/dist/application/agent/agent-input-context.js +12 -0
- package/dist/application/agent/agent-limit.d.ts +3 -0
- package/dist/application/agent/agent-limit.js +12 -0
- package/dist/application/agent/agent-run-tracker.d.ts +30 -0
- package/dist/application/agent/agent-run-tracker.js +68 -0
- package/dist/application/agent/agent-session-store.d.ts +19 -0
- package/dist/application/agent/agent-session-store.js +74 -0
- package/dist/application/agent/capability-profile.d.ts +37 -0
- package/dist/application/agent/capability-profile.js +13 -0
- package/dist/application/agent/cli-agent-execution-service.d.ts +81 -0
- package/dist/application/agent/cli-agent-execution-service.js +279 -0
- package/dist/application/agent/context-compaction-persistence.d.ts +8 -0
- package/dist/application/agent/context-compaction-persistence.js +27 -0
- package/dist/application/agent/context-compaction.d.ts +20 -0
- package/dist/application/agent/context-compaction.js +114 -0
- package/dist/application/agent/prompt-data-safety.d.ts +14 -0
- package/dist/application/agent/prompt-data-safety.js +38 -0
- package/dist/application/agent/safe-system-prompt.d.ts +3 -0
- package/dist/application/agent/safe-system-prompt.js +19 -0
- package/dist/application/agent/scoped-tool-executor.d.ts +13 -0
- package/dist/application/agent/scoped-tool-executor.js +32 -0
- package/dist/application/agent/system-prompt-builder.d.ts +14 -0
- package/dist/application/agent/system-prompt-builder.js +199 -0
- package/dist/application/agent/tool-catalog.d.ts +14 -0
- package/dist/application/agent/tool-catalog.js +30 -0
- package/dist/application/agent/tool-display.d.ts +6 -0
- package/dist/application/agent/tool-display.js +59 -0
- package/dist/application/agent/tool-hook-lifecycle.d.ts +19 -0
- package/dist/application/agent/tool-hook-lifecycle.js +85 -0
- package/dist/application/auth/authentication-service.d.ts +20 -0
- package/dist/application/auth/authentication-service.js +44 -0
- package/dist/application/chat/chat-service.d.ts +12 -0
- package/dist/application/chat/chat-service.js +19 -0
- package/dist/application/chat/pending-attachment-store.d.ts +12 -0
- package/dist/application/chat/pending-attachment-store.js +28 -0
- package/dist/application/commands/application-command-executor.d.ts +20 -0
- package/dist/application/commands/application-command-executor.js +66 -0
- package/dist/application/commands/cli-args.d.ts +6 -0
- package/dist/application/commands/cli-args.js +43 -0
- package/dist/application/commands/cli-command-services.d.ts +16 -0
- package/dist/application/commands/cli-command-services.js +405 -0
- package/dist/application/commands/command-catalog.d.ts +6 -0
- package/dist/application/commands/command-catalog.js +159 -0
- package/dist/application/commands/command-contract.d.ts +58 -0
- package/dist/application/commands/command-contract.js +1 -0
- package/dist/application/commands/command-hints.d.ts +9 -0
- package/dist/application/commands/command-hints.js +17 -0
- package/dist/application/commands/command-output.d.ts +4 -0
- package/dist/application/commands/command-output.js +1 -0
- package/dist/application/commands/command-parser.d.ts +10 -0
- package/dist/application/commands/command-parser.js +155 -0
- package/dist/application/commands/command-presentation.d.ts +7 -0
- package/dist/application/commands/command-presentation.js +131 -0
- package/dist/application/commands/command-registry.d.ts +11 -0
- package/dist/application/commands/command-registry.js +64 -0
- package/dist/application/commands/command-runtime.d.ts +2 -0
- package/dist/application/commands/command-runtime.js +3 -0
- package/dist/application/commands/goal-command-handlers.d.ts +3 -0
- package/dist/application/commands/goal-command-handlers.js +120 -0
- package/dist/application/commands/media-command-handlers.d.ts +9 -0
- package/dist/application/commands/media-command-handlers.js +307 -0
- package/dist/application/commands/media-command-output.d.ts +11 -0
- package/dist/application/commands/media-command-output.js +8 -0
- package/dist/application/commands/runtime-command-handlers.d.ts +7 -0
- package/dist/application/commands/runtime-command-handlers.js +177 -0
- package/dist/application/commands/stream-output.d.ts +4 -0
- package/dist/application/commands/stream-output.js +10 -0
- package/dist/application/commands/utility-commands.d.ts +6 -0
- package/dist/application/commands/utility-commands.js +81 -0
- package/dist/application/config/execution-config.d.ts +4 -0
- package/dist/application/config/execution-config.js +6 -0
- package/dist/application/extensions/extension-list-contract.d.ts +13 -0
- package/dist/application/extensions/extension-list-contract.js +1 -0
- package/dist/application/extensions/extension-list-formatters.d.ts +31 -0
- package/dist/application/extensions/extension-list-formatters.js +98 -0
- package/dist/application/extensions/extension-list-output.d.ts +3 -0
- package/dist/application/extensions/extension-list-output.js +7 -0
- package/dist/application/extensions/plugin-contribution-registry.d.ts +15 -0
- package/dist/application/extensions/plugin-contribution-registry.js +80 -0
- package/dist/application/extensions/skill-scope-store.d.ts +23 -0
- package/dist/application/extensions/skill-scope-store.js +33 -0
- package/dist/application/formatting/compact-number.d.ts +2 -0
- package/dist/application/formatting/compact-number.js +18 -0
- package/dist/application/formatting/compact-table.d.ts +22 -0
- package/dist/application/formatting/compact-table.js +49 -0
- package/dist/application/media/video-operation-poller.d.ts +5 -0
- package/dist/application/media/video-operation-poller.js +42 -0
- package/dist/application/model/cached-model-catalog.d.ts +13 -0
- package/dist/application/model/cached-model-catalog.js +31 -0
- package/dist/application/model/initial-model-selection.d.ts +10 -0
- package/dist/application/model/initial-model-selection.js +11 -0
- package/dist/application/model/model-catalog-service.d.ts +6 -0
- package/dist/application/model/model-catalog-service.js +13 -0
- package/dist/application/model/model-context-window.d.ts +3 -0
- package/dist/application/model/model-context-window.js +23 -0
- package/dist/application/orchestration/cli-subagent-service.d.ts +70 -0
- package/dist/application/orchestration/cli-subagent-service.js +328 -0
- package/dist/application/orchestration/cli-turn-event-projector.d.ts +12 -0
- package/dist/application/orchestration/cli-turn-event-projector.js +81 -0
- package/dist/application/orchestration/cli-turn-events.d.ts +76 -0
- package/dist/application/orchestration/cli-turn-events.js +39 -0
- package/dist/application/orchestration/cli-turn-persistence.d.ts +6 -0
- package/dist/application/orchestration/cli-turn-persistence.js +14 -0
- package/dist/application/orchestration/goal-evaluator.d.ts +18 -0
- package/dist/application/orchestration/goal-evaluator.js +88 -0
- package/dist/application/orchestration/goal-input.d.ts +3 -0
- package/dist/application/orchestration/goal-input.js +19 -0
- package/dist/application/orchestration/goal-output.d.ts +2 -0
- package/dist/application/orchestration/goal-output.js +11 -0
- package/dist/application/orchestration/goal-runner.d.ts +22 -0
- package/dist/application/orchestration/goal-runner.js +153 -0
- package/dist/application/orchestration/goal-usage.d.ts +9 -0
- package/dist/application/orchestration/goal-usage.js +19 -0
- package/dist/application/orchestration/headless-agent-turn.d.ts +32 -0
- package/dist/application/orchestration/headless-agent-turn.js +82 -0
- package/dist/application/orchestration/plan-generator.d.ts +7 -0
- package/dist/application/orchestration/plan-generator.js +34 -0
- package/dist/application/orchestration/subagent-coordinator.d.ts +33 -0
- package/dist/application/orchestration/subagent-coordinator.js +28 -0
- package/dist/application/orchestration/subagent-handoff.d.ts +2 -0
- package/dist/application/orchestration/subagent-handoff.js +68 -0
- package/dist/application/orchestration/subagent-tool-executor.d.ts +12 -0
- package/dist/application/orchestration/subagent-tool-executor.js +93 -0
- package/dist/application/orchestration/task-assessment.d.ts +4 -0
- package/dist/application/orchestration/task-assessment.js +35 -0
- package/dist/application/orchestration/task-graph.d.ts +13 -0
- package/dist/application/orchestration/task-graph.js +56 -0
- package/dist/application/orchestration/task-scheduler.d.ts +18 -0
- package/dist/application/orchestration/task-scheduler.js +88 -0
- package/dist/application/project/project-trust-service.d.ts +13 -0
- package/dist/application/project/project-trust-service.js +74 -0
- package/dist/application/protocol/browser-host-tool-executor.d.ts +41 -0
- package/dist/application/protocol/browser-host-tool-executor.js +88 -0
- package/dist/application/protocol/desktop-agent-command.d.ts +9 -0
- package/dist/application/protocol/desktop-agent-command.js +663 -0
- package/dist/application/protocol/desktop-attachment-store.d.ts +16 -0
- package/dist/application/protocol/desktop-attachment-store.js +82 -0
- package/dist/application/protocol/desktop-command-catalog.d.ts +2 -0
- package/dist/application/protocol/desktop-command-catalog.js +19 -0
- package/dist/application/protocol/desktop-command-contract.d.ts +22 -0
- package/dist/application/protocol/desktop-command-contract.js +3 -0
- package/dist/application/protocol/desktop-command-executor.d.ts +16 -0
- package/dist/application/protocol/desktop-command-executor.js +47 -0
- package/dist/application/protocol/desktop-command-output.d.ts +15 -0
- package/dist/application/protocol/desktop-command-output.js +24 -0
- package/dist/application/protocol/desktop-execution-policy.d.ts +17 -0
- package/dist/application/protocol/desktop-execution-policy.js +49 -0
- package/dist/application/protocol/desktop-host-tool-executor.d.ts +57 -0
- package/dist/application/protocol/desktop-host-tool-executor.js +53 -0
- package/dist/application/protocol/desktop-orchestration-events.d.ts +5 -0
- package/dist/application/protocol/desktop-orchestration-events.js +37 -0
- package/dist/application/protocol/json-line-writer.d.ts +9 -0
- package/dist/application/protocol/json-line-writer.js +19 -0
- package/dist/application/protocol/jsonl-agent-command.d.ts +3 -0
- package/dist/application/protocol/jsonl-agent-command.js +97 -0
- package/dist/application/protocol/jsonl-protocol.d.ts +52 -0
- package/dist/application/protocol/jsonl-protocol.js +170 -0
- package/dist/application/security/desktop-tool-scope-policy.d.ts +3 -0
- package/dist/application/security/desktop-tool-scope-policy.js +52 -0
- package/dist/application/security/tool-action-risk-analyzer.d.ts +13 -0
- package/dist/application/security/tool-action-risk-analyzer.js +64 -0
- package/dist/application/security/tool-approval-service.d.ts +35 -0
- package/dist/application/security/tool-approval-service.js +97 -0
- package/dist/application/security/tool-risk-classifier.d.ts +11 -0
- package/dist/application/security/tool-risk-classifier.js +65 -0
- package/dist/application/security/workspace-permission-policy.d.ts +10 -0
- package/dist/application/security/workspace-permission-policy.js +50 -0
- package/dist/application/session/project-session-access.d.ts +8 -0
- package/dist/application/session/project-session-access.js +19 -0
- package/dist/application/session/session-compaction-service.d.ts +10 -0
- package/dist/application/session/session-compaction-service.js +43 -0
- package/dist/application/session/session-turn-lifecycle.d.ts +5 -0
- package/dist/application/session/session-turn-lifecycle.js +31 -0
- package/dist/application/workspace/workspace-file-index.d.ts +15 -0
- package/dist/application/workspace/workspace-file-index.js +60 -0
- package/dist/application/workspace/workspace-file-reference-resolver.d.ts +14 -0
- package/dist/application/workspace/workspace-file-reference-resolver.js +123 -0
- package/dist/application/workspace/workspace-instruction-loader.d.ts +8 -0
- package/dist/application/workspace/workspace-instruction-loader.js +55 -0
- package/dist/bootstrap/composition-root.d.ts +6 -0
- package/dist/bootstrap/composition-root.js +4 -0
- package/dist/bootstrap/global-cli-options.d.ts +6 -0
- package/dist/bootstrap/global-cli-options.js +29 -0
- package/dist/bootstrap/native-devtools-stub.d.ts +10 -0
- package/dist/bootstrap/native-devtools-stub.js +10 -0
- package/dist/bootstrap/native-entry.d.ts +1 -0
- package/dist/bootstrap/native-entry.js +6 -0
- package/dist/bootstrap/native-tiktoken.d.ts +4 -0
- package/dist/bootstrap/native-tiktoken.js +5 -0
- package/dist/bootstrap/runtime-factory.d.ts +35 -0
- package/dist/bootstrap/runtime-factory.js +44 -0
- package/dist/bootstrap/shutdown-manager.d.ts +10 -0
- package/dist/bootstrap/shutdown-manager.js +14 -0
- package/dist/bootstrap/startup-sequence.d.ts +5 -0
- package/dist/bootstrap/startup-sequence.js +10 -0
- package/dist/domain/auth/auth-profile.d.ts +14 -0
- package/dist/domain/auth/auth-profile.js +39 -0
- package/dist/domain/config/config-schema.d.ts +17 -0
- package/dist/domain/config/config-schema.js +105 -0
- package/dist/domain/errors/cli-command-hint.d.ts +5 -0
- package/dist/domain/errors/cli-command-hint.js +1 -0
- package/dist/domain/errors/cli-error.d.ts +35 -0
- package/dist/domain/errors/cli-error.js +129 -0
- package/dist/domain/errors/error-codes.d.ts +46 -0
- package/dist/domain/errors/error-codes.js +45 -0
- package/dist/domain/extensions/extension-scope.d.ts +3 -0
- package/dist/domain/extensions/extension-scope.js +23 -0
- package/dist/domain/extensions/extension-state.d.ts +5 -0
- package/dist/domain/extensions/extension-state.js +11 -0
- package/dist/domain/extensions/hook-manifest.d.ts +10 -0
- package/dist/domain/extensions/hook-manifest.js +23 -0
- package/dist/domain/extensions/mcp-config.d.ts +18 -0
- package/dist/domain/extensions/mcp-config.js +111 -0
- package/dist/domain/extensions/plugin-manifest.d.ts +11 -0
- package/dist/domain/extensions/plugin-manifest.js +43 -0
- package/dist/domain/extensions/skill-manifest.d.ts +10 -0
- package/dist/domain/extensions/skill-manifest.js +51 -0
- package/dist/domain/filesystem/file-change-diff.d.ts +21 -0
- package/dist/domain/filesystem/file-change-diff.js +60 -0
- package/dist/domain/media/gateway-media-contract.d.ts +23 -0
- package/dist/domain/media/gateway-media-contract.js +163 -0
- package/dist/domain/media/media-contract.d.ts +28 -0
- package/dist/domain/media/media-contract.js +1 -0
- package/dist/domain/media/media-execution-policy.d.ts +9 -0
- package/dist/domain/media/media-execution-policy.js +31 -0
- package/dist/domain/orchestration/goal.d.ts +58 -0
- package/dist/domain/orchestration/goal.js +113 -0
- package/dist/domain/orchestration/subagent-identity.d.ts +2 -0
- package/dist/domain/orchestration/subagent-identity.js +8 -0
- package/dist/domain/orchestration/subagent.d.ts +33 -0
- package/dist/domain/orchestration/subagent.js +1 -0
- package/dist/domain/orchestration/task.d.ts +31 -0
- package/dist/domain/orchestration/task.js +1 -0
- package/dist/domain/project/project-identity.d.ts +6 -0
- package/dist/domain/project/project-identity.js +4 -0
- package/dist/domain/runtime/assistant-delta-normalizer.d.ts +11 -0
- package/dist/domain/runtime/assistant-delta-normalizer.js +19 -0
- package/dist/domain/runtime/resource-limits.d.ts +60 -0
- package/dist/domain/runtime/resource-limits.js +60 -0
- package/dist/domain/session/attachment.d.ts +13 -0
- package/dist/domain/session/attachment.js +1 -0
- package/dist/domain/session/session-schema.d.ts +6 -0
- package/dist/domain/session/session-schema.js +28 -0
- package/dist/domain/session/session.d.ts +27 -0
- package/dist/domain/session/session.js +1 -0
- package/dist/domain/settings/settings-document.d.ts +8 -0
- package/dist/domain/settings/settings-document.js +36 -0
- package/dist/domain/validation/record-schema.d.ts +4 -0
- package/dist/domain/validation/record-schema.js +9 -0
- package/dist/domain/workspace/workspace-settings.d.ts +12 -0
- package/dist/domain/workspace/workspace-settings.js +44 -0
- package/dist/infrastructure/agent-sdk/agent-instance-factory.d.ts +22 -0
- package/dist/infrastructure/agent-sdk/agent-instance-factory.js +31 -0
- package/dist/infrastructure/agent-sdk/tool-calling-model-client.d.ts +11 -0
- package/dist/infrastructure/agent-sdk/tool-calling-model-client.js +447 -0
- package/dist/infrastructure/cache/cache-policy.d.ts +7 -0
- package/dist/infrastructure/cache/cache-policy.js +18 -0
- package/dist/infrastructure/cache/file-cache-store.d.ts +17 -0
- package/dist/infrastructure/cache/file-cache-store.js +121 -0
- package/dist/infrastructure/clipboard/clipboard-adapter-factory.d.ts +11 -0
- package/dist/infrastructure/clipboard/clipboard-adapter-factory.js +98 -0
- package/dist/infrastructure/clipboard/clipboard-policy.d.ts +8 -0
- package/dist/infrastructure/clipboard/clipboard-policy.js +19 -0
- package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.d.ts +10 -0
- package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.js +94 -0
- package/dist/infrastructure/clipboard/image-normalizer.d.ts +12 -0
- package/dist/infrastructure/clipboard/image-normalizer.js +78 -0
- package/dist/infrastructure/clipboard/windows-clipboard-adapter.d.ts +7 -0
- package/dist/infrastructure/clipboard/windows-clipboard-adapter.js +66 -0
- package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.d.ts +7 -0
- package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.js +70 -0
- package/dist/infrastructure/config/config-loader.d.ts +19 -0
- package/dist/infrastructure/config/config-loader.js +76 -0
- package/dist/infrastructure/config/environment-values.d.ts +2 -0
- package/dist/infrastructure/config/environment-values.js +7 -0
- package/dist/infrastructure/credentials/composite-credential-store.d.ts +11 -0
- package/dist/infrastructure/credentials/composite-credential-store.js +32 -0
- package/dist/infrastructure/credentials/encrypted-file-credential-store.d.ts +17 -0
- package/dist/infrastructure/credentials/encrypted-file-credential-store.js +181 -0
- package/dist/infrastructure/credentials/environment-credential-store.d.ts +11 -0
- package/dist/infrastructure/credentials/environment-credential-store.js +37 -0
- package/dist/infrastructure/credentials/secret-input.d.ts +7 -0
- package/dist/infrastructure/credentials/secret-input.js +44 -0
- package/dist/infrastructure/extensions/composite-mcp-config-store.d.ts +9 -0
- package/dist/infrastructure/extensions/composite-mcp-config-store.js +10 -0
- package/dist/infrastructure/extensions/extension-directory-reader.d.ts +2 -0
- package/dist/infrastructure/extensions/extension-directory-reader.js +15 -0
- package/dist/infrastructure/extensions/extension-source-resolver.d.ts +6 -0
- package/dist/infrastructure/extensions/extension-source-resolver.js +126 -0
- package/dist/infrastructure/extensions/file-mcp-config-store.d.ts +15 -0
- package/dist/infrastructure/extensions/file-mcp-config-store.js +66 -0
- package/dist/infrastructure/extensions/hook-runtime.d.ts +18 -0
- package/dist/infrastructure/extensions/hook-runtime.js +66 -0
- package/dist/infrastructure/extensions/mcp-runtime.d.ts +12 -0
- package/dist/infrastructure/extensions/mcp-runtime.js +52 -0
- package/dist/infrastructure/extensions/plugin-discovery.d.ts +5 -0
- package/dist/infrastructure/extensions/plugin-discovery.js +52 -0
- package/dist/infrastructure/extensions/plugin-manager.d.ts +26 -0
- package/dist/infrastructure/extensions/plugin-manager.js +139 -0
- package/dist/infrastructure/extensions/skill-discovery.d.ts +4 -0
- package/dist/infrastructure/extensions/skill-discovery.js +29 -0
- package/dist/infrastructure/extensions/skill-installer.d.ts +8 -0
- package/dist/infrastructure/extensions/skill-installer.js +88 -0
- package/dist/infrastructure/extensions/skill-manager.d.ts +22 -0
- package/dist/infrastructure/extensions/skill-manager.js +67 -0
- package/dist/infrastructure/extensions/skill-roots.d.ts +19 -0
- package/dist/infrastructure/extensions/skill-roots.js +25 -0
- package/dist/infrastructure/extensions/skill-tool-executor.d.ts +18 -0
- package/dist/infrastructure/extensions/skill-tool-executor.js +53 -0
- package/dist/infrastructure/filesystem/atomic-file-store.d.ts +12 -0
- package/dist/infrastructure/filesystem/atomic-file-store.js +106 -0
- package/dist/infrastructure/filesystem/bounded-file-reader.d.ts +6 -0
- package/dist/infrastructure/filesystem/bounded-file-reader.js +24 -0
- package/dist/infrastructure/filesystem/bounded-json-reader.d.ts +1 -0
- package/dist/infrastructure/filesystem/bounded-json-reader.js +7 -0
- package/dist/infrastructure/filesystem/fs-errors.d.ts +2 -0
- package/dist/infrastructure/filesystem/fs-errors.js +6 -0
- package/dist/infrastructure/filesystem/gateway-media-input-reader.d.ts +12 -0
- package/dist/infrastructure/filesystem/gateway-media-input-reader.js +49 -0
- package/dist/infrastructure/filesystem/local-filesystem-tool-executor.d.ts +21 -0
- package/dist/infrastructure/filesystem/local-filesystem-tool-executor.js +176 -0
- package/dist/infrastructure/filesystem/path-resolver.d.ts +20 -0
- package/dist/infrastructure/filesystem/path-resolver.js +119 -0
- package/dist/infrastructure/filesystem/workspace-media-artifact-store.d.ts +13 -0
- package/dist/infrastructure/filesystem/workspace-media-artifact-store.js +152 -0
- package/dist/infrastructure/logging/daily-rotating-file-writer.d.ts +20 -0
- package/dist/infrastructure/logging/daily-rotating-file-writer.js +75 -0
- package/dist/infrastructure/logging/log-redactor.d.ts +2 -0
- package/dist/infrastructure/logging/log-redactor.js +26 -0
- package/dist/infrastructure/logging/logging-policy.d.ts +6 -0
- package/dist/infrastructure/logging/logging-policy.js +6 -0
- package/dist/infrastructure/logging/structured-logger.d.ts +24 -0
- package/dist/infrastructure/logging/structured-logger.js +40 -0
- package/dist/infrastructure/network/safe-media-downloader.d.ts +23 -0
- package/dist/infrastructure/network/safe-media-downloader.js +239 -0
- package/dist/infrastructure/platform/host-platform.d.ts +14 -0
- package/dist/infrastructure/platform/host-platform.js +23 -0
- package/dist/infrastructure/platform/host-process.d.ts +17 -0
- package/dist/infrastructure/platform/host-process.js +116 -0
- package/dist/infrastructure/platform/platform-paths.d.ts +25 -0
- package/dist/infrastructure/platform/platform-paths.js +33 -0
- package/dist/infrastructure/project/file-project-trust-store.d.ts +12 -0
- package/dist/infrastructure/project/file-project-trust-store.js +59 -0
- package/dist/infrastructure/sdk/chat-completion-adapter.d.ts +8 -0
- package/dist/infrastructure/sdk/chat-completion-adapter.js +115 -0
- package/dist/infrastructure/sdk/lotagate-client-factory.d.ts +3 -0
- package/dist/infrastructure/sdk/lotagate-client-factory.js +8 -0
- package/dist/infrastructure/sdk/model-catalog-adapter.d.ts +19 -0
- package/dist/infrastructure/sdk/model-catalog-adapter.js +28 -0
- package/dist/infrastructure/sdk/sdk-media-gateway-client.d.ts +20 -0
- package/dist/infrastructure/sdk/sdk-media-gateway-client.js +97 -0
- package/dist/infrastructure/sessions/file-goal-store.d.ts +21 -0
- package/dist/infrastructure/sessions/file-goal-store.js +160 -0
- package/dist/infrastructure/sessions/file-session-store.d.ts +48 -0
- package/dist/infrastructure/sessions/file-session-store.js +525 -0
- package/dist/infrastructure/sessions/project-session-paths.d.ts +17 -0
- package/dist/infrastructure/sessions/project-session-paths.js +41 -0
- package/dist/infrastructure/sessions/session-index.d.ts +16 -0
- package/dist/infrastructure/sessions/session-index.js +84 -0
- package/dist/infrastructure/sessions/session-journal.d.ts +22 -0
- package/dist/infrastructure/sessions/session-journal.js +137 -0
- package/dist/infrastructure/sessions/subagent-journal-store.d.ts +28 -0
- package/dist/infrastructure/sessions/subagent-journal-store.js +30 -0
- package/dist/infrastructure/shell/shell-tool-executor.d.ts +17 -0
- package/dist/infrastructure/shell/shell-tool-executor.js +115 -0
- package/dist/infrastructure/tokens/tiktoken-token-estimator.d.ts +18 -0
- package/dist/infrastructure/tokens/tiktoken-token-estimator.js +48 -0
- package/dist/infrastructure/workspace/workspace-settings-store.d.ts +9 -0
- package/dist/infrastructure/workspace/workspace-settings-store.js +75 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.js +66 -0
- package/dist/ports/cache-store.d.ts +10 -0
- package/dist/ports/cache-store.js +1 -0
- package/dist/ports/chat-model.d.ts +30 -0
- package/dist/ports/chat-model.js +1 -0
- package/dist/ports/clipboard-adapter.d.ts +7 -0
- package/dist/ports/clipboard-adapter.js +1 -0
- package/dist/ports/clipboard-text-adapter.d.ts +3 -0
- package/dist/ports/clipboard-text-adapter.js +1 -0
- package/dist/ports/credential-store.d.ts +7 -0
- package/dist/ports/credential-store.js +1 -0
- package/dist/ports/goal-store.d.ts +12 -0
- package/dist/ports/goal-store.js +1 -0
- package/dist/ports/logger.d.ts +8 -0
- package/dist/ports/logger.js +1 -0
- package/dist/ports/media-gateway-client.d.ts +54 -0
- package/dist/ports/media-gateway-client.js +1 -0
- package/dist/ports/model-diagnostics.d.ts +17 -0
- package/dist/ports/model-diagnostics.js +1 -0
- package/dist/ports/project-trust-store.d.ts +12 -0
- package/dist/ports/project-trust-store.js +1 -0
- package/dist/ports/session-store.d.ts +58 -0
- package/dist/ports/session-store.js +1 -0
- package/dist/ports/subagent-lifecycle.d.ts +31 -0
- package/dist/ports/subagent-lifecycle.js +1 -0
- package/dist/ports/tool-activity.d.ts +13 -0
- package/dist/ports/tool-activity.js +1 -0
- package/dist/presentation/themes/theme.d.ts +19 -0
- package/dist/presentation/themes/theme.js +8 -0
- package/dist/presentation/tui/agent-initialization-renderer.d.ts +4 -0
- package/dist/presentation/tui/agent-initialization-renderer.js +37 -0
- package/dist/presentation/tui/context-display.d.ts +21 -0
- package/dist/presentation/tui/context-display.js +33 -0
- package/dist/presentation/tui/formatters.d.ts +6 -0
- package/dist/presentation/tui/formatters.js +60 -0
- package/dist/presentation/tui/ink/choice-window.d.ts +5 -0
- package/dist/presentation/tui/ink/choice-window.js +5 -0
- package/dist/presentation/tui/ink/components/activity-entry.d.ts +6 -0
- package/dist/presentation/tui/ink/components/activity-entry.js +16 -0
- package/dist/presentation/tui/ink/components/activity-status.d.ts +10 -0
- package/dist/presentation/tui/ink/components/activity-status.js +21 -0
- package/dist/presentation/tui/ink/components/choice-modal.d.ts +11 -0
- package/dist/presentation/tui/ink/components/choice-modal.js +29 -0
- package/dist/presentation/tui/ink/components/composer.d.ts +40 -0
- package/dist/presentation/tui/ink/components/composer.js +271 -0
- package/dist/presentation/tui/ink/components/file-diff.d.ts +6 -0
- package/dist/presentation/tui/ink/components/file-diff.js +34 -0
- package/dist/presentation/tui/ink/components/modal.d.ts +8 -0
- package/dist/presentation/tui/ink/components/modal.js +110 -0
- package/dist/presentation/tui/ink/components/shimmer-text.d.ts +6 -0
- package/dist/presentation/tui/ink/components/shimmer-text.js +9 -0
- package/dist/presentation/tui/ink/components/subagent-activity.d.ts +11 -0
- package/dist/presentation/tui/ink/components/subagent-activity.js +61 -0
- package/dist/presentation/tui/ink/components/transcript.d.ts +39 -0
- package/dist/presentation/tui/ink/components/transcript.js +121 -0
- package/dist/presentation/tui/ink/components/welcome-panel.d.ts +6 -0
- package/dist/presentation/tui/ink/components/welcome-panel.js +20 -0
- package/dist/presentation/tui/ink/lotagate-tui.d.ts +6 -0
- package/dist/presentation/tui/ink/lotagate-tui.js +136 -0
- package/dist/presentation/tui/ink/markdown-inline-renderer.d.ts +4 -0
- package/dist/presentation/tui/ink/markdown-inline-renderer.js +20 -0
- package/dist/presentation/tui/ink/markdown-inline.d.ts +13 -0
- package/dist/presentation/tui/ink/markdown-inline.js +91 -0
- package/dist/presentation/tui/ink/markdown-message.d.ts +6 -0
- package/dist/presentation/tui/ink/markdown-message.js +66 -0
- package/dist/presentation/tui/ink/markdown-table.d.ts +16 -0
- package/dist/presentation/tui/ink/markdown-table.js +77 -0
- package/dist/presentation/tui/ink/tui-bridge.d.ts +195 -0
- package/dist/presentation/tui/ink/tui-bridge.js +289 -0
- package/dist/presentation/tui/terminal-capabilities.d.ts +15 -0
- package/dist/presentation/tui/terminal-capabilities.js +7 -0
- package/dist/presentation/tui/terminal-mouse.d.ts +5 -0
- package/dist/presentation/tui/terminal-mouse.js +19 -0
- package/dist/presentation/tui/terminal-screen.d.ts +10 -0
- package/dist/presentation/tui/terminal-screen.js +23 -0
- package/dist/presentation/tui/tui-agent-event-runner.d.ts +24 -0
- package/dist/presentation/tui/tui-agent-event-runner.js +69 -0
- package/dist/presentation/tui/tui-application-contract.d.ts +10 -0
- package/dist/presentation/tui/tui-application-contract.js +8 -0
- package/dist/presentation/tui/tui-application.d.ts +62 -0
- package/dist/presentation/tui/tui-application.js +675 -0
- package/dist/presentation/tui/tui-attachment-input.d.ts +2 -0
- package/dist/presentation/tui/tui-attachment-input.js +5 -0
- package/dist/presentation/tui/tui-clipboard-paste-handlers.d.ts +11 -0
- package/dist/presentation/tui/tui-clipboard-paste-handlers.js +25 -0
- package/dist/presentation/tui/tui-command-context.d.ts +3 -0
- package/dist/presentation/tui/tui-command-context.js +1 -0
- package/dist/presentation/tui/tui-command-executor.d.ts +38 -0
- package/dist/presentation/tui/tui-command-executor.js +214 -0
- package/dist/presentation/tui/tui-command-host-factory.d.ts +40 -0
- package/dist/presentation/tui/tui-command-host-factory.js +23 -0
- package/dist/presentation/tui/tui-context-compaction.d.ts +5 -0
- package/dist/presentation/tui/tui-context-compaction.js +22 -0
- package/dist/presentation/tui/tui-context-service.d.ts +34 -0
- package/dist/presentation/tui/tui-context-service.js +126 -0
- package/dist/presentation/tui/tui-file-suggestions.d.ts +3 -0
- package/dist/presentation/tui/tui-file-suggestions.js +8 -0
- package/dist/presentation/tui/tui-goal-controller.d.ts +14 -0
- package/dist/presentation/tui/tui-goal-controller.js +52 -0
- package/dist/presentation/tui/tui-initial-model.d.ts +3 -0
- package/dist/presentation/tui/tui-initial-model.js +28 -0
- package/dist/presentation/tui/tui-lifecycle-actions.d.ts +13 -0
- package/dist/presentation/tui/tui-lifecycle-actions.js +45 -0
- package/dist/presentation/tui/tui-manual-compaction.d.ts +18 -0
- package/dist/presentation/tui/tui-manual-compaction.js +31 -0
- package/dist/presentation/tui/tui-media-model-selection.d.ts +12 -0
- package/dist/presentation/tui/tui-media-model-selection.js +38 -0
- package/dist/presentation/tui/tui-prompt-dispatcher.d.ts +16 -0
- package/dist/presentation/tui/tui-prompt-dispatcher.js +38 -0
- package/dist/presentation/tui/tui-skill-controller.d.ts +11 -0
- package/dist/presentation/tui/tui-skill-controller.js +13 -0
- package/dist/presentation/tui/tui-tool-approval.d.ts +22 -0
- package/dist/presentation/tui/tui-tool-approval.js +73 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/package.json +9 -8
- package/scripts/install-native.mjs +11 -11
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AuthenticationService } from '../../application/auth/authentication-service.js';
|
|
2
|
+
import { loadExecutionConfig } from '../../application/config/execution-config.js';
|
|
3
|
+
import { createLotaGateClient } from '../../infrastructure/sdk/lotagate-client-factory.js';
|
|
4
|
+
import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
|
|
5
|
+
import { runGoalLoop } from '../../application/orchestration/goal-runner.js';
|
|
6
|
+
import { formatCommandHint, MODEL_SELECT_HINT, TRUST_GRANT_HINT } from '../../application/commands/command-hints.js';
|
|
7
|
+
export async function runTuiGoal(options, objective, limits = {}) {
|
|
8
|
+
await runGoalLoopForTui(options, objective, true, limits);
|
|
9
|
+
}
|
|
10
|
+
export async function resumeTuiGoal(options) {
|
|
11
|
+
if (options.sessionId === undefined) {
|
|
12
|
+
options.write('No active session.');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const state = await options.runtime.goalStore.get(options.sessionId);
|
|
16
|
+
if (state === undefined) {
|
|
17
|
+
options.write('No active goal.');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
await runGoalLoopForTui(options, state.objective, false);
|
|
21
|
+
}
|
|
22
|
+
async function runGoalLoopForTui(options, objective, replace, limits = {}) {
|
|
23
|
+
if (options.sessionId === undefined) {
|
|
24
|
+
options.write('No active session.');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const identity = await options.runtime.projectTrust.inspect(options.cwd);
|
|
28
|
+
if (!await options.runtime.projectTrust.isTrusted(identity)) {
|
|
29
|
+
options.write(`Project is not trusted. ${formatCommandHint(TRUST_GRANT_HINT, 'tui')}`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const loaded = await loadExecutionConfig(options.runtime, options.cwd);
|
|
33
|
+
const model = options.model ?? loaded.config.model;
|
|
34
|
+
if (model === null) {
|
|
35
|
+
options.write(`No model is selected. ${formatCommandHint(MODEL_SELECT_HINT, 'tui')}`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const profile = options.profile ?? loaded.config.profile ?? AuthenticationService.defaultProfileName();
|
|
39
|
+
const credential = await options.runtime.auth.requireCredential(profile);
|
|
40
|
+
const goal = replace
|
|
41
|
+
? await options.runtime.goalStore.replace(options.sessionId, { objective, maxTurns: RESOURCE_LIMITS.goalDefaultMaxTurns, maxDurationMs: RESOURCE_LIMITS.goalDefaultMaxDurationMs, ...limits })
|
|
42
|
+
: await resumeGoal(options.sessionId, options.runtime);
|
|
43
|
+
const client = createLotaGateClient(credential.profile, credential.apiKey);
|
|
44
|
+
await runGoalLoop({
|
|
45
|
+
runtime: options.runtime, sessionId: options.sessionId, objective: goal.objective, model, client,
|
|
46
|
+
runTurn: (prompt, callbacks) => options.runPrompt(prompt, callbacks),
|
|
47
|
+
onMessage: options.write,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async function resumeGoal(sessionId, runtime) {
|
|
51
|
+
return runtime.goalStore.resume(sessionId);
|
|
52
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AuthenticationService } from '../../application/auth/authentication-service.js';
|
|
2
|
+
import { CachedModelCatalog, modelCatalogCacheKey } from '../../application/model/cached-model-catalog.js';
|
|
3
|
+
import { ModelCatalogAdapter } from '../../infrastructure/sdk/model-catalog-adapter.js';
|
|
4
|
+
import { createLotaGateClient } from '../../infrastructure/sdk/lotagate-client-factory.js';
|
|
5
|
+
import { selectInitialModel } from '../../application/model/initial-model-selection.js';
|
|
6
|
+
export async function resolveInitialModel(runtime, cwd, config) {
|
|
7
|
+
if (config.model !== null && config.model.trim().length > 0)
|
|
8
|
+
return config.model;
|
|
9
|
+
const profileName = config.profile ?? AuthenticationService.defaultProfileName();
|
|
10
|
+
let credential;
|
|
11
|
+
try {
|
|
12
|
+
credential = await runtime.credentialStore.get(profileName);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
runtime.logger.warn('Unable to load credentials while selecting the initial model.', { reason: error instanceof Error ? error.message : String(error) });
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (credential === undefined)
|
|
19
|
+
return null;
|
|
20
|
+
try {
|
|
21
|
+
const catalog = new CachedModelCatalog(new ModelCatalogAdapter(createLotaGateClient(credential.profile, credential.apiKey)), runtime.cache, modelCatalogCacheKey(credential.profile.name, credential.profile.baseUrl), runtime.cachePolicy.modelCatalogTtlMs);
|
|
22
|
+
return await selectInitialModel(config.model, { list: () => catalog.listModels() }, (model) => runtime.configLoader.setGlobal('model', model));
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
runtime.logger.warn('Unable to select the first model from the catalog.', { reason: error instanceof Error ? error.message : String(error) });
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HookDefinition, HookEvent } from '../../domain/extensions/hook-manifest.js';
|
|
2
|
+
import type { HookRuntime } from '../../infrastructure/extensions/hook-runtime.js';
|
|
3
|
+
import type { InkTuiBridge } from './ink/tui-bridge.js';
|
|
4
|
+
export interface TuiInterruptState {
|
|
5
|
+
lastInterruptAt: number;
|
|
6
|
+
exitArmedUntil: number;
|
|
7
|
+
printResumeCommandOnExit: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function handleTuiInterrupt(state: TuiInterruptState, activeAbortController: AbortController | undefined, renderer: InkTuiBridge): TuiInterruptState;
|
|
10
|
+
export declare function cancelTuiResponse(activeAbortController: AbortController | undefined, renderer: InkTuiBridge): void;
|
|
11
|
+
export declare function runTuiHookEvent(hookRuntime: HookRuntime | undefined, hooks: readonly HookDefinition[], event: HookEvent, cwd: string, sessionId: string): Promise<void>;
|
|
12
|
+
export declare function isAbortError(error: unknown): boolean;
|
|
13
|
+
export declare function throwIfAborted(signal: AbortSignal): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function handleTuiInterrupt(state, activeAbortController, renderer) {
|
|
2
|
+
const now = Date.now();
|
|
3
|
+
if (now - state.lastInterruptAt < 75)
|
|
4
|
+
return state;
|
|
5
|
+
if (activeAbortController !== undefined && !activeAbortController.signal.aborted) {
|
|
6
|
+
activeAbortController.abort();
|
|
7
|
+
renderer.cancelled();
|
|
8
|
+
renderer.notice('Interrupted. Press Ctrl+C again within 2 seconds to exit.');
|
|
9
|
+
return { ...state, lastInterruptAt: now, exitArmedUntil: now + 2000 };
|
|
10
|
+
}
|
|
11
|
+
if (now <= state.exitArmedUntil) {
|
|
12
|
+
renderer.requestExit();
|
|
13
|
+
return { ...state, lastInterruptAt: now, printResumeCommandOnExit: true };
|
|
14
|
+
}
|
|
15
|
+
renderer.notice('Press Ctrl+C again within 2 seconds to exit.');
|
|
16
|
+
return { ...state, lastInterruptAt: now, exitArmedUntil: now + 2000 };
|
|
17
|
+
}
|
|
18
|
+
export function cancelTuiResponse(activeAbortController, renderer) {
|
|
19
|
+
if (activeAbortController === undefined)
|
|
20
|
+
return;
|
|
21
|
+
activeAbortController.abort();
|
|
22
|
+
renderer.cancelled();
|
|
23
|
+
renderer.notice('Stopping response…');
|
|
24
|
+
}
|
|
25
|
+
export async function runTuiHookEvent(hookRuntime, hooks, event, cwd, sessionId) {
|
|
26
|
+
if (hookRuntime === undefined || hooks.length === 0)
|
|
27
|
+
return;
|
|
28
|
+
await hookRuntime.runEvent(hooks, event, { sessionId, runId: `hook-${Date.now()}`, iteration: 0, cwd, workspaceRoot: cwd, maxResultBytes: 256 * 1024 });
|
|
29
|
+
}
|
|
30
|
+
export function isAbortError(error) {
|
|
31
|
+
if (!(error instanceof Error))
|
|
32
|
+
return false;
|
|
33
|
+
if (error.name === 'AbortError' || error.message.toLowerCase().includes('aborted'))
|
|
34
|
+
return true;
|
|
35
|
+
return error.cause !== undefined && isAbortError(error.cause);
|
|
36
|
+
}
|
|
37
|
+
export function throwIfAborted(signal) {
|
|
38
|
+
if (!signal.aborted)
|
|
39
|
+
return;
|
|
40
|
+
if (signal.reason instanceof Error && signal.reason.name === 'AbortError')
|
|
41
|
+
throw signal.reason;
|
|
42
|
+
const error = new Error(signal.reason instanceof Error && signal.reason.message.length > 0 ? signal.reason.message : 'The operation was aborted.');
|
|
43
|
+
error.name = 'AbortError';
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CliRuntime } from '../../bootstrap/runtime-factory.js';
|
|
2
|
+
import type { SessionMetadata } from '../../domain/session/session.js';
|
|
3
|
+
import type { CliAgentSessionStore } from '../../application/agent/agent-session-store.js';
|
|
4
|
+
import type { TuiContextService } from './tui-context-service.js';
|
|
5
|
+
import type { InkTuiBridge } from './ink/tui-bridge.js';
|
|
6
|
+
export interface TuiManualCompactionOptions {
|
|
7
|
+
runtime: CliRuntime;
|
|
8
|
+
cwd: string;
|
|
9
|
+
session: SessionMetadata | undefined;
|
|
10
|
+
activeModel: string | null;
|
|
11
|
+
activeProfile: string | null;
|
|
12
|
+
activeResponse: boolean;
|
|
13
|
+
renderer: InkTuiBridge;
|
|
14
|
+
contextService: TuiContextService;
|
|
15
|
+
agentSessionStore: CliAgentSessionStore;
|
|
16
|
+
refreshContextUsage: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function compactManualTuiSession(options: TuiManualCompactionOptions): Promise<void>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AuthenticationService } from '../../application/auth/authentication-service.js';
|
|
2
|
+
import { loadExecutionConfig } from '../../application/config/execution-config.js';
|
|
3
|
+
import { createLotaGateClient } from '../../infrastructure/sdk/lotagate-client-factory.js';
|
|
4
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
5
|
+
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
6
|
+
import { MODEL_SELECT_HINT } from '../../application/commands/command-hints.js';
|
|
7
|
+
import { compactTuiSession } from './tui-context-compaction.js';
|
|
8
|
+
export async function compactManualTuiSession(options) {
|
|
9
|
+
if (options.activeResponse)
|
|
10
|
+
throw new Error('Stop the active response before compacting the session.');
|
|
11
|
+
if (options.session === undefined) {
|
|
12
|
+
options.renderer.notice('No active session.');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const loaded = await loadExecutionConfig(options.runtime, options.cwd);
|
|
16
|
+
const model = options.session.model ?? options.activeModel ?? loaded.config.model;
|
|
17
|
+
if (model === null)
|
|
18
|
+
throw new CliError(CLI_ERROR_CODES.MODEL_NOT_FOUND, 'No model is selected.', { category: 'model', userMessage: 'No model is selected.', hint: MODEL_SELECT_HINT });
|
|
19
|
+
const profile = options.session.profile ?? options.activeProfile ?? loaded.config.profile ?? AuthenticationService.defaultProfileName();
|
|
20
|
+
const credential = await options.runtime.auth.requireCredential(profile);
|
|
21
|
+
const contextWindow = await options.contextService.getModelContextWindow(model, profile);
|
|
22
|
+
options.renderer.activity('Compacting context manually…', 0);
|
|
23
|
+
try {
|
|
24
|
+
const compacted = await compactTuiSession(options.runtime, options.agentSessionStore, options.session.id, createLotaGateClient(credential.profile, credential.apiKey), model, contextWindow, (error) => options.runtime.logger.warn('Context summarization failed; using fallback summary.', { reason: error instanceof Error ? error.message : String(error) }));
|
|
25
|
+
options.renderer.transcriptNotice(compacted ? 'Context compacted manually.' : 'No conversation to compact.');
|
|
26
|
+
await options.refreshContextUsage();
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
options.renderer.clearActivity();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CommandInvocation } from '../../application/commands/command-contract.js';
|
|
2
|
+
import type { TuiChoice } from './ink/tui-bridge.js';
|
|
3
|
+
import type { loadModelCatalog } from '../../application/model/model-catalog-service.js';
|
|
4
|
+
export type MediaModelCategory = 'image' | 'speech' | 'transcription' | 'translation' | 'video';
|
|
5
|
+
type ModelCatalog = Awaited<ReturnType<typeof loadModelCatalog>>;
|
|
6
|
+
export interface TuiMediaModelSelectionDependencies {
|
|
7
|
+
readonly loadModels: () => Promise<ModelCatalog>;
|
|
8
|
+
readonly selectModel: (title: string, choices: readonly TuiChoice[]) => Promise<string | undefined>;
|
|
9
|
+
}
|
|
10
|
+
/** Adds a request-only media model selection without changing persisted configuration. */
|
|
11
|
+
export declare function prepareTuiMediaInvocation(invocation: CommandInvocation, dependencies: TuiMediaModelSelectionDependencies): Promise<CommandInvocation | undefined>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
2
|
+
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
3
|
+
const MEDIA_MODEL_CATEGORY_BY_ACTION = {
|
|
4
|
+
'image.generate': 'image',
|
|
5
|
+
'image.edit': 'image',
|
|
6
|
+
'audio.speech': 'speech',
|
|
7
|
+
'audio.transcribe': 'transcription',
|
|
8
|
+
'audio.translate': 'translation',
|
|
9
|
+
'video.generate': 'video',
|
|
10
|
+
};
|
|
11
|
+
/** Adds a request-only media model selection without changing persisted configuration. */
|
|
12
|
+
export async function prepareTuiMediaInvocation(invocation, dependencies) {
|
|
13
|
+
const category = MEDIA_MODEL_CATEGORY_BY_ACTION[invocation.action.id];
|
|
14
|
+
if (category === undefined || invocation.options.has('model'))
|
|
15
|
+
return invocation;
|
|
16
|
+
const catalog = await dependencies.loadModels();
|
|
17
|
+
const candidates = catalog.data.filter((model) => model['model_category'] === category);
|
|
18
|
+
if (candidates.length === 0) {
|
|
19
|
+
throw new CliError(CLI_ERROR_CODES.MODEL_NOT_FOUND, `No ${category} models are available.`, {
|
|
20
|
+
category: 'model',
|
|
21
|
+
userMessage: `No ${category} models are available for this command.`,
|
|
22
|
+
details: { category },
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const selected = await dependencies.selectModel(`Select ${category} model`, candidates.map((model) => ({ value: model.id, label: model.id })));
|
|
26
|
+
if (selected === undefined)
|
|
27
|
+
return undefined;
|
|
28
|
+
const selectedModel = candidates.find((model) => model.id === selected);
|
|
29
|
+
if (selectedModel === undefined) {
|
|
30
|
+
throw new CliError(CLI_ERROR_CODES.MODEL_NOT_FOUND, 'The selected media model is no longer available.', {
|
|
31
|
+
category: 'model',
|
|
32
|
+
userMessage: 'The selected media model is no longer available. Refresh the model list and try again.',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const options = new Map(invocation.options);
|
|
36
|
+
options.set('model', selectedModel.id);
|
|
37
|
+
return { ...invocation, options };
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Logger } from '../../ports/logger.js';
|
|
2
|
+
import type { AttachmentPayload } from '../../domain/session/attachment.js';
|
|
3
|
+
import type { PendingAttachmentStore } from '../../application/chat/pending-attachment-store.js';
|
|
4
|
+
import type { InkTuiBridge } from './ink/tui-bridge.js';
|
|
5
|
+
import type { TuiCommandContext } from './tui-command-context.js';
|
|
6
|
+
import type { TuiCommandHost } from './tui-command-executor.js';
|
|
7
|
+
export interface TuiPromptDispatcherOptions {
|
|
8
|
+
renderer: InkTuiBridge;
|
|
9
|
+
logger: Logger;
|
|
10
|
+
commandHost: TuiCommandHost;
|
|
11
|
+
pendingAttachments: PendingAttachmentStore;
|
|
12
|
+
commandContext: () => TuiCommandContext;
|
|
13
|
+
sendPrompt: (input: string, attachments: readonly AttachmentPayload[]) => Promise<unknown>;
|
|
14
|
+
resetActiveAbortController: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function dispatchTuiPrompt(input: string, options: TuiPromptDispatcherOptions): Promise<boolean>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { asCliError } from '../../domain/errors/cli-error.js';
|
|
2
|
+
import { parseCommandInvocation, tokenizeCommandInput } from '../../application/commands/command-parser.js';
|
|
3
|
+
import { COMMAND_REGISTRY } from '../../application/commands/command-runtime.js';
|
|
4
|
+
import { formatCliErrorMessage } from '../../application/commands/command-hints.js';
|
|
5
|
+
import { executeTuiCommand } from './tui-command-executor.js';
|
|
6
|
+
export async function dispatchTuiPrompt(input, options) {
|
|
7
|
+
if (input.trimStart().startsWith('/'))
|
|
8
|
+
return dispatchSlashCommand(input, options);
|
|
9
|
+
options.logger.info('Interactive prompt started.', { promptLength: input.length, attachmentCount: options.pendingAttachments.size });
|
|
10
|
+
try {
|
|
11
|
+
await options.sendPrompt(input, options.pendingAttachments.list());
|
|
12
|
+
options.logger.info('Interactive prompt completed.', { promptLength: input.length });
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
options.resetActiveAbortController();
|
|
16
|
+
options.renderer.failed();
|
|
17
|
+
const cliError = asCliError(error);
|
|
18
|
+
options.logger.error('Prompt execution failed.', { code: cliError.code, category: cliError.category, ...(cliError.details ?? {}) });
|
|
19
|
+
options.renderer.error(formatCliErrorMessage(cliError, 'tui'));
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
async function dispatchSlashCommand(input, options) {
|
|
24
|
+
options.renderer.command(input);
|
|
25
|
+
try {
|
|
26
|
+
const invocation = parseCommandInvocation(tokenizeCommandInput(input.trimStart().slice(1)), 'tui', COMMAND_REGISTRY);
|
|
27
|
+
options.logger.info('Slash command started.', { command: invocation.action.id });
|
|
28
|
+
const exit = await executeTuiCommand(invocation, options.commandHost, options.commandContext());
|
|
29
|
+
options.logger.info('Slash command completed.', { command: invocation.action.id, exit });
|
|
30
|
+
return exit;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const cliError = asCliError(error);
|
|
34
|
+
options.logger.error('Slash command failed.', { code: cliError.code, category: cliError.category });
|
|
35
|
+
options.renderer.error(formatCliErrorMessage(cliError, 'tui'));
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SkillManifest } from '../../domain/extensions/skill-manifest.js';
|
|
2
|
+
import type { ExtensionScope } from '../../domain/extensions/extension-scope.js';
|
|
3
|
+
import type { TuiCommandContext } from './tui-command-context.js';
|
|
4
|
+
import { type ScopedSkill } from '../../infrastructure/extensions/skill-manager.js';
|
|
5
|
+
import type { SkillRootScope } from '../../infrastructure/extensions/skill-roots.js';
|
|
6
|
+
export interface TuiSkillControllerOptions {
|
|
7
|
+
globalConfigDir: string;
|
|
8
|
+
skillRootScopes: readonly SkillRootScope[];
|
|
9
|
+
runPrompt: (prompt: string, skill?: SkillManifest) => Promise<string>;
|
|
10
|
+
}
|
|
11
|
+
export declare function runTuiSkill(options: TuiSkillControllerOptions, name: string, args: readonly string[], context: TuiCommandContext, scope?: ExtensionScope, availableSkills?: readonly ScopedSkill[]): Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { SkillManager } from '../../infrastructure/extensions/skill-manager.js';
|
|
3
|
+
export async function runTuiSkill(options, name, args, context, scope, availableSkills) {
|
|
4
|
+
const skills = availableSkills ?? await new SkillManager(path.join(options.globalConfigDir, 'skills-state.json')).listScoped(options.skillRootScopes, { includeShadowed: true });
|
|
5
|
+
const skill = skills.find((item) => (item.skillKey === name || item.name === name) && (scope === undefined || item.scope === scope));
|
|
6
|
+
if (skill === undefined || !skill.enabled || !skill.userInvocable) {
|
|
7
|
+
context.write(`Skill unavailable: ${name}`);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const requestedScope = args.join(' ').trim();
|
|
11
|
+
const prompt = requestedScope.length === 0 ? skill.body : `${skill.body}\n\nRequested scope: ${requestedScope}`;
|
|
12
|
+
await options.runPrompt(prompt, skill);
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CliRuntime } from '../../bootstrap/runtime-factory.js';
|
|
2
|
+
import type { ToolApprovalRequest } from '@lotagate/agent-sdk';
|
|
3
|
+
import { ToolApprovalService, type CliApprovalMode, type ToolApprovalDecision } from '../../application/security/tool-approval-service.js';
|
|
4
|
+
import type { SkillScopeStore } from '../../application/extensions/skill-scope-store.js';
|
|
5
|
+
import type { WorkspacePermissionPolicy } from '../../domain/workspace/workspace-settings.js';
|
|
6
|
+
import type { InkTuiBridge } from './ink/tui-bridge.js';
|
|
7
|
+
export interface TuiToolApprovalHost {
|
|
8
|
+
readonly renderer: InkTuiBridge;
|
|
9
|
+
readonly runtime: CliRuntime;
|
|
10
|
+
getSessionId(): string | undefined;
|
|
11
|
+
getActiveSignal(): AbortSignal | undefined;
|
|
12
|
+
}
|
|
13
|
+
/** Owns the TUI adapter around the application-layer approval service. */
|
|
14
|
+
export declare class TuiToolApprovalCoordinator {
|
|
15
|
+
private readonly host;
|
|
16
|
+
constructor(host: TuiToolApprovalHost);
|
|
17
|
+
ask(request: ToolApprovalRequest): Promise<boolean>;
|
|
18
|
+
create(mode: CliApprovalMode, trustedProject: boolean, workspaceRoot: string, skillScopes?: SkillScopeStore, workspacePermissions?: WorkspacePermissionPolicy): ToolApprovalService;
|
|
19
|
+
remember(workspaceRoot: string, request: ToolApprovalRequest): Promise<void>;
|
|
20
|
+
audit(decision: ToolApprovalDecision): Promise<void>;
|
|
21
|
+
rememberFailure(error: unknown): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ToolApprovalService } from '../../application/security/tool-approval-service.js';
|
|
2
|
+
import { permissionRuleForRequest } from '../../application/security/workspace-permission-policy.js';
|
|
3
|
+
import { formatShellCommandForDisplay, formatToolActivityName } from '../../application/agent/tool-display.js';
|
|
4
|
+
/** Owns the TUI adapter around the application-layer approval service. */
|
|
5
|
+
export class TuiToolApprovalCoordinator {
|
|
6
|
+
host;
|
|
7
|
+
constructor(host) {
|
|
8
|
+
this.host = host;
|
|
9
|
+
}
|
|
10
|
+
async ask(request) {
|
|
11
|
+
this.host.renderer.status('Waiting for approval');
|
|
12
|
+
try {
|
|
13
|
+
return await this.host.renderer.confirmTool(request.toolName, describeToolApproval(request));
|
|
14
|
+
}
|
|
15
|
+
finally {
|
|
16
|
+
const signal = this.host.getActiveSignal();
|
|
17
|
+
if (signal !== undefined && !signal.aborted)
|
|
18
|
+
this.host.renderer.status('Thinking');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
create(mode, trustedProject, workspaceRoot, skillScopes, workspacePermissions) {
|
|
22
|
+
return new ToolApprovalService({
|
|
23
|
+
mode,
|
|
24
|
+
trustedProject,
|
|
25
|
+
...(skillScopes === undefined ? {} : { skillScopes }),
|
|
26
|
+
...(workspacePermissions === undefined ? {} : { workspacePermissions }),
|
|
27
|
+
prompt: (request) => this.ask(request),
|
|
28
|
+
...(trustedProject ? { rememberApproval: (request) => this.remember(workspaceRoot, request) } : {}),
|
|
29
|
+
...(trustedProject ? { onRememberApprovalFailure: (_request, error) => this.rememberFailure(error) } : {}),
|
|
30
|
+
audit: (decision) => this.audit(decision),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async remember(workspaceRoot, request) {
|
|
34
|
+
await this.host.runtime.workspaceSettings.rememberAllow(workspaceRoot, permissionRuleForRequest(request.toolName, request.input));
|
|
35
|
+
}
|
|
36
|
+
async audit(decision) {
|
|
37
|
+
this.host.runtime.logger.info('Tool authorization decision.', {
|
|
38
|
+
toolName: decision.toolName,
|
|
39
|
+
decision: decision.decision,
|
|
40
|
+
reason: decision.reason,
|
|
41
|
+
...(decision.source === undefined ? {} : { source: decision.source }),
|
|
42
|
+
...(decision.skillName === undefined ? {} : { skillName: decision.skillName }),
|
|
43
|
+
});
|
|
44
|
+
const sessionId = this.host.getSessionId();
|
|
45
|
+
if (sessionId === undefined)
|
|
46
|
+
return;
|
|
47
|
+
await this.host.runtime.sessionStore.appendEvent({
|
|
48
|
+
type: 'tool.approval',
|
|
49
|
+
timestamp: new Date().toISOString(),
|
|
50
|
+
sessionId,
|
|
51
|
+
data: { toolName: decision.toolName, ...(decision.source === undefined ? {} : { source: decision.source }), ...(decision.skillName === undefined ? {} : { skillName: decision.skillName }), decision: decision.decision, reason: decision.reason },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
rememberFailure(error) {
|
|
55
|
+
this.host.runtime.logger.warn('Unable to persist tool approval.', { reason: error instanceof Error ? error.message : String(error) });
|
|
56
|
+
this.host.renderer.notice('Approval accepted for this action, but could not be remembered.');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function describeToolApproval(request) {
|
|
60
|
+
if (request.toolName === 'filesystem.write')
|
|
61
|
+
return `Write workspace file: ${safeApprovalValue(request.input['path'])}`;
|
|
62
|
+
if (request.toolName === 'shell.exec') {
|
|
63
|
+
const command = typeof request.input['command'] === 'string' ? request.input['command'] : '';
|
|
64
|
+
const args = Array.isArray(request.input['args']) ? request.input['args'].filter((value) => typeof value === 'string') : [];
|
|
65
|
+
return truncateApprovalDetail(`Run command: ${formatShellCommandForDisplay(command, args, 240)}`);
|
|
66
|
+
}
|
|
67
|
+
return `This ${formatToolActivityName(request.toolName)} operation may change workspace or external state.`;
|
|
68
|
+
}
|
|
69
|
+
function safeApprovalValue(value) {
|
|
70
|
+
const text = typeof value === 'string' ? value : String(value ?? '');
|
|
71
|
+
return truncateApprovalDetail(text.replace(/Bearer\s+[^\s]+/giu, 'Bearer [REDACTED]').replace(/sk-[A-Za-z0-9_-]{8,}/gu, '[REDACTED]'));
|
|
72
|
+
}
|
|
73
|
+
function truncateApprovalDetail(value) { return value.length <= 240 ? value : `${value.slice(0, 237)}...`; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CLI_VERSION = "0.1.22";
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CLI_VERSION = '0.1.22';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lotagate/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "Enterprise-grade terminal client for LotaGate AI agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,19 +62,20 @@
|
|
|
62
62
|
"prepack": "npm run build"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@lotagate/agent-sdk": "^0.1.
|
|
65
|
+
"@lotagate/agent-sdk": "^0.1.5",
|
|
66
|
+
"@lotagate/cli": "^0.1.6",
|
|
66
67
|
"@lotagate/sdk": "^0.1.2",
|
|
67
68
|
"ink": "^7.1.1",
|
|
68
69
|
"react": "^19.2.4",
|
|
69
70
|
"tiktoken": "^1.0.22"
|
|
70
71
|
},
|
|
71
72
|
"optionalDependencies": {
|
|
72
|
-
"@lotagate/cli-native-linux-arm64-gnu": "0.1.
|
|
73
|
-
"@lotagate/cli-native-linux-x64-gnu": "0.1.
|
|
74
|
-
"@lotagate/cli-native-macos-arm64": "0.1.
|
|
75
|
-
"@lotagate/cli-native-macos-x64": "0.1.
|
|
76
|
-
"@lotagate/cli-native-windows-arm64": "0.1.
|
|
77
|
-
"@lotagate/cli-native-windows-x64": "0.1.
|
|
73
|
+
"@lotagate/cli-native-linux-arm64-gnu": "0.1.22",
|
|
74
|
+
"@lotagate/cli-native-linux-x64-gnu": "0.1.22",
|
|
75
|
+
"@lotagate/cli-native-macos-arm64": "0.1.22",
|
|
76
|
+
"@lotagate/cli-native-macos-x64": "0.1.22",
|
|
77
|
+
"@lotagate/cli-native-windows-arm64": "0.1.22",
|
|
78
|
+
"@lotagate/cli-native-windows-x64": "0.1.22"
|
|
78
79
|
},
|
|
79
80
|
"devDependencies": {
|
|
80
81
|
"@eslint/js": "9.39.5",
|
|
@@ -13,17 +13,17 @@ if (existsSync(resolve(packageRoot, '.git'))) process.exit(0);
|
|
|
13
13
|
if (target === undefined) await installNodeFallback();
|
|
14
14
|
else await installNativeTarget(target);
|
|
15
15
|
|
|
16
|
-
function findInstalledNativePackageRoot(packageName) {
|
|
17
|
-
const segments = packageName.split('/');
|
|
18
|
-
for (let current = packageRoot; ; current = dirname(current)) {
|
|
19
|
-
const candidate = resolve(current, 'node_modules', ...segments);
|
|
20
|
-
if (existsSync(resolve(candidate, 'package.json'))) return candidate;
|
|
21
|
-
const parent = dirname(current);
|
|
22
|
-
if (parent === current) break;
|
|
23
|
-
}
|
|
24
|
-
return resolve(packageRoot, 'node_modules', ...segments);
|
|
25
|
-
}
|
|
26
|
-
|
|
16
|
+
function findInstalledNativePackageRoot(packageName) {
|
|
17
|
+
const segments = packageName.split('/');
|
|
18
|
+
for (let current = packageRoot; ; current = dirname(current)) {
|
|
19
|
+
const candidate = resolve(current, 'node_modules', ...segments);
|
|
20
|
+
if (existsSync(resolve(candidate, 'package.json'))) return candidate;
|
|
21
|
+
const parent = dirname(current);
|
|
22
|
+
if (parent === current) break;
|
|
23
|
+
}
|
|
24
|
+
return resolve(packageRoot, 'node_modules', ...segments);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
27
|
async function installNativeTarget(nativeTarget) {
|
|
28
28
|
const nativePackageRoot = findInstalledNativePackageRoot(nativeTarget.packageName);
|
|
29
29
|
const source = resolve(nativePackageRoot, 'bin', nativeTarget.binaryName);
|