@getrift/rift 0.1.0-beta.1 → 0.1.0-beta.10
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.md +154 -0
- package/dist/src/auth/keychain.d.ts +9 -0
- package/dist/src/auth/keychain.d.ts.map +1 -1
- package/dist/src/auth/keychain.js +37 -0
- package/dist/src/auth/keychain.js.map +1 -1
- package/dist/src/capture/recover-quarantine.d.ts +221 -0
- package/dist/src/capture/recover-quarantine.d.ts.map +1 -0
- package/dist/src/capture/recover-quarantine.js +453 -0
- package/dist/src/capture/recover-quarantine.js.map +1 -0
- package/dist/src/cli/commands/backfill.d.ts.map +1 -1
- package/dist/src/cli/commands/backfill.js +5 -2
- package/dist/src/cli/commands/backfill.js.map +1 -1
- package/dist/src/cli/commands/capture-recover.d.ts +12 -0
- package/dist/src/cli/commands/capture-recover.d.ts.map +1 -0
- package/dist/src/cli/commands/capture-recover.js +120 -0
- package/dist/src/cli/commands/capture-recover.js.map +1 -0
- package/dist/src/cli/commands/capture.d.ts.map +1 -1
- package/dist/src/cli/commands/capture.js +10 -4
- package/dist/src/cli/commands/capture.js.map +1 -1
- package/dist/src/cli/commands/feedback.d.ts.map +1 -1
- package/dist/src/cli/commands/feedback.js +6 -2
- package/dist/src/cli/commands/feedback.js.map +1 -1
- package/dist/src/cli/commands/mcp-install.js +5 -2
- package/dist/src/cli/commands/mcp-install.js.map +1 -1
- package/dist/src/cli/commands/onboard.d.ts +24 -0
- package/dist/src/cli/commands/onboard.d.ts.map +1 -1
- package/dist/src/cli/commands/onboard.js +119 -21
- package/dist/src/cli/commands/onboard.js.map +1 -1
- package/dist/src/cli/commands/rebuild.d.ts.map +1 -1
- package/dist/src/cli/commands/rebuild.js +6 -3
- package/dist/src/cli/commands/rebuild.js.map +1 -1
- package/dist/src/cli/commands/review.d.ts.map +1 -1
- package/dist/src/cli/commands/review.js +22 -7
- package/dist/src/cli/commands/review.js.map +1 -1
- package/dist/src/cli/commands/status.d.ts.map +1 -1
- package/dist/src/cli/commands/status.js +48 -2
- package/dist/src/cli/commands/status.js.map +1 -1
- package/dist/src/cli/commands/token-issue.d.ts.map +1 -1
- package/dist/src/cli/commands/token-issue.js +9 -1
- package/dist/src/cli/commands/token-issue.js.map +1 -1
- package/dist/src/cli/commands/triage.d.ts.map +1 -1
- package/dist/src/cli/commands/triage.js +7 -5
- package/dist/src/cli/commands/triage.js.map +1 -1
- package/dist/src/cli/commands/update.d.ts +26 -0
- package/dist/src/cli/commands/update.d.ts.map +1 -0
- package/dist/src/cli/commands/update.js +130 -0
- package/dist/src/cli/commands/update.js.map +1 -0
- package/dist/src/cli/default-config-path.d.ts +15 -0
- package/dist/src/cli/default-config-path.d.ts.map +1 -0
- package/dist/src/cli/default-config-path.js +27 -0
- package/dist/src/cli/default-config-path.js.map +1 -0
- package/dist/src/cli/http-client.d.ts +56 -1
- package/dist/src/cli/http-client.d.ts.map +1 -1
- package/dist/src/cli/http-client.js +140 -4
- package/dist/src/cli/http-client.js.map +1 -1
- package/dist/src/cli/index.d.ts.map +1 -1
- package/dist/src/cli/index.js +25 -6
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/status/friend-header.d.ts.map +1 -1
- package/dist/src/cli/status/friend-header.js +117 -7
- package/dist/src/cli/status/friend-header.js.map +1 -1
- package/dist/src/ingestion/inbox-core/conversation-key.d.ts +2 -0
- package/dist/src/ingestion/inbox-core/conversation-key.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/conversation-key.js +31 -0
- package/dist/src/ingestion/inbox-core/conversation-key.js.map +1 -0
- package/dist/src/ingestion/inbox-core/extensions.d.ts +3 -0
- package/dist/src/ingestion/inbox-core/extensions.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/extensions.js +16 -0
- package/dist/src/ingestion/inbox-core/extensions.js.map +1 -0
- package/dist/src/ingestion/inbox-core/idempotency.d.ts +2 -0
- package/dist/src/ingestion/inbox-core/idempotency.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/idempotency.js +22 -0
- package/dist/src/ingestion/inbox-core/idempotency.js.map +1 -0
- package/dist/src/ingestion/inbox-core/index.d.ts +19 -0
- package/dist/src/ingestion/inbox-core/index.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/index.js +19 -0
- package/dist/src/ingestion/inbox-core/index.js.map +1 -0
- package/dist/src/ingestion/inbox-core/source-detection.d.ts +2 -0
- package/dist/src/ingestion/inbox-core/source-detection.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/source-detection.js +23 -0
- package/dist/src/ingestion/inbox-core/source-detection.js.map +1 -0
- package/dist/src/ingestion/inbox-core/source-sniffer.d.ts +11 -0
- package/dist/src/ingestion/inbox-core/source-sniffer.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/source-sniffer.js +69 -0
- package/dist/src/ingestion/inbox-core/source-sniffer.js.map +1 -0
- package/dist/src/ingestion/inbox-core/zip-sniffer.d.ts +70 -0
- package/dist/src/ingestion/inbox-core/zip-sniffer.d.ts.map +1 -0
- package/dist/src/ingestion/inbox-core/zip-sniffer.js +161 -0
- package/dist/src/ingestion/inbox-core/zip-sniffer.js.map +1 -0
- package/dist/src/ingestion/inbox-watcher.d.ts.map +1 -1
- package/dist/src/ingestion/inbox-watcher.js +34 -50
- package/dist/src/ingestion/inbox-watcher.js.map +1 -1
- package/dist/src/ingestion/indexer.d.ts +7 -0
- package/dist/src/ingestion/indexer.d.ts.map +1 -1
- package/dist/src/ingestion/indexer.js +36 -2
- package/dist/src/ingestion/indexer.js.map +1 -1
- package/dist/src/ingestion/metadata-extraction.d.ts +8 -5
- package/dist/src/ingestion/metadata-extraction.d.ts.map +1 -1
- package/dist/src/ingestion/metadata-extraction.js +24 -5
- package/dist/src/ingestion/metadata-extraction.js.map +1 -1
- package/dist/src/ingestion/skip-quarantine.d.ts +10 -0
- package/dist/src/ingestion/skip-quarantine.d.ts.map +1 -0
- package/dist/src/ingestion/skip-quarantine.js +35 -0
- package/dist/src/ingestion/skip-quarantine.js.map +1 -0
- package/dist/src/jobs/handlers/compact.d.ts.map +1 -1
- package/dist/src/jobs/handlers/compact.js +25 -4
- package/dist/src/jobs/handlers/compact.js.map +1 -1
- package/dist/src/jobs/handlers/ingest.d.ts.map +1 -1
- package/dist/src/jobs/handlers/ingest.js +49 -24
- package/dist/src/jobs/handlers/ingest.js.map +1 -1
- package/dist/src/jobs/handlers/reconcile.d.ts.map +1 -1
- package/dist/src/jobs/handlers/reconcile.js +30 -8
- package/dist/src/jobs/handlers/reconcile.js.map +1 -1
- package/dist/src/jobs/handlers/reindex.d.ts.map +1 -1
- package/dist/src/jobs/handlers/reindex.js +12 -2
- package/dist/src/jobs/handlers/reindex.js.map +1 -1
- package/dist/src/jobs/handlers/save.d.ts.map +1 -1
- package/dist/src/jobs/handlers/save.js +9 -2
- package/dist/src/jobs/handlers/save.js.map +1 -1
- package/dist/src/jobs/queue.d.ts +11 -0
- package/dist/src/jobs/queue.d.ts.map +1 -1
- package/dist/src/jobs/queue.js +18 -0
- package/dist/src/jobs/queue.js.map +1 -1
- package/dist/src/jobs/worker-entry.d.ts.map +1 -1
- package/dist/src/jobs/worker-entry.js +2 -0
- package/dist/src/jobs/worker-entry.js.map +1 -1
- package/dist/src/main.js +36 -4
- package/dist/src/main.js.map +1 -1
- package/dist/src/observability/embedding-events.d.ts +52 -0
- package/dist/src/observability/embedding-events.d.ts.map +1 -0
- package/dist/src/observability/embedding-events.js +149 -0
- package/dist/src/observability/embedding-events.js.map +1 -0
- package/dist/src/observability/index-events.d.ts +70 -0
- package/dist/src/observability/index-events.d.ts.map +1 -0
- package/dist/src/observability/index-events.js +148 -0
- package/dist/src/observability/index-events.js.map +1 -0
- package/dist/src/observability/tool-usage-stats.d.ts +7 -0
- package/dist/src/observability/tool-usage-stats.d.ts.map +1 -1
- package/dist/src/observability/tool-usage-stats.js +41 -5
- package/dist/src/observability/tool-usage-stats.js.map +1 -1
- package/dist/src/observability/tool-usage.d.ts +7 -7
- package/dist/src/observability/tool-usage.d.ts.map +1 -1
- package/dist/src/observability/tool-usage.js +78 -39
- package/dist/src/observability/tool-usage.js.map +1 -1
- package/dist/src/observability/version-check.d.ts +70 -0
- package/dist/src/observability/version-check.d.ts.map +1 -0
- package/dist/src/observability/version-check.js +197 -0
- package/dist/src/observability/version-check.js.map +1 -0
- package/dist/src/providers/ollama-embed.d.ts +2 -1
- package/dist/src/providers/ollama-embed.d.ts.map +1 -1
- package/dist/src/providers/ollama-embed.js +1 -0
- package/dist/src/providers/ollama-embed.js.map +1 -1
- package/dist/src/providers/openai-metadata-extraction.d.ts +3 -3
- package/dist/src/providers/openai-metadata-extraction.d.ts.map +1 -1
- package/dist/src/providers/openai-metadata-extraction.js +18 -3
- package/dist/src/providers/openai-metadata-extraction.js.map +1 -1
- package/dist/src/providers/stub.d.ts +2 -0
- package/dist/src/providers/stub.d.ts.map +1 -1
- package/dist/src/providers/stub.js +2 -0
- package/dist/src/providers/stub.js.map +1 -1
- package/dist/src/providers/types.d.ts +11 -0
- package/dist/src/providers/types.d.ts.map +1 -1
- package/dist/src/providers/voyage.d.ts +2 -1
- package/dist/src/providers/voyage.d.ts.map +1 -1
- package/dist/src/providers/voyage.js +1 -0
- package/dist/src/providers/voyage.js.map +1 -1
- package/dist/src/server/app.d.ts.map +1 -1
- package/dist/src/server/app.js +67 -1
- package/dist/src/server/app.js.map +1 -1
- package/dist/src/server/routes/friend-status.d.ts +202 -3
- package/dist/src/server/routes/friend-status.d.ts.map +1 -1
- package/dist/src/server/routes/friend-status.js +290 -7
- package/dist/src/server/routes/friend-status.js.map +1 -1
- package/dist/src/storage/rebuild.d.ts +14 -1
- package/dist/src/storage/rebuild.d.ts.map +1 -1
- package/dist/src/storage/rebuild.js +160 -34
- package/dist/src/storage/rebuild.js.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Rift
|
|
2
|
+
|
|
3
|
+
**Mémoire personnelle locale pour tes IA.**
|
|
4
|
+
|
|
5
|
+
Rift capture en local tes sessions Claude Code et Codex CLI, les triage, les indexe, et expose une mémoire interrogeable via MCP — pour que Claude Desktop, Claude Code, Codex et Cursor retrouvent ce que tu leur as déjà dit.
|
|
6
|
+
|
|
7
|
+
Tout reste sur ta machine, sauf les *embeddings* (envoyés à Voyage AI sous une clé qui t'appartient).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## À lire avant d'installer
|
|
12
|
+
|
|
13
|
+
> **La capture démarre maintenant.**
|
|
14
|
+
> Au premier lancement, Rift pose un *watermark* sur tes sessions Claude Code et Codex CLI existantes : **elles ne sont pas réingérées rétroactivement**. Seules les sessions à partir de l'installation comptent.
|
|
15
|
+
>
|
|
16
|
+
> Si tu veux que ton corpus passé soit *aussi* indexé (sessions Claude Code locales antérieures + exports `.zip` claude.ai / chatgpt.com / gemini.google.com / grok.com), c'est une **prestation séparée** — voir [Backfill historique (payant)](#backfill-historique-payant) plus bas.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Prérequis
|
|
21
|
+
|
|
22
|
+
À avoir sur ton Mac avant l'install :
|
|
23
|
+
|
|
24
|
+
| | Quoi | Comment |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| 1 | **macOS 12.3+** | Pomme → "À propos de ce Mac" |
|
|
27
|
+
| 2 | **Node.js 20.19+** | `node --version` dans Ghostty. Si manquant : [nodejs.org](https://nodejs.org/en/download) (LTS) |
|
|
28
|
+
| 3 | **Codex CLI authentifié** | `codex --version`, puis `codex login` si tu n'as jamais loggé |
|
|
29
|
+
| 4 | **Une clé Voyage AI** | Je te l'envoie en DM (c'est un projet dédié sur mon compte Voyage). Range-la dans 1Password, on la collera pendant l'onboard |
|
|
30
|
+
|
|
31
|
+
Codex CLI fait tourner le triage et l'extraction de métadonnées — pas besoin de clé OpenAI séparée. La clé Voyage sert *uniquement* aux embeddings.
|
|
32
|
+
|
|
33
|
+
## Installation (1 commande)
|
|
34
|
+
|
|
35
|
+
Dans Ghostty, tape :
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
curl -fsSL https://getrift.dev/install | bash
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Ce que fait le script :
|
|
42
|
+
|
|
43
|
+
- vérifie les prérequis ;
|
|
44
|
+
- installe le paquet npm `@getrift/rift@beta` globalement ;
|
|
45
|
+
- crée tes dossiers de données sous `~/Library/Application Support/Rift/` ;
|
|
46
|
+
- pose un agent launchd qui lance Rift à chaque session ;
|
|
47
|
+
- attend que le daemon réponde sur le port local.
|
|
48
|
+
|
|
49
|
+
**Si on te demande ton mot de passe Mac (`Password:`)**, c'est normal — il faut écrire dans un dossier système pour rendre la commande `rift` disponible partout. Tape ton mot de passe (rien ne s'affiche pendant la frappe — c'est normal sur Unix), `Entrée`.
|
|
50
|
+
|
|
51
|
+
Si ça plante en cours de route, le script restaure ton état précédent et imprime un identifiant de backup. Tu peux me l'envoyer.
|
|
52
|
+
|
|
53
|
+
## Premier paramétrage
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
rift onboard
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
L'assistant va te poser **5 ou 6 questions**, dans cet ordre :
|
|
60
|
+
|
|
61
|
+
1. **La clé Voyage que je t'ai envoyée.** Colle-la depuis 1Password. Elle ne s'affiche pas pendant la frappe.
|
|
62
|
+
2. **Validation.** Rift fait un embed test pour vérifier la clé.
|
|
63
|
+
3. **Vérifie que Codex est authentifié.** Si ça échoue, lance `codex login` et relance `rift onboard`. Ou demande à Claude.
|
|
64
|
+
4. **Première passe de capture.** Watermarke tes sessions existantes (ne les ingère pas).
|
|
65
|
+
5. **Branchement MCP.** Te demande dans quels clients tu veux Rift comme serveur MCP — Claude Desktop, Claude Code, Codex, Cursor. **Réponds `oui` à tous ceux que tu utilises.**
|
|
66
|
+
6. **Garde-fou Claude Code (optionnel).** Si Claude Code est détecté, l'assistant te propose d'installer un *PreToolUse hook* qui force la récupération Rift à commencer par `rift_context_pack` (compact, budgété) avant tout `rift_search`. Évite que l'agent crame ton contexte avec des recherches larges. **Réponds `y`** si tu utilises Claude Code. Désactivable à tout moment via `RIFT_POLICY_DISABLED=1` ou en supprimant l'entrée de `~/.claude/settings.json`.
|
|
67
|
+
|
|
68
|
+
À la fin, l'assistant te dit "Onboarding terminé" et te suggère ta première recherche.
|
|
69
|
+
|
|
70
|
+
> Si tu veux importer un export ChatGPT ou Claude.ai, l'assistant te le proposera. **Pour la beta : décline** — c'est de la backfill historique, voir la section payante plus bas.
|
|
71
|
+
|
|
72
|
+
> Si tu as déjà fait `rift onboard` avant cette beta, tu peux poser le hook après coup avec `rift hooks install --client claude-code`.
|
|
73
|
+
|
|
74
|
+
## Vérifier que ça tourne
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
rift status
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Tu dois voir une sortie qui ressemble à ça (en anglais — le binaire est anglophone) :
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Rift v0.1.0-beta.2 · daemon: running (uptime 5m) · port 3577 ✓
|
|
84
|
+
Voyage: key valid (last 4 …xxxx, last embed 2m ago)
|
|
85
|
+
Codex CLI: authed ✓
|
|
86
|
+
Capture: last run 8m ago — 3 saved · 0 review · 0 failed
|
|
87
|
+
MCP: claude-desktop ✓ · codex ✓ · claude-code ✓ · cursor ✓
|
|
88
|
+
Feedback: relay off (local JSONL only)
|
|
89
|
+
|
|
90
|
+
Next: nothing broken. Try rift search "<topic>".
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Les ✓ partout = tout va bien. Si une ligne montre ✗ ou un *Next:* différent de "nothing broken", suis l'instruction qu'il imprime.
|
|
94
|
+
|
|
95
|
+
## Usage quotidien
|
|
96
|
+
|
|
97
|
+
- **Rien à faire.** Le daemon tourne en tâche de fond, ingère tes nouvelles sessions Claude Code / Codex CLI toutes les heures, et expose la mémoire via MCP.
|
|
98
|
+
- **Tester depuis Claude Desktop ou Cursor.** Ouvre une conversation, demande par exemple : *"Rappelle-toi ce qu'on a discuté sur le pricing la semaine dernière, va voir dans Rift"* — Claude/Cursor appellera `rift_search` ou `rift_context_pack` automatiquement et t'affichera ce qu'il trouve.
|
|
99
|
+
- **Rechercher en ligne de commande :** `rift search "comment on a structuré le pricing"`
|
|
100
|
+
- **Forcer une passe de capture maintenant :** `rift capture`
|
|
101
|
+
|
|
102
|
+
## Vie privée
|
|
103
|
+
|
|
104
|
+
- **Local par défaut.** Tes sessions, métadonnées et la base vectorielle (LanceDB) restent sur ta machine.
|
|
105
|
+
- **Voyage AI.** Seuls les *snippets* envoyés pour embedding partent vers Voyage. Ta clé t'appartient — tu peux la révoquer côté Voyage à tout moment, ce qui coupe l'envoi.
|
|
106
|
+
- **Aucune télémétrie de contenu.** Rift ne m'envoie rien, sauf si tu actives explicitement le *feedback relay* (`rift feedback --kind=...`). Et même là, c'est juste la note que tu écris, pas tes conversations.
|
|
107
|
+
- **Désinstallation propre.** `rift uninstall` enlève le daemon et les entrées MCP. `rift uninstall --purge-data` supprime aussi les données locales.
|
|
108
|
+
|
|
109
|
+
Le contrat de vie privée détaillé est dans `docs/feedback/PRIVACY.md` (livré avec le paquet).
|
|
110
|
+
|
|
111
|
+
## Backfill historique (payant)
|
|
112
|
+
|
|
113
|
+
Le watermark protège ton historique pré-installation : Rift ne va pas inonder ta mémoire avec deux ans de conversations dont la moitié sont du débogage jetable.
|
|
114
|
+
|
|
115
|
+
Mais si tu veux *vraiment* que ton corpus passé soit indexé, c'est faisable. Ce que ça représente côté boulot :
|
|
116
|
+
|
|
117
|
+
- import + audit de tes exports web (claude.ai, chatgpt.com, gemini.google.com, grok.com) ;
|
|
118
|
+
- déwatermark ciblé des sessions Claude Code / Codex CLI qui valent le coup (filtré par date, projet, heuristique) ;
|
|
119
|
+
- tuning des règles de triage à ton usage réel sur ~1 semaine ;
|
|
120
|
+
- session de 60 min en visio pour valider ce qui est entré dans la mémoire et ce qui a été écarté.
|
|
121
|
+
|
|
122
|
+
**Tarifs (HT, prestation ponctuelle) :**
|
|
123
|
+
|
|
124
|
+
| Profondeur | Tarif |
|
|
125
|
+
|---|---|
|
|
126
|
+
| 1 mois de données | **1 000 €** |
|
|
127
|
+
| 6 mois de données | **3 000 €** |
|
|
128
|
+
| 1 an de données | **5 000 €** |
|
|
129
|
+
|
|
130
|
+
Pour déclencher : il me faut un **bon de commande / facture HT signée** par ton boss. Une fois validé, on cale 1h de kickoff. Tu m'envoies un message quand tu es prêt.
|
|
131
|
+
|
|
132
|
+
## En cas de pépin
|
|
133
|
+
|
|
134
|
+
| Symptôme | Solution |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `rift status` dit "daemon: unreachable" | `launchctl kickstart -k gui/$UID/com.getrift.daemon` |
|
|
137
|
+
| Codex CLI auth périmé | `codex login` |
|
|
138
|
+
| Clé Voyage révoquée ou changée | `rift onboard --reconfigure-voyage` |
|
|
139
|
+
| Rift n'apparaît pas dans Claude Desktop / Cursor | `rift mcp install --client=claude-desktop` (remplace par `codex`, `claude-code`, `cursor` selon le besoin) |
|
|
140
|
+
| Le garde-fou Claude Code te bloque trop souvent | `export RIFT_POLICY_DISABLED=1` dans le shell (désactive le hook le temps de la session), ou enlève l'entrée `rift-policy.mjs` de `~/.claude/settings.json` |
|
|
141
|
+
| Truc bizarre, tu veux me prévenir | `rift feedback --kind=broke --with-status` — capture l'état actuel et envoie le tout en local (+ chez moi si tu as activé le relay pendant l'onboard) |
|
|
142
|
+
|
|
143
|
+
## Désinstaller
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
rift uninstall # enlève daemon + entrées MCP
|
|
147
|
+
rift uninstall --purge-data # + supprime les données locales
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
La clé Voyage reste dans `~/.rift.env` même après `--purge-data` — la commande affiche le `rm` exact pour la nettoyer, ou tu peux la révoquer côté Voyage.
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
Beta privée. Pas de redistribution.
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error thrown when the macOS Keychain is locked. Caught by
|
|
3
|
+
* `readToken` (CLI read path) and `ensureToken` (CLI write path) to
|
|
4
|
+
* surface the `security unlock-keychain ~/Library/Keychains/login.keychain-db`
|
|
5
|
+
* recovery copy instead of the raw `security` CLI failure.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LockedKeychainError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
1
10
|
/**
|
|
2
11
|
* Low-level Keychain operations.
|
|
3
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keychain.d.ts","sourceRoot":"","sources":["../../../src/auth/keychain.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keychain.d.ts","sourceRoot":"","sources":["../../../src/auth/keychain.ts"],"names":[],"mappings":"AAuBA;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAWD;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACtC;AAgBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,WAoFzB,CAAC"}
|
|
@@ -8,6 +8,37 @@ const SERVICE = "com.getrift.daemon";
|
|
|
8
8
|
* All other non-zero exits are real failures that must propagate.
|
|
9
9
|
*/
|
|
10
10
|
const ERR_SEC_ITEM_NOT_FOUND = 44;
|
|
11
|
+
/**
|
|
12
|
+
* Substring emitted by the macOS `security` CLI when the login keychain
|
|
13
|
+
* is locked (typical over SSH or in CI without a GUI session). Locked-
|
|
14
|
+
* keychain failures are a distinct *class* — they're recoverable with
|
|
15
|
+
* `security unlock-keychain`, unlike permission denials or missing
|
|
16
|
+
* binaries — so callers benefit from a typed error to render a precise
|
|
17
|
+
* recovery hint.
|
|
18
|
+
*/
|
|
19
|
+
const LOCKED_KEYCHAIN_SUBSTRING = "User interaction is not allowed";
|
|
20
|
+
/**
|
|
21
|
+
* Typed error thrown when the macOS Keychain is locked. Caught by
|
|
22
|
+
* `readToken` (CLI read path) and `ensureToken` (CLI write path) to
|
|
23
|
+
* surface the `security unlock-keychain ~/Library/Keychains/login.keychain-db`
|
|
24
|
+
* recovery copy instead of the raw `security` CLI failure.
|
|
25
|
+
*/
|
|
26
|
+
export class LockedKeychainError extends Error {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = "LockedKeychainError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function isLockedKeychain(err) {
|
|
33
|
+
if (!(err instanceof Error))
|
|
34
|
+
return false;
|
|
35
|
+
if (err.message.includes(LOCKED_KEYCHAIN_SUBSTRING))
|
|
36
|
+
return true;
|
|
37
|
+
// The substring lands on stderr, which `execFile` attaches to the
|
|
38
|
+
// error object as `stderr`. Belt + braces: check both surfaces.
|
|
39
|
+
const stderr = err.stderr;
|
|
40
|
+
return typeof stderr === "string" && stderr.includes(LOCKED_KEYCHAIN_SUBSTRING);
|
|
41
|
+
}
|
|
11
42
|
function accountName(version) {
|
|
12
43
|
return `AUTH_TOKEN_v${version}`;
|
|
13
44
|
}
|
|
@@ -48,6 +79,9 @@ export const macKeychain = {
|
|
|
48
79
|
catch (err) {
|
|
49
80
|
if (isItemNotFound(err))
|
|
50
81
|
return null;
|
|
82
|
+
if (isLockedKeychain(err)) {
|
|
83
|
+
throw new LockedKeychainError(err instanceof Error ? err.message : String(err));
|
|
84
|
+
}
|
|
51
85
|
throw err;
|
|
52
86
|
}
|
|
53
87
|
},
|
|
@@ -106,6 +140,9 @@ export const macKeychain = {
|
|
|
106
140
|
catch (err) {
|
|
107
141
|
if (isItemNotFound(err))
|
|
108
142
|
return 0; // No tokens issued yet.
|
|
143
|
+
if (isLockedKeychain(err)) {
|
|
144
|
+
throw new LockedKeychainError(err instanceof Error ? err.message : String(err));
|
|
145
|
+
}
|
|
109
146
|
throw err;
|
|
110
147
|
}
|
|
111
148
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keychain.js","sourceRoot":"","sources":["../../../src/auth/keychain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,OAAO,GAAG,oBAAoB,CAAC;AAErC;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"keychain.js","sourceRoot":"","sources":["../../../src/auth/keychain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,OAAO,GAAG,oBAAoB,CAAC;AAErC;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,yBAAyB,GAAG,iCAAiC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC7C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,cAAc,CAAC,GAAG,CAAC;gBAAE,OAAO,CAAC,CAAC,CAAC,wBAAwB;YAC3D,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,mBAAmB,CAC3B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CACjD,CAAC;YACJ,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Default byte budget per summarization chunk. Sits well below the
|
|
4
|
+
* 8 MB auto-capture threshold so the Codex CLI input never hits the
|
|
5
|
+
* same wall that caused the quarantine in the first place. 512 KB
|
|
6
|
+
* fits comfortably in stdin and leaves room for the prompt.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_RECOVERY_CHUNK_BYTES: number;
|
|
9
|
+
/** Minimum chunk size we allow — anything smaller risks turn-truncation. */
|
|
10
|
+
export declare const MIN_RECOVERY_CHUNK_BYTES: number;
|
|
11
|
+
export declare const PROVENANCE_TOPIC = "recovered_oversized_quarantine";
|
|
12
|
+
declare const QuarantineRecordSchema: z.ZodObject<{
|
|
13
|
+
source: z.ZodLiteral<"codex_cli">;
|
|
14
|
+
session_id: z.ZodString;
|
|
15
|
+
session_path: z.ZodString;
|
|
16
|
+
size_bytes: z.ZodNumber;
|
|
17
|
+
threshold_bytes: z.ZodNumber;
|
|
18
|
+
fingerprint: z.ZodString;
|
|
19
|
+
reason: z.ZodString;
|
|
20
|
+
quarantined_at: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
source: "codex_cli";
|
|
23
|
+
size_bytes: number;
|
|
24
|
+
quarantined_at: string;
|
|
25
|
+
reason: string;
|
|
26
|
+
fingerprint: string;
|
|
27
|
+
session_id: string;
|
|
28
|
+
session_path: string;
|
|
29
|
+
threshold_bytes: number;
|
|
30
|
+
}, {
|
|
31
|
+
source: "codex_cli";
|
|
32
|
+
size_bytes: number;
|
|
33
|
+
quarantined_at: string;
|
|
34
|
+
reason: string;
|
|
35
|
+
fingerprint: string;
|
|
36
|
+
session_id: string;
|
|
37
|
+
session_path: string;
|
|
38
|
+
threshold_bytes: number;
|
|
39
|
+
}>;
|
|
40
|
+
export type QuarantineRecord = z.infer<typeof QuarantineRecordSchema> & {
|
|
41
|
+
/** Path to the quarantine record file itself. */
|
|
42
|
+
record_path: string;
|
|
43
|
+
};
|
|
44
|
+
declare const RecoveredEntrySchema: z.ZodObject<{
|
|
45
|
+
recovered_at: z.ZodString;
|
|
46
|
+
fingerprint: z.ZodString;
|
|
47
|
+
idempotency_key: z.ZodString;
|
|
48
|
+
chunks: z.ZodNumber;
|
|
49
|
+
session_path: z.ZodString;
|
|
50
|
+
size_bytes: z.ZodNumber;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
idempotency_key: string;
|
|
53
|
+
size_bytes: number;
|
|
54
|
+
fingerprint: string;
|
|
55
|
+
session_path: string;
|
|
56
|
+
recovered_at: string;
|
|
57
|
+
chunks: number;
|
|
58
|
+
}, {
|
|
59
|
+
idempotency_key: string;
|
|
60
|
+
size_bytes: number;
|
|
61
|
+
fingerprint: string;
|
|
62
|
+
session_path: string;
|
|
63
|
+
recovered_at: string;
|
|
64
|
+
chunks: number;
|
|
65
|
+
}>;
|
|
66
|
+
export type RecoveredEntry = z.infer<typeof RecoveredEntrySchema>;
|
|
67
|
+
declare const RecoveryStateSchema: z.ZodObject<{
|
|
68
|
+
recovered: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
69
|
+
recovered_at: z.ZodString;
|
|
70
|
+
fingerprint: z.ZodString;
|
|
71
|
+
idempotency_key: z.ZodString;
|
|
72
|
+
chunks: z.ZodNumber;
|
|
73
|
+
session_path: z.ZodString;
|
|
74
|
+
size_bytes: z.ZodNumber;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
idempotency_key: string;
|
|
77
|
+
size_bytes: number;
|
|
78
|
+
fingerprint: string;
|
|
79
|
+
session_path: string;
|
|
80
|
+
recovered_at: string;
|
|
81
|
+
chunks: number;
|
|
82
|
+
}, {
|
|
83
|
+
idempotency_key: string;
|
|
84
|
+
size_bytes: number;
|
|
85
|
+
fingerprint: string;
|
|
86
|
+
session_path: string;
|
|
87
|
+
recovered_at: string;
|
|
88
|
+
chunks: number;
|
|
89
|
+
}>>>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
recovered: Record<string, {
|
|
92
|
+
idempotency_key: string;
|
|
93
|
+
size_bytes: number;
|
|
94
|
+
fingerprint: string;
|
|
95
|
+
session_path: string;
|
|
96
|
+
recovered_at: string;
|
|
97
|
+
chunks: number;
|
|
98
|
+
}>;
|
|
99
|
+
}, {
|
|
100
|
+
recovered?: Record<string, {
|
|
101
|
+
idempotency_key: string;
|
|
102
|
+
size_bytes: number;
|
|
103
|
+
fingerprint: string;
|
|
104
|
+
session_path: string;
|
|
105
|
+
recovered_at: string;
|
|
106
|
+
chunks: number;
|
|
107
|
+
}> | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
export type RecoveryState = z.infer<typeof RecoveryStateSchema>;
|
|
110
|
+
export type SkipReason = "already_recovered" | "missing_source" | "empty_session" | "summarize_failed" | "save_failed";
|
|
111
|
+
export interface RecoveryResult {
|
|
112
|
+
session_id: string;
|
|
113
|
+
fingerprint: string;
|
|
114
|
+
outcome: "recovered" | "skipped" | "failed";
|
|
115
|
+
reason?: SkipReason;
|
|
116
|
+
chunks?: number;
|
|
117
|
+
idempotency_key?: string;
|
|
118
|
+
error?: string;
|
|
119
|
+
}
|
|
120
|
+
export interface RecoveryReport {
|
|
121
|
+
total_records: number;
|
|
122
|
+
total_sessions: number;
|
|
123
|
+
recovered: number;
|
|
124
|
+
skipped: number;
|
|
125
|
+
missing_source: number;
|
|
126
|
+
failed: number;
|
|
127
|
+
results: RecoveryResult[];
|
|
128
|
+
}
|
|
129
|
+
export interface ChunkSummary {
|
|
130
|
+
summary: string;
|
|
131
|
+
topics: string[];
|
|
132
|
+
}
|
|
133
|
+
export interface ChunkSummarizer {
|
|
134
|
+
summarize(opts: {
|
|
135
|
+
chunk: string;
|
|
136
|
+
index: number;
|
|
137
|
+
total: number;
|
|
138
|
+
sessionId: string;
|
|
139
|
+
}): Promise<ChunkSummary>;
|
|
140
|
+
}
|
|
141
|
+
export interface RecoverQuarantineSaveInput {
|
|
142
|
+
sessionId: string;
|
|
143
|
+
fingerprint: string;
|
|
144
|
+
sessionPath: string;
|
|
145
|
+
sizeBytes: number;
|
|
146
|
+
thresholdBytes: number;
|
|
147
|
+
chunks: ChunkSummary[];
|
|
148
|
+
content: string;
|
|
149
|
+
summary: string;
|
|
150
|
+
topics: string[];
|
|
151
|
+
idempotencyKey: string;
|
|
152
|
+
}
|
|
153
|
+
export interface RecoverQuarantineDeps {
|
|
154
|
+
dataDir: string;
|
|
155
|
+
/** Override quarantine directory (defaults to `<dataDir>/quarantine`). */
|
|
156
|
+
quarantineDir?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Chunk byte budget. Clamped to at least `MIN_RECOVERY_CHUNK_BYTES`.
|
|
159
|
+
* Defaults to `DEFAULT_RECOVERY_CHUNK_BYTES`.
|
|
160
|
+
*/
|
|
161
|
+
chunkBytes?: number;
|
|
162
|
+
summarizer: ChunkSummarizer;
|
|
163
|
+
/**
|
|
164
|
+
* Save the recovered artifact through the daemon. Implementations
|
|
165
|
+
* should be idempotent w.r.t. `idempotencyKey` so a partial failure
|
|
166
|
+
* mid-batch doesn't double-insert when the recovery state write
|
|
167
|
+
* happened after a successful save (it doesn't here — state is
|
|
168
|
+
* persisted on success only — but the contract still holds).
|
|
169
|
+
*/
|
|
170
|
+
saveFn: (input: RecoverQuarantineSaveInput) => Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Dry-run: discover, parse, and chunk only. The Codex CLI summarizer
|
|
173
|
+
* is NOT invoked (each chunk call costs real time/quota on real data),
|
|
174
|
+
* and saving + state persistence are skipped. Use this to plan a real
|
|
175
|
+
* run cheaply; the report's `chunks` count reflects what a real run
|
|
176
|
+
* would summarize.
|
|
177
|
+
*/
|
|
178
|
+
dryRun?: boolean;
|
|
179
|
+
/** Optional clock for deterministic tests. */
|
|
180
|
+
now?: () => Date;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Read all Codex-CLI quarantine records under the configured directory.
|
|
184
|
+
* Malformed JSON / schema mismatches are skipped silently with a stderr
|
|
185
|
+
* note so one corrupt record can never block the rest of the batch.
|
|
186
|
+
*/
|
|
187
|
+
export declare function loadQuarantineRecords(deps: Pick<RecoverQuarantineDeps, "dataDir" | "quarantineDir">): QuarantineRecord[];
|
|
188
|
+
/**
|
|
189
|
+
* Collapse multiple quarantine records that point at the same session
|
|
190
|
+
* (the same jsonl that hit the threshold at different sizes as it grew)
|
|
191
|
+
* down to one: the latest `quarantined_at`. The collapsed record still
|
|
192
|
+
* carries the recovery key, so reruns can mark every related record as
|
|
193
|
+
* already-recovered for that session.
|
|
194
|
+
*/
|
|
195
|
+
export declare function groupBySession(records: QuarantineRecord[]): QuarantineRecord[];
|
|
196
|
+
export declare function loadRecoveryState(deps: Pick<RecoverQuarantineDeps, "dataDir">): RecoveryState;
|
|
197
|
+
export declare function saveRecoveryState(deps: Pick<RecoverQuarantineDeps, "dataDir">, state: RecoveryState): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Split parser-emitted Codex content into byte-budgeted chunks at turn
|
|
200
|
+
* boundaries. The parser format is `User: …\n\nAssistant: …\n\n…`, so
|
|
201
|
+
* we split on `\n\n` immediately preceding a `User:` or `Assistant:`
|
|
202
|
+
* marker. A single turn larger than `maxBytes` becomes its own chunk
|
|
203
|
+
* (oversized but preserved — better than dropping signal).
|
|
204
|
+
*/
|
|
205
|
+
export declare function chunkByTurns(content: string, maxBytes: number): string[];
|
|
206
|
+
export declare function runRecoverQuarantine(deps: RecoverQuarantineDeps): Promise<RecoveryReport>;
|
|
207
|
+
export declare class CodexCliChunkSummarizer implements ChunkSummarizer {
|
|
208
|
+
private readonly options;
|
|
209
|
+
constructor(options?: {
|
|
210
|
+
cwd?: string;
|
|
211
|
+
timeoutMs?: number;
|
|
212
|
+
});
|
|
213
|
+
summarize(opts: {
|
|
214
|
+
chunk: string;
|
|
215
|
+
index: number;
|
|
216
|
+
total: number;
|
|
217
|
+
sessionId: string;
|
|
218
|
+
}): Promise<ChunkSummary>;
|
|
219
|
+
}
|
|
220
|
+
export {};
|
|
221
|
+
//# sourceMappingURL=recover-quarantine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recover-quarantine.d.ts","sourceRoot":"","sources":["../../../src/capture/recover-quarantine.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAAa,CAAC;AAEvD,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,QAAY,CAAC;AAElD,eAAO,MAAM,gBAAgB,mCAAmC,CAAC;AAEjE,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS1B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,GAAG;IACtE,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;EAOxB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;A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