Ajoute jean link : acces distant via le relais ajean.link

- nouvelle commande `jean link <token>` (link.go) : connexion sortante
  WebSocket + yamux vers le relais, sert l'UI web Jean ET l'endpoint
  compatible OpenAI (/v1) a travers le tunnel, avec injection des cles
  locales, keepalive et reconnexion automatique.
- web.go : extraction de newWebMux() pour reutiliser le routeur HTTP
  cote `jean link` sans repasser par un ecouteur TCP local.
- ui/index.html : base d'URL relative (API_BASE) + script marked relatif.
- main.go : cablage de la commande `link` + aide.
- README : section acces distant (ajean.link) + commande link.
- .gitignore : secrets runtime (.web_key/.link_token/.link_machine).

Inclut aussi les evolutions en cours du coeur de jean (llm.go, skills.go,
tools.go, chat.go).
This commit is contained in:
nathaninline committed 2026-06-20 20:11:32 +02:00
1 parent 6ea2e91810
commit e606206d90
12 files changed
+724 -91

No files matched your search

+37 -4
View File
@@ -5,6 +5,8 @@ import (
"fmt"
"os"
"os/exec"
"os/user"
"runtime"
"strings"
"time"
)
@@ -35,6 +37,37 @@ func setToolsEnabled(on bool) error {
return nil
}
// machineSystemPrompt returns a short briefing about the host the model is
// running on, so that when machine access is enabled it knows *which* machine
// run_shell acts upon (and doesn't claim it has no access to "your PC").
// Returns "" when machine access is off.
func machineSystemPrompt() string {
if !toolsEnabled() {
return ""
}
host, _ := os.Hostname()
if host == "" {
host = "inconnu"
}
who := ""
if u, err := user.Current(); err == nil {
who = u.Username
}
cwd, _ := os.Getwd()
var b strings.Builder
b.WriteString("Accès machine actif : le tool run_shell exécute des commandes sur cette machine — c'est ton accès réel, ne dis jamais que tu n'y as pas accès. Pour toute question système (OS, disque, process, fichiers, réseau), utilise-le au lieu de supposer.\n")
b.WriteString(fmt.Sprintf("Machine : hôte=%s, %s/%s", host, runtime.GOOS, runtime.GOARCH))
if who != "" {
b.WriteString(", user=" + who)
}
if cwd != "" {
b.WriteString(", cwd=" + cwd)
}
b.WriteString(".")
return b.String()
}
// runShell executes a command via the platform shell (bash -c on Unix, cmd /C
// on Windows — see newShellCmd in platform_*.go) with a clamped timeout,
// returning a single string formatted "exit: N\n\nstdout:\n...\n\nstderr:\n..."
@@ -95,21 +128,21 @@ func cmdTools(args []string) error {
if err := setToolsEnabled(true); err != nil {
return err
}
fmt.Println(green("[ok]") + " tool run_shell activé — exécution bash possible")
fmt.Println(green("[ok]") + " accès machine activé — l'IA dispose d'un shell complet sur le serveur")
case "off":
if err := setToolsEnabled(false); err != nil {
return err
}
fmt.Println(green("[ok]") + " tools désactivés")
fmt.Println(green("[ok]") + " accès machine désactivé")
case "", "status":
state := dim("off")
if toolsEnabled() {
state = green("on")
}
fmt.Printf("%s run_shell état: %s\n", cyan("Tools"), state)
fmt.Printf("%s état: %s\n", cyan("Accès machine"), state)
fmt.Printf(" timeout défaut: %ds, max: %ds\n", toolDefaultTimeout, toolMaxTimeout)
default:
return fmt.Errorf("usage: jean tools [on|off|status]")
return fmt.Errorf("usage: jean machine [on|off|status]")
}
return nil
}