minicode-ai 0.9.28 → 0.10.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/cli/args.ts +1 -0
  3. package/cli/commands.ts +219 -103
  4. package/cli/index.ts +8 -6
  5. package/cli/model-manager.ts +2 -7
  6. package/cli/provider-manager.ts +13 -13
  7. package/cli/setup.ts +10 -1
  8. package/cli/tui.ts +506 -0
  9. package/cli/wizard.ts +2 -1
  10. package/docs/ARCHITECTURE.html +41 -22
  11. package/docs/README.md +1 -0
  12. package/package.json +3 -3
  13. package/src/app/rag-layer.ts +7 -2
  14. package/src/config.ts +30 -1
  15. package/src/policy/bash-guard.ts +64 -8
  16. package/src/policy/update-check.ts +4 -1
  17. package/src/tools/bash.ts +8 -0
  18. package/src/tools/task.ts +6 -1
  19. package/src/tools/web_fetch.ts +11 -2
  20. package/src/tools/web_search.ts +4 -1
  21. package/src/ui/approval/prompt.ts +84 -18
  22. package/src/ui/assistant/simple.ts +55 -22
  23. package/src/ui/assistant/turn-status.ts +16 -7
  24. package/src/ui/footer.ts +14 -12
  25. package/src/ui/i18n/en.ts +225 -0
  26. package/src/ui/i18n/id.ts +227 -0
  27. package/src/ui/i18n/locale.ts +66 -0
  28. package/src/ui/input/input.ts +138 -77
  29. package/src/ui/input/prompt-engine.ts +97 -4
  30. package/src/ui/render/collapse.ts +8 -1
  31. package/src/ui/render/errors.ts +75 -50
  32. package/src/ui/render/format.ts +15 -5
  33. package/src/ui/render/highlight.ts +5 -2
  34. package/src/ui/render/table.ts +7 -4
  35. package/src/ui/render/theme.ts +8 -3
  36. package/src/ui/render/width.ts +17 -9
  37. package/src/ui/runtime/screen.ts +197 -0
  38. package/src/ui/screens/dialog.ts +174 -0
  39. package/src/ui/screens/form.ts +459 -0
  40. package/src/ui/screens/model-manager.ts +274 -127
  41. package/src/ui/screens/picker.ts +229 -98
  42. package/src/ui/screens/provider-manager.ts +371 -164
  43. package/src/ui/screens/wizard.ts +149 -102
  44. package/src/ui/tui/app.ts +745 -0
  45. package/src/ui/tui/transcript.ts +271 -0
  46. package/cli/repl.ts +0 -740
  47. package/src/ui/runtime/chrome.ts +0 -369
  48. package/src/ui/screens/overlay.ts +0 -61
