@lotagate/cli 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application/agent/agent-history.d.ts +3 -0
- package/dist/application/agent/agent-history.js +81 -0
- package/dist/application/agent/agent-input-context.d.ts +9 -0
- package/dist/application/agent/agent-input-context.js +12 -0
- package/dist/application/agent/agent-limit.d.ts +3 -0
- package/dist/application/agent/agent-limit.js +12 -0
- package/dist/application/agent/agent-run-tracker.d.ts +30 -0
- package/dist/application/agent/agent-run-tracker.js +68 -0
- package/dist/application/agent/agent-session-store.d.ts +19 -0
- package/dist/application/agent/agent-session-store.js +74 -0
- package/dist/application/agent/capability-profile.d.ts +37 -0
- package/dist/application/agent/capability-profile.js +13 -0
- package/dist/application/agent/cli-agent-execution-service.d.ts +81 -0
- package/dist/application/agent/cli-agent-execution-service.js +279 -0
- package/dist/application/agent/context-compaction-persistence.d.ts +8 -0
- package/dist/application/agent/context-compaction-persistence.js +27 -0
- package/dist/application/agent/context-compaction.d.ts +20 -0
- package/dist/application/agent/context-compaction.js +114 -0
- package/dist/application/agent/prompt-data-safety.d.ts +14 -0
- package/dist/application/agent/prompt-data-safety.js +38 -0
- package/dist/application/agent/safe-system-prompt.d.ts +3 -0
- package/dist/application/agent/safe-system-prompt.js +19 -0
- package/dist/application/agent/scoped-tool-executor.d.ts +13 -0
- package/dist/application/agent/scoped-tool-executor.js +32 -0
- package/dist/application/agent/system-prompt-builder.d.ts +14 -0
- package/dist/application/agent/system-prompt-builder.js +199 -0
- package/dist/application/agent/tool-catalog.d.ts +14 -0
- package/dist/application/agent/tool-catalog.js +30 -0
- package/dist/application/agent/tool-display.d.ts +6 -0
- package/dist/application/agent/tool-display.js +59 -0
- package/dist/application/agent/tool-hook-lifecycle.d.ts +19 -0
- package/dist/application/agent/tool-hook-lifecycle.js +85 -0
- package/dist/application/auth/authentication-service.d.ts +20 -0
- package/dist/application/auth/authentication-service.js +44 -0
- package/dist/application/chat/chat-service.d.ts +12 -0
- package/dist/application/chat/chat-service.js +19 -0
- package/dist/application/chat/pending-attachment-store.d.ts +12 -0
- package/dist/application/chat/pending-attachment-store.js +28 -0
- package/dist/application/commands/application-command-executor.d.ts +20 -0
- package/dist/application/commands/application-command-executor.js +66 -0
- package/dist/application/commands/cli-args.d.ts +6 -0
- package/dist/application/commands/cli-args.js +43 -0
- package/dist/application/commands/cli-command-services.d.ts +16 -0
- package/dist/application/commands/cli-command-services.js +405 -0
- package/dist/application/commands/command-catalog.d.ts +6 -0
- package/dist/application/commands/command-catalog.js +159 -0
- package/dist/application/commands/command-contract.d.ts +58 -0
- package/dist/application/commands/command-contract.js +1 -0
- package/dist/application/commands/command-hints.d.ts +9 -0
- package/dist/application/commands/command-hints.js +17 -0
- package/dist/application/commands/command-output.d.ts +4 -0
- package/dist/application/commands/command-output.js +1 -0
- package/dist/application/commands/command-parser.d.ts +10 -0
- package/dist/application/commands/command-parser.js +155 -0
- package/dist/application/commands/command-presentation.d.ts +7 -0
- package/dist/application/commands/command-presentation.js +131 -0
- package/dist/application/commands/command-registry.d.ts +11 -0
- package/dist/application/commands/command-registry.js +64 -0
- package/dist/application/commands/command-runtime.d.ts +2 -0
- package/dist/application/commands/command-runtime.js +3 -0
- package/dist/application/commands/goal-command-handlers.d.ts +3 -0
- package/dist/application/commands/goal-command-handlers.js +120 -0
- package/dist/application/commands/media-command-handlers.d.ts +9 -0
- package/dist/application/commands/media-command-handlers.js +307 -0
- package/dist/application/commands/media-command-output.d.ts +11 -0
- package/dist/application/commands/media-command-output.js +8 -0
- package/dist/application/commands/runtime-command-handlers.d.ts +7 -0
- package/dist/application/commands/runtime-command-handlers.js +177 -0
- package/dist/application/commands/stream-output.d.ts +4 -0
- package/dist/application/commands/stream-output.js +10 -0
- package/dist/application/commands/utility-commands.d.ts +6 -0
- package/dist/application/commands/utility-commands.js +81 -0
- package/dist/application/config/execution-config.d.ts +4 -0
- package/dist/application/config/execution-config.js +6 -0
- package/dist/application/extensions/extension-list-contract.d.ts +13 -0
- package/dist/application/extensions/extension-list-contract.js +1 -0
- package/dist/application/extensions/extension-list-formatters.d.ts +31 -0
- package/dist/application/extensions/extension-list-formatters.js +98 -0
- package/dist/application/extensions/extension-list-output.d.ts +3 -0
- package/dist/application/extensions/extension-list-output.js +7 -0
- package/dist/application/extensions/plugin-contribution-registry.d.ts +15 -0
- package/dist/application/extensions/plugin-contribution-registry.js +80 -0
- package/dist/application/extensions/skill-scope-store.d.ts +23 -0
- package/dist/application/extensions/skill-scope-store.js +33 -0
- package/dist/application/formatting/compact-number.d.ts +2 -0
- package/dist/application/formatting/compact-number.js +18 -0
- package/dist/application/formatting/compact-table.d.ts +22 -0
- package/dist/application/formatting/compact-table.js +49 -0
- package/dist/application/media/video-operation-poller.d.ts +5 -0
- package/dist/application/media/video-operation-poller.js +42 -0
- package/dist/application/model/cached-model-catalog.d.ts +13 -0
- package/dist/application/model/cached-model-catalog.js +31 -0
- package/dist/application/model/initial-model-selection.d.ts +10 -0
- package/dist/application/model/initial-model-selection.js +11 -0
- package/dist/application/model/model-catalog-service.d.ts +6 -0
- package/dist/application/model/model-catalog-service.js +13 -0
- package/dist/application/model/model-context-window.d.ts +3 -0
- package/dist/application/model/model-context-window.js +23 -0
- package/dist/application/orchestration/cli-subagent-service.d.ts +70 -0
- package/dist/application/orchestration/cli-subagent-service.js +328 -0
- package/dist/application/orchestration/cli-turn-event-projector.d.ts +12 -0
- package/dist/application/orchestration/cli-turn-event-projector.js +81 -0
- package/dist/application/orchestration/cli-turn-events.d.ts +76 -0
- package/dist/application/orchestration/cli-turn-events.js +39 -0
- package/dist/application/orchestration/cli-turn-persistence.d.ts +6 -0
- package/dist/application/orchestration/cli-turn-persistence.js +14 -0
- package/dist/application/orchestration/goal-evaluator.d.ts +18 -0
- package/dist/application/orchestration/goal-evaluator.js +88 -0
- package/dist/application/orchestration/goal-input.d.ts +3 -0
- package/dist/application/orchestration/goal-input.js +19 -0
- package/dist/application/orchestration/goal-output.d.ts +2 -0
- package/dist/application/orchestration/goal-output.js +11 -0
- package/dist/application/orchestration/goal-runner.d.ts +22 -0
- package/dist/application/orchestration/goal-runner.js +153 -0
- package/dist/application/orchestration/goal-usage.d.ts +9 -0
- package/dist/application/orchestration/goal-usage.js +19 -0
- package/dist/application/orchestration/headless-agent-turn.d.ts +32 -0
- package/dist/application/orchestration/headless-agent-turn.js +82 -0
- package/dist/application/orchestration/plan-generator.d.ts +7 -0
- package/dist/application/orchestration/plan-generator.js +34 -0
- package/dist/application/orchestration/subagent-coordinator.d.ts +33 -0
- package/dist/application/orchestration/subagent-coordinator.js +28 -0
- package/dist/application/orchestration/subagent-handoff.d.ts +2 -0
- package/dist/application/orchestration/subagent-handoff.js +68 -0
- package/dist/application/orchestration/subagent-tool-executor.d.ts +12 -0
- package/dist/application/orchestration/subagent-tool-executor.js +93 -0
- package/dist/application/orchestration/task-assessment.d.ts +4 -0
- package/dist/application/orchestration/task-assessment.js +35 -0
- package/dist/application/orchestration/task-graph.d.ts +13 -0
- package/dist/application/orchestration/task-graph.js +56 -0
- package/dist/application/orchestration/task-scheduler.d.ts +18 -0
- package/dist/application/orchestration/task-scheduler.js +88 -0
- package/dist/application/project/project-trust-service.d.ts +13 -0
- package/dist/application/project/project-trust-service.js +74 -0
- package/dist/application/protocol/browser-host-tool-executor.d.ts +41 -0
- package/dist/application/protocol/browser-host-tool-executor.js +88 -0
- package/dist/application/protocol/desktop-agent-command.d.ts +9 -0
- package/dist/application/protocol/desktop-agent-command.js +663 -0
- package/dist/application/protocol/desktop-attachment-store.d.ts +16 -0
- package/dist/application/protocol/desktop-attachment-store.js +82 -0
- package/dist/application/protocol/desktop-command-catalog.d.ts +2 -0
- package/dist/application/protocol/desktop-command-catalog.js +19 -0
- package/dist/application/protocol/desktop-command-contract.d.ts +22 -0
- package/dist/application/protocol/desktop-command-contract.js +3 -0
- package/dist/application/protocol/desktop-command-executor.d.ts +16 -0
- package/dist/application/protocol/desktop-command-executor.js +47 -0
- package/dist/application/protocol/desktop-command-output.d.ts +15 -0
- package/dist/application/protocol/desktop-command-output.js +24 -0
- package/dist/application/protocol/desktop-execution-policy.d.ts +17 -0
- package/dist/application/protocol/desktop-execution-policy.js +49 -0
- package/dist/application/protocol/desktop-host-tool-executor.d.ts +57 -0
- package/dist/application/protocol/desktop-host-tool-executor.js +53 -0
- package/dist/application/protocol/desktop-orchestration-events.d.ts +5 -0
- package/dist/application/protocol/desktop-orchestration-events.js +37 -0
- package/dist/application/protocol/json-line-writer.d.ts +9 -0
- package/dist/application/protocol/json-line-writer.js +19 -0
- package/dist/application/protocol/jsonl-agent-command.d.ts +3 -0
- package/dist/application/protocol/jsonl-agent-command.js +97 -0
- package/dist/application/protocol/jsonl-protocol.d.ts +52 -0
- package/dist/application/protocol/jsonl-protocol.js +170 -0
- package/dist/application/security/desktop-tool-scope-policy.d.ts +3 -0
- package/dist/application/security/desktop-tool-scope-policy.js +52 -0
- package/dist/application/security/tool-action-risk-analyzer.d.ts +13 -0
- package/dist/application/security/tool-action-risk-analyzer.js +64 -0
- package/dist/application/security/tool-approval-service.d.ts +35 -0
- package/dist/application/security/tool-approval-service.js +97 -0
- package/dist/application/security/tool-risk-classifier.d.ts +11 -0
- package/dist/application/security/tool-risk-classifier.js +65 -0
- package/dist/application/security/workspace-permission-policy.d.ts +10 -0
- package/dist/application/security/workspace-permission-policy.js +50 -0
- package/dist/application/session/project-session-access.d.ts +8 -0
- package/dist/application/session/project-session-access.js +19 -0
- package/dist/application/session/session-compaction-service.d.ts +10 -0
- package/dist/application/session/session-compaction-service.js +43 -0
- package/dist/application/session/session-turn-lifecycle.d.ts +5 -0
- package/dist/application/session/session-turn-lifecycle.js +31 -0
- package/dist/application/workspace/workspace-file-index.d.ts +15 -0
- package/dist/application/workspace/workspace-file-index.js +60 -0
- package/dist/application/workspace/workspace-file-reference-resolver.d.ts +14 -0
- package/dist/application/workspace/workspace-file-reference-resolver.js +123 -0
- package/dist/application/workspace/workspace-instruction-loader.d.ts +8 -0
- package/dist/application/workspace/workspace-instruction-loader.js +55 -0
- package/dist/bootstrap/composition-root.d.ts +6 -0
- package/dist/bootstrap/composition-root.js +4 -0
- package/dist/bootstrap/global-cli-options.d.ts +6 -0
- package/dist/bootstrap/global-cli-options.js +29 -0
- package/dist/bootstrap/native-devtools-stub.d.ts +10 -0
- package/dist/bootstrap/native-devtools-stub.js +10 -0
- package/dist/bootstrap/native-entry.d.ts +1 -0
- package/dist/bootstrap/native-entry.js +6 -0
- package/dist/bootstrap/native-tiktoken.d.ts +4 -0
- package/dist/bootstrap/native-tiktoken.js +5 -0
- package/dist/bootstrap/runtime-factory.d.ts +35 -0
- package/dist/bootstrap/runtime-factory.js +44 -0
- package/dist/bootstrap/shutdown-manager.d.ts +10 -0
- package/dist/bootstrap/shutdown-manager.js +14 -0
- package/dist/bootstrap/startup-sequence.d.ts +5 -0
- package/dist/bootstrap/startup-sequence.js +10 -0
- package/dist/domain/auth/auth-profile.d.ts +14 -0
- package/dist/domain/auth/auth-profile.js +39 -0
- package/dist/domain/config/config-schema.d.ts +17 -0
- package/dist/domain/config/config-schema.js +105 -0
- package/dist/domain/errors/cli-command-hint.d.ts +5 -0
- package/dist/domain/errors/cli-command-hint.js +1 -0
- package/dist/domain/errors/cli-error.d.ts +35 -0
- package/dist/domain/errors/cli-error.js +129 -0
- package/dist/domain/errors/error-codes.d.ts +46 -0
- package/dist/domain/errors/error-codes.js +45 -0
- package/dist/domain/extensions/extension-scope.d.ts +3 -0
- package/dist/domain/extensions/extension-scope.js +23 -0
- package/dist/domain/extensions/extension-state.d.ts +5 -0
- package/dist/domain/extensions/extension-state.js +11 -0
- package/dist/domain/extensions/hook-manifest.d.ts +10 -0
- package/dist/domain/extensions/hook-manifest.js +23 -0
- package/dist/domain/extensions/mcp-config.d.ts +18 -0
- package/dist/domain/extensions/mcp-config.js +111 -0
- package/dist/domain/extensions/plugin-manifest.d.ts +11 -0
- package/dist/domain/extensions/plugin-manifest.js +43 -0
- package/dist/domain/extensions/skill-manifest.d.ts +10 -0
- package/dist/domain/extensions/skill-manifest.js +51 -0
- package/dist/domain/filesystem/file-change-diff.d.ts +21 -0
- package/dist/domain/filesystem/file-change-diff.js +60 -0
- package/dist/domain/media/gateway-media-contract.d.ts +23 -0
- package/dist/domain/media/gateway-media-contract.js +163 -0
- package/dist/domain/media/media-contract.d.ts +28 -0
- package/dist/domain/media/media-contract.js +1 -0
- package/dist/domain/media/media-execution-policy.d.ts +9 -0
- package/dist/domain/media/media-execution-policy.js +31 -0
- package/dist/domain/orchestration/goal.d.ts +58 -0
- package/dist/domain/orchestration/goal.js +113 -0
- package/dist/domain/orchestration/subagent-identity.d.ts +2 -0
- package/dist/domain/orchestration/subagent-identity.js +8 -0
- package/dist/domain/orchestration/subagent.d.ts +33 -0
- package/dist/domain/orchestration/subagent.js +1 -0
- package/dist/domain/orchestration/task.d.ts +31 -0
- package/dist/domain/orchestration/task.js +1 -0
- package/dist/domain/project/project-identity.d.ts +6 -0
- package/dist/domain/project/project-identity.js +4 -0
- package/dist/domain/runtime/assistant-delta-normalizer.d.ts +11 -0
- package/dist/domain/runtime/assistant-delta-normalizer.js +19 -0
- package/dist/domain/runtime/resource-limits.d.ts +60 -0
- package/dist/domain/runtime/resource-limits.js +60 -0
- package/dist/domain/session/attachment.d.ts +13 -0
- package/dist/domain/session/attachment.js +1 -0
- package/dist/domain/session/session-schema.d.ts +6 -0
- package/dist/domain/session/session-schema.js +28 -0
- package/dist/domain/session/session.d.ts +27 -0
- package/dist/domain/session/session.js +1 -0
- package/dist/domain/settings/settings-document.d.ts +8 -0
- package/dist/domain/settings/settings-document.js +36 -0
- package/dist/domain/validation/record-schema.d.ts +4 -0
- package/dist/domain/validation/record-schema.js +9 -0
- package/dist/domain/workspace/workspace-settings.d.ts +12 -0
- package/dist/domain/workspace/workspace-settings.js +44 -0
- package/dist/infrastructure/agent-sdk/agent-instance-factory.d.ts +22 -0
- package/dist/infrastructure/agent-sdk/agent-instance-factory.js +31 -0
- package/dist/infrastructure/agent-sdk/tool-calling-model-client.d.ts +11 -0
- package/dist/infrastructure/agent-sdk/tool-calling-model-client.js +447 -0
- package/dist/infrastructure/cache/cache-policy.d.ts +7 -0
- package/dist/infrastructure/cache/cache-policy.js +18 -0
- package/dist/infrastructure/cache/file-cache-store.d.ts +17 -0
- package/dist/infrastructure/cache/file-cache-store.js +121 -0
- package/dist/infrastructure/clipboard/clipboard-adapter-factory.d.ts +11 -0
- package/dist/infrastructure/clipboard/clipboard-adapter-factory.js +98 -0
- package/dist/infrastructure/clipboard/clipboard-policy.d.ts +8 -0
- package/dist/infrastructure/clipboard/clipboard-policy.js +19 -0
- package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.d.ts +10 -0
- package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.js +94 -0
- package/dist/infrastructure/clipboard/image-normalizer.d.ts +12 -0
- package/dist/infrastructure/clipboard/image-normalizer.js +78 -0
- package/dist/infrastructure/clipboard/windows-clipboard-adapter.d.ts +7 -0
- package/dist/infrastructure/clipboard/windows-clipboard-adapter.js +66 -0
- package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.d.ts +7 -0
- package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.js +70 -0
- package/dist/infrastructure/config/config-loader.d.ts +19 -0
- package/dist/infrastructure/config/config-loader.js +76 -0
- package/dist/infrastructure/config/environment-values.d.ts +2 -0
- package/dist/infrastructure/config/environment-values.js +7 -0
- package/dist/infrastructure/credentials/composite-credential-store.d.ts +11 -0
- package/dist/infrastructure/credentials/composite-credential-store.js +32 -0
- package/dist/infrastructure/credentials/encrypted-file-credential-store.d.ts +17 -0
- package/dist/infrastructure/credentials/encrypted-file-credential-store.js +181 -0
- package/dist/infrastructure/credentials/environment-credential-store.d.ts +11 -0
- package/dist/infrastructure/credentials/environment-credential-store.js +37 -0
- package/dist/infrastructure/credentials/secret-input.d.ts +7 -0
- package/dist/infrastructure/credentials/secret-input.js +44 -0
- package/dist/infrastructure/extensions/composite-mcp-config-store.d.ts +9 -0
- package/dist/infrastructure/extensions/composite-mcp-config-store.js +10 -0
- package/dist/infrastructure/extensions/extension-directory-reader.d.ts +2 -0
- package/dist/infrastructure/extensions/extension-directory-reader.js +15 -0
- package/dist/infrastructure/extensions/extension-source-resolver.d.ts +6 -0
- package/dist/infrastructure/extensions/extension-source-resolver.js +126 -0
- package/dist/infrastructure/extensions/file-mcp-config-store.d.ts +15 -0
- package/dist/infrastructure/extensions/file-mcp-config-store.js +66 -0
- package/dist/infrastructure/extensions/hook-runtime.d.ts +18 -0
- package/dist/infrastructure/extensions/hook-runtime.js +66 -0
- package/dist/infrastructure/extensions/mcp-runtime.d.ts +12 -0
- package/dist/infrastructure/extensions/mcp-runtime.js +52 -0
- package/dist/infrastructure/extensions/plugin-discovery.d.ts +5 -0
- package/dist/infrastructure/extensions/plugin-discovery.js +52 -0
- package/dist/infrastructure/extensions/plugin-manager.d.ts +26 -0
- package/dist/infrastructure/extensions/plugin-manager.js +139 -0
- package/dist/infrastructure/extensions/skill-discovery.d.ts +4 -0
- package/dist/infrastructure/extensions/skill-discovery.js +29 -0
- package/dist/infrastructure/extensions/skill-installer.d.ts +8 -0
- package/dist/infrastructure/extensions/skill-installer.js +88 -0
- package/dist/infrastructure/extensions/skill-manager.d.ts +22 -0
- package/dist/infrastructure/extensions/skill-manager.js +67 -0
- package/dist/infrastructure/extensions/skill-roots.d.ts +19 -0
- package/dist/infrastructure/extensions/skill-roots.js +25 -0
- package/dist/infrastructure/extensions/skill-tool-executor.d.ts +18 -0
- package/dist/infrastructure/extensions/skill-tool-executor.js +53 -0
- package/dist/infrastructure/filesystem/atomic-file-store.d.ts +12 -0
- package/dist/infrastructure/filesystem/atomic-file-store.js +106 -0
- package/dist/infrastructure/filesystem/bounded-file-reader.d.ts +6 -0
- package/dist/infrastructure/filesystem/bounded-file-reader.js +24 -0
- package/dist/infrastructure/filesystem/bounded-json-reader.d.ts +1 -0
- package/dist/infrastructure/filesystem/bounded-json-reader.js +7 -0
- package/dist/infrastructure/filesystem/fs-errors.d.ts +2 -0
- package/dist/infrastructure/filesystem/fs-errors.js +6 -0
- package/dist/infrastructure/filesystem/gateway-media-input-reader.d.ts +12 -0
- package/dist/infrastructure/filesystem/gateway-media-input-reader.js +49 -0
- package/dist/infrastructure/filesystem/local-filesystem-tool-executor.d.ts +21 -0
- package/dist/infrastructure/filesystem/local-filesystem-tool-executor.js +176 -0
- package/dist/infrastructure/filesystem/path-resolver.d.ts +20 -0
- package/dist/infrastructure/filesystem/path-resolver.js +119 -0
- package/dist/infrastructure/filesystem/workspace-media-artifact-store.d.ts +13 -0
- package/dist/infrastructure/filesystem/workspace-media-artifact-store.js +152 -0
- package/dist/infrastructure/logging/daily-rotating-file-writer.d.ts +20 -0
- package/dist/infrastructure/logging/daily-rotating-file-writer.js +75 -0
- package/dist/infrastructure/logging/log-redactor.d.ts +2 -0
- package/dist/infrastructure/logging/log-redactor.js +26 -0
- package/dist/infrastructure/logging/logging-policy.d.ts +6 -0
- package/dist/infrastructure/logging/logging-policy.js +6 -0
- package/dist/infrastructure/logging/structured-logger.d.ts +24 -0
- package/dist/infrastructure/logging/structured-logger.js +40 -0
- package/dist/infrastructure/network/safe-media-downloader.d.ts +23 -0
- package/dist/infrastructure/network/safe-media-downloader.js +239 -0
- package/dist/infrastructure/platform/host-platform.d.ts +14 -0
- package/dist/infrastructure/platform/host-platform.js +23 -0
- package/dist/infrastructure/platform/host-process.d.ts +17 -0
- package/dist/infrastructure/platform/host-process.js +116 -0
- package/dist/infrastructure/platform/platform-paths.d.ts +25 -0
- package/dist/infrastructure/platform/platform-paths.js +33 -0
- package/dist/infrastructure/project/file-project-trust-store.d.ts +12 -0
- package/dist/infrastructure/project/file-project-trust-store.js +59 -0
- package/dist/infrastructure/sdk/chat-completion-adapter.d.ts +8 -0
- package/dist/infrastructure/sdk/chat-completion-adapter.js +115 -0
- package/dist/infrastructure/sdk/lotagate-client-factory.d.ts +3 -0
- package/dist/infrastructure/sdk/lotagate-client-factory.js +8 -0
- package/dist/infrastructure/sdk/model-catalog-adapter.d.ts +19 -0
- package/dist/infrastructure/sdk/model-catalog-adapter.js +28 -0
- package/dist/infrastructure/sdk/sdk-media-gateway-client.d.ts +20 -0
- package/dist/infrastructure/sdk/sdk-media-gateway-client.js +97 -0
- package/dist/infrastructure/sessions/file-goal-store.d.ts +21 -0
- package/dist/infrastructure/sessions/file-goal-store.js +160 -0
- package/dist/infrastructure/sessions/file-session-store.d.ts +48 -0
- package/dist/infrastructure/sessions/file-session-store.js +525 -0
- package/dist/infrastructure/sessions/project-session-paths.d.ts +17 -0
- package/dist/infrastructure/sessions/project-session-paths.js +41 -0
- package/dist/infrastructure/sessions/session-index.d.ts +16 -0
- package/dist/infrastructure/sessions/session-index.js +84 -0
- package/dist/infrastructure/sessions/session-journal.d.ts +22 -0
- package/dist/infrastructure/sessions/session-journal.js +137 -0
- package/dist/infrastructure/sessions/subagent-journal-store.d.ts +28 -0
- package/dist/infrastructure/sessions/subagent-journal-store.js +30 -0
- package/dist/infrastructure/shell/shell-tool-executor.d.ts +17 -0
- package/dist/infrastructure/shell/shell-tool-executor.js +115 -0
- package/dist/infrastructure/tokens/tiktoken-token-estimator.d.ts +18 -0
- package/dist/infrastructure/tokens/tiktoken-token-estimator.js +48 -0
- package/dist/infrastructure/workspace/workspace-settings-store.d.ts +9 -0
- package/dist/infrastructure/workspace/workspace-settings-store.js +75 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.js +66 -0
- package/dist/ports/cache-store.d.ts +10 -0
- package/dist/ports/cache-store.js +1 -0
- package/dist/ports/chat-model.d.ts +30 -0
- package/dist/ports/chat-model.js +1 -0
- package/dist/ports/clipboard-adapter.d.ts +7 -0
- package/dist/ports/clipboard-adapter.js +1 -0
- package/dist/ports/clipboard-text-adapter.d.ts +3 -0
- package/dist/ports/clipboard-text-adapter.js +1 -0
- package/dist/ports/credential-store.d.ts +7 -0
- package/dist/ports/credential-store.js +1 -0
- package/dist/ports/goal-store.d.ts +12 -0
- package/dist/ports/goal-store.js +1 -0
- package/dist/ports/logger.d.ts +8 -0
- package/dist/ports/logger.js +1 -0
- package/dist/ports/media-gateway-client.d.ts +54 -0
- package/dist/ports/media-gateway-client.js +1 -0
- package/dist/ports/model-diagnostics.d.ts +17 -0
- package/dist/ports/model-diagnostics.js +1 -0
- package/dist/ports/project-trust-store.d.ts +12 -0
- package/dist/ports/project-trust-store.js +1 -0
- package/dist/ports/session-store.d.ts +58 -0
- package/dist/ports/session-store.js +1 -0
- package/dist/ports/subagent-lifecycle.d.ts +31 -0
- package/dist/ports/subagent-lifecycle.js +1 -0
- package/dist/ports/tool-activity.d.ts +13 -0
- package/dist/ports/tool-activity.js +1 -0
- package/dist/presentation/themes/theme.d.ts +19 -0
- package/dist/presentation/themes/theme.js +8 -0
- package/dist/presentation/tui/agent-initialization-renderer.d.ts +4 -0
- package/dist/presentation/tui/agent-initialization-renderer.js +37 -0
- package/dist/presentation/tui/context-display.d.ts +21 -0
- package/dist/presentation/tui/context-display.js +33 -0
- package/dist/presentation/tui/formatters.d.ts +6 -0
- package/dist/presentation/tui/formatters.js +60 -0
- package/dist/presentation/tui/ink/choice-window.d.ts +5 -0
- package/dist/presentation/tui/ink/choice-window.js +5 -0
- package/dist/presentation/tui/ink/components/activity-entry.d.ts +6 -0
- package/dist/presentation/tui/ink/components/activity-entry.js +16 -0
- package/dist/presentation/tui/ink/components/activity-status.d.ts +10 -0
- package/dist/presentation/tui/ink/components/activity-status.js +21 -0
- package/dist/presentation/tui/ink/components/choice-modal.d.ts +11 -0
- package/dist/presentation/tui/ink/components/choice-modal.js +29 -0
- package/dist/presentation/tui/ink/components/composer.d.ts +40 -0
- package/dist/presentation/tui/ink/components/composer.js +271 -0
- package/dist/presentation/tui/ink/components/file-diff.d.ts +6 -0
- package/dist/presentation/tui/ink/components/file-diff.js +34 -0
- package/dist/presentation/tui/ink/components/modal.d.ts +8 -0
- package/dist/presentation/tui/ink/components/modal.js +110 -0
- package/dist/presentation/tui/ink/components/shimmer-text.d.ts +6 -0
- package/dist/presentation/tui/ink/components/shimmer-text.js +9 -0
- package/dist/presentation/tui/ink/components/subagent-activity.d.ts +11 -0
- package/dist/presentation/tui/ink/components/subagent-activity.js +61 -0
- package/dist/presentation/tui/ink/components/transcript.d.ts +39 -0
- package/dist/presentation/tui/ink/components/transcript.js +121 -0
- package/dist/presentation/tui/ink/components/welcome-panel.d.ts +6 -0
- package/dist/presentation/tui/ink/components/welcome-panel.js +20 -0
- package/dist/presentation/tui/ink/lotagate-tui.d.ts +6 -0
- package/dist/presentation/tui/ink/lotagate-tui.js +136 -0
- package/dist/presentation/tui/ink/markdown-inline-renderer.d.ts +4 -0
- package/dist/presentation/tui/ink/markdown-inline-renderer.js +20 -0
- package/dist/presentation/tui/ink/markdown-inline.d.ts +13 -0
- package/dist/presentation/tui/ink/markdown-inline.js +91 -0
- package/dist/presentation/tui/ink/markdown-message.d.ts +6 -0
- package/dist/presentation/tui/ink/markdown-message.js +66 -0
- package/dist/presentation/tui/ink/markdown-table.d.ts +16 -0
- package/dist/presentation/tui/ink/markdown-table.js +77 -0
- package/dist/presentation/tui/ink/tui-bridge.d.ts +195 -0
- package/dist/presentation/tui/ink/tui-bridge.js +289 -0
- package/dist/presentation/tui/terminal-capabilities.d.ts +15 -0
- package/dist/presentation/tui/terminal-capabilities.js +7 -0
- package/dist/presentation/tui/terminal-mouse.d.ts +5 -0
- package/dist/presentation/tui/terminal-mouse.js +19 -0
- package/dist/presentation/tui/terminal-screen.d.ts +10 -0
- package/dist/presentation/tui/terminal-screen.js +23 -0
- package/dist/presentation/tui/tui-agent-event-runner.d.ts +24 -0
- package/dist/presentation/tui/tui-agent-event-runner.js +69 -0
- package/dist/presentation/tui/tui-application-contract.d.ts +10 -0
- package/dist/presentation/tui/tui-application-contract.js +8 -0
- package/dist/presentation/tui/tui-application.d.ts +62 -0
- package/dist/presentation/tui/tui-application.js +675 -0
- package/dist/presentation/tui/tui-attachment-input.d.ts +2 -0
- package/dist/presentation/tui/tui-attachment-input.js +5 -0
- package/dist/presentation/tui/tui-clipboard-paste-handlers.d.ts +11 -0
- package/dist/presentation/tui/tui-clipboard-paste-handlers.js +25 -0
- package/dist/presentation/tui/tui-command-context.d.ts +3 -0
- package/dist/presentation/tui/tui-command-context.js +1 -0
- package/dist/presentation/tui/tui-command-executor.d.ts +38 -0
- package/dist/presentation/tui/tui-command-executor.js +214 -0
- package/dist/presentation/tui/tui-command-host-factory.d.ts +40 -0
- package/dist/presentation/tui/tui-command-host-factory.js +23 -0
- package/dist/presentation/tui/tui-context-compaction.d.ts +5 -0
- package/dist/presentation/tui/tui-context-compaction.js +22 -0
- package/dist/presentation/tui/tui-context-service.d.ts +34 -0
- package/dist/presentation/tui/tui-context-service.js +126 -0
- package/dist/presentation/tui/tui-file-suggestions.d.ts +3 -0
- package/dist/presentation/tui/tui-file-suggestions.js +8 -0
- package/dist/presentation/tui/tui-goal-controller.d.ts +14 -0
- package/dist/presentation/tui/tui-goal-controller.js +52 -0
- package/dist/presentation/tui/tui-initial-model.d.ts +3 -0
- package/dist/presentation/tui/tui-initial-model.js +28 -0
- package/dist/presentation/tui/tui-lifecycle-actions.d.ts +13 -0
- package/dist/presentation/tui/tui-lifecycle-actions.js +45 -0
- package/dist/presentation/tui/tui-manual-compaction.d.ts +18 -0
- package/dist/presentation/tui/tui-manual-compaction.js +31 -0
- package/dist/presentation/tui/tui-media-model-selection.d.ts +12 -0
- package/dist/presentation/tui/tui-media-model-selection.js +38 -0
- package/dist/presentation/tui/tui-prompt-dispatcher.d.ts +16 -0
- package/dist/presentation/tui/tui-prompt-dispatcher.js +38 -0
- package/dist/presentation/tui/tui-skill-controller.d.ts +11 -0
- package/dist/presentation/tui/tui-skill-controller.js +13 -0
- package/dist/presentation/tui/tui-tool-approval.d.ts +22 -0
- package/dist/presentation/tui/tui-tool-approval.js +73 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/package.json +8 -7
- package/scripts/install-native.mjs +11 -11
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SessionEvent, TranscriptEntry } from '../../domain/session/session.js';
|
|
2
|
+
/** Builds model-facing history without deleting the durable transcript. */
|
|
3
|
+
export declare function buildAgentHistory(transcript: readonly TranscriptEntry[], events: readonly SessionEvent[]): TranscriptEntry[];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const TURN_EVENTS = new Set(['turn.started', 'turn.completed', 'turn.failed', 'turn.cancelled']);
|
|
2
|
+
/** Builds model-facing history without deleting the durable transcript. */
|
|
3
|
+
export function buildAgentHistory(transcript, events) {
|
|
4
|
+
const states = resolveTurnStates(events);
|
|
5
|
+
const legacyStates = resolveLegacyTurnStates(events);
|
|
6
|
+
const legacyUsers = transcript.filter((entry) => entry.type === 'user' && entry.turnId === undefined);
|
|
7
|
+
const representedTurns = new Set();
|
|
8
|
+
const history = [];
|
|
9
|
+
for (const entry of transcript) {
|
|
10
|
+
let state;
|
|
11
|
+
if (entry.turnId !== undefined)
|
|
12
|
+
state = states.get(entry.turnId);
|
|
13
|
+
else if (entry.type === 'user') {
|
|
14
|
+
state = legacyStates[legacyUsers.indexOf(entry)];
|
|
15
|
+
}
|
|
16
|
+
if (state === undefined || state.outcome === 'completed') {
|
|
17
|
+
history.push(entry);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (entry.turnId !== undefined) {
|
|
21
|
+
if (representedTurns.has(entry.turnId))
|
|
22
|
+
continue;
|
|
23
|
+
representedTurns.add(entry.turnId);
|
|
24
|
+
}
|
|
25
|
+
if (entry.type !== 'user' && entry.turnId !== undefined)
|
|
26
|
+
continue;
|
|
27
|
+
history.push(failedTurnReference(entry, state));
|
|
28
|
+
}
|
|
29
|
+
return history;
|
|
30
|
+
}
|
|
31
|
+
function resolveTurnStates(events) {
|
|
32
|
+
const states = new Map();
|
|
33
|
+
for (const event of events) {
|
|
34
|
+
if (event.turnId === undefined || !TURN_EVENTS.has(event.type))
|
|
35
|
+
continue;
|
|
36
|
+
if (event.type === 'turn.started')
|
|
37
|
+
states.set(event.turnId, { outcome: 'incomplete' });
|
|
38
|
+
else if (event.type === 'turn.completed')
|
|
39
|
+
states.set(event.turnId, { outcome: 'completed' });
|
|
40
|
+
else {
|
|
41
|
+
const message = eventMessage(event);
|
|
42
|
+
states.set(event.turnId, { outcome: event.type === 'turn.cancelled' ? 'cancelled' : 'failed', ...(message === undefined ? {} : { message }) });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return states;
|
|
46
|
+
}
|
|
47
|
+
function resolveLegacyTurnStates(events) {
|
|
48
|
+
const states = [];
|
|
49
|
+
for (const event of events) {
|
|
50
|
+
if (event.turnId !== undefined || !TURN_EVENTS.has(event.type))
|
|
51
|
+
continue;
|
|
52
|
+
if (event.type === 'turn.started')
|
|
53
|
+
states.push({ outcome: 'incomplete' });
|
|
54
|
+
else {
|
|
55
|
+
const current = states.at(-1);
|
|
56
|
+
if (current === undefined)
|
|
57
|
+
continue;
|
|
58
|
+
current.outcome = event.type === 'turn.completed' ? 'completed' : event.type === 'turn.cancelled' ? 'cancelled' : 'failed';
|
|
59
|
+
const message = eventMessage(event);
|
|
60
|
+
if (message === undefined)
|
|
61
|
+
delete current.message;
|
|
62
|
+
else
|
|
63
|
+
current.message = message;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return states;
|
|
67
|
+
}
|
|
68
|
+
function failedTurnReference(entry, state) {
|
|
69
|
+
const status = state.outcome === 'cancelled' ? 'cancelled' : state.outcome === 'incomplete' ? 'incomplete' : 'failed';
|
|
70
|
+
const reason = state.message === undefined ? 'The turn did not complete.' : `Reason: ${state.message}`;
|
|
71
|
+
return {
|
|
72
|
+
type: 'system',
|
|
73
|
+
timestamp: entry.timestamp,
|
|
74
|
+
...(entry.turnId === undefined ? {} : { turnId: entry.turnId }),
|
|
75
|
+
content: `[Previous turn — ${status}; reference only]\nOriginal request:\n${entry.content}\n${reason}\nDo not retry or continue this request unless the current user explicitly asks.`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function eventMessage(event) {
|
|
79
|
+
const message = event.data?.['message'];
|
|
80
|
+
return typeof message === 'string' && message.trim().length > 0 ? message.slice(0, 1024) : undefined;
|
|
81
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type WorkspaceFileReference } from '../workspace/workspace-file-reference-resolver.js';
|
|
2
|
+
export interface AgentInputContext {
|
|
3
|
+
readonly input: string;
|
|
4
|
+
readonly references: readonly WorkspaceFileReference[];
|
|
5
|
+
}
|
|
6
|
+
/** Builds the same bounded, untrusted reference context for every CLI surface. */
|
|
7
|
+
export declare function buildAgentInputContext(prompt: string, workspaceRoot: string, trusted: boolean, options?: {
|
|
8
|
+
includeContent?: boolean;
|
|
9
|
+
}): Promise<AgentInputContext>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WorkspaceFileReferenceResolver } from '../workspace/workspace-file-reference-resolver.js';
|
|
2
|
+
/** Builds the same bounded, untrusted reference context for every CLI surface. */
|
|
3
|
+
export async function buildAgentInputContext(prompt, workspaceRoot, trusted, options = {}) {
|
|
4
|
+
const resolver = new WorkspaceFileReferenceResolver(workspaceRoot);
|
|
5
|
+
const references = trusted ? await resolver.resolve(prompt) : [];
|
|
6
|
+
const instruction = resolver.instruction(references);
|
|
7
|
+
const content = trusted && options.includeContent !== false ? await resolver.contentInstruction(references) : undefined;
|
|
8
|
+
return {
|
|
9
|
+
input: [prompt, instruction, content].filter((value) => value !== undefined && value.length > 0).join('\n\n'),
|
|
10
|
+
references,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AgentSdkError, AgentSdkErrorCode } from '@lotagate/agent-sdk';
|
|
2
|
+
export function classifyAgentLimit(error) {
|
|
3
|
+
if (!(error instanceof AgentSdkError) || error.code !== AgentSdkErrorCode.AgentLimitExceeded)
|
|
4
|
+
return undefined;
|
|
5
|
+
if (error.details?.['maxToolCallsPerTurn'] !== undefined || /tool calls/iu.test(error.message))
|
|
6
|
+
return 'tool_calls';
|
|
7
|
+
return 'iterations';
|
|
8
|
+
}
|
|
9
|
+
export function agentLimitNotice(reason) {
|
|
10
|
+
const limit = reason === 'tool_calls' ? 'tool-call' : 'iteration';
|
|
11
|
+
return `The agent stopped after reaching its ${limit} safety limit. The response may be incomplete; send a focused follow-up to continue.`;
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AgentEvent } from '@lotagate/agent-sdk';
|
|
2
|
+
import type { ModelCallSummary } from '../../ports/model-diagnostics.js';
|
|
3
|
+
export type CliAgentRunState = 'preparing' | 'thinking' | 'executing_tool' | 'waiting_approval' | 'compacting' | 'completed' | 'failed' | 'cancelled' | 'stuck';
|
|
4
|
+
export interface AgentRunSnapshot {
|
|
5
|
+
readonly state: CliAgentRunState;
|
|
6
|
+
readonly modelTurns: number;
|
|
7
|
+
readonly toolCalls: number;
|
|
8
|
+
readonly toolCompletions: number;
|
|
9
|
+
readonly toolFailures: number;
|
|
10
|
+
readonly modelContentLength: number;
|
|
11
|
+
readonly lastFinishReason?: string | null;
|
|
12
|
+
readonly toolNames: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
/** Tracks the CLI-visible lifecycle without duplicating the Agent SDK loop. */
|
|
15
|
+
export declare class AgentRunTracker {
|
|
16
|
+
private state;
|
|
17
|
+
private modelTurns;
|
|
18
|
+
private toolCalls;
|
|
19
|
+
private toolCompletions;
|
|
20
|
+
private toolFailures;
|
|
21
|
+
private modelContentLength;
|
|
22
|
+
private lastFinishReason;
|
|
23
|
+
private readonly toolNames;
|
|
24
|
+
observe(event: AgentEvent): void;
|
|
25
|
+
observeModel(summary: ModelCallSummary): void;
|
|
26
|
+
markCancelled(): void;
|
|
27
|
+
markFailed(): void;
|
|
28
|
+
markStuck(): void;
|
|
29
|
+
snapshot(): AgentRunSnapshot;
|
|
30
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Tracks the CLI-visible lifecycle without duplicating the Agent SDK loop. */
|
|
2
|
+
export class AgentRunTracker {
|
|
3
|
+
state = 'preparing';
|
|
4
|
+
modelTurns = 0;
|
|
5
|
+
toolCalls = 0;
|
|
6
|
+
toolCompletions = 0;
|
|
7
|
+
toolFailures = 0;
|
|
8
|
+
modelContentLength = 0;
|
|
9
|
+
lastFinishReason;
|
|
10
|
+
toolNames = new Set();
|
|
11
|
+
observe(event) {
|
|
12
|
+
switch (event.type) {
|
|
13
|
+
case 'model.delta':
|
|
14
|
+
this.state = 'thinking';
|
|
15
|
+
this.modelContentLength += event.content.length;
|
|
16
|
+
break;
|
|
17
|
+
case 'model.completed':
|
|
18
|
+
this.state = 'thinking';
|
|
19
|
+
this.modelTurns += 1;
|
|
20
|
+
break;
|
|
21
|
+
case 'tool.approval.requested':
|
|
22
|
+
this.state = 'waiting_approval';
|
|
23
|
+
break;
|
|
24
|
+
case 'tool.called':
|
|
25
|
+
this.state = 'executing_tool';
|
|
26
|
+
this.toolCalls += 1;
|
|
27
|
+
this.toolNames.add(event.toolName);
|
|
28
|
+
break;
|
|
29
|
+
case 'tool.completed':
|
|
30
|
+
this.state = 'thinking';
|
|
31
|
+
this.toolCompletions += 1;
|
|
32
|
+
if (event.isError)
|
|
33
|
+
this.toolFailures += 1;
|
|
34
|
+
break;
|
|
35
|
+
case 'context.compacted':
|
|
36
|
+
this.state = 'compacting';
|
|
37
|
+
break;
|
|
38
|
+
case 'session.completed':
|
|
39
|
+
this.state = 'completed';
|
|
40
|
+
this.modelContentLength += event.content.length;
|
|
41
|
+
break;
|
|
42
|
+
case 'session.failed':
|
|
43
|
+
this.state = 'failed';
|
|
44
|
+
break;
|
|
45
|
+
default: break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
observeModel(summary) {
|
|
49
|
+
this.lastFinishReason = summary.finishReason;
|
|
50
|
+
for (const name of summary.toolNames)
|
|
51
|
+
this.toolNames.add(name);
|
|
52
|
+
}
|
|
53
|
+
markCancelled() { this.state = 'cancelled'; }
|
|
54
|
+
markFailed() { this.state = 'failed'; }
|
|
55
|
+
markStuck() { this.state = 'stuck'; }
|
|
56
|
+
snapshot() {
|
|
57
|
+
return {
|
|
58
|
+
state: this.state,
|
|
59
|
+
modelTurns: this.modelTurns,
|
|
60
|
+
toolCalls: this.toolCalls,
|
|
61
|
+
toolCompletions: this.toolCompletions,
|
|
62
|
+
toolFailures: this.toolFailures,
|
|
63
|
+
modelContentLength: this.modelContentLength,
|
|
64
|
+
...(this.lastFinishReason === undefined ? {} : { lastFinishReason: this.lastFinishReason }),
|
|
65
|
+
toolNames: [...this.toolNames].sort(),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TextMessage } from '@lotagate/sdk';
|
|
2
|
+
import type { AgentSessionPatch, AgentSessionState, SessionStore as AgentSessionStore } from '@lotagate/agent-sdk';
|
|
3
|
+
import type { SessionEvent, TranscriptEntry } from '../../domain/session/session.js';
|
|
4
|
+
/**
|
|
5
|
+
* Keeps the Agent SDK conversation alive across TUI turns while leaving the
|
|
6
|
+
* durable CLI session format owned by the CLI session store.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CliAgentSessionStore implements AgentSessionStore {
|
|
9
|
+
private readonly sessions;
|
|
10
|
+
create(state: AgentSessionState): void;
|
|
11
|
+
get(sessionId: string): AgentSessionState | undefined;
|
|
12
|
+
update(sessionId: string, patch: AgentSessionPatch): void;
|
|
13
|
+
delete(sessionId: string): void;
|
|
14
|
+
/** Seeds a resumed session only when the current process has no SDK state. */
|
|
15
|
+
hydrate(sessionId: string, systemPrompt: string, transcript: readonly TranscriptEntry[], events: readonly SessionEvent[], currentInput: string): void;
|
|
16
|
+
}
|
|
17
|
+
export declare function toAgentMessage(entry: TranscriptEntry): TextMessage;
|
|
18
|
+
/** Keeps durable history intact while rebuilding only the active post-compaction context. */
|
|
19
|
+
export declare function retainLatestCompaction(transcript: readonly TranscriptEntry[]): TranscriptEntry[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { buildAgentHistory } from './agent-history.js';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps the Agent SDK conversation alive across TUI turns while leaving the
|
|
4
|
+
* durable CLI session format owned by the CLI session store.
|
|
5
|
+
*/
|
|
6
|
+
export class CliAgentSessionStore {
|
|
7
|
+
sessions = new Map();
|
|
8
|
+
create(state) {
|
|
9
|
+
this.sessions.set(state.sessionId, state);
|
|
10
|
+
}
|
|
11
|
+
get(sessionId) {
|
|
12
|
+
return this.sessions.get(sessionId);
|
|
13
|
+
}
|
|
14
|
+
update(sessionId, patch) {
|
|
15
|
+
const current = this.sessions.get(sessionId);
|
|
16
|
+
if (current === undefined)
|
|
17
|
+
throw new Error(`Agent session not found: ${sessionId}`);
|
|
18
|
+
this.sessions.set(sessionId, {
|
|
19
|
+
...current,
|
|
20
|
+
...patch,
|
|
21
|
+
...(patch.finalContent === undefined ? {} : { finalContent: patch.finalContent }),
|
|
22
|
+
updatedAt: new Date().toISOString(),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
delete(sessionId) {
|
|
26
|
+
this.sessions.delete(sessionId);
|
|
27
|
+
}
|
|
28
|
+
/** Seeds a resumed session only when the current process has no SDK state. */
|
|
29
|
+
hydrate(sessionId, systemPrompt, transcript, events, currentInput) {
|
|
30
|
+
if (this.sessions.has(sessionId))
|
|
31
|
+
return;
|
|
32
|
+
const source = [...transcript];
|
|
33
|
+
const currentIndex = findLastIndex(source, (entry) => entry.type === 'user' && entry.content === currentInput);
|
|
34
|
+
if (currentIndex >= 0)
|
|
35
|
+
source.splice(currentIndex, 1);
|
|
36
|
+
const previous = retainLatestCompaction(buildAgentHistory(source, events));
|
|
37
|
+
const messages = [
|
|
38
|
+
{ role: 'system', content: systemPrompt },
|
|
39
|
+
...previous.map(toAgentMessage),
|
|
40
|
+
];
|
|
41
|
+
if (messages.length <= 1)
|
|
42
|
+
return;
|
|
43
|
+
const now = new Date().toISOString();
|
|
44
|
+
this.create({ sessionId, status: 'completed', messages, iteration: 0, createdAt: now, updatedAt: now });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export function toAgentMessage(entry) {
|
|
48
|
+
if (entry.type === 'system' && entry.content.startsWith('[Compacted context]\n')) {
|
|
49
|
+
return { role: 'user', content: `[Conversation summary — untrusted conversation context]\n${entry.content.slice('[Compacted context]\n'.length)}` };
|
|
50
|
+
}
|
|
51
|
+
if (entry.type === 'system')
|
|
52
|
+
return { role: 'system', content: entry.content };
|
|
53
|
+
if (entry.type === 'tool')
|
|
54
|
+
return { role: 'system', content: `[Tool result]\n${entry.content}` };
|
|
55
|
+
return { role: entry.type, content: entry.content };
|
|
56
|
+
}
|
|
57
|
+
/** Keeps durable history intact while rebuilding only the active post-compaction context. */
|
|
58
|
+
export function retainLatestCompaction(transcript) {
|
|
59
|
+
let latest = -1;
|
|
60
|
+
for (let index = transcript.length - 1; index >= 0; index -= 1) {
|
|
61
|
+
const entry = transcript[index];
|
|
62
|
+
if (entry?.type === 'system' && entry.content.startsWith('[Compacted context]\n')) {
|
|
63
|
+
latest = index;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return latest < 0 ? [...transcript] : transcript.slice(latest);
|
|
68
|
+
}
|
|
69
|
+
function findLastIndex(items, predicate) {
|
|
70
|
+
for (let index = items.length - 1; index >= 0; index -= 1)
|
|
71
|
+
if (predicate(items[index]))
|
|
72
|
+
return index;
|
|
73
|
+
return -1;
|
|
74
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type AgentCapabilityProfile = 'interactive-trusted' | 'interactive-untrusted' | 'headless-safe' | 'protocol-safe' | 'subagent';
|
|
2
|
+
export type AgentSubagentMode = 'research' | 'worker';
|
|
3
|
+
export interface AgentSkillSummary {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AgentInstructionSummary {
|
|
8
|
+
path: string;
|
|
9
|
+
content: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AgentGoalSummary {
|
|
12
|
+
objective: string;
|
|
13
|
+
status: string;
|
|
14
|
+
turns: number;
|
|
15
|
+
evaluatorRuns: number;
|
|
16
|
+
tokensUsed: number;
|
|
17
|
+
tokenBudget?: number;
|
|
18
|
+
maxTurns?: number;
|
|
19
|
+
maxDurationMs?: number;
|
|
20
|
+
lastEvaluation?: string;
|
|
21
|
+
lastError?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AgentCapabilitySnapshot {
|
|
24
|
+
profile: AgentCapabilityProfile;
|
|
25
|
+
model: string;
|
|
26
|
+
cwd: string;
|
|
27
|
+
workspaceRoot: string;
|
|
28
|
+
trusted: boolean;
|
|
29
|
+
subagentMode?: AgentSubagentMode;
|
|
30
|
+
subagentModels?: readonly string[];
|
|
31
|
+
tools: readonly string[];
|
|
32
|
+
skills: readonly AgentSkillSummary[];
|
|
33
|
+
plugins: readonly string[];
|
|
34
|
+
instructions?: readonly AgentInstructionSummary[];
|
|
35
|
+
goal?: AgentGoalSummary;
|
|
36
|
+
}
|
|
37
|
+
export declare function createCapabilitySnapshot(input: AgentCapabilitySnapshot): AgentCapabilitySnapshot;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function createCapabilitySnapshot(input) {
|
|
2
|
+
return {
|
|
3
|
+
...input,
|
|
4
|
+
...(input.subagentModels === undefined ? {} : { subagentModels: [...new Set(input.subagentModels)].sort() }),
|
|
5
|
+
tools: uniqueSorted(input.tools),
|
|
6
|
+
skills: [...input.skills].sort((left, right) => left.name.localeCompare(right.name)),
|
|
7
|
+
plugins: uniqueSorted(input.plugins),
|
|
8
|
+
...(input.instructions === undefined ? {} : { instructions: [...input.instructions].sort((left, right) => left.path.localeCompare(right.path)) }),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function uniqueSorted(values) {
|
|
12
|
+
return [...new Set(values)].sort((left, right) => left.localeCompare(right));
|
|
13
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { LotaGate } from '@lotagate/sdk';
|
|
2
|
+
import type { AgentEvent, AgentRunRequest, LotaGateAgent, ContextManagementOptions, SessionStore as AgentSessionStore, ToolExecutor } from '@lotagate/agent-sdk';
|
|
3
|
+
import type { CliRuntime } from '../../bootstrap/runtime-factory.js';
|
|
4
|
+
import { type CliApprovalMode, type ToolApprovalDecision } from '../security/tool-approval-service.js';
|
|
5
|
+
import { type AgentCapabilityProfile, type AgentGoalSummary } from './capability-profile.js';
|
|
6
|
+
import type { ModelCallSummary } from '../../ports/model-diagnostics.js';
|
|
7
|
+
import { type AgentInputContext } from './agent-input-context.js';
|
|
8
|
+
import type { SkillManifest } from '../../domain/extensions/skill-manifest.js';
|
|
9
|
+
import type { FileChangeDiff } from '../../domain/filesystem/file-change-diff.js';
|
|
10
|
+
import type { ToolApprovalRequest } from '@lotagate/agent-sdk';
|
|
11
|
+
import type { ToolActivityObserver } from '../../ports/tool-activity.js';
|
|
12
|
+
import { type SubagentJobRegistry } from '../orchestration/cli-subagent-service.js';
|
|
13
|
+
import type { SubagentMode } from '../../domain/orchestration/subagent.js';
|
|
14
|
+
import type { SubagentLifecycleObserver } from '../../ports/subagent-lifecycle.js';
|
|
15
|
+
import { type BrowserHostInvoker } from '../protocol/browser-host-tool-executor.js';
|
|
16
|
+
import { type DesktopHostInvoker } from '../protocol/desktop-host-tool-executor.js';
|
|
17
|
+
import type { DesktopBrowserAccess } from '../protocol/desktop-execution-policy.js';
|
|
18
|
+
export interface CliAgentExecutionOptions {
|
|
19
|
+
runtime: CliRuntime;
|
|
20
|
+
cwd: string;
|
|
21
|
+
model: string;
|
|
22
|
+
client: LotaGate;
|
|
23
|
+
profile: AgentCapabilityProfile;
|
|
24
|
+
/** Non-interactive callers cannot answer an approval prompt. */
|
|
25
|
+
approvalMode?: CliApprovalMode;
|
|
26
|
+
onModelComplete?: (summary: ModelCallSummary) => void;
|
|
27
|
+
onSubagentModelComplete?: (summary: ModelCallSummary) => void;
|
|
28
|
+
initialSkill?: SkillManifest;
|
|
29
|
+
onWrite?: (change: FileChangeDiff) => void | Promise<void>;
|
|
30
|
+
prompt?: (request: ToolApprovalRequest) => boolean | Promise<boolean>;
|
|
31
|
+
rememberApproval?: (request: ToolApprovalRequest) => void | Promise<void>;
|
|
32
|
+
onApprovalPersistenceFailure?: (request: ToolApprovalRequest, error: unknown) => void | Promise<void>;
|
|
33
|
+
audit?: (decision: ToolApprovalDecision) => void | Promise<void>;
|
|
34
|
+
contextManagement?: ContextManagementOptions;
|
|
35
|
+
agentSessionStore?: AgentSessionStore;
|
|
36
|
+
toolActivity?: ToolActivityObserver;
|
|
37
|
+
/** Internal child-agent guard. Child agents never receive agent.spawn. */
|
|
38
|
+
allowSubagents?: boolean;
|
|
39
|
+
/** Child capability mode. Research is the least-privileged default. */
|
|
40
|
+
subagentMode?: SubagentMode;
|
|
41
|
+
/** Model ids permitted for delegated children. Defaults to the parent model only. */
|
|
42
|
+
allowedSubagentModels?: readonly string[];
|
|
43
|
+
/** Workspace-relative paths a worker child may write. */
|
|
44
|
+
subagentWriteScope?: readonly string[];
|
|
45
|
+
/** Session-owned registry keeps background subagents available across turns. */
|
|
46
|
+
subagentJobs?: SubagentJobRegistry;
|
|
47
|
+
/** CLI presentation can observe delegated-work lifecycle without entering the SDK boundary. */
|
|
48
|
+
subagentLifecycle?: SubagentLifecycleObserver;
|
|
49
|
+
goal?: AgentGoalSummary;
|
|
50
|
+
/** Desktop-only bridge. Standalone CLI callers leave this undefined. */
|
|
51
|
+
browserHost?: BrowserHostInvoker;
|
|
52
|
+
/** Optional Desktop automation tool scope. Standalone callers leave this undefined. */
|
|
53
|
+
allowedTools?: readonly string[];
|
|
54
|
+
/** Optional Desktop automation skill selection. Standalone callers leave this undefined. */
|
|
55
|
+
selectedSkills?: readonly string[];
|
|
56
|
+
/** Optional Desktop browser exposure policy. The host remains authoritative. */
|
|
57
|
+
browserAccess?: DesktopBrowserAccess;
|
|
58
|
+
/** Desktop-only host execution bridge. Standalone callers leave this undefined. */
|
|
59
|
+
desktopHost?: DesktopHostInvoker;
|
|
60
|
+
/** Selects where Desktop-owned filesystem and shell tools execute. */
|
|
61
|
+
executionBoundary?: 'sandbox' | 'host';
|
|
62
|
+
/** Host fallback policy for a Desktop-owned sandbox request. */
|
|
63
|
+
hostFallback?: 'ask' | 'deny' | 'allow';
|
|
64
|
+
/** Reuses the Desktop tool approval surface when sandbox fallback needs consent. */
|
|
65
|
+
onExecutionFallbackApproval?: (request: ToolApprovalRequest, reason: string) => boolean | Promise<boolean>;
|
|
66
|
+
}
|
|
67
|
+
export interface PreparedCliAgent {
|
|
68
|
+
readonly agent: LotaGateAgent;
|
|
69
|
+
readonly system: string;
|
|
70
|
+
readonly trusted: boolean;
|
|
71
|
+
readonly buildInput: (prompt: string) => Promise<AgentInputContext>;
|
|
72
|
+
readonly close: () => Promise<void>;
|
|
73
|
+
readonly run: (request: Pick<AgentRunRequest, 'input' | 'model' | 'signal' | 'sessionId' | 'metadata' | 'limits' | 'stream'>) => AsyncIterable<AgentEvent>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Composes the CLI-owned capabilities around the public Agent SDK runtime.
|
|
77
|
+
* The SDK remains responsible for MCP transport, tool dispatch and the agent
|
|
78
|
+
* loop; this service only supplies workspace policy and CLI extensions.
|
|
79
|
+
*/
|
|
80
|
+
export declare function prepareCliAgent(options: CliAgentExecutionOptions): Promise<PreparedCliAgent>;
|
|
81
|
+
export declare function composeFullToolExecutors(hostExecution: ToolExecutor | undefined, filesystem: ToolExecutor, shell: ToolExecutor, skill: ToolExecutor, browser?: ToolExecutor): readonly ToolExecutor[];
|