@lotagate/cli 0.1.22 → 0.1.24
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,195 +0,0 @@
|
|
|
1
|
-
import type { Attachment } from '../../../domain/session/attachment.js';
|
|
2
|
-
import type { ExecutionPlan } from '../../../domain/orchestration/task.js';
|
|
3
|
-
import type { ChatUsage } from '../../../ports/chat-model.js';
|
|
4
|
-
import type { FileChangeDiff } from '../../../domain/filesystem/file-change-diff.js';
|
|
5
|
-
import type { ExtensionScope } from '../../../domain/extensions/extension-scope.js';
|
|
6
|
-
import type { SubagentMode, SubagentStatus } from '../../../domain/orchestration/subagent.js';
|
|
7
|
-
import type { SubagentHandoff } from '../../../domain/orchestration/subagent.js';
|
|
8
|
-
import type { SubagentLastAction, SubagentLifecycleEvent } from '../../../ports/subagent-lifecycle.js';
|
|
9
|
-
import type { CliActionKind } from '../../../application/orchestration/cli-turn-events.js';
|
|
10
|
-
export type TuiMessageKind = 'user' | 'assistant' | 'command' | 'notice' | 'error' | 'diff' | 'activity' | 'subagent';
|
|
11
|
-
export type TuiActivityState = 'pending' | 'running' | 'completed' | 'failed';
|
|
12
|
-
export interface TuiMessage {
|
|
13
|
-
id: string;
|
|
14
|
-
kind: TuiMessageKind;
|
|
15
|
-
content: string;
|
|
16
|
-
attachments?: readonly Attachment[];
|
|
17
|
-
fileChange?: FileChangeDiff;
|
|
18
|
-
activity?: {
|
|
19
|
-
label: string;
|
|
20
|
-
state: TuiActivityState;
|
|
21
|
-
startedAt: number;
|
|
22
|
-
elapsedMs?: number;
|
|
23
|
-
toolName?: string;
|
|
24
|
-
kind?: CliActionKind;
|
|
25
|
-
};
|
|
26
|
-
subagent?: TuiSubagent;
|
|
27
|
-
}
|
|
28
|
-
export interface TuiSubagent {
|
|
29
|
-
readonly id: string;
|
|
30
|
-
readonly displayName: string;
|
|
31
|
-
readonly task: string;
|
|
32
|
-
readonly mode: SubagentMode;
|
|
33
|
-
readonly model: string;
|
|
34
|
-
readonly status: SubagentStatus;
|
|
35
|
-
readonly background: boolean;
|
|
36
|
-
readonly createdAt: number;
|
|
37
|
-
readonly updatedAt: number;
|
|
38
|
-
readonly durationMs?: number;
|
|
39
|
-
readonly summary?: string;
|
|
40
|
-
readonly lastAction?: SubagentLastAction;
|
|
41
|
-
readonly handoff?: SubagentHandoff;
|
|
42
|
-
}
|
|
43
|
-
export interface TuiWelcome {
|
|
44
|
-
version: string;
|
|
45
|
-
cwd: string;
|
|
46
|
-
model: string | null;
|
|
47
|
-
profile: string | null;
|
|
48
|
-
trusted: boolean;
|
|
49
|
-
}
|
|
50
|
-
export interface TuiContextUsage {
|
|
51
|
-
usedTokens: number;
|
|
52
|
-
contextWindow?: number;
|
|
53
|
-
}
|
|
54
|
-
export interface TuiChoice {
|
|
55
|
-
value: string;
|
|
56
|
-
label: string;
|
|
57
|
-
description?: string;
|
|
58
|
-
kind?: 'file' | 'directory';
|
|
59
|
-
}
|
|
60
|
-
export type TuiModal = {
|
|
61
|
-
kind: 'trust';
|
|
62
|
-
} | {
|
|
63
|
-
kind: 'plan';
|
|
64
|
-
plan: ExecutionPlan;
|
|
65
|
-
} | {
|
|
66
|
-
kind: 'approval';
|
|
67
|
-
toolName: string;
|
|
68
|
-
detail?: string;
|
|
69
|
-
} | {
|
|
70
|
-
kind: 'subagent';
|
|
71
|
-
subagent: TuiSubagent;
|
|
72
|
-
} | {
|
|
73
|
-
kind: 'choice';
|
|
74
|
-
title: string;
|
|
75
|
-
choices: readonly TuiChoice[];
|
|
76
|
-
currentValue?: string;
|
|
77
|
-
detail?: string;
|
|
78
|
-
} | {
|
|
79
|
-
kind: 'secret';
|
|
80
|
-
label: string;
|
|
81
|
-
};
|
|
82
|
-
export interface TuiViewState {
|
|
83
|
-
ready: boolean;
|
|
84
|
-
runActive: boolean;
|
|
85
|
-
welcome?: TuiWelcome | undefined;
|
|
86
|
-
messages: readonly TuiMessage[];
|
|
87
|
-
subagents: readonly TuiSubagent[];
|
|
88
|
-
status?: string | undefined;
|
|
89
|
-
footerNotice?: string | undefined;
|
|
90
|
-
activityStartedAt?: number | undefined;
|
|
91
|
-
elapsedMs?: number | undefined;
|
|
92
|
-
usage?: ChatUsage | undefined;
|
|
93
|
-
contextUsage?: TuiContextUsage | undefined;
|
|
94
|
-
pendingAttachments: readonly Attachment[];
|
|
95
|
-
fileSuggestions: readonly TuiChoice[];
|
|
96
|
-
modal?: TuiModal | undefined;
|
|
97
|
-
clearBlockedUntil?: number | undefined;
|
|
98
|
-
actionDetails: boolean;
|
|
99
|
-
}
|
|
100
|
-
type Listener = () => void;
|
|
101
|
-
export declare class InkTuiBridge {
|
|
102
|
-
private readonly listeners;
|
|
103
|
-
private readonly initializationNotices;
|
|
104
|
-
private state;
|
|
105
|
-
private resolveModal;
|
|
106
|
-
private readonly exitResolvers;
|
|
107
|
-
private submitHandler;
|
|
108
|
-
private imagePasteHandler;
|
|
109
|
-
private textPasteHandler;
|
|
110
|
-
private clearAttachmentsHandler;
|
|
111
|
-
private interruptHandler;
|
|
112
|
-
private cancelHandler;
|
|
113
|
-
private sequence;
|
|
114
|
-
private noticeTimer;
|
|
115
|
-
private assistantFlushTimer;
|
|
116
|
-
private pendingAssistant;
|
|
117
|
-
private assistantSegmentPending;
|
|
118
|
-
private readonly pendingActivityTimers;
|
|
119
|
-
snapshot(): TuiViewState;
|
|
120
|
-
subscribe(listener: Listener): () => void;
|
|
121
|
-
setSubmitHandler(handler: (value: string) => Promise<void>): void;
|
|
122
|
-
setImagePasteHandler(handler: () => Promise<void>): void;
|
|
123
|
-
setTextPasteHandler(handler: () => Promise<string | undefined>): void;
|
|
124
|
-
setClearAttachmentsHandler(handler: () => void): void;
|
|
125
|
-
setInterruptHandler(handler: () => void): void;
|
|
126
|
-
setCancelHandler(handler: () => void): void;
|
|
127
|
-
submit(value: string): Promise<void>;
|
|
128
|
-
pasteImage(): Promise<void>;
|
|
129
|
-
pasteText(): Promise<string | undefined>;
|
|
130
|
-
interrupt(): void;
|
|
131
|
-
cancel(): void;
|
|
132
|
-
clearAttachments(): void;
|
|
133
|
-
setReady(): void;
|
|
134
|
-
setRunActive(runActive: boolean): void;
|
|
135
|
-
setWelcome(welcome: TuiWelcome): void;
|
|
136
|
-
setPendingAttachments(attachments: readonly Attachment[]): void;
|
|
137
|
-
setContextUsage(contextUsage: TuiContextUsage | undefined): void;
|
|
138
|
-
setFileSuggestions(fileSuggestions: readonly TuiChoice[]): void;
|
|
139
|
-
toggleActionDetails(): boolean;
|
|
140
|
-
clearTranscript(): void;
|
|
141
|
-
private exitCode;
|
|
142
|
-
requestExit(code?: number): void;
|
|
143
|
-
waitForExit(): Promise<number>;
|
|
144
|
-
userPrompt(content: string, attachments?: readonly Attachment[]): void;
|
|
145
|
-
command(content: string): void;
|
|
146
|
-
commandOutput(content: string): void;
|
|
147
|
-
transcriptNotice(content: string, notify?: boolean): void;
|
|
148
|
-
initializationNotice(key: string, content: string): void;
|
|
149
|
-
fileChange(change: FileChangeDiff): void;
|
|
150
|
-
notice(content: string): void;
|
|
151
|
-
dispose(): void;
|
|
152
|
-
error(content: string): void;
|
|
153
|
-
subagentLifecycle(event: SubagentLifecycleEvent): void;
|
|
154
|
-
startToolActivity(key: string, label: string, metadata?: {
|
|
155
|
-
toolName?: string;
|
|
156
|
-
kind?: CliActionKind;
|
|
157
|
-
}): {
|
|
158
|
-
complete: (isError: boolean) => void;
|
|
159
|
-
};
|
|
160
|
-
toolActivityStarted(key: string, label: string, metadata?: {
|
|
161
|
-
toolName?: string;
|
|
162
|
-
kind?: CliActionKind;
|
|
163
|
-
}): void;
|
|
164
|
-
toolActivityCompleted(key: string, isError: boolean): void;
|
|
165
|
-
status(label: string): void;
|
|
166
|
-
activity(label: string, elapsedMs: number, usage?: ChatUsage): void;
|
|
167
|
-
clearActivity(): void;
|
|
168
|
-
complete(elapsedMs: number, usage?: ChatUsage): void;
|
|
169
|
-
failed(): void;
|
|
170
|
-
cancelled(): void;
|
|
171
|
-
beginAssistant(): void;
|
|
172
|
-
/** Starts a new assistant segment after a host-owned action or approval boundary. */
|
|
173
|
-
assistantActionBoundary(): void;
|
|
174
|
-
assistantDelta(content: string): void;
|
|
175
|
-
finishAssistant(): void;
|
|
176
|
-
confirmTrust(): Promise<boolean>;
|
|
177
|
-
confirmPlan(plan: ExecutionPlan): Promise<boolean>;
|
|
178
|
-
confirmTool(toolName: string, detail?: string): Promise<boolean>;
|
|
179
|
-
openSubagentDetails(id: string): void;
|
|
180
|
-
closeSubagentDetails(): void;
|
|
181
|
-
selectModel(title: string, choices: readonly TuiChoice[], currentValue?: string): Promise<string | undefined>;
|
|
182
|
-
selectScope(title: string): Promise<ExtensionScope | undefined>;
|
|
183
|
-
requestSecret(label: string): Promise<string | undefined>;
|
|
184
|
-
resolveActiveModal(value: boolean | string | undefined): void;
|
|
185
|
-
private request;
|
|
186
|
-
private selectChoice;
|
|
187
|
-
private append;
|
|
188
|
-
private message;
|
|
189
|
-
private updateActivity;
|
|
190
|
-
private completeToolActivity;
|
|
191
|
-
private clearPendingActivityTimer;
|
|
192
|
-
private update;
|
|
193
|
-
private flushAssistant;
|
|
194
|
-
}
|
|
195
|
-
export {};
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
import { RESOURCE_LIMITS } from '../../../domain/runtime/resource-limits.js';
|
|
2
|
-
export class InkTuiBridge {
|
|
3
|
-
listeners = new Set();
|
|
4
|
-
initializationNotices = new Map();
|
|
5
|
-
state = { ready: false, runActive: false, messages: [], subagents: [], pendingAttachments: [], fileSuggestions: [], actionDetails: false };
|
|
6
|
-
resolveModal;
|
|
7
|
-
exitResolvers = new Set();
|
|
8
|
-
submitHandler;
|
|
9
|
-
imagePasteHandler;
|
|
10
|
-
textPasteHandler;
|
|
11
|
-
clearAttachmentsHandler;
|
|
12
|
-
interruptHandler;
|
|
13
|
-
cancelHandler;
|
|
14
|
-
sequence = 0;
|
|
15
|
-
noticeTimer;
|
|
16
|
-
assistantFlushTimer;
|
|
17
|
-
pendingAssistant;
|
|
18
|
-
assistantSegmentPending = false;
|
|
19
|
-
pendingActivityTimers = new Map();
|
|
20
|
-
snapshot() { return this.state; }
|
|
21
|
-
subscribe(listener) { this.listeners.add(listener); return () => this.listeners.delete(listener); }
|
|
22
|
-
setSubmitHandler(handler) { this.submitHandler = handler; }
|
|
23
|
-
setImagePasteHandler(handler) { this.imagePasteHandler = handler; }
|
|
24
|
-
setTextPasteHandler(handler) { this.textPasteHandler = handler; }
|
|
25
|
-
setClearAttachmentsHandler(handler) { this.clearAttachmentsHandler = handler; }
|
|
26
|
-
setInterruptHandler(handler) { this.interruptHandler = handler; }
|
|
27
|
-
setCancelHandler(handler) { this.cancelHandler = handler; }
|
|
28
|
-
async submit(value) { await this.submitHandler?.(value); }
|
|
29
|
-
async pasteImage() { await this.imagePasteHandler?.(); }
|
|
30
|
-
async pasteText() { return this.textPasteHandler?.(); }
|
|
31
|
-
interrupt() { this.interruptHandler?.(); }
|
|
32
|
-
cancel() {
|
|
33
|
-
this.cancelHandler?.();
|
|
34
|
-
this.resolveActiveModal(undefined);
|
|
35
|
-
this.update({ clearBlockedUntil: Date.now() + 1500 });
|
|
36
|
-
}
|
|
37
|
-
clearAttachments() { this.clearAttachmentsHandler?.(); }
|
|
38
|
-
setReady() { this.update({ ready: true }); }
|
|
39
|
-
setRunActive(runActive) { this.update({ runActive }); }
|
|
40
|
-
setWelcome(welcome) { this.update({ welcome }); }
|
|
41
|
-
setPendingAttachments(attachments) { this.update({ pendingAttachments: attachments }); }
|
|
42
|
-
setContextUsage(contextUsage) { this.update({ contextUsage }); }
|
|
43
|
-
setFileSuggestions(fileSuggestions) { this.update({ fileSuggestions }); }
|
|
44
|
-
toggleActionDetails() { const actionDetails = !this.state.actionDetails; this.update({ actionDetails }); return actionDetails; }
|
|
45
|
-
clearTranscript() { this.initializationNotices.clear(); this.update({ messages: [], subagents: [] }); }
|
|
46
|
-
exitCode;
|
|
47
|
-
requestExit(code = 0) { this.exitCode ??= code; for (const resolve of this.exitResolvers)
|
|
48
|
-
resolve(this.exitCode); this.exitResolvers.clear(); }
|
|
49
|
-
waitForExit() { return this.exitCode === undefined ? new Promise((resolve) => { this.exitResolvers.add(resolve); }) : Promise.resolve(this.exitCode); }
|
|
50
|
-
userPrompt(content, attachments = []) { this.append('user', content, attachments); }
|
|
51
|
-
command(content) { this.append('command', content); }
|
|
52
|
-
commandOutput(content) { this.append('notice', content); }
|
|
53
|
-
transcriptNotice(content, notify = true) { this.append('notice', content, undefined, undefined, undefined, undefined, notify); }
|
|
54
|
-
initializationNotice(key, content) {
|
|
55
|
-
if (this.initializationNotices.get(key) === content)
|
|
56
|
-
return;
|
|
57
|
-
this.initializationNotices.set(key, content);
|
|
58
|
-
this.transcriptNotice(content);
|
|
59
|
-
}
|
|
60
|
-
fileChange(change) { this.append('diff', change.path, undefined, change); }
|
|
61
|
-
notice(content) {
|
|
62
|
-
if (this.noticeTimer !== undefined)
|
|
63
|
-
clearTimeout(this.noticeTimer);
|
|
64
|
-
this.update({ footerNotice: content });
|
|
65
|
-
this.noticeTimer = setTimeout(() => {
|
|
66
|
-
this.noticeTimer = undefined;
|
|
67
|
-
this.update({ footerNotice: undefined });
|
|
68
|
-
}, 4000);
|
|
69
|
-
}
|
|
70
|
-
dispose() {
|
|
71
|
-
if (this.noticeTimer !== undefined)
|
|
72
|
-
clearTimeout(this.noticeTimer);
|
|
73
|
-
if (this.assistantFlushTimer !== undefined)
|
|
74
|
-
clearImmediate(this.assistantFlushTimer);
|
|
75
|
-
for (const timer of this.pendingActivityTimers.values())
|
|
76
|
-
clearImmediate(timer);
|
|
77
|
-
this.pendingActivityTimers.clear();
|
|
78
|
-
this.noticeTimer = undefined;
|
|
79
|
-
this.assistantFlushTimer = undefined;
|
|
80
|
-
this.resolveActiveModal(undefined);
|
|
81
|
-
this.initializationNotices.clear();
|
|
82
|
-
this.listeners.clear();
|
|
83
|
-
}
|
|
84
|
-
error(content) { this.append('error', content); }
|
|
85
|
-
subagentLifecycle(event) {
|
|
86
|
-
const deferRender = this.state.modal?.kind === 'subagent';
|
|
87
|
-
const existing = this.state.subagents.find((subagent) => subagent.id === event.id);
|
|
88
|
-
const subagent = {
|
|
89
|
-
id: event.id,
|
|
90
|
-
displayName: event.displayName,
|
|
91
|
-
task: event.task,
|
|
92
|
-
mode: event.mode,
|
|
93
|
-
model: event.model,
|
|
94
|
-
status: event.status,
|
|
95
|
-
background: event.background,
|
|
96
|
-
createdAt: existing?.createdAt ?? event.timestamp,
|
|
97
|
-
updatedAt: event.timestamp,
|
|
98
|
-
...(event.durationMs === undefined ? {} : { durationMs: event.durationMs }),
|
|
99
|
-
...(event.summary === undefined ? {} : { summary: event.summary }),
|
|
100
|
-
...(event.lastAction === undefined ? (existing?.lastAction === undefined ? {} : { lastAction: existing.lastAction }) : { lastAction: event.lastAction }),
|
|
101
|
-
...(event.handoff === undefined ? (existing?.handoff === undefined ? {} : { handoff: existing.handoff }) : { handoff: event.handoff }),
|
|
102
|
-
};
|
|
103
|
-
const subagents = existing === undefined
|
|
104
|
-
? [...this.state.subagents, subagent]
|
|
105
|
-
: this.state.subagents.map((candidate) => candidate.id === event.id ? subagent : candidate);
|
|
106
|
-
this.update({ subagents }, !deferRender);
|
|
107
|
-
if (event.type === 'created' && !this.state.messages.some((message) => message.kind === 'subagent' && message.subagent?.id === event.id)) {
|
|
108
|
-
this.append('subagent', event.id, undefined, undefined, undefined, subagent, !deferRender);
|
|
109
|
-
}
|
|
110
|
-
if ((event.type === 'completed' || event.type === 'failed' || event.type === 'cancelled') && event.summary !== undefined) {
|
|
111
|
-
this.transcriptNotice(`Agent ${event.displayName} ${event.status} · ${event.summary}`, !deferRender);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
startToolActivity(key, label, metadata) {
|
|
115
|
-
const existing = this.state.messages.find((message) => message.kind === 'activity' && (message.activity?.state === 'pending' || message.activity?.state === 'running') && message.content === key);
|
|
116
|
-
let id = existing?.id;
|
|
117
|
-
if (existing === undefined) {
|
|
118
|
-
const created = this.message('activity', key, undefined, undefined, { label, state: 'running', startedAt: Date.now(), ...metadata });
|
|
119
|
-
id = created.id;
|
|
120
|
-
this.update({ messages: [...this.state.messages, created] });
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
this.clearPendingActivityTimer(key);
|
|
124
|
-
this.updateActivity(existing.id, label, 'running', metadata);
|
|
125
|
-
}
|
|
126
|
-
return { complete: (isError) => this.completeToolActivity(id, isError) };
|
|
127
|
-
}
|
|
128
|
-
toolActivityStarted(key, label, metadata) {
|
|
129
|
-
const existing = this.state.messages.find((message) => message.kind === 'activity' && message.content === key && (message.activity?.state === 'pending' || message.activity?.state === 'running'));
|
|
130
|
-
if (existing !== undefined) {
|
|
131
|
-
this.updateActivity(existing.id, label, existing.activity?.state === 'pending' ? 'pending' : 'running', metadata);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const created = this.message('activity', key, undefined, undefined, { label, state: 'pending', startedAt: Date.now(), ...metadata });
|
|
135
|
-
this.update({ messages: [...this.state.messages, created] });
|
|
136
|
-
const timer = setImmediate(() => {
|
|
137
|
-
this.pendingActivityTimers.delete(key);
|
|
138
|
-
const pending = this.state.messages.find((message) => message.kind === 'activity' && message.content === key && message.activity?.state === 'pending');
|
|
139
|
-
if (pending !== undefined)
|
|
140
|
-
this.updateActivity(pending.id, label, 'running', metadata);
|
|
141
|
-
});
|
|
142
|
-
this.pendingActivityTimers.set(key, timer);
|
|
143
|
-
}
|
|
144
|
-
toolActivityCompleted(key, isError) {
|
|
145
|
-
this.clearPendingActivityTimer(key);
|
|
146
|
-
const message = this.state.messages.find((candidate) => candidate.kind === 'activity' && candidate.content === key && (candidate.activity?.state === 'pending' || candidate.activity?.state === 'running'));
|
|
147
|
-
if (message !== undefined)
|
|
148
|
-
this.completeToolActivity(message.id, isError);
|
|
149
|
-
}
|
|
150
|
-
status(label) { this.update({ status: label, activityStartedAt: Date.now(), elapsedMs: undefined, usage: undefined }); }
|
|
151
|
-
activity(label, elapsedMs, usage) { this.update({ status: label, ...(this.state.activityStartedAt === undefined ? { activityStartedAt: Date.now() - elapsedMs } : {}), elapsedMs, ...(usage === undefined ? {} : { usage }) }); }
|
|
152
|
-
clearActivity() { this.update({ status: undefined, activityStartedAt: undefined, elapsedMs: undefined, usage: undefined }); }
|
|
153
|
-
complete(elapsedMs, usage) { this.update({ status: 'Done', elapsedMs, ...(usage === undefined ? {} : { usage }) }); }
|
|
154
|
-
failed() { this.update({ status: 'Failed', elapsedMs: undefined, usage: undefined }); }
|
|
155
|
-
cancelled() { this.update({ status: 'Cancelled', elapsedMs: undefined, usage: undefined }); }
|
|
156
|
-
beginAssistant() { this.flushAssistant(); this.assistantSegmentPending = false; this.append('assistant', ''); }
|
|
157
|
-
/** Starts a new assistant segment after a host-owned action or approval boundary. */
|
|
158
|
-
assistantActionBoundary() { this.flushAssistant(); this.assistantSegmentPending = true; }
|
|
159
|
-
assistantDelta(content) {
|
|
160
|
-
if (this.assistantSegmentPending) {
|
|
161
|
-
this.assistantSegmentPending = false;
|
|
162
|
-
this.append('assistant', content);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const last = this.state.messages.at(-1);
|
|
166
|
-
if (last?.kind !== 'assistant') {
|
|
167
|
-
this.flushAssistant();
|
|
168
|
-
this.append('assistant', content);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const pending = this.pendingAssistant;
|
|
172
|
-
this.pendingAssistant = { id: last.id, content: `${pending?.id === last.id ? pending.content : last.content}${content}` };
|
|
173
|
-
if (this.assistantFlushTimer === undefined)
|
|
174
|
-
this.assistantFlushTimer = setImmediate(() => { this.assistantFlushTimer = undefined; this.flushAssistant(); });
|
|
175
|
-
}
|
|
176
|
-
finishAssistant() { this.flushAssistant(); this.assistantSegmentPending = false; }
|
|
177
|
-
confirmTrust() { return this.request({ kind: 'trust' }).then((value) => value === true); }
|
|
178
|
-
confirmPlan(plan) { return this.request({ kind: 'plan', plan }).then((value) => value === true); }
|
|
179
|
-
confirmTool(toolName, detail) {
|
|
180
|
-
return this.request({ kind: 'approval', toolName, ...(detail === undefined ? {} : { detail }) }).then((value) => value === 'allow' || value === true);
|
|
181
|
-
}
|
|
182
|
-
openSubagentDetails(id) {
|
|
183
|
-
if (this.state.modal !== undefined)
|
|
184
|
-
return;
|
|
185
|
-
const subagent = this.state.subagents.find((candidate) => candidate.id === id);
|
|
186
|
-
if (subagent !== undefined)
|
|
187
|
-
this.update({ modal: { kind: 'subagent', subagent } });
|
|
188
|
-
}
|
|
189
|
-
closeSubagentDetails() {
|
|
190
|
-
if (this.state.modal?.kind === 'subagent')
|
|
191
|
-
this.update({ modal: undefined });
|
|
192
|
-
}
|
|
193
|
-
selectModel(title, choices, currentValue) {
|
|
194
|
-
return this.selectChoice(title, choices, currentValue);
|
|
195
|
-
}
|
|
196
|
-
selectScope(title) {
|
|
197
|
-
return this.selectChoice(title, [
|
|
198
|
-
{ value: 'user', label: 'User', description: 'Available across your projects' },
|
|
199
|
-
{ value: 'project', label: 'Project', description: 'Stored in the trusted project' },
|
|
200
|
-
]).then((value) => value === 'user' || value === 'project' ? value : undefined);
|
|
201
|
-
}
|
|
202
|
-
requestSecret(label) { return this.request({ kind: 'secret', label }).then((value) => typeof value === 'string' ? value : undefined); }
|
|
203
|
-
resolveActiveModal(value) {
|
|
204
|
-
const resolve = this.resolveModal;
|
|
205
|
-
if (resolve === undefined)
|
|
206
|
-
return;
|
|
207
|
-
this.resolveModal = undefined;
|
|
208
|
-
this.update({ modal: undefined });
|
|
209
|
-
resolve?.(value);
|
|
210
|
-
}
|
|
211
|
-
request(modal) {
|
|
212
|
-
if (this.resolveModal !== undefined)
|
|
213
|
-
throw new Error('A TUI decision is already active.');
|
|
214
|
-
this.update({ modal });
|
|
215
|
-
return new Promise((resolve) => { this.resolveModal = resolve; });
|
|
216
|
-
}
|
|
217
|
-
selectChoice(title, choices, currentValue) {
|
|
218
|
-
return this.request({ kind: 'choice', title, choices, ...(currentValue === undefined ? {} : { currentValue }) }).then((value) => typeof value === 'string' ? value : undefined);
|
|
219
|
-
}
|
|
220
|
-
append(kind, content, attachments, fileChange, activity, subagent, notify = true) {
|
|
221
|
-
this.update({ messages: retainTranscriptMessages([...this.state.messages, this.message(kind, content, attachments, fileChange, activity, subagent)]) }, notify);
|
|
222
|
-
}
|
|
223
|
-
message(kind, content, attachments, fileChange, activity, subagent) {
|
|
224
|
-
return {
|
|
225
|
-
id: `tui-${++this.sequence}`,
|
|
226
|
-
kind,
|
|
227
|
-
content,
|
|
228
|
-
...(attachments === undefined || attachments.length === 0 ? {} : { attachments }),
|
|
229
|
-
...(fileChange === undefined ? {} : { fileChange }),
|
|
230
|
-
...(activity === undefined ? {} : { activity }),
|
|
231
|
-
...(subagent === undefined ? {} : { subagent }),
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
updateActivity(id, label, state, metadata) {
|
|
235
|
-
const messages = this.state.messages.map((message) => message.id === id && message.activity !== undefined
|
|
236
|
-
? { ...message, content: message.content, activity: { ...message.activity, label, state, ...metadata } }
|
|
237
|
-
: message);
|
|
238
|
-
this.update({ messages });
|
|
239
|
-
}
|
|
240
|
-
completeToolActivity(id, isError) {
|
|
241
|
-
const message = this.state.messages.find((candidate) => candidate.id === id && candidate.activity !== undefined);
|
|
242
|
-
if (message?.activity === undefined || (message.activity.state !== 'pending' && message.activity.state !== 'running'))
|
|
243
|
-
return;
|
|
244
|
-
this.update({ messages: this.state.messages.map((candidate) => candidate.id === id && candidate.activity !== undefined
|
|
245
|
-
? { ...candidate, activity: { ...candidate.activity, state: isError ? 'failed' : 'completed', elapsedMs: Date.now() - candidate.activity.startedAt } }
|
|
246
|
-
: candidate) });
|
|
247
|
-
}
|
|
248
|
-
clearPendingActivityTimer(key) {
|
|
249
|
-
const timer = this.pendingActivityTimers.get(key);
|
|
250
|
-
if (timer === undefined)
|
|
251
|
-
return;
|
|
252
|
-
clearImmediate(timer);
|
|
253
|
-
this.pendingActivityTimers.delete(key);
|
|
254
|
-
}
|
|
255
|
-
update(patch, notify = true) {
|
|
256
|
-
this.state = { ...this.state, ...patch };
|
|
257
|
-
if (!notify)
|
|
258
|
-
return;
|
|
259
|
-
for (const listener of this.listeners)
|
|
260
|
-
listener();
|
|
261
|
-
}
|
|
262
|
-
flushAssistant() {
|
|
263
|
-
if (this.assistantFlushTimer !== undefined) {
|
|
264
|
-
clearImmediate(this.assistantFlushTimer);
|
|
265
|
-
this.assistantFlushTimer = undefined;
|
|
266
|
-
}
|
|
267
|
-
const pending = this.pendingAssistant;
|
|
268
|
-
if (pending === undefined)
|
|
269
|
-
return;
|
|
270
|
-
this.pendingAssistant = undefined;
|
|
271
|
-
const index = this.state.messages.findIndex((message) => message.id === pending.id);
|
|
272
|
-
if (index < 0)
|
|
273
|
-
return;
|
|
274
|
-
const messages = [...this.state.messages];
|
|
275
|
-
const current = messages[index];
|
|
276
|
-
if (current === undefined || current.kind !== 'assistant')
|
|
277
|
-
return;
|
|
278
|
-
messages[index] = { ...current, content: pending.content };
|
|
279
|
-
this.update({ messages });
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
function retainTranscriptMessages(messages) {
|
|
283
|
-
if (messages.length <= RESOURCE_LIMITS.tuiTranscriptMessages)
|
|
284
|
-
return messages;
|
|
285
|
-
const active = messages.filter((message) => message.activity?.state === 'pending' || message.activity?.state === 'running' || message.subagent?.status === 'queued' || message.subagent?.status === 'running');
|
|
286
|
-
const recent = messages.slice(-RESOURCE_LIMITS.tuiTranscriptMessages);
|
|
287
|
-
const retained = [...active, ...recent.filter((message) => !active.some((candidate) => candidate.id === message.id))];
|
|
288
|
-
return retained.slice(-RESOURCE_LIMITS.tuiTranscriptMessages);
|
|
289
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Readable, Writable } from 'node:stream';
|
|
2
|
-
export interface TerminalOutput extends Writable {
|
|
3
|
-
isTTY?: boolean;
|
|
4
|
-
columns?: number;
|
|
5
|
-
rows?: number;
|
|
6
|
-
}
|
|
7
|
-
export interface TerminalCapabilities {
|
|
8
|
-
isInteractive: boolean;
|
|
9
|
-
colorEnabled: boolean;
|
|
10
|
-
unicodeEnabled: boolean;
|
|
11
|
-
width: number;
|
|
12
|
-
}
|
|
13
|
-
export declare function detectTerminalCapabilities(input: Readable & {
|
|
14
|
-
isTTY?: boolean;
|
|
15
|
-
}, output: TerminalOutput, env?: Readonly<Record<string, string | undefined>>): TerminalCapabilities;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export function detectTerminalCapabilities(input, output, env = process.env) {
|
|
2
|
-
const isInteractive = input.isTTY === true && output.isTTY === true;
|
|
3
|
-
const colorEnabled = isInteractive && env['NO_COLOR'] === undefined && env['TERM'] !== 'dumb';
|
|
4
|
-
const unicodeEnabled = env['LOTAGATE_ASCII'] !== '1';
|
|
5
|
-
const width = typeof output.columns === 'number' && output.columns > 0 ? output.columns : 80;
|
|
6
|
-
return { isInteractive, colorEnabled, unicodeEnabled, width };
|
|
7
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type MouseWheelDirection = 'up' | 'down';
|
|
2
|
-
/** Returns the wheel direction for an SGR mouse event, if the event is a wheel event. */
|
|
3
|
-
export declare function parseMouseWheel(input: string): MouseWheelDirection | undefined;
|
|
4
|
-
/** Identifies mouse escape sequences so they cannot be inserted into the prompt draft. */
|
|
5
|
-
export declare function isMouseSequence(input: string): boolean;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const ESC = String.fromCharCode(27);
|
|
2
|
-
const SGR_MOUSE_SEQUENCE = /^\[<(\d+);(\d+);(\d+)([mM])$/u;
|
|
3
|
-
/** Returns the wheel direction for an SGR mouse event, if the event is a wheel event. */
|
|
4
|
-
export function parseMouseWheel(input) {
|
|
5
|
-
const match = SGR_MOUSE_SEQUENCE.exec(stripEscape(input));
|
|
6
|
-
if (match === null)
|
|
7
|
-
return undefined;
|
|
8
|
-
const button = Number(match[1]);
|
|
9
|
-
if ((button & 64) === 0)
|
|
10
|
-
return undefined;
|
|
11
|
-
return (button & 1) === 0 ? 'up' : 'down';
|
|
12
|
-
}
|
|
13
|
-
/** Identifies mouse escape sequences so they cannot be inserted into the prompt draft. */
|
|
14
|
-
export function isMouseSequence(input) {
|
|
15
|
-
return /^\[<[0-9;]+[mM]$/u.test(stripEscape(input));
|
|
16
|
-
}
|
|
17
|
-
function stripEscape(input) {
|
|
18
|
-
return input.startsWith(ESC) ? input.slice(1) : input;
|
|
19
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { TerminalOutput } from './terminal-capabilities.js';
|
|
2
|
-
/** Starts the interactive application at the top of a clean terminal screen. */
|
|
3
|
-
export declare function clearTerminalScreen(output: TerminalOutput): void;
|
|
4
|
-
/**
|
|
5
|
-
* Isolates the interactive application from the invoking shell's scrollback.
|
|
6
|
-
* The terminal restores the original screen after the TUI has unmounted.
|
|
7
|
-
*/
|
|
8
|
-
export declare function enterInteractiveScreen(output: TerminalOutput): void;
|
|
9
|
-
/** Restores the shell screen that was active before the interactive TUI. */
|
|
10
|
-
export declare function exitInteractiveScreen(output: TerminalOutput): void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const CLEAR_SCREEN_AND_HOME = '\u001B[2J\u001B[H';
|
|
2
|
-
const ENTER_ALTERNATE_SCREEN = '\u001B[?1049h';
|
|
3
|
-
const EXIT_ALTERNATE_SCREEN = '\u001B[?1049l';
|
|
4
|
-
const ENABLE_SGR_MOUSE = '\u001B[?1000h\u001B[?1006h';
|
|
5
|
-
const DISABLE_SGR_MOUSE = '\u001B[?1006l\u001B[?1000l';
|
|
6
|
-
/** Starts the interactive application at the top of a clean terminal screen. */
|
|
7
|
-
export function clearTerminalScreen(output) {
|
|
8
|
-
output.write(CLEAR_SCREEN_AND_HOME);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Isolates the interactive application from the invoking shell's scrollback.
|
|
12
|
-
* The terminal restores the original screen after the TUI has unmounted.
|
|
13
|
-
*/
|
|
14
|
-
export function enterInteractiveScreen(output) {
|
|
15
|
-
output.write(ENTER_ALTERNATE_SCREEN);
|
|
16
|
-
clearTerminalScreen(output);
|
|
17
|
-
output.write(ENABLE_SGR_MOUSE);
|
|
18
|
-
}
|
|
19
|
-
/** Restores the shell screen that was active before the interactive TUI. */
|
|
20
|
-
export function exitInteractiveScreen(output) {
|
|
21
|
-
output.write(DISABLE_SGR_MOUSE);
|
|
22
|
-
output.write(EXIT_ALTERNATE_SCREEN);
|
|
23
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { PreparedCliAgent } from '../../application/agent/cli-agent-execution-service.js';
|
|
2
|
-
import type { AgentRunTracker } from '../../application/agent/agent-run-tracker.js';
|
|
3
|
-
import type { CliRuntime } from '../../bootstrap/runtime-factory.js';
|
|
4
|
-
import type { ChatUsage } from '../../ports/chat-model.js';
|
|
5
|
-
import type { InkTuiBridge } from './ink/tui-bridge.js';
|
|
6
|
-
import type { CliAgentSessionStore } from '../../application/agent/agent-session-store.js';
|
|
7
|
-
export interface TuiAgentEventRunnerOptions {
|
|
8
|
-
prepared: PreparedCliAgent;
|
|
9
|
-
input: string;
|
|
10
|
-
model: string;
|
|
11
|
-
sessionId?: string;
|
|
12
|
-
turnId?: string;
|
|
13
|
-
signal: AbortSignal;
|
|
14
|
-
agentSessionStore: CliAgentSessionStore;
|
|
15
|
-
tracker: AgentRunTracker;
|
|
16
|
-
runtime: CliRuntime;
|
|
17
|
-
renderer: InkTuiBridge;
|
|
18
|
-
startedAt: number;
|
|
19
|
-
getUsage: () => ChatUsage | undefined;
|
|
20
|
-
appendAssistantDelta: (content: string) => void;
|
|
21
|
-
hasResponse: () => boolean;
|
|
22
|
-
}
|
|
23
|
-
/** Owns the CLI projection of the Agent SDK event stream for interactive runs. */
|
|
24
|
-
export declare function runTuiAgentEvents(options: TuiAgentEventRunnerOptions): Promise<void>;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { CliTurnEventProjector } from '../../application/orchestration/cli-turn-event-projector.js';
|
|
2
|
-
import { persistCliTurnEvent } from '../../application/orchestration/cli-turn-persistence.js';
|
|
3
|
-
import { persistContextCompaction } from '../../application/agent/context-compaction-persistence.js';
|
|
4
|
-
import { renderAgentInitialization } from './agent-initialization-renderer.js';
|
|
5
|
-
import { throwIfAborted } from './tui-lifecycle-actions.js';
|
|
6
|
-
import { agentLimitNotice, classifyAgentLimit } from '../../application/agent/agent-limit.js';
|
|
7
|
-
/** Owns the CLI projection of the Agent SDK event stream for interactive runs. */
|
|
8
|
-
export async function runTuiAgentEvents(options) {
|
|
9
|
-
const projector = new CliTurnEventProjector();
|
|
10
|
-
renderAgentInitialization(options.renderer, await options.prepared.agent.initialize());
|
|
11
|
-
if (options.sessionId !== undefined) {
|
|
12
|
-
const history = await options.runtime.sessionStore.readHistory(options.sessionId);
|
|
13
|
-
options.agentSessionStore.hydrate(options.sessionId, options.prepared.system, history.transcript, history.events, options.input);
|
|
14
|
-
}
|
|
15
|
-
for await (const event of options.prepared.run({ input: options.input, model: options.model, ...(options.sessionId === undefined ? {} : { sessionId: options.sessionId }), signal: options.signal })) {
|
|
16
|
-
throwIfAborted(options.signal);
|
|
17
|
-
options.tracker.observe(event);
|
|
18
|
-
for (const item of projector.observe(event)) {
|
|
19
|
-
if (options.sessionId !== undefined) {
|
|
20
|
-
try {
|
|
21
|
-
await persistCliTurnEvent(options.runtime.sessionStore, options.sessionId, item, { ...(options.turnId === undefined ? {} : { turnId: options.turnId }) });
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
options.runtime.logger.warn('Unable to persist agent lifecycle event.', { eventType: item.type, reason: error instanceof Error ? error.message : String(error) });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (item.type === 'assistant.delta')
|
|
28
|
-
options.appendAssistantDelta(item.content);
|
|
29
|
-
if (item.type === 'assistant.segment.completed')
|
|
30
|
-
options.renderer.assistantActionBoundary();
|
|
31
|
-
if (item.type === 'action.approval_requested') {
|
|
32
|
-
options.renderer.assistantActionBoundary();
|
|
33
|
-
options.renderer.status('Waiting for approval');
|
|
34
|
-
}
|
|
35
|
-
if (item.type === 'action.started') {
|
|
36
|
-
options.renderer.assistantActionBoundary();
|
|
37
|
-
options.runtime.logger.info('Agent tool called.', { toolName: item.toolName, actionId: item.actionId });
|
|
38
|
-
if (item.toolName !== 'agent.spawn')
|
|
39
|
-
options.renderer.toolActivityStarted(item.actionId, item.displayName, { toolName: item.toolName, kind: item.kind });
|
|
40
|
-
}
|
|
41
|
-
if (item.type === 'action.completed') {
|
|
42
|
-
options.runtime.logger.info('Agent tool completed.', { toolName: item.toolName, actionId: item.actionId, isError: item.isError });
|
|
43
|
-
options.renderer.toolActivityCompleted(item.actionId, item.isError);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (event.type === 'context.compacted') {
|
|
47
|
-
if (options.sessionId !== undefined)
|
|
48
|
-
await persistContextCompaction(options.runtime, options.prepared, options.sessionId, event.metrics, options.turnId);
|
|
49
|
-
options.renderer.transcriptNotice('Context compacted automatically.');
|
|
50
|
-
options.renderer.activity('Thinking', Date.now() - options.startedAt, options.getUsage());
|
|
51
|
-
}
|
|
52
|
-
if (event.type === 'session.failed') {
|
|
53
|
-
const limitReason = classifyAgentLimit(event.error);
|
|
54
|
-
if (limitReason === undefined)
|
|
55
|
-
throw event.error;
|
|
56
|
-
options.tracker.markStuck();
|
|
57
|
-
if (options.sessionId !== undefined)
|
|
58
|
-
options.agentSessionStore.delete(options.sessionId);
|
|
59
|
-
const notice = agentLimitNotice(limitReason);
|
|
60
|
-
if (options.hasResponse())
|
|
61
|
-
options.renderer.notice(notice);
|
|
62
|
-
else
|
|
63
|
-
options.appendAssistantDelta(notice);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (event.type === 'session.completed' && !options.hasResponse())
|
|
67
|
-
options.appendAssistantDelta(event.content);
|
|
68
|
-
}
|
|
69
|
-
}
|