@irfnd/ape 0.0.0-stage → 0.1.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.md +116 -2
- package/bunfig.toml +3 -0
- package/dist/ape.js +23590 -0
- package/dist/opencode-plugin.js +52 -0
- package/package.json +47 -5
package/README.md
CHANGED
|
@@ -1,3 +1,117 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @irfnd/ape
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sisi client dari **APE (AI Personal Environment)**:
|
|
4
|
+
|
|
5
|
+
- **Hooks memori** untuk Claude Code, Antigravity dan OpenCode: tiap project punya memori bersama (ringkasan sesi, perubahan, fakta) yang tersimpan di server remote [`@irfnd/ape-server`](https://www.npmjs.com/package/@irfnd/ape-server) dan dibagi antar agent dan antar komputer.
|
|
6
|
+
- **Zed adapter** lokal untuk edit prediction, meneruskan ke LLM gateway (9router) di server.
|
|
7
|
+
|
|
8
|
+
Pengganti sisi client dari `supermemory-local`; server-nya sekarang jalan di VPS di belakang cloudflared + Cloudflare Access.
|
|
9
|
+
|
|
10
|
+
## Instalasi
|
|
11
|
+
|
|
12
|
+
Butuh [Bun](https://bun.sh) ≥ 1.3 dan git.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
bun add -g @irfnd/ape
|
|
16
|
+
ape init # URL server, Cloudflare Access service token, API key, lalu tes koneksi
|
|
17
|
+
ape install-hooks # semua agent yang terdeteksi
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ape init` bisa non-interaktif: `--memory-url --llm-url --cf-client-id --cf-client-secret --supermemory-key --nine-router-key --translate-model`.
|
|
21
|
+
|
|
22
|
+
## Perintah
|
|
23
|
+
|
|
24
|
+
| Perintah | Fungsi |
|
|
25
|
+
| ---------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
26
|
+
| `ape init` | Simpan konfigurasi (`~/.config/ape/config.json`, `chmod 600`) dan tes |
|
|
27
|
+
| `ape install-hooks [--claude-code] [--antigravity] [--opencode]` | Pasang hooks; tanpa flag = semua agent yang terpasang di komputer |
|
|
28
|
+
| `ape uninstall-hooks [flag yang sama]` | Lepas hooks (entri milik agent/user lain tidak disentuh) |
|
|
29
|
+
| `ape start --zed-adaptor [--daemon]` | Jalankan Zed adapter (foreground, atau background dengan `--daemon`) |
|
|
30
|
+
| `ape stop` | Hentikan adapter background |
|
|
31
|
+
| `ape status` | Config, hooks terpasang, adapter (offline) |
|
|
32
|
+
| `ape doctor` | Tes server: Cloudflare Access, API key, latensi, model, hooks |
|
|
33
|
+
| `ape migrate --scan <dir>...` | Pindahkan memori dari `supermemory-local` ke server (lihat di bawah) |
|
|
34
|
+
|
|
35
|
+
Direktori state bisa diganti dengan `APE_CONFIG_DIR`. Isi `~/.config/ape/`: `config.json`, `hook.log`, `zed-adapter.log` dan `.pid`, `migrated.json`.
|
|
36
|
+
|
|
37
|
+
## Hooks
|
|
38
|
+
|
|
39
|
+
`ape install-hooks` menulis perintah absolut ke `~/.claude/settings.json`, `~/.gemini/config/hooks.json` dan `~/.config/opencode/plugins/ape.ts` (backup `.bak-<timestamp>` dibuat dulu). Hooks lama dari `supermemory-local` otomatis digantikan. Restart sesi agent yang sedang berjalan setelah memasang.
|
|
40
|
+
|
|
41
|
+
Alur: sesi mulai → memori project dimasukkan ke konteks; tiap prompt → memori baru dari agent/komputer lain + hasil pencarian hybrid untuk prompt itu; tiap perubahan file → dicatat; sesi selesai/compact → ringkasan disimpan.
|
|
42
|
+
|
|
43
|
+
Hooks **tidak pernah** mengganggu agent: semua error masuk `~/.config/ape/hook.log` dan exit code selalu 0.
|
|
44
|
+
|
|
45
|
+
### Identitas project
|
|
46
|
+
|
|
47
|
+
Memori dikunci ke **git remote** (`origin`, dinormalisasi jadi `github.com/owner/repo`), jadi repo yang sama di komputer manapun, lewat ssh/https, berbagi memori. Tanpa remote dipakai hash path absolut (seperti `supermemory-local`).
|
|
48
|
+
|
|
49
|
+
### Terjemahan
|
|
50
|
+
|
|
51
|
+
Embedding default server (`bge-base-en`) hanya paham Inggris. Isi `translateModel` (model 9router, mis. `ag/gemini-3.8-flash-low`) agar prompt dan ringkasan non-Inggris diterjemahkan dulu; kosong = mati (pakai ini bila server memakai embedding multibahasa). Tiap terjemahan menambah ~1-2 detik.
|
|
52
|
+
|
|
53
|
+
### Latensi
|
|
54
|
+
|
|
55
|
+
Tiap prompt membayar satu round-trip listing + satu pencarian lewat tunnel. `ape doctor` memperingatkan jika server menjawab > 1,5 detik. `timeoutMs` (default 6000) adalah timeout per request; hook dimatikan agent pada 20 detik.
|
|
56
|
+
|
|
57
|
+
## Zed
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
ape start --zed-adaptor --daemon
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Lalu di settings Zed (port dari `zed.port`, default 20130):
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
"edit_predictions": {
|
|
67
|
+
"provider": "open_ai_compatible_api",
|
|
68
|
+
"open_ai_compatible_api": {
|
|
69
|
+
"api_url": "http://127.0.0.1:20130/v1/completions",
|
|
70
|
+
"model": "ag/gemini-3.8-flash-low",
|
|
71
|
+
"prompt_format": "zeta"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Adapter jalan di komputer ini supaya token Cloudflare Access dan key 9router tidak pernah sampai ke Zed. Model yang dipakai ke 9router adalah `zed.model` di config.
|
|
77
|
+
|
|
78
|
+
## Memindahkan memori dari supermemory-local
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
ape migrate --scan ~/Coding --dry-run # lihat apa yang akan disalin
|
|
82
|
+
ape migrate --scan ~/Coding # salin
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- Tag lama (hash path) dipetakan ke tag baru (git remote) lewat repo yang ditemukan di `--scan`; tag tanpa repo dilaporkan dan dilewati (`--include-unmatched` menyalinnya apa adanya).
|
|
86
|
+
- Default hanya `session_summary` (`--types session_summary,change_observation` atau `--types all` untuk menambah). Setiap dokumen diproses ulang oleh LLM server, dan supermemory Lite dibatasi ±10.000 dokumen.
|
|
87
|
+
- Urutan lama → baru dipertahankan, timestamp asli disimpan di metadata, dan `migrated.json` membuat perintah ini aman diulang.
|
|
88
|
+
- Sumber default `http://127.0.0.1:6767` (`--from`, `--from-key` bila perlu).
|
|
89
|
+
|
|
90
|
+
## Konfigurasi (`config.json`)
|
|
91
|
+
|
|
92
|
+
| Key | Keterangan |
|
|
93
|
+
| -------------------------------- | --------------------------------------------------------------- |
|
|
94
|
+
| `memoryUrl`, `llmUrl` | URL publik supermemory dan 9router (di belakang Access) |
|
|
95
|
+
| `cfAccess.clientId/clientSecret` | Service token Cloudflare Access (hapus bila tidak pakai Access) |
|
|
96
|
+
| `supermemoryApiKey` | dari `ape-server status --keys` |
|
|
97
|
+
| `nineRouterApiKey` | key dari dashboard 9router |
|
|
98
|
+
| `translateModel` | lihat Terjemahan; default kosong |
|
|
99
|
+
| `timeoutMs` | timeout per request hook, default 6000 |
|
|
100
|
+
| `zed.port/model/reasoningEffort` | default `20130`, `ag/gemini-3.8-flash-low`, `none` |
|
|
101
|
+
|
|
102
|
+
## Troubleshooting
|
|
103
|
+
|
|
104
|
+
- `ape doctor` menjawab kebanyakan hal. "redirected to a login page" = Cloudflare Access menolak service token (cek id/secret dan policy _Service Auth_).
|
|
105
|
+
- Hook tidak jalan? Lihat `~/.config/ape/hook.log`.
|
|
106
|
+
- Memori kosong di komputer kedua? Pastikan repo punya remote `origin` yang sama; `ape migrate` hanya memindahkan memori lama.
|
|
107
|
+
|
|
108
|
+
## Pengembangan
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
bun install
|
|
112
|
+
bun test && bun run typecheck && bun run format:check
|
|
113
|
+
bun run build # dist/ape.js + dist/opencode-plugin.js; dipublish sebagai bundle
|
|
114
|
+
bun bin/ape.ts --help
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`CLAUDE.md` berisi arsitektur dan invariant.
|
package/bunfig.toml
ADDED