@caretive/caret-cli 0.0.1
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/.npmrc.tmp +2 -0
- package/README.md +72 -0
- package/cmd/cline/main.go +348 -0
- package/cmd/cline-host/main.go +71 -0
- package/e2e/default_update_test.go +154 -0
- package/e2e/helpers_test.go +378 -0
- package/e2e/main_test.go +47 -0
- package/e2e/mixed_stress_test.go +120 -0
- package/e2e/sqlite_helper.go +161 -0
- package/e2e/start_list_test.go +178 -0
- package/go.mod +64 -0
- package/go.sum +162 -0
- package/man/cline.1 +331 -0
- package/man/cline.1.md +332 -0
- package/package.json +54 -0
- package/pkg/cli/auth/auth_cline_provider.go +285 -0
- package/pkg/cli/auth/auth_menu.go +323 -0
- package/pkg/cli/auth/auth_subscription.go +130 -0
- package/pkg/cli/auth/byo_quick_setup.go +247 -0
- package/pkg/cli/auth/models_cline.go +141 -0
- package/pkg/cli/auth/models_list_fetch.go +156 -0
- package/pkg/cli/auth/models_list_static.go +69 -0
- package/pkg/cli/auth/providers_byo.go +184 -0
- package/pkg/cli/auth/providers_list.go +517 -0
- package/pkg/cli/auth/update_api_configurations.go +647 -0
- package/pkg/cli/auth/wizard_byo.go +764 -0
- package/pkg/cli/auth/wizard_byo_bedrock.go +193 -0
- package/pkg/cli/auth/wizard_byo_oca.go +366 -0
- package/pkg/cli/auth.go +43 -0
- package/pkg/cli/clerror/cline_error.go +187 -0
- package/pkg/cli/config/manager.go +208 -0
- package/pkg/cli/config/settings_renderer.go +198 -0
- package/pkg/cli/config.go +152 -0
- package/pkg/cli/display/ansi.go +27 -0
- package/pkg/cli/display/banner.go +211 -0
- package/pkg/cli/display/deduplicator.go +95 -0
- package/pkg/cli/display/markdown_renderer.go +139 -0
- package/pkg/cli/display/renderer.go +304 -0
- package/pkg/cli/display/segment_streamer.go +212 -0
- package/pkg/cli/display/streaming.go +134 -0
- package/pkg/cli/display/system_renderer.go +269 -0
- package/pkg/cli/display/tool_renderer.go +455 -0
- package/pkg/cli/display/tool_result_parser.go +371 -0
- package/pkg/cli/display/typewriter.go +210 -0
- package/pkg/cli/doctor.go +65 -0
- package/pkg/cli/global/cline-clients.go +501 -0
- package/pkg/cli/global/global.go +113 -0
- package/pkg/cli/global/registry.go +304 -0
- package/pkg/cli/handlers/ask_handlers.go +339 -0
- package/pkg/cli/handlers/handler.go +130 -0
- package/pkg/cli/handlers/say_handlers.go +521 -0
- package/pkg/cli/instances.go +506 -0
- package/pkg/cli/logs.go +382 -0
- package/pkg/cli/output/coordinator.go +167 -0
- package/pkg/cli/output/input_model.go +497 -0
- package/pkg/cli/sqlite/locks.go +366 -0
- package/pkg/cli/task/history_handler.go +72 -0
- package/pkg/cli/task/input_handler.go +577 -0
- package/pkg/cli/task/manager.go +1283 -0
- package/pkg/cli/task/settings_parser.go +754 -0
- package/pkg/cli/task/stream_coordinator.go +60 -0
- package/pkg/cli/task.go +675 -0
- package/pkg/cli/terminal/keyboard.go +695 -0
- package/pkg/cli/tui/HELP_WANTED.md +1 -0
- package/pkg/cli/types/history.go +17 -0
- package/pkg/cli/types/messages.go +329 -0
- package/pkg/cli/types/state.go +59 -0
- package/pkg/cli/updater/updater.go +409 -0
- package/pkg/cli/version.go +43 -0
- package/pkg/common/constants.go +6 -0
- package/pkg/common/schema.go +54 -0
- package/pkg/common/types.go +54 -0
- package/pkg/common/utils.go +185 -0
- package/pkg/generated/field_overrides.go +39 -0
- package/pkg/generated/providers.go +1584 -0
- package/pkg/hostbridge/diff.go +351 -0
- package/pkg/hostbridge/disabled/watch.go +39 -0
- package/pkg/hostbridge/disabled/window.go +63 -0
- package/pkg/hostbridge/disabled/workspace.go +66 -0
- package/pkg/hostbridge/env.go +166 -0
- package/pkg/hostbridge/grpc_server.go +113 -0
- package/pkg/hostbridge/simple.go +43 -0
- package/pkg/hostbridge/simple_workspace.go +85 -0
- package/pkg/hostbridge/window.go +129 -0
- package/scripts/publish-caret-cli.sh +39 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
package task
|
|
2
|
+
|
|
3
|
+
import "sync"
|
|
4
|
+
|
|
5
|
+
// StreamCoordinator manages coordination between SubscribeToState and SubscribeToPartialMessage streams
|
|
6
|
+
type StreamCoordinator struct {
|
|
7
|
+
conversationTurnStartIndex int // First message index of current turn
|
|
8
|
+
processedInCurrentTurn map[string]bool // What we've handled in THIS turn
|
|
9
|
+
inputAllowed bool // Whether user input is currently allowed
|
|
10
|
+
mu sync.RWMutex // Protects inputAllowed
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// NewStreamCoordinator creates a new stream coordinator
|
|
14
|
+
func NewStreamCoordinator() *StreamCoordinator {
|
|
15
|
+
return &StreamCoordinator{
|
|
16
|
+
conversationTurnStartIndex: 0,
|
|
17
|
+
processedInCurrentTurn: make(map[string]bool),
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// SetConversationTurnStartIndex sets the starting index for the current conversation turn
|
|
22
|
+
func (sc *StreamCoordinator) SetConversationTurnStartIndex(index int) {
|
|
23
|
+
sc.conversationTurnStartIndex = index
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// GetConversationTurnStartIndex returns the starting index for the current conversation turn
|
|
27
|
+
func (sc *StreamCoordinator) GetConversationTurnStartIndex() int {
|
|
28
|
+
return sc.conversationTurnStartIndex
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// MarkProcessedInCurrentTurn marks an item as processed in the current turn
|
|
32
|
+
func (sc *StreamCoordinator) MarkProcessedInCurrentTurn(key string) {
|
|
33
|
+
sc.processedInCurrentTurn[key] = true
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// IsProcessedInCurrentTurn checks if an item has been processed in the current turn
|
|
37
|
+
func (sc *StreamCoordinator) IsProcessedInCurrentTurn(key string) bool {
|
|
38
|
+
return sc.processedInCurrentTurn[key]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// CompleteTurn updates the start index for the next batch of messages
|
|
42
|
+
// Note: Does NOT reset the processed map - that persists across state updates
|
|
43
|
+
func (sc *StreamCoordinator) CompleteTurn(totalMessages int) {
|
|
44
|
+
sc.conversationTurnStartIndex = totalMessages
|
|
45
|
+
// Don't reset processedInCurrentTurn - it should persist across state updates
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// SetInputAllowed sets whether user input is currently allowed
|
|
49
|
+
func (sc *StreamCoordinator) SetInputAllowed(allowed bool) {
|
|
50
|
+
sc.mu.Lock()
|
|
51
|
+
defer sc.mu.Unlock()
|
|
52
|
+
sc.inputAllowed = allowed
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// IsInputAllowed returns whether user input is currently allowed
|
|
56
|
+
func (sc *StreamCoordinator) IsInputAllowed() bool {
|
|
57
|
+
sc.mu.RLock()
|
|
58
|
+
defer sc.mu.RUnlock()
|
|
59
|
+
return sc.inputAllowed
|
|
60
|
+
}
|