summaryrefslogtreecommitdiffhomepage
path: root/internal/config
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-05 11:02:02 -0500
committeradamdottv <[email protected]>2025-05-05 11:02:02 -0500
commit874715838af25915061048ac20ea536363d62fb7 (patch)
tree87428b0d291097ff2efd5724821fa231bf88d032 /internal/config
parent167eb9ddfa366f38b72362624c4b28ac587cfce6 (diff)
downloadopencode-874715838af25915061048ac20ea536363d62fb7.tar.gz
opencode-874715838af25915061048ac20ea536363d62fb7.zip
feat: show sender name and timestamp
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 06e996f05..745d88d8e 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -6,6 +6,7 @@ import (
"fmt"
"log/slog"
"os"
+ "os/user"
"path/filepath"
"strings"
@@ -712,6 +713,24 @@ func WorkingDirectory() string {
return cfg.WorkingDir
}
+// GetHostname returns the system hostname or "User" if it can't be determined
+func GetHostname() (string, error) {
+ hostname, err := os.Hostname()
+ if err != nil {
+ return "User", err
+ }
+ return hostname, nil
+}
+
+// GetUsername returns the current user's username
+func GetUsername() (string, error) {
+ currentUser, err := user.Current()
+ if err != nil {
+ return "User", err
+ }
+ return currentUser.Username, nil
+}
+
func UpdateAgentModel(agentName AgentName, modelID models.ModelID) error {
if cfg == nil {
panic("config not loaded")