byterover-cli 0.3.5 → 0.4.0
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/README.md +119 -63
- package/bin/dev.js +8 -1
- package/bin/run.js +7 -0
- package/dist/commands/cipher-agent/run.d.ts +30 -0
- package/dist/commands/cipher-agent/run.js +123 -61
- package/dist/commands/cipher-agent/set-prompt.d.ts +2 -0
- package/dist/commands/cipher-agent/set-prompt.js +13 -8
- package/dist/commands/cipher-agent/show-prompt.d.ts +2 -0
- package/dist/commands/cipher-agent/show-prompt.js +17 -12
- package/dist/commands/curate.d.ts +3 -60
- package/dist/commands/curate.js +45 -341
- package/dist/commands/foo.d.ts +4 -2
- package/dist/commands/foo.js +21 -16
- package/dist/commands/main.d.ts +9 -0
- package/dist/commands/main.js +34 -0
- package/dist/commands/query.d.ts +2 -48
- package/dist/commands/query.js +19 -287
- package/dist/commands/status.d.ts +2 -13
- package/dist/commands/status.js +12 -91
- package/dist/commands/watch.d.ts +2 -0
- package/dist/commands/watch.js +23 -19
- package/dist/config/environment.d.ts +1 -1
- package/dist/config/environment.js +2 -2
- package/dist/constants.d.ts +4 -5
- package/dist/constants.js +5 -5
- package/dist/core/domain/cipher/errors/storage-error.d.ts +89 -0
- package/dist/core/domain/cipher/errors/storage-error.js +130 -0
- package/dist/core/domain/cipher/queue/types.d.ts +71 -0
- package/dist/core/domain/cipher/queue/types.js +9 -0
- package/dist/core/domain/cipher/storage/message-storage-types.d.ts +218 -0
- package/dist/core/domain/cipher/storage/message-storage-types.js +18 -0
- package/dist/core/domain/cipher/tools/constants.d.ts +1 -0
- package/dist/core/domain/cipher/tools/constants.js +1 -0
- package/dist/core/domain/entities/event.d.ts +1 -1
- package/dist/core/domain/entities/event.js +5 -0
- package/dist/core/domain/entities/global-config.d.ts +36 -0
- package/dist/core/domain/entities/global-config.js +66 -0
- package/dist/core/domain/knowledge/directory-manager.d.ts +10 -0
- package/dist/core/domain/knowledge/directory-manager.js +18 -0
- package/dist/core/domain/knowledge/markdown-writer.d.ts +9 -0
- package/dist/core/domain/knowledge/markdown-writer.js +51 -1
- package/dist/core/interfaces/cipher/i-agent-storage.d.ts +152 -0
- package/dist/core/interfaces/cipher/i-agent-storage.js +1 -0
- package/dist/core/interfaces/cipher/i-cipher-agent.d.ts +2 -0
- package/dist/core/interfaces/cipher/i-key-storage.d.ts +91 -0
- package/dist/core/interfaces/cipher/i-key-storage.js +1 -0
- package/dist/core/interfaces/i-global-config-store.d.ts +34 -0
- package/dist/core/interfaces/i-global-config-store.js +1 -0
- package/dist/core/interfaces/i-onboarding-preference-store.d.ts +20 -0
- package/dist/core/interfaces/i-onboarding-preference-store.js +1 -0
- package/dist/core/interfaces/i-terminal.d.ts +146 -0
- package/dist/core/interfaces/i-terminal.js +1 -0
- package/dist/core/interfaces/i-workspace-detector-service.d.ts +8 -0
- package/dist/core/interfaces/i-workspace-detector-service.js +1 -0
- package/dist/core/interfaces/usecase/i-clear-use-case.d.ts +6 -0
- package/dist/core/interfaces/usecase/i-clear-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-curate-use-case.d.ts +10 -0
- package/dist/core/interfaces/usecase/i-curate-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-generate-rules-use-case.d.ts +3 -0
- package/dist/core/interfaces/usecase/i-generate-rules-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-init-use-case.d.ts +5 -0
- package/dist/core/interfaces/usecase/i-init-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-login-use-case.d.ts +3 -0
- package/dist/core/interfaces/usecase/i-login-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-logout-use-case.d.ts +5 -0
- package/dist/core/interfaces/usecase/i-logout-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-pull-use-case.d.ts +5 -0
- package/dist/core/interfaces/usecase/i-pull-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-push-use-case.d.ts +6 -0
- package/dist/core/interfaces/usecase/i-push-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-query-use-case.d.ts +9 -0
- package/dist/core/interfaces/usecase/i-query-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-space-list-use-case.d.ts +3 -0
- package/dist/core/interfaces/usecase/i-space-list-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-space-switch-use-case.d.ts +3 -0
- package/dist/core/interfaces/usecase/i-space-switch-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-status-use-case.d.ts +5 -0
- package/dist/core/interfaces/usecase/i-status-use-case.js +1 -0
- package/dist/hooks/init/welcome.js +1 -2
- package/dist/infra/cipher/agent-service-factory.d.ts +13 -6
- package/dist/infra/cipher/agent-service-factory.js +40 -16
- package/dist/infra/cipher/cipher-agent.js +4 -4
- package/dist/infra/cipher/consumer/consumer-lock.d.ts +20 -0
- package/dist/infra/cipher/consumer/consumer-lock.js +40 -0
- package/dist/infra/cipher/consumer/consumer-service.d.ts +99 -0
- package/dist/infra/cipher/consumer/consumer-service.js +165 -0
- package/dist/infra/cipher/consumer/execution-consumer.d.ts +121 -0
- package/dist/infra/cipher/consumer/execution-consumer.js +523 -0
- package/dist/infra/cipher/consumer/index.d.ts +33 -0
- package/dist/infra/cipher/consumer/index.js +33 -0
- package/dist/infra/cipher/consumer/queue-polling-service.d.ts +120 -0
- package/dist/infra/cipher/consumer/queue-polling-service.js +248 -0
- package/dist/infra/cipher/http/internal-llm-http-service.d.ts +94 -0
- package/dist/infra/cipher/http/internal-llm-http-service.js +118 -0
- package/dist/infra/cipher/llm/context/compaction/compaction-service.d.ts +106 -0
- package/dist/infra/cipher/llm/context/compaction/compaction-service.js +132 -0
- package/dist/infra/cipher/llm/context/compaction/index.d.ts +9 -0
- package/dist/infra/cipher/llm/context/compaction/index.js +9 -0
- package/dist/infra/cipher/llm/context/context-manager.d.ts +46 -2
- package/dist/infra/cipher/llm/context/context-manager.js +68 -4
- package/dist/infra/cipher/llm/context/rw-lock.d.ts +72 -0
- package/dist/infra/cipher/llm/context/rw-lock.js +145 -0
- package/dist/infra/cipher/llm/generators/byterover-content-generator.d.ts +7 -7
- package/dist/infra/cipher/llm/generators/byterover-content-generator.js +8 -8
- package/dist/infra/cipher/llm/internal-llm-service.js +2 -0
- package/dist/infra/cipher/session/session-manager.d.ts +4 -4
- package/dist/infra/cipher/session/session-manager.js +5 -5
- package/dist/infra/cipher/storage/agent-storage.d.ts +246 -0
- package/dist/infra/cipher/storage/agent-storage.js +956 -0
- package/dist/infra/cipher/storage/dual-format-history-storage.d.ts +77 -0
- package/dist/infra/cipher/storage/dual-format-history-storage.js +149 -0
- package/dist/infra/cipher/storage/granular-history-storage.d.ts +65 -0
- package/dist/infra/cipher/storage/granular-history-storage.js +118 -0
- package/dist/infra/cipher/storage/message-storage-service.d.ts +108 -0
- package/dist/infra/cipher/storage/message-storage-service.js +529 -0
- package/dist/infra/cipher/storage/process-utils.d.ts +16 -0
- package/dist/infra/cipher/storage/process-utils.js +43 -0
- package/dist/infra/cipher/storage/sqlite-key-storage.d.ts +105 -0
- package/dist/infra/cipher/storage/sqlite-key-storage.js +404 -0
- package/dist/infra/cipher/system-prompt/simple-prompt-factory.d.ts +1 -0
- package/dist/infra/cipher/system-prompt/simple-prompt-factory.js +7 -0
- package/dist/infra/cipher/tools/default-policy-rules.js +1 -1
- package/dist/infra/cipher/tools/implementations/curate-tool.d.ts +10 -0
- package/dist/infra/cipher/tools/implementations/curate-tool.js +371 -0
- package/dist/infra/cipher/tools/implementations/find-knowledge-topics-tool.js +11 -8
- package/dist/infra/cipher/tools/tool-manager.d.ts +8 -2
- package/dist/infra/cipher/tools/tool-manager.js +29 -2
- package/dist/infra/cipher/tools/tool-registry.js +7 -0
- package/dist/infra/http/authenticated-http-client.d.ts +21 -0
- package/dist/infra/http/authenticated-http-client.js +38 -0
- package/dist/infra/repl/commands/arg-parser.d.ts +97 -0
- package/dist/infra/repl/commands/arg-parser.js +129 -0
- package/dist/infra/repl/commands/clear-command.d.ts +5 -0
- package/dist/infra/repl/commands/clear-command.js +61 -0
- package/dist/infra/repl/commands/curate-command.d.ts +9 -0
- package/dist/infra/repl/commands/curate-command.js +88 -0
- package/dist/infra/repl/commands/gen-rules-command.d.ts +7 -0
- package/dist/infra/repl/commands/gen-rules-command.js +38 -0
- package/dist/infra/repl/commands/index.d.ts +8 -0
- package/dist/infra/repl/commands/index.js +36 -0
- package/dist/infra/repl/commands/init-command.d.ts +7 -0
- package/dist/infra/repl/commands/init-command.js +83 -0
- package/dist/infra/repl/commands/login-command.d.ts +7 -0
- package/dist/infra/repl/commands/login-command.js +50 -0
- package/dist/infra/repl/commands/logout-command.d.ts +5 -0
- package/dist/infra/repl/commands/logout-command.js +48 -0
- package/dist/infra/repl/commands/pull-command.d.ts +5 -0
- package/dist/infra/repl/commands/pull-command.js +61 -0
- package/dist/infra/repl/commands/push-command.d.ts +5 -0
- package/dist/infra/repl/commands/push-command.js +66 -0
- package/dist/infra/repl/commands/query-command.d.ts +5 -0
- package/dist/infra/repl/commands/query-command.js +66 -0
- package/dist/infra/repl/commands/space/index.d.ts +5 -0
- package/dist/infra/repl/commands/space/index.js +14 -0
- package/dist/infra/repl/commands/space/list-command.d.ts +5 -0
- package/dist/infra/repl/commands/space/list-command.js +70 -0
- package/dist/infra/repl/commands/space/switch-command.d.ts +5 -0
- package/dist/infra/repl/commands/space/switch-command.js +37 -0
- package/dist/infra/repl/commands/status-command.d.ts +5 -0
- package/dist/infra/repl/commands/status-command.js +39 -0
- package/dist/infra/repl/repl-startup.d.ts +18 -0
- package/dist/infra/repl/repl-startup.js +26 -0
- package/dist/infra/storage/file-global-config-store.d.ts +22 -0
- package/dist/infra/storage/file-global-config-store.js +65 -0
- package/dist/infra/storage/file-onboarding-preference-store.d.ts +10 -0
- package/dist/infra/storage/file-onboarding-preference-store.js +46 -0
- package/dist/infra/terminal/oclif-terminal.d.ts +19 -0
- package/dist/infra/terminal/oclif-terminal.js +60 -0
- package/dist/infra/terminal/repl-terminal.d.ts +31 -0
- package/dist/infra/terminal/repl-terminal.js +116 -0
- package/dist/infra/tracking/mixpanel-tracking-service.d.ts +11 -1
- package/dist/infra/tracking/mixpanel-tracking-service.js +18 -13
- package/dist/infra/usecase/clear-use-case.d.ts +20 -0
- package/dist/infra/usecase/clear-use-case.js +58 -0
- package/dist/infra/usecase/curate-use-case.d.ts +66 -0
- package/dist/infra/usecase/curate-use-case.js +283 -0
- package/dist/{commands/gen-rules.d.ts → infra/usecase/generate-rules-use-case.d.ts} +14 -20
- package/dist/{commands/gen-rules.js → infra/usecase/generate-rules-use-case.js} +59 -78
- package/dist/infra/usecase/init-use-case.d.ts +139 -0
- package/dist/{commands/init.js → infra/usecase/init-use-case.js} +184 -230
- package/dist/infra/usecase/login-use-case.d.ts +28 -0
- package/dist/infra/usecase/login-use-case.js +88 -0
- package/dist/infra/usecase/logout-use-case.d.ts +22 -0
- package/dist/infra/usecase/logout-use-case.js +51 -0
- package/dist/infra/usecase/pull-use-case.d.ts +35 -0
- package/dist/infra/usecase/pull-use-case.js +89 -0
- package/dist/infra/usecase/push-use-case.d.ts +37 -0
- package/dist/infra/usecase/push-use-case.js +124 -0
- package/dist/infra/usecase/query-use-case.d.ts +78 -0
- package/dist/infra/usecase/query-use-case.js +401 -0
- package/dist/infra/usecase/space-list-use-case.d.ts +27 -0
- package/dist/infra/usecase/space-list-use-case.js +64 -0
- package/dist/infra/usecase/space-switch-use-case.d.ts +36 -0
- package/dist/infra/usecase/space-switch-use-case.js +140 -0
- package/dist/infra/usecase/status-use-case.d.ts +27 -0
- package/dist/infra/usecase/status-use-case.js +97 -0
- package/dist/infra/workspace/workspace-detector-service.d.ts +3 -6
- package/dist/resources/prompts/curate-context-tree-curation.yml +23 -11
- package/dist/resources/prompts/query-context-tree-retrieval.yml +3 -4
- package/dist/resources/prompts/system-prompt.yml +1 -1
- package/dist/resources/prompts/tool-outputs.yml +4 -3
- package/dist/templates/sections/command-reference.md +12 -0
- package/dist/templates/sections/workflow.md +10 -1
- package/dist/tui/app.d.ts +9 -0
- package/dist/tui/app.js +26 -0
- package/dist/tui/components/enter-prompt.d.ts +13 -0
- package/dist/tui/components/enter-prompt.js +15 -0
- package/dist/tui/components/execution/execution-changes.d.ts +14 -0
- package/dist/tui/components/execution/execution-changes.js +15 -0
- package/dist/tui/components/execution/execution-content.d.ts +25 -0
- package/dist/tui/components/execution/execution-content.js +67 -0
- package/dist/tui/components/execution/execution-input.d.ts +12 -0
- package/dist/tui/components/execution/execution-input.js +16 -0
- package/dist/tui/components/execution/execution-progress.d.ts +21 -0
- package/dist/tui/components/execution/execution-progress.js +21 -0
- package/dist/tui/components/execution/execution-status.d.ts +13 -0
- package/dist/tui/components/execution/execution-status.js +19 -0
- package/dist/tui/components/execution/index.d.ts +11 -0
- package/dist/tui/components/execution/index.js +11 -0
- package/dist/tui/components/execution/log-item.d.ts +17 -0
- package/dist/tui/components/execution/log-item.js +25 -0
- package/dist/tui/components/footer.d.ts +5 -0
- package/dist/tui/components/footer.js +12 -0
- package/dist/tui/components/header.d.ts +18 -0
- package/dist/tui/components/header.js +18 -0
- package/dist/tui/components/index.d.ts +17 -0
- package/dist/tui/components/index.js +14 -0
- package/dist/tui/components/inline-prompts/index.d.ts +15 -0
- package/dist/tui/components/inline-prompts/index.js +10 -0
- package/dist/tui/components/inline-prompts/inline-confirm.d.ts +17 -0
- package/dist/tui/components/inline-prompts/inline-confirm.js +32 -0
- package/dist/tui/components/inline-prompts/inline-file-selector.d.ts +43 -0
- package/dist/tui/components/inline-prompts/inline-file-selector.js +185 -0
- package/dist/tui/components/inline-prompts/inline-input.d.ts +19 -0
- package/dist/tui/components/inline-prompts/inline-input.js +32 -0
- package/dist/tui/components/inline-prompts/inline-search.d.ts +20 -0
- package/dist/tui/components/inline-prompts/inline-search.js +50 -0
- package/dist/tui/components/inline-prompts/inline-select.d.ts +20 -0
- package/dist/tui/components/inline-prompts/inline-select.js +34 -0
- package/dist/tui/components/logo.d.ts +43 -0
- package/dist/tui/components/logo.js +103 -0
- package/dist/tui/components/message-item.d.ts +12 -0
- package/dist/tui/components/message-item.js +12 -0
- package/dist/tui/components/onboarding/copyable-prompt.d.ts +15 -0
- package/dist/tui/components/onboarding/copyable-prompt.js +65 -0
- package/dist/tui/components/onboarding/index.d.ts +7 -0
- package/dist/tui/components/onboarding/index.js +6 -0
- package/dist/tui/components/onboarding/onboarding-flow.d.ts +13 -0
- package/dist/tui/components/onboarding/onboarding-flow.js +304 -0
- package/dist/tui/components/onboarding/onboarding-step.d.ts +23 -0
- package/dist/tui/components/onboarding/onboarding-step.js +12 -0
- package/dist/tui/components/output-log.d.ts +14 -0
- package/dist/tui/components/output-log.js +13 -0
- package/dist/tui/components/scrollable-list.d.ts +30 -0
- package/dist/tui/components/scrollable-list.js +121 -0
- package/dist/tui/components/suggestions.d.ts +16 -0
- package/dist/tui/components/suggestions.js +162 -0
- package/dist/tui/components/tab-bar.d.ts +10 -0
- package/dist/tui/components/tab-bar.js +12 -0
- package/dist/tui/constants.d.ts +11 -0
- package/dist/tui/constants.js +13 -0
- package/dist/tui/contexts/auth-context.d.ts +30 -0
- package/dist/tui/contexts/auth-context.js +153 -0
- package/dist/tui/contexts/consumer.d.ts +31 -0
- package/dist/tui/contexts/consumer.js +56 -0
- package/dist/tui/contexts/index.d.ts +6 -0
- package/dist/tui/contexts/index.js +6 -0
- package/dist/tui/contexts/onboarding-context.d.ts +43 -0
- package/dist/tui/contexts/onboarding-context.js +181 -0
- package/dist/tui/contexts/services-context.d.ts +29 -0
- package/dist/tui/contexts/services-context.js +20 -0
- package/dist/tui/contexts/use-commands.d.ts +29 -0
- package/dist/tui/contexts/use-commands.js +53 -0
- package/dist/tui/contexts/use-mode.d.ts +43 -0
- package/dist/tui/contexts/use-mode.js +76 -0
- package/dist/tui/contexts/use-theme.d.ts +53 -0
- package/dist/tui/contexts/use-theme.js +60 -0
- package/dist/tui/hooks/index.d.ts +17 -0
- package/dist/tui/hooks/index.js +14 -0
- package/dist/tui/hooks/use-activity-logs.d.ts +26 -0
- package/dist/tui/hooks/use-activity-logs.js +90 -0
- package/dist/tui/hooks/use-consumer.d.ts +12 -0
- package/dist/tui/hooks/use-consumer.js +50 -0
- package/dist/tui/hooks/use-onboarding.d.ts +7 -0
- package/dist/tui/hooks/use-onboarding.js +6 -0
- package/dist/tui/hooks/use-queue-polling.d.ts +31 -0
- package/dist/tui/hooks/use-queue-polling.js +90 -0
- package/dist/tui/hooks/use-slash-command-processor.d.ts +16 -0
- package/dist/tui/hooks/use-slash-command-processor.js +132 -0
- package/dist/tui/hooks/use-slash-completion.d.ts +30 -0
- package/dist/tui/hooks/use-slash-completion.js +230 -0
- package/dist/tui/hooks/use-tab-navigation.d.ts +10 -0
- package/dist/tui/hooks/use-tab-navigation.js +35 -0
- package/dist/tui/hooks/use-visible-window.d.ts +22 -0
- package/dist/tui/hooks/use-visible-window.js +37 -0
- package/dist/tui/index.d.ts +1 -0
- package/dist/tui/index.js +1 -0
- package/dist/tui/providers/app-providers.d.ts +25 -0
- package/dist/tui/providers/app-providers.js +9 -0
- package/dist/tui/types/commands.d.ts +252 -0
- package/dist/tui/types/commands.js +16 -0
- package/dist/tui/types/dialogs.d.ts +37 -0
- package/dist/tui/types/dialogs.js +4 -0
- package/dist/tui/types/index.d.ts +11 -0
- package/dist/tui/types/index.js +7 -0
- package/dist/tui/types/messages.d.ts +55 -0
- package/dist/tui/types/messages.js +4 -0
- package/dist/tui/types/prompts.d.ts +100 -0
- package/dist/tui/types/prompts.js +4 -0
- package/dist/tui/types/ui.d.ts +14 -0
- package/dist/tui/types/ui.js +4 -0
- package/dist/tui/types.d.ts +1 -0
- package/dist/tui/types.js +1 -0
- package/dist/tui/views/command-view.d.ts +12 -0
- package/dist/tui/views/command-view.js +451 -0
- package/dist/tui/views/index.d.ts +6 -0
- package/dist/tui/views/index.js +6 -0
- package/dist/tui/views/login-view.d.ts +10 -0
- package/dist/tui/views/login-view.js +30 -0
- package/dist/tui/views/logs-view.d.ts +11 -0
- package/dist/tui/views/logs-view.js +73 -0
- package/dist/utils/file-validator.d.ts +16 -0
- package/dist/utils/file-validator.js +81 -0
- package/dist/utils/global-config-path.d.ts +15 -0
- package/dist/utils/global-config-path.js +38 -0
- package/oclif.manifest.json +29 -315
- package/package.json +11 -4
- package/dist/commands/clear.d.ts +0 -19
- package/dist/commands/clear.js +0 -78
- package/dist/commands/init.d.ts +0 -130
- package/dist/commands/login.d.ts +0 -22
- package/dist/commands/login.js +0 -108
- package/dist/commands/logout.d.ts +0 -16
- package/dist/commands/logout.js +0 -61
- package/dist/commands/pull.d.ts +0 -33
- package/dist/commands/pull.js +0 -115
- package/dist/commands/push.d.ts +0 -35
- package/dist/commands/push.js +0 -160
- package/dist/commands/space/list.d.ts +0 -25
- package/dist/commands/space/list.js +0 -114
- package/dist/commands/space/switch.d.ts +0 -36
- package/dist/commands/space/switch.js +0 -160
- package/dist/infra/cipher/grpc/internal-llm-grpc-service.d.ts +0 -149
- package/dist/infra/cipher/grpc/internal-llm-grpc-service.js +0 -364
- package/dist/infra/cipher/grpc/internal-llm-grpc.proto +0 -94
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage key as a tuple of string segments.
|
|
3
|
+
* Examples:
|
|
4
|
+
* ["message", sessionId, messageId]
|
|
5
|
+
* ["part", messageId, partId]
|
|
6
|
+
* ["session", sessionId]
|
|
7
|
+
*/
|
|
8
|
+
export type StorageKey = readonly string[];
|
|
9
|
+
/**
|
|
10
|
+
* Batch operation for atomic multi-key updates.
|
|
11
|
+
*/
|
|
12
|
+
export type BatchOperation = {
|
|
13
|
+
key: StorageKey;
|
|
14
|
+
type: 'delete';
|
|
15
|
+
} | {
|
|
16
|
+
key: StorageKey;
|
|
17
|
+
type: 'set';
|
|
18
|
+
value: unknown;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Low-level key-value storage interface for granular persistence.
|
|
22
|
+
*
|
|
23
|
+
* Enables hierarchical data organization with prefix-based operations.
|
|
24
|
+
* Designed to support the OpenCode-style message/part storage pattern
|
|
25
|
+
* where messages and parts are stored at separate keys for selective loading.
|
|
26
|
+
*
|
|
27
|
+
* Key path structure:
|
|
28
|
+
* - ["session", sessionId] → Session metadata
|
|
29
|
+
* - ["message", sessionId, messageId] → Individual message
|
|
30
|
+
* - ["part", messageId, partId] → Message part (tool output, file, etc.)
|
|
31
|
+
*/
|
|
32
|
+
export interface IKeyStorage {
|
|
33
|
+
/**
|
|
34
|
+
* Batch operations for atomic multi-key updates.
|
|
35
|
+
* All operations succeed or fail together.
|
|
36
|
+
*
|
|
37
|
+
* @param operations - Array of set/delete operations
|
|
38
|
+
*/
|
|
39
|
+
batch(operations: BatchOperation[]): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Delete a value by its composite key.
|
|
42
|
+
*
|
|
43
|
+
* @param key - Composite key as string segments
|
|
44
|
+
* @returns True if the key existed and was deleted, false if not found
|
|
45
|
+
*/
|
|
46
|
+
delete(key: StorageKey): Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Check if a key exists.
|
|
49
|
+
*
|
|
50
|
+
* @param key - Composite key as string segments
|
|
51
|
+
* @returns True if the key exists
|
|
52
|
+
*/
|
|
53
|
+
exists(key: StorageKey): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Get a value by its composite key.
|
|
56
|
+
*
|
|
57
|
+
* @param key - Composite key as string segments
|
|
58
|
+
* @returns The stored value, or undefined if not found
|
|
59
|
+
*/
|
|
60
|
+
get<T>(key: StorageKey): Promise<T | undefined>;
|
|
61
|
+
/**
|
|
62
|
+
* Initialize the storage backend.
|
|
63
|
+
* Should be called once before any other operations.
|
|
64
|
+
*/
|
|
65
|
+
initialize(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* List all keys matching a prefix.
|
|
68
|
+
* Used for iterating over messages in a session or parts of a message.
|
|
69
|
+
*
|
|
70
|
+
* @param prefix - Key prefix to match (e.g., ["message", sessionId])
|
|
71
|
+
* @returns Array of matching full keys
|
|
72
|
+
*/
|
|
73
|
+
list(prefix: StorageKey): Promise<StorageKey[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Set a value at a composite key.
|
|
76
|
+
* Creates or overwrites the value at the key.
|
|
77
|
+
*
|
|
78
|
+
* @param key - Composite key as string segments
|
|
79
|
+
* @param value - Value to store (will be JSON serialized)
|
|
80
|
+
*/
|
|
81
|
+
set<T>(key: StorageKey, value: T): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Atomic update with optimistic locking.
|
|
84
|
+
* Reads the current value, applies the updater function, and writes back.
|
|
85
|
+
*
|
|
86
|
+
* @param key - Key to update
|
|
87
|
+
* @param updater - Function that receives current value and returns new value
|
|
88
|
+
* @returns The new value after update
|
|
89
|
+
*/
|
|
90
|
+
update<T>(key: StorageKey, updater: (current: T | undefined) => T): Promise<T>;
|
|
91
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GlobalConfig } from '../domain/entities/global-config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for storing and retrieving global ByteRover CLI configuration.
|
|
4
|
+
* Implementations handle persistence of user-level config (e.g., ~/.config/brv/config.json).
|
|
5
|
+
*/
|
|
6
|
+
export interface IGlobalConfigStore {
|
|
7
|
+
/**
|
|
8
|
+
* Gets the existing device ID or creates a new one if not present.
|
|
9
|
+
* This is the primary method for obtaining the device ID for tracking.
|
|
10
|
+
*
|
|
11
|
+
* @returns The device ID (existing or newly generated)
|
|
12
|
+
*/
|
|
13
|
+
getOrCreateDeviceId: () => Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Reads the global configuration from the user's config directory.
|
|
16
|
+
*
|
|
17
|
+
* @returns The configuration if found and valid, undefined otherwise
|
|
18
|
+
*/
|
|
19
|
+
read: () => Promise<GlobalConfig | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Regenerates the device ID by creating a new UUID v4 and persisting it.
|
|
22
|
+
* Called when leaving authenticated state to break tracking continuity.
|
|
23
|
+
*
|
|
24
|
+
* @returns The newly generated device ID
|
|
25
|
+
*/
|
|
26
|
+
regenerateDeviceId: () => Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Writes the global configuration to the user's config directory.
|
|
29
|
+
* Creates the directory if it doesn't exist.
|
|
30
|
+
*
|
|
31
|
+
* @param config The configuration to write
|
|
32
|
+
*/
|
|
33
|
+
write: (config: GlobalConfig) => Promise<void>;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store for onboarding preferences.
|
|
3
|
+
* Used to persist when onboarding was last dismissed to implement
|
|
4
|
+
* cooldown periods (e.g., show onboarding at most once per week).
|
|
5
|
+
*/
|
|
6
|
+
export interface IOnboardingPreferenceStore {
|
|
7
|
+
/**
|
|
8
|
+
* Get the timestamp when onboarding was last dismissed.
|
|
9
|
+
* Returns undefined if never dismissed.
|
|
10
|
+
*/
|
|
11
|
+
getLastDismissedAt(): Promise<number | undefined>;
|
|
12
|
+
/**
|
|
13
|
+
* Set the timestamp when onboarding was dismissed.
|
|
14
|
+
*/
|
|
15
|
+
setLastDismissedAt(timestamp: number): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Clear the stored preference.
|
|
18
|
+
*/
|
|
19
|
+
clear(): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Choice option for select prompts.
|
|
3
|
+
*/
|
|
4
|
+
export interface SelectChoice<T> {
|
|
5
|
+
description?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
value: T;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Search source function type.
|
|
11
|
+
*/
|
|
12
|
+
export type SearchSource<T> = (input: string | undefined) => Promise<SelectChoice<T>[]> | SelectChoice<T>[];
|
|
13
|
+
/**
|
|
14
|
+
* Options for confirm prompt.
|
|
15
|
+
*/
|
|
16
|
+
export interface ConfirmOptions {
|
|
17
|
+
/** The default value (default: true) */
|
|
18
|
+
default?: boolean;
|
|
19
|
+
/** The confirmation message */
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Options for search prompt.
|
|
24
|
+
*/
|
|
25
|
+
export interface SearchOptions<T> {
|
|
26
|
+
/** The prompt message */
|
|
27
|
+
message: string;
|
|
28
|
+
/** Function that returns choices based on input */
|
|
29
|
+
source: SearchSource<T>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Options for select prompt.
|
|
33
|
+
*/
|
|
34
|
+
export interface SelectOptions<T> {
|
|
35
|
+
/** The available choices */
|
|
36
|
+
choices: SelectChoice<T>[];
|
|
37
|
+
/** The prompt message */
|
|
38
|
+
message: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Options for input prompt.
|
|
42
|
+
*/
|
|
43
|
+
export interface InputOptions {
|
|
44
|
+
/** The prompt message */
|
|
45
|
+
message: string;
|
|
46
|
+
/** Validation function (return true if valid, or error message string) */
|
|
47
|
+
validate?: (value: string) => boolean | string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* File selector item representation.
|
|
51
|
+
*/
|
|
52
|
+
export interface FileSelectorItem {
|
|
53
|
+
/** Whether the item is a directory */
|
|
54
|
+
isDirectory: boolean;
|
|
55
|
+
/** The file/directory name */
|
|
56
|
+
name: string;
|
|
57
|
+
/** The full path to the item */
|
|
58
|
+
path: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Options for file selector prompt.
|
|
62
|
+
*/
|
|
63
|
+
export interface FileSelectorOptions {
|
|
64
|
+
/** Allow user to cancel selection */
|
|
65
|
+
allowCancel?: boolean;
|
|
66
|
+
/** Base path to start selection from */
|
|
67
|
+
basePath: string;
|
|
68
|
+
/** Filter function to show/hide items */
|
|
69
|
+
filter?: (item: Readonly<FileSelectorItem>) => boolean;
|
|
70
|
+
/** The prompt message */
|
|
71
|
+
message: string;
|
|
72
|
+
/** Number of items to show per page */
|
|
73
|
+
pageSize?: number;
|
|
74
|
+
/** Custom theme labels */
|
|
75
|
+
theme?: {
|
|
76
|
+
labels?: {
|
|
77
|
+
messages?: {
|
|
78
|
+
cancel?: string;
|
|
79
|
+
empty?: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/** Type of items to select: 'directory' or 'file' */
|
|
84
|
+
type?: 'directory' | 'file';
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Interface for terminal interactions.
|
|
88
|
+
* Provides output and user input operations.
|
|
89
|
+
*/
|
|
90
|
+
export interface ITerminal {
|
|
91
|
+
/**
|
|
92
|
+
* Start a spinner/action indicator with a message.
|
|
93
|
+
* @param message The message to display while action is in progress
|
|
94
|
+
*/
|
|
95
|
+
actionStart(message: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* Stop the current spinner/action indicator.
|
|
98
|
+
* @param message Optional message to display when stopped
|
|
99
|
+
*/
|
|
100
|
+
actionStop(message?: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Display a error message.
|
|
103
|
+
* @param message The message to display
|
|
104
|
+
*/
|
|
105
|
+
error(message: string): void;
|
|
106
|
+
/**
|
|
107
|
+
* Display a message to the terminal.
|
|
108
|
+
* @param message The message to display (optional, empty line if omitted)
|
|
109
|
+
*/
|
|
110
|
+
log(message?: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* Display a warning message.
|
|
113
|
+
* @param message The message to display
|
|
114
|
+
*/
|
|
115
|
+
warn(message: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* Prompt the user for confirmation.
|
|
118
|
+
* @param options Confirmation options
|
|
119
|
+
* @returns Promise resolving to user's choice
|
|
120
|
+
*/
|
|
121
|
+
confirm(options: ConfirmOptions): Promise<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* Prompt the user to select a file or directory.
|
|
124
|
+
* @param options File selector options
|
|
125
|
+
* @returns Promise resolving to selected item, or null if cancelled
|
|
126
|
+
*/
|
|
127
|
+
fileSelector(options: FileSelectorOptions): Promise<FileSelectorItem | null>;
|
|
128
|
+
/**
|
|
129
|
+
* Prompt the user for text input.
|
|
130
|
+
* @param options Input options
|
|
131
|
+
* @returns Promise resolving to user's input string
|
|
132
|
+
*/
|
|
133
|
+
input(options: InputOptions): Promise<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Prompt the user to search and select from options.
|
|
136
|
+
* @param options Search options
|
|
137
|
+
* @returns Promise resolving to selected value
|
|
138
|
+
*/
|
|
139
|
+
search<T>(options: SearchOptions<T>): Promise<T>;
|
|
140
|
+
/**
|
|
141
|
+
* Prompt the user to select from a list of choices.
|
|
142
|
+
* @param options Select options
|
|
143
|
+
* @returns Promise resolving to selected value
|
|
144
|
+
*/
|
|
145
|
+
select<T>(options: SelectOptions<T>): Promise<T>;
|
|
146
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -68,8 +68,7 @@ const hook = async function (options) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
// Detect root help commands only (not command-specific help)
|
|
71
|
-
const isRootHelp = (options.id ===
|
|
72
|
-
(options.id === '--help' && options.argv.length === 0) || // `brv --help`
|
|
71
|
+
const isRootHelp = (options.id === '--help' && options.argv.length === 0) || // `brv --help`
|
|
73
72
|
(options.id === 'help' && options.argv.length === 0); // `brv help`
|
|
74
73
|
if (isRootHelp) {
|
|
75
74
|
const logo = [
|
|
@@ -6,10 +6,10 @@ import type { CipherAgentServices, SessionServices } from '../../core/interfaces
|
|
|
6
6
|
*/
|
|
7
7
|
export interface CipherLLMConfig {
|
|
8
8
|
accessToken: string;
|
|
9
|
+
apiBaseUrl: string;
|
|
9
10
|
apiKey?: string;
|
|
10
11
|
blobStorageConfig?: Partial<BlobStorageConfig>;
|
|
11
12
|
fileSystemConfig?: Partial<FileSystemConfig>;
|
|
12
|
-
grpcEndpoint: string;
|
|
13
13
|
httpReferer?: string;
|
|
14
14
|
maxIterations?: number;
|
|
15
15
|
maxTokens?: number;
|
|
@@ -22,14 +22,21 @@ export interface CipherLLMConfig {
|
|
|
22
22
|
temperature?: number;
|
|
23
23
|
topK?: number;
|
|
24
24
|
topP?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Enable granular history storage for new sessions.
|
|
27
|
+
* When enabled, new sessions use per-message storage with streaming support.
|
|
28
|
+
* Existing sessions continue using blob storage (no migration).
|
|
29
|
+
* Default: false (use blob storage for all sessions)
|
|
30
|
+
*/
|
|
31
|
+
useGranularStorage?: boolean;
|
|
25
32
|
verbose?: boolean;
|
|
26
33
|
}
|
|
27
34
|
/**
|
|
28
|
-
*
|
|
35
|
+
* HTTP configuration for ByteRover LLM service
|
|
29
36
|
*/
|
|
30
|
-
export interface
|
|
37
|
+
export interface ByteRoverHttpConfig {
|
|
31
38
|
accessToken: string;
|
|
32
|
-
|
|
39
|
+
apiBaseUrl: string;
|
|
33
40
|
projectId: string;
|
|
34
41
|
region?: string;
|
|
35
42
|
sessionKey: string;
|
|
@@ -62,7 +69,7 @@ export declare function createCipherAgentServices(llmConfig: CipherLLMConfig): P
|
|
|
62
69
|
*
|
|
63
70
|
* @param sessionId - Unique session identifier
|
|
64
71
|
* @param sharedServices - Shared services from agent
|
|
65
|
-
* @param
|
|
72
|
+
* @param httpConfig - HTTP configuration
|
|
66
73
|
* @param llmConfig - LLM service configuration
|
|
67
74
|
* @param llmConfig.openRouterApiKey - Optional OpenRouter API key for OpenRouter service
|
|
68
75
|
* @param llmConfig.httpReferer - Optional HTTP Referer for OpenRouter rankings
|
|
@@ -74,7 +81,7 @@ export declare function createCipherAgentServices(llmConfig: CipherLLMConfig): P
|
|
|
74
81
|
* @param llmConfig.verbose - Enable verbose debug output
|
|
75
82
|
* @returns Initialized session services
|
|
76
83
|
*/
|
|
77
|
-
export declare function createSessionServices(sessionId: string, sharedServices: CipherAgentServices,
|
|
84
|
+
export declare function createSessionServices(sessionId: string, sharedServices: CipherAgentServices, httpConfig: ByteRoverHttpConfig, llmConfig: {
|
|
78
85
|
httpReferer?: string;
|
|
79
86
|
maxIterations?: number;
|
|
80
87
|
maxTokens?: number;
|
|
@@ -2,7 +2,7 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { createBlobStorage } from './blob/blob-storage-factory.js';
|
|
3
3
|
import { AgentEventBus, SessionEventBus } from './events/event-emitter.js';
|
|
4
4
|
import { FileSystemService } from './file-system/file-system-service.js';
|
|
5
|
-
import {
|
|
5
|
+
import { ByteRoverLlmHttpService } from './http/internal-llm-http-service.js';
|
|
6
6
|
import { ByteRoverContentGenerator, LoggingContentGenerator, RetryableContentGenerator } from './llm/generators/index.js';
|
|
7
7
|
import { ByteRoverLLMService } from './llm/internal-llm-service.js';
|
|
8
8
|
import { OpenRouterLLMService } from './llm/openrouter-llm-service.js';
|
|
@@ -11,6 +11,10 @@ import { EventBasedLogger } from './logger/event-based-logger.js';
|
|
|
11
11
|
import { MemoryManager } from './memory/memory-manager.js';
|
|
12
12
|
import { ProcessService } from './process/process-service.js';
|
|
13
13
|
import { BlobHistoryStorage } from './storage/blob-history-storage.js';
|
|
14
|
+
import { DualFormatHistoryStorage } from './storage/dual-format-history-storage.js';
|
|
15
|
+
import { GranularHistoryStorage } from './storage/granular-history-storage.js';
|
|
16
|
+
import { MessageStorageService } from './storage/message-storage-service.js';
|
|
17
|
+
import { SqliteKeyStorage } from './storage/sqlite-key-storage.js';
|
|
14
18
|
import { SimplePromptFactory } from './system-prompt/simple-prompt-factory.js';
|
|
15
19
|
import { CoreToolScheduler } from './tools/core-tool-scheduler.js';
|
|
16
20
|
import { DEFAULT_POLICY_RULES } from './tools/default-policy-rules.js';
|
|
@@ -82,7 +86,27 @@ export async function createCipherAgentServices(llmConfig) {
|
|
|
82
86
|
const toolManager = new ToolManager(toolProvider, toolScheduler);
|
|
83
87
|
await toolManager.initialize();
|
|
84
88
|
// 11. History storage (depends on BlobStorage) - SHARED across sessions
|
|
85
|
-
|
|
89
|
+
// Use DualFormatHistoryStorage when granular storage is enabled
|
|
90
|
+
let historyStorage;
|
|
91
|
+
if (llmConfig.useGranularStorage) {
|
|
92
|
+
// Create granular storage infrastructure
|
|
93
|
+
const keyStorage = new SqliteKeyStorage({
|
|
94
|
+
storageDir: join(workingDirectory, '.brv'),
|
|
95
|
+
});
|
|
96
|
+
await keyStorage.initialize();
|
|
97
|
+
const messageStorage = new MessageStorageService(keyStorage);
|
|
98
|
+
const granularStorage = new GranularHistoryStorage(messageStorage);
|
|
99
|
+
const blobHistoryStorage = new BlobHistoryStorage(blobStorage);
|
|
100
|
+
// DualFormatHistoryStorage routes between formats:
|
|
101
|
+
// - New sessions → GranularHistoryStorage
|
|
102
|
+
// - Existing sessions → BlobHistoryStorage (no migration)
|
|
103
|
+
historyStorage = new DualFormatHistoryStorage(blobHistoryStorage, granularStorage);
|
|
104
|
+
logger.info('Granular history storage enabled for new sessions');
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
// Default: use blob storage for all sessions
|
|
108
|
+
historyStorage = new BlobHistoryStorage(blobStorage);
|
|
109
|
+
}
|
|
86
110
|
// Log successful initialization
|
|
87
111
|
logger.info('CipherAgent services initialized successfully', {
|
|
88
112
|
model: llmConfig.model,
|
|
@@ -116,7 +140,7 @@ export async function createCipherAgentServices(llmConfig) {
|
|
|
116
140
|
*
|
|
117
141
|
* @param sessionId - Unique session identifier
|
|
118
142
|
* @param sharedServices - Shared services from agent
|
|
119
|
-
* @param
|
|
143
|
+
* @param httpConfig - HTTP configuration
|
|
120
144
|
* @param llmConfig - LLM service configuration
|
|
121
145
|
* @param llmConfig.openRouterApiKey - Optional OpenRouter API key for OpenRouter service
|
|
122
146
|
* @param llmConfig.httpReferer - Optional HTTP Referer for OpenRouter rankings
|
|
@@ -128,7 +152,7 @@ export async function createCipherAgentServices(llmConfig) {
|
|
|
128
152
|
* @param llmConfig.verbose - Enable verbose debug output
|
|
129
153
|
* @returns Initialized session services
|
|
130
154
|
*/
|
|
131
|
-
export function createSessionServices(sessionId, sharedServices,
|
|
155
|
+
export function createSessionServices(sessionId, sharedServices, httpConfig, llmConfig) {
|
|
132
156
|
// 1. Create session-specific event bus
|
|
133
157
|
const sessionEventBus = new SessionEventBus();
|
|
134
158
|
// 2. Create session-scoped logger
|
|
@@ -157,20 +181,20 @@ export function createSessionServices(sessionId, sharedServices, grpcConfig, llm
|
|
|
157
181
|
});
|
|
158
182
|
}
|
|
159
183
|
else {
|
|
160
|
-
// Use
|
|
161
|
-
// Step 1: Create
|
|
162
|
-
const
|
|
163
|
-
accessToken:
|
|
164
|
-
|
|
165
|
-
projectId:
|
|
166
|
-
region:
|
|
167
|
-
sessionKey:
|
|
168
|
-
spaceId:
|
|
169
|
-
teamId:
|
|
170
|
-
timeout:
|
|
184
|
+
// Use HTTP backend service (default) with new generator pattern
|
|
185
|
+
// Step 1: Create HTTP service
|
|
186
|
+
const httpService = new ByteRoverLlmHttpService({
|
|
187
|
+
accessToken: httpConfig.accessToken,
|
|
188
|
+
apiBaseUrl: httpConfig.apiBaseUrl,
|
|
189
|
+
projectId: httpConfig.projectId,
|
|
190
|
+
region: httpConfig.region,
|
|
191
|
+
sessionKey: httpConfig.sessionKey,
|
|
192
|
+
spaceId: httpConfig.spaceId,
|
|
193
|
+
teamId: httpConfig.teamId,
|
|
194
|
+
timeout: httpConfig.timeout,
|
|
171
195
|
});
|
|
172
196
|
// Step 2: Create base content generator
|
|
173
|
-
let generator = new ByteRoverContentGenerator(
|
|
197
|
+
let generator = new ByteRoverContentGenerator(httpService, {
|
|
174
198
|
maxTokens: llmConfig.maxTokens ?? 8192,
|
|
175
199
|
model: llmConfig.model ?? 'gemini-2.5-pro',
|
|
176
200
|
temperature: llmConfig.temperature ?? 0.7,
|
|
@@ -209,10 +209,10 @@ export class CipherAgent {
|
|
|
209
209
|
// No need for upfront validation - let services handle their own setup
|
|
210
210
|
// Create SHARED services only (following Dexto's pattern)
|
|
211
211
|
const sharedServices = await createCipherAgentServices(this.llmConfig);
|
|
212
|
-
// Extract
|
|
213
|
-
const
|
|
212
|
+
// Extract HTTP config from llmConfig
|
|
213
|
+
const httpConfig = {
|
|
214
214
|
accessToken: this.llmConfig.accessToken,
|
|
215
|
-
|
|
215
|
+
apiBaseUrl: this.llmConfig.apiBaseUrl,
|
|
216
216
|
projectId: this.llmConfig.projectId,
|
|
217
217
|
region: this.llmConfig.region,
|
|
218
218
|
sessionKey: this.llmConfig.sessionKey,
|
|
@@ -231,7 +231,7 @@ export class CipherAgent {
|
|
|
231
231
|
verbose: this.llmConfig.verbose,
|
|
232
232
|
};
|
|
233
233
|
// Create SessionManager with shared services
|
|
234
|
-
const sessionManager = new SessionManager(sharedServices,
|
|
234
|
+
const sessionManager = new SessionManager(sharedServices, httpConfig, sessionLLMConfig, {
|
|
235
235
|
config: {
|
|
236
236
|
maxSessions: 100,
|
|
237
237
|
sessionTTL: 3_600_000, // 1 hour
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DB-based consumer lock utilities
|
|
3
|
+
*
|
|
4
|
+
* The actual locking is now handled by AgentStorage methods:
|
|
5
|
+
* - acquireConsumerLock(consumerId)
|
|
6
|
+
* - releaseConsumerLock(consumerId)
|
|
7
|
+
* - hasActiveConsumer(timeoutMs)
|
|
8
|
+
*
|
|
9
|
+
* These utility functions provide a simple interface for checking consumer status.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Check if a consumer is currently running (has active heartbeat in DB)
|
|
13
|
+
* Auto-detects .brv/blobs path from cwd
|
|
14
|
+
*/
|
|
15
|
+
export declare function isConsumerRunning(): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if a consumer is currently running (sync version)
|
|
18
|
+
* Assumes storage is already initialized
|
|
19
|
+
*/
|
|
20
|
+
export declare function isConsumerRunningSync(): boolean;
|