@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.
Files changed (85) hide show
  1. package/.npmrc.tmp +2 -0
  2. package/README.md +72 -0
  3. package/cmd/cline/main.go +348 -0
  4. package/cmd/cline-host/main.go +71 -0
  5. package/e2e/default_update_test.go +154 -0
  6. package/e2e/helpers_test.go +378 -0
  7. package/e2e/main_test.go +47 -0
  8. package/e2e/mixed_stress_test.go +120 -0
  9. package/e2e/sqlite_helper.go +161 -0
  10. package/e2e/start_list_test.go +178 -0
  11. package/go.mod +64 -0
  12. package/go.sum +162 -0
  13. package/man/cline.1 +331 -0
  14. package/man/cline.1.md +332 -0
  15. package/package.json +54 -0
  16. package/pkg/cli/auth/auth_cline_provider.go +285 -0
  17. package/pkg/cli/auth/auth_menu.go +323 -0
  18. package/pkg/cli/auth/auth_subscription.go +130 -0
  19. package/pkg/cli/auth/byo_quick_setup.go +247 -0
  20. package/pkg/cli/auth/models_cline.go +141 -0
  21. package/pkg/cli/auth/models_list_fetch.go +156 -0
  22. package/pkg/cli/auth/models_list_static.go +69 -0
  23. package/pkg/cli/auth/providers_byo.go +184 -0
  24. package/pkg/cli/auth/providers_list.go +517 -0
  25. package/pkg/cli/auth/update_api_configurations.go +647 -0
  26. package/pkg/cli/auth/wizard_byo.go +764 -0
  27. package/pkg/cli/auth/wizard_byo_bedrock.go +193 -0
  28. package/pkg/cli/auth/wizard_byo_oca.go +366 -0
  29. package/pkg/cli/auth.go +43 -0
  30. package/pkg/cli/clerror/cline_error.go +187 -0
  31. package/pkg/cli/config/manager.go +208 -0
  32. package/pkg/cli/config/settings_renderer.go +198 -0
  33. package/pkg/cli/config.go +152 -0
  34. package/pkg/cli/display/ansi.go +27 -0
  35. package/pkg/cli/display/banner.go +211 -0
  36. package/pkg/cli/display/deduplicator.go +95 -0
  37. package/pkg/cli/display/markdown_renderer.go +139 -0
  38. package/pkg/cli/display/renderer.go +304 -0
  39. package/pkg/cli/display/segment_streamer.go +212 -0
  40. package/pkg/cli/display/streaming.go +134 -0
  41. package/pkg/cli/display/system_renderer.go +269 -0
  42. package/pkg/cli/display/tool_renderer.go +455 -0
  43. package/pkg/cli/display/tool_result_parser.go +371 -0
  44. package/pkg/cli/display/typewriter.go +210 -0
  45. package/pkg/cli/doctor.go +65 -0
  46. package/pkg/cli/global/cline-clients.go +501 -0
  47. package/pkg/cli/global/global.go +113 -0
  48. package/pkg/cli/global/registry.go +304 -0
  49. package/pkg/cli/handlers/ask_handlers.go +339 -0
  50. package/pkg/cli/handlers/handler.go +130 -0
  51. package/pkg/cli/handlers/say_handlers.go +521 -0
  52. package/pkg/cli/instances.go +506 -0
  53. package/pkg/cli/logs.go +382 -0
  54. package/pkg/cli/output/coordinator.go +167 -0
  55. package/pkg/cli/output/input_model.go +497 -0
  56. package/pkg/cli/sqlite/locks.go +366 -0
  57. package/pkg/cli/task/history_handler.go +72 -0
  58. package/pkg/cli/task/input_handler.go +577 -0
  59. package/pkg/cli/task/manager.go +1283 -0
  60. package/pkg/cli/task/settings_parser.go +754 -0
  61. package/pkg/cli/task/stream_coordinator.go +60 -0
  62. package/pkg/cli/task.go +675 -0
  63. package/pkg/cli/terminal/keyboard.go +695 -0
  64. package/pkg/cli/tui/HELP_WANTED.md +1 -0
  65. package/pkg/cli/types/history.go +17 -0
  66. package/pkg/cli/types/messages.go +329 -0
  67. package/pkg/cli/types/state.go +59 -0
  68. package/pkg/cli/updater/updater.go +409 -0
  69. package/pkg/cli/version.go +43 -0
  70. package/pkg/common/constants.go +6 -0
  71. package/pkg/common/schema.go +54 -0
  72. package/pkg/common/types.go +54 -0
  73. package/pkg/common/utils.go +185 -0
  74. package/pkg/generated/field_overrides.go +39 -0
  75. package/pkg/generated/providers.go +1584 -0
  76. package/pkg/hostbridge/diff.go +351 -0
  77. package/pkg/hostbridge/disabled/watch.go +39 -0
  78. package/pkg/hostbridge/disabled/window.go +63 -0
  79. package/pkg/hostbridge/disabled/workspace.go +66 -0
  80. package/pkg/hostbridge/env.go +166 -0
  81. package/pkg/hostbridge/grpc_server.go +113 -0
  82. package/pkg/hostbridge/simple.go +43 -0
  83. package/pkg/hostbridge/simple_workspace.go +85 -0
  84. package/pkg/hostbridge/window.go +129 -0
  85. 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
+ }