fix interactive capture; fix prompts

This commit is contained in:
AI Christianson 2025-02-25 14:59:13 -05:00
parent eede183110
commit 7ae4c61af6
2 changed files with 18 additions and 6 deletions

View File

@ -399,12 +399,25 @@ def run_interactive_command(
decoded = raw_output.decode("utf-8", errors="ignore")
stream.feed(decoded)
# Get only the current display (final screen state), not the entire history
display_lines = [render_line(line, cols) for line in screen.display]
# Get all history lines (top and bottom) and current display
all_lines = []
# Add history.top lines (older history)
for line_num in sorted(screen.history.top):
line = screen.history.top[line_num]
all_lines.append(render_line(line, cols))
# Add current display lines
all_lines.extend([render_line(line, cols) for line in screen.display])
# Add history.bottom lines (newer history)
for line_num in sorted(screen.history.bottom):
line = screen.history.bottom[line_num]
all_lines.append(render_line(line, cols))
# Trim out empty lines to get only meaningful lines
# Also strip trailing whitespace from each line
trimmed_lines = [line.rstrip() for line in display_lines if line and line.strip()]
trimmed_lines = [line.rstrip() for line in all_lines if line and line.strip()]
final_output = "\n".join(trimmed_lines)
except Exception as e:
@ -434,7 +447,6 @@ def run_interactive_command(
# Handle any unexpected type
final_output = str(final_output)[-8000:].encode("utf-8")
print("HERE", final_output)
return final_output, proc.returncode

View File

@ -49,7 +49,7 @@ def emit_expert_context(context: str) -> str:
Do not include your question in the additional context.
Err on the side of adding more context rather than less.
Err on the side of adding more context rather than less, but keep it information dense and under 500 words total.
You must give the complete contents.
@ -135,7 +135,7 @@ def ask_expert(question: str) -> str:
The expert can be extremely useful at logic questions, debugging, and reviewing complex source code, but you must provide all context including source manually.
The can see any key facts and code snippets previously noted, along with any additional context you've provided.
The expert can see any key facts and code snippets previously noted, along with any additional context you've provided.
But the expert cannot see or reason about anything you have not explicitly provided in this way.
Try to phrase your question in a way that it does not expand the scope of our top-level task.