@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,106 +0,0 @@
|
|
|
1
|
-
import crypto from 'node:crypto';
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { CliError } from '../../domain/errors/cli-error.js';
|
|
5
|
-
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
6
|
-
import { isAlreadyExists, isFileNotFound } from './fs-errors.js';
|
|
7
|
-
const DEFAULT_LOCK_TIMEOUT_MS = 5_000;
|
|
8
|
-
const DEFAULT_LOCK_STALE_MS = 15 * 60 * 1_000;
|
|
9
|
-
const LOCK_RETRY_MS = 25;
|
|
10
|
-
/** Writes a file through a same-directory temporary file and rename. */
|
|
11
|
-
export async function atomicWriteFile(filePath, data, mode = 0o600) {
|
|
12
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
13
|
-
const temporary = `${filePath}.tmp-${process.pid}-${crypto.randomUUID()}`;
|
|
14
|
-
try {
|
|
15
|
-
await fs.writeFile(temporary, data, { mode });
|
|
16
|
-
await fs.rename(temporary, filePath);
|
|
17
|
-
}
|
|
18
|
-
finally {
|
|
19
|
-
await fs.rm(temporary, { force: true });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/** Creates an advisory lock and removes it again when lock metadata cannot be persisted. */
|
|
23
|
-
export async function acquireAdvisoryFileLock(lockPath) {
|
|
24
|
-
const handle = await fs.open(lockPath, 'wx', 0o600);
|
|
25
|
-
try {
|
|
26
|
-
await handle.writeFile(JSON.stringify({ pid: process.pid, createdAt: new Date().toISOString() }));
|
|
27
|
-
return handle;
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
await releaseAdvisoryFileLock(handle, lockPath);
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/** Closes an advisory lock handle and removes its lock file even when close fails. */
|
|
35
|
-
export async function releaseAdvisoryFileLock(handle, lockPath) {
|
|
36
|
-
try {
|
|
37
|
-
await handle.close();
|
|
38
|
-
}
|
|
39
|
-
finally {
|
|
40
|
-
await fs.rm(lockPath, { force: true });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/** Serializes mutations across CLI processes using an advisory lock file. */
|
|
44
|
-
export async function withFileLock(filePath, operation, options = {}) {
|
|
45
|
-
const lockPath = `${filePath}.lock`;
|
|
46
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS;
|
|
47
|
-
const staleMs = options.staleMs ?? DEFAULT_LOCK_STALE_MS;
|
|
48
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
49
|
-
const deadline = Date.now() + timeoutMs;
|
|
50
|
-
let handle;
|
|
51
|
-
while (handle === undefined) {
|
|
52
|
-
try {
|
|
53
|
-
handle = await acquireAdvisoryFileLock(lockPath);
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
if (!isAlreadyExists(error))
|
|
57
|
-
throw error;
|
|
58
|
-
if (await recoverStaleLock(lockPath, staleMs))
|
|
59
|
-
continue;
|
|
60
|
-
if (Date.now() >= deadline) {
|
|
61
|
-
throw new CliError(CLI_ERROR_CODES.CONFIG_LOCKED, `Configuration file is locked: ${filePath}`, {
|
|
62
|
-
category: 'config', userMessage: 'A configuration update is already in progress. Try again shortly.', retryable: true,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_MS));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
return await operation();
|
|
70
|
-
}
|
|
71
|
-
finally {
|
|
72
|
-
await releaseAdvisoryFileLock(handle, lockPath);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
async function recoverStaleLock(lockPath, staleMs) {
|
|
76
|
-
let stat;
|
|
77
|
-
try {
|
|
78
|
-
stat = await fs.stat(lockPath);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
return isFileNotFound(error);
|
|
82
|
-
}
|
|
83
|
-
if (Date.now() - stat.mtimeMs < staleMs)
|
|
84
|
-
return false;
|
|
85
|
-
let pid;
|
|
86
|
-
try {
|
|
87
|
-
const value = JSON.parse(await fs.readFile(lockPath, 'utf8'));
|
|
88
|
-
pid = typeof value.pid === 'number' ? value.pid : undefined;
|
|
89
|
-
}
|
|
90
|
-
catch { /* An old malformed lock is recoverable. */ }
|
|
91
|
-
if (pid !== undefined && isProcessAlive(pid))
|
|
92
|
-
return false;
|
|
93
|
-
await fs.rm(lockPath, { force: true });
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
function isProcessAlive(pid) {
|
|
97
|
-
if (pid === process.pid)
|
|
98
|
-
return true;
|
|
99
|
-
try {
|
|
100
|
-
process.kill(pid, 0);
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
catch {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
/** Reads at most maxBytes and never loads an entire untrusted file into memory. */
|
|
3
|
-
export async function readFileBounded(filePath, maxBytes) {
|
|
4
|
-
const limit = Math.max(0, Math.floor(maxBytes));
|
|
5
|
-
const handle = await fs.open(filePath, 'r');
|
|
6
|
-
try {
|
|
7
|
-
const chunks = [];
|
|
8
|
-
let total = 0;
|
|
9
|
-
const target = limit + 1;
|
|
10
|
-
while (total < target) {
|
|
11
|
-
const buffer = Buffer.alloc(Math.min(64 * 1024, target - total));
|
|
12
|
-
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
13
|
-
if (bytesRead === 0)
|
|
14
|
-
break;
|
|
15
|
-
chunks.push(buffer.subarray(0, bytesRead));
|
|
16
|
-
total += bytesRead;
|
|
17
|
-
}
|
|
18
|
-
const bytes = Buffer.concat(chunks);
|
|
19
|
-
return { bytes: bytes.subarray(0, limit), truncated: bytes.byteLength > limit };
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
await handle.close();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function readJsonFileBounded(filePath: string, maxBytes: number): Promise<unknown>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { readFileBounded } from './bounded-file-reader.js';
|
|
2
|
-
export async function readJsonFileBounded(filePath, maxBytes) {
|
|
3
|
-
const result = await readFileBounded(filePath, maxBytes);
|
|
4
|
-
if (result.truncated)
|
|
5
|
-
throw new Error(`File exceeds the maximum supported size: ${filePath}`);
|
|
6
|
-
return JSON.parse(result.bytes.toString('utf8'));
|
|
7
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export function isFileNotFound(error) {
|
|
2
|
-
return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';
|
|
3
|
-
}
|
|
4
|
-
export function isAlreadyExists(error) {
|
|
5
|
-
return typeof error === 'object' && error !== null && 'code' in error && error.code === 'EEXIST';
|
|
6
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface GatewayImageEditInput {
|
|
2
|
-
readonly images: readonly Uint8Array[];
|
|
3
|
-
readonly mask: Uint8Array | undefined;
|
|
4
|
-
}
|
|
5
|
-
export interface GatewayAudioInput {
|
|
6
|
-
readonly bytes: Uint8Array;
|
|
7
|
-
readonly filename: string;
|
|
8
|
-
readonly sourceName: string;
|
|
9
|
-
}
|
|
10
|
-
/** Reads local upload inputs sequentially and enforces the gateway's published limits. */
|
|
11
|
-
export declare function readGatewayImageEditInput(imageValue: string, maskValue: string | undefined, cwd: string): Promise<GatewayImageEditInput>;
|
|
12
|
-
export declare function readGatewayAudioInput(source: string, cwd: string): Promise<GatewayAudioInput>;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { GATEWAY_MEDIA_LIMITS, validateImageEditInputCount, validateImageEditTotalSize, validateUploadSize, } from '../../domain/media/gateway-media-contract.js';
|
|
3
|
-
import { CliError } from '../../domain/errors/cli-error.js';
|
|
4
|
-
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
5
|
-
import { normalizeImage } from '../clipboard/image-normalizer.js';
|
|
6
|
-
import { readFileBounded } from './bounded-file-reader.js';
|
|
7
|
-
import { resolveExternalPath } from './path-resolver.js';
|
|
8
|
-
/** Reads local upload inputs sequentially and enforces the gateway's published limits. */
|
|
9
|
-
export async function readGatewayImageEditInput(imageValue, maskValue, cwd) {
|
|
10
|
-
const paths = imageValue.split(',').map((item) => item.trim()).filter(Boolean);
|
|
11
|
-
validateImageEditInputCount(paths);
|
|
12
|
-
const images = [];
|
|
13
|
-
let totalBytes = 0;
|
|
14
|
-
for (const source of paths) {
|
|
15
|
-
const image = await readLocalImage(source, cwd, GATEWAY_MEDIA_LIMITS.imageEditFileBytes, 'Image', ['image/png', 'image/jpeg', 'image/webp']);
|
|
16
|
-
totalBytes += image.byteLength;
|
|
17
|
-
validateImageEditTotalSize(totalBytes);
|
|
18
|
-
images.push(image);
|
|
19
|
-
}
|
|
20
|
-
const mask = maskValue === undefined
|
|
21
|
-
? undefined
|
|
22
|
-
: await readLocalImage(maskValue, cwd, GATEWAY_MEDIA_LIMITS.imageEditMaskBytes, 'Mask', ['image/png']);
|
|
23
|
-
if (mask !== undefined)
|
|
24
|
-
validateImageEditTotalSize(totalBytes + mask.byteLength);
|
|
25
|
-
return { images, mask };
|
|
26
|
-
}
|
|
27
|
-
export async function readGatewayAudioInput(source, cwd) {
|
|
28
|
-
const resolved = await resolveExternalPath(source, { cwd });
|
|
29
|
-
const read = await readFileBounded(resolved, GATEWAY_MEDIA_LIMITS.audioUploadBytes);
|
|
30
|
-
if (read.truncated)
|
|
31
|
-
validateUploadSize(GATEWAY_MEDIA_LIMITS.audioUploadBytes + 1, GATEWAY_MEDIA_LIMITS.audioUploadBytes, 'Audio file');
|
|
32
|
-
validateUploadSize(read.bytes.byteLength, GATEWAY_MEDIA_LIMITS.audioUploadBytes, 'Audio file');
|
|
33
|
-
return { bytes: read.bytes, filename: path.basename(resolved), sourceName: path.parse(path.basename(resolved)).name };
|
|
34
|
-
}
|
|
35
|
-
async function readLocalImage(source, cwd, maximum, label, allowedMimeTypes) {
|
|
36
|
-
const resolved = await resolveExternalPath(source, { cwd });
|
|
37
|
-
const read = await readFileBounded(resolved, maximum);
|
|
38
|
-
if (read.truncated)
|
|
39
|
-
validateUploadSize(maximum + 1, maximum, label);
|
|
40
|
-
const image = normalizeImage(read.bytes, undefined, maximum);
|
|
41
|
-
if (!allowedMimeTypes.includes(image.mimeType)) {
|
|
42
|
-
throw new CliError(CLI_ERROR_CODES.ATTACHMENT_FORMAT_UNSUPPORTED, `${label} format is not accepted by the gateway.`, {
|
|
43
|
-
category: 'media',
|
|
44
|
-
userMessage: `${label} must use one of: ${allowedMimeTypes.join(', ')}.`,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
validateUploadSize(image.bytes.byteLength, maximum, label);
|
|
48
|
-
return image.bytes;
|
|
49
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from '@lotagate/sdk';
|
|
2
|
-
import type { ToolExecutionContext, ToolExecutor, ToolInfo, ToolResult } from '@lotagate/agent-sdk';
|
|
3
|
-
import { type FileChangeDiff } from '../../domain/filesystem/file-change-diff.js';
|
|
4
|
-
import type { ToolActivityObserver } from '../../ports/tool-activity.js';
|
|
5
|
-
/** Exposes the same filesystem capability definitions to runtime and context accounting. */
|
|
6
|
-
export declare function filesystemToolDefinitions(): readonly ToolDefinition[];
|
|
7
|
-
export declare class LocalFilesystemToolExecutor implements ToolExecutor {
|
|
8
|
-
private readonly options;
|
|
9
|
-
constructor(options?: {
|
|
10
|
-
onWrite?: (change: FileChangeDiff) => void | Promise<void>;
|
|
11
|
-
onActivity?: ToolActivityObserver;
|
|
12
|
-
writeScope?: readonly string[];
|
|
13
|
-
});
|
|
14
|
-
listTools(): readonly ToolDefinition[];
|
|
15
|
-
getToolInfo(toolName: string): ToolInfo | undefined;
|
|
16
|
-
execute(toolName: string, input: Record<string, unknown>, context: ToolExecutionContext): Promise<ToolResult>;
|
|
17
|
-
private read;
|
|
18
|
-
private list;
|
|
19
|
-
private write;
|
|
20
|
-
private exists;
|
|
21
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { createFileChangeDiff } from '../../domain/filesystem/file-change-diff.js';
|
|
4
|
-
import { assertWorkspaceWriteTarget, resolveWorkspacePath } from './path-resolver.js';
|
|
5
|
-
import { readFileBounded } from './bounded-file-reader.js';
|
|
6
|
-
import { isFileNotFound } from './fs-errors.js';
|
|
7
|
-
import { atomicWriteFile } from './atomic-file-store.js';
|
|
8
|
-
const FILESYSTEM_TOOLS = [
|
|
9
|
-
functionTool('filesystem.read', 'Read a UTF-8 text file inside the trusted workspace.', {
|
|
10
|
-
path: { type: 'string', description: 'Workspace-relative file path.' },
|
|
11
|
-
}, ['path']),
|
|
12
|
-
functionTool('filesystem.list', 'List entries inside a trusted workspace directory.', {
|
|
13
|
-
path: { type: 'string', description: 'Optional workspace-relative directory path. Defaults to the workspace root.' },
|
|
14
|
-
}, []),
|
|
15
|
-
functionTool('filesystem.write', 'Write UTF-8 text to a file inside the trusted workspace.', {
|
|
16
|
-
path: { type: 'string', description: 'Workspace-relative file path.' },
|
|
17
|
-
content: { type: 'string', description: 'UTF-8 file content.' },
|
|
18
|
-
}, ['path', 'content']),
|
|
19
|
-
functionTool('filesystem.exists', 'Check whether a workspace-relative path exists.', {
|
|
20
|
-
path: { type: 'string', description: 'Workspace-relative path.' },
|
|
21
|
-
}, ['path']),
|
|
22
|
-
];
|
|
23
|
-
const FILE_DIFF_MAX_BYTES = 64 * 1024;
|
|
24
|
-
const FILE_DIFF_MAX_INPUT_LINES = 400;
|
|
25
|
-
const FILE_DIFF_MAX_LINES = 240;
|
|
26
|
-
/** Exposes the same filesystem capability definitions to runtime and context accounting. */
|
|
27
|
-
export function filesystemToolDefinitions() { return FILESYSTEM_TOOLS; }
|
|
28
|
-
export class LocalFilesystemToolExecutor {
|
|
29
|
-
options;
|
|
30
|
-
constructor(options = {}) {
|
|
31
|
-
this.options = options;
|
|
32
|
-
}
|
|
33
|
-
listTools() {
|
|
34
|
-
return filesystemToolDefinitions();
|
|
35
|
-
}
|
|
36
|
-
getToolInfo(toolName) {
|
|
37
|
-
return FILESYSTEM_TOOLS.some((definition) => getToolName(definition) === toolName)
|
|
38
|
-
? { toolName, source: 'filesystem', executorId: 'local-filesystem', metadata: { risk: toolName === 'filesystem.write' ? 'write' : 'read' } }
|
|
39
|
-
: undefined;
|
|
40
|
-
}
|
|
41
|
-
async execute(toolName, input, context) {
|
|
42
|
-
const activity = this.options.onActivity?.start({ key: `${context.runId}:${toolName}`, toolName, source: 'filesystem', label: formatFilesystemActivity(toolName, input['path']) });
|
|
43
|
-
let result;
|
|
44
|
-
try {
|
|
45
|
-
switch (toolName) {
|
|
46
|
-
case 'filesystem.read':
|
|
47
|
-
result = await this.read(input, context);
|
|
48
|
-
break;
|
|
49
|
-
case 'filesystem.list':
|
|
50
|
-
result = await this.list(input, context);
|
|
51
|
-
break;
|
|
52
|
-
case 'filesystem.write':
|
|
53
|
-
result = await this.write(input, context);
|
|
54
|
-
break;
|
|
55
|
-
case 'filesystem.exists':
|
|
56
|
-
result = await this.exists(input, context);
|
|
57
|
-
break;
|
|
58
|
-
default:
|
|
59
|
-
result = errorResult(`Unknown filesystem tool: ${toolName}`);
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
result = errorResult(error instanceof Error ? error.message : String(error));
|
|
65
|
-
}
|
|
66
|
-
activity?.complete(result.isError === true);
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
async read(input, context) {
|
|
70
|
-
const filePath = await resolveWorkspacePath(input['path'], context);
|
|
71
|
-
const result = await readFileBounded(filePath, context.maxResultBytes);
|
|
72
|
-
return okResult(`${result.bytes.toString('utf8')}${result.truncated ? '\n[truncated]' : ''}`);
|
|
73
|
-
}
|
|
74
|
-
async list(input, context) {
|
|
75
|
-
const directory = await resolveWorkspacePath(input['path'] === undefined || (typeof input['path'] === 'string' && input['path'].trim().length === 0) ? '.' : input['path'], context);
|
|
76
|
-
const result = [];
|
|
77
|
-
const maxEntries = Math.max(1, Math.floor(context.maxResultBytes / 64));
|
|
78
|
-
const handle = await fs.opendir(directory);
|
|
79
|
-
try {
|
|
80
|
-
for (let entry = await handle.read(); entry !== null; entry = await handle.read()) {
|
|
81
|
-
result.push({ name: entry.name, kind: entry.isDirectory() ? 'directory' : 'file' });
|
|
82
|
-
if (result.length >= maxEntries)
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
finally {
|
|
87
|
-
await handle.close();
|
|
88
|
-
}
|
|
89
|
-
return okResult(boundText(Buffer.from(JSON.stringify(result)), context.maxResultBytes));
|
|
90
|
-
}
|
|
91
|
-
async write(input, context) {
|
|
92
|
-
if (typeof input['content'] !== 'string')
|
|
93
|
-
return errorResult('filesystem.write requires string content.');
|
|
94
|
-
const filePath = await resolveWorkspacePath(input['path'], context, true);
|
|
95
|
-
if (this.options.writeScope !== undefined && !(await isWithinWriteScope(filePath, context, this.options.writeScope)))
|
|
96
|
-
return errorResult('filesystem.write path is outside the delegated worker write scope.');
|
|
97
|
-
const content = Buffer.from(input['content'], 'utf8');
|
|
98
|
-
if (content.byteLength > context.maxResultBytes)
|
|
99
|
-
return errorResult('filesystem.write content exceeds the configured limit.');
|
|
100
|
-
const previous = await readExistingText(filePath);
|
|
101
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
102
|
-
await assertWorkspaceWriteTarget(filePath, context);
|
|
103
|
-
await atomicWriteFile(filePath, content);
|
|
104
|
-
await assertWorkspaceWriteTarget(filePath, context);
|
|
105
|
-
const change = createFileChangeDiff(String(input['path']), previous.content, input['content'], {
|
|
106
|
-
maxInputLines: FILE_DIFF_MAX_INPUT_LINES,
|
|
107
|
-
maxLines: FILE_DIFF_MAX_LINES,
|
|
108
|
-
truncated: previous.truncated,
|
|
109
|
-
});
|
|
110
|
-
try {
|
|
111
|
-
await this.options.onWrite?.(change);
|
|
112
|
-
}
|
|
113
|
-
catch { /* UI observers must not turn a successful write into a failed tool call. */ }
|
|
114
|
-
return okResult(`Wrote ${content.byteLength} bytes.`);
|
|
115
|
-
}
|
|
116
|
-
async exists(input, context) {
|
|
117
|
-
try {
|
|
118
|
-
await resolveWorkspacePath(input['path'], context);
|
|
119
|
-
return okResult('true');
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
if (isFileNotFound(error))
|
|
123
|
-
return okResult('false');
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async function isWithinWriteScope(filePath, context, scopes) {
|
|
129
|
-
const workspaceRoot = await fs.realpath(path.resolve(context.workspaceRoot ?? context.cwd ?? process.cwd()));
|
|
130
|
-
const relativeFile = path.relative(workspaceRoot, path.resolve(filePath));
|
|
131
|
-
if (relativeFile.startsWith('..') || path.isAbsolute(relativeFile))
|
|
132
|
-
return false;
|
|
133
|
-
return scopes.some((scope) => {
|
|
134
|
-
const normalizedScope = path.normalize(scope).replace(/[\\/]$/u, '');
|
|
135
|
-
if (normalizedScope === '.')
|
|
136
|
-
return true;
|
|
137
|
-
return relativeFile === normalizedScope || relativeFile.startsWith(`${normalizedScope}${path.sep}`);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
async function readExistingText(filePath) {
|
|
141
|
-
try {
|
|
142
|
-
const result = await readFileBounded(filePath, FILE_DIFF_MAX_BYTES);
|
|
143
|
-
return { content: result.bytes.toString('utf8'), truncated: result.truncated };
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
if (isFileNotFound(error))
|
|
147
|
-
return { content: '', truncated: false };
|
|
148
|
-
return { content: '', truncated: true };
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function functionTool(name, description, properties, required) {
|
|
152
|
-
return { type: 'function', function: { name, description, parameters: { type: 'object', properties, required, additionalProperties: false } } };
|
|
153
|
-
}
|
|
154
|
-
function getToolName(definition) {
|
|
155
|
-
return 'function' in definition ? definition.function.name : undefined;
|
|
156
|
-
}
|
|
157
|
-
function okResult(content) { return { content, isError: false }; }
|
|
158
|
-
function errorResult(content) { return { content, isError: true }; }
|
|
159
|
-
function boundText(content, maxBytes) {
|
|
160
|
-
return content.byteLength <= maxBytes ? content.toString('utf8') : `${content.subarray(0, maxBytes).toString('utf8')}\n[truncated]`;
|
|
161
|
-
}
|
|
162
|
-
function formatFilesystemActivity(toolName, value) {
|
|
163
|
-
const pathValue = typeof value === 'string' && value.trim().length > 0 ? value.trim() : '.';
|
|
164
|
-
const displayPath = pathValue === '.' ? 'workspace' : pathValue;
|
|
165
|
-
const action = toolName === 'filesystem.read'
|
|
166
|
-
? 'Read'
|
|
167
|
-
: toolName === 'filesystem.list'
|
|
168
|
-
? 'List'
|
|
169
|
-
: toolName === 'filesystem.exists'
|
|
170
|
-
? 'Check'
|
|
171
|
-
: toolName === 'filesystem.write'
|
|
172
|
-
? 'Write'
|
|
173
|
-
: toolName;
|
|
174
|
-
const label = `${action} ${displayPath}${toolName === 'filesystem.list' && displayPath !== 'workspace' && !displayPath.endsWith('/') ? '/' : ''}`;
|
|
175
|
-
return label.length <= 180 ? label : `${label.slice(0, 177)}...`;
|
|
176
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare function resolveWorkspacePath(input: unknown, context: {
|
|
2
|
-
cwd?: string;
|
|
3
|
-
workspaceRoot?: string;
|
|
4
|
-
}, allowMissing?: boolean): Promise<string>;
|
|
5
|
-
/** Resolves an explicitly supplied local path without applying workspace containment. */
|
|
6
|
-
export declare function resolveExternalPath(input: unknown, context: {
|
|
7
|
-
cwd?: string;
|
|
8
|
-
}, allowMissing?: boolean): Promise<string>;
|
|
9
|
-
/** Resolves an output path while refusing a final symlink target. */
|
|
10
|
-
export declare function resolveExternalOutputPath(input: unknown, context: {
|
|
11
|
-
cwd?: string;
|
|
12
|
-
}): Promise<string>;
|
|
13
|
-
/** Revalidates a write target immediately at the filesystem mutation boundary. */
|
|
14
|
-
export declare function assertWorkspaceWriteTarget(filePath: string, context: {
|
|
15
|
-
cwd?: string;
|
|
16
|
-
workspaceRoot?: string;
|
|
17
|
-
}): Promise<void>;
|
|
18
|
-
/** Revalidates an explicitly selected external output without following the final path component. */
|
|
19
|
-
export declare function assertExternalWriteTarget(filePath: string): Promise<void>;
|
|
20
|
-
export declare function assertInside(root: string, candidate: string): void;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { CliError } from '../../domain/errors/cli-error.js';
|
|
4
|
-
import { CLI_ERROR_CODES } from '../../domain/errors/error-codes.js';
|
|
5
|
-
import { isFileNotFound } from './fs-errors.js';
|
|
6
|
-
export async function resolveWorkspacePath(input, context, allowMissing = false) {
|
|
7
|
-
if (typeof input !== 'string' || input.trim().length === 0) {
|
|
8
|
-
throw new CliError(CLI_ERROR_CODES.TOOL_ARGUMENT_INVALID, 'A relative workspace path is required.', {
|
|
9
|
-
category: 'tool', userMessage: 'The filesystem tool requires a non-empty path.',
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
const root = await fs.realpath(path.resolve(context.workspaceRoot ?? context.cwd ?? process.cwd()));
|
|
13
|
-
const base = await fs.realpath(path.resolve(context.cwd ?? root));
|
|
14
|
-
assertInside(root, base);
|
|
15
|
-
const candidate = path.resolve(base, input);
|
|
16
|
-
try {
|
|
17
|
-
const canonical = await fs.realpath(candidate);
|
|
18
|
-
assertInside(root, canonical);
|
|
19
|
-
return canonical;
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
if (!allowMissing || !isFileNotFound(error))
|
|
23
|
-
throw error;
|
|
24
|
-
return resolveMissingWorkspacePath(candidate, root);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/** Resolves an explicitly supplied local path without applying workspace containment. */
|
|
28
|
-
export async function resolveExternalPath(input, context, allowMissing = false) {
|
|
29
|
-
const candidate = resolveLocalCandidate(input, context.cwd);
|
|
30
|
-
try {
|
|
31
|
-
return await fs.realpath(candidate);
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
if (!allowMissing || !isFileNotFound(error))
|
|
35
|
-
throw error;
|
|
36
|
-
return resolveMissingPath(candidate);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/** Resolves an output path while refusing a final symlink target. */
|
|
40
|
-
export async function resolveExternalOutputPath(input, context) {
|
|
41
|
-
const candidate = resolveLocalCandidate(input, context.cwd);
|
|
42
|
-
const parent = await resolveExternalPath(path.dirname(candidate), context, true);
|
|
43
|
-
const target = path.join(parent, path.basename(candidate));
|
|
44
|
-
await assertNotSymbolicLink(target);
|
|
45
|
-
return target;
|
|
46
|
-
}
|
|
47
|
-
async function resolveMissingWorkspacePath(candidate, root) {
|
|
48
|
-
return resolveMissingPath(candidate, root);
|
|
49
|
-
}
|
|
50
|
-
async function resolveMissingPath(candidate, root) {
|
|
51
|
-
const missingSegments = [];
|
|
52
|
-
let current = candidate;
|
|
53
|
-
while (true) {
|
|
54
|
-
try {
|
|
55
|
-
const canonical = await fs.realpath(current);
|
|
56
|
-
if (root !== undefined)
|
|
57
|
-
assertInside(root, canonical);
|
|
58
|
-
return path.join(canonical, ...missingSegments);
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
if (!isFileNotFound(error))
|
|
62
|
-
throw error;
|
|
63
|
-
const parent = path.dirname(current);
|
|
64
|
-
if (parent === current)
|
|
65
|
-
throw error;
|
|
66
|
-
missingSegments.unshift(path.basename(current));
|
|
67
|
-
current = parent;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function resolveLocalCandidate(input, cwd = process.cwd()) {
|
|
72
|
-
if (typeof input !== 'string' || input.trim().length === 0) {
|
|
73
|
-
throw new CliError(CLI_ERROR_CODES.INVALID_ARGUMENT, 'A non-empty local path is required.', {
|
|
74
|
-
category: 'path', userMessage: 'A non-empty local path is required.',
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return path.resolve(cwd, input);
|
|
78
|
-
}
|
|
79
|
-
async function assertNotSymbolicLink(filePath) {
|
|
80
|
-
try {
|
|
81
|
-
const target = await fs.lstat(filePath);
|
|
82
|
-
if (target.isSymbolicLink()) {
|
|
83
|
-
throw new CliError(CLI_ERROR_CODES.INVALID_ARGUMENT, 'Output paths cannot be symbolic links.', {
|
|
84
|
-
category: 'path', userMessage: 'The output path cannot be a symbolic link.',
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
if (!isFileNotFound(error))
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/** Revalidates a write target immediately at the filesystem mutation boundary. */
|
|
94
|
-
export async function assertWorkspaceWriteTarget(filePath, context) {
|
|
95
|
-
const root = await fs.realpath(path.resolve(context.workspaceRoot ?? context.cwd ?? process.cwd()));
|
|
96
|
-
const parent = await fs.realpath(path.dirname(filePath));
|
|
97
|
-
assertInside(root, parent);
|
|
98
|
-
try {
|
|
99
|
-
const target = await fs.realpath(filePath);
|
|
100
|
-
assertInside(root, target);
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
if (!isFileNotFound(error))
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/** Revalidates an explicitly selected external output without following the final path component. */
|
|
108
|
-
export async function assertExternalWriteTarget(filePath) {
|
|
109
|
-
await fs.realpath(path.dirname(filePath));
|
|
110
|
-
await assertNotSymbolicLink(filePath);
|
|
111
|
-
}
|
|
112
|
-
export function assertInside(root, candidate) {
|
|
113
|
-
const relative = path.relative(root, candidate);
|
|
114
|
-
if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
|
115
|
-
throw new CliError(CLI_ERROR_CODES.PROJECT_SYMLINK_ESCAPE, 'Path escapes the trusted workspace.', {
|
|
116
|
-
category: 'project', userMessage: 'Tool access was denied because the path is outside the trusted workspace.',
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { MediaArtifactRequest, StoredMediaArtifact } from '../../domain/media/media-contract.js';
|
|
2
|
-
import type { Logger } from '../../ports/logger.js';
|
|
3
|
-
/** Persists generated media below the workspace by default or in an explicitly supplied local directory. */
|
|
4
|
-
export declare class WorkspaceMediaArtifactStore {
|
|
5
|
-
private readonly cwd;
|
|
6
|
-
private readonly logger?;
|
|
7
|
-
constructor(cwd: string, logger?: Logger | undefined);
|
|
8
|
-
writeMany(request: MediaArtifactRequest, artifacts: readonly Uint8Array[]): Promise<readonly StoredMediaArtifact[]>;
|
|
9
|
-
private resolveDirectory;
|
|
10
|
-
private resolveTarget;
|
|
11
|
-
private resolveOutputPath;
|
|
12
|
-
private context;
|
|
13
|
-
}
|