pi-ghost-autocomplete 0.6.0 → 0.8.0
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.
- package/README.de.md +164 -0
- package/README.es.md +66 -0
- package/README.fr.md +79 -0
- package/README.it.md +66 -0
- package/README.ja.md +65 -0
- package/README.md +69 -10
- package/README.pt-BR.md +66 -0
- package/README.ru.md +66 -0
- package/README.zh-CN.md +66 -0
- package/dist/bench-cli.js +1 -1
- package/dist/bench.d.ts +30 -4
- package/dist/bench.js +1 -1
- package/dist/cold-start.d.ts +26 -0
- package/dist/command-registry.d.ts +3 -3
- package/dist/config.d.ts +21 -0
- package/dist/cycle-manager.d.ts +21 -0
- package/dist/eval-dataset.d.ts +4 -0
- package/dist/ghost-editor.d.ts +79 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +1 -1
- package/dist/intent.d.ts +58 -3
- package/dist/metrics.d.ts +33 -7
- package/dist/profile-store.d.ts +8 -2
- package/dist/profile.d.ts +9 -1
- package/dist/providers/openai-compat-provider.d.ts +2 -2
- package/dist/providers/router.d.ts +41 -16
- package/dist/providers/types.d.ts +18 -1
- package/dist/replay-cli.js +1 -1
- package/dist/session-trie.d.ts +53 -0
- package/dist/snooze.d.ts +35 -0
- package/package.json +5 -5
package/README.de.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# pi-ghost-autocomplete
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [Deutsch](README.de.md) | [Français](README.fr.md) | [Español](README.es.md) | [中文](README.zh-CN.md) | [日本語](README.ja.md) | [Português](README.pt-BR.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
|
|
4
|
+
|
|
5
|
+
Inline-Ghost-Text-Autovervollständigung für den [Pi Coding Agent](https://pi.dev/) (`@earendil-works/pi-coding-agent`).
|
|
6
|
+
|
|
7
|
+
Während du an der Pi-Eingabe schreibst, sagt ein LLM die wahrscheinlichste
|
|
8
|
+
Fortsetzung der aktuellen Zeile voraus und zeigt sie als grauen „Ghost-Text"
|
|
9
|
+
rechts vom Cursor an. Drücke **Rechtspfeil** zum Akzeptieren. Der Cursor
|
|
10
|
+
bewegt sich erst, wenn du das tust, das bestehende Slash-Command-Popup
|
|
11
|
+
behält **Tab**, und ein langsamer oder unerreichbarer Backend deaktiviert
|
|
12
|
+
sich selbstständig, statt den Chat zu spammen.
|
|
13
|
+
|
|
14
|
+
**Mehrsprachig** (Session 52): Unicode-fähige Worterkennung verarbeitet
|
|
15
|
+
deutsche Umlaute, französische/spanische Akzente, CJK-Schriften und
|
|
16
|
+
kombinierende Zeichen. Register-basiertes Routing stellt sicher, dass
|
|
17
|
+
Prosa in der jeweiligen Sprache vervollständigt wird, ohne als
|
|
18
|
+
Coding-Agent-Anweisung umgedeutet zu werden.
|
|
19
|
+
|
|
20
|
+
## Erste Schritte
|
|
21
|
+
|
|
22
|
+
### 1. Mercury Edit 2 API-Key besorgen
|
|
23
|
+
|
|
24
|
+
Der Standard-Provider ist **Mercury Edit 2** von Inception Labs — ein
|
|
25
|
+
diffusionsbasiertes Modell für latenzarme Code-Vervollständigungen.
|
|
26
|
+
Registriere dich unter [platform.inceptionlabs.ai](https://platform.inceptionlabs.ai),
|
|
27
|
+
um einen API-Key zu erhalten.
|
|
28
|
+
|
|
29
|
+
Setze die `INCEPTION_API_KEY`-Umgebungsvariable:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# ~/.bashrc oder ~/.zshrc
|
|
33
|
+
export INCEPTION_API_KEY="dein-key"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```powershell
|
|
37
|
+
# PowerShell $PROFILE
|
|
38
|
+
$env:INCEPTION_API_KEY = "dein-key"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Erweiterung installieren
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pi install npm:pi-ghost-autocomplete
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Für nur ein einzelnes Projekt:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pi install npm:pi-ghost-autocomplete -l
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Pi starten und ausprobieren
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pi
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Beginne an der Eingabe zu tippen. Ein grauer Ghost-Text sollte innerhalb
|
|
60
|
+
von ~150 ms erscheinen. Drücke **Rechtspfeil** zum Akzeptieren oder tippe
|
|
61
|
+
weiter zum Verwerfen.
|
|
62
|
+
|
|
63
|
+
> **Die erste Sitzung fühlt sich „kalt" an.** Trie, Cache und Profil
|
|
64
|
+
> starten leer und lernen mit der Zeit. Nach 20–30 akzeptierten
|
|
65
|
+
> Vorschlägen werden häufige Präfixe aus dem lokalen Cache bedient.
|
|
66
|
+
|
|
67
|
+
## Konfiguration
|
|
68
|
+
|
|
69
|
+
Alle Einstellungen sind Umgebungsvariablen — keine zusätzliche
|
|
70
|
+
Konfigurationsdatei nötig. Die wichtigsten:
|
|
71
|
+
|
|
72
|
+
| Variable | Standard | Wirkung |
|
|
73
|
+
| --- | --- | --- |
|
|
74
|
+
| `PI_GHOST_DISABLED` | nicht gesetzt | Auf `1` setzen, um beim Start zu deaktivieren |
|
|
75
|
+
| `PI_GHOST_PROVIDER` | Mercury Edit 2 | `cloud`, `local`, oder `router` |
|
|
76
|
+
| `INCEPTION_API_KEY` | — | API-Key für Mercury Edit |
|
|
77
|
+
| `PI_GHOST_MODEL` | providerspezifisch | Modell-ID |
|
|
78
|
+
| `PI_GHOST_CHAT_MAX_TOKENS` | `256` | Token-Limit für den Chat-Zweig (Router-Modus) |
|
|
79
|
+
| `PI_GHOST_CHAT_TEMPERATURE` | `0.75` | Temperatur für den Chat-Zweig |
|
|
80
|
+
| `PI_GHOST_DEBOUNCE_MS` | 150 (Cloud) / 400 (Local) | Debounce vor Request |
|
|
81
|
+
| `PI_GHOST_METRICS` | nicht gesetzt | Auf `1` setzen für Metriken in `.pi/ghost-autocomplete/metrics.jsonl` |
|
|
82
|
+
|
|
83
|
+
> Die vollständige Variablen-Referenz findest du im
|
|
84
|
+
> [englischen README](README.md#configuration).
|
|
85
|
+
|
|
86
|
+
## Register-Routing
|
|
87
|
+
|
|
88
|
+
Der Router-Modus teilt die Arbeit zwischen zwei Modellen auf, basierend auf
|
|
89
|
+
dem **Completion-Register**:
|
|
90
|
+
|
|
91
|
+
| Register | Zweig | System-Prompt |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| `code` | **FIM** (`mercury-edit-2`) | Code/Command/Pfad-Vervollständigung |
|
|
94
|
+
| `agent-message` | **Chat** (`mercury-2`) | „Setze die Nachricht an den Assistenten fort" |
|
|
95
|
+
| `general-prose` | **Chat** (`mercury-2`) | „Setze den Text natürlich fort, gleiche Sprache/Stil" — **ohne** Coding-Agent-Framing |
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
PI_GHOST_PROVIDER=router INCEPTION_API_KEY=dein-key pi ...
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Mehrsprachige Unterstützung
|
|
102
|
+
|
|
103
|
+
Die Intent-Erkennung und Kontext-Tokenisierung verwenden Unicode-fähige
|
|
104
|
+
Wortsegmentierung (`Intl.Segmenter`) statt ASCII-Regexen. Das bedeutet:
|
|
105
|
+
|
|
106
|
+
- Deutsche Umlaute (möchte, ändern, über) werden als vollständige Wörter erkannt
|
|
107
|
+
- Französische/Spanische Akzente (café, función) bleiben erhalten
|
|
108
|
+
- CJK-Text (Chinesisch/Japanisch/Koreanisch) erhält wörterbuchbasierte Segmentierung
|
|
109
|
+
- BM25-Kontextauswahl funktioniert für nichtenglische Konversationen
|
|
110
|
+
|
|
111
|
+
## Befehle
|
|
112
|
+
|
|
113
|
+
| Befehl | Wirkung |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| `/ghost` | Aktuelle Konfiguration anzeigen |
|
|
116
|
+
| `/ghost on` | Für diese Sitzung aktivieren |
|
|
117
|
+
| `/ghost off` | Für diese Sitzung deaktivieren |
|
|
118
|
+
|
|
119
|
+
## Metriken und Debug-Logging
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
PI_GHOST_METRICS=1 pi ... # schreibt .pi/ghost-autocomplete/metrics.jsonl
|
|
123
|
+
PI_GHOST_DEBUG_LOG=1 pi ... # schreibt .pi/ghost-autocomplete/debug.jsonl
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Metriken enthalten: Zeitstempel, Provider-Latenzen, Completion-Register,
|
|
127
|
+
Ergebnis, Acceptance-Outcome und (bei `empty`) die diagnostizierte Ursache.
|
|
128
|
+
Rohe Prompts/Completions werden **niemals** in die Metrik-Datei geschrieben.
|
|
129
|
+
|
|
130
|
+
### Empty-Ursachen
|
|
131
|
+
|
|
132
|
+
| Ursache | Bedeutung |
|
|
133
|
+
| --- | --- |
|
|
134
|
+
| `model-empty` | Modell lieferte leeren/Whitespace-Only-Text |
|
|
135
|
+
| `token-budget-exhausted` | Budget vollständig für Reasoning verbraucht → `PI_GHOST_CHAT_MAX_TOKENS` erhöhen |
|
|
136
|
+
| `sanitizer-null` | Inhalt vom Sanitizer verworfen (Echo, Dateiname in Prosa) |
|
|
137
|
+
| `response-schema-error` | Response war JSON, aber nicht im erwarteten Schema |
|
|
138
|
+
| `http-error` | Fehlender Key, Non-2xx, malformed JSON, Timeout |
|
|
139
|
+
|
|
140
|
+
`pi-ghost-bench` zeigt eine `empty-cause`-Aufschlüsselung.
|
|
141
|
+
|
|
142
|
+
## Benutzerprofil
|
|
143
|
+
|
|
144
|
+
Die Erweiterung speichert ein langlebiges JSONL-Profil unter
|
|
145
|
+
`.pi/ghost-autocomplete/profile.jsonl`, um Slash-Command-, Pfad- und
|
|
146
|
+
Trigramm-Häufigkeiten über Sitzungen hinweg zu lernen. Das Profil speist
|
|
147
|
+
drei lokale Signale:
|
|
148
|
+
|
|
149
|
+
1. **Slash-Fast-Path** — `/`-Präfixe werden aus dem Gedächtnis bedient
|
|
150
|
+
2. **Profile-Bias-Rerank** — Trigramm-Häufigkeit fließt in den Reranker ein
|
|
151
|
+
3. **Pfad-Boost** — Häufige Pfade erhalten einen begrenzten Boost
|
|
152
|
+
|
|
153
|
+
Datenschutz: Keine rohen Präfixe oder Completions werden gespeichert.
|
|
154
|
+
Das Profil nutzt SHA-256-Hashes für Präfix-Lookups und sanitisierte
|
|
155
|
+
n-Grams. Sensible Nachrichten werden vollständig verworfen.
|
|
156
|
+
|
|
157
|
+
## Lizenz
|
|
158
|
+
|
|
159
|
+
SSPL-1.0 — siehe [Lizenzdatei](LICENSE).
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
> Die vollständige technische Dokumentation findest du im
|
|
164
|
+
> [englischen README](README.md) und in [`docs/`](docs/).
|
package/README.es.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# pi-ghost-autocomplete
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [Deutsch](README.de.md) | [Français](README.fr.md) | [Español](README.es.md) | [中文](README.zh-CN.md) | [日本語](README.ja.md) | [Português](README.pt-BR.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
|
|
4
|
+
|
|
5
|
+
Autocompletado de texto fantasma para el [agente de codificación Pi](https://pi.dev/) (`@earendil-works/pi-coding-agent`).
|
|
6
|
+
|
|
7
|
+
Mientras escribes en el prompt de Pi, un LLM predice la continuación más
|
|
8
|
+
probable de la línea actual y la muestra en gris a la derecha del cursor.
|
|
9
|
+
Pulsa **Flecha derecha** para aceptar.
|
|
10
|
+
|
|
11
|
+
**Multilingüe** (sesión 52): la segmentación de palabras Unicode maneja
|
|
12
|
+
acentos españoles, diéresis alemanas, scripts CJK y marcas combinatorias.
|
|
13
|
+
|
|
14
|
+
## Inicio rápido
|
|
15
|
+
|
|
16
|
+
### 1. Obtener una clave API de Mercury Edit 2
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
export INCEPTION_API_KEY="tu-clave"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 2. Instalar la extensión
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pi install npm:pi-ghost-autocomplete
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 3. Iniciar Pi
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pi
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Configuración
|
|
35
|
+
|
|
36
|
+
| Variable | Predeterminado | Efecto |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| `PI_GHOST_DISABLED` | sin definir | `1` para desactivar |
|
|
39
|
+
| `PI_GHOST_PROVIDER` | Mercury Edit 2 | `cloud`, `local`, o `router` |
|
|
40
|
+
| `INCEPTION_API_KEY` | — | Clave API |
|
|
41
|
+
| `PI_GHOST_CHAT_MAX_TOKENS` | `256` | Límite de tokens (chat) |
|
|
42
|
+
| `PI_GHOST_CHAT_TEMPERATURE` | `0.75` | Temperatura (chat) |
|
|
43
|
+
|
|
44
|
+
> Consulta el [README en inglés](README.md#configuration) para la referencia completa.
|
|
45
|
+
|
|
46
|
+
## Enrutamiento por registro
|
|
47
|
+
|
|
48
|
+
| Registro | Rama | Prompt del sistema |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `code` | **FIM** | Completar código/comando/ruta |
|
|
51
|
+
| `agent-message` | **Chat** | «Continuar el mensaje al asistente» |
|
|
52
|
+
| `general-prose` | **Chat** | «Continuar el texto naturalmente, mismo idioma» |
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
PI_GHOST_PROVIDER=router INCEPTION_API_KEY=tu-clave pi ...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Comandos
|
|
59
|
+
|
|
60
|
+
| Comando | Efecto |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `/ghost` | Mostrar configuración |
|
|
63
|
+
| `/ghost on` | Activar para esta sesión |
|
|
64
|
+
| `/ghost off` | Desactivar para esta sesión |
|
|
65
|
+
|
|
66
|
+
> Documentación completa: [README en inglés](README.md) y [`docs/`](docs/).
|
package/README.fr.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# pi-ghost-autocomplete
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [Deutsch](README.de.md) | [Français](README.fr.md) | [Español](README.es.md) | [中文](README.zh-CN.md) | [日本語](README.ja.md) | [Português](README.pt-BR.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
|
|
4
|
+
|
|
5
|
+
Auto-complétion en texte fantôme (« ghost text ») pour l'[agent de codage Pi](https://pi.dev/) (`@earendil-works/pi-coding-agent`).
|
|
6
|
+
|
|
7
|
+
Pendant que vous tapez à l'invite Pi, un LLM prédit la suite la plus probable
|
|
8
|
+
de la ligne courante et l'affiche en gris à droite du curseur. Appuyez sur
|
|
9
|
+
**Flèche droite** pour accepter. Le curseur ne bouge pas tant que vous ne le
|
|
10
|
+
faites pas.
|
|
11
|
+
|
|
12
|
+
**Multilingue** (session 52) : la segmentation des mots Unicode gère les
|
|
13
|
+
accents français, les trémas allemands, les scripts CJK et les marques
|
|
14
|
+
combinaison. Le routage par registre garantit que la prose est complétée
|
|
15
|
+
dans la même langue.
|
|
16
|
+
|
|
17
|
+
## Démarrage
|
|
18
|
+
|
|
19
|
+
### 1. Obtenir une clé API Mercury Edit 2
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
export INCEPTION_API_KEY="votre-clé"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. Installer l'extension
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pi install npm:pi-ghost-autocomplete
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 3. Lancer Pi
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pi
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
| Variable | Défaut | Effet |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `PI_GHOST_DISABLED` | non défini | `1` pour désactiver |
|
|
42
|
+
| `PI_GHOST_PROVIDER` | Mercury Edit 2 | `cloud`, `local`, ou `router` |
|
|
43
|
+
| `INCEPTION_API_KEY` | — | Clé API |
|
|
44
|
+
| `PI_GHOST_CHAT_MAX_TOKENS` | `256` | Limite de tokens (chat) |
|
|
45
|
+
| `PI_GHOST_CHAT_TEMPERATURE` | `0.75` | Température (chat) |
|
|
46
|
+
| `PI_GHOST_METRICS` | non défini | `1` pour les métriques |
|
|
47
|
+
|
|
48
|
+
> Voir le [README anglais](README.md#configuration) pour la référence complète.
|
|
49
|
+
|
|
50
|
+
## Routage par registre
|
|
51
|
+
|
|
52
|
+
| Registre | Branche | Invite système |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| `code` | **FIM** | Complétion de code/commande/chemin |
|
|
55
|
+
| `agent-message` | **Chat** | « Continuez le message à l'assistant » |
|
|
56
|
+
| `general-prose` | **Chat** | « Continuez le texte naturellement, même langue » |
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
PI_GHOST_PROVIDER=router INCEPTION_API_KEY=votre-clé pi ...
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Commandes
|
|
63
|
+
|
|
64
|
+
| Commande | Effet |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `/ghost` | Afficher la configuration |
|
|
67
|
+
| `/ghost on` | Activer pour cette session |
|
|
68
|
+
| `/ghost off` | Désactiver pour cette session |
|
|
69
|
+
|
|
70
|
+
## Métriques
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
PI_GHOST_METRICS=1 pi ...
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Les métriques incluent : latences, registre de complétion, résultat et cause
|
|
77
|
+
des réponses vides (`token-budget-exhausted`, `model-empty`, etc.).
|
|
78
|
+
|
|
79
|
+
> Documentation complète : [README anglais](README.md) et [`docs/`](docs/).
|
package/README.it.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# pi-ghost-autocomplete
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [Deutsch](README.de.md) | [Français](README.fr.md) | [Español](README.es.md) | [中文](README.zh-CN.md) | [日本語](README.ja.md) | [Português](README.pt-BR.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
|
|
4
|
+
|
|
5
|
+
Auto-completamento con testo fantasma (« ghost text ») per l'[agente di codifica Pi](https://pi.dev/) (`@earendil-works/pi-coding-agent`).
|
|
6
|
+
|
|
7
|
+
Mentre digiti al prompt di Pi, un LLM predice la continuazione più probabile
|
|
8
|
+
della riga corrente e la mostra in grigio a destra del cursore. Premi
|
|
9
|
+
**Freccia destra** per accettare.
|
|
10
|
+
|
|
11
|
+
**Multilingue** (session 52): la segmentazione delle parole Unicode gestisce
|
|
12
|
+
accenti italiani, umlaut tedeschi, script CJK e segni combinanti.
|
|
13
|
+
|
|
14
|
+
## Avvio rapido
|
|
15
|
+
|
|
16
|
+
### 1. Ottenere una chiave API Mercury Edit 2
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
export INCEPTION_API_KEY="la-tua-chiave"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 2. Installare l'estensione
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pi install npm:pi-ghost-autocomplete
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 3. Avviare Pi
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pi
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Configurazione
|
|
35
|
+
|
|
36
|
+
| Variabile | Predefinito | Effetto |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| `PI_GHOST_DISABLED` | non impostato | `1` per disattivare |
|
|
39
|
+
| `PI_GHOST_PROVIDER` | Mercury Edit 2 | `cloud`, `local`, o `router` |
|
|
40
|
+
| `INCEPTION_API_KEY` | — | Chiave API |
|
|
41
|
+
| `PI_GHOST_CHAT_MAX_TOKENS` | `256` | Limite di token (chat) |
|
|
42
|
+
| `PI_GHOST_CHAT_TEMPERATURE` | `0.75` | Temperatura (chat) |
|
|
43
|
+
|
|
44
|
+
> Consulta il [README in inglese](README.md#configuration) per la reference completa.
|
|
45
|
+
|
|
46
|
+
## Routing per registro
|
|
47
|
+
|
|
48
|
+
| Registro | Ramo | Prompt di sistema |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `code` | **FIM** | Completare codice/comando/percorso |
|
|
51
|
+
| `agent-message` | **Chat** | «Continua il messaggio all'assistente» |
|
|
52
|
+
| `general-prose` | **Chat** | «Continua il testo naturalmente, stessa lingua» |
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
PI_GHOST_PROVIDER=router INCEPTION_API_KEY=la-tua-chiave pi ...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Comandi
|
|
59
|
+
|
|
60
|
+
| Comando | Effetto |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `/ghost` | Mostra configurazione |
|
|
63
|
+
| `/ghost on` | Attiva per questa sessione |
|
|
64
|
+
| `/ghost off` | Disattiva per questa sessione |
|
|
65
|
+
|
|
66
|
+
> Documentazione completa: [README in inglese](README.md) e [`docs/`](docs/).
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# pi-ghost-autocomplete
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [Deutsch](README.de.md) | [Français](README.fr.md) | [Español](README.es.md) | [中文](README.zh-CN.md) | [日本語](README.ja.md) | [Português](README.pt-BR.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
|
|
4
|
+
|
|
5
|
+
[Pi コーディングエージェント](https://pi.dev/)(`@earendil-works/pi-coding-agent`)用のインラインゴーストテキスト自動補完。
|
|
6
|
+
|
|
7
|
+
Pi のプロンプトで入力中、LLM が現在の行の続きを予測し、カーソルの右側に
|
|
8
|
+
グレーの「ゴーストテキスト」として表示します。**右矢印キー**で受け入れます。
|
|
9
|
+
|
|
10
|
+
**多言語対応**(Session 52):Unicode 対応の単語分割により、日本語・中国語・
|
|
11
|
+
韓国語のスクリプト、ドイツ語のウムラウト、フランス語のアクセントを処理します。
|
|
12
|
+
|
|
13
|
+
## クイックスタート
|
|
14
|
+
|
|
15
|
+
### 1. Mercury Edit 2 API キーを取得
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
export INCEPTION_API_KEY="あなたのキー"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2. 拡張機能をインストール
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pi install npm:pi-ghost-autocomplete
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 3. Pi を起動
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pi
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 設定
|
|
34
|
+
|
|
35
|
+
| 変数 | デフォルト | 効果 |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `PI_GHOST_DISABLED` | 未設定 | `1` で無効化 |
|
|
38
|
+
| `PI_GHOST_PROVIDER` | Mercury Edit 2 | `cloud`、`local`、または `router` |
|
|
39
|
+
| `INCEPTION_API_KEY` | — | API キー |
|
|
40
|
+
| `PI_GHOST_CHAT_MAX_TOKENS` | `256` | チャットのトークン上限 |
|
|
41
|
+
| `PI_GHOST_CHAT_TEMPERATURE` | `0.75` | チャットの温度 |
|
|
42
|
+
|
|
43
|
+
> 完全な設定リファレンスは[英語 README](README.md#configuration) を参照してください。
|
|
44
|
+
|
|
45
|
+
## レジスタルーティング
|
|
46
|
+
|
|
47
|
+
| レジスタ | ブランチ | システムプロンプト |
|
|
48
|
+
| --- | --- | --- |
|
|
49
|
+
| `code` | **FIM** | コード/コマンド/パスの補完 |
|
|
50
|
+
| `agent-message` | **チャット** | 「アシスタントへのメッセージを続ける」 |
|
|
51
|
+
| `general-prose` | **チャット** | 「テキストを自然に続ける、同じ言語で」 |
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
PI_GHOST_PROVIDER=router INCEPTION_API_KEY=あなたのキー pi ...
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## コマンド
|
|
58
|
+
|
|
59
|
+
| コマンド | 効果 |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `/ghost` | 設定を表示 |
|
|
62
|
+
| `/ghost on` | このセッションで有効化 |
|
|
63
|
+
| `/ghost off` | このセッションで無効化 |
|
|
64
|
+
|
|
65
|
+
> 完全なドキュメント:[英語 README](README.md) と [`docs/`](docs/)。
|
package/README.md
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
# pi-ghost-autocomplete
|
|
2
2
|
|
|
3
|
+
[English](README.md) | [Deutsch](README.de.md) | [Français](README.fr.md) | [Español](README.es.md) | [中文](README.zh-CN.md) | [日本語](README.ja.md) | [Português](README.pt-BR.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
|
|
4
|
+
|
|
3
5
|
Inline ghost-text autocomplete for the [Pi coding agent](https://pi.dev/) (`@earendil-works/pi-coding-agent`).
|
|
4
6
|
|
|
5
7
|
While you type at the Pi prompt, an LLM predicts the most likely continuation
|
|
6
8
|
of the current line and renders it as dim grey "ghost text" right of the
|
|
7
|
-
cursor. Press **Right Arrow** to accept. The cursor never moves until you do,
|
|
9
|
+
cursor. Press **Right Arrow** or **Tab** (when no slash popup) to accept. The cursor never moves until you do,
|
|
8
10
|
the existing slash-command popup keeps **Tab**, and a slow or unreachable
|
|
9
11
|
backend silently disables itself rather than spamming the chat.
|
|
10
12
|
|
|
13
|
+
**Multilingual** (session 52): Unicode-aware word segmentation handles German
|
|
14
|
+
umlauts, French/Spanish diacritics, CJK scripts, and combining marks.
|
|
15
|
+
Register-based routing ensures general prose is completed in-language without
|
|
16
|
+
being reframed as a coding-agent instruction.
|
|
17
|
+
|
|
11
18
|
Four provider modes ship in the same package:
|
|
12
19
|
|
|
13
20
|
| Mode | Backend | Default debounce | Default model |
|
|
@@ -65,7 +72,18 @@ pi install npm:pi-ghost-autocomplete -l # writes to .pi/ in the current direct
|
|
|
65
72
|
pi
|
|
66
73
|
```
|
|
67
74
|
|
|
68
|
-
Start typing at the prompt. A dim ghost text should appear to the right of your cursor within ~150 ms. Press **Right Arrow** to accept it, or keep typing to dismiss it.
|
|
75
|
+
Start typing at the prompt. A dim ghost text should appear to the right of your cursor within ~150 ms. Press **Right Arrow** to accept it, or keep typing to dismiss it. The first ghost of a session shows a one-shot `[→ accept]` hint.
|
|
76
|
+
|
|
77
|
+
| Key | Action |
|
|
78
|
+
| --- | --- |
|
|
79
|
+
| **→** / **Tab** | Accept full ghost (Tab only when no slash-command popup; configure via `PI_GHOST_ACCEPT_KEYS`) |
|
|
80
|
+
| **Ctrl+→** | Accept next word |
|
|
81
|
+
| **Ctrl+↓** | Accept through end of line (incl. newline when present) |
|
|
82
|
+
| **Alt+]** / **Alt+[** | Next / previous candidate |
|
|
83
|
+
| **Esc** | Dismiss ghost |
|
|
84
|
+
| Keep typing | Dismiss |
|
|
85
|
+
|
|
86
|
+
Run `/ghost keys` anytime for the same cheat-sheet. Temporary mute: `/ghost snooze` (default 5m) or `/ghost snooze 30s` — wake with `/ghost on`.
|
|
69
87
|
|
|
70
88
|
> **The first session feels "cold."** The trie, cache, and profile all start
|
|
71
89
|
> empty, so every ghost is a fresh LLM call — slower and more generic. It gets
|
|
@@ -110,22 +128,28 @@ All knobs are environment variables — no extra config file needed:
|
|
|
110
128
|
| Variable | Default | Effect |
|
|
111
129
|
| --- | --- | --- |
|
|
112
130
|
| `PI_GHOST_DISABLED` | unset | Set to `1` to disable on launch |
|
|
131
|
+
| `PI_GHOST_HINTS` | on | Set to `off` (or `0`/`false`/`no`) to hide the one-shot `[→ accept]` onboarding suffix on the first ghost |
|
|
132
|
+
| `PI_GHOST_ACCEPT_TAB` | on | Legacy: set to `off` so Tab never accepts (ignored when `PI_GHOST_ACCEPT_KEYS` is set) |
|
|
133
|
+
| `PI_GHOST_ACCEPT_KEYS` | `right,tab` | Comma list of full-accept keys: `right`, `tab` (e.g. `right` only, or `tab,right`) |
|
|
113
134
|
| `PI_GHOST_PROVIDER` | unset (Mercury Edit 2) | `cloud`, `local`, or `router` — set explicitly to switch away from Mercury Edit 2 (ignored when `PI_GHOST_RACE_PROVIDERS` is set). See [Register routing](#register-routing) for `router` |
|
|
114
135
|
| `PI_GHOST_PROVIDER_NAME` | `groq` | Cloud only (`PI_GHOST_PROVIDER=cloud`): any `KnownProvider` from `pi-ai` (`groq`, `cerebras`, `openrouter`, …) |
|
|
115
136
|
| `PI_GHOST_MODEL` | provider-specific | Model id, e.g. `llama-3.1-8b-instant`, `qwen2.5-coder:1.5b` |
|
|
116
137
|
| `PI_GHOST_API_KEY` | env var lookup | Cloud only: explicit API key (else `pi-ai` env lookup is used) |
|
|
117
138
|
| `PI_GHOST_BASE_URL` | `http://localhost:11434` | Local only: Ollama / vLLM base URL |
|
|
118
139
|
| `PI_GHOST_DEBOUNCE_MS` | 150 (cloud) / 400 (local) | Inputs are debounced this long before a request is sent |
|
|
140
|
+
| `PI_GHOST_DEBOUNCE_AGENT_MULT` | `1.5` | Router only: multiplier on the base debounce for `agent-message` register requests (instructions, questions). Longer pause reduces wasted API calls during deliberate typing |
|
|
141
|
+
| `PI_GHOST_DEBOUNCE_PROSE_MULT` | `1.8` | Router only: multiplier on the base debounce for `general-prose` register. Free prose is the most deliberate register — the longest debounce |
|
|
119
142
|
| `PI_GHOST_MAX_TOKENS` | 64 (cloud) / 48 (local) | Cap on completion tokens |
|
|
120
143
|
| `PI_GHOST_RECENT` | 4 (cloud) / 2 (local) | Number of recent user/assistant messages bundled as context |
|
|
121
144
|
| `PI_GHOST_MIN_CHARS` | 3 | Minimum draft length before a prediction fires |
|
|
122
145
|
| `PI_GHOST_MAX_LINE` | 240 | Predictions skipped if the current line exceeds this length |
|
|
123
|
-
| `PI_GHOST_TEMPERATURE` | `0` | Sampling temperature [0, 2]. `0` is best-effort deterministic; see note below |
|
|
146
|
+
| `PI_GHOST_TEMPERATURE` | `0` | Sampling temperature [0, 2] for the FIM / cloud / local legs. `0` is best-effort deterministic; see note below. Does **not** affect the router chat leg — use `PI_GHOST_CHAT_TEMPERATURE` for that |
|
|
124
147
|
| `PI_GHOST_MERCURY_PARALLEL_N` | `1` | Mercury FIM only: fire N parallel candidate completions for cycling. Requires `PI_GHOST_TEMPERATURE > 0` (downgrades silently to 1 at temp=0). Costs scale linearly with N |
|
|
125
148
|
| `PI_GHOST_CHAT_MODEL` | `mercury-2` | Router only: chat model id for the natural-language leg (`/chat/completions`) |
|
|
126
149
|
| `PI_GHOST_CHAT_BASE_URL` | = FIM base URL | Router only: override the chat leg's endpoint base (defaults to the same vendor as the FIM leg) |
|
|
127
150
|
| `PI_GHOST_CHAT_API_KEY` | = Inception/FIM key | Router only: override the chat leg's API key (defaults to the FIM leg's key) |
|
|
128
|
-
| `PI_GHOST_CHAT_MAX_TOKENS` |
|
|
151
|
+
| `PI_GHOST_CHAT_MAX_TOKENS` | `256` | Router only: cap on chat-leg completion tokens. Independent of `PI_GHOST_MAX_TOKENS` — Mercury chat consumes budget on internal reasoning before emitting visible content, so it needs far more headroom than code-FIM. At `64` the chat leg returned `content=null` on nearly every request (session 52) |
|
|
152
|
+
| `PI_GHOST_CHAT_TEMPERATURE` | `0.75` | Router only: chat-leg sampling temperature, independent of `PI_GHOST_TEMPERATURE`. Inception's `/chat/completions` supports `[0.5, 1]`; `0` is silently coerced to `0.75` server-side |
|
|
129
153
|
| `PI_GHOST_CONTEXT_MAX_SCAN` | `200` | M6b: cap on the candidate pool scanned for relevance ranking |
|
|
130
154
|
| `PI_GHOST_CONTEXT_MAX_SELECTED` | `8` | M6b: max number of selected context entries |
|
|
131
155
|
| `PI_GHOST_CONTEXT_MAX_CHARS` | `4000` | M6b: total char budget for the selected context window |
|
|
@@ -166,12 +190,33 @@ instruction, a question. A code fill-in-the-middle model (Mercury Edit), fed
|
|
|
166
190
|
that message, tends to complete it like *code*: it writes the solution instead
|
|
167
191
|
of finishing your sentence. That's the wrong register.
|
|
168
192
|
|
|
169
|
-
Router mode fixes this by splitting the work between two models by
|
|
193
|
+
Router mode fixes this by splitting the work between two models by
|
|
194
|
+
**completion register** (session 52). The register is a coarse classification
|
|
195
|
+
of *what kind of text* the user is composing, derived from the prompt intent
|
|
196
|
+
but language-independent:
|
|
170
197
|
|
|
171
|
-
|
|
|
172
|
-
| --- | --- | --- |
|
|
173
|
-
| `command`, `path-ref`, unclassified | **FIM** (`mercury-edit-2
|
|
174
|
-
| `instruction`, `question
|
|
198
|
+
| Register | Intents | Leg | System prompt |
|
|
199
|
+
| --- | --- | --- | --- |
|
|
200
|
+
| `code` | `command`, `path-ref`, unclassified | **FIM** (`mercury-edit-2`) | code/command/path completion |
|
|
201
|
+
| `agent-message` | `instruction`, `question` | **chat** (`mercury-2`) | "continue the user's message to an assistant, don't answer" |
|
|
202
|
+
| `general-prose` | `prose` | **chat** (`mercury-2`) | "continue the text naturally, same language/voice" — NO coding-agent framing |
|
|
203
|
+
|
|
204
|
+
The `general-prose` register (session 52) is the key fix for non-English and
|
|
205
|
+
non-instructional text: it gets a neutral persona that preserves the draft's
|
|
206
|
+
language and voice instead of reframing it as a task instruction. This means
|
|
207
|
+
German, French, Spanish, and other languages are completed in-language without
|
|
208
|
+
being distorted into coding-agent phrasing.
|
|
209
|
+
|
|
210
|
+
### Multilingual support (session 52)
|
|
211
|
+
|
|
212
|
+
Intent detection and context tokenization use Unicode-aware word segmentation
|
|
213
|
+
(`Intl.Segmenter`) instead of ASCII-only regexes. This means:
|
|
214
|
+
|
|
215
|
+
- German umlauts (möchte, ändern, über) count as complete words, not fragments
|
|
216
|
+
- French/Spanish diacritics (café, déjà, función) are preserved
|
|
217
|
+
- CJK text (Chinese/Japanese/Korean) gets dictionary-based word segmentation
|
|
218
|
+
- BM25 context selection works for non-English conversations
|
|
219
|
+
- No fixed English stopword list — IDF handles frequent terms per-language
|
|
175
220
|
|
|
176
221
|
Both legs default to the same vendor (Inception) and the same key, so a single
|
|
177
222
|
`INCEPTION_API_KEY` is enough. If the chat leg is unreachable or unconfigured,
|
|
@@ -242,11 +287,25 @@ PI_GHOST_DEBUG_LOG=1 pi ... # writes .pi/ghost-autocomplete/debug.jsonl
|
|
|
242
287
|
|
|
243
288
|
Metrics records include: timestamp, request id, provider latencies, completion
|
|
244
289
|
mode (`deterministic` or `llm`), result (`produced`, `empty`, `rejected`,
|
|
245
|
-
`aborted`, `error`), rejection reason, completion
|
|
290
|
+
`aborted`, `error`), rejection reason, completion register (`code`,
|
|
291
|
+
`agent-message`, `general-prose`), completion length, whether the ghost was
|
|
246
292
|
shown, and acceptance outcome (`accepted`, `dismissed`, `stale`, `expired`).
|
|
247
293
|
Raw prompt text and LLM output are never written to the metrics file. Both
|
|
248
294
|
files rotate at 10 MB.
|
|
249
295
|
|
|
296
|
+
When `result` is `empty`, the diagnosed cause is recorded in `emptyReason`:
|
|
297
|
+
|
|
298
|
+
| Reason | Meaning |
|
|
299
|
+
| --- | --- |
|
|
300
|
+
| `model-empty` | The model returned empty/whitespace-only text |
|
|
301
|
+
| `token-budget-exhausted` | The provider spent its entire `max_tokens` budget on internal reasoning before emitting visible content (Mercury 2 chat). Increase `PI_GHOST_CHAT_MAX_TOKENS` |
|
|
302
|
+
| `sanitizer-null` | The model returned content but the sanitizer rejected it (echo, filename-in-prose, markdown) |
|
|
303
|
+
| `response-schema-error` | The response parsed as JSON but lacked the expected `choices[].message` shape |
|
|
304
|
+
| `http-error` | Missing key, non-2xx, malformed JSON, fetch throw, or timeout |
|
|
305
|
+
|
|
306
|
+
`pi-ghost-bench` reports an `empty-cause` breakdown so you can distinguish a
|
|
307
|
+
model that declines from one that's starved for tokens.
|
|
308
|
+
|
|
250
309
|
## User profile
|
|
251
310
|
|
|
252
311
|
The extension keeps a long-lived JSONL store at
|
package/README.pt-BR.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# pi-ghost-autocomplete
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [Deutsch](README.de.md) | [Français](README.fr.md) | [Español](README.es.md) | [中文](README.zh-CN.md) | [日本語](README.ja.md) | [Português](README.pt-BR.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
|
|
4
|
+
|
|
5
|
+
Autocompletar com texto fantasma (« ghost text ») para o [agente de codificação Pi](https://pi.dev/) (`@earendil-works/pi-coding-agent`).
|
|
6
|
+
|
|
7
|
+
Enquanto você digita no prompt do Pi, um LLM prevê a continuação mais provável
|
|
8
|
+
da linha atual e a exibe em cinza à direita do cursor. Pressione **Seta para
|
|
9
|
+
a direita** para aceitar.
|
|
10
|
+
|
|
11
|
+
**Multilíngue** (session 52): a segmentação de palavras Unicode lida com
|
|
12
|
+
acentos portugueses, trema alemão, scripts CJK e marcas combinatórias.
|
|
13
|
+
|
|
14
|
+
## Início rápido
|
|
15
|
+
|
|
16
|
+
### 1. Obter uma chave de API do Mercury Edit 2
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
export INCEPTION_API_KEY="sua-chave"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 2. Instalar a extensão
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pi install npm:pi-ghost-autocomplete
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 3. Iniciar o Pi
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pi
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Configuração
|
|
35
|
+
|
|
36
|
+
| Variável | Padrão | Efeito |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| `PI_GHOST_DISABLED` | não definido | `1` para desativar |
|
|
39
|
+
| `PI_GHOST_PROVIDER` | Mercury Edit 2 | `cloud`, `local`, ou `router` |
|
|
40
|
+
| `INCEPTION_API_KEY` | — | Chave de API |
|
|
41
|
+
| `PI_GHOST_CHAT_MAX_TOKENS` | `256` | Limite de tokens (chat) |
|
|
42
|
+
| `PI_GHOST_CHAT_TEMPERATURE` | `0.75` | Temperatura (chat) |
|
|
43
|
+
|
|
44
|
+
> Consulte o [README em inglês](README.md#configuration) para a referência completa.
|
|
45
|
+
|
|
46
|
+
## Roteamento por registro
|
|
47
|
+
|
|
48
|
+
| Registro | Ramo | Prompt do sistema |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `code` | **FIM** | Completar código/comando/caminho |
|
|
51
|
+
| `agent-message` | **Chat** | «Continuar a mensagem ao assistente» |
|
|
52
|
+
| `general-prose` | **Chat** | «Continuar o texto naturalmente, mesmo idioma» |
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
PI_GHOST_PROVIDER=router INCEPTION_API_KEY=sua-chave pi ...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Comandos
|
|
59
|
+
|
|
60
|
+
| Comando | Efeito |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `/ghost` | Mostrar configuração |
|
|
63
|
+
| `/ghost on` | Ativar para esta sessão |
|
|
64
|
+
| `/ghost off` | Desativar para esta sessão |
|
|
65
|
+
|
|
66
|
+
> Documentação completa: [README em inglês](README.md) e [`docs/`](docs/).
|