@lotagate/cli 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/scripts/install-native.mjs +11 -11
- package/dist/application/agent/agent-history.d.ts +0 -3
- package/dist/application/agent/agent-history.js +0 -81
- package/dist/application/agent/agent-input-context.d.ts +0 -9
- package/dist/application/agent/agent-input-context.js +0 -12
- package/dist/application/agent/agent-limit.d.ts +0 -3
- package/dist/application/agent/agent-limit.js +0 -12
- package/dist/application/agent/agent-run-tracker.d.ts +0 -30
- package/dist/application/agent/agent-run-tracker.js +0 -68
- package/dist/application/agent/agent-session-store.d.ts +0 -19
- package/dist/application/agent/agent-session-store.js +0 -74
- package/dist/application/agent/capability-profile.d.ts +0 -37
- package/dist/application/agent/capability-profile.js +0 -13
- package/dist/application/agent/cli-agent-execution-service.d.ts +0 -81
- package/dist/application/agent/cli-agent-execution-service.js +0 -279
- package/dist/application/agent/context-compaction-persistence.d.ts +0 -8
- package/dist/application/agent/context-compaction-persistence.js +0 -27
- package/dist/application/agent/context-compaction.d.ts +0 -20
- package/dist/application/agent/context-compaction.js +0 -114
- package/dist/application/agent/prompt-data-safety.d.ts +0 -14
- package/dist/application/agent/prompt-data-safety.js +0 -38
- package/dist/application/agent/safe-system-prompt.d.ts +0 -3
- package/dist/application/agent/safe-system-prompt.js +0 -19
- package/dist/application/agent/scoped-tool-executor.d.ts +0 -13
- package/dist/application/agent/scoped-tool-executor.js +0 -32
- package/dist/application/agent/system-prompt-builder.d.ts +0 -14
- package/dist/application/agent/system-prompt-builder.js +0 -199
- package/dist/application/agent/tool-catalog.d.ts +0 -14
- package/dist/application/agent/tool-catalog.js +0 -30
- package/dist/application/agent/tool-display.d.ts +0 -6
- package/dist/application/agent/tool-display.js +0 -59
- package/dist/application/agent/tool-hook-lifecycle.d.ts +0 -19
- package/dist/application/agent/tool-hook-lifecycle.js +0 -85
- package/dist/application/auth/authentication-service.d.ts +0 -20
- package/dist/application/auth/authentication-service.js +0 -44
- package/dist/application/chat/chat-service.d.ts +0 -12
- package/dist/application/chat/chat-service.js +0 -19
- package/dist/application/chat/pending-attachment-store.d.ts +0 -12
- package/dist/application/chat/pending-attachment-store.js +0 -28
- package/dist/application/commands/application-command-executor.d.ts +0 -20
- package/dist/application/commands/application-command-executor.js +0 -66
- package/dist/application/commands/cli-args.d.ts +0 -6
- package/dist/application/commands/cli-args.js +0 -43
- package/dist/application/commands/cli-command-services.d.ts +0 -16
- package/dist/application/commands/cli-command-services.js +0 -405
- package/dist/application/commands/command-catalog.d.ts +0 -6
- package/dist/application/commands/command-catalog.js +0 -159
- package/dist/application/commands/command-contract.d.ts +0 -58
- package/dist/application/commands/command-contract.js +0 -1
- package/dist/application/commands/command-hints.d.ts +0 -9
- package/dist/application/commands/command-hints.js +0 -17
- package/dist/application/commands/command-output.d.ts +0 -4
- package/dist/application/commands/command-output.js +0 -1
- package/dist/application/commands/command-parser.d.ts +0 -10
- package/dist/application/commands/command-parser.js +0 -155
- package/dist/application/commands/command-presentation.d.ts +0 -7
- package/dist/application/commands/command-presentation.js +0 -131
- package/dist/application/commands/command-registry.d.ts +0 -11
- package/dist/application/commands/command-registry.js +0 -64
- package/dist/application/commands/command-runtime.d.ts +0 -2
- package/dist/application/commands/command-runtime.js +0 -3
- package/dist/application/commands/goal-command-handlers.d.ts +0 -3
- package/dist/application/commands/goal-command-handlers.js +0 -120
- package/dist/application/commands/media-command-handlers.d.ts +0 -9
- package/dist/application/commands/media-command-handlers.js +0 -307
- package/dist/application/commands/media-command-output.d.ts +0 -11
- package/dist/application/commands/media-command-output.js +0 -8
- package/dist/application/commands/runtime-command-handlers.d.ts +0 -7
- package/dist/application/commands/runtime-command-handlers.js +0 -177
- package/dist/application/commands/stream-output.d.ts +0 -4
- package/dist/application/commands/stream-output.js +0 -10
- package/dist/application/commands/utility-commands.d.ts +0 -6
- package/dist/application/commands/utility-commands.js +0 -81
- package/dist/application/config/execution-config.d.ts +0 -4
- package/dist/application/config/execution-config.js +0 -6
- package/dist/application/extensions/extension-list-contract.d.ts +0 -13
- package/dist/application/extensions/extension-list-contract.js +0 -1
- package/dist/application/extensions/extension-list-formatters.d.ts +0 -31
- package/dist/application/extensions/extension-list-formatters.js +0 -98
- package/dist/application/extensions/extension-list-output.d.ts +0 -3
- package/dist/application/extensions/extension-list-output.js +0 -7
- package/dist/application/extensions/plugin-contribution-registry.d.ts +0 -15
- package/dist/application/extensions/plugin-contribution-registry.js +0 -80
- package/dist/application/extensions/skill-scope-store.d.ts +0 -23
- package/dist/application/extensions/skill-scope-store.js +0 -33
- package/dist/application/formatting/compact-number.d.ts +0 -2
- package/dist/application/formatting/compact-number.js +0 -18
- package/dist/application/formatting/compact-table.d.ts +0 -22
- package/dist/application/formatting/compact-table.js +0 -49
- package/dist/application/media/video-operation-poller.d.ts +0 -5
- package/dist/application/media/video-operation-poller.js +0 -42
- package/dist/application/model/cached-model-catalog.d.ts +0 -13
- package/dist/application/model/cached-model-catalog.js +0 -31
- package/dist/application/model/initial-model-selection.d.ts +0 -10
- package/dist/application/model/initial-model-selection.js +0 -11
- package/dist/application/model/model-catalog-service.d.ts +0 -6
- package/dist/application/model/model-catalog-service.js +0 -13
- package/dist/application/model/model-context-window.d.ts +0 -3
- package/dist/application/model/model-context-window.js +0 -23
- package/dist/application/orchestration/cli-subagent-service.d.ts +0 -70
- package/dist/application/orchestration/cli-subagent-service.js +0 -328
- package/dist/application/orchestration/cli-turn-event-projector.d.ts +0 -12
- package/dist/application/orchestration/cli-turn-event-projector.js +0 -81
- package/dist/application/orchestration/cli-turn-events.d.ts +0 -76
- package/dist/application/orchestration/cli-turn-events.js +0 -39
- package/dist/application/orchestration/cli-turn-persistence.d.ts +0 -6
- package/dist/application/orchestration/cli-turn-persistence.js +0 -14
- package/dist/application/orchestration/goal-evaluator.d.ts +0 -18
- package/dist/application/orchestration/goal-evaluator.js +0 -88
- package/dist/application/orchestration/goal-input.d.ts +0 -3
- package/dist/application/orchestration/goal-input.js +0 -19
- package/dist/application/orchestration/goal-output.d.ts +0 -2
- package/dist/application/orchestration/goal-output.js +0 -11
- package/dist/application/orchestration/goal-runner.d.ts +0 -22
- package/dist/application/orchestration/goal-runner.js +0 -153
- package/dist/application/orchestration/goal-usage.d.ts +0 -9
- package/dist/application/orchestration/goal-usage.js +0 -19
- package/dist/application/orchestration/headless-agent-turn.d.ts +0 -32
- package/dist/application/orchestration/headless-agent-turn.js +0 -82
- package/dist/application/orchestration/plan-generator.d.ts +0 -7
- package/dist/application/orchestration/plan-generator.js +0 -34
- package/dist/application/orchestration/subagent-coordinator.d.ts +0 -33
- package/dist/application/orchestration/subagent-coordinator.js +0 -28
- package/dist/application/orchestration/subagent-handoff.d.ts +0 -2
- package/dist/application/orchestration/subagent-handoff.js +0 -68
- package/dist/application/orchestration/subagent-tool-executor.d.ts +0 -12
- package/dist/application/orchestration/subagent-tool-executor.js +0 -93
- package/dist/application/orchestration/task-assessment.d.ts +0 -4
- package/dist/application/orchestration/task-assessment.js +0 -35
- package/dist/application/orchestration/task-graph.d.ts +0 -13
- package/dist/application/orchestration/task-graph.js +0 -56
- package/dist/application/orchestration/task-scheduler.d.ts +0 -18
- package/dist/application/orchestration/task-scheduler.js +0 -88
- package/dist/application/project/project-trust-service.d.ts +0 -13
- package/dist/application/project/project-trust-service.js +0 -74
- package/dist/application/protocol/browser-host-tool-executor.d.ts +0 -41
- package/dist/application/protocol/browser-host-tool-executor.js +0 -88
- package/dist/application/protocol/desktop-agent-command.d.ts +0 -9
- package/dist/application/protocol/desktop-agent-command.js +0 -663
- package/dist/application/protocol/desktop-attachment-store.d.ts +0 -16
- package/dist/application/protocol/desktop-attachment-store.js +0 -82
- package/dist/application/protocol/desktop-command-catalog.d.ts +0 -2
- package/dist/application/protocol/desktop-command-catalog.js +0 -19
- package/dist/application/protocol/desktop-command-contract.d.ts +0 -22
- package/dist/application/protocol/desktop-command-contract.js +0 -3
- package/dist/application/protocol/desktop-command-executor.d.ts +0 -16
- package/dist/application/protocol/desktop-command-executor.js +0 -47
- package/dist/application/protocol/desktop-command-output.d.ts +0 -15
- package/dist/application/protocol/desktop-command-output.js +0 -24
- package/dist/application/protocol/desktop-execution-policy.d.ts +0 -17
- package/dist/application/protocol/desktop-execution-policy.js +0 -49
- package/dist/application/protocol/desktop-host-tool-executor.d.ts +0 -57
- package/dist/application/protocol/desktop-host-tool-executor.js +0 -53
- package/dist/application/protocol/desktop-orchestration-events.d.ts +0 -5
- package/dist/application/protocol/desktop-orchestration-events.js +0 -37
- package/dist/application/protocol/json-line-writer.d.ts +0 -9
- package/dist/application/protocol/json-line-writer.js +0 -19
- package/dist/application/protocol/jsonl-agent-command.d.ts +0 -3
- package/dist/application/protocol/jsonl-agent-command.js +0 -97
- package/dist/application/protocol/jsonl-protocol.d.ts +0 -52
- package/dist/application/protocol/jsonl-protocol.js +0 -170
- package/dist/application/security/desktop-tool-scope-policy.d.ts +0 -3
- package/dist/application/security/desktop-tool-scope-policy.js +0 -52
- package/dist/application/security/tool-action-risk-analyzer.d.ts +0 -13
- package/dist/application/security/tool-action-risk-analyzer.js +0 -64
- package/dist/application/security/tool-approval-service.d.ts +0 -35
- package/dist/application/security/tool-approval-service.js +0 -97
- package/dist/application/security/tool-risk-classifier.d.ts +0 -11
- package/dist/application/security/tool-risk-classifier.js +0 -65
- package/dist/application/security/workspace-permission-policy.d.ts +0 -10
- package/dist/application/security/workspace-permission-policy.js +0 -50
- package/dist/application/session/project-session-access.d.ts +0 -8
- package/dist/application/session/project-session-access.js +0 -19
- package/dist/application/session/session-compaction-service.d.ts +0 -10
- package/dist/application/session/session-compaction-service.js +0 -43
- package/dist/application/session/session-turn-lifecycle.d.ts +0 -5
- package/dist/application/session/session-turn-lifecycle.js +0 -31
- package/dist/application/workspace/workspace-file-index.d.ts +0 -15
- package/dist/application/workspace/workspace-file-index.js +0 -60
- package/dist/application/workspace/workspace-file-reference-resolver.d.ts +0 -14
- package/dist/application/workspace/workspace-file-reference-resolver.js +0 -123
- package/dist/application/workspace/workspace-instruction-loader.d.ts +0 -8
- package/dist/application/workspace/workspace-instruction-loader.js +0 -55
- package/dist/bootstrap/composition-root.d.ts +0 -6
- package/dist/bootstrap/composition-root.js +0 -4
- package/dist/bootstrap/global-cli-options.d.ts +0 -6
- package/dist/bootstrap/global-cli-options.js +0 -29
- package/dist/bootstrap/native-devtools-stub.d.ts +0 -10
- package/dist/bootstrap/native-devtools-stub.js +0 -10
- package/dist/bootstrap/native-entry.d.ts +0 -1
- package/dist/bootstrap/native-entry.js +0 -6
- package/dist/bootstrap/native-tiktoken.d.ts +0 -4
- package/dist/bootstrap/native-tiktoken.js +0 -5
- package/dist/bootstrap/runtime-factory.d.ts +0 -35
- package/dist/bootstrap/runtime-factory.js +0 -44
- package/dist/bootstrap/shutdown-manager.d.ts +0 -10
- package/dist/bootstrap/shutdown-manager.js +0 -14
- package/dist/bootstrap/startup-sequence.d.ts +0 -5
- package/dist/bootstrap/startup-sequence.js +0 -10
- package/dist/domain/auth/auth-profile.d.ts +0 -14
- package/dist/domain/auth/auth-profile.js +0 -39
- package/dist/domain/config/config-schema.d.ts +0 -17
- package/dist/domain/config/config-schema.js +0 -105
- package/dist/domain/errors/cli-command-hint.d.ts +0 -5
- package/dist/domain/errors/cli-command-hint.js +0 -1
- package/dist/domain/errors/cli-error.d.ts +0 -35
- package/dist/domain/errors/cli-error.js +0 -129
- package/dist/domain/errors/error-codes.d.ts +0 -46
- package/dist/domain/errors/error-codes.js +0 -45
- package/dist/domain/extensions/extension-scope.d.ts +0 -3
- package/dist/domain/extensions/extension-scope.js +0 -23
- package/dist/domain/extensions/extension-state.d.ts +0 -5
- package/dist/domain/extensions/extension-state.js +0 -11
- package/dist/domain/extensions/hook-manifest.d.ts +0 -10
- package/dist/domain/extensions/hook-manifest.js +0 -23
- package/dist/domain/extensions/mcp-config.d.ts +0 -18
- package/dist/domain/extensions/mcp-config.js +0 -111
- package/dist/domain/extensions/plugin-manifest.d.ts +0 -11
- package/dist/domain/extensions/plugin-manifest.js +0 -43
- package/dist/domain/extensions/skill-manifest.d.ts +0 -10
- package/dist/domain/extensions/skill-manifest.js +0 -51
- package/dist/domain/filesystem/file-change-diff.d.ts +0 -21
- package/dist/domain/filesystem/file-change-diff.js +0 -60
- package/dist/domain/media/gateway-media-contract.d.ts +0 -23
- package/dist/domain/media/gateway-media-contract.js +0 -163
- package/dist/domain/media/media-contract.d.ts +0 -28
- package/dist/domain/media/media-contract.js +0 -1
- package/dist/domain/media/media-execution-policy.d.ts +0 -9
- package/dist/domain/media/media-execution-policy.js +0 -31
- package/dist/domain/orchestration/goal.d.ts +0 -58
- package/dist/domain/orchestration/goal.js +0 -113
- package/dist/domain/orchestration/subagent-identity.d.ts +0 -2
- package/dist/domain/orchestration/subagent-identity.js +0 -8
- package/dist/domain/orchestration/subagent.d.ts +0 -33
- package/dist/domain/orchestration/subagent.js +0 -1
- package/dist/domain/orchestration/task.d.ts +0 -31
- package/dist/domain/orchestration/task.js +0 -1
- package/dist/domain/project/project-identity.d.ts +0 -6
- package/dist/domain/project/project-identity.js +0 -4
- package/dist/domain/runtime/assistant-delta-normalizer.d.ts +0 -11
- package/dist/domain/runtime/assistant-delta-normalizer.js +0 -19
- package/dist/domain/runtime/resource-limits.d.ts +0 -60
- package/dist/domain/runtime/resource-limits.js +0 -60
- package/dist/domain/session/attachment.d.ts +0 -13
- package/dist/domain/session/attachment.js +0 -1
- package/dist/domain/session/session-schema.d.ts +0 -6
- package/dist/domain/session/session-schema.js +0 -28
- package/dist/domain/session/session.d.ts +0 -27
- package/dist/domain/session/session.js +0 -1
- package/dist/domain/settings/settings-document.d.ts +0 -8
- package/dist/domain/settings/settings-document.js +0 -36
- package/dist/domain/validation/record-schema.d.ts +0 -4
- package/dist/domain/validation/record-schema.js +0 -9
- package/dist/domain/workspace/workspace-settings.d.ts +0 -12
- package/dist/domain/workspace/workspace-settings.js +0 -44
- package/dist/infrastructure/agent-sdk/agent-instance-factory.d.ts +0 -22
- package/dist/infrastructure/agent-sdk/agent-instance-factory.js +0 -31
- package/dist/infrastructure/agent-sdk/tool-calling-model-client.d.ts +0 -11
- package/dist/infrastructure/agent-sdk/tool-calling-model-client.js +0 -447
- package/dist/infrastructure/cache/cache-policy.d.ts +0 -7
- package/dist/infrastructure/cache/cache-policy.js +0 -18
- package/dist/infrastructure/cache/file-cache-store.d.ts +0 -17
- package/dist/infrastructure/cache/file-cache-store.js +0 -121
- package/dist/infrastructure/clipboard/clipboard-adapter-factory.d.ts +0 -11
- package/dist/infrastructure/clipboard/clipboard-adapter-factory.js +0 -98
- package/dist/infrastructure/clipboard/clipboard-policy.d.ts +0 -8
- package/dist/infrastructure/clipboard/clipboard-policy.js +0 -19
- package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.d.ts +0 -10
- package/dist/infrastructure/clipboard/clipboard-text-adapter-factory.js +0 -94
- package/dist/infrastructure/clipboard/image-normalizer.d.ts +0 -12
- package/dist/infrastructure/clipboard/image-normalizer.js +0 -78
- package/dist/infrastructure/clipboard/windows-clipboard-adapter.d.ts +0 -7
- package/dist/infrastructure/clipboard/windows-clipboard-adapter.js +0 -66
- package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.d.ts +0 -7
- package/dist/infrastructure/clipboard/windows-clipboard-text-adapter.js +0 -70
- package/dist/infrastructure/config/config-loader.d.ts +0 -19
- package/dist/infrastructure/config/config-loader.js +0 -76
- package/dist/infrastructure/config/environment-values.d.ts +0 -2
- package/dist/infrastructure/config/environment-values.js +0 -7
- package/dist/infrastructure/credentials/composite-credential-store.d.ts +0 -11
- package/dist/infrastructure/credentials/composite-credential-store.js +0 -32
- package/dist/infrastructure/credentials/encrypted-file-credential-store.d.ts +0 -17
- package/dist/infrastructure/credentials/encrypted-file-credential-store.js +0 -181
- package/dist/infrastructure/credentials/environment-credential-store.d.ts +0 -11
- package/dist/infrastructure/credentials/environment-credential-store.js +0 -37
- package/dist/infrastructure/credentials/secret-input.d.ts +0 -7
- package/dist/infrastructure/credentials/secret-input.js +0 -44
- package/dist/infrastructure/extensions/composite-mcp-config-store.d.ts +0 -9
- package/dist/infrastructure/extensions/composite-mcp-config-store.js +0 -10
- package/dist/infrastructure/extensions/extension-directory-reader.d.ts +0 -2
- package/dist/infrastructure/extensions/extension-directory-reader.js +0 -15
- package/dist/infrastructure/extensions/extension-source-resolver.d.ts +0 -6
- package/dist/infrastructure/extensions/extension-source-resolver.js +0 -126
- package/dist/infrastructure/extensions/file-mcp-config-store.d.ts +0 -15
- package/dist/infrastructure/extensions/file-mcp-config-store.js +0 -66
- package/dist/infrastructure/extensions/hook-runtime.d.ts +0 -18
- package/dist/infrastructure/extensions/hook-runtime.js +0 -66
- package/dist/infrastructure/extensions/mcp-runtime.d.ts +0 -12
- package/dist/infrastructure/extensions/mcp-runtime.js +0 -52
- package/dist/infrastructure/extensions/plugin-discovery.d.ts +0 -5
- package/dist/infrastructure/extensions/plugin-discovery.js +0 -52
- package/dist/infrastructure/extensions/plugin-manager.d.ts +0 -26
- package/dist/infrastructure/extensions/plugin-manager.js +0 -139
- package/dist/infrastructure/extensions/skill-discovery.d.ts +0 -4
- package/dist/infrastructure/extensions/skill-discovery.js +0 -29
- package/dist/infrastructure/extensions/skill-installer.d.ts +0 -8
- package/dist/infrastructure/extensions/skill-installer.js +0 -88
- package/dist/infrastructure/extensions/skill-manager.d.ts +0 -22
- package/dist/infrastructure/extensions/skill-manager.js +0 -67
- package/dist/infrastructure/extensions/skill-roots.d.ts +0 -19
- package/dist/infrastructure/extensions/skill-roots.js +0 -25
- package/dist/infrastructure/extensions/skill-tool-executor.d.ts +0 -18
- package/dist/infrastructure/extensions/skill-tool-executor.js +0 -53
- package/dist/infrastructure/filesystem/atomic-file-store.d.ts +0 -12
- package/dist/infrastructure/filesystem/atomic-file-store.js +0 -106
- package/dist/infrastructure/filesystem/bounded-file-reader.d.ts +0 -6
- package/dist/infrastructure/filesystem/bounded-file-reader.js +0 -24
- package/dist/infrastructure/filesystem/bounded-json-reader.d.ts +0 -1
- package/dist/infrastructure/filesystem/bounded-json-reader.js +0 -7
- package/dist/infrastructure/filesystem/fs-errors.d.ts +0 -2
- package/dist/infrastructure/filesystem/fs-errors.js +0 -6
- package/dist/infrastructure/filesystem/gateway-media-input-reader.d.ts +0 -12
- package/dist/infrastructure/filesystem/gateway-media-input-reader.js +0 -49
- package/dist/infrastructure/filesystem/local-filesystem-tool-executor.d.ts +0 -21
- package/dist/infrastructure/filesystem/local-filesystem-tool-executor.js +0 -176
- package/dist/infrastructure/filesystem/path-resolver.d.ts +0 -20
- package/dist/infrastructure/filesystem/path-resolver.js +0 -119
- package/dist/infrastructure/filesystem/workspace-media-artifact-store.d.ts +0 -13
- package/dist/infrastructure/filesystem/workspace-media-artifact-store.js +0 -152
- package/dist/infrastructure/logging/daily-rotating-file-writer.d.ts +0 -20
- package/dist/infrastructure/logging/daily-rotating-file-writer.js +0 -75
- package/dist/infrastructure/logging/log-redactor.d.ts +0 -2
- package/dist/infrastructure/logging/log-redactor.js +0 -26
- package/dist/infrastructure/logging/logging-policy.d.ts +0 -6
- package/dist/infrastructure/logging/logging-policy.js +0 -6
- package/dist/infrastructure/logging/structured-logger.d.ts +0 -24
- package/dist/infrastructure/logging/structured-logger.js +0 -40
- package/dist/infrastructure/network/safe-media-downloader.d.ts +0 -23
- package/dist/infrastructure/network/safe-media-downloader.js +0 -239
- package/dist/infrastructure/platform/host-platform.d.ts +0 -14
- package/dist/infrastructure/platform/host-platform.js +0 -23
- package/dist/infrastructure/platform/host-process.d.ts +0 -17
- package/dist/infrastructure/platform/host-process.js +0 -116
- package/dist/infrastructure/platform/platform-paths.d.ts +0 -25
- package/dist/infrastructure/platform/platform-paths.js +0 -33
- package/dist/infrastructure/project/file-project-trust-store.d.ts +0 -12
- package/dist/infrastructure/project/file-project-trust-store.js +0 -59
- package/dist/infrastructure/sdk/chat-completion-adapter.d.ts +0 -8
- package/dist/infrastructure/sdk/chat-completion-adapter.js +0 -115
- package/dist/infrastructure/sdk/lotagate-client-factory.d.ts +0 -3
- package/dist/infrastructure/sdk/lotagate-client-factory.js +0 -8
- package/dist/infrastructure/sdk/model-catalog-adapter.d.ts +0 -19
- package/dist/infrastructure/sdk/model-catalog-adapter.js +0 -28
- package/dist/infrastructure/sdk/sdk-media-gateway-client.d.ts +0 -20
- package/dist/infrastructure/sdk/sdk-media-gateway-client.js +0 -97
- package/dist/infrastructure/sessions/file-goal-store.d.ts +0 -21
- package/dist/infrastructure/sessions/file-goal-store.js +0 -160
- package/dist/infrastructure/sessions/file-session-store.d.ts +0 -48
- package/dist/infrastructure/sessions/file-session-store.js +0 -525
- package/dist/infrastructure/sessions/project-session-paths.d.ts +0 -17
- package/dist/infrastructure/sessions/project-session-paths.js +0 -41
- package/dist/infrastructure/sessions/session-index.d.ts +0 -16
- package/dist/infrastructure/sessions/session-index.js +0 -84
- package/dist/infrastructure/sessions/session-journal.d.ts +0 -22
- package/dist/infrastructure/sessions/session-journal.js +0 -137
- package/dist/infrastructure/sessions/subagent-journal-store.d.ts +0 -28
- package/dist/infrastructure/sessions/subagent-journal-store.js +0 -30
- package/dist/infrastructure/shell/shell-tool-executor.d.ts +0 -17
- package/dist/infrastructure/shell/shell-tool-executor.js +0 -115
- package/dist/infrastructure/tokens/tiktoken-token-estimator.d.ts +0 -18
- package/dist/infrastructure/tokens/tiktoken-token-estimator.js +0 -48
- package/dist/infrastructure/workspace/workspace-settings-store.d.ts +0 -9
- package/dist/infrastructure/workspace/workspace-settings-store.js +0 -75
- package/dist/main.d.ts +0 -7
- package/dist/main.js +0 -66
- package/dist/ports/cache-store.d.ts +0 -10
- package/dist/ports/cache-store.js +0 -1
- package/dist/ports/chat-model.d.ts +0 -30
- package/dist/ports/chat-model.js +0 -1
- package/dist/ports/clipboard-adapter.d.ts +0 -7
- package/dist/ports/clipboard-adapter.js +0 -1
- package/dist/ports/clipboard-text-adapter.d.ts +0 -3
- package/dist/ports/clipboard-text-adapter.js +0 -1
- package/dist/ports/credential-store.d.ts +0 -7
- package/dist/ports/credential-store.js +0 -1
- package/dist/ports/goal-store.d.ts +0 -12
- package/dist/ports/goal-store.js +0 -1
- package/dist/ports/logger.d.ts +0 -8
- package/dist/ports/logger.js +0 -1
- package/dist/ports/media-gateway-client.d.ts +0 -54
- package/dist/ports/media-gateway-client.js +0 -1
- package/dist/ports/model-diagnostics.d.ts +0 -17
- package/dist/ports/model-diagnostics.js +0 -1
- package/dist/ports/project-trust-store.d.ts +0 -12
- package/dist/ports/project-trust-store.js +0 -1
- package/dist/ports/session-store.d.ts +0 -58
- package/dist/ports/session-store.js +0 -1
- package/dist/ports/subagent-lifecycle.d.ts +0 -31
- package/dist/ports/subagent-lifecycle.js +0 -1
- package/dist/ports/tool-activity.d.ts +0 -13
- package/dist/ports/tool-activity.js +0 -1
- package/dist/presentation/themes/theme.d.ts +0 -19
- package/dist/presentation/themes/theme.js +0 -8
- package/dist/presentation/tui/agent-initialization-renderer.d.ts +0 -4
- package/dist/presentation/tui/agent-initialization-renderer.js +0 -37
- package/dist/presentation/tui/context-display.d.ts +0 -21
- package/dist/presentation/tui/context-display.js +0 -33
- package/dist/presentation/tui/formatters.d.ts +0 -6
- package/dist/presentation/tui/formatters.js +0 -60
- package/dist/presentation/tui/ink/choice-window.d.ts +0 -5
- package/dist/presentation/tui/ink/choice-window.js +0 -5
- package/dist/presentation/tui/ink/components/activity-entry.d.ts +0 -6
- package/dist/presentation/tui/ink/components/activity-entry.js +0 -16
- package/dist/presentation/tui/ink/components/activity-status.d.ts +0 -10
- package/dist/presentation/tui/ink/components/activity-status.js +0 -21
- package/dist/presentation/tui/ink/components/choice-modal.d.ts +0 -11
- package/dist/presentation/tui/ink/components/choice-modal.js +0 -29
- package/dist/presentation/tui/ink/components/composer.d.ts +0 -40
- package/dist/presentation/tui/ink/components/composer.js +0 -271
- package/dist/presentation/tui/ink/components/file-diff.d.ts +0 -6
- package/dist/presentation/tui/ink/components/file-diff.js +0 -34
- package/dist/presentation/tui/ink/components/modal.d.ts +0 -8
- package/dist/presentation/tui/ink/components/modal.js +0 -110
- package/dist/presentation/tui/ink/components/shimmer-text.d.ts +0 -6
- package/dist/presentation/tui/ink/components/shimmer-text.js +0 -9
- package/dist/presentation/tui/ink/components/subagent-activity.d.ts +0 -11
- package/dist/presentation/tui/ink/components/subagent-activity.js +0 -61
- package/dist/presentation/tui/ink/components/transcript.d.ts +0 -39
- package/dist/presentation/tui/ink/components/transcript.js +0 -121
- package/dist/presentation/tui/ink/components/welcome-panel.d.ts +0 -6
- package/dist/presentation/tui/ink/components/welcome-panel.js +0 -20
- package/dist/presentation/tui/ink/lotagate-tui.d.ts +0 -6
- package/dist/presentation/tui/ink/lotagate-tui.js +0 -136
- package/dist/presentation/tui/ink/markdown-inline-renderer.d.ts +0 -4
- package/dist/presentation/tui/ink/markdown-inline-renderer.js +0 -20
- package/dist/presentation/tui/ink/markdown-inline.d.ts +0 -13
- package/dist/presentation/tui/ink/markdown-inline.js +0 -91
- package/dist/presentation/tui/ink/markdown-message.d.ts +0 -6
- package/dist/presentation/tui/ink/markdown-message.js +0 -66
- package/dist/presentation/tui/ink/markdown-table.d.ts +0 -16
- package/dist/presentation/tui/ink/markdown-table.js +0 -77
- package/dist/presentation/tui/ink/tui-bridge.d.ts +0 -195
- package/dist/presentation/tui/ink/tui-bridge.js +0 -289
- package/dist/presentation/tui/terminal-capabilities.d.ts +0 -15
- package/dist/presentation/tui/terminal-capabilities.js +0 -7
- package/dist/presentation/tui/terminal-mouse.d.ts +0 -5
- package/dist/presentation/tui/terminal-mouse.js +0 -19
- package/dist/presentation/tui/terminal-screen.d.ts +0 -10
- package/dist/presentation/tui/terminal-screen.js +0 -23
- package/dist/presentation/tui/tui-agent-event-runner.d.ts +0 -24
- package/dist/presentation/tui/tui-agent-event-runner.js +0 -69
- package/dist/presentation/tui/tui-application-contract.d.ts +0 -10
- package/dist/presentation/tui/tui-application-contract.js +0 -8
- package/dist/presentation/tui/tui-application.d.ts +0 -62
- package/dist/presentation/tui/tui-application.js +0 -675
- package/dist/presentation/tui/tui-attachment-input.d.ts +0 -2
- package/dist/presentation/tui/tui-attachment-input.js +0 -5
- package/dist/presentation/tui/tui-clipboard-paste-handlers.d.ts +0 -11
- package/dist/presentation/tui/tui-clipboard-paste-handlers.js +0 -25
- package/dist/presentation/tui/tui-command-context.d.ts +0 -3
- package/dist/presentation/tui/tui-command-context.js +0 -1
- package/dist/presentation/tui/tui-command-executor.d.ts +0 -38
- package/dist/presentation/tui/tui-command-executor.js +0 -214
- package/dist/presentation/tui/tui-command-host-factory.d.ts +0 -40
- package/dist/presentation/tui/tui-command-host-factory.js +0 -23
- package/dist/presentation/tui/tui-context-compaction.d.ts +0 -5
- package/dist/presentation/tui/tui-context-compaction.js +0 -22
- package/dist/presentation/tui/tui-context-service.d.ts +0 -34
- package/dist/presentation/tui/tui-context-service.js +0 -126
- package/dist/presentation/tui/tui-file-suggestions.d.ts +0 -3
- package/dist/presentation/tui/tui-file-suggestions.js +0 -8
- package/dist/presentation/tui/tui-goal-controller.d.ts +0 -14
- package/dist/presentation/tui/tui-goal-controller.js +0 -52
- package/dist/presentation/tui/tui-initial-model.d.ts +0 -3
- package/dist/presentation/tui/tui-initial-model.js +0 -28
- package/dist/presentation/tui/tui-lifecycle-actions.d.ts +0 -13
- package/dist/presentation/tui/tui-lifecycle-actions.js +0 -45
- package/dist/presentation/tui/tui-manual-compaction.d.ts +0 -18
- package/dist/presentation/tui/tui-manual-compaction.js +0 -31
- package/dist/presentation/tui/tui-media-model-selection.d.ts +0 -12
- package/dist/presentation/tui/tui-media-model-selection.js +0 -38
- package/dist/presentation/tui/tui-prompt-dispatcher.d.ts +0 -16
- package/dist/presentation/tui/tui-prompt-dispatcher.js +0 -38
- package/dist/presentation/tui/tui-skill-controller.d.ts +0 -11
- package/dist/presentation/tui/tui-skill-controller.js +0 -13
- package/dist/presentation/tui/tui-tool-approval.d.ts +0 -22
- package/dist/presentation/tui/tui-tool-approval.js +0 -73
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { AgentEvent } from '@lotagate/agent-sdk';
|
|
2
|
-
import { type CliTurnEvent } from './cli-turn-events.js';
|
|
3
|
-
/** Converts external agent events into a small, CLI-owned lifecycle projection. */
|
|
4
|
-
export declare class CliTurnEventProjector {
|
|
5
|
-
private readonly openSegments;
|
|
6
|
-
observe(event: AgentEvent): readonly CliTurnEvent[];
|
|
7
|
-
private delta;
|
|
8
|
-
private closeOpenSegment;
|
|
9
|
-
private approval;
|
|
10
|
-
private started;
|
|
11
|
-
private completed;
|
|
12
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { actionDisplayName, actionId, actionKind } from './cli-turn-events.js';
|
|
2
|
-
/** Converts external agent events into a small, CLI-owned lifecycle projection. */
|
|
3
|
-
export class CliTurnEventProjector {
|
|
4
|
-
openSegments = new Map();
|
|
5
|
-
observe(event) {
|
|
6
|
-
switch (event.type) {
|
|
7
|
-
case 'session.started':
|
|
8
|
-
this.openSegments.delete(event.runId);
|
|
9
|
-
return [{ type: 'turn.started', runId: event.runId, timestamp: event.timestamp }];
|
|
10
|
-
case 'model.delta': return event.content.length === 0 ? [] : [this.delta(event)];
|
|
11
|
-
case 'tool.approval.requested': return [...this.closeOpenSegment(event.request.context.runId, 'progress', event.timestamp), this.approval(event)];
|
|
12
|
-
case 'tool.called': return [...this.closeOpenSegment(event.runId, 'progress', event.timestamp), this.started(event)];
|
|
13
|
-
case 'tool.completed': return [this.completed(event)];
|
|
14
|
-
case 'context.compacted': return [{ type: 'context.compacted', runId: event.runId, timestamp: event.timestamp }];
|
|
15
|
-
case 'session.completed': {
|
|
16
|
-
const boundary = this.closeOpenSegment(event.runId, 'final', event.timestamp);
|
|
17
|
-
if (boundary.length > 0)
|
|
18
|
-
return [...boundary, { type: 'turn.completed', runId: event.runId, timestamp: event.timestamp }];
|
|
19
|
-
if (event.content.length === 0)
|
|
20
|
-
return [{ type: 'turn.completed', runId: event.runId, timestamp: event.timestamp }];
|
|
21
|
-
const segmentId = `${event.runId}:final`;
|
|
22
|
-
return [
|
|
23
|
-
{ type: 'assistant.delta', runId: event.runId, segmentId, iteration: 0, content: event.content, timestamp: event.timestamp },
|
|
24
|
-
{ type: 'assistant.segment.completed', runId: event.runId, segmentId, iteration: 0, phase: 'final', timestamp: event.timestamp },
|
|
25
|
-
{ type: 'turn.completed', runId: event.runId, timestamp: event.timestamp },
|
|
26
|
-
];
|
|
27
|
-
}
|
|
28
|
-
case 'session.failed': return [...this.closeOpenSegment(event.runId, 'progress', event.timestamp), { type: 'turn.failed', runId: event.runId, error: event.error, timestamp: event.timestamp }];
|
|
29
|
-
default: return [];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
delta(event) {
|
|
33
|
-
const segmentId = `${event.runId}:${event.iteration}`;
|
|
34
|
-
this.openSegments.set(event.runId, { segmentId, iteration: event.iteration });
|
|
35
|
-
return { type: 'assistant.delta', runId: event.runId, segmentId, iteration: event.iteration, content: event.content, timestamp: event.timestamp };
|
|
36
|
-
}
|
|
37
|
-
closeOpenSegment(runId, phase, timestamp) {
|
|
38
|
-
const open = this.openSegments.get(runId);
|
|
39
|
-
if (open === undefined)
|
|
40
|
-
return [];
|
|
41
|
-
this.openSegments.delete(runId);
|
|
42
|
-
return [{ type: 'assistant.segment.completed', runId, segmentId: open.segmentId, iteration: open.iteration, phase, timestamp }];
|
|
43
|
-
}
|
|
44
|
-
approval(event) {
|
|
45
|
-
const request = event.request;
|
|
46
|
-
return {
|
|
47
|
-
type: 'action.approval_requested',
|
|
48
|
-
actionId: actionId(request.context.runId, request.toolName),
|
|
49
|
-
runId: request.context.runId,
|
|
50
|
-
toolName: request.toolName,
|
|
51
|
-
displayName: actionDisplayName(request.toolName),
|
|
52
|
-
kind: actionKind(request.toolName, request.toolInfo?.source),
|
|
53
|
-
timestamp: event.timestamp,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
started(event) {
|
|
57
|
-
return {
|
|
58
|
-
type: 'action.started',
|
|
59
|
-
actionId: actionId(event.runId, event.toolName),
|
|
60
|
-
runId: event.runId,
|
|
61
|
-
toolName: event.toolName,
|
|
62
|
-
displayName: actionDisplayName(event.toolName),
|
|
63
|
-
kind: actionKind(event.toolName, event.source),
|
|
64
|
-
...(event.source === undefined ? {} : { source: event.source }),
|
|
65
|
-
timestamp: event.timestamp,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
completed(event) {
|
|
69
|
-
return {
|
|
70
|
-
type: 'action.completed',
|
|
71
|
-
actionId: actionId(event.runId, event.toolName),
|
|
72
|
-
runId: event.runId,
|
|
73
|
-
toolName: event.toolName,
|
|
74
|
-
displayName: actionDisplayName(event.toolName),
|
|
75
|
-
kind: actionKind(event.toolName, event.source),
|
|
76
|
-
status: event.isError ? 'failed' : 'completed',
|
|
77
|
-
isError: event.isError,
|
|
78
|
-
timestamp: event.timestamp,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { AgentEvent } from '@lotagate/agent-sdk';
|
|
2
|
-
export type CliActionKind = 'filesystem' | 'shell' | 'mcp' | 'skill' | 'subagent' | 'other';
|
|
3
|
-
export type CliActionStatus = 'waiting_approval' | 'running' | 'completed' | 'failed';
|
|
4
|
-
export type AssistantSegmentPhase = 'progress' | 'final';
|
|
5
|
-
export type CliTurnEvent = {
|
|
6
|
-
type: 'turn.started';
|
|
7
|
-
runId: string;
|
|
8
|
-
timestamp: string;
|
|
9
|
-
} | {
|
|
10
|
-
type: 'assistant.delta';
|
|
11
|
-
runId: string;
|
|
12
|
-
segmentId: string;
|
|
13
|
-
iteration: number;
|
|
14
|
-
content: string;
|
|
15
|
-
timestamp: string;
|
|
16
|
-
} | {
|
|
17
|
-
type: 'assistant.segment.completed';
|
|
18
|
-
runId: string;
|
|
19
|
-
segmentId: string;
|
|
20
|
-
iteration: number;
|
|
21
|
-
phase: AssistantSegmentPhase;
|
|
22
|
-
timestamp: string;
|
|
23
|
-
} | {
|
|
24
|
-
type: 'action.approval_requested';
|
|
25
|
-
actionId: string;
|
|
26
|
-
runId: string;
|
|
27
|
-
toolName: string;
|
|
28
|
-
displayName: string;
|
|
29
|
-
kind: CliActionKind;
|
|
30
|
-
timestamp: string;
|
|
31
|
-
} | {
|
|
32
|
-
type: 'action.started';
|
|
33
|
-
actionId: string;
|
|
34
|
-
runId: string;
|
|
35
|
-
toolName: string;
|
|
36
|
-
displayName: string;
|
|
37
|
-
kind: CliActionKind;
|
|
38
|
-
source?: string;
|
|
39
|
-
timestamp: string;
|
|
40
|
-
} | {
|
|
41
|
-
type: 'action.completed';
|
|
42
|
-
actionId: string;
|
|
43
|
-
runId: string;
|
|
44
|
-
toolName: string;
|
|
45
|
-
displayName: string;
|
|
46
|
-
kind: CliActionKind;
|
|
47
|
-
status: Extract<CliActionStatus, 'completed' | 'failed'>;
|
|
48
|
-
isError: boolean;
|
|
49
|
-
timestamp: string;
|
|
50
|
-
} | {
|
|
51
|
-
type: 'context.compacted';
|
|
52
|
-
runId: string;
|
|
53
|
-
timestamp: string;
|
|
54
|
-
} | {
|
|
55
|
-
type: 'turn.completed';
|
|
56
|
-
runId: string;
|
|
57
|
-
timestamp: string;
|
|
58
|
-
} | {
|
|
59
|
-
type: 'turn.failed';
|
|
60
|
-
runId: string;
|
|
61
|
-
error: Error;
|
|
62
|
-
timestamp: string;
|
|
63
|
-
};
|
|
64
|
-
export declare function actionId(runId: string, toolName: string): string;
|
|
65
|
-
export declare function actionKind(toolName: string, source?: string): CliActionKind;
|
|
66
|
-
export declare function actionDisplayName(toolName: string): string;
|
|
67
|
-
export declare function isDurableTurnEvent(event: CliTurnEvent): boolean;
|
|
68
|
-
export declare function toSafeTurnEventData(event: CliTurnEvent): Record<string, unknown>;
|
|
69
|
-
/** Produces the only error text permitted in durable turn state or model-facing history. */
|
|
70
|
-
export declare function safeTurnFailureMessage(error: unknown): string;
|
|
71
|
-
export type ActionEvent = Extract<CliTurnEvent, {
|
|
72
|
-
type: 'action.started' | 'action.completed' | 'action.approval_requested';
|
|
73
|
-
}>;
|
|
74
|
-
export type ProjectableAgentEvent = Extract<AgentEvent, {
|
|
75
|
-
type: 'session.started' | 'model.delta' | 'tool.approval.requested' | 'tool.called' | 'tool.completed' | 'context.compacted' | 'session.completed' | 'session.failed';
|
|
76
|
-
}>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { formatToolActivityName } from '../agent/tool-display.js';
|
|
2
|
-
export function actionId(runId, toolName) {
|
|
3
|
-
return `${runId}:${toolName}`;
|
|
4
|
-
}
|
|
5
|
-
export function actionKind(toolName, source) {
|
|
6
|
-
if (toolName === 'agent.spawn')
|
|
7
|
-
return 'subagent';
|
|
8
|
-
if (toolName.startsWith('mcp__') || source === 'mcp')
|
|
9
|
-
return 'mcp';
|
|
10
|
-
if (toolName.startsWith('filesystem.') || source === 'filesystem')
|
|
11
|
-
return 'filesystem';
|
|
12
|
-
if (toolName.startsWith('shell.') || source === 'shell')
|
|
13
|
-
return 'shell';
|
|
14
|
-
if (toolName.startsWith('skill.') || source === 'skill')
|
|
15
|
-
return 'skill';
|
|
16
|
-
return 'other';
|
|
17
|
-
}
|
|
18
|
-
export function actionDisplayName(toolName) {
|
|
19
|
-
return formatToolActivityName(toolName);
|
|
20
|
-
}
|
|
21
|
-
export function isDurableTurnEvent(event) {
|
|
22
|
-
return event.type === 'action.started' || event.type === 'action.completed' || event.type === 'assistant.segment.completed';
|
|
23
|
-
}
|
|
24
|
-
export function toSafeTurnEventData(event) {
|
|
25
|
-
switch (event.type) {
|
|
26
|
-
case 'assistant.segment.completed': return { segmentId: event.segmentId, iteration: event.iteration, phase: event.phase };
|
|
27
|
-
case 'action.started': return { actionId: event.actionId, toolName: event.toolName, displayName: event.displayName, kind: event.kind, source: event.source, status: 'running' };
|
|
28
|
-
case 'action.completed': return { actionId: event.actionId, toolName: event.toolName, displayName: event.displayName, kind: event.kind, status: event.status, isError: event.isError };
|
|
29
|
-
case 'context.compacted': return { runId: event.runId };
|
|
30
|
-
case 'turn.completed': return { runId: event.runId };
|
|
31
|
-
case 'turn.failed': return { runId: event.runId, message: safeTurnFailureMessage(event.error) };
|
|
32
|
-
default: return {};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/** Produces the only error text permitted in durable turn state or model-facing history. */
|
|
36
|
-
export function safeTurnFailureMessage(error) {
|
|
37
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
38
|
-
return message.replace(/(api[-_ ]?key|authorization|bearer|token)\s*[:=]\s*[^\s,;]+/giu, '$1=[REDACTED]').slice(0, 1024);
|
|
39
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { SessionStore } from '../../ports/session-store.js';
|
|
2
|
-
import { type CliTurnEvent } from './cli-turn-events.js';
|
|
3
|
-
/** Persists only sanitized, durable lifecycle metadata; deltas and raw payloads stay ephemeral. */
|
|
4
|
-
export declare function persistCliTurnEvent(store: SessionStore, sessionId: string, event: CliTurnEvent, options?: {
|
|
5
|
-
turnId?: string;
|
|
6
|
-
}): Promise<void>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { isDurableTurnEvent, toSafeTurnEventData } from './cli-turn-events.js';
|
|
2
|
-
/** Persists only sanitized, durable lifecycle metadata; deltas and raw payloads stay ephemeral. */
|
|
3
|
-
export async function persistCliTurnEvent(store, sessionId, event, options = {}) {
|
|
4
|
-
if (!isDurableTurnEvent(event))
|
|
5
|
-
return;
|
|
6
|
-
await store.appendEvent({
|
|
7
|
-
type: `agent.${event.type}`,
|
|
8
|
-
timestamp: event.timestamp,
|
|
9
|
-
sessionId,
|
|
10
|
-
...(options.turnId === undefined ? {} : { turnId: options.turnId }),
|
|
11
|
-
...('runId' in event ? { runId: event.runId } : {}),
|
|
12
|
-
data: toSafeTurnEventData(event),
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { LotaGate } from '@lotagate/sdk';
|
|
2
|
-
import type { GoalEvaluation } from '../../domain/orchestration/goal.js';
|
|
3
|
-
import type { ModelUsageReport } from '../../ports/model-diagnostics.js';
|
|
4
|
-
export interface GoalVerificationContext {
|
|
5
|
-
toolCalls: number;
|
|
6
|
-
toolFailures: number;
|
|
7
|
-
toolNames: readonly string[];
|
|
8
|
-
}
|
|
9
|
-
export interface GoalEvaluationInput {
|
|
10
|
-
objective: string;
|
|
11
|
-
response: string;
|
|
12
|
-
turn: number;
|
|
13
|
-
model: string;
|
|
14
|
-
signal?: AbortSignal;
|
|
15
|
-
verification?: GoalVerificationContext;
|
|
16
|
-
onUsage?: (report: ModelUsageReport) => void;
|
|
17
|
-
}
|
|
18
|
-
export declare function evaluateGoal(client: LotaGate, input: GoalEvaluationInput): Promise<GoalEvaluation>;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
|
|
2
|
-
import { estimateTurnUsage } from '../../infrastructure/tokens/tiktoken-token-estimator.js';
|
|
3
|
-
export async function evaluateGoal(client, input) {
|
|
4
|
-
const evaluatorPrompt = [
|
|
5
|
-
`<objective>\n${bounded(input.objective, RESOURCE_LIMITS.goalObjectiveBytes)}\n</objective>`,
|
|
6
|
-
`<latest-turn>\n${bounded(input.response, RESOURCE_LIMITS.goalEvidenceBytes)}\n</latest-turn>`,
|
|
7
|
-
`<verification>\n${formatVerification(input.verification)}\n</verification>`,
|
|
8
|
-
`<turn>${input.turn}</turn>`,
|
|
9
|
-
].join('\n');
|
|
10
|
-
try {
|
|
11
|
-
const response = await client.chat.completions.create({
|
|
12
|
-
model: input.model,
|
|
13
|
-
messages: [
|
|
14
|
-
{ role: 'system', content: 'Evaluate whether the user goal is complete. Return JSON only with decision (continue|complete|blocked), reason, and evidence (array of strings). Mark complete only when every requirement has concrete evidence from the latest work and verification context. A model claim alone is not evidence. Do not invent evidence and do not use tools.' },
|
|
15
|
-
{ role: 'user', content: evaluatorPrompt },
|
|
16
|
-
],
|
|
17
|
-
stream: false,
|
|
18
|
-
max_tokens: 512,
|
|
19
|
-
temperature: 0,
|
|
20
|
-
}, input.signal === undefined ? undefined : { signal: input.signal });
|
|
21
|
-
const content = response.choices[0]?.message.content;
|
|
22
|
-
const usage = mapUsage(response.usage);
|
|
23
|
-
const estimated = usage === undefined ? estimateTurnUsage({ model: input.model, prompt: evaluatorPrompt, response: textContent(content) }) : usage;
|
|
24
|
-
if (estimated !== undefined)
|
|
25
|
-
input.onUsage?.({ usage: estimated, modelCalls: 1 });
|
|
26
|
-
const parsed = parseEvaluation(content);
|
|
27
|
-
if (parsed === undefined)
|
|
28
|
-
throw new Error('Goal evaluator returned an invalid decision.');
|
|
29
|
-
return { ...requireConcreteCompletionEvidence(parsed, input.verification), timestamp: new Date().toISOString(), evaluatorModel: input.model };
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
throw new Error(`Goal evaluator failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function requireConcreteCompletionEvidence(evaluation, verification) {
|
|
36
|
-
if (evaluation.decision !== 'complete')
|
|
37
|
-
return evaluation;
|
|
38
|
-
if (verification === undefined || verification.toolCalls === 0 || verification.toolFailures > 0) {
|
|
39
|
-
return {
|
|
40
|
-
decision: 'continue',
|
|
41
|
-
reason: 'Completion requires successful tool-backed verification; continue inspecting and validating the workspace.',
|
|
42
|
-
evidence: verification?.toolFailures === 0 ? verification.toolNames : [],
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return evaluation;
|
|
46
|
-
}
|
|
47
|
-
function parseEvaluation(content) {
|
|
48
|
-
const text = textContent(content);
|
|
49
|
-
const match = text.match(/\{[\s\S]*\}/u);
|
|
50
|
-
if (match === null)
|
|
51
|
-
return undefined;
|
|
52
|
-
try {
|
|
53
|
-
const value = JSON.parse(match[0]);
|
|
54
|
-
const decision = value['decision'];
|
|
55
|
-
const reason = value['reason'];
|
|
56
|
-
const evidence = value['evidence'];
|
|
57
|
-
if (decision !== 'continue' && decision !== 'complete' && decision !== 'blocked')
|
|
58
|
-
return undefined;
|
|
59
|
-
if (typeof reason !== 'string' || !Array.isArray(evidence) || evidence.some((item) => typeof item !== 'string'))
|
|
60
|
-
return undefined;
|
|
61
|
-
return { decision, reason: bounded(reason, RESOURCE_LIMITS.goalReasonBytes), evidence: evidence.slice(0, RESOURCE_LIMITS.goalEvidenceItems).map((item) => bounded(item, RESOURCE_LIMITS.goalEvidenceBytes)) };
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function mapUsage(usage) {
|
|
68
|
-
if (usage === undefined)
|
|
69
|
-
return undefined;
|
|
70
|
-
return {
|
|
71
|
-
...(typeof usage.prompt_tokens === 'number' ? { promptTokens: usage.prompt_tokens } : {}),
|
|
72
|
-
...(typeof usage.completion_tokens === 'number' ? { completionTokens: usage.completion_tokens } : {}),
|
|
73
|
-
...(typeof usage.total_tokens === 'number' ? { totalTokens: usage.total_tokens } : {}),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function formatVerification(value) {
|
|
77
|
-
if (value === undefined)
|
|
78
|
-
return 'No tool verification metadata was available; do not mark complete from a claim alone.';
|
|
79
|
-
return `tool_calls=${value.toolCalls}; tool_failures=${value.toolFailures}; tools=${value.toolNames.slice(0, 32).join(', ') || 'none'}`;
|
|
80
|
-
}
|
|
81
|
-
function textContent(content) {
|
|
82
|
-
if (typeof content === 'string')
|
|
83
|
-
return content;
|
|
84
|
-
if (!Array.isArray(content))
|
|
85
|
-
return '';
|
|
86
|
-
return content.map((part) => typeof part === 'object' && part !== null && 'text' in part && typeof part.text === 'string' ? part.text : '').join('');
|
|
87
|
-
}
|
|
88
|
-
function bounded(value, maximum) { return value.length <= maximum ? value : `${value.slice(0, maximum - 3)}...`; }
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { CreateGoalInput } from '../../domain/orchestration/goal.js';
|
|
2
|
-
export declare function parseGoalInput(objective: string, flags: ReadonlyMap<string, string | boolean>): CreateGoalInput;
|
|
3
|
-
export declare function parseGoalLimits(flags: ReadonlyMap<string, string | boolean>): Omit<CreateGoalInput, 'objective'>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { getPositiveIntegerFlag } from '../commands/cli-args.js';
|
|
2
|
-
import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
|
|
3
|
-
export function parseGoalInput(objective, flags) {
|
|
4
|
-
return { objective, maxTurns: RESOURCE_LIMITS.goalDefaultMaxTurns, maxDurationMs: RESOURCE_LIMITS.goalDefaultMaxDurationMs, ...parseGoalLimits(flags) };
|
|
5
|
-
}
|
|
6
|
-
export function parseGoalLimits(flags) {
|
|
7
|
-
const tokenBudget = readPositive(flags, 'token-budget');
|
|
8
|
-
const maxTurns = readPositive(flags, 'max-turns');
|
|
9
|
-
const maxDurationMs = readPositive(flags, 'max-duration-ms');
|
|
10
|
-
return { ...(tokenBudget === undefined ? {} : { tokenBudget }), ...(maxTurns === undefined ? {} : { maxTurns }), ...(maxDurationMs === undefined ? {} : { maxDurationMs }) };
|
|
11
|
-
}
|
|
12
|
-
function readPositive(flags, name) {
|
|
13
|
-
const maximum = name === 'max-duration-ms'
|
|
14
|
-
? RESOURCE_LIMITS.goalMaximumMaxDurationMs
|
|
15
|
-
: name === 'max-turns'
|
|
16
|
-
? RESOURCE_LIMITS.goalMaximumMaxTurns
|
|
17
|
-
: RESOURCE_LIMITS.goalMaximumTokenBudget;
|
|
18
|
-
return getPositiveIntegerFlag(flags, name, maximum);
|
|
19
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function formatGoalStatus(state) {
|
|
2
|
-
return [
|
|
3
|
-
`Goal ${state.status}`, `Objective: ${state.objective}`, `Turns: ${state.turns}`, `Evaluator runs: ${state.evaluatorRuns}`,
|
|
4
|
-
`Tokens: ${state.usage.totalTokens} (input ${state.usage.inputTokens}, output ${state.usage.outputTokens}${state.usage.estimated ? ', estimated' : ''})`,
|
|
5
|
-
...(state.tokenBudget === undefined ? [] : [`Token budget: ${state.tokenBudget}`]),
|
|
6
|
-
...(state.maxTurns === undefined ? [] : [`Max turns: ${state.maxTurns}`]),
|
|
7
|
-
...(state.maxDurationMs === undefined ? [] : [`Max duration: ${state.maxDurationMs} ms`]),
|
|
8
|
-
...(state.lastError === undefined ? [] : [`Last error: ${state.lastError}`]),
|
|
9
|
-
...(state.lastEvaluation === undefined ? [] : [`Last evaluation: ${state.lastEvaluation.decision} — ${state.lastEvaluation.reason}`]),
|
|
10
|
-
].join('\n');
|
|
11
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { LotaGate } from '@lotagate/sdk';
|
|
2
|
-
import type { AgentRunSnapshot } from '../agent/agent-run-tracker.js';
|
|
3
|
-
import type { CliRuntime } from '../../bootstrap/runtime-factory.js';
|
|
4
|
-
import type { GoalState } from '../../domain/orchestration/goal.js';
|
|
5
|
-
import { GoalUsageAccumulator } from './goal-usage.js';
|
|
6
|
-
export interface GoalRunnerOptions {
|
|
7
|
-
runtime: CliRuntime;
|
|
8
|
-
sessionId: string;
|
|
9
|
-
objective: string;
|
|
10
|
-
model: string;
|
|
11
|
-
client: LotaGate;
|
|
12
|
-
signal?: AbortSignal;
|
|
13
|
-
initialPrompt?: string;
|
|
14
|
-
runTurn: (prompt: string, callbacks: GoalTurnCallbacks, signal: AbortSignal) => Promise<string>;
|
|
15
|
-
onMessage?: (message: string) => void;
|
|
16
|
-
}
|
|
17
|
-
export interface GoalTurnCallbacks {
|
|
18
|
-
onUsage: (report: Parameters<GoalUsageAccumulator['add']>[0]) => void;
|
|
19
|
-
onSnapshot: (snapshot: AgentRunSnapshot) => void;
|
|
20
|
-
onError: (error: unknown) => void;
|
|
21
|
-
}
|
|
22
|
-
export declare function runGoalLoop(options: GoalRunnerOptions): Promise<GoalState | undefined>;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { RESOURCE_LIMITS } from '../../domain/runtime/resource-limits.js';
|
|
2
|
-
import { evaluateGoal } from './goal-evaluator.js';
|
|
3
|
-
import { GoalUsageAccumulator } from './goal-usage.js';
|
|
4
|
-
import { CliError } from '../../domain/errors/cli-error.js';
|
|
5
|
-
export async function runGoalLoop(options) {
|
|
6
|
-
let prompt = options.initialPrompt ?? options.objective;
|
|
7
|
-
let turnsThisRun = 0;
|
|
8
|
-
let evaluatorRunsThisRun = 0;
|
|
9
|
-
options.onMessage?.(`Goal started: ${options.objective}`);
|
|
10
|
-
while (true) {
|
|
11
|
-
const state = await options.runtime.goalStore.get(options.sessionId);
|
|
12
|
-
if (state === undefined || state.status !== 'active')
|
|
13
|
-
break;
|
|
14
|
-
const limit = executionLimit(state, turnsThisRun, evaluatorRunsThisRun);
|
|
15
|
-
if (limit !== undefined) {
|
|
16
|
-
await pauseForLimit(options, limit);
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
await options.runtime.goalStore.recordTurn(options.sessionId);
|
|
20
|
-
turnsThisRun += 1;
|
|
21
|
-
const turnUsage = new GoalUsageAccumulator();
|
|
22
|
-
let verification;
|
|
23
|
-
let turnError;
|
|
24
|
-
let response = '';
|
|
25
|
-
const turn = deadlineSignal(state, options.signal);
|
|
26
|
-
try {
|
|
27
|
-
response = await options.runTurn(prompt, {
|
|
28
|
-
onUsage: (report) => turnUsage.add(report),
|
|
29
|
-
onSnapshot: (snapshot) => { verification = { toolCalls: snapshot.toolCalls, toolFailures: snapshot.toolFailures, toolNames: snapshot.toolNames }; },
|
|
30
|
-
onError: (error) => { turnError = error; },
|
|
31
|
-
}, turn.signal);
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
turnError = error;
|
|
35
|
-
}
|
|
36
|
-
finally {
|
|
37
|
-
turn.dispose();
|
|
38
|
-
}
|
|
39
|
-
await persistUsage(options, turnUsage);
|
|
40
|
-
if (isGoalDeadline(turn.signal, options.signal)) {
|
|
41
|
-
await pauseForLimit(options, { kind: 'duration', reason: 'Goal execution duration limit reached.' });
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
if (turnError !== undefined || response.trim().length === 0) {
|
|
45
|
-
await pauseAfterFailure(options, turnError ?? new Error('The agent turn did not return a final response.'));
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
const afterTurn = await options.runtime.goalStore.get(options.sessionId);
|
|
49
|
-
if (afterTurn?.tokenBudget !== undefined && afterTurn.usage.totalTokens >= afterTurn.tokenBudget) {
|
|
50
|
-
await pauseForLimit(options, { kind: 'tokens', reason: 'Goal token budget reached after the agent turn.' });
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
const evaluationUsage = new GoalUsageAccumulator();
|
|
54
|
-
const evaluationDeadline = deadlineSignal(afterTurn ?? state, options.signal);
|
|
55
|
-
try {
|
|
56
|
-
const evaluation = await evaluateGoal(options.client, {
|
|
57
|
-
objective: options.objective,
|
|
58
|
-
response,
|
|
59
|
-
turn: afterTurn?.turns ?? state.turns + 1,
|
|
60
|
-
model: options.model,
|
|
61
|
-
signal: evaluationDeadline.signal,
|
|
62
|
-
...(verification === undefined ? {} : { verification }),
|
|
63
|
-
onUsage: (report) => evaluationUsage.add(report),
|
|
64
|
-
});
|
|
65
|
-
if (isGoalDeadline(evaluationDeadline.signal, options.signal)) {
|
|
66
|
-
await pauseForLimit(options, { kind: 'duration', reason: 'Goal execution duration limit reached during evaluation.' });
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
evaluatorRunsThisRun += 1;
|
|
70
|
-
await persistUsage(options, evaluationUsage);
|
|
71
|
-
const afterEvaluation = await options.runtime.goalStore.get(options.sessionId);
|
|
72
|
-
const updated = afterEvaluation?.tokenBudget !== undefined && afterEvaluation.usage.totalTokens >= afterEvaluation.tokenBudget
|
|
73
|
-
? await pauseForLimit(options, { kind: 'tokens', reason: 'Goal token budget reached during evaluation.' })
|
|
74
|
-
: await options.runtime.goalStore.recordEvaluation(options.sessionId, evaluation);
|
|
75
|
-
if (updated?.status !== 'active')
|
|
76
|
-
break;
|
|
77
|
-
prompt = nextPrompt(options.objective, evaluation.reason, evaluation.evidence);
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
if (isGoalDeadline(evaluationDeadline.signal, options.signal)) {
|
|
81
|
-
await persistUsage(options, evaluationUsage);
|
|
82
|
-
await pauseForLimit(options, { kind: 'duration', reason: 'Goal execution duration limit reached during evaluation.' });
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
await persistUsage(options, evaluationUsage);
|
|
86
|
-
await pauseAfterFailure(options, error);
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
finally {
|
|
90
|
-
evaluationDeadline.dispose();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
const final = await options.runtime.goalStore.get(options.sessionId);
|
|
94
|
-
options.onMessage?.(final === undefined ? 'Goal ended.' : `Goal ${final.status}. Turns: ${final.turns}. Tokens: ${final.usage.totalTokens}${final.usage.estimated ? ' (estimated)' : ''}.`);
|
|
95
|
-
return final;
|
|
96
|
-
}
|
|
97
|
-
function deadlineSignal(state, parent) {
|
|
98
|
-
const controller = new AbortController();
|
|
99
|
-
const abort = () => controller.abort(parent?.reason);
|
|
100
|
-
if (parent?.aborted)
|
|
101
|
-
abort();
|
|
102
|
-
else
|
|
103
|
-
parent?.addEventListener('abort', abort, { once: true });
|
|
104
|
-
const remaining = Math.max(1, (state.maxDurationMs ?? RESOURCE_LIMITS.goalDefaultMaxDurationMs) - (Date.now() - Date.parse(state.startedAt)));
|
|
105
|
-
const timer = setTimeout(() => controller.abort(new Error('Goal execution duration limit reached.')), remaining);
|
|
106
|
-
return { signal: controller.signal, dispose: () => { clearTimeout(timer); parent?.removeEventListener('abort', abort); } };
|
|
107
|
-
}
|
|
108
|
-
function executionLimit(state, turnsThisRun, evaluatorRunsThisRun) {
|
|
109
|
-
const maxTurns = state.maxTurns ?? RESOURCE_LIMITS.goalDefaultMaxTurns;
|
|
110
|
-
if (turnsThisRun >= maxTurns)
|
|
111
|
-
return { kind: 'turns', reason: 'Goal safety turn guard reached for this run.' };
|
|
112
|
-
if (evaluatorRunsThisRun >= RESOURCE_LIMITS.goalDefaultMaxEvaluatorRuns)
|
|
113
|
-
return { kind: 'evaluator', reason: 'Goal safety evaluator guard reached for this run.' };
|
|
114
|
-
if (state.tokenBudget !== undefined && state.usage.totalTokens >= state.tokenBudget)
|
|
115
|
-
return { kind: 'tokens', reason: 'Goal token budget reached.' };
|
|
116
|
-
const started = Date.parse(state.startedAt);
|
|
117
|
-
const elapsed = Number.isFinite(started) ? Date.now() - started : Number.MAX_SAFE_INTEGER;
|
|
118
|
-
if (elapsed >= (state.maxDurationMs ?? RESOURCE_LIMITS.goalDefaultMaxDurationMs))
|
|
119
|
-
return { kind: 'duration', reason: 'Goal execution duration limit reached.' };
|
|
120
|
-
return undefined;
|
|
121
|
-
}
|
|
122
|
-
async function persistUsage(options, usage) {
|
|
123
|
-
const delta = usage.delta();
|
|
124
|
-
if ((delta.modelCalls ?? 0) === 0)
|
|
125
|
-
return;
|
|
126
|
-
const state = await options.runtime.goalStore.get(options.sessionId);
|
|
127
|
-
if (state?.status === 'active')
|
|
128
|
-
await options.runtime.goalStore.recordUsage(options.sessionId, delta);
|
|
129
|
-
}
|
|
130
|
-
async function pauseAfterFailure(options, error) {
|
|
131
|
-
const reason = sanitizeFailureReason(error);
|
|
132
|
-
const state = await options.runtime.goalStore.get(options.sessionId);
|
|
133
|
-
if (state?.status === 'active')
|
|
134
|
-
await options.runtime.goalStore.pause(options.sessionId, `Goal paused: ${reason}`);
|
|
135
|
-
}
|
|
136
|
-
async function pauseForLimit(options, limit) {
|
|
137
|
-
const state = await options.runtime.goalStore.get(options.sessionId);
|
|
138
|
-
if (state?.status !== 'active')
|
|
139
|
-
return state;
|
|
140
|
-
const paused = await options.runtime.goalStore.pause(options.sessionId, `Goal paused by safety limit: ${limit.reason}`);
|
|
141
|
-
options.onMessage?.(`Goal paused safely: ${limit.reason}\nResume the goal to continue from the persisted state.`);
|
|
142
|
-
return paused;
|
|
143
|
-
}
|
|
144
|
-
function isGoalDeadline(signal, parent) {
|
|
145
|
-
return signal.aborted && signal !== parent && signal.reason instanceof Error && /Goal execution duration limit reached/iu.test(signal.reason.message);
|
|
146
|
-
}
|
|
147
|
-
function sanitizeFailureReason(error) {
|
|
148
|
-
const raw = error instanceof CliError ? error.userMessage : error instanceof Error ? error.message : String(error);
|
|
149
|
-
return raw.replace(/(api[-_ ]?key|authorization|bearer|token)\s*[:=]\s*[^\s,;]+/giu, '$1=[REDACTED]').slice(0, RESOURCE_LIMITS.goalReasonBytes);
|
|
150
|
-
}
|
|
151
|
-
function nextPrompt(objective, reason, evidence) {
|
|
152
|
-
return `<active-goal>\n${objective}\n</active-goal>\n<last-evaluation>\n${reason}\n${evidence.join('\n')}\n</last-evaluation>\nContinue the work and verify the remaining requirements.`;
|
|
153
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ChatUsage } from '../../ports/chat-model.js';
|
|
2
|
-
import type { ModelUsageReport } from '../../ports/model-diagnostics.js';
|
|
3
|
-
import type { GoalUsage, GoalUsageDelta } from '../../domain/orchestration/goal.js';
|
|
4
|
-
export declare class GoalUsageAccumulator {
|
|
5
|
-
private current;
|
|
6
|
-
add(report: ModelUsageReport | ChatUsage): void;
|
|
7
|
-
snapshot(): GoalUsage;
|
|
8
|
-
delta(): GoalUsageDelta;
|
|
9
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export class GoalUsageAccumulator {
|
|
2
|
-
current = { inputTokens: 0, outputTokens: 0, totalTokens: 0, modelCalls: 0, estimated: false };
|
|
3
|
-
add(report) {
|
|
4
|
-
const usage = 'usage' in report ? report.usage : report;
|
|
5
|
-
const modelCalls = 'usage' in report ? report.modelCalls ?? 1 : 1;
|
|
6
|
-
const inputTokens = usage.promptTokens ?? 0;
|
|
7
|
-
const outputTokens = usage.completionTokens ?? 0;
|
|
8
|
-
const totalTokens = Math.max(usage.totalTokens ?? 0, inputTokens + outputTokens);
|
|
9
|
-
this.current = {
|
|
10
|
-
inputTokens: this.current.inputTokens + inputTokens,
|
|
11
|
-
outputTokens: this.current.outputTokens + outputTokens,
|
|
12
|
-
totalTokens: this.current.totalTokens + totalTokens,
|
|
13
|
-
modelCalls: this.current.modelCalls + modelCalls,
|
|
14
|
-
estimated: this.current.estimated || usage.estimated === true,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
snapshot() { return { ...this.current }; }
|
|
18
|
-
delta() { return { ...this.current }; }
|
|
19
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { LotaGate } from '@lotagate/sdk';
|
|
2
|
-
import type { CliRuntime } from '../../bootstrap/runtime-factory.js';
|
|
3
|
-
import type { AgentGoalSummary } from '../agent/capability-profile.js';
|
|
4
|
-
import type { SessionStore as AgentSessionStore } from '@lotagate/agent-sdk';
|
|
5
|
-
import type { ModelUsageReport } from '../../ports/model-diagnostics.js';
|
|
6
|
-
import type { AgentRunSnapshot } from '../agent/agent-run-tracker.js';
|
|
7
|
-
import type { SessionEvent, TranscriptEntry } from '../../domain/session/session.js';
|
|
8
|
-
type HydratableAgentSessionStore = AgentSessionStore & {
|
|
9
|
-
hydrate(sessionId: string, systemPrompt: string, transcript: readonly TranscriptEntry[], events: readonly SessionEvent[], currentInput: string): void;
|
|
10
|
-
delete(sessionId: string): void;
|
|
11
|
-
};
|
|
12
|
-
export interface HeadlessAgentTurnOptions {
|
|
13
|
-
runtime: CliRuntime;
|
|
14
|
-
cwd: string;
|
|
15
|
-
model: string;
|
|
16
|
-
client: LotaGate;
|
|
17
|
-
prompt: string;
|
|
18
|
-
output?: {
|
|
19
|
-
write(chunk: string): unknown;
|
|
20
|
-
};
|
|
21
|
-
json?: boolean;
|
|
22
|
-
signal?: AbortSignal;
|
|
23
|
-
sessionId?: string;
|
|
24
|
-
turnId?: string;
|
|
25
|
-
goal?: AgentGoalSummary;
|
|
26
|
-
agentSessionStore?: HydratableAgentSessionStore;
|
|
27
|
-
onUsage?: (report: ModelUsageReport) => void;
|
|
28
|
-
onSubagentUsage?: (report: ModelUsageReport) => void;
|
|
29
|
-
onSnapshot?: (snapshot: AgentRunSnapshot) => void;
|
|
30
|
-
}
|
|
31
|
-
export declare function runHeadlessAgentTurn(options: HeadlessAgentTurnOptions): Promise<string>;
|
|
32
|
-
export {};
|