@@ -0,0 +1,225 @@
1
+ // Kamus Inggris (default). Kunci = MsgKey (lihat locale.ts); id.ts WAJIB
2
+ // memuat kunci yang sama persis — tsc yang mengawal (Record<MsgKey, string>).
3
+ // Nilai memakai interpolasi `{nama}` sederhana (lihat t()).
4
+ export const en = {
5
+ "app.placeholder": "ask anything, / for commands… (Ctrl+D exits)",
6
+ "app.menuHeader": "─ commands ─",
7
+ "app.moreLines": " … {n} more",
8
+ "app.newBelow": "↓ {n} new lines below · PgDn to bottom",
9
+ "appr.title": "Approval required",
10
+ "appr.tool": "Tool:",
11
+ "appr.allowOnce": "[y] Allow once",
12
+ "appr.always": "[a] Always",
13
+ "appr.deny": "[n] Deny",
14
+ "appr.decAllow": "allow",
15
+ "appr.decAlways": "always",
16
+ "appr.decDeny": "deny",
17
+ "appr.askTitle": "Agent asks",
18
+ "appr.a11y": "[approval required: {name}]",
19
+ "appr.answerPrompt": "Your answer (empty = cancel): ",
20
+ "dlg.more": "… {n} more",
21
+ "ts.compacted": "… compacted: {reason}",
22
+ "ts.thinking": "… thinking",
23
+ "form.footerDefault": "Tab move · Enter save · Esc cancel",
24
+ "form.required": "required",
25
+ "form.invalidUrl": "invalid URL",
26
+ "form.httpOnly": "must be http(s)",
27
+ "form.yes": "Yes",
28
+ "form.no": "No",
29
+ "verb.select": "select",
30
+ "verb.add": "add",
31
+ "verb.delete": "delete",
32
+ "verb.edit": "edit",
33
+ "verb.close": "close",
34
+ "pick.filter": "Filter:",
35
+ "pick.placeholder": "type to filter",
36
+ "pick.noMatch": 'No matches for "{q}"',
37
+ "pick.matches": "{n}/{total} matches",
38
+ "pick.hint": "type to filter · ↑↓ select · Enter confirm · Esc back",
39
+ "pick.fail": "picker failed: {msg}",
40
+ "pick.failOpen": "picker failed to open: {msg}",
41
+ "model.empty": "No models configured",
42
+ "model.noMatch": "No models match",
43
+ "model.title": "Models",
44
+ "model.typeFilter": "type to filter",
45
+ "model.deleteTitle": "Delete model",
46
+ "model.deleteFooter": "←/→/y/n select · Enter delete · Esc cancel",
47
+ "model.delActive": 'Delete ACTIVE model "{id}"?',
48
+ "model.del": 'Delete model "{id}"?',
49
+ "model.failOpen": "model manager failed to open: {msg}",
50
+ "effort.title": "Thinking effort",
51
+ "effort.saved": "Thinking: {effort} (next session)",
52
+ "prov.title": "Providers",
53
+ "prov.empty": "No providers",
54
+ "prov.hint": "Enter:{select} a:{add} d:{delete} e:{edit} Esc:{close}",
55
+ "prov.addTitle": "Add provider",
56
+ "prov.customUrl": "Custom URL",
57
+ "prov.editTitle": 'Edit "{id}"',
58
+ "prov.deleteTitle": "Delete provider",
59
+ "prov.urlLabel": "Base URL",
60
+ "prov.keyLabel": "API key",
61
+ "prov.keyKeepLabel": "API key (empty = keep)",
62
+ "prov.scopeLabel": "Scope",
63
+ "prov.overwriteLabel": 'Overwrite "{id}"?',
64
+ "prov.deleteLabel": '"{id}" ({n} models)',
65
+ "prov.deleteActive": " — active ({model})",
66
+ "prov.deleteAsk": " — delete?",
67
+ "prov.deleteFooter": "←/→/y/n select · Enter delete · Esc cancel",
68
+ "prov.failOpen": "provider manager failed to open: {msg}",
69
+ "prov.models": "{n} models",
70
+ "prov.reloadFail": "provider reload failed — restart to apply changes",
71
+ "prov.detectFail": "Model detection failed: {msg}",
72
+ "prov.updateFail": "Update failed: {msg}",
73
+ "prov.deleted": 'Provider "{id}" deleted.',
74
+ "sess.title": "Sessions",
75
+ "sess.listHead": "Sessions",
76
+ "sess.listHint": " Select a session to resume.",
77
+ "sess.notFound": 'Session "{id}" not found or empty.',
78
+ "wiz.gateway": "Minicode setup — Select gateway",
79
+ "wiz.title": "Minicode setup",
80
+ "wiz.urlLabel": "Base URL",
81
+ "wiz.keyLabel": "API key for {url}",
82
+ "wiz.detecting": "Detecting models…",
83
+ "wiz.done": "Setup complete.",
84
+ "wiz.detectFail": "Model detection failed: {msg}",
85
+ "wiz.canceled": "Setup canceled.",
86
+ "wiz.keyLater": "Setup canceled. Set OPENAI_API_KEY later to continue.",
87
+ "ntc.deleted": "deleted {id}",
88
+ "ntc.saved": '"{id}" saved ({n} models, {scope}).',
89
+ "ntc.updated": '"{id}" updated ({n} models)',
90
+ "ntc.noChange": "No changes.",
91
+ "ntc.notFound": "Provider not found",
92
+ "ntc.detecting": "Detecting models…",
93
+ "ntc.timeout": "timed out — no response, UI recovered; retry or Esc",
94
+ "gate.tuiPicker": '"{title}" needs an interactive terminal — canceled.',
95
+ "gate.tuiModel": "model manager needs an interactive terminal — canceled.",
96
+ "gate.tuiProvider": "provider manager needs an interactive terminal — canceled.",
97
+ "st.session": "Session {id}",
98
+ "st.model": " Model: {v}",
99
+ "st.provider": " Provider: {v}",
100
+ "st.tools": " Tools: {v}",
101
+ "st.context": " Context: ~{v} tok (window estimate)",
102
+ "st.input": " Input: {v} (provider usage)",
103
+ "st.output": " Output: {v} (provider usage)",
104
+ "st.total": " Total: {v} (session cumulative)",
105
+ "st.cost": " Cost: {v} (estimated from price table)",
106
+ "st.budget": " Budget: {v}{extra}",
107
+ "st.costUnknown": " (cost unknown — model without pricing)",
108
+ "help.head": "Commands:",
109
+ "help.keysLine": "Enter · Tab/Shift+Tab mode · Ctrl+R search · PgUp/PgDn scroll · Ctrl+D exit",
110
+ "help.cHead": "Commands:",
111
+ "help.cKeys": "Keys: Tab mode · ↑↓ history · PgUp/PgDn scroll · Ctrl+R search · Ctrl+D exit",
112
+ "help.cMore": " /help keys = all shortcuts",
113
+ "help.kHead": "Keyboard:",
114
+ "help.k.submit": "submit",
115
+ "help.k.cycleMode": "cycle permission mode",
116
+ "help.k.history": "prompt history (in picker: navigate)",
117
+ "help.k.scroll": "scroll transcript",
118
+ "help.k.move": "move cursor",
119
+ "help.k.jump": "jump to line start / end",
120
+ "help.k.delChar": "delete character at cursor",
121
+ "help.k.lineEnds": "line start / end",
122
+ "help.k.histSearch": "history prefix search",
123
+ "help.k.newline": "insert newline (multiline input)",
124
+ "help.k.delWord": "delete previous word",
125
+ "help.k.clearLine": "clear line",
126
+ "help.k.compact": "toggle compact/expanded tool output",
127
+ "help.k.thinking": "toggle expand/minimize thinking output",
128
+ "help.k.esc": "close dropdown / picker / clear line (busy: abort turn)",
129
+ "help.k.ctrlC": "clear line (busy: abort turn)",
130
+ "help.k.ctrlD": "exit on empty line",
131
+ "help.desc.help": "Show commands",
132
+ "help.desc.provider": "Manage providers",
133
+ "help.desc.model": "Manage and select models",
134
+ "help.desc.sync": "Refresh provider models",
135
+ "help.desc.status": "Show session status and usage",
136
+ "help.desc.sessions": "List, inspect, and resume sessions",
137
+ "help.desc.init": "Create AGENTS.md",
138
+ "help.desc.exit": "Exit",
139
+ "help.desc.mode": "Show or set permission mode",
140
+ "help.desc.lang": "Show or set UI language",
141
+ "help.desc.undo": "Revert file changes from the last turn",
142
+ "help.desc.redo": "Re-apply reverted changes",
143
+ "help.desc.clear": "Clear transcript",
144
+ "help.desc.copy": "Copy last turn to clipboard (OSC 52)",
145
+ "help.desc.history": "Show recent prompt history",
146
+ "tui.budgetOver":
147
+ "[budget] {spent} > {budget} — over budget, new prompts rejected. /exit to quit.",
148
+ "tui.budgetUnknown":
149
+ "[budget] cost unknown (model without pricing) with {tokens} tokens spent — over budget, new prompts rejected. /exit to quit.",
150
+ "tui.stopped": "(stopped)",
151
+ "tui.budget80": "[budget] {spent} / {budget} (80% used)",
152
+ "tui.copyNone": "(nothing to copy yet — run a prompt first)",
153
+ "tui.copyOk": "copied {n} chars (OSC 52 — allow clipboard access in terminal if empty)",
154
+ "tui.copyNeedTty": "(clipboard needs a TTY terminal)",
155
+ "tui.unknownMode": "unknown mode: {a} — choices: {modes}",
156
+ "tui.modeLine": "mode: {m}",
157
+ "tui.langLine": "lang: {v}",
158
+ "tui.toolCall": "tool call: {v}",
159
+ "tui.modelSet": "model: {v}",
160
+ "tui.thinkingSet": "thinking: {v}",
161
+ "tui.sectionsMin": "sections: minimized",
162
+ "tui.sectionsExp": "sections: expanded",
163
+ "tui.minUse": "usage: /minimize [on|off]",
164
+ "tui.unknownCmd": "Unknown command: /{name}.{tail}",
165
+ "tui.didYou": " Did you mean /{hint}?",
166
+ "tui.tryHelp": " Try /help.",
167
+ "tui.expandEmpty": "(nothing to expand — all sections were visible)",
168
+ "tui.historyEmpty": "(empty history)",
169
+ "tui.langUnknown": "unknown lang: {a} — choices: en, id",
170
+ "tui.noTty": "Terminal does not support fullscreen TUI — interactive needs a TTY with ≥10 rows.",
171
+ "tui.tooSmall": "Terminal too small — enlarge to ≥10 rows / ≥20 cols (Ctrl+D exits).",
172
+ "cmd.bye": "Bye.",
173
+ "tui.noModel": "no model",
174
+ "cmd.syncing": "Syncing models…",
175
+ "cmd.noProviders": " No providers configured.",
176
+ "cmd.noChanges": " No changes — check API key and network, then retry.",
177
+ "cmd.restart": " Restart to use updated models.",
178
+ "cmd.nothingUpdated": " Nothing updated — check API keys and network above, then retry /sync.",
179
+ "cmd.initExists": "AGENTS.md already exists - not overwritten.",
180
+ "cmd.initCreated": "AGENTS.md created: {t}",
181
+ "cmd.noSessions": "No sessions.",
182
+ "ask.search": "(reverse-i-search)`{q}': ",
183
+ "ask.searchFail": "(failed reverse-i-search)`{q}': ",
184
+ "ask.more": "… {n} more",
185
+ "one.turnHead": "\n── Turn {n} ──\n",
186
+ "one.done": "\n done\n",
187
+ "one.answerOpen": " − answer\n",
188
+ "one.answerMin": " + answer ({n} chars{cap}) — /expand to read\n",
189
+ "one.answerCap": ", capped 1MB",
190
+ "one.thinkOpen": " − thinking\n",
191
+ "one.thinkMin": " + thinking\n",
192
+ "one.more3": "\n ... ({n} more)",
193
+ "one.moreLines": "\n … ({n} more lines)",
194
+ "one.contentBlocked": "\n! Content filter blocked\n",
195
+ "one.step": " Step {i}: {calls}\n",
196
+ "hl.moreLines": " ... ({n} more lines)",
197
+ "common.canceled": "Canceled",
198
+ "err.rateLimit": "Provider is rate-limiting requests",
199
+ "err.rateLimitFix": "Wait a moment and try again, or use --ratelimit to throttle requests.",
200
+ "err.balance": "API key balance or quota is exhausted",
201
+ "err.balanceFix": "Switch provider via /model, or top up credits.",
202
+ "err.auth": "Provider rejected authentication",
203
+ "err.authFix": "Check your API key, or switch provider via /model.",
204
+ "err.server": "Provider is temporarily unavailable",
205
+ "err.serverFix": "Wait a moment and try again, or switch provider via /model.",
206
+ "err.network": "Failed to reach provider",
207
+ "err.networkFix": "Check your connection and try again.",
208
+ "err.invalid": "Request was rejected by provider",
209
+ "err.invalidFix": "Check the model name or select another model with /model.",
210
+ "err.context": "Context window exceeded",
211
+ "err.contextFix":
212
+ "Start a new session (/exit then minicode), or use a model with a larger context window.",
213
+ "err.filter": "Request was blocked by provider content filter",
214
+ "err.filterFix": "Rewrite the prompt, or switch provider via /model.",
215
+ "err.timeout": "Run exceeded timeout",
216
+ "err.timeoutFix": "Increase --timeout or use a faster model.",
217
+ "err.steps": "Tool step limit reached",
218
+ "err.stepsFix": "Split the task into smaller prompts.",
219
+ "err.budget": "Session budget exceeded",
220
+ "err.budgetFix": "Start a new session or increase --budget.",
221
+ "err.busy": "A run is still in progress",
222
+ "err.busyFix": "Wait for the current run to finish.",
223
+ "err.aborted": "Run was aborted",
224
+ "common.active": "active",
225
+ } as const
@@ -0,0 +1,227 @@
1
+ // Kamus Indonesia. WAJIB kunci = en (Record<MsgKey, string> mengawal di
2
+ // tsc — kunci hilang = compile error, bukan diam).
3
+ import type { MsgKey } from "./locale.ts"
4
+
5
+ export const id: Record<MsgKey, string> = {
6
+ "app.placeholder": "tanya sesuatu, / untuk perintah… (Ctrl+D keluar)",
7
+ "app.menuHeader": "─ perintah ─",
8
+ "app.moreLines": " … {n} lagi",
9
+ "app.newBelow": "↓ {n} baris baru di bawah · PgDn ke ekor",
10
+ "appr.title": "Perlu persetujuan",
11
+ "appr.tool": "Alat:",
12
+ "appr.allowOnce": "[y] Izinkan sekali",
13
+ "appr.always": "[a] Selalu",
14
+ "appr.deny": "[n] Tolak",
15
+ "appr.decAllow": "izinkan",
16
+ "appr.decAlways": "selalu",
17
+ "appr.decDeny": "tolak",
18
+ "appr.askTitle": "Agen bertanya",
19
+ "appr.a11y": "[butuh persetujuan: {name}]",
20
+ "appr.answerPrompt": "Jawaban (kosong = batal): ",
21
+ "dlg.more": "… {n} lagi",
22
+ "ts.compacted": "… dipadatkan: {reason}",
23
+ "ts.thinking": "… berpikir",
24
+ "form.footerDefault": "Tab pindah · Enter simpan · Esc batal",
25
+ "form.required": "wajib diisi",
26
+ "form.invalidUrl": "URL tidak valid",
27
+ "form.httpOnly": "harus http(s)",
28
+ "form.yes": "Ya",
29
+ "form.no": "Tidak",
30
+ "verb.select": "pilih",
31
+ "verb.add": "tambah",
32
+ "verb.delete": "hapus",
33
+ "verb.edit": "ubah",
34
+ "verb.close": "tutup",
35
+ "pick.filter": "Filter:",
36
+ "pick.placeholder": "ketik untuk saring",
37
+ "pick.noMatch": 'Tidak cocok untuk "{q}"',
38
+ "pick.matches": "{n}/{total} cocok",
39
+ "pick.hint": "ketik untuk saring · ↑↓ pilih · Enter konfirmasi · Esc kembali",
40
+ "pick.fail": "picker gagal: {msg}",
41
+ "pick.failOpen": "picker gagal dibuka: {msg}",
42
+ "model.empty": "Belum ada model",
43
+ "model.noMatch": "Tidak ada model yang cocok",
44
+ "model.title": "Model",
45
+ "model.typeFilter": "ketik untuk saring",
46
+ "model.deleteTitle": "Hapus model",
47
+ "model.deleteFooter": "←/→/y/n pilih · Enter hapus · Esc batal",
48
+ "model.delActive": 'Hapus model AKTIF "{id}"?',
49
+ "model.del": 'Hapus model "{id}"?',
50
+ "model.failOpen": "model manager gagal dibuka: {msg}",
51
+ "effort.title": "Upaya berpikir",
52
+ "effort.saved": "Thinking: {effort} (sesi berikut)",
53
+ "prov.title": "Penyedia",
54
+ "prov.empty": "Belum ada penyedia",
55
+ "prov.hint": "Enter:{select} a:{add} d:{delete} e:{edit} Esc:{close}",
56
+ "prov.addTitle": "Tambah penyedia",
57
+ "prov.customUrl": "URL kustom",
58
+ "prov.editTitle": 'Ubah "{id}"',
59
+ "prov.deleteTitle": "Hapus penyedia",
60
+ "prov.urlLabel": "URL dasar",
61
+ "prov.keyLabel": "Kunci API",
62
+ "prov.keyKeepLabel": "Kunci API (kosong = tetap)",
63
+ "prov.scopeLabel": "Cakupan",
64
+ "prov.overwriteLabel": 'Timpa "{id}"?',
65
+ "prov.deleteLabel": '"{id}" ({n} model)',
66
+ "prov.deleteActive": " — aktif ({model})",
67
+ "prov.deleteAsk": " — hapus?",
68
+ "prov.deleteFooter": "←/→/y/n pilih · Enter hapus · Esc batal",
69
+ "prov.failOpen": "provider manager gagal dibuka: {msg}",
70
+ "prov.models": "{n} model",
71
+ "prov.reloadFail": "reload provider gagal — restart untuk menerapkan",
72
+ "prov.detectFail": "Deteksi model gagal: {msg}",
73
+ "prov.updateFail": "Pembaruan gagal: {msg}",
74
+ "prov.deleted": 'Penyedia "{id}" dihapus.',
75
+ "sess.title": "Sesi",
76
+ "sess.listHead": "Sesi",
77
+ "sess.listHint": " Pilih sesi untuk dilanjutkan.",
78
+ "sess.notFound": 'Sesi "{id}" tidak ditemukan atau kosong.',
79
+ "wiz.gateway": "Penyiapan Minicode — Pilih gateway",
80
+ "wiz.title": "Penyiapan Minicode",
81
+ "wiz.urlLabel": "URL dasar",
82
+ "wiz.keyLabel": "Kunci API untuk {url}",
83
+ "wiz.detecting": "Mendeteksi model…",
84
+ "wiz.done": "Penyiapan selesai.",
85
+ "wiz.detectFail": "Deteksi model gagal: {msg}",
86
+ "wiz.canceled": "Penyiapan dibatalkan.",
87
+ "wiz.keyLater": "Penyiapan dibatalkan. Set OPENAI_API_KEY lain waktu untuk lanjut.",
88
+ "ntc.deleted": "dihapus {id}",
89
+ "ntc.saved": '"{id}" tersimpan ({n} model, {scope}).',
90
+ "ntc.updated": '"{id}" diperbarui ({n} model)',
91
+ "ntc.noChange": "Tidak ada perubahan.",
92
+ "ntc.notFound": "Penyedia tidak ditemukan",
93
+ "ntc.detecting": "Mendeteksi model…",
94
+ "ntc.timeout": "batas waktu — tak ada respons, UI pulih; ulangi atau Esc",
95
+ "gate.tuiPicker": '"{title}" butuh terminal interaktif — dibatalkan.',
96
+ "gate.tuiModel": "model manager butuh terminal interaktif — dibatalkan.",
97
+ "gate.tuiProvider": "provider manager butuh terminal interaktif — dibatalkan.",
98
+ "st.session": "Sesi {id}",
99
+ "st.model": " Model: {v}",
100
+ "st.provider": " Penyedia: {v}",
101
+ "st.tools": " Perkakas: {v}",
102
+ "st.context": " Konteks: ~{v} tok (estimasi jendela)",
103
+ "st.input": " Masukan: {v} (pemakaian provider)",
104
+ "st.output": " Keluaran: {v} (pemakaian provider)",
105
+ "st.total": " Total: {v} (kumulatif sesi)",
106
+ "st.cost": " Biaya: {v} (estimasi tabel harga)",
107
+ "st.budget": " Budget: {v}{extra}",
108
+ "st.costUnknown": " (biaya tak diketahui — model tanpa harga)",
109
+ "help.head": "Perintah:",
110
+ "help.keysLine": "Enter · Tab/Shift+Tab mode · Ctrl+R cari · PgUp/PgDn gulir · Ctrl+D keluar",
111
+ "help.cHead": "Perintah:",
112
+ "help.cKeys": "Tombol: Tab mode · ↑↓ riwayat · PgUp/PgDn gulir · Ctrl+R cari · Ctrl+D keluar",
113
+ "help.cMore": " /help tombol = semua pintasan",
114
+ "help.kHead": "Papan tombol:",
115
+ "help.k.submit": "kirim",
116
+ "help.k.cycleMode": "putar mode izin",
117
+ "help.k.history": "riwayat prompt (di picker: navigasi)",
118
+ "help.k.scroll": "gulir transkrip",
119
+ "help.k.move": "geser kursor",
120
+ "help.k.jump": "lompat ke awal/akhir baris",
121
+ "help.k.delChar": "hapus karakter di kursor",
122
+ "help.k.lineEnds": "awal/akhir baris",
123
+ "help.k.histSearch": "cari riwayat prompt",
124
+ "help.k.newline": "sisip baris baru (input multibaris)",
125
+ "help.k.delWord": "hapus kata sebelumnya",
126
+ "help.k.clearLine": "hapus baris",
127
+ "help.k.compact": "alihkan output tool ringkas/penuh",
128
+ "help.k.thinking": "alihkan thinking bentang/ringkas",
129
+ "help.k.esc": "tutup dropdown/picker/hapus baris (busy: batalkan turn)",
130
+ "help.k.ctrlC": "hapus baris (busy: batalkan turn)",
131
+ "help.k.ctrlD": "keluar saat baris kosong",
132
+ "help.desc.help": "Tampilkan perintah",
133
+ "help.desc.provider": "Kelola penyedia",
134
+ "help.desc.model": "Kelola dan pilih model",
135
+ "help.desc.sync": "Segarkan model penyedia",
136
+ "help.desc.status": "Tampilkan status dan pemakaian sesi",
137
+ "help.desc.sessions": "Daftar, periksa, dan lanjutkan sesi",
138
+ "help.desc.init": "Buat AGENTS.md",
139
+ "help.desc.exit": "Keluar",
140
+ "help.desc.mode": "Tampilkan atau set mode izin",
141
+ "help.desc.lang": "Tampilkan atau set bahasa UI",
142
+ "help.desc.undo": "Urungkan perubahan berkas dari turn terakhir",
143
+ "help.desc.redo": "Terapkan ulang yang diurungkan",
144
+ "help.desc.clear": "Bersihkan transkrip",
145
+ "help.desc.copy": "Salin turn terakhir ke clipboard (OSC 52)",
146
+ "help.desc.history": "Tampilkan riwayat prompt",
147
+ "tui.budgetOver":
148
+ "[budget] {spent} > {budget} — melebihi budget, prompt baru ditolak. /exit untuk keluar.",
149
+ "tui.budgetUnknown":
150
+ "[budget] biaya tak diketahui (model tanpa harga) dengan {tokens} token terpakai — melebihi budget, prompt baru ditolak. /exit untuk keluar.",
151
+ "tui.stopped": "(dihentikan)",
152
+ "tui.budget80": "[budget] {spent} / {budget} (80% terpakai)",
153
+ "tui.copyNone": "(belum ada yang disalin — jalankan prompt dulu)",
154
+ "tui.copyOk": "tersalin {n} chars (OSC 52 — izinkan akses clipboard di terminal bila kosong)",
155
+ "tui.copyNeedTty": "(clipboard butuh terminal TTY)",
156
+ "tui.unknownMode": "mode tidak dikenal: {a} — pilihan: {modes}",
157
+ "tui.modeLine": "mode: {m}",
158
+ "tui.langLine": "lang: {v}",
159
+ "tui.toolCall": "pemanggilan tool: {v}",
160
+ "tui.modelSet": "model: {v}",
161
+ "tui.thinkingSet": "thinking: {v}",
162
+ "tui.sectionsMin": "bagian: diminimalkan",
163
+ "tui.sectionsExp": "bagian: dibuka",
164
+ "tui.minUse": "pakai: /minimize [on|off]",
165
+ "tui.unknownCmd": "Perintah tak dikenal: /{name}.{tail}",
166
+ "tui.didYou": " Maksudmu /{hint}?",
167
+ "tui.tryHelp": " Coba /help.",
168
+ "tui.expandEmpty": "(tidak ada yang dibuka — semua sudah terlihat)",
169
+ "tui.historyEmpty": "(riwayat kosong)",
170
+ "tui.langUnknown": "bahasa tak dikenal: {a} — pilihan: en, id",
171
+ "tui.noTty": "Terminal tidak mendukung TUI fullscreen — interaktif butuh TTY dengan ≥10 baris.",
172
+ "tui.noModel": "tanpa model",
173
+ "tui.tooSmall": "Terminal terlalu kecil — besarkan ≥10 baris / ≥20 kolom (Ctrl+D keluar).",
174
+ "cmd.bye": "Sampai jumpa.",
175
+ "cmd.syncing": "Sinkronisasi model…",
176
+ "cmd.noProviders": " Tidak ada penyedia.",
177
+ "cmd.noChanges": " Tidak ada perubahan — periksa API key dan jaringan, coba lagi.",
178
+ "cmd.restart": " Restart untuk memakai model baru.",
179
+ "cmd.nothingUpdated":
180
+ " Tidak ada yang diperbarui — periksa API key dan jaringan di atas, lalu coba /sync.",
181
+ "cmd.initExists": "AGENTS.md sudah ada - tidak ditimpa.",
182
+ "cmd.initCreated": "AGENTS.md dibuat: {t}",
183
+ "cmd.noSessions": "Tidak ada sesi.",
184
+ "ask.search": "(cari-balik)`{q}': ",
185
+ "ask.searchFail": "(gagal cari-balik)`{q}': ",
186
+ "ask.more": "… {n} lagi",
187
+ "one.turnHead": "\n── Giliran {n} ──\n",
188
+ "one.done": "\n selesai\n",
189
+ "one.answerOpen": " − jawaban\n",
190
+ "one.answerMin": " + jawaban ({n} karakter{cap}) — /expand untuk baca\n",
191
+ "one.answerCap": ", dibatasi 1MB",
192
+ "one.thinkOpen": " − berpikir\n",
193
+ "one.thinkMin": " + berpikir\n",
194
+ "one.more3": "\n ... ({n} lagi)",
195
+ "one.moreLines": "\n … ({n} baris lagi)",
196
+ "one.contentBlocked": "\n! Filter konten diblokir\n",
197
+ "one.step": " Langkah {i}: {calls}\n",
198
+ "hl.moreLines": " ... ({n} baris lagi)",
199
+ "common.canceled": "Dibatalkan",
200
+ "err.rateLimit": "Penyedia membatasi laju permintaan",
201
+ "err.rateLimitFix": "Tunggu sebentar dan coba lagi, atau pakai --ratelimit untuk menahan laju.",
202
+ "err.balance": "Saldo atau kuota API key habis",
203
+ "err.balanceFix": "Ganti penyedia via /model, atau isi ulang kredit.",
204
+ "err.auth": "Penyedia menolak autentikasi",
205
+ "err.authFix": "Periksa API key, atau ganti penyedia via /model.",
206
+ "err.server": "Penyedia sedang tidak tersedia",
207
+ "err.serverFix": "Tunggu sebentar dan coba lagi, atau ganti penyedia via /model.",
208
+ "err.network": "Gagal menjangkau penyedia",
209
+ "err.networkFix": "Periksa koneksi dan coba lagi.",
210
+ "err.invalid": "Permintaan ditolak penyedia",
211
+ "err.invalidFix": "Periksa nama model atau pilih model lain dengan /model.",
212
+ "err.context": "Jendela konteks terlampaui",
213
+ "err.contextFix":
214
+ "Mulai sesi baru (/exit lalu minicode), atau pakai model berjendela konteks lebih besar.",
215
+ "err.filter": "Permintaan diblokir filter konten penyedia",
216
+ "err.filterFix": "Tulis ulang prompt, atau ganti penyedia via /model.",
217
+ "err.timeout": "Run melewati batas waktu",
218
+ "err.timeoutFix": "Naikkan --timeout atau pakai model lebih cepat.",
219
+ "err.steps": "Batas langkah tool tercapai",
220
+ "err.stepsFix": "Pecah tugas menjadi prompt lebih kecil.",
221
+ "err.budget": "Budget sesi terlampaui",
222
+ "err.budgetFix": "Mulai sesi baru atau naikkan --budget.",
223
+ "err.busy": "Run masih berjalan",
224
+ "err.busyFix": "Tunggu run berjalan selesai.",
225
+ "err.aborted": "Run dibatalkan",
226
+ "common.active": "aktif",
227
+ }
@@ -0,0 +1,66 @@
1
+ // i18n nol-dependensi — kamus statis + resolusi berlapis, pola yang sama
2
+ // dengan theme.ts: SEMUA dibaca via getter/fungsi saat DIPAKAI, jangan simpan
3
+ // hasil `t()` atau `currentLocale()` ke const module-scope (bahasa terkunci
4
+ // saat import — kesalahan yang sama seperti c/glyphs; dijaga test).
5
+ //
6
+ // Prioritas (keputusan produk): sesi (/lang) > MINICODE_LANG > state.json
7
+ // `lang` > locale OS (LANG/LC_ALL awalan `id`) > en. Kunci hilang di locale
8
+ // fallback en (tak pernah crash, tak pernah kunci mentah).
9
+ import { en } from "./en.ts"
10
+ import { id } from "./id.ts"
11
+
12
+ export type Locale = "en" | "id"
13
+ export type MsgKey = keyof typeof en
14
+
15
+ const dicts: Record<Locale, Record<MsgKey, string>> = { en, id }
16
+
17
+ /** Runtime switch sesi (/lang). Mengalahkan env + config selama sesi hidup. */
18
+ let sessionLocale: Locale | null = null
19
+ /** `lang` state.json (di-inject composition root dari state termuat). */
20
+ let configLocale: Locale | null = null
21
+
22
+ export function setSessionLocale(locale: Locale | null): void {
23
+ sessionLocale = locale
24
+ }
25
+
26
+ export function setConfigLocale(locale: Locale | null): void {
27
+ configLocale = locale
28
+ }
29
+
30
+ /** Untuk test: kembalikan ke steril (tanpa ini env bocor antar-file). */
31
+ export function resetLocaleState(): void {
32
+ sessionLocale = null
33
+ configLocale = null
34
+ }
35
+
36
+ function parseLocale(raw: string | undefined): Locale | null {
37
+ const v = (raw ?? "").trim().toLowerCase()
38
+ if (v === "id" || v.startsWith("id_") || v.startsWith("id-")) return "id"
39
+ if (v === "en" || v.startsWith("en_") || v.startsWith("en-")) return "en"
40
+ return null
41
+ }
42
+
43
+ /** Locale aktif SAAT INI (baca tiap panggil — jangan cache). */
44
+ export function currentLocale(): Locale {
45
+ if (sessionLocale) return sessionLocale
46
+ const env = parseLocale(process.env.MINICODE_LANG)
47
+ if (env) return env
48
+ if (configLocale) return configLocale
49
+ const sys = process.env.LANG ?? process.env.LC_ALL ?? ""
50
+ // Prefix `id` (id_ID.UTF-8, id_ID, id): sistem berbahasa Indonesia.
51
+ if (/^id([_.@-]|$)/i.test(sys.trim())) return "id"
52
+ return "en"
53
+ }
54
+
55
+ /**
56
+ * Ambil string UI + interpolasi `{nama}`. Params tak dikenal dibiarkan
57
+ * apa adanya (terlihat saat dev, bukan crash saat produksi).
58
+ */
59
+ export function t(key: MsgKey, params?: Record<string, string | number>): string {
60
+ const locale = currentLocale()
61
+ const template = dicts[locale][key] ?? dicts.en[key] ?? key
62
+ if (!params) return template
63
+ return template.replace(/\{([A-Za-z0-9_]+)\}/g, (m, name: string) =>
64
+ name in params ? String(params[name]) : m,
65
+ )
66
+ }