aia 0.9.12 → 0.9.14

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.
data/_notes.txt DELETED
@@ -1,231 +0,0 @@
1
-
2
- --- 2025-02-01 18:01:36 -0600
3
- I have no idea where I left off in this branch. The objective is to replace all the back-end processes with AiClient.
4
-
5
- Tests are failing.
6
-
7
- Make a few changes. It seems to be working in its basic modes.
8
-
9
- --- 2025-02-21 20:13:19 -0600
10
- Implemented Stark's clean slate protocol
11
-
12
-
13
-
14
-
15
-
16
- --- 2025-03-29 21:39:46 -0500
17
- starting the refactor to take advantage of the new capability of the PromptMananger gem.
18
-
19
- lib/aia/chat_processor_service.rb
20
-
21
-
22
-
23
- --- 2025-04-03 22:17:11 -0500
24
- i have been tring to get multi-line input to work in the chat mode but have run into all kinds of problems. I think it would be best just to invoke the users editor for that kind of operation. Alo I am not sure but I thing the same ask method is used for getting values for parameters. changes may have been committed but they should be reversed back to the original and start over.
25
-
26
- def get_multiline_input
27
- input_lines = []
28
- current_line = ""
29
- last_key_time = Time.now
30
- waiting_printed = 0 # Track number of WAITING characters printed
31
-
32
- STDIN.raw! # Enable raw mode for immediate keypress detection
33
- begin
34
- loop do
35
- begin
36
- r, _, _ = IO.select([STDIN], nil, nil, 0.1)
37
- if r
38
- char = STDIN.getc
39
- last_key_time = Time.now
40
- # Clear waiting characters when user types again
41
- if waiting_printed > 0
42
- print WAITING_ERASE * waiting_printed # Erase all waiting characters
43
- $stdout.flush
44
- waiting_printed = 0
45
- end
46
- else
47
- if (Time.now - last_key_time >= KEYPRESS_TIMEUT) &&
48
- waiting_printed == 0 &&
49
- (!input_lines.empty? || !current_line.empty?)
50
- print WAITING
51
- $stdout.flush
52
- waiting_printed = 1 # Record one '?' printed
53
- end
54
- next
55
- end
56
-
57
- rescue Interrupt
58
- puts "\nInput cancelled. Discarding current input; please start over."
59
- input_lines = []
60
- current_line = ""
61
- waiting_printed = 0
62
- last_key_time = Time.now
63
- next
64
- end
65
-
66
- break if char.nil? # Handle EOF (Ctrl+D)
67
-
68
- if char == "\r" || char == "\n"
69
- if current_line.empty? && !input_lines.empty?
70
- break # Two Enters in a row submits
71
- else
72
- input_lines << current_line
73
- current_line = ""
74
- waiting_printed = 0 # Reset waiting on new line
75
- print "\n\r"
76
- $stdout.flush
77
- end
78
-
79
- elsif char == "\x04" # Ctrl+D
80
- break
81
-
82
- elsif char == "\x08" || char == "\x7F" # Backspace or Delete
83
- if !current_line.empty?
84
- current_line.chop!
85
- print WAITING_ERASE
86
- $stdout.flush
87
- elsif waiting_printed > 0
88
- # Clear one waiting character if current_line is empty
89
- print "\b \b"
90
- $stdout.flush
91
- waiting_printed -= 1
92
- end
93
-
94
- else
95
- current_line << char
96
- print char
97
- $stdout.flush
98
- end
99
- end
100
-
101
- ensure
102
- STDIN.cooked! # Restore terminal to normal mode
103
- end
104
-
105
- input_lines << current_line unless current_line.empty?
106
-
107
- # Handle single-line special case
108
- if input_lines.size == 1
109
- if special_first_line_processing(input_lines.first)
110
- # If special (starts with "//"), return immediately as if double return was pressed
111
- return input_lines.first
112
- else
113
- # If not special, keep as is and return the full input
114
- return input_lines.join("\n")
115
- end
116
- end
117
-
118
- input_lines.join("\n").tap do |result|
119
- puts "\n" if result.empty? # Clean up display if no input
120
- end
121
-
122
- rescue EOFError
123
- input_lines.join("\n")
124
- end
125
-
126
-
127
-
128
- --- 2025-04-03 22:18:18 -0500
129
- by using subl -w for multi-line input in chat mode that gives us the ability to write ERB for chat input.
130
-
131
- def get_multiline_input
132
- input_lines = []
133
- current_line = ""
134
- last_key_time = Time.now
135
- waiting_printed = 0 # Track number of WAITING characters printed
136
-
137
- STDIN.raw! # Enable raw mode for immediate keypress detection
138
- begin
139
- loop do
140
- begin
141
- r, _, _ = IO.select([STDIN], nil, nil, 0.1)
142
- if r
143
- char = STDIN.getc
144
- last_key_time = Time.now
145
- # Clear waiting characters when user types again
146
- if waiting_printed > 0
147
- print WAITING_ERASE * waiting_printed # Erase all waiting characters
148
- $stdout.flush
149
- waiting_printed = 0
150
- end
151
- else
152
- if (Time.now - last_key_time >= KEYPRESS_TIMEUT) &&
153
- waiting_printed == 0 &&
154
- (!input_lines.empty? || !current_line.empty?)
155
- print WAITING
156
- $stdout.flush
157
- waiting_printed = 1 # Record one '?' printed
158
- end
159
- next
160
- end
161
-
162
- rescue Interrupt
163
- puts "\nInput cancelled. Discarding current input; please start over."
164
- input_lines = []
165
- current_line = ""
166
- waiting_printed = 0
167
- last_key_time = Time.now
168
- next
169
- end
170
-
171
- break if char.nil? # Handle EOF (Ctrl+D)
172
-
173
- if char == "\r" || char == "\n"
174
- if current_line.empty? && !input_lines.empty?
175
- break # Two Enters in a row submits
176
- else
177
- input_lines << current_line
178
- current_line = ""
179
- waiting_printed = 0 # Reset waiting on new line
180
- print "\n\r"
181
- $stdout.flush
182
- end
183
-
184
- elsif char == "\x04" # Ctrl+D
185
- break
186
-
187
- elsif char == "\x08" || char == "\x7F" # Backspace or Delete
188
- if !current_line.empty?
189
- current_line.chop!
190
- print WAITING_ERASE
191
- $stdout.flush
192
- elsif waiting_printed > 0
193
- # Clear one waiting character if current_line is empty
194
- print "\b \b"
195
- $stdout.flush
196
- waiting_printed -= 1
197
- end
198
-
199
- else
200
- current_line << char
201
- print char
202
- $stdout.flush
203
- end
204
- end
205
-
206
- ensure
207
- STDIN.cooked! # Restore terminal to normal mode
208
- end
209
-
210
- input_lines << current_line unless current_line.empty?
211
-
212
- # Handle single-line special case
213
- if input_lines.size == 1
214
- if special_first_line_processing(input_lines.first)
215
- # If special (starts with "//"), return immediately as if double return was pressed
216
- return input_lines.first
217
- else
218
- # If not special, keep as is and return the full input
219
- return input_lines.join("\n")
220
- end
221
- end
222
-
223
- input_lines.join("\n").tap do |result|
224
- puts "\n" if result.empty? # Clean up display if no input
225
- end
226
-
227
- rescue EOFError
228
- input_lines.join("\n")
229
- end
230
-
231
-