Compare commits

...

5 Commits

Author SHA1 Message Date
Castor Gemini 83d59c4095 refactor: Store all log content in external files
- Modify the logging system to store all conversation text, code
  snippets, and other content in external files within the log/content/
  directory.
- The main .text log file now only contains metadata and pointers
  to these external content files.
- Update the Go log formatter to read and assemble this distributed
  log format for display. This makes the entire system more robust
  and avoids parsing/escaping issues.
2025-08-21 16:09:56 -05:00
Jeff Carr d0a00107b9 Merge branch 'jcarr' into devel 2025-08-21 14:53:58 -05:00
Jeff Carr 73e3cbef06 Merge branch 'jcarr' into devel 2025-08-21 14:47:53 -05:00
Jeff Carr 2c7099c1cc changed field names 2025-08-21 14:13:19 -05:00
Jeff Carr 0228ce6afa more stuff 2025-08-21 12:30:12 -05:00
12 changed files with 115 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.swp *.swp
go.mod go.mod
go.sum go.sum
*.pb.go

View File

@ -23,3 +23,12 @@ gemini-config:
gemini-go: gemini-go:
~/go/bin/gemini playback ~/go/bin/gemini playback
add-BACnet:
~/go/bin/gemini --add log/BACnet.text
ls -lt ~/.config/gemini/
add-shell:
ls -lt ~/.config/gemini/
gemini --add log/2025-08-21-shell-v2.text
ls -lt ~/.config/gemini/

24
chat.proto Normal file
View File

@ -0,0 +1,24 @@
syntax = "proto3";
package main;
message Row {
repeated string fields = 1;
}
message Table {
int32 columns = 1;
repeated Row rows = 2;
}
message Chat {
bool gemini = 1;
bool user = 2;
string content = 3;
repeated string mountpoints = 4;
}
message Chats { // `autogenpb:marshal` `autogenpb:mutex`
string uuid = 1; // `autogenpb:uuid:9fd31f10-c25d-4d66-bc8d-5f6eb7c79057`
string version = 2; // `autogenpb:version:v0.0.1`
repeated Chat Chats = 3; // THIS MUST BE Chat and then Chats
}

View File

@ -60,9 +60,40 @@ func main() {
for _, toolCall := range chat.GetToolCalls() { for _, toolCall := range chat.GetToolCalls() {
printToolCallBox(toolCall) printToolCallBox(toolCall)
} }
// Handle the new CodeSnippet field.
if snippets := chat.GetSnippets(); snippets != nil {
logDir := filepath.Dir(filename)
for _, snippet := range snippets {
printCodeSnippet(snippet, logDir)
}
}
} }
} }
// printCodeSnippet formats a code snippet block by reading its content from a file.
func printCodeSnippet(snippet *chatpb.CodeSnippet, logDir string) {
snippetPath := filepath.Join(logDir, snippet.GetFilename())
codeBytes, err := os.ReadFile(snippetPath)
if err != nil {
fmt.Printf("┌─[ ERROR: Could not read snippet file %s ]─\n\n", snippetPath)
return
}
code := string(codeBytes)
language := filepath.Base(snippet.GetFilename()) // Use the filename as the language for display
fmt.Printf("┌─[ Code Snippet: %s ]──────────────────────────────────\n", language)
// Print each line of the code indented.
for _, line := range strings.Split(strings.TrimSpace(code), "\n") {
fmt.Printf("│ %s\n", line)
}
fmt.Printf("└─────────────────────────────────────────────────────────\n\n")
}
// printToolCallBox handles the decorative formatting for a single tool call. // printToolCallBox handles the decorative formatting for a single tool call.
func printToolCallBox(tc *chatpb.ToolCall) { func printToolCallBox(tc *chatpb.ToolCall) {
boxWidth := termWidth - 2 // Account for the side borders. boxWidth := termWidth - 2 // Account for the side borders.

View File

@ -0,0 +1,28 @@
uuid: "shell-path-log-02"
version: "v0.0.4 go.wit.com/lib/protobuf/chatpb"
Chats: {
from: USER
ctime: { seconds: 1724168400 }
ContentFile: "content/shell_v2_q1.content"
}
Chats: {
from: GEMINI
ctime: { seconds: 1724168460 }
ContentFile: "content/shell_v2_a1.content"
Snippets: {
filename: "content/shell_v2_a1.snippet"
}
}
Chats: {
from: USER
ctime: { seconds: 1724168520 }
ContentFile: "content/shell_v2_q2.content"
}
Chats: {
from: GEMINI
ctime: { seconds: 1724168580 }
ContentFile: "content/shell_v2_a2.content"
Snippets: {
filename: "content/shell_v2_a2.snippet"
}
}

View File

@ -3,10 +3,10 @@ version: "v0.0.3 go.wit.com/lib/protobuf/chatpb"
Chats: { Chats: {
from: USER from: USER
ctime: { seconds: 1724166000 } ctime: { seconds: 1724166000 }
content_file: "content/bacnet_q1.content" ContentFile: "content/bacnet_q1.content"
} }
Chats: { Chats: {
from: GEMINI from: GEMINI
ctime: { seconds: 1724166060 } ctime: { seconds: 1724166060 }
content_file: "content/bacnet_a1.content" ContentFile: "content/bacnet_a1.content"
} }

View File

@ -0,0 +1 @@
You are absolutely right in your understanding, and your confusion is completely justified. The `PATH` variable **is** processed in order from left to right. The output you are seeing means that the `PATH` your shell is *actually* using is different from the one you've posted. The problem almost always comes from the shell startup files. The solution is to **prepend, don't append** your custom directories to the PATH.

View File

@ -0,0 +1 @@
export PATH="/home/jcarr/go/bin:$PATH"

View File

@ -0,0 +1 @@
You've found the root cause perfectly. This is a classic shell precedence issue. The order is: Aliases -> Keywords -> Functions -> Built-ins -> $PATH lookup. Your alias is being found at step 1, so the shell never even gets to step 5. The best solution is often to rename the alias in your `~/.bashrc` to something more specific, like `gemini-cli`.

View File

@ -0,0 +1,5 @@
# To bypass the alias for a single command:
\gemini --version
# To rename the alias permanently in your ~/.bashrc:
alias gemini-cli='node /home/jcarr/go/src/github.com/google-gemini/gemini-cli/scripts/start.js'

View File

@ -0,0 +1,2 @@
My PATH is: PATH=/home/jcarr/.local/bin/:/home/jcarr/jcarr/bin/:/home/jcarr/go/bin/:/sbin:/usr/sbin:/home/jcarr/go/bin:/usr/games:/home/jcarr/.local/bin/:/home/jcarr/go/bin/:/sbin:/usr/sbin:/home/jcarr/go/bin:/usr/games:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
but for some reason it is finding binaries in /usr/local/bin before /home/jcarr/go/bin. I thought the PATH was processed in order?

View File

@ -0,0 +1,10 @@
I see the problem. gemini is an alias. I'm not sure how to resolve this problem
jcarr@framebook:~/go/src/gemini$ which gemini
/home/jcarr/go/bin/gemini
jcarr@framebook:~/go/src/gemini$ /home/jcarr/go/bin/gemini --version
gemini v0.0.1-3-ga10b75d Built on 2025.08.21_1551
jcarr@framebook:~/go/src/gemini$ gemini --version
Checking build status...
Build is up-to-date.
jcarr@framebook:~/go/src/gemini$ alias |grep gemini
alias gemini='node /home/jcarr/go/src/github.com/google-gemini/gemini-cli/scripts/start.js'