minicode-ai 0.22.0 → 0.25.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 +2 -2
- package/cli/commands.ts +10 -0
- package/cli/index.ts +11 -0
- package/cli/setup.ts +64 -33
- package/cli/tui.ts +29 -3
- package/docs/README.md +2 -2
- package/docs/SUMMARY.md +10 -19
- package/docs/TERMINAL_CONTRACT.md +119 -32
- package/docs/architecture.md +1 -1
- package/docs/autonomous-scheduler.md +283 -2
- package/docs/choosing-mode.md +4 -4
- package/docs/concepts.md +39 -3
- package/docs/config.md +90 -4
- package/docs/environment.md +6 -0
- package/docs/getting-started.md +58 -2
- package/docs/repl.md +1 -1
- package/docs/security.md +49 -2
- package/docs/tools.md +2 -1
- package/package.json +2 -36
- package/src/app/provider-layer.ts +1 -1
- package/src/app/session.ts +129 -20
- package/src/config.ts +102 -2
- package/src/constants.ts +32 -4
- package/src/lib/safe-open.ts +21 -12
- package/src/memory/vector.ts +0 -31
- package/src/policy/compaction.ts +27 -0
- package/src/policy/context-budget.ts +132 -0
- package/src/policy/context-escalation.ts +140 -0
- package/src/policy/context-window.ts +14 -9
- package/src/policy/context.ts +10 -1
- package/src/policy/microcompact.ts +162 -0
- package/src/policy/no-progress.ts +1 -1
- package/src/policy/permission.ts +5 -0
- package/src/policy/scrub.ts +15 -2
- package/src/policy/tool-contract.ts +11 -9
- package/src/presentation/reducer.ts +1 -0
- package/src/providers/anthropic.ts +17 -3
- package/src/providers/detect.ts +155 -13
- package/src/providers/provision.ts +92 -1
- package/src/providers/responses.ts +13 -1
- package/src/session/persistence.ts +56 -0
- package/src/task/autonomous-policy.ts +7 -0
- package/src/task/graph-validate.ts +1 -1
- package/src/task/session-authority.ts +0 -5
- package/src/task/store.ts +0 -4
- package/src/tools/ask_user.ts +14 -1
- package/src/tools/bash.ts +57 -9
- package/src/tools/context.ts +10 -0
- package/src/tools/delete_file.ts +3 -2
- package/src/tools/edit.ts +5 -4
- package/src/tools/git.ts +70 -12
- package/src/tools/glob.ts +13 -5
- package/src/tools/grep.ts +26 -10
- package/src/tools/index.ts +3 -2
- package/src/tools/lsp.ts +15 -9
- package/src/tools/move_file.ts +4 -3
- package/src/tools/patch.ts +5 -4
- package/src/tools/read_file.ts +3 -2
- package/src/tools/read_image.ts +3 -2
- package/src/tools/task.ts +1 -0
- package/src/tools/todo.ts +4 -8
- package/src/tools/write_file.ts +4 -3
- package/src/ui/approval/prompt.ts +226 -77
- package/src/ui/assistant/simple.ts +1 -1
- package/src/ui/footer.ts +41 -29
- package/src/ui/i18n/en.ts +23 -4
- package/src/ui/i18n/id.ts +25 -4
- package/src/ui/input/input.ts +2 -2
- package/src/ui/render/activity-group.ts +1 -0
- package/src/ui/render/activity-panel.ts +21 -3
- package/src/ui/render/hint.ts +28 -0
- package/src/ui/render/ledger.ts +1 -9
- package/src/ui/render/logo.ts +86 -0
- package/src/ui/render/markdown-table.ts +0 -3
- package/src/ui/render/session-summary.ts +22 -1
- package/src/ui/render/table-grid.ts +0 -3
- package/src/ui/render/theme.ts +36 -5
- package/src/ui/runtime/screen.ts +11 -3
- package/src/ui/screens/dialog.ts +45 -81
- package/src/ui/screens/form.ts +29 -33
- package/src/ui/screens/lifecycle.ts +80 -0
- package/src/ui/screens/model-manager.ts +84 -91
- package/src/ui/screens/picker.ts +36 -33
- package/src/ui/screens/provider-manager.ts +50 -59
- package/src/ui/screens/watchdog.ts +27 -0
- package/src/ui/screens/wizard.ts +3 -20
- package/src/ui/tui/app.ts +97 -11
- package/src/ui/tui/transcript.ts +55 -16
- package/vendor/minicore/src/core/compact.ts +10 -0
- package/vendor/minicore/src/core/errors.ts +11 -1
- package/vendor/minicore/src/core/executor.ts +6 -1
- package/vendor/minicore/src/core/loop.ts +92 -2
- package/vendor/minicore/src/core/session.ts +8 -0
- package/vendor/minicore/src/providers/openai-compat.ts +15 -2
- package/docs/P14_OPEN_WORK.md +0 -290
- package/docs/config-providers.md +0 -87
- package/docs/glossary.md +0 -39
- package/docs/quickstart.md +0 -60
- package/docs/security-model.md +0 -96
- package/docs/terminal.md +0 -91
package/docs/concepts.md
CHANGED
|
@@ -28,7 +28,7 @@ ditulis sendiri) dan membagi dua jalur secara tegas:
|
|
|
28
28
|
buffer utama kembali persis (transkrip tidak di-dump ke scrollback).
|
|
29
29
|
- Warna hanya saat TTY; `NO_COLOR` selalu menang; output program tetap bersih dari cursor-control saat di-pipe.
|
|
30
30
|
|
|
31
|
-
Detail lengkap + kontrak FROZEN-nya di [Kontrak Terminal](
|
|
31
|
+
Detail lengkap + kontrak FROZEN-nya di [Kontrak Terminal](TERMINAL_CONTRACT.md).
|
|
32
32
|
|
|
33
33
|
## Kejujuran sebagai fitur
|
|
34
34
|
|
|
@@ -45,9 +45,45 @@ Runtime tanpa dependency pihak ketiga; satu-satunya kebutuhan keras adalah **Bun
|
|
|
45
45
|
|
|
46
46
|
## Bahasa
|
|
47
47
|
|
|
48
|
-
Dokumentasi dan komentar kode berbahasa **Indonesia** dengan istilah teknis tetap English (`provider`, `checkpoint`, `sandbox`, `jail`).
|
|
48
|
+
Dokumentasi dan komentar kode berbahasa **Indonesia** dengan istilah teknis tetap English (`provider`, `checkpoint`, `sandbox`, `jail`). Tabel di bawah mengunci makna istilah yang paling sering dipakai.
|
|
49
|
+
|
|
50
|
+
## Glosarium
|
|
51
|
+
|
|
52
|
+
Istilah MiniCode yang punya makna spesifik. Dokumentasi berbahasa Indonesia dengan
|
|
53
|
+
istilah teknis English — tabel ini mengunci maknanya.
|
|
54
|
+
|
|
55
|
+
| Istilah | Makna |
|
|
56
|
+
|---|---|
|
|
57
|
+
| **MiniCore** | Kernel runtime `STATE / MODEL / ACTION / LOOP` di-vendor ke `vendor/minicore`; inti beku, zero-dep, di-resolve via `#minicore` |
|
|
58
|
+
| **Minicode** | Layer agencode di atas MiniCore: tools, agents, policy, providers, memory, sessions, CLI |
|
|
59
|
+
| **Tool** | Kemampuan yang dipilih model dalam loop ReAct; tool MCP dapat ditambahkan dinamis sebagai `serverId.toolName` |
|
|
60
|
+
| **Tool scope** | `full` atau subset read-only `explore` — flag `--tool-scope` |
|
|
61
|
+
| **WorkMode** | Cara agent bekerja: `DISCUSS`, `PLAN`, atau `BUILD` (alias produk untuk identitas internal `EXECUTE`) |
|
|
62
|
+
| **PermissionMode** | Pilihan pengawasan: `AUTO` menjalankan capability yang diotorisasi; `ASK` meminta persetujuan untuk aksi yang digate |
|
|
63
|
+
| **Tool Access Policy** | Batas capability yang tersedia, seperti read-only, allowlist, atau profil akses warisan `--allow-all` |
|
|
64
|
+
| **Gate** | Tool wajib persetujuan manusia saat TTY; non-TTY selalu tolak (mis. `git_commit`, MCP, `delegate_task`) |
|
|
65
|
+
| **Path jail** | Pembatasan akses file ke workspace (realpath + symlink; `O_NOFOLLOW` pada POSIX dan pencocokan identitas handle `dev+ino` pada semua platform); aktif bahkan `--allow-all` |
|
|
66
|
+
| **Bash-guard** | Normalisasi + blokir pola bash berbahaya sebelum eksekusi (quote-split, indirection, wrapper) |
|
|
67
|
+
| **Sandbox OS** | bubblewrap (Linux) / seatbelt (macOS) — otomatis bila tersedia |
|
|
68
|
+
| **Sandbox Docker** | Container ephemeral `--network none`, 512m, 1 CPU, `node:22-alpine` |
|
|
69
|
+
| **Checkpoint** | Snapshot per turn via shadow-git: SHA tree di `refs/minicode/…` (O(delta), HEAD/index tak tersentuh) |
|
|
70
|
+
| **Recovery journal** | `journal-<sesi>.jsonl`: `pending` → `committed`/`failed`/`unknown`; finalisasi menandai cakupan turn yang sudah durable |
|
|
71
|
+
| **Session** | Riwayat tersimpan di `.minicode/sessions.db` (SQLite WAL); kompaksi dapat mengganti bagian lama dengan ringkasan + tail |
|
|
72
|
+
| **Memory dua lapis** | `MEMORY.md` hierarki (selalu ke system prompt) + vector RAG hybrid (injeksi bila skor ≥ ambang) |
|
|
73
|
+
| **RAG hybrid** | Pencarian memory cosine 0.7 + keyword 0.3, ranking MMR (λ 0.7), dedup >0.92 |
|
|
74
|
+
| **Repo-map** | Simbol per file (regex 9 bahasa, fallback LSP) disuntik ke system prompt |
|
|
75
|
+
| **Skill** | Prompt terpaket `.minicode/skills/*.md` dengan frontmatter `name`/`description` |
|
|
76
|
+
| **Hook** | Skrip `pre/post-run` dari `~/.minicode/hooks` + `.minicode/hooks`; mati default, `MINICODE_HOOKS=1` |
|
|
77
|
+
| **Env scrub** | `sanitizeSpawnEnv` menghapus kata-kunci kredensial dari env subprocess |
|
|
78
|
+
| **Secret scrubber** | Redaksi `sk-`/`ghp_`/`AKIA`/PEM/JWT/Bearer sebelum teks ke LLM |
|
|
79
|
+
| **Ledger** | Baris ` › name target` / ` › name: …` di stderr — jejak aksi agent |
|
|
80
|
+
| **Scrollback** | Riwayat layar terminal; jalur non-interaktif minicode append-only di sana (interaktif pakai alternate screen) |
|
|
81
|
+
| **Transient** | UI muncul-sekali yang menghapus dirinya (spinner, garis status turn) — vs transkrip yang menetap |
|
|
82
|
+
| **Composition root** | `cli/index.ts` + `cli/setup.ts`: satu tempat wiring DI (provider, RAG, session, tools) |
|
|
83
|
+
| **Seam aditif** | Satu-satunya patch yang dibolehkan ke kernel beku: `compactAsync`, `initialMessages`, `cwd` |
|
|
84
|
+
| **Self-contained** | Tanpa clone repo lain — kernel di-vendor, runtime zero-dep, butuh Bun ≥ 1.1.13 |
|
|
49
85
|
|
|
50
86
|
## Lanjut
|
|
51
87
|
|
|
52
88
|
- [Arsitektur](architecture.md) — tiga lapisan, boundary, alur satu prompt.
|
|
53
|
-
- [Quickstart](
|
|
89
|
+
- [Instalasi & Quickstart](getting-started.md) — dari nol ke prompt pertama yang ter-verify.
|
package/docs/config.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Config
|
|
1
|
+
# Config & Provider
|
|
2
2
|
|
|
3
|
-
Di mana pengaturan dan data Minicode tinggal,
|
|
3
|
+
Di mana pengaturan dan data Minicode tinggal, bagaimana file lokal yang tak tepercaya diperlakukan, dan provider mana yang bisa dipakai.
|
|
4
4
|
|
|
5
5
|
## Skema `.minicode/config.json`
|
|
6
6
|
|
|
@@ -20,12 +20,98 @@ Di mana pengaturan dan data Minicode tinggal, dan bagaimana file lokal yang tak
|
|
|
20
20
|
}
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
- `providers` — bisa juga diisi lewat wizard/`minicode config add`/`/provider`; lihat daftar preset di
|
|
23
|
+
- `providers` — bisa juga diisi lewat wizard/`minicode config add`/`/provider`; lihat daftar preset di bawah.
|
|
24
24
|
- `providers[].contextWindows` — batas konteks dalam token per model; exact model ID menang, lalu key `"*"` menjadi fallback provider. Nilai harus integer positif. Karena gateway memakai alias model, MiniCode memakai **default konservatif 128K** untuk alias generik (`auto`/`best`/...) dan **32K** untuk model tak dikenal lainnya; jendela eksak tersedia lewat katalog built-in (keluarga umum), overlay `minicode pricing sync` (models.dev), dan **tokenizer presisi on-demand** dari HuggingFace untuk model open. `--context-window` mengalahkan nilai config selama sesi itu.
|
|
25
25
|
- `mcpServers` — dua bentuk: stdio (`command`+`args`) dan HTTP (`url`+opsional `headers`). Detail transport di [MCP & LSP](mcp-lsp.md).
|
|
26
26
|
- `verifyCommand` — dipakai `--verify` bila auto-detect tidak menemukan (urutan deteksi: `typecheck` → `test` → `tsconfig`).
|
|
27
27
|
- `bashAllowlist` — pola koma/pola glob perintah bash yang dianggap aman (mode `allowlist`).
|
|
28
28
|
|
|
29
|
+
## 15 preset gateway (termasuk Custom URL)
|
|
30
|
+
|
|
31
|
+
`Gateway >` hanya menampilkan `[0] Label` tanpa URL (minimalis, tanpa bocor endpoint).
|
|
32
|
+
|
|
33
|
+
| id | Label | Catatan |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `openai` | OpenAI | gpt, o-series |
|
|
36
|
+
| `anthropic` | Anthropic | Claude, streaming `tool_use` |
|
|
37
|
+
| `openrouter` | OpenRouter | Gateway 75+ model |
|
|
38
|
+
| `deepseek` | DeepSeek | chat/reasoner |
|
|
39
|
+
| `opencode-zen` | OpenCode Zen | Gateway |
|
|
40
|
+
| `google` | Google Gemini | Konteks 1M, `thought_signature` pass-through |
|
|
41
|
+
| `ollama` | Ollama | Lokal, gratis, tanpa key |
|
|
42
|
+
| `qwen` | Qwen | Alibaba Qwen3-Coder (satu-satunya dengan spec OAuth terdaftar) |
|
|
43
|
+
| `groq` | Groq | Inferensi cepat |
|
|
44
|
+
| `together` | Together AI | Model terbuka |
|
|
45
|
+
| `fireworks` | Fireworks AI | — |
|
|
46
|
+
| `mistral` | Mistral AI | — |
|
|
47
|
+
| `cohere` | Cohere | — |
|
|
48
|
+
| `generic` | OpenAI-compatible umum | vLLM / LM Studio |
|
|
49
|
+
| `custom` | Custom URL | Pseudo-preset untuk baseUrl sendiri |
|
|
50
|
+
|
|
51
|
+
Alur: wizard & `/provider` (add `[0] OpenAI` … `[14] Custom URL`) → API key ter-masking → auto-detect models via `GET /models` timeout 4 dtk → provider otomatis pindah saat pilih model beda provider (tanpa restart, via `reloadProviders()` setelah `Gateway >2`).
|
|
52
|
+
|
|
53
|
+
## Dua jalur autentikasi
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 1. API key
|
|
57
|
+
minicode config add --baseUrl https://api.openai.com/v1 --apiKey sk-…
|
|
58
|
+
|
|
59
|
+
# 2. OAuth device-code (tanpa API key, tanpa kartu kredit) — RFC 8628
|
|
60
|
+
minicode auth list # provider yang mendukung
|
|
61
|
+
minicode auth login qwen # kode singkat → buka URL → tunggu persetujuan
|
|
62
|
+
minicode auth status # kredensial + kapan kedaluwarsa
|
|
63
|
+
minicode auth logout qwen
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Token di `~/.minicode/auth.json` (chmod 600), bukan `config.json`. Refresh otomatis margin 60 dtk. Provider OAuth yang belum login dibuang dari daftar dengan peringatan, bukan dikirim dengan header kosong.
|
|
67
|
+
|
|
68
|
+
> Kejujuran: device flow teruji lengkap ke server OAuth lokal (pending/slow_down/denied/expired/clamp), tapi endpoint/clientId provider belum semua terkonfirmasi live. `auth login chatgpt` fail-fast di non-TTY. Jangan baca token aplikasi desktop orang lain — itu pencurian kredensial.
|
|
69
|
+
|
|
70
|
+
## Keyring OS (ganti plaintext config)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
minicode config set-key openrouter # pindah API key ke OS store, config tinggal referensi
|
|
74
|
+
minicode config delete-key openrouter # lupakan (provider nonaktif sampai di-set ulang)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Windows memakai DPAPI user-scope (hanya user ini yang bisa membuka); selain itu berkas chmod 600 dengan label jujur `plain-file` (bukan keyring). Referensi hilang/rusak = provider di-skip dengan peringatan (fail-closed, seperti OAuth). Matikan paksa via `MINICODE_KEYSTORE_DISABLE=1`.
|
|
78
|
+
|
|
79
|
+
## Model & thinking effort
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
/model [cari] → picker provider::model, bisa difilter
|
|
83
|
+
Enter → pilih model (+ picker effort bila modelnya mendukung)
|
|
84
|
+
Esc → batal total
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Effort tersimpan di `ProviderEntry.reasoningEffort`, berlaku sesi berikutnya, tampil badge `[low|medium|high]`. **Default universal = omit** (tanpa param thinking): default bawaan tiap model sudah di-tune vendornya. Knob hanya dikirim ke keluarga terbukti, dalam bahasa native-nya: OpenAI reasoning (`o1`/`o3`/`o4`, `gpt-5`/`gpt-6` → `reasoning_effort`, level tervalidasi per model — pro = high saja); Claude ≤4.5 → budget `1024/2048/4096`; Claude ≥4.6/5 → adaptive + `output_config.effort`. **Selain itu tak pernah dikirimi param thinking** (DeepSeek, Gemini, Groq, Ollama, free-tier, custom). Bila model menolak param (400/500), request diulang sekali tanpa param + diingat per sesi + dicatat `[thinking]` di stderr. Picker effort hanya muncul untuk model yang mendukung; sisanya select langsung tanpa menyentuh effort tersimpan. `detectAndSave`/`auth login` mempertahankan effort (tidak reset diam-diam). Mutasi ditulis ke file scope asal (bukan hasil merge) agar tidak duplikat/shadowing.
|
|
88
|
+
|
|
89
|
+
Model override sekali jalan:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
minicode --model providerId::modelName "prompt"
|
|
93
|
+
minicode --provider openai "prompt"
|
|
94
|
+
minicode models --match gemini
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`MINICODE_PROVIDER_ORDER=openai,anthropic,deepseek` mengurutkan provider agnostik tanpa edit config.
|
|
98
|
+
|
|
99
|
+
## Pin eksplisit `provider::model` (kontrak)
|
|
100
|
+
|
|
101
|
+
Model berformat `providerId::modelName` = PIN: request hanya ke provider
|
|
102
|
+
itu — **tanpa fallback lintas provider dan tanpa substitusi diam-diam**.
|
|
103
|
+
Gagal = error jujur dari provider yang dipilih (limit/saldo/error server),
|
|
104
|
+
user memilih model lanjutannya sendiri via `/model`. Alasan: fallback
|
|
105
|
+
otomatis pernah melempar user dari model gratis ke model berbayar provider
|
|
106
|
+
lain (tagihan tak terduga). Model bare (tanpa `::`) tetap perilaku lama
|
|
107
|
+
(first-match + substitusi + fallback rate_limit/server/network).
|
|
108
|
+
|
|
109
|
+
## Build & router
|
|
110
|
+
|
|
111
|
+
Build provider terpusat di `src/providers/build.ts`. Router fallback untuk rate_limit/server/network (clone-error + base64 fix + retryAfter cap). Deteksi wire dari probe path `/responses` → hint `responses`; substring host hanya fallback. `max_tokens` 8192; stop `length` = peringatan eksplisit, bukan teks sunyi.
|
|
112
|
+
|
|
113
|
+
Responses API: `/v1/responses`, `previous_response_id` chaining per model, `store:false` default.
|
|
114
|
+
|
|
29
115
|
## Global vs lokal
|
|
30
116
|
|
|
31
117
|
| File | Lokasi | Catatan |
|
|
@@ -39,7 +125,7 @@ Merge dengan **prioritas lokal menang**. Mutasi (add/update provider, MCP, LSP)
|
|
|
39
125
|
|
|
40
126
|
## Token OAuth bukan di config
|
|
41
127
|
|
|
42
|
-
Kredensial OAuth di `~/.minicode/auth.json` (chmod 600) — terpisah dari config karena config lokal rawan ikut ter-commit sedangkan token rahasia berumur pendek. Provider OAuth menyimpan `apiKey: ""` di config dan mengambil token saat runtime. Detail di [Config & Provider](config
|
|
128
|
+
Kredensial OAuth di `~/.minicode/auth.json` (chmod 600) — terpisah dari config karena config lokal rawan ikut ter-commit sedangkan token rahasia berumur pendek. Provider OAuth menyimpan `apiKey: ""` di config dan mengambil token saat runtime. Detail di [Config & Provider](config.md).
|
|
43
129
|
|
|
44
130
|
## Lokasi data
|
|
45
131
|
|
package/docs/environment.md
CHANGED
|
@@ -57,6 +57,9 @@ Variabel yang paling menentukan perilaku (sisanya referensi di bawah):
|
|
|
57
57
|
| `MINICODE_PROVIDER_ORDER` | Urutkan provider agnostik tanpa edit config: `openai,anthropic,deepseek` |
|
|
58
58
|
| `MINICODE_EMBED_MODEL` | Model embedding untuk memory/vector (default `text-embedding-3-small`) |
|
|
59
59
|
| `MINICODE_COMPACT_KEEP_TURNS` | Override keepRecentTurns kompaksi (bilangan ≥1; invalid → default kernel + warn) |
|
|
60
|
+
| `MINICODE_MICROCOMPACT` | `0` → matikan pemangkasan isi hasil tool lama (lapisan termurah sebelum kompaksi penuh). Default aktif; matikan bila sesi butuh seluruh output tool verbatim |
|
|
61
|
+
| `MINICODE_PROMPT_CACHE` | `0` → matikan prompt caching (`cache_control: ephemeral` Anthropic). Default aktif; kill-switch runtime bila gateway menolak header cache atau untuk diagnostik hit-rate (berpasangan dengan metrik cache di ringkasan sesi/`/status`) |
|
|
62
|
+
| `MINICODE_CONTEXT_PROBE` | `0` → matikan eskalasi adaptif jendela konteks (probe reaktif setelah overflow terverifikasi). Default aktif; probe juga dibatasi anggaran per-model/per-proses terlepas dari nilai ini |
|
|
60
63
|
| `MINICODE_MEMORY_SCOPE` | Scope baca memory: `cwd` (default) \| `global` \| `all` (gabung, tanpa silent shadowing) |
|
|
61
64
|
| `MINICODE_AUTO_MEMORY` | `0` → matikan auto-simpan summary/snippet ke memory (opt-out) |
|
|
62
65
|
| `MINICODE_READ_VOLUME_GUARD` | `1` → aktifkan peringatan sekali per turn saat volume baca (char hasil tool) melewati ambang — penanda "banyak dibaca tanpa kompaksi" (risiko degradasi working-memory, bukan jendela token); default nonaktif |
|
|
@@ -77,6 +80,8 @@ Variabel yang paling menentukan perilaku (sisanya referensi di bawah):
|
|
|
77
80
|
| Variabel | Fungsi |
|
|
78
81
|
|---|---|
|
|
79
82
|
| `MINICODE_ASCII` | `1` → paksa glyph ASCII (`[OK]`, `>`, `.`) untuk konsol tanpa UTF-8 |
|
|
83
|
+
| `MINICODE_BOX` | gaya sudut kotak popup: default **melengkung** (`╭╮╰╯`); `square` → lancip (`┌┐└┘`); `ascii` → `+-|` (sama dengan `MINICODE_ASCII=1`). Untuk terminal yang merender glyph melengkung jelek |
|
|
84
|
+
| `MINICODE_SCRIM` | `none` → paksa scrim backdrop jadi `faint` saja (tanpa latar gelap `48;5;236`) — diagnostik/tema terminal yang memetakan 256-warna aneh |
|
|
80
85
|
| `MINICODE_COMPACT` | `1` → tool call ringkas, `0` → expanded. Default: compact di TUI, expanded di one-shot/exec (juga `/compact`, Ctrl+O) |
|
|
81
86
|
| `MINICODE_JUSTIFY` | `1` → aktifkan rata kanan-kiri (justify) keluaran teks model. Default: mati (opt-in) — justify menyuntik spasi yang mengubah teks asli saat di-copy/–pipe |
|
|
82
87
|
| `MINICODE_DROPDOWN` | `0` → matikan floating dropdown, pakai hint inline (konsol legacy) |
|
|
@@ -88,6 +93,7 @@ Variabel yang paling menentukan perilaku (sisanya referensi di bawah):
|
|
|
88
93
|
| `MINICODE_SHOW_THINKING` | reasoning model terlihat SECARA DEFAULT; `0` → minimized (hanya penanda), `1` → paksa terlihat |
|
|
89
94
|
| `MINICODE_MINIMIZE_ACTIVITY` | ON secara default di TUI; `0` → transparan (baris per-tool). Lipat aktivitas tool per turn jadi satu ringkasan (detail via `/expand`) |
|
|
90
95
|
| `MINICODE_ACTIVITY_PANEL` | `0` → matikan panel aktivitas (default AKTIF di TUI; `/fold` toggle); `1` → paksa aktif juga di jalur linear/one-shot |
|
|
96
|
+
| `MINICODE_AUTORESUME_BG` | `0` → nonaktifkan auto-resume turn TUI saat job background selesai (default aktif; sekali per job, hanya bila tidak ada turn berjalan) |
|
|
91
97
|
| `MINICORE_THINKING` | `off` → kirim `enable_thinking:false` ke OpenAI-compat (DeepSeek). Alias lama `MINICODE_THINKING` masih dihormati |
|
|
92
98
|
| `NO_COLOR` | Set apa pun selain `0` → matikan seluruh warna |
|
|
93
99
|
|
package/docs/getting-started.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
# Instalasi
|
|
1
|
+
# Instalasi & Quickstart
|
|
2
|
+
|
|
3
|
+
Dari nol sampai prompt pertama yang ter-verify: pasang, setup provider, jalankan, verifikasi.
|
|
2
4
|
|
|
3
5
|
Prasyarat tunggal: **`bun >= 1.1.13`** — runtime Minicode, bukan Node.js. `npm` hanya dipakai untuk distribusi, bukan untuk menjalankan. (Lantai versi: kode memakai `AbortSignal.any()` yang absen di Bun 1.0.x; `minicode` gagal cepat dengan pesan jelas bila versi lebih lama.)
|
|
4
6
|
|
|
@@ -50,6 +52,61 @@ bun test # offline/hermetic; live & docker di-skip otomatis
|
|
|
50
52
|
|
|
51
53
|
Setup wizard berjalan otomatis saat `minicode` pertama kali bila belum ada provider.
|
|
52
54
|
|
|
55
|
+
## Prompt pertama
|
|
56
|
+
|
|
57
|
+
Tujuan: dari nol sampai prompt pertama yang ter-verify, tanpa membaca seluruh manual.
|
|
58
|
+
|
|
59
|
+
## 1. Jalan pertama (1 menit)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
minicode
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Bila belum ada provider, wizard setup muncul. Isi berurutan: pilih gateway → tempel API key (ter-masking) → auto-detect models. Wizard memakai picker (panah + filter), bukan `readline` nomor — mengetik di luar rentang tidak lagi diam-diam memilih `[0]`.
|
|
66
|
+
|
|
67
|
+
Alternatif tanpa API key:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
minicode auth login # device-code: kode singkat + URL, setujui di browser
|
|
71
|
+
minicode auth status # lihat kredensial + kapan kedaluwarsa
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 2. Prompt pertama (2 menit)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
minicode --work-mode BUILD "buat http server hello world di server.ts" --verbose
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Yang terjadi: model menerima system prompt berisi `# Environment` (cwd + platform) + repo-map ringkas, lalu loop ReAct `Thought → Action → Observation` sampai jawaban final atau batas (`--max-steps` default 50, `--timeout` default 1 jam).
|
|
81
|
+
|
|
82
|
+
Coba mode interaktif:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
minicode --interactive
|
|
86
|
+
# minicode › jelaskan isi src/tools/index.ts
|
|
87
|
+
# /model → picker provider::model, Enter = pilih + atur effort
|
|
88
|
+
# /status → token + biaya kumulatif sesi
|
|
89
|
+
# /exit → keluar (Esc ganda saat abort juga bisa)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 3. Verify otomatis (2 menit)
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
minicode --work-mode BUILD --verify "fix bugs lalu typecheck"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Sebelum agen jalan, baseline diuji dulu. Bila baseline sudah merah, catatan Health-Check ditempel ke prompt awal agar agen memperbaiki dulu. Setelah run, verify dijalankan; bila gagal, agen self-heal maks 3 siklus. Output error dibungkus fence agar tidak jadi prompt injection. Custom command via `MINICODE_VERIFY_CMD` atau `verifyCommand` di config.
|
|
99
|
+
|
|
100
|
+
## Contoh pola harian
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
minicode --ask "deploy script" # human-in-loop confirmation card
|
|
104
|
+
minicode --sandbox docker "task" # bash di container ephemeral
|
|
105
|
+
minicode --budget 0.50 "task besar" # warn 80%; pagu lewat → prompt baru ditolak + turn berjalan digugurkan
|
|
106
|
+
minicode exec "prompt" --json # headless CI: JSONL stream + summary
|
|
107
|
+
minicode "/review src/a.ts" # skill slash-command
|
|
108
|
+
```
|
|
109
|
+
|
|
53
110
|
## Matriks OS
|
|
54
111
|
|
|
55
112
|
| OS | Sandbox otomatis | Default permission | Catatan |
|
|
@@ -100,5 +157,4 @@ Uninstall = `npm uninstall -g minicode-ai` (atau hapus clone + `bun unlink` bila
|
|
|
100
157
|
|
|
101
158
|
## Berikutnya
|
|
102
159
|
|
|
103
|
-
- [Quickstart 5 menit](quickstart.md) — wizard → prompt pertama → verify.
|
|
104
160
|
- [Troubleshooting](troubleshooting.md) — bila `doctor` merah atau sandbox tidak jalan.
|
package/docs/repl.md
CHANGED
|
@@ -36,7 +36,7 @@ locale OS > en. `/lang` tanpa argumen = tampilkan aktif. Semua string lewat kamu
|
|
|
36
36
|
|
|
37
37
|
Alias (jalan, tidak diiklankan di `/help`): `/models` → `/model`, `/providers` → `/provider`, `/usage` & `/cost` → `/status`, `/resume [id]` → `/sessions [id]`, `/compact`, `/thinking`, `/minimize`, `/quit`.
|
|
38
38
|
|
|
39
|
-
Perintah tersembunyi (sengaja tak tampil di `/help`/dropdown, per-sesi): `/unrestric` —
|
|
39
|
+
Perintah tersembunyi (sengaja tak tampil di `/help`/dropdown, per-sesi): `/unrestric` — jembatan jail luar workspace + bash-guard + allowlist dibuka, kredensial git sempit diteruskan, tetapi file sensitif/state minicode tetap ditolak; gerbang = kepercayaan operator (toggle; footer menampilkan `○` merah). Detail di [Keamanan](security.md).
|
|
40
40
|
|
|
41
41
|
Did-you-mean: typo `/sessoons` → `Did you mean /sessions?` (jarak ≤ 2).
|
|
42
42
|
|
package/docs/security.md
CHANGED
|
@@ -2,11 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
## Prinsip
|
|
4
4
|
|
|
5
|
+
Minicode mengontrol **kemampuan bertingkat** (layered capability control), bukan niat model.
|
|
6
|
+
Model boleh salah paham; yang menentukan apa yang benar-benar terjadi adalah gerbang
|
|
7
|
+
deterministik di bawahnya: izin → jail → guard → validasi → eksekusi → bukti.
|
|
8
|
+
|
|
5
9
|
1. **Fail-closed di jalur tak pasti**: tool tanpa backend tersedia menolak (`code_run`), sandbox yang diminta tapi tidak tersedia ditolak (fail-closed; fallback host hanya via `MINICODE_SANDBOX_ALLOW_FALLBACK=1`), provider OAuth yang belum login dibuang dari daftar, auth non-TTY fail-fast.
|
|
6
10
|
2. **Ukur, bukan klaim**: bash-guard divalidasi korpus manual pola serangan + perintah sah — jalankan `bun run gate:bash` untuk angka terkini (exit 0 = 0 bypass / 0 over-block).
|
|
7
11
|
3. **Teks eksternal = tidak terpercaya**: output tool, MCP, web, bahkan output verify dibungkus fence; `sanitizeAnsi` menyaring escape ANSI dari teks model/tool sebelum render.
|
|
8
12
|
4. **Permission mengontrol pemanggilan, bukan capability**: di ASK, satu approval hanya mencakup pasangan server+tool+args (MCP); capability di balik server tak bisa diketahui statis.
|
|
9
13
|
|
|
14
|
+
## Execution Chain
|
|
15
|
+
|
|
16
|
+
Setiap pemanggilan tool melewati rantai ini, berurutan:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
Permission → Jail → Bash Guard → Argument Validation → Executor → Journal / Recovery
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
| Tahap | Fungsi |
|
|
23
|
+
|---|---|
|
|
24
|
+
| **Permission** | Mode izin (`src/policy/permission.ts`) memutuskan allow/deny/ask per pasangan tool+args. Berlaku SEBELUM efek apa pun. |
|
|
25
|
+
| **Jail** | Path di luar workspace, symlink keluar, file sensitif (`.env`, `.git/config`), dan state milik minicode (`.minicode/*.db`, todos, jurnal, config) ditolak — **bahkan di `--allow-all`** (kecuali mode `unrestricted`, lihat §Mode dan akses di bawah). |
|
|
26
|
+
| **Bash Guard** | Perintah shell dinormalisasi dulu (buang quote/wrapper/variabel sederhana), baru diperiksa polanya. Menolak env-dump, exfiltrasi upload, interpreter inline, destruksi luas. |
|
|
27
|
+
| **Argument Validation** | Skema argumen divalidasi kernel sebelum eksekusi; argumen invalid ditolak tanpa efek. |
|
|
28
|
+
| **Executor** | Menjalankan yang lolos: read paralel, write dibatasi konkurensinya, abort-aware, output dipotong dengan penanda (tak pernah diam-diam). |
|
|
29
|
+
| **Journal / Recovery** | Tiap mutasi dicatat sebagai `pending` lalu `committed`/`failed`/`unknown`; finalisasi menandai cakupan turn durable. Resume tak pernah mengulang buta (lihat [Recovery](#recovery)). |
|
|
30
|
+
|
|
10
31
|
## Mode dan akses
|
|
11
32
|
|
|
12
33
|
Kontrol mode punya tiga sumbu: **WorkMode** (`DISCUSS`/`PLAN`/`BUILD`) membatasi cara kerja agent; **PermissionMode** (`AUTO`/`ASK`) menentukan kapan dibutuhkan persetujuan manusia; **Tool Access Policy** menentukan capability yang tersedia. Nilai internal `readonly`, `plan`, `allowlist`, dan `allow-all` masih ada untuk batas akses dan kompatibilitas, tetapi bukan empat mode pengawasan tambahan. Hard deny path jail, owned-state, dan bash-guard tetap berlaku. Detail kombinasi dan interface ada di [Memilih Mode](choosing-mode.md) dan [Policy & Sandbox](policy-sandbox.md).
|
|
@@ -77,9 +98,35 @@ provider model pihak ketiga.
|
|
|
77
98
|
|
|
78
99
|
Setiap turn checkpoint shadow-git + recovery journal `.minicode/journal-<sesi>.jsonl` (`pending` → `committed`/`failed`/`unknown`; finalisasi menandai cakupan turn durable). Saat resume: `committed` yang turn-nya hilang tidak diulang; `pending`/`failed`/`unknown` → direktif verifikasi, dilarang redo buta; `committed` MCP = external-acknowledged wajib baca-balik. Detail di [Memory & Sessions](memory-sessions.md).
|
|
79
100
|
|
|
101
|
+
## Dangerous Capabilities
|
|
102
|
+
|
|
103
|
+
Minicode **tidak menyediakan tool** untuk (terverifikasi di `src/tools/`):
|
|
104
|
+
|
|
105
|
+
- `git fetch`, `pull`, `clone` — tak ada tool git jaringan pembaca
|
|
106
|
+
- `git reset`, `amend`, `rebase`, `checkout`, `branch -D`, `stash drop`
|
|
107
|
+
- Eksekusi remote / deploy bawaan
|
|
108
|
+
|
|
109
|
+
Satu-satunya operasi jaringan git adalah `git_push` (di-gate seperti `git_commit`: TTY minta sekali, non-TTY tolak, `readonly/plan/allowlist` tolak, sub-agent tidak mendapatkannya). Tool ini memakai hardening `GIT_SAFE_BASE` dan di mode `unrestricted` mendapat kredensial git sempit (lihat §Mode dan akses).
|
|
110
|
+
|
|
111
|
+
Catatan jujur: operasi lain tetap BISA diketik lewat `bash` (tunduk pada bash-guard + jail, BUKAN larangan). `git` via bash menjalankan konfigurasi repo apa adanya (hook/filter/driver milik repo). Tool baca `git_*` dinetralkan; `git_push` menetralkan hook/filter via `GIT_SAFE_BASE`; `git_commit` menolak sebelum staging bila filter Git terkonfigurasi. Di repo tak-terpercaya, utamakan tool baca dan tinjau konfigurasi sebelum memakai Git manual.
|
|
112
|
+
|
|
113
|
+
## Limitations
|
|
114
|
+
|
|
115
|
+
- **Repo hooks/filter/driver:** `git` via bash mengeksekusinya (semantik stock-git); tool baca `git_*` menetralkan filter, sedangkan `git_commit` menolak bila menemukan filter terkonfigurasi.
|
|
116
|
+
- **Bash arbitrer:** guard adalah analisis statis; substitusi dinamis (`$(curl …)`) butuh sandbox OS/docker untuk isolasi nyata.
|
|
117
|
+
- **Efek eksternal MCP:** setelah terjadi, tak bisa dibatalkan dari sini.
|
|
118
|
+
- **Provider/network:** data melewati provider pilihan Anda; Minicode tak menambahkan transmisi sendiri.
|
|
119
|
+
- **Perilaku model:** pemilihan tool, klaim sukses, dan kepatuhan intent adalah sifat model — orkestrasi menjamin bukti dan batas, bukan kebijaksanaan.
|
|
120
|
+
- **Server LSP:** di-spawn dari perintah di config Anda; hanya daftarkan server yang Anda percaya.
|
|
121
|
+
- **Repo tak-terpercaya:** perlakukan seperti menjalankan `git`/`bash` manual di sana — karena memang itu yang terjadi di balik tool.
|
|
122
|
+
|
|
123
|
+
## Security Contact
|
|
124
|
+
|
|
125
|
+
Belum ada kontak keamanan privat. Laporkan masalah via [GitHub Issues](https://github.com/minilabs-id/minicode/issues) **tanpa menyertakan kredensial, token, atau data sensitif** — cukup langkah reproduksi minimal + output `minicode doctor`.
|
|
126
|
+
|
|
80
127
|
## Lanjut
|
|
81
128
|
|
|
82
|
-
- [
|
|
129
|
+
- [Keamanan](security.md) — rantai eksekusi, trust boundary, dan limitasi dalam satu halaman.
|
|
83
130
|
- [Policy & Sandbox](policy-sandbox.md) — mode, tool access policy, dan detail guard.
|
|
84
|
-
- [Kontrak Terminal](
|
|
131
|
+
- [Kontrak Terminal](TERMINAL_CONTRACT.md) — kenapa warna di-gate TTY.
|
|
85
132
|
- [Otomasi & CI](exec.md) — batasan agent di CI (fail-closed non-TTY).
|
package/docs/tools.md
CHANGED
|
@@ -66,7 +66,8 @@ Batas `BASH_BACKGROUND_MAX_JOBS`; semua job mati saat CLI keluar.
|
|
|
66
66
|
| `git_status` | `status --porcelain + diff --stat + log -10` | cwd jail |
|
|
67
67
|
| `git_diff` | `diff` unstaged atau `--staged` | — |
|
|
68
68
|
| `git_log` | `log --oneline -n` | — |
|
|
69
|
-
| `git_commit` | Commit saja | **Di-gate** seperti `delegate_task` (TTY = minta sekali, non-TTY = tolak; `readonly/plan/allowlist` = tolak). Menolak sebelum staging jika config Git efektif memuat custom filter; tinjau filter terpercaya lalu lakukan commit manual. Sub-agent tidak mendapatkannya. Yang sengaja tidak ada:
|
|
69
|
+
| `git_commit` | Commit saja | **Di-gate** seperti `delegate_task` (TTY = minta sekali, non-TTY = tolak; `readonly/plan/allowlist` = tolak). Menolak sebelum staging jika config Git efektif memuat custom filter; tinjau filter terpercaya lalu lakukan commit manual. Sub-agent tidak mendapatkannya. Yang sengaja tidak ada: amend/reset/rebase/checkout/branch -D/stash drop. Pesan via `-m` tunggal agar `$()`/backtick tidak dieksekusi; `git add -- <paths>` agar file `-weird.txt` tidak jadi flag |
|
|
70
|
+
| `git_push` | Push branch lokal ke remote | **Di-gate** seperti `git_commit`; butuh branch/remote eksplisit atau `setUpstream`. Hardening `GIT_SAFE_BASE` menetralkan hook pre-push + filter repo. Di mode `unrestricted`, kredensial git sempit (`GH_TOKEN`/`GITHUB_TOKEN`/`SSH_AUTH_SOCK`) diteruskan ke subprocess; di mode lain push hanya berhasil bila kredensial sudah tersedia di mesin (mis. credential helper OS). Sub-agent tidak mendapatkannya |
|
|
70
71
|
|
|
71
72
|
## Web
|
|
72
73
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minicode-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Open-source terminal coding agent on a vendored zero-dependency MiniCore kernel — layered permissions, path jail, sandboxing, MCP/LSP, and durable shadow-git checkpoints",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -51,41 +51,7 @@
|
|
|
51
51
|
"scripts/vendor-overlays/minicode-context.patch",
|
|
52
52
|
"README.md",
|
|
53
53
|
"LICENSE",
|
|
54
|
-
"docs
|
|
55
|
-
"docs/OUTPUT_PROTOCOL_SPEC.md",
|
|
56
|
-
"docs/OUTPUT_RENDERING_SPEC.md",
|
|
57
|
-
"docs/OUTPUT_UX_RULES.md",
|
|
58
|
-
"docs/P14_OPEN_WORK.md",
|
|
59
|
-
"docs/SUMMARY.md",
|
|
60
|
-
"docs/TERMINAL_CONTRACT.md",
|
|
61
|
-
"docs/UI_RENDER_PIPELINE.md",
|
|
62
|
-
"docs/agents.md",
|
|
63
|
-
"docs/architecture.md",
|
|
64
|
-
"docs/autonomous-scheduler.md",
|
|
65
|
-
"docs/choosing-mode.md",
|
|
66
|
-
"docs/cli.md",
|
|
67
|
-
"docs/concepts.md",
|
|
68
|
-
"docs/CONTROL-PLANE-MAP.md",
|
|
69
|
-
"docs/config-providers.md",
|
|
70
|
-
"docs/config.md",
|
|
71
|
-
"docs/contributing.md",
|
|
72
|
-
"docs/environment.md",
|
|
73
|
-
"docs/exec.md",
|
|
74
|
-
"docs/getting-started.md",
|
|
75
|
-
"docs/glossary.md",
|
|
76
|
-
"docs/mcp-lsp.md",
|
|
77
|
-
"docs/memory-sessions.md",
|
|
78
|
-
"docs/policy-sandbox.md",
|
|
79
|
-
"docs/pricing-budget.md",
|
|
80
|
-
"docs/quickstart.md",
|
|
81
|
-
"docs/repl.md",
|
|
82
|
-
"docs/security-model.md",
|
|
83
|
-
"docs/security.md",
|
|
84
|
-
"docs/skills.md",
|
|
85
|
-
"docs/terminal.md",
|
|
86
|
-
"docs/tools.md",
|
|
87
|
-
"docs/troubleshooting.md",
|
|
88
|
-
"docs/verify-benchmark.md"
|
|
54
|
+
"docs"
|
|
89
55
|
],
|
|
90
56
|
"scripts": {
|
|
91
57
|
"test": "bun test",
|
|
@@ -15,7 +15,7 @@ let currentConfig: MinicodeConfig | null = null
|
|
|
15
15
|
* manusia ke stderr, `exec --json` menambah envelope mesin ke stdout.
|
|
16
16
|
* Pesan = teks yang dulu dicetak langsung sebelum exit(1) — byte-identik. */
|
|
17
17
|
export class NoProviderError extends Error {
|
|
18
|
-
readonly name = "NoProviderError"
|
|
18
|
+
override readonly name = "NoProviderError"
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const NO_PROVIDER_MESSAGE =
|