@lotagate/cli 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/scripts/install-native.mjs +11 -11
- package/dist/application/agent/agent-history.d.ts +0 -3
- package/dist/application/agent/agent-history.js +0 -81
- package/dist/application/agent/agent-input-context.d.ts +0 -9
- package/dist/application/agent/agent-input-context.js +0 -12
- package/dist/application/agent/agent-limit.d.ts +0 -3
- package/dist/application/agent/agent-limit.js +0 -12
- package/dist/application/agent/agent-run-tracker.d.ts +0 -30
- package/dist/application/agent/agent-run-tracker.js +0 -68
- package/dist/application/agent/agent-session-store.d.ts +0 -19
- package/dist/application/agent/agent-session-store.js +0 -74
- package/dist/application/agent/capability-profile.d.ts +0 -37
- package/dist/application/agent/capability-profile.js +0 -13
- package/dist/application/agent/cli-agent-execution-service.d.ts +0 -81
- package/dist/application/agent/cli-agent-execution-service.js +0 -279
- package/dist/application/agent/context-compaction-persistence.d.ts +0 -8
- package/dist/application/agent/context-compaction-persistence.js +0 -27
- package/dist/application/agent/context-compaction.d.ts +0 -20
- package/dist/application/agent/context-compaction.js +0 -114
- package/dist/application/agent/prompt-data-safety.d.ts +0 -14
- package/dist/application/agent/prompt-data-safety.js +0 -38
- package/dist/application/agent/safe-system-prompt.d.ts +0 -3
- package/dist/application/agent/safe-system-prompt.js +0 -19
- package/dist/application/agent/scoped-tool-executor.d.ts +0 -13
- package/dist/application/agent/scoped-tool-executor.js +0 -32
- package/dist/application/agent/system-prompt-builder.d.ts +0 -14
- package/dist/application/agent/system-prompt-builder.js +0 -199
- package/dist/application/agent/tool-catalog.d.ts +0 -14
- package/dist/application/agent/tool-catalog.js +0 -30
- package/dist/application/agent/tool-display.d.ts +0 -6
- package/dist/application/agent/tool-display.js +0 -59
- package/dist/application/agent/tool-hook-lifecycle.d.ts +0 -19
- package/dist/application/agent/tool-hook-lifecycle.js +0 -85
- package/dist/application/auth/authentication-service.d.ts +0 -20
- package/dist/application/auth/authentication-service.js +0 -44
- package/dist/application/chat/chat-service.d.ts +0 -12
- package/dist/application/chat/chat-service.js +0 -19
- package/dist/application/chat/pending-attachment-store.d.ts +0 -12
- package/dist/application/chat/pending-attachment-store.js +0 -28
- package/dist/application/commands/application-command-executor.d.ts +0 -20
- package/dist/application/commands/application-command-executor.js +0 -66
- package/dist/application/commands/cli-args.d.ts +0 -6
- package/dist/application/commands/cli-args.js +0 -43
- package/dist/application/commands/cli-command-services.d.ts +0 -16
- package/dist/application/commands/cli-command-services.js +0 -405
- package/dist/application/commands/command-catalog.d.ts +0 -6
- package/dist/application/commands/command-catalog.js +0 -159
- package/dist/application/commands/command-contract.d.ts +0 -58
- package/dist/application/commands/command-contract.js +0 -1
- package/dist/application/commands/command-hints.d.ts +0 -9
- package/dist/application/commands/command-hints.js +0 -17
- package/dist/application/commands/command-output.d.ts +0 -4
- package/dist/application/commands/command-output.js +0 -1
- package/dist/application/commands/command-parser.d.ts +0 -10
- package/dist/application/commands/command-parser.js +0 -155
- package/dist/application/commands/command-presentation.d.ts +0 -7
- package/dist/application/commands/command-presentation.js +0 -131
- package/dist/application/commands/command-registry.d.ts +0 -11
- package/dist/application/commands/command-registry.js +0 -64
- package/dist/application/commands/command-runtime.d.ts +0 -2
- package/dist/application/commands/command-runtime.js +0 -3
- package/dist/application/commands/goal-command-handlers.d.ts +0 -3
- package/dist/application/commands/goal-command-handlers.js +0 -120
- package/dist/application/commands/media-command-handlers.d.ts +0 -9
- package/dist/application/commands/media-command-handlers.js +0 -307
- package/dist/application/commands/media-command-output.d.ts +0 -11
- package/dist/application/commands/media-command-output.js +0 -8
- package/dist/application/commands/runtime-command-handlers.d.ts +0 -7
- package/dist/application/commands/runtime-command-handlers.js +0 -177
- package/dist/application/commands/stream-output.d.ts +0 -4
- package/dist/application/commands/stream-output.js +0 -10
- package/dist/application/commands/utility-commands.d.ts +0 -6
- package/dist/application/commands/utility-commands.js +0 -81
- package/dist/application/config/execution-config.d.ts +0 -4
- package/dist/application/config/execution-config.js +0 -6
- package/dist/application/extensions/extension-list-contract.d.ts +0 -13
- package/dist/application/extensions/extension-list-contract.js +0 -1
- package/dist/application/extensions/extension-list-formatters.d.ts +0 -31
- package/dist/application/extensions/extension-list-formatters.js +0 -98
- package/dist/application/extensions/extension-list-output.d.ts +0 -3
- package/dist/application/extensions/extension-list-output.js +0 -7
- package/dist/application/extensions/plugin-contribution-registry.d.ts +0 -15
- package/dist/application/extensions/plugin-contribution-registry.js +0 -80
- package/dist/application/extensions/skill-scope-store.d.ts +0 -23
- package/dist/application/extensions/skill-scope-store.js +0 -33
- package/dist/application/formatting/compact-number.d.ts +0 -2
- package/dist/application/formatting/compact-number.js +0 -18
- package/dist/application/formatting/compact-table.d.ts +0 -22
- package/dist/application/formatting/compact-table.js +0 -49
- package/dist/application/media/video-operation-poller.d.ts +0 -5
- package/dist/application/media/video-operation-poller.js +0 -42
- package/dist/application/model/cached-model-catalog.d.ts +0 -13
- package/dist/application/model/cached-model-catalog.js +0 -31
- package/dist/application/model/initial-model-selection.d.ts +0 -10
- package/dist/application/model/initial-model-selection.js +0 -11
- package/dist/application/model/model-catalog-service.d.ts +0 -6
- package/dist/application/model/model-catalog-service.js +0 -13
- package/dist/application/model/model-context-window.d.ts +0 -3
- package/dist/application/model/model-context-window.js +0 -23
- package/dist/application/orchestration/cli-subagent-service.d.ts +0 -70
- package/dist/application/orchestration/cli-subagent-service.js +0 -328
- package/dist/application/orchestration/cli-turn-event-projector.d.ts +0 -12
- package/dist/application/orchestration/cli-turn-event-projector.js +0 -81
- package/dist/application/orchestration/cli-turn-events.d.ts +0 -76
- package/dist/application/orchestration/cli-turn-events.js +0 -39
- package/dist/application/orchestration/cli-turn-persistence.d.ts +0 -6
- package/dist/application/orchestration/cli-turn-persistence.js +0 -14
- package/dist/application/orchestration/goal-evaluator.d.ts +0 -18
- package/dist/application/orchestration/goal-evaluator.js +0 -88
- package/dist/application/orchestration/goal-input.d.ts +0 -3
- package/dist/application/orchestration/goal-input.js +0 -19
- package/dist/application/orchestration/goal-output.d.ts +0 -2
- package/dist/application/orchestration/goal-output.js +0 -11
- package/dist/application/orchestration/goal-runner.d.ts +0 -22
- package/dist/application/orchestration/goal-runner.js +0 -153
- package/dist/application/orchestration/goal-usage.d.ts +0 -9
- package/dist/application/orchestration/goal-usage.js +0 -19
- package/dist/application/orchestration/headless-agent-turn.d.ts +0 -32
- package/dist/application/orchestration/headless-agent-turn.js +0 -82
- package/dist/application/orchestration/plan-generator.d.ts +0 -7
- package/dist/application/orchestration/plan-generator.js +0 -34
- package/dist/application/orchestration/subagent-coordinator.d.ts +0 -33
- package/dist/application/orchestration/subagent-coordinator.js +0 -28
- package/dist/application/orchestration/subagent-handoff.d.ts +0 -2
- package/dist/application/orchestration/subagent-handoff.js +0 -68
- package/dist/application/orchestration/subagent-tool-executor.d.ts +0 -12
- package/dist/application/orchestration/subagent-tool-executor.js +0 -93
- package/dist/application/orchestration/task-assessment.d.ts +0 -4
- package/dist/application/orchestration/task-assessment.js +0 -35
- package/dist/application/orchestration/task-graph.d.ts +0 -13
- package/dist/application/orchestration/task-graph.js +0 -56
- package/dist/application/orchestration/task-scheduler.d.ts +0 -18
- package/dist/application/orchestration/task-scheduler.js +0 -88
- package/dist/application/project/project-trust-service.d.ts +0 -13
- package/dist/application/project/project-trust-service.js +0 -74
- package/dist/application/protocol/browser-host-tool-executor.d.ts +0 -41
- package/dist/application/protocol/browser-host-tool-executor.js +0 -88
- package/dist/application/protocol/desktop-agent-command.d.ts +0 -9
- package/dist/application/protocol/desktop-agent-command.js +0 -663
- package/dist/application/protocol/desktop-attachment-store.d.ts +0 -16
- package/dist/application/protocol/desktop-attachment-store.js +0 -82
- package/dist/application/protocol/desktop-command-catalog.d.ts +0 -2
- package/dist/application/protocol/desktop-command-catalog.js +0 -19
- package/dist/application/protocol/desktop-command-contract.d.ts +0 -22
- package/dist/application/protocol/desktop-command-contract.js +0 -3
- package/dist/application/protocol/desktop-command-executor.d.ts +0 -16
- package/dist/application/protocol/desktop-command-executor.js +0 -47
- package/dist/application/protocol/desktop-command-output.d.ts +0 -15
- package/dist/application/protocol/desktop-command-output.js +0 -24
- package/dist/application/protocol/desktop-execution-policy.d.ts +0 -17
- package/dist/application/protocol/desktop-execution-policy.js +0 -49
- package/dist/application/protocol/desktop-host-tool-executor.d.ts +0 -57
- package/dist/application/protocol/desktop-host-tool-executor.js +0 -53
- package/dist/application/protocol/desktop-orchestration-events.d.ts +0 -5
- package/dist/application/protocol/desktop-orchestration-events.js +0 -37
- package/dist/application/protocol/json-line-writer.d.ts +0 -9
- package/dist/application/protocol/json-line-writer.js +0 -19
- package/dist/application/protocol/jsonl-agent-command.d.ts +0 -3
- package/dist/application/protocol/jsonl-agent-command.js +0 -97
- package/dist/application/protocol/jsonl-protocol.d.ts +0 -52
- package/dist/application/protocol/jsonl-protocol.js +0 -170
- package/dist/application/security/desktop-tool-scope-policy.d.ts +0 -3
- package/dist/application/security/desktop-tool-scope-policy.js +0 -52
- package/dist/application/security/tool-action-risk-analyzer.d.ts +0 -13
- package/dist/application/security/tool-action-risk-analyzer.js +0 -64
- package/dist/application/security/tool-approval-service.d.ts +0 -35
- package/dist/application/security/tool-approval-service.js +0 -97
- package/dist/application/security/tool-risk-classifier.d.ts +0 -11
- package/dist/application/security/tool-risk-classifier.js +0 -65
- package/dist/application/security/workspace-permission-policy.d.ts +0 -10
- package/dist/application/security/workspace-permission-policy.js +0 -50
- package/dist/application/session/project-session-access.d.ts +0 -8
- package/dist/application/session/project-session-access.js +0 -19
- package/dist/application/session/session-compaction-service.d.ts +0 -10
- package/dist/application/session/session-compaction-service.js +0 -43
- package/dist/application/session/session-turn-lifecycle.d.ts +0 -5
- package/dist/application/session/session-turn-lifecycle.js +0 -31
- package/dist/application/workspace/workspace-file-index.d.ts +0 -15
- package/dist/application/workspace/workspace-file-index.js +0 -60
- package/dist/application/workspace/workspace-file-reference-resolver.d.ts +0 -14
- package/dist/application/workspace/workspace-file-reference-resolver.js +0 -123
- package/dist/application/workspace/workspace-instruction-loader.d.ts +0 -8
- package/dist/application/workspace/workspace-instruction-loader.js +0 -55
- package/dist/bootstrap/composition-root.d.ts +0 -6
- package/dist/bootstrap/composition-root.js +0 -4
- package/dist/bootstrap/global-cli-options.d.ts +0 -6
- package/dist/bootstrap/global-cli-options.js +0 -29
- package/dist/bootstrap/native-devtools-stub.d.ts +0 -10
- package/dist/bootstrap/native-devtools-stub.js +0 -10
- package/dist/bootstrap/native-entry.d.ts +0 -1
- package/dist/bootstrap/native-entry.js +0 -6
- package/dist/bootstrap/native-tiktoken.d.ts +0 -4
- package/dist/bootstrap/native-tiktoken.js +0 -5
- package/dist/bootstrap/runtime-factory.d.ts +0 -35
- package/dist/bootstrap/runtime-factory.js +0 -44
- package/dist/bootstrap/shutdown-manager.d.ts +0 -10
- package/dist/bootstrap/shutdown-manager.js +0 -14
- package/dist/bootstrap/startup-sequence.d.ts +0 -5
- package/dist/bootstrap/startup-sequence.js +0 -10
- package/dist/domain/auth/auth-profile.d.ts +0 -14
- package/dist/domain/auth/auth-profile.js +0 -39
- package/dist/domain/config/config-schema.d.ts +0 -17
- package/dist/domain/config/config-schema.js +0 -105
- package/dist/domain/errors/cli-command-hint.d.ts +0 -5
- package/dist/domain/errors/cli-command-hint.js +0 -1
- package/dist/domain/errors/cli-error.d.ts +0 -35
- package/dist/domain/errors/cli-error.js +0 -129
- package/dist/domain/errors/error-codes.d.ts +0 -46
- package/dist/domain/errors/error-codes.js +0 -45
- package/dist/domain/extensions/extension-scope.d.ts +0 -3
- package/dist/domain/extensions/extension-scope.js +0 -23
- package/dist/domain/extensions/extension-state.d.ts +0 -5
- package/dist/domain/extensions/extension-state.js +0 -11
- package/dist/domain/extensions/hook-manifest.d.ts +0 -10
- package/dist/domain/extensions/hook-manifest.js +0 -23
- package/dist/domain/extensions/mcp-config.d.ts +0 -18
- package/dist/domain/extensions/mcp-config.js +0 -111
- package/dist/domain/extensions/plugin-manifest.d.ts +0 -11
- package/dist/domain/extensions/plugin-manifest.js +0 -43
- package/dist/domain/extensions/skill-manifest.d.ts +0 -10
- package/dist/domain/extensions/skill-manifest.js +0 -51
- package/dist/domain/filesystem/file-change-diff.d.ts +0 -21
- package/dist/domain/filesystem/file-change-diff.js +0 -60
- package/dist/domain/media/gateway-media-contract.d.ts +0 -23
- package/dist/domain/media/gateway-media-contract.js +0 -163
- package/dist/domain/media/media-contract.d.ts +0 -28
- package/dist/domain/media/media-contract.js +0 -1
- package/dist/domain/media/media-execution-policy.d.ts +0 -9
- package/dist/domain/media/media-execution-policy.js +0 -31
- package/dist/domain/orchestration/goal.d.ts +0 -58
- package/dist/domain/orchestration/goal.js +0 -113
- package/dist/domain/orchestration/subagent-identity.d.ts +0 -2
- package/dist/domain/orchestration/subagent-identity.js +0 -8
- package/dist/domain/orchestration/subagent.d.ts +0 -33
- package/dist/domain/orchestration/subagent.js +0 -1
- package/dist/domain/orchestration/task.d.ts +0 -31
- package/dist/domain/orchestration/task.js +0 -1
- package/dist/domain/project/project-identity.d.ts +0 -6
- package/dist/domain/project/project-identity.js +0 -4
- package/dist/domain/runtime/assistant-delta-normalizer.d.ts +0 -11
- package/dist/domain/runtime/assistant-delta-normalizer.js +0 -19
- package/dist/domain/runtime/resource-limits.d.ts +0 -60
- package/dist/domain/runtime/resource-limits.js +0 -60
- package/dist/domain/session/attachment.d.ts +0 -13
- package/dist/domain/session/attachment.js +0 -1
- package/dist/domain/session/session-schema.d.ts +0 -6
- package/dist/domain/session/session-schema.js +0 -28
- package/dist/domain/session/session.d.ts +0 -27
- package/dist/domain/session/session.js +0 -1
- package/dist/domain/settings/settings-document.d.ts +0 -8
- package/dist/domain/settings/settings-document.js +0 -36
- package/dist/domain/validation/record-schema.d.ts +0 -4
- package/dist/domain/validation/record-schema.js +0 -9
- package/dist/domain/workspace/workspace-settings.d.ts +0 -12
- package/dist/domain/workspace/workspace-settings.js +0 -44
- package/dist/infrastructure/agent-sdk/agent-instance-factory.d.ts +0 -22
- package/dist/infrastructure/agent-sdk/agent-instance-factory.js +0 -31
- package/dist/infrastructure/agent-sdk/tool-calling-model-client.d.ts +0 -11
- package/dist/infrastructure/agent-sdk/tool-calling-model-client.js +0 -447
- package/dist/infrastructure/cache/cache-policy.d.ts +0 -7
- package/dist/infrastructure/cache/cache-policy.js +0 -18
- package/dist/infrastructure/cache/file-cache-store.d.ts +0 -17
- package/dist/infrastructure/cache/file-cache-store.js +0 -121
- package/dist/infrastructure/clipboard/clipboard-adapter-factory.d.ts +0 -11
- package/dist/infrastructure/clipboard/clipboard-adapter-factory.js +0 -98
- package/dist/infrastructure/clipboard/clipboard-policy.d.ts +0 -8
- package/dist/infrastructure/clipboard/clipboard-policy.js +0 -19
- package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.d.ts +0 -10
- package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.js +0 -94
- package/dist/infrastructure/clipboard/image-normalizer.d.ts +0 -12
- package/dist/infrastructure/clipboard/image-normalizer.js +0 -78
- package/dist/infrastructure/clipboard/windows-clipboard-adapter.d.ts +0 -7
- package/dist/infrastructure/clipboard/windows-clipboard-adapter.js +0 -66
- package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.d.ts +0 -7
- package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.js +0 -70
- package/dist/infrastructure/config/config-loader.d.ts +0 -19
- package/dist/infrastructure/config/config-loader.js +0 -76
- package/dist/infrastructure/config/environment-values.d.ts +0 -2
- package/dist/infrastructure/config/environment-values.js +0 -7
- package/dist/infrastructure/credentials/composite-credential-store.d.ts +0 -11
- package/dist/infrastructure/credentials/composite-credential-store.js +0 -32
- package/dist/infrastructure/credentials/encrypted-file-credential-store.d.ts +0 -17
- package/dist/infrastructure/credentials/encrypted-file-credential-store.js +0 -181
- package/dist/infrastructure/credentials/environment-credential-store.d.ts +0 -11
- package/dist/infrastructure/credentials/environment-credential-store.js +0 -37
- package/dist/infrastructure/credentials/secret-input.d.ts +0 -7
- package/dist/infrastructure/credentials/secret-input.js +0 -44
- package/dist/infrastructure/extensions/composite-mcp-config-store.d.ts +0 -9
- package/dist/infrastructure/extensions/composite-mcp-config-store.js +0 -10
- package/dist/infrastructure/extensions/extension-directory-reader.d.ts +0 -2
- package/dist/infrastructure/extensions/extension-directory-reader.js +0 -15
- package/dist/infrastructure/extensions/extension-source-resolver.d.ts +0 -6
- package/dist/infrastructure/extensions/extension-source-resolver.js +0 -126
- package/dist/infrastructure/extensions/file-mcp-config-store.d.ts +0 -15
- package/dist/infrastructure/extensions/file-mcp-config-store.js +0 -66
- package/dist/infrastructure/extensions/hook-runtime.d.ts +0 -18
- package/dist/infrastructure/extensions/hook-runtime.js +0 -66
- package/dist/infrastructure/extensions/mcp-runtime.d.ts +0 -12
- package/dist/infrastructure/extensions/mcp-runtime.js +0 -52
- package/dist/infrastructure/extensions/plugin-discovery.d.ts +0 -5
- package/dist/infrastructure/extensions/plugin-discovery.js +0 -52
- package/dist/infrastructure/extensions/plugin-manager.d.ts +0 -26
- package/dist/infrastructure/extensions/plugin-manager.js +0 -139
- package/dist/infrastructure/extensions/skill-discovery.d.ts +0 -4
- package/dist/infrastructure/extensions/skill-discovery.js +0 -29
- package/dist/infrastructure/extensions/skill-installer.d.ts +0 -8
- package/dist/infrastructure/extensions/skill-installer.js +0 -88
- package/dist/infrastructure/extensions/skill-manager.d.ts +0 -22
- package/dist/infrastructure/extensions/skill-manager.js +0 -67
- package/dist/infrastructure/extensions/skill-roots.d.ts +0 -19
- package/dist/infrastructure/extensions/skill-roots.js +0 -25
- package/dist/infrastructure/extensions/skill-tool-executor.d.ts +0 -18
- package/dist/infrastructure/extensions/skill-tool-executor.js +0 -53
- package/dist/infrastructure/filesystem/atomic-file-store.d.ts +0 -12
- package/dist/infrastructure/filesystem/atomic-file-store.js +0 -106
- package/dist/infrastructure/filesystem/bounded-file-reader.d.ts +0 -6
- package/dist/infrastructure/filesystem/bounded-file-reader.js +0 -24
- package/dist/infrastructure/filesystem/bounded-json-reader.d.ts +0 -1
- package/dist/infrastructure/filesystem/bounded-json-reader.js +0 -7
- package/dist/infrastructure/filesystem/fs-errors.d.ts +0 -2
- package/dist/infrastructure/filesystem/fs-errors.js +0 -6
- package/dist/infrastructure/filesystem/gateway-media-input-reader.d.ts +0 -12
- package/dist/infrastructure/filesystem/gateway-media-input-reader.js +0 -49
- package/dist/infrastructure/filesystem/local-filesystem-tool-executor.d.ts +0 -21
- package/dist/infrastructure/filesystem/local-filesystem-tool-executor.js +0 -176
- package/dist/infrastructure/filesystem/path-resolver.d.ts +0 -20
- package/dist/infrastructure/filesystem/path-resolver.js +0 -119
- package/dist/infrastructure/filesystem/workspace-media-artifact-store.d.ts +0 -13
- package/dist/infrastructure/filesystem/workspace-media-artifact-store.js +0 -152
- package/dist/infrastructure/logging/daily-rotating-file-writer.d.ts +0 -20
- package/dist/infrastructure/logging/daily-rotating-file-writer.js +0 -75
- package/dist/infrastructure/logging/log-redactor.d.ts +0 -2
- package/dist/infrastructure/logging/log-redactor.js +0 -26
- package/dist/infrastructure/logging/logging-policy.d.ts +0 -6
- package/dist/infrastructure/logging/logging-policy.js +0 -6
- package/dist/infrastructure/logging/structured-logger.d.ts +0 -24
- package/dist/infrastructure/logging/structured-logger.js +0 -40
- package/dist/infrastructure/network/safe-media-downloader.d.ts +0 -23
- package/dist/infrastructure/network/safe-media-downloader.js +0 -239
- package/dist/infrastructure/platform/host-platform.d.ts +0 -14
- package/dist/infrastructure/platform/host-platform.js +0 -23
- package/dist/infrastructure/platform/host-process.d.ts +0 -17
- package/dist/infrastructure/platform/host-process.js +0 -116
- package/dist/infrastructure/platform/platform-paths.d.ts +0 -25
- package/dist/infrastructure/platform/platform-paths.js +0 -33
- package/dist/infrastructure/project/file-project-trust-store.d.ts +0 -12
- package/dist/infrastructure/project/file-project-trust-store.js +0 -59
- package/dist/infrastructure/sdk/chat-completion-adapter.d.ts +0 -8
- package/dist/infrastructure/sdk/chat-completion-adapter.js +0 -115
- package/dist/infrastructure/sdk/lotagate-client-factory.d.ts +0 -3
- package/dist/infrastructure/sdk/lotagate-client-factory.js +0 -8
- package/dist/infrastructure/sdk/model-catalog-adapter.d.ts +0 -19
- package/dist/infrastructure/sdk/model-catalog-adapter.js +0 -28
- package/dist/infrastructure/sdk/sdk-media-gateway-client.d.ts +0 -20
- package/dist/infrastructure/sdk/sdk-media-gateway-client.js +0 -97
- package/dist/infrastructure/sessions/file-goal-store.d.ts +0 -21
- package/dist/infrastructure/sessions/file-goal-store.js +0 -160
- package/dist/infrastructure/sessions/file-session-store.d.ts +0 -48
- package/dist/infrastructure/sessions/file-session-store.js +0 -525
- package/dist/infrastructure/sessions/project-session-paths.d.ts +0 -17
- package/dist/infrastructure/sessions/project-session-paths.js +0 -41
- package/dist/infrastructure/sessions/session-index.d.ts +0 -16
- package/dist/infrastructure/sessions/session-index.js +0 -84
- package/dist/infrastructure/sessions/session-journal.d.ts +0 -22
- package/dist/infrastructure/sessions/session-journal.js +0 -137
- package/dist/infrastructure/sessions/subagent-journal-store.d.ts +0 -28
- package/dist/infrastructure/sessions/subagent-journal-store.js +0 -30
- package/dist/infrastructure/shell/shell-tool-executor.d.ts +0 -17
- package/dist/infrastructure/shell/shell-tool-executor.js +0 -115
- package/dist/infrastructure/tokens/tiktoken-token-estimator.d.ts +0 -18
- package/dist/infrastructure/tokens/tiktoken-token-estimator.js +0 -48
- package/dist/infrastructure/workspace/workspace-settings-store.d.ts +0 -9
- package/dist/infrastructure/workspace/workspace-settings-store.js +0 -75
- package/dist/main.d.ts +0 -7
- package/dist/main.js +0 -66
- package/dist/ports/cache-store.d.ts +0 -10
- package/dist/ports/cache-store.js +0 -1
- package/dist/ports/chat-model.d.ts +0 -30
- package/dist/ports/chat-model.js +0 -1
- package/dist/ports/clipboard-adapter.d.ts +0 -7
- package/dist/ports/clipboard-adapter.js +0 -1
- package/dist/ports/clipboard-text-adapter.d.ts +0 -3
- package/dist/ports/clipboard-text-adapter.js +0 -1
- package/dist/ports/credential-store.d.ts +0 -7
- package/dist/ports/credential-store.js +0 -1
- package/dist/ports/goal-store.d.ts +0 -12
- package/dist/ports/goal-store.js +0 -1
- package/dist/ports/logger.d.ts +0 -8
- package/dist/ports/logger.js +0 -1
- package/dist/ports/media-gateway-client.d.ts +0 -54
- package/dist/ports/media-gateway-client.js +0 -1
- package/dist/ports/model-diagnostics.d.ts +0 -17
- package/dist/ports/model-diagnostics.js +0 -1
- package/dist/ports/project-trust-store.d.ts +0 -12
- package/dist/ports/project-trust-store.js +0 -1
- package/dist/ports/session-store.d.ts +0 -58
- package/dist/ports/session-store.js +0 -1
- package/dist/ports/subagent-lifecycle.d.ts +0 -31
- package/dist/ports/subagent-lifecycle.js +0 -1
- package/dist/ports/tool-activity.d.ts +0 -13
- package/dist/ports/tool-activity.js +0 -1
- package/dist/presentation/themes/theme.d.ts +0 -19
- package/dist/presentation/themes/theme.js +0 -8
- package/dist/presentation/tui/agent-initialization-renderer.d.ts +0 -4
- package/dist/presentation/tui/agent-initialization-renderer.js +0 -37
- package/dist/presentation/tui/context-display.d.ts +0 -21
- package/dist/presentation/tui/context-display.js +0 -33
- package/dist/presentation/tui/formatters.d.ts +0 -6
- package/dist/presentation/tui/formatters.js +0 -60
- package/dist/presentation/tui/ink/choice-window.d.ts +0 -5
- package/dist/presentation/tui/ink/choice-window.js +0 -5
- package/dist/presentation/tui/ink/components/activity-entry.d.ts +0 -6
- package/dist/presentation/tui/ink/components/activity-entry.js +0 -16
- package/dist/presentation/tui/ink/components/activity-status.d.ts +0 -10
- package/dist/presentation/tui/ink/components/activity-status.js +0 -21
- package/dist/presentation/tui/ink/components/choice-modal.d.ts +0 -11
- package/dist/presentation/tui/ink/components/choice-modal.js +0 -29
- package/dist/presentation/tui/ink/components/composer.d.ts +0 -40
- package/dist/presentation/tui/ink/components/composer.js +0 -271
- package/dist/presentation/tui/ink/components/file-diff.d.ts +0 -6
- package/dist/presentation/tui/ink/components/file-diff.js +0 -34
- package/dist/presentation/tui/ink/components/modal.d.ts +0 -8
- package/dist/presentation/tui/ink/components/modal.js +0 -110
- package/dist/presentation/tui/ink/components/shimmer-text.d.ts +0 -6
- package/dist/presentation/tui/ink/components/shimmer-text.js +0 -9
- package/dist/presentation/tui/ink/components/subagent-activity.d.ts +0 -11
- package/dist/presentation/tui/ink/components/subagent-activity.js +0 -61
- package/dist/presentation/tui/ink/components/transcript.d.ts +0 -39
- package/dist/presentation/tui/ink/components/transcript.js +0 -121
- package/dist/presentation/tui/ink/components/welcome-panel.d.ts +0 -6
- package/dist/presentation/tui/ink/components/welcome-panel.js +0 -20
- package/dist/presentation/tui/ink/lotagate-tui.d.ts +0 -6
- package/dist/presentation/tui/ink/lotagate-tui.js +0 -136
- package/dist/presentation/tui/ink/markdown-inline-renderer.d.ts +0 -4
- package/dist/presentation/tui/ink/markdown-inline-renderer.js +0 -20
- package/dist/presentation/tui/ink/markdown-inline.d.ts +0 -13
- package/dist/presentation/tui/ink/markdown-inline.js +0 -91
- package/dist/presentation/tui/ink/markdown-message.d.ts +0 -6
- package/dist/presentation/tui/ink/markdown-message.js +0 -66
- package/dist/presentation/tui/ink/markdown-table.d.ts +0 -16
- package/dist/presentation/tui/ink/markdown-table.js +0 -77
- package/dist/presentation/tui/ink/tui-bridge.d.ts +0 -195
- package/dist/presentation/tui/ink/tui-bridge.js +0 -289
- package/dist/presentation/tui/terminal-capabilities.d.ts +0 -15
- package/dist/presentation/tui/terminal-capabilities.js +0 -7
- package/dist/presentation/tui/terminal-mouse.d.ts +0 -5
- package/dist/presentation/tui/terminal-mouse.js +0 -19
- package/dist/presentation/tui/terminal-screen.d.ts +0 -10
- package/dist/presentation/tui/terminal-screen.js +0 -23
- package/dist/presentation/tui/tui-agent-event-runner.d.ts +0 -24
- package/dist/presentation/tui/tui-agent-event-runner.js +0 -69
- package/dist/presentation/tui/tui-application-contract.d.ts +0 -10
- package/dist/presentation/tui/tui-application-contract.js +0 -8
- package/dist/presentation/tui/tui-application.d.ts +0 -62
- package/dist/presentation/tui/tui-application.js +0 -675
- package/dist/presentation/tui/tui-attachment-input.d.ts +0 -2
- package/dist/presentation/tui/tui-attachment-input.js +0 -5
- package/dist/presentation/tui/tui-clipboard-paste-handlers.d.ts +0 -11
- package/dist/presentation/tui/tui-clipboard-paste-handlers.js +0 -25
- package/dist/presentation/tui/tui-command-context.d.ts +0 -3
- package/dist/presentation/tui/tui-command-context.js +0 -1
- package/dist/presentation/tui/tui-command-executor.d.ts +0 -38
- package/dist/presentation/tui/tui-command-executor.js +0 -214
- package/dist/presentation/tui/tui-command-host-factory.d.ts +0 -40
- package/dist/presentation/tui/tui-command-host-factory.js +0 -23
- package/dist/presentation/tui/tui-context-compaction.d.ts +0 -5
- package/dist/presentation/tui/tui-context-compaction.js +0 -22
- package/dist/presentation/tui/tui-context-service.d.ts +0 -34
- package/dist/presentation/tui/tui-context-service.js +0 -126
- package/dist/presentation/tui/tui-file-suggestions.d.ts +0 -3
- package/dist/presentation/tui/tui-file-suggestions.js +0 -8
- package/dist/presentation/tui/tui-goal-controller.d.ts +0 -14
- package/dist/presentation/tui/tui-goal-controller.js +0 -52
- package/dist/presentation/tui/tui-initial-model.d.ts +0 -3
- package/dist/presentation/tui/tui-initial-model.js +0 -28
- package/dist/presentation/tui/tui-lifecycle-actions.d.ts +0 -13
- package/dist/presentation/tui/tui-lifecycle-actions.js +0 -45
- package/dist/presentation/tui/tui-manual-compaction.d.ts +0 -18
- package/dist/presentation/tui/tui-manual-compaction.js +0 -31
- package/dist/presentation/tui/tui-media-model-selection.d.ts +0 -12
- package/dist/presentation/tui/tui-media-model-selection.js +0 -38
- package/dist/presentation/tui/tui-prompt-dispatcher.d.ts +0 -16
- package/dist/presentation/tui/tui-prompt-dispatcher.js +0 -38
- package/dist/presentation/tui/tui-skill-controller.d.ts +0 -11
- package/dist/presentation/tui/tui-skill-controller.js +0 -13
- package/dist/presentation/tui/tui-tool-approval.d.ts +0 -22
- package/dist/presentation/tui/tui-tool-approval.js +0 -73
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { CliError } from '../errors/cli-error.js';
|
|
2
|
-
import { CLI_ERROR_CODES } from '../errors/error-codes.js';
|
|
3
|
-
const PROFILE_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,31}$/;
|
|
4
|
-
export function validateProfileName(name) {
|
|
5
|
-
const normalized = name.trim().toLowerCase();
|
|
6
|
-
if (!PROFILE_NAME_PATTERN.test(normalized)) {
|
|
7
|
-
throw new CliError(CLI_ERROR_CODES.AUTH_PROFILE_NOT_FOUND, `Invalid profile name: ${name}`, {
|
|
8
|
-
category: 'auth',
|
|
9
|
-
userMessage: 'Profile names may contain lowercase letters, digits, hyphens, or underscores; maximum 32 characters.',
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
return normalized;
|
|
13
|
-
}
|
|
14
|
-
export function validateBaseUrl(value) {
|
|
15
|
-
let url;
|
|
16
|
-
try {
|
|
17
|
-
url = new URL(value);
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
throw new CliError(CLI_ERROR_CODES.AUTH_BASE_URL_INVALID, 'Base URL is invalid.', {
|
|
21
|
-
category: 'auth', userMessage: 'Invalid base URL.', cause: error,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
25
|
-
throw new CliError(CLI_ERROR_CODES.AUTH_BASE_URL_INVALID, 'Base URL must use HTTP or HTTPS.', {
|
|
26
|
-
category: 'auth', userMessage: 'Base URL must use HTTP or HTTPS.',
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return value.replace(/\/+$/, '');
|
|
30
|
-
}
|
|
31
|
-
export function validateApiKey(apiKey) {
|
|
32
|
-
const normalized = apiKey.trim();
|
|
33
|
-
if (normalized.length < 8 || normalized.length > 4096 || /[\r\n]/.test(normalized)) {
|
|
34
|
-
throw new CliError(CLI_ERROR_CODES.AUTH_API_KEY_INVALID, 'API key has an invalid shape.', {
|
|
35
|
-
category: 'auth', userMessage: 'API key is invalid or contains a newline.',
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return normalized;
|
|
39
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const CONFIG_SCHEMA_VERSION = 1;
|
|
2
|
-
export interface CliConfig {
|
|
3
|
-
schemaVersion: 1;
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
model: string | null;
|
|
6
|
-
profile: string | null;
|
|
7
|
-
theme: 'dark' | 'light' | 'auto';
|
|
8
|
-
approvalMode: 'ask' | 'auto' | 'deny';
|
|
9
|
-
sandboxMode: 'workspace' | 'disabled';
|
|
10
|
-
telemetry: 'off' | 'opt-in';
|
|
11
|
-
updateChannel: 'stable' | 'preview';
|
|
12
|
-
}
|
|
13
|
-
export type ConfigurableKey = Exclude<keyof CliConfig, 'schemaVersion'>;
|
|
14
|
-
export declare const CONFIGURABLE_KEYS: readonly ConfigurableKey[];
|
|
15
|
-
export declare const DEFAULT_CONFIG: CliConfig;
|
|
16
|
-
export declare function validateConfig(value: unknown): Partial<CliConfig>;
|
|
17
|
-
export declare function mergeConfig(...layers: readonly Partial<CliConfig>[]): CliConfig;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { CliError } from '../errors/cli-error.js';
|
|
2
|
-
import { CLI_ERROR_CODES } from '../errors/error-codes.js';
|
|
3
|
-
import { findUnexpectedRecordKey, isRecord } from '../validation/record-schema.js';
|
|
4
|
-
export const CONFIG_SCHEMA_VERSION = 1;
|
|
5
|
-
export const CONFIGURABLE_KEYS = [
|
|
6
|
-
'baseUrl',
|
|
7
|
-
'model',
|
|
8
|
-
'profile',
|
|
9
|
-
'theme',
|
|
10
|
-
'approvalMode',
|
|
11
|
-
'sandboxMode',
|
|
12
|
-
'telemetry',
|
|
13
|
-
'updateChannel',
|
|
14
|
-
];
|
|
15
|
-
const CONFIG_KEYS = ['schemaVersion', ...CONFIGURABLE_KEYS];
|
|
16
|
-
export const DEFAULT_CONFIG = {
|
|
17
|
-
schemaVersion: CONFIG_SCHEMA_VERSION,
|
|
18
|
-
baseUrl: 'https://api.lotagate.com',
|
|
19
|
-
model: null,
|
|
20
|
-
profile: null,
|
|
21
|
-
theme: 'dark',
|
|
22
|
-
approvalMode: 'ask',
|
|
23
|
-
sandboxMode: 'workspace',
|
|
24
|
-
telemetry: 'off',
|
|
25
|
-
updateChannel: 'stable',
|
|
26
|
-
};
|
|
27
|
-
function assertString(value, field) {
|
|
28
|
-
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
29
|
-
throw new CliError(CLI_ERROR_CODES.CONFIG_SCHEMA_INVALID, `Invalid config field: ${field}`, {
|
|
30
|
-
category: 'config',
|
|
31
|
-
userMessage: `Invalid configuration: field \`${field}\` must be a non-empty string.`,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export function validateConfig(value) {
|
|
36
|
-
if (!isRecord(value)) {
|
|
37
|
-
throw new CliError(CLI_ERROR_CODES.CONFIG_SCHEMA_INVALID, 'Config must be a JSON object.', {
|
|
38
|
-
category: 'config',
|
|
39
|
-
userMessage: 'Configuration file must contain a JSON object.',
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
const unexpectedKey = findUnexpectedRecordKey(value, CONFIG_KEYS);
|
|
43
|
-
if (unexpectedKey !== undefined)
|
|
44
|
-
throw invalidConfig(`Unsupported configuration field: \`${unexpectedKey}\`.`);
|
|
45
|
-
if (value['schemaVersion'] !== undefined && value['schemaVersion'] !== CONFIG_SCHEMA_VERSION) {
|
|
46
|
-
throw new CliError(CLI_ERROR_CODES.CONFIG_SCHEMA_INVALID, 'Unsupported config schema version.', {
|
|
47
|
-
category: 'config',
|
|
48
|
-
userMessage: `Unsupported configuration schema version: ${String(value['schemaVersion'])}.`,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
const baseUrl = value['baseUrl'];
|
|
52
|
-
if (baseUrl !== undefined) {
|
|
53
|
-
assertString(baseUrl, 'baseUrl');
|
|
54
|
-
try {
|
|
55
|
-
new URL(baseUrl);
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
throw new CliError(CLI_ERROR_CODES.CONFIG_SCHEMA_INVALID, 'baseUrl must be a valid URL.', {
|
|
59
|
-
category: 'config', userMessage: 'baseUrl must be a valid URL.', cause: error,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const modelValue = value['model'];
|
|
64
|
-
const profileValue = value['profile'];
|
|
65
|
-
if (modelValue !== undefined && modelValue !== null)
|
|
66
|
-
assertString(modelValue, 'model');
|
|
67
|
-
if (profileValue !== undefined && profileValue !== null)
|
|
68
|
-
assertString(profileValue, 'profile');
|
|
69
|
-
if (typeof modelValue === 'string' && modelValue.length > 256) {
|
|
70
|
-
throw new CliError(CLI_ERROR_CODES.CONFIG_SCHEMA_INVALID, 'Model id is too long.', {
|
|
71
|
-
category: 'config', userMessage: 'Model id must not exceed 256 characters.',
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
const theme = parseEnum(value['theme'], 'theme', ['dark', 'light', 'auto']);
|
|
75
|
-
const approvalMode = parseEnum(value['approvalMode'], 'approvalMode', ['ask', 'auto', 'deny']);
|
|
76
|
-
const sandboxMode = parseEnum(value['sandboxMode'], 'sandboxMode', ['workspace', 'disabled']);
|
|
77
|
-
const telemetry = parseEnum(value['telemetry'], 'telemetry', ['off', 'opt-in']);
|
|
78
|
-
const updateChannel = parseEnum(value['updateChannel'], 'updateChannel', ['stable', 'preview']);
|
|
79
|
-
return {
|
|
80
|
-
...(value['schemaVersion'] === undefined ? {} : { schemaVersion: CONFIG_SCHEMA_VERSION }),
|
|
81
|
-
...(baseUrl === undefined ? {} : { baseUrl }),
|
|
82
|
-
...(modelValue === undefined ? {} : { model: modelValue }),
|
|
83
|
-
...(profileValue === undefined ? {} : { profile: profileValue }),
|
|
84
|
-
...(theme === undefined ? {} : { theme }),
|
|
85
|
-
...(approvalMode === undefined ? {} : { approvalMode }),
|
|
86
|
-
...(sandboxMode === undefined ? {} : { sandboxMode }),
|
|
87
|
-
...(telemetry === undefined ? {} : { telemetry }),
|
|
88
|
-
...(updateChannel === undefined ? {} : { updateChannel }),
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
export function mergeConfig(...layers) {
|
|
92
|
-
const merged = layers.reduce((result, layer) => ({ ...result, ...layer }), {});
|
|
93
|
-
return { ...DEFAULT_CONFIG, ...validateConfig(merged), schemaVersion: CONFIG_SCHEMA_VERSION };
|
|
94
|
-
}
|
|
95
|
-
function parseEnum(value, field, values) {
|
|
96
|
-
if (value === undefined)
|
|
97
|
-
return undefined;
|
|
98
|
-
if (typeof value !== 'string' || !values.includes(value)) {
|
|
99
|
-
throw invalidConfig(`Invalid configuration: value for \`${field}\` is not supported.`);
|
|
100
|
-
}
|
|
101
|
-
return value;
|
|
102
|
-
}
|
|
103
|
-
function invalidConfig(userMessage) {
|
|
104
|
-
return new CliError(CLI_ERROR_CODES.CONFIG_SCHEMA_INVALID, userMessage, { category: 'config', userMessage });
|
|
105
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { CliErrorCode } from './error-codes.js';
|
|
2
|
-
import type { CliCommandHint } from './cli-command-hint.js';
|
|
3
|
-
export interface CliErrorOptions {
|
|
4
|
-
category: string;
|
|
5
|
-
userMessage?: string;
|
|
6
|
-
retryable?: boolean;
|
|
7
|
-
exitCode?: number;
|
|
8
|
-
correlationId?: string;
|
|
9
|
-
details?: Record<string, unknown>;
|
|
10
|
-
hint?: CliCommandHint;
|
|
11
|
-
cause?: unknown;
|
|
12
|
-
}
|
|
13
|
-
export interface CliErrorShape {
|
|
14
|
-
code: CliErrorCode | string;
|
|
15
|
-
category: string;
|
|
16
|
-
message: string;
|
|
17
|
-
userMessage: string;
|
|
18
|
-
retryable: boolean;
|
|
19
|
-
exitCode: number;
|
|
20
|
-
correlationId?: string;
|
|
21
|
-
details?: Record<string, unknown>;
|
|
22
|
-
}
|
|
23
|
-
export declare class CliError extends Error {
|
|
24
|
-
readonly code: CliErrorCode | string;
|
|
25
|
-
readonly category: string;
|
|
26
|
-
readonly userMessage: string;
|
|
27
|
-
readonly retryable: boolean;
|
|
28
|
-
readonly exitCode: number;
|
|
29
|
-
readonly correlationId: string | undefined;
|
|
30
|
-
readonly details: Record<string, unknown> | undefined;
|
|
31
|
-
readonly hint: CliCommandHint | undefined;
|
|
32
|
-
constructor(code: CliErrorCode | string, message: string, options: CliErrorOptions);
|
|
33
|
-
toJSON(): CliErrorShape;
|
|
34
|
-
}
|
|
35
|
-
export declare function asCliError(error: unknown): CliError;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { CLI_ERROR_CODES } from './error-codes.js';
|
|
2
|
-
export class CliError extends Error {
|
|
3
|
-
code;
|
|
4
|
-
category;
|
|
5
|
-
userMessage;
|
|
6
|
-
retryable;
|
|
7
|
-
exitCode;
|
|
8
|
-
correlationId;
|
|
9
|
-
details;
|
|
10
|
-
hint;
|
|
11
|
-
constructor(code, message, options) {
|
|
12
|
-
super(message, { cause: options.cause });
|
|
13
|
-
this.name = 'CliError';
|
|
14
|
-
this.code = code;
|
|
15
|
-
this.category = options.category;
|
|
16
|
-
this.userMessage = options.userMessage ?? message;
|
|
17
|
-
this.retryable = options.retryable ?? false;
|
|
18
|
-
this.exitCode = options.exitCode ?? 1;
|
|
19
|
-
this.correlationId = options.correlationId;
|
|
20
|
-
this.details = options.details;
|
|
21
|
-
this.hint = options.hint;
|
|
22
|
-
}
|
|
23
|
-
toJSON() {
|
|
24
|
-
return {
|
|
25
|
-
code: this.code,
|
|
26
|
-
category: this.category,
|
|
27
|
-
message: this.message,
|
|
28
|
-
userMessage: this.userMessage,
|
|
29
|
-
retryable: this.retryable,
|
|
30
|
-
exitCode: this.exitCode,
|
|
31
|
-
...(this.correlationId !== undefined ? { correlationId: this.correlationId } : {}),
|
|
32
|
-
...(this.details !== undefined ? { details: this.details } : {}),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export function asCliError(error) {
|
|
37
|
-
if (error instanceof CliError)
|
|
38
|
-
return error;
|
|
39
|
-
const code = readExternalErrorCode(error);
|
|
40
|
-
const external = readExternalError(error);
|
|
41
|
-
if (code === 'REQUEST_ABORTED') {
|
|
42
|
-
return new CliError(CLI_ERROR_CODES.INTERRUPTED, errorMessage(error), {
|
|
43
|
-
category: 'media', userMessage: 'The request was interrupted.', retryable: true,
|
|
44
|
-
...external, cause: error,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (code === 'REQUEST_TIMEOUT' || code === 'NETWORK_ERROR') {
|
|
48
|
-
return new CliError(CLI_ERROR_CODES.MEDIA_REQUEST_FAILED, errorMessage(error), {
|
|
49
|
-
category: 'media', userMessage: 'The media request could not be completed. Retry the request; if it persists, check the selected model, credentials, and network connection.', retryable: true,
|
|
50
|
-
...external, cause: error,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
if (code === 'REQUEST_VALIDATION_ERROR' || code === 'REQUEST_PAYLOAD_TOO_LARGE') {
|
|
54
|
-
return new CliError(CLI_ERROR_CODES.INVALID_ARGUMENT, errorMessage(error), {
|
|
55
|
-
category: 'media', userMessage: 'The media request does not satisfy a gateway validation limit. Review the command options and input file size.',
|
|
56
|
-
...external, cause: error,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (code === 'RESPONSE_TOO_LARGE') {
|
|
60
|
-
return new CliError(CLI_ERROR_CODES.MEDIA_RESPONSE_TOO_LARGE, errorMessage(error), {
|
|
61
|
-
category: 'media', userMessage: 'The generated media exceeds the supported download size.', retryable: false,
|
|
62
|
-
...external, cause: error,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if (code === 'TOOL_ARGUMENTS_INVALID') {
|
|
66
|
-
return new CliError(CLI_ERROR_CODES.TOOL_ARGUMENT_INVALID, errorMessage(error), {
|
|
67
|
-
category: 'tool',
|
|
68
|
-
userMessage: 'The selected model returned malformed tool arguments. Retry the request or choose a model with reliable tool-calling support.',
|
|
69
|
-
retryable: true,
|
|
70
|
-
cause: error,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
if (code === 'TOOL_NOT_FOUND') {
|
|
74
|
-
return new CliError(CLI_ERROR_CODES.MODEL_STREAM_FAILED, errorMessage(error), {
|
|
75
|
-
category: 'model',
|
|
76
|
-
userMessage: 'The selected model requested a tool that is unavailable in this CLI session. Retry the request or choose another model.',
|
|
77
|
-
retryable: true,
|
|
78
|
-
cause: error,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (code === 'AGENT_LIMIT_EXCEEDED') {
|
|
82
|
-
return new CliError(CLI_ERROR_CODES.AGENT_STUCK, errorMessage(error), {
|
|
83
|
-
category: 'agent',
|
|
84
|
-
userMessage: 'The agent reached a safety limit before completing. Narrow the task and try again.',
|
|
85
|
-
retryable: true,
|
|
86
|
-
cause: error,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (code === 'MODEL_RESPONSE_INVALID' || isProviderFailure(error)) {
|
|
90
|
-
return new CliError(CLI_ERROR_CODES.MODEL_STREAM_FAILED, errorMessage(error), {
|
|
91
|
-
category: 'model',
|
|
92
|
-
userMessage: 'The model provider could not complete the request. Retry; if it persists, check the selected model, credentials, and base URL.',
|
|
93
|
-
retryable: true,
|
|
94
|
-
cause: error,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
return new CliError(CLI_ERROR_CODES.INTERNAL_ERROR, error instanceof Error ? error.message : String(error), {
|
|
98
|
-
category: 'general',
|
|
99
|
-
userMessage: 'An internal error occurred.',
|
|
100
|
-
hint: { actionId: 'doctor' },
|
|
101
|
-
cause: error,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
function readExternalErrorCode(error) {
|
|
105
|
-
if (typeof error !== 'object' || error === null)
|
|
106
|
-
return undefined;
|
|
107
|
-
const value = error;
|
|
108
|
-
if (typeof value['code'] === 'string')
|
|
109
|
-
return value['code'];
|
|
110
|
-
return typeof value['errorCode'] === 'string' ? value['errorCode'] : undefined;
|
|
111
|
-
}
|
|
112
|
-
function readExternalError(error) {
|
|
113
|
-
if (typeof error !== 'object' || error === null)
|
|
114
|
-
return {};
|
|
115
|
-
const value = error;
|
|
116
|
-
return {
|
|
117
|
-
...(typeof value['correlationId'] === 'string' ? { correlationId: value['correlationId'] } : {}),
|
|
118
|
-
...(isDetails(value['details']) ? { details: value['details'] } : {}),
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
function isDetails(value) {
|
|
122
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
123
|
-
}
|
|
124
|
-
function isProviderFailure(error) {
|
|
125
|
-
return errorMessage(error) === 'Upstream AI provider request failed.';
|
|
126
|
-
}
|
|
127
|
-
function errorMessage(error) {
|
|
128
|
-
return error instanceof Error ? error.message : String(error);
|
|
129
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export declare const CLI_ERROR_CODES: {
|
|
2
|
-
readonly INVALID_ARGUMENT: "CLI_INVALID_ARGUMENT";
|
|
3
|
-
readonly MISSING_ARGUMENT: "CLI_MISSING_ARGUMENT";
|
|
4
|
-
readonly INTERRUPTED: "CLI_INTERRUPTED";
|
|
5
|
-
readonly INTERNAL_ERROR: "CLI_INTERNAL_ERROR";
|
|
6
|
-
readonly CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND";
|
|
7
|
-
readonly CONFIG_INVALID_JSON: "CONFIG_INVALID_JSON";
|
|
8
|
-
readonly CONFIG_SCHEMA_INVALID: "CONFIG_SCHEMA_INVALID";
|
|
9
|
-
readonly CONFIG_LOCKED: "CONFIG_LOCKED";
|
|
10
|
-
readonly PROJECT_PATH_INVALID: "PROJECT_PATH_INVALID";
|
|
11
|
-
readonly AUTH_API_KEY_INVALID: "AUTH_API_KEY_INVALID";
|
|
12
|
-
readonly AUTH_PROFILE_NOT_FOUND: "AUTH_PROFILE_NOT_FOUND";
|
|
13
|
-
readonly AUTH_CREDENTIAL_STORE_UNAVAILABLE: "AUTH_CREDENTIAL_STORE_UNAVAILABLE";
|
|
14
|
-
readonly AUTH_BASE_URL_INVALID: "AUTH_BASE_URL_INVALID";
|
|
15
|
-
readonly PROJECT_TRUST_REQUIRED: "PROJECT_TRUST_REQUIRED";
|
|
16
|
-
readonly MODEL_NOT_FOUND: "MODEL_NOT_FOUND";
|
|
17
|
-
readonly MODEL_STREAM_FAILED: "MODEL_STREAM_FAILED";
|
|
18
|
-
readonly MODEL_EMPTY_RESPONSE: "MODEL_EMPTY_RESPONSE";
|
|
19
|
-
readonly MODEL_PROTOCOL_EMPTY_RESPONSE: "MODEL_PROTOCOL_EMPTY_RESPONSE";
|
|
20
|
-
readonly MEDIA_REQUEST_FAILED: "MEDIA_REQUEST_FAILED";
|
|
21
|
-
readonly MEDIA_RESPONSE_TOO_LARGE: "MEDIA_RESPONSE_TOO_LARGE";
|
|
22
|
-
readonly MODEL_EMPTY_FINAL: "MODEL_EMPTY_FINAL";
|
|
23
|
-
readonly AGENT_STUCK: "AGENT_STUCK";
|
|
24
|
-
readonly ATTACHMENT_CLIPBOARD_UNAVAILABLE: "ATTACHMENT_CLIPBOARD_UNAVAILABLE";
|
|
25
|
-
readonly ATTACHMENT_FORMAT_UNSUPPORTED: "ATTACHMENT_FORMAT_UNSUPPORTED";
|
|
26
|
-
readonly ATTACHMENT_TOO_LARGE: "ATTACHMENT_TOO_LARGE";
|
|
27
|
-
readonly ATTACHMENT_INVALID_IMAGE: "ATTACHMENT_INVALID_IMAGE";
|
|
28
|
-
readonly TOOL_ARGUMENT_INVALID: "TOOL_ARGUMENT_INVALID";
|
|
29
|
-
readonly PROJECT_SYMLINK_ESCAPE: "PROJECT_SYMLINK_ESCAPE";
|
|
30
|
-
readonly SESSION_NOT_FOUND: "SESSION_NOT_FOUND";
|
|
31
|
-
readonly SESSION_LOCKED: "SESSION_LOCKED";
|
|
32
|
-
readonly SESSION_CORRUPTED: "SESSION_CORRUPTED";
|
|
33
|
-
readonly TASK_DEPENDENCY_CYCLE: "TASK_DEPENDENCY_CYCLE";
|
|
34
|
-
readonly TASK_SCHEDULER_OVERLOADED: "TASK_SCHEDULER_OVERLOADED";
|
|
35
|
-
readonly TASK_PLAN_APPROVAL_REQUIRED: "TASK_PLAN_APPROVAL_REQUIRED";
|
|
36
|
-
readonly PLUGIN_MANIFEST_INVALID: "PLUGIN_MANIFEST_INVALID";
|
|
37
|
-
readonly PLUGIN_NOT_FOUND: "PLUGIN_NOT_FOUND";
|
|
38
|
-
readonly SKILL_FRONTMATTER_INVALID: "SKILL_FRONTMATTER_INVALID";
|
|
39
|
-
readonly SKILL_NOT_FOUND: "SKILL_NOT_FOUND";
|
|
40
|
-
readonly MCP_CONFIG_INVALID: "MCP_CONFIG_INVALID";
|
|
41
|
-
readonly MCP_SERVER_NOT_FOUND: "MCP_SERVER_NOT_FOUND";
|
|
42
|
-
readonly GOAL_NOT_FOUND: "GOAL_NOT_FOUND";
|
|
43
|
-
readonly GOAL_INVALID_STATE: "GOAL_INVALID_STATE";
|
|
44
|
-
readonly GOAL_LIMIT_REACHED: "GOAL_LIMIT_REACHED";
|
|
45
|
-
};
|
|
46
|
-
export type CliErrorCode = (typeof CLI_ERROR_CODES)[keyof typeof CLI_ERROR_CODES];
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export const CLI_ERROR_CODES = {
|
|
2
|
-
INVALID_ARGUMENT: 'CLI_INVALID_ARGUMENT',
|
|
3
|
-
MISSING_ARGUMENT: 'CLI_MISSING_ARGUMENT',
|
|
4
|
-
INTERRUPTED: 'CLI_INTERRUPTED',
|
|
5
|
-
INTERNAL_ERROR: 'CLI_INTERNAL_ERROR',
|
|
6
|
-
CONFIG_NOT_FOUND: 'CONFIG_NOT_FOUND',
|
|
7
|
-
CONFIG_INVALID_JSON: 'CONFIG_INVALID_JSON',
|
|
8
|
-
CONFIG_SCHEMA_INVALID: 'CONFIG_SCHEMA_INVALID',
|
|
9
|
-
CONFIG_LOCKED: 'CONFIG_LOCKED',
|
|
10
|
-
PROJECT_PATH_INVALID: 'PROJECT_PATH_INVALID',
|
|
11
|
-
AUTH_API_KEY_INVALID: 'AUTH_API_KEY_INVALID',
|
|
12
|
-
AUTH_PROFILE_NOT_FOUND: 'AUTH_PROFILE_NOT_FOUND',
|
|
13
|
-
AUTH_CREDENTIAL_STORE_UNAVAILABLE: 'AUTH_CREDENTIAL_STORE_UNAVAILABLE',
|
|
14
|
-
AUTH_BASE_URL_INVALID: 'AUTH_BASE_URL_INVALID',
|
|
15
|
-
PROJECT_TRUST_REQUIRED: 'PROJECT_TRUST_REQUIRED',
|
|
16
|
-
MODEL_NOT_FOUND: 'MODEL_NOT_FOUND',
|
|
17
|
-
MODEL_STREAM_FAILED: 'MODEL_STREAM_FAILED',
|
|
18
|
-
MODEL_EMPTY_RESPONSE: 'MODEL_EMPTY_RESPONSE',
|
|
19
|
-
MODEL_PROTOCOL_EMPTY_RESPONSE: 'MODEL_PROTOCOL_EMPTY_RESPONSE',
|
|
20
|
-
MEDIA_REQUEST_FAILED: 'MEDIA_REQUEST_FAILED',
|
|
21
|
-
MEDIA_RESPONSE_TOO_LARGE: 'MEDIA_RESPONSE_TOO_LARGE',
|
|
22
|
-
MODEL_EMPTY_FINAL: 'MODEL_EMPTY_FINAL',
|
|
23
|
-
AGENT_STUCK: 'AGENT_STUCK',
|
|
24
|
-
ATTACHMENT_CLIPBOARD_UNAVAILABLE: 'ATTACHMENT_CLIPBOARD_UNAVAILABLE',
|
|
25
|
-
ATTACHMENT_FORMAT_UNSUPPORTED: 'ATTACHMENT_FORMAT_UNSUPPORTED',
|
|
26
|
-
ATTACHMENT_TOO_LARGE: 'ATTACHMENT_TOO_LARGE',
|
|
27
|
-
ATTACHMENT_INVALID_IMAGE: 'ATTACHMENT_INVALID_IMAGE',
|
|
28
|
-
TOOL_ARGUMENT_INVALID: 'TOOL_ARGUMENT_INVALID',
|
|
29
|
-
PROJECT_SYMLINK_ESCAPE: 'PROJECT_SYMLINK_ESCAPE',
|
|
30
|
-
SESSION_NOT_FOUND: 'SESSION_NOT_FOUND',
|
|
31
|
-
SESSION_LOCKED: 'SESSION_LOCKED',
|
|
32
|
-
SESSION_CORRUPTED: 'SESSION_CORRUPTED',
|
|
33
|
-
TASK_DEPENDENCY_CYCLE: 'TASK_DEPENDENCY_CYCLE',
|
|
34
|
-
TASK_SCHEDULER_OVERLOADED: 'TASK_SCHEDULER_OVERLOADED',
|
|
35
|
-
TASK_PLAN_APPROVAL_REQUIRED: 'TASK_PLAN_APPROVAL_REQUIRED',
|
|
36
|
-
PLUGIN_MANIFEST_INVALID: 'PLUGIN_MANIFEST_INVALID',
|
|
37
|
-
PLUGIN_NOT_FOUND: 'PLUGIN_NOT_FOUND',
|
|
38
|
-
SKILL_FRONTMATTER_INVALID: 'SKILL_FRONTMATTER_INVALID',
|
|
39
|
-
SKILL_NOT_FOUND: 'SKILL_NOT_FOUND',
|
|
40
|
-
MCP_CONFIG_INVALID: 'MCP_CONFIG_INVALID',
|
|
41
|
-
MCP_SERVER_NOT_FOUND: 'MCP_SERVER_NOT_FOUND',
|
|
42
|
-
GOAL_NOT_FOUND: 'GOAL_NOT_FOUND',
|
|
43
|
-
GOAL_INVALID_STATE: 'GOAL_INVALID_STATE',
|
|
44
|
-
GOAL_LIMIT_REACHED: 'GOAL_LIMIT_REACHED',
|
|
45
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CliError } from '../errors/cli-error.js';
|
|
2
|
-
import { CLI_ERROR_CODES } from '../errors/error-codes.js';
|
|
3
|
-
export function parseExtensionScope(value) {
|
|
4
|
-
if (value === undefined)
|
|
5
|
-
return undefined;
|
|
6
|
-
if (typeof value !== 'string' || (value !== 'user' && value !== 'project')) {
|
|
7
|
-
throw new CliError(CLI_ERROR_CODES.INVALID_ARGUMENT, 'Extension scope must be user or project.', {
|
|
8
|
-
category: 'arguments',
|
|
9
|
-
userMessage: 'Invalid scope. Use --scope user or --scope project.',
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
export function requireExtensionScope(value) {
|
|
15
|
-
const scope = parseExtensionScope(value);
|
|
16
|
-
if (scope === undefined) {
|
|
17
|
-
throw new CliError(CLI_ERROR_CODES.MISSING_ARGUMENT, 'Extension scope is required for non-interactive commands.', {
|
|
18
|
-
category: 'arguments',
|
|
19
|
-
userMessage: 'Choose a scope interactively or pass --scope user|project.',
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return scope;
|
|
23
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function parseExtensionState(value) {
|
|
2
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
3
|
-
throw new Error('Extension state must be an object.');
|
|
4
|
-
const state = {};
|
|
5
|
-
for (const [name, entry] of Object.entries(value)) {
|
|
6
|
-
if (typeof entry !== 'object' || entry === null || Array.isArray(entry) || typeof entry['enabled'] !== 'boolean')
|
|
7
|
-
throw new Error(`Invalid extension state entry: ${name}.`);
|
|
8
|
-
state[name] = { enabled: entry['enabled'] };
|
|
9
|
-
}
|
|
10
|
-
return state;
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type HookEvent = 'session.start' | 'prompt.before' | 'tool.before' | 'tool.after' | 'response.after' | 'session.end';
|
|
2
|
-
export interface HookDefinition {
|
|
3
|
-
id: string;
|
|
4
|
-
event: HookEvent;
|
|
5
|
-
command: string;
|
|
6
|
-
args: readonly string[];
|
|
7
|
-
timeoutMs: number;
|
|
8
|
-
directory: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function parseHookDefinition(value: unknown, directory: string, id: string): HookDefinition;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CliError } from '../errors/cli-error.js';
|
|
2
|
-
import { CLI_ERROR_CODES } from '../errors/error-codes.js';
|
|
3
|
-
export function parseHookDefinition(value, directory, id) {
|
|
4
|
-
if (typeof value !== 'object' || value === null)
|
|
5
|
-
throw invalidHook('Hook must be a JSON object.');
|
|
6
|
-
const record = value;
|
|
7
|
-
const event = record['event'];
|
|
8
|
-
const command = record['command'];
|
|
9
|
-
const args = record['args'];
|
|
10
|
-
const timeoutMs = record['timeoutMs'];
|
|
11
|
-
if (!isHookEvent(event))
|
|
12
|
-
throw invalidHook('Hook event is not supported.');
|
|
13
|
-
if (typeof command !== 'string' || command.trim().length === 0 || /[\r\n]/u.test(command))
|
|
14
|
-
throw invalidHook('Hook command is invalid.');
|
|
15
|
-
if (args !== undefined && (!Array.isArray(args) || args.some((item) => typeof item !== 'string')))
|
|
16
|
-
throw invalidHook('Hook args must be strings.');
|
|
17
|
-
const timeout = timeoutMs === undefined ? 10_000 : timeoutMs;
|
|
18
|
-
if (typeof timeout !== 'number' || !Number.isInteger(timeout) || timeout < 100 || timeout > 120_000)
|
|
19
|
-
throw invalidHook('Hook timeout must be between 100 and 120000 milliseconds.');
|
|
20
|
-
return { id, event, command, args: (args ?? []), timeoutMs: timeout, directory };
|
|
21
|
-
}
|
|
22
|
-
function isHookEvent(value) { return typeof value === 'string' && ['session.start', 'prompt.before', 'tool.before', 'tool.after', 'response.after', 'session.end'].includes(value); }
|
|
23
|
-
function invalidHook(message) { return new CliError(CLI_ERROR_CODES.PLUGIN_MANIFEST_INVALID, message, { category: 'extension', userMessage: `Invalid hook: ${message}` }); }
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { McpServerConfig } from '@lotagate/agent-sdk';
|
|
2
|
-
/** Persistable subset of the public Agent SDK MCP contract. */
|
|
3
|
-
export type CliMcpServerConfig = McpServerConfig;
|
|
4
|
-
export interface CliMcpServerEntry {
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
config: CliMcpServerConfig;
|
|
7
|
-
}
|
|
8
|
-
export type CliMcpConfig = Record<string, CliMcpServerEntry>;
|
|
9
|
-
export declare function mergeMcpConfigs(...configs: readonly CliMcpConfig[]): CliMcpConfig;
|
|
10
|
-
/**
|
|
11
|
-
* Combines ordered configuration layers where a later, more specific layer
|
|
12
|
-
* overrides an earlier one. Runtime callers pass user scope before project
|
|
13
|
-
* scope so a trusted project can intentionally override a global server with
|
|
14
|
-
* the same name.
|
|
15
|
-
*/
|
|
16
|
-
export declare function mergeMcpConfigsWithOverride(...configs: readonly CliMcpConfig[]): CliMcpConfig;
|
|
17
|
-
export declare function validateMcpName(name: string): string;
|
|
18
|
-
export declare function validateMcpConfig(value: unknown): CliMcpConfig;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { CliError } from '../errors/cli-error.js';
|
|
2
|
-
import { CLI_ERROR_CODES } from '../errors/error-codes.js';
|
|
3
|
-
export function mergeMcpConfigs(...configs) {
|
|
4
|
-
const merged = {};
|
|
5
|
-
for (const config of configs) {
|
|
6
|
-
for (const [name, entry] of Object.entries(config)) {
|
|
7
|
-
if (merged[name] !== undefined)
|
|
8
|
-
throw invalid(`MCP server is defined more than once: ${name}.`);
|
|
9
|
-
merged[name] = entry;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return merged;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Combines ordered configuration layers where a later, more specific layer
|
|
16
|
-
* overrides an earlier one. Runtime callers pass user scope before project
|
|
17
|
-
* scope so a trusted project can intentionally override a global server with
|
|
18
|
-
* the same name.
|
|
19
|
-
*/
|
|
20
|
-
export function mergeMcpConfigsWithOverride(...configs) {
|
|
21
|
-
const merged = {};
|
|
22
|
-
for (const config of configs)
|
|
23
|
-
Object.assign(merged, config);
|
|
24
|
-
return merged;
|
|
25
|
-
}
|
|
26
|
-
export function validateMcpName(name) {
|
|
27
|
-
const normalized = name.trim().toLowerCase();
|
|
28
|
-
if (!/^[a-z][a-z0-9_-]{0,63}$/.test(normalized))
|
|
29
|
-
throw invalid('MCP server name must be lowercase and <= 64 characters.');
|
|
30
|
-
return normalized;
|
|
31
|
-
}
|
|
32
|
-
export function validateMcpConfig(value) {
|
|
33
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
34
|
-
throw invalid('MCP config must be an object.');
|
|
35
|
-
const result = {};
|
|
36
|
-
for (const [rawName, rawEntry] of Object.entries(value)) {
|
|
37
|
-
const name = validateMcpName(rawName);
|
|
38
|
-
if (typeof rawEntry !== 'object' || rawEntry === null || Array.isArray(rawEntry))
|
|
39
|
-
throw invalid(`Invalid MCP entry: ${name}.`);
|
|
40
|
-
const entry = rawEntry;
|
|
41
|
-
if (typeof entry['enabled'] !== 'boolean' || typeof entry['config'] !== 'object' || entry['config'] === null)
|
|
42
|
-
throw invalid(`Invalid MCP entry: ${name}.`);
|
|
43
|
-
result[name] = { enabled: entry['enabled'], config: validateServerConfig(entry['config']) };
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
function validateServerConfig(value) {
|
|
48
|
-
const config = value;
|
|
49
|
-
const type = config['type'];
|
|
50
|
-
if (type === 'stdio') {
|
|
51
|
-
if (typeof config['command'] !== 'string' || config['command'].trim().length === 0 || /[\r\n]/.test(config['command']))
|
|
52
|
-
throw invalid('stdio MCP command is invalid.');
|
|
53
|
-
if (config['args'] !== undefined && (!Array.isArray(config['args']) || config['args'].some((arg) => typeof arg !== 'string')))
|
|
54
|
-
throw invalid('stdio MCP args must be strings.');
|
|
55
|
-
return {
|
|
56
|
-
type,
|
|
57
|
-
command: config['command'],
|
|
58
|
-
...(config['args'] === undefined ? {} : { args: config['args'] }),
|
|
59
|
-
...(config['env'] === undefined ? {} : { env: validateStringMap(config['env'], 'stdio env') }),
|
|
60
|
-
...(config['cwd'] === undefined ? {} : { cwd: requireString(config['cwd'], 'stdio cwd') }),
|
|
61
|
-
...(config['maxBufferSize'] === undefined ? {} : { maxBufferSize: validatePositiveInteger(config['maxBufferSize'], 'stdio maxBufferSize') }),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
if (type === 'http' || type === 'sse') {
|
|
65
|
-
if (typeof config['url'] !== 'string')
|
|
66
|
-
throw invalid('HTTP MCP URL is required.');
|
|
67
|
-
try {
|
|
68
|
-
const url = new URL(config['url']);
|
|
69
|
-
if (!['http:', 'https:'].includes(url.protocol))
|
|
70
|
-
throw new Error('protocol');
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
throw invalid('HTTP MCP URL must use HTTP or HTTPS.', error);
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
type,
|
|
77
|
-
url: config['url'],
|
|
78
|
-
...(config['headers'] === undefined ? {} : { headers: validateStringMap(config['headers'], 'HTTP headers') }),
|
|
79
|
-
...(config['auth'] === undefined ? {} : { auth: validatePersistedAuth(config['auth']) }),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
throw invalid('MCP type must be stdio, http or sse.');
|
|
83
|
-
}
|
|
84
|
-
function requireString(value, field) { if (typeof value !== 'string' || value.length === 0)
|
|
85
|
-
throw invalid(`${field} must be a non-empty string.`); return value; }
|
|
86
|
-
function validatePositiveInteger(value, field) {
|
|
87
|
-
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value <= 0)
|
|
88
|
-
throw invalid(`${field} must be a positive integer.`);
|
|
89
|
-
return value;
|
|
90
|
-
}
|
|
91
|
-
function validatePersistedAuth(value) {
|
|
92
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
93
|
-
throw invalid('HTTP auth must be a bearer token configuration.');
|
|
94
|
-
const auth = value;
|
|
95
|
-
if (auth['type'] !== 'bearer' || typeof auth['token'] !== 'string' || auth['token'].length === 0 || /[\r\n]/u.test(auth['token'])) {
|
|
96
|
-
throw invalid('HTTP auth must be a non-empty bearer token configuration.');
|
|
97
|
-
}
|
|
98
|
-
return { type: 'bearer', token: auth['token'] };
|
|
99
|
-
}
|
|
100
|
-
function validateStringMap(value, field) {
|
|
101
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
102
|
-
throw invalid(`${field} must be an object of strings.`);
|
|
103
|
-
const result = {};
|
|
104
|
-
for (const [key, rawValue] of Object.entries(value)) {
|
|
105
|
-
if (key.length === 0 || typeof rawValue !== 'string' || /[\r\n]/u.test(key) || /[\r\n]/u.test(rawValue))
|
|
106
|
-
throw invalid(`${field} must contain valid string key/value pairs.`);
|
|
107
|
-
result[key] = rawValue;
|
|
108
|
-
}
|
|
109
|
-
return result;
|
|
110
|
-
}
|
|
111
|
-
function invalid(message, cause) { return new CliError(CLI_ERROR_CODES.MCP_CONFIG_INVALID, message, { category: 'mcp', userMessage: `Invalid MCP configuration: ${message}`, cause }); }
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface PluginManifest {
|
|
2
|
-
name: string;
|
|
3
|
-
version: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
directory: string;
|
|
6
|
-
skillsDirectory?: string;
|
|
7
|
-
agentsDirectory?: string;
|
|
8
|
-
hooksDirectory?: string;
|
|
9
|
-
mcpConfig?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function parsePluginManifest(value: unknown, directory: string): PluginManifest;
|