@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,98 @@
|
|
|
1
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
2
|
+
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
3
|
+
import { WindowsClipboardAdapter } from './windows-clipboard-adapter.js';
|
|
4
|
+
import { detectHostPlatform } from '../platform/host-platform.js';
|
|
5
|
+
import { spawnPlatformProcess } from '../platform/host-process.js';
|
|
6
|
+
import { CLIPBOARD_POLICY, clipboardUnavailableError, isClipboardUnavailableError } from './clipboard-policy.js';
|
|
7
|
+
export function createClipboardAdapter(platform = detectHostPlatform()) {
|
|
8
|
+
if (platform.id === 'windows')
|
|
9
|
+
return new WindowsClipboardAdapter(platform);
|
|
10
|
+
if (platform.id === 'macos')
|
|
11
|
+
return new FallbackClipboardAdapter([
|
|
12
|
+
new ProcessClipboardAdapter('pbpaste', ['-Prefer', 'png'], 'image/png', platform),
|
|
13
|
+
]);
|
|
14
|
+
if (platform.id === 'linux' || platform.id === 'bsd')
|
|
15
|
+
return new FallbackClipboardAdapter([
|
|
16
|
+
new ProcessClipboardAdapter('wl-paste', ['--no-newline', '--type', 'image/png'], 'image/png', platform),
|
|
17
|
+
new ProcessClipboardAdapter('xclip', ['-selection', 'clipboard', '-target', 'image/png', '-out'], 'image/png', platform),
|
|
18
|
+
]);
|
|
19
|
+
return new UnsupportedClipboardAdapter();
|
|
20
|
+
}
|
|
21
|
+
export class ProcessClipboardAdapter {
|
|
22
|
+
command;
|
|
23
|
+
args;
|
|
24
|
+
mimeType;
|
|
25
|
+
platform;
|
|
26
|
+
constructor(command, args, mimeType, platform = detectHostPlatform()) {
|
|
27
|
+
this.command = command;
|
|
28
|
+
this.args = args;
|
|
29
|
+
this.mimeType = mimeType;
|
|
30
|
+
this.platform = platform;
|
|
31
|
+
}
|
|
32
|
+
async readImage() {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const child = spawnPlatformProcess(this.command, this.args, this.platform, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
35
|
+
const chunks = [];
|
|
36
|
+
let size = 0;
|
|
37
|
+
let settled = false;
|
|
38
|
+
const finish = (callback) => {
|
|
39
|
+
if (settled)
|
|
40
|
+
return;
|
|
41
|
+
settled = true;
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
callback();
|
|
44
|
+
};
|
|
45
|
+
const timer = setTimeout(() => {
|
|
46
|
+
child.kill();
|
|
47
|
+
finish(() => reject(clipboardUnavailableError(`Clipboard image read timed out after ${CLIPBOARD_POLICY.timeoutMs}ms.`)));
|
|
48
|
+
}, CLIPBOARD_POLICY.timeoutMs);
|
|
49
|
+
child.stdout?.on('data', (chunk) => {
|
|
50
|
+
if (settled)
|
|
51
|
+
return;
|
|
52
|
+
size += chunk.byteLength;
|
|
53
|
+
if (size > CLIPBOARD_POLICY.maxImageBytes) {
|
|
54
|
+
child.kill();
|
|
55
|
+
finish(() => reject(new CliError(CLI_ERROR_CODES.ATTACHMENT_TOO_LARGE, 'Clipboard image is too large.', { category: 'attachment', userMessage: 'Clipboard image exceeds the maximum allowed size.' })));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
chunks.push(chunk);
|
|
59
|
+
});
|
|
60
|
+
child.once('error', () => finish(() => resolve(undefined)));
|
|
61
|
+
child.once('close', (code) => {
|
|
62
|
+
finish(() => {
|
|
63
|
+
if (code !== 0 || chunks.length === 0)
|
|
64
|
+
resolve(undefined);
|
|
65
|
+
else
|
|
66
|
+
resolve({ bytes: Buffer.concat(chunks), mimeType: this.mimeType });
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
class FallbackClipboardAdapter {
|
|
73
|
+
adapters;
|
|
74
|
+
constructor(adapters) {
|
|
75
|
+
this.adapters = adapters;
|
|
76
|
+
}
|
|
77
|
+
async readImage() {
|
|
78
|
+
let unavailable;
|
|
79
|
+
for (const adapter of this.adapters) {
|
|
80
|
+
try {
|
|
81
|
+
const image = await adapter.readImage();
|
|
82
|
+
if (image !== undefined)
|
|
83
|
+
return image;
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (!isClipboardUnavailableError(error))
|
|
87
|
+
throw error;
|
|
88
|
+
unavailable = error;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
throw unavailable ?? clipboardUnavailableError('No supported clipboard image provider was found.');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
class UnsupportedClipboardAdapter {
|
|
95
|
+
async readImage() {
|
|
96
|
+
throw clipboardUnavailableError('Clipboard image support is unavailable on this platform.');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
2
|
+
export declare const CLIPBOARD_POLICY: {
|
|
3
|
+
readonly maxImageBytes: number;
|
|
4
|
+
readonly maxTextBytes: number;
|
|
5
|
+
readonly timeoutMs: 15000;
|
|
6
|
+
};
|
|
7
|
+
export declare function clipboardUnavailableError(message: string, cause?: unknown): CliError;
|
|
8
|
+
export declare function isClipboardUnavailableError(error: unknown): error is CliError;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
2
|
+
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
3
|
+
import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
|
|
4
|
+
export const CLIPBOARD_POLICY = {
|
|
5
|
+
maxImageBytes: RESOURCE_LIMITS.maxAttachmentBytes,
|
|
6
|
+
maxTextBytes: RESOURCE_LIMITS.clipboardTextBytes,
|
|
7
|
+
timeoutMs: RESOURCE_LIMITS.clipboardTimeoutMs,
|
|
8
|
+
};
|
|
9
|
+
export function clipboardUnavailableError(message, cause) {
|
|
10
|
+
return new CliError(CLI_ERROR_CODES.ATTACHMENT_CLIPBOARD_UNAVAILABLE, message, {
|
|
11
|
+
category: 'attachment',
|
|
12
|
+
userMessage: 'Unable to read from the clipboard. Copy the content again and retry.',
|
|
13
|
+
retryable: true,
|
|
14
|
+
...(cause === undefined ? {} : { cause }),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function isClipboardUnavailableError(error) {
|
|
18
|
+
return error instanceof CliError && error.code === CLI_ERROR_CODES.ATTACHMENT_CLIPBOARD_UNAVAILABLE;
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClipboardTextAdapter } from '../../ports/clipboard-text-adapter.js';
|
|
2
|
+
import { type HostPlatformContext } from '../platform/host-platform.js';
|
|
3
|
+
export declare function createClipboardTextAdapter(platform?: HostPlatformContext): ClipboardTextAdapter;
|
|
4
|
+
export declare class ProcessClipboardTextAdapter implements ClipboardTextAdapter {
|
|
5
|
+
private readonly command;
|
|
6
|
+
private readonly args;
|
|
7
|
+
private readonly platform;
|
|
8
|
+
constructor(command: string, args: readonly string[], platform?: HostPlatformContext);
|
|
9
|
+
readText(): Promise<string | undefined>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
2
|
+
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
3
|
+
import { WindowsClipboardTextAdapter } from './windows-clipboard-text-adapter.js';
|
|
4
|
+
import { detectHostPlatform } from '../platform/host-platform.js';
|
|
5
|
+
import { spawnPlatformProcess } from '../platform/host-process.js';
|
|
6
|
+
import { CLIPBOARD_POLICY, clipboardUnavailableError, isClipboardUnavailableError } from './clipboard-policy.js';
|
|
7
|
+
export function createClipboardTextAdapter(platform = detectHostPlatform()) {
|
|
8
|
+
if (platform.id === 'windows')
|
|
9
|
+
return new WindowsClipboardTextAdapter(platform);
|
|
10
|
+
if (platform.id === 'macos')
|
|
11
|
+
return new ProcessClipboardTextAdapter('pbpaste', [], platform);
|
|
12
|
+
if (platform.id === 'linux' || platform.id === 'bsd')
|
|
13
|
+
return new FallbackClipboardTextAdapter([
|
|
14
|
+
new ProcessClipboardTextAdapter('wl-paste', ['--no-newline'], platform),
|
|
15
|
+
new ProcessClipboardTextAdapter('xclip', ['-selection', 'clipboard', '-out'], platform),
|
|
16
|
+
]);
|
|
17
|
+
return new UnsupportedClipboardTextAdapter();
|
|
18
|
+
}
|
|
19
|
+
export class ProcessClipboardTextAdapter {
|
|
20
|
+
command;
|
|
21
|
+
args;
|
|
22
|
+
platform;
|
|
23
|
+
constructor(command, args, platform = detectHostPlatform()) {
|
|
24
|
+
this.command = command;
|
|
25
|
+
this.args = args;
|
|
26
|
+
this.platform = platform;
|
|
27
|
+
}
|
|
28
|
+
async readText() {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
const child = spawnPlatformProcess(this.command, this.args, this.platform, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
31
|
+
const chunks = [];
|
|
32
|
+
let size = 0;
|
|
33
|
+
let settled = false;
|
|
34
|
+
const finish = (callback) => {
|
|
35
|
+
if (settled)
|
|
36
|
+
return;
|
|
37
|
+
settled = true;
|
|
38
|
+
clearTimeout(timer);
|
|
39
|
+
callback();
|
|
40
|
+
};
|
|
41
|
+
const timer = setTimeout(() => {
|
|
42
|
+
child.kill();
|
|
43
|
+
finish(() => reject(clipboardUnavailableError(`Clipboard text read timed out after ${CLIPBOARD_POLICY.timeoutMs}ms.`)));
|
|
44
|
+
}, CLIPBOARD_POLICY.timeoutMs);
|
|
45
|
+
child.stdout?.on('data', (chunk) => {
|
|
46
|
+
if (settled)
|
|
47
|
+
return;
|
|
48
|
+
size += chunk.byteLength;
|
|
49
|
+
if (size > CLIPBOARD_POLICY.maxTextBytes) {
|
|
50
|
+
child.kill();
|
|
51
|
+
finish(() => reject(new CliError(CLI_ERROR_CODES.ATTACHMENT_TOO_LARGE, 'Clipboard text is too large.', {
|
|
52
|
+
category: 'attachment', userMessage: 'Clipboard text exceeds the maximum allowed size.',
|
|
53
|
+
})));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
chunks.push(chunk);
|
|
57
|
+
});
|
|
58
|
+
child.once('error', () => finish(() => resolve(undefined)));
|
|
59
|
+
child.once('close', (code) => finish(() => {
|
|
60
|
+
if (code !== 0 || chunks.length === 0)
|
|
61
|
+
resolve(undefined);
|
|
62
|
+
else
|
|
63
|
+
resolve(Buffer.concat(chunks).toString('utf8'));
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
class FallbackClipboardTextAdapter {
|
|
69
|
+
adapters;
|
|
70
|
+
constructor(adapters) {
|
|
71
|
+
this.adapters = adapters;
|
|
72
|
+
}
|
|
73
|
+
async readText() {
|
|
74
|
+
let unavailable;
|
|
75
|
+
for (const adapter of this.adapters) {
|
|
76
|
+
try {
|
|
77
|
+
const text = await adapter.readText();
|
|
78
|
+
if (text !== undefined)
|
|
79
|
+
return text;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (!isClipboardUnavailableError(error))
|
|
83
|
+
throw error;
|
|
84
|
+
unavailable = error;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
throw unavailable ?? clipboardUnavailableError('No supported clipboard text provider was found.');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
class UnsupportedClipboardTextAdapter {
|
|
91
|
+
async readText() {
|
|
92
|
+
throw clipboardUnavailableError('Clipboard text support is unavailable on this platform.');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Attachment, AttachmentPayload, AttachmentSource } from '../../domain/session/attachment.js';
|
|
2
|
+
import type { TextFileContentPart, TextImageContentPart, TextMessage } from '@lotagate/sdk';
|
|
3
|
+
export declare const DEFAULT_MAX_IMAGE_BYTES: number;
|
|
4
|
+
export interface NormalizedImage {
|
|
5
|
+
bytes: Buffer;
|
|
6
|
+
mimeType: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function normalizeImage(bytes: Uint8Array, declaredMimeType?: string, maxBytes?: number): NormalizedImage;
|
|
9
|
+
export declare function createImageAttachment(image: NormalizedImage, source: AttachmentSource, id: string, storagePath?: string): Attachment;
|
|
10
|
+
export declare function toImageContentPart(payload: AttachmentPayload): TextImageContentPart;
|
|
11
|
+
export declare function toAttachmentContentPart(payload: AttachmentPayload): TextImageContentPart | TextFileContentPart;
|
|
12
|
+
export declare function buildUserMessage(prompt: string, attachments?: readonly AttachmentPayload[]): TextMessage;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
2
|
+
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
3
|
+
import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
|
|
4
|
+
export const DEFAULT_MAX_IMAGE_BYTES = RESOURCE_LIMITS.maxAttachmentBytes;
|
|
5
|
+
const IMAGE_MIME_TYPES = new Map([
|
|
6
|
+
['89504e470d0a1a0a', 'image/png'],
|
|
7
|
+
['ffd8ff', 'image/jpeg'],
|
|
8
|
+
['47494638', 'image/gif'],
|
|
9
|
+
['424d', 'image/bmp'],
|
|
10
|
+
]);
|
|
11
|
+
export function normalizeImage(bytes, declaredMimeType, maxBytes = DEFAULT_MAX_IMAGE_BYTES) {
|
|
12
|
+
if (bytes.byteLength === 0 || bytes.byteLength > maxBytes) {
|
|
13
|
+
throw new CliError(CLI_ERROR_CODES.ATTACHMENT_TOO_LARGE, 'Image size is outside the allowed range.', {
|
|
14
|
+
category: 'attachment', userMessage: `Image size must be between 1 byte and ${maxBytes} bytes.`,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const detected = detectMimeType(bytes);
|
|
18
|
+
const mimeType = detected ?? declaredMimeType;
|
|
19
|
+
if (mimeType === undefined || !mimeType.startsWith('image/')) {
|
|
20
|
+
throw new CliError(CLI_ERROR_CODES.ATTACHMENT_FORMAT_UNSUPPORTED, 'Clipboard content is not a supported image.', {
|
|
21
|
+
category: 'attachment', userMessage: 'The clipboard does not contain a supported image format.',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (detected !== undefined && declaredMimeType !== undefined && declaredMimeType !== detected) {
|
|
25
|
+
throw new CliError(CLI_ERROR_CODES.ATTACHMENT_INVALID_IMAGE, 'Declared image type does not match its bytes.', {
|
|
26
|
+
category: 'attachment', userMessage: 'The image format does not match its actual content.',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return { bytes: Buffer.from(bytes), mimeType };
|
|
30
|
+
}
|
|
31
|
+
export function createImageAttachment(image, source, id, storagePath) {
|
|
32
|
+
const name = id.trim();
|
|
33
|
+
if (name.length === 0)
|
|
34
|
+
throw new CliError(CLI_ERROR_CODES.ATTACHMENT_INVALID_IMAGE, 'Attachment id is required.', { category: 'attachment' });
|
|
35
|
+
return {
|
|
36
|
+
id: name,
|
|
37
|
+
name,
|
|
38
|
+
mimeType: image.mimeType,
|
|
39
|
+
sizeBytes: image.bytes.byteLength,
|
|
40
|
+
source,
|
|
41
|
+
...(storagePath === undefined ? {} : { storagePath }),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function toImageContentPart(payload) {
|
|
45
|
+
const base64 = Buffer.from(payload.bytes).toString('base64');
|
|
46
|
+
return { type: 'image_url', image_url: { url: `data:${payload.attachment.mimeType};base64,${base64}`, detail: 'auto' } };
|
|
47
|
+
}
|
|
48
|
+
export function toAttachmentContentPart(payload) {
|
|
49
|
+
if (payload.attachment.mimeType.startsWith('image/'))
|
|
50
|
+
return toImageContentPart(payload);
|
|
51
|
+
const base64 = Buffer.from(payload.bytes).toString('base64');
|
|
52
|
+
return {
|
|
53
|
+
type: 'input_file',
|
|
54
|
+
file_data: `data:${payload.attachment.mimeType};base64,${base64}`,
|
|
55
|
+
filename: payload.attachment.name,
|
|
56
|
+
media_type: payload.attachment.mimeType,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function buildUserMessage(prompt, attachments = []) {
|
|
60
|
+
if (attachments.length === 0)
|
|
61
|
+
return { role: 'user', content: prompt };
|
|
62
|
+
return {
|
|
63
|
+
role: 'user',
|
|
64
|
+
content: [
|
|
65
|
+
{ type: 'text', text: prompt },
|
|
66
|
+
...attachments.map(toAttachmentContentPart),
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function detectMimeType(bytes) {
|
|
71
|
+
const hex = [...bytes.slice(0, 8)].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
72
|
+
for (const [signature, mimeType] of IMAGE_MIME_TYPES)
|
|
73
|
+
if (hex.startsWith(signature))
|
|
74
|
+
return mimeType;
|
|
75
|
+
if (bytes.length >= 12 && Buffer.from(bytes.slice(0, 12)).toString('ascii', 0, 4) === 'RIFF' && Buffer.from(bytes.slice(8, 12)).toString('ascii') === 'WEBP')
|
|
76
|
+
return 'image/webp';
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClipboardAdapter, ClipboardImage } from '../../ports/clipboard-adapter.js';
|
|
2
|
+
import { type HostPlatformContext } from '../platform/host-platform.js';
|
|
3
|
+
export declare class WindowsClipboardAdapter implements ClipboardAdapter {
|
|
4
|
+
private readonly platform;
|
|
5
|
+
constructor(platform?: HostPlatformContext);
|
|
6
|
+
readImage(): Promise<ClipboardImage | undefined>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
6
|
+
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
7
|
+
import { DEFAULT_MAX_IMAGE_BYTES } from './image-normalizer.js';
|
|
8
|
+
import { readFileBounded } from '../filesystem/bounded-file-reader.js';
|
|
9
|
+
import { detectHostPlatform } from '../platform/host-platform.js';
|
|
10
|
+
import { spawnPlatformProcess } from '../platform/host-process.js';
|
|
11
|
+
import { CLIPBOARD_POLICY, clipboardUnavailableError } from './clipboard-policy.js';
|
|
12
|
+
export class WindowsClipboardAdapter {
|
|
13
|
+
platform;
|
|
14
|
+
constructor(platform = detectHostPlatform()) {
|
|
15
|
+
this.platform = platform;
|
|
16
|
+
}
|
|
17
|
+
async readImage() {
|
|
18
|
+
if (!this.platform.isWindows) {
|
|
19
|
+
throw clipboardUnavailableError('Windows clipboard image adapter cannot run on this platform.');
|
|
20
|
+
}
|
|
21
|
+
const outputPath = path.join(os.tmpdir(), `lotagate-clipboard-${process.pid}-${crypto.randomUUID()}.png`);
|
|
22
|
+
try {
|
|
23
|
+
await runPowerShell(outputPath, this.platform);
|
|
24
|
+
const image = await readFileBounded(outputPath, DEFAULT_MAX_IMAGE_BYTES);
|
|
25
|
+
if (image.truncated) {
|
|
26
|
+
throw new CliError(CLI_ERROR_CODES.ATTACHMENT_TOO_LARGE, 'Clipboard image exceeds the configured size limit.', {
|
|
27
|
+
category: 'attachment', userMessage: 'The clipboard image is too large to attach.',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return { bytes: image.bytes, mimeType: 'image/png' };
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof CliError)
|
|
34
|
+
throw error;
|
|
35
|
+
throw clipboardUnavailableError('Unable to read an image from the clipboard.', error);
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
await fs.rm(outputPath, { force: true });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function runPowerShell(outputPath, platform) {
|
|
43
|
+
const script = "$ErrorActionPreference='Stop'; $image=Get-Clipboard -Format Image; if ($null -eq $image) { exit 3 }; $image.Save($env:LOTAGATE_CLIPBOARD_OUTPUT, [System.Drawing.Imaging.ImageFormat]::Png)";
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
const child = spawnPlatformProcess('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], platform, {
|
|
46
|
+
env: { ...process.env, LOTAGATE_CLIPBOARD_OUTPUT: outputPath },
|
|
47
|
+
stdio: ['ignore', 'ignore', 'pipe'],
|
|
48
|
+
});
|
|
49
|
+
const stderr = [];
|
|
50
|
+
let settled = false;
|
|
51
|
+
const finish = (callback) => {
|
|
52
|
+
if (settled)
|
|
53
|
+
return;
|
|
54
|
+
settled = true;
|
|
55
|
+
clearTimeout(timer);
|
|
56
|
+
callback();
|
|
57
|
+
};
|
|
58
|
+
const timer = setTimeout(() => {
|
|
59
|
+
child.kill();
|
|
60
|
+
finish(() => reject(clipboardUnavailableError(`Clipboard image read timed out after ${CLIPBOARD_POLICY.timeoutMs}ms.`)));
|
|
61
|
+
}, CLIPBOARD_POLICY.timeoutMs);
|
|
62
|
+
child.stderr?.on('data', (chunk) => stderr.push(chunk));
|
|
63
|
+
child.once('error', (error) => finish(() => reject(error)));
|
|
64
|
+
child.once('close', (code) => finish(() => code === 0 ? resolve() : reject(new Error(Buffer.concat(stderr).toString('utf8').trim() || `PowerShell exited with code ${String(code)}.`))));
|
|
65
|
+
});
|
|
66
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClipboardTextAdapter } from '../../ports/clipboard-text-adapter.js';
|
|
2
|
+
import { type HostPlatformContext } from '../platform/host-platform.js';
|
|
3
|
+
export declare class WindowsClipboardTextAdapter implements ClipboardTextAdapter {
|
|
4
|
+
private readonly platform;
|
|
5
|
+
constructor(platform?: HostPlatformContext);
|
|
6
|
+
readText(): Promise<string | undefined>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
2
|
+
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
3
|
+
import { detectHostPlatform } from '../platform/host-platform.js';
|
|
4
|
+
import { spawnPlatformProcess } from '../platform/host-process.js';
|
|
5
|
+
import { CLIPBOARD_POLICY, clipboardUnavailableError } from './clipboard-policy.js';
|
|
6
|
+
export class WindowsClipboardTextAdapter {
|
|
7
|
+
platform;
|
|
8
|
+
constructor(platform = detectHostPlatform()) {
|
|
9
|
+
this.platform = platform;
|
|
10
|
+
}
|
|
11
|
+
async readText() {
|
|
12
|
+
if (!this.platform.isWindows) {
|
|
13
|
+
throw clipboardUnavailableError('Windows clipboard text adapter cannot run on this platform.');
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
return await runPowerShellText(this.platform);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error instanceof CliError)
|
|
20
|
+
throw error;
|
|
21
|
+
throw clipboardUnavailableError('Unable to read text from the clipboard.', error);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function runPowerShellText(platform) {
|
|
26
|
+
const script = "$ErrorActionPreference='Stop'; [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; $text=Get-Clipboard -Raw; if ($null -eq $text) { exit 3 }; [Console]::Out.Write($text)";
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const child = spawnPlatformProcess('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], platform, {
|
|
29
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
30
|
+
});
|
|
31
|
+
const chunks = [];
|
|
32
|
+
let size = 0;
|
|
33
|
+
let settled = false;
|
|
34
|
+
const finish = (callback) => {
|
|
35
|
+
if (settled)
|
|
36
|
+
return;
|
|
37
|
+
settled = true;
|
|
38
|
+
clearTimeout(timer);
|
|
39
|
+
callback();
|
|
40
|
+
};
|
|
41
|
+
const timer = setTimeout(() => {
|
|
42
|
+
child.kill();
|
|
43
|
+
finish(() => reject(clipboardUnavailableError(`Clipboard text read timed out after ${CLIPBOARD_POLICY.timeoutMs}ms.`)));
|
|
44
|
+
}, CLIPBOARD_POLICY.timeoutMs);
|
|
45
|
+
child.stdout?.on('data', (chunk) => {
|
|
46
|
+
if (settled)
|
|
47
|
+
return;
|
|
48
|
+
size += chunk.byteLength;
|
|
49
|
+
if (size > CLIPBOARD_POLICY.maxTextBytes) {
|
|
50
|
+
child.kill();
|
|
51
|
+
finish(() => reject(new CliError(CLI_ERROR_CODES.ATTACHMENT_TOO_LARGE, 'Clipboard text is too large.', {
|
|
52
|
+
category: 'attachment', userMessage: 'Clipboard text exceeds the maximum allowed size.',
|
|
53
|
+
})));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
chunks.push(chunk);
|
|
57
|
+
});
|
|
58
|
+
const stderr = [];
|
|
59
|
+
child.stderr?.on('data', (chunk) => stderr.push(chunk));
|
|
60
|
+
child.once('error', (error) => finish(() => reject(error)));
|
|
61
|
+
child.once('close', (code) => finish(() => {
|
|
62
|
+
if (code === 3)
|
|
63
|
+
resolve(undefined);
|
|
64
|
+
else if (code !== 0)
|
|
65
|
+
reject(new Error(Buffer.concat(stderr).toString('utf8').trim() || `PowerShell exited with code ${String(code)}.`));
|
|
66
|
+
else
|
|
67
|
+
resolve(Buffer.concat(chunks).toString('utf8'));
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CliConfig, type ConfigurableKey } from '../../domain/config/config-schema.js';
|
|
2
|
+
import type { Logger } from '../../ports/logger.js';
|
|
3
|
+
import { type PlatformPaths } from '../platform/platform-paths.js';
|
|
4
|
+
export interface ConfigLoadResult {
|
|
5
|
+
config: CliConfig;
|
|
6
|
+
sources: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
export declare class ConfigLoader {
|
|
9
|
+
private readonly logger;
|
|
10
|
+
private readonly paths;
|
|
11
|
+
constructor(logger: Logger, paths?: PlatformPaths);
|
|
12
|
+
get platformPaths(): PlatformPaths;
|
|
13
|
+
load(cwd: string, options?: {
|
|
14
|
+
includeProject?: boolean;
|
|
15
|
+
}): Promise<ConfigLoadResult>;
|
|
16
|
+
setGlobal(key: ConfigurableKey, value: unknown): Promise<void>;
|
|
17
|
+
private readOptional;
|
|
18
|
+
private readDocumentOptional;
|
|
19
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { CliError } from '../../domain/errors/cli-error.js';
|
|
2
|
+
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
3
|
+
import { DEFAULT_CONFIG, mergeConfig } from '../../domain/config/config-schema.js';
|
|
4
|
+
import { resolvePlatformPaths, resolveProjectConfigPaths } from '../platform/platform-paths.js';
|
|
5
|
+
import { atomicWriteFile, withFileLock } from '../filesystem/atomic-file-store.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 { validateSettingsDocument } from '../../domain/settings/settings-document.js';
|
|
10
|
+
export class ConfigLoader {
|
|
11
|
+
logger;
|
|
12
|
+
paths;
|
|
13
|
+
constructor(logger, paths = resolvePlatformPaths()) {
|
|
14
|
+
this.logger = logger;
|
|
15
|
+
this.paths = paths;
|
|
16
|
+
}
|
|
17
|
+
get platformPaths() {
|
|
18
|
+
return this.paths;
|
|
19
|
+
}
|
|
20
|
+
async load(cwd, options = {}) {
|
|
21
|
+
const layers = [];
|
|
22
|
+
const sources = [];
|
|
23
|
+
const candidates = options.includeProject === false
|
|
24
|
+
? [this.paths.globalConfigFile]
|
|
25
|
+
: [this.paths.globalConfigFile, resolveProjectConfigPaths(cwd).settings, resolveProjectConfigPaths(cwd).localSettings];
|
|
26
|
+
for (const file of candidates) {
|
|
27
|
+
const layer = await this.readOptional(file);
|
|
28
|
+
if (layer !== undefined) {
|
|
29
|
+
layers.push(layer);
|
|
30
|
+
sources.push(file);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { config: mergeConfig(DEFAULT_CONFIG, ...layers), sources };
|
|
34
|
+
}
|
|
35
|
+
async setGlobal(key, value) {
|
|
36
|
+
await withFileLock(this.paths.globalConfigFile, async () => {
|
|
37
|
+
const existing = await this.readDocumentOptional(this.paths.globalConfigFile);
|
|
38
|
+
const candidate = {
|
|
39
|
+
...(existing?.config ?? {}),
|
|
40
|
+
...(existing?.permissions === undefined ? {} : { permissions: existing.permissions }),
|
|
41
|
+
[key]: value,
|
|
42
|
+
schemaVersion: 1,
|
|
43
|
+
};
|
|
44
|
+
validateSettingsDocument(candidate);
|
|
45
|
+
await atomicWriteFile(this.paths.globalConfigFile, `${JSON.stringify(candidate, null, 2)}\n`);
|
|
46
|
+
});
|
|
47
|
+
this.logger.info('Global configuration updated.', { key });
|
|
48
|
+
}
|
|
49
|
+
async readOptional(file) {
|
|
50
|
+
const document = await this.readDocumentOptional(file);
|
|
51
|
+
return document?.config;
|
|
52
|
+
}
|
|
53
|
+
async readDocumentOptional(file) {
|
|
54
|
+
try {
|
|
55
|
+
try {
|
|
56
|
+
return validateSettingsDocument(await readJsonFileBounded(file, RESOURCE_LIMITS.configFileBytes));
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (isFileNotFound(error))
|
|
60
|
+
return undefined;
|
|
61
|
+
if (error instanceof CliError)
|
|
62
|
+
throw error;
|
|
63
|
+
throw new CliError(CLI_ERROR_CODES.CONFIG_INVALID_JSON, `Invalid JSON in ${file}.`, {
|
|
64
|
+
category: 'config', userMessage: `Unable to parse JSON in ${file}.`, cause: error,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (error instanceof CliError)
|
|
70
|
+
throw error;
|
|
71
|
+
throw new CliError(CLI_ERROR_CODES.CONFIG_NOT_FOUND, `Unable to read config ${file}.`, {
|
|
72
|
+
category: 'config', userMessage: `Unable to read configuration file ${file}.`, cause: error,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Reads an integer environment value without allowing invalid settings to disable a safe default. */
|
|
2
|
+
export function readBoundedEnvironmentInteger(value, fallback, minimum, maximum) {
|
|
3
|
+
if (value === undefined)
|
|
4
|
+
return fallback;
|
|
5
|
+
const parsed = Number(value);
|
|
6
|
+
return Number.isSafeInteger(parsed) && parsed >= minimum && parsed <= maximum ? parsed : fallback;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AuthProfile, StoredCredential } from '../../domain/auth/auth-profile.js';
|
|
2
|
+
import type { CredentialStore } from '../../ports/credential-store.js';
|
|
3
|
+
export declare class CompositeCredentialStore implements CredentialStore {
|
|
4
|
+
private readonly stores;
|
|
5
|
+
private readonly writableStore;
|
|
6
|
+
constructor(stores: readonly CredentialStore[], writableStore: CredentialStore);
|
|
7
|
+
list(): Promise<readonly AuthProfile[]>;
|
|
8
|
+
get(profileName: string): Promise<StoredCredential | undefined>;
|
|
9
|
+
set(credential: StoredCredential): Promise<void>;
|
|
10
|
+
delete(profileName: string): Promise<boolean>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class CompositeCredentialStore {
|
|
2
|
+
stores;
|
|
3
|
+
writableStore;
|
|
4
|
+
constructor(stores, writableStore) {
|
|
5
|
+
this.stores = stores;
|
|
6
|
+
this.writableStore = writableStore;
|
|
7
|
+
}
|
|
8
|
+
async list() {
|
|
9
|
+
const profiles = new Map();
|
|
10
|
+
for (const store of this.stores)
|
|
11
|
+
for (const profile of await store.list())
|
|
12
|
+
profiles.set(profile.name, profile);
|
|
13
|
+
return [...profiles.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
14
|
+
}
|
|
15
|
+
async get(profileName) {
|
|
16
|
+
for (const store of this.stores) {
|
|
17
|
+
const credential = await store.get(profileName);
|
|
18
|
+
if (credential !== undefined)
|
|
19
|
+
return credential;
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
async set(credential) {
|
|
24
|
+
await this.writableStore.set(credential);
|
|
25
|
+
}
|
|
26
|
+
async delete(profileName) {
|
|
27
|
+
let deleted = false;
|
|
28
|
+
for (const store of this.stores)
|
|
29
|
+
deleted = (await store.delete(profileName)) || deleted;
|
|
30
|
+
return deleted;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AuthProfile, type StoredCredential } from '../../domain/auth/auth-profile.js';
|
|
2
|
+
import type { CredentialStore } from '../../ports/credential-store.js';
|
|
3
|
+
import type { PlatformPaths } from '../platform/platform-paths.js';
|
|
4
|
+
export declare class EncryptedFileCredentialStore implements CredentialStore {
|
|
5
|
+
private readonly paths;
|
|
6
|
+
private readonly secret;
|
|
7
|
+
constructor(paths: PlatformPaths, secret?: string | undefined);
|
|
8
|
+
list(): Promise<readonly AuthProfile[]>;
|
|
9
|
+
get(profileName: string): Promise<StoredCredential | undefined>;
|
|
10
|
+
set(credential: StoredCredential): Promise<void>;
|
|
11
|
+
delete(profileName: string): Promise<boolean>;
|
|
12
|
+
private readPayload;
|
|
13
|
+
private writePayload;
|
|
14
|
+
private readFile;
|
|
15
|
+
private deriveKey;
|
|
16
|
+
private resolveSecret;
|
|
17
|
+
}
|