minicode-ai 0.26.0 → 0.28.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/cli/args.ts +120 -16
- package/cli/commands/acp.ts +38 -28
- package/cli/commands/auth.ts +17 -17
- package/cli/commands/config.ts +65 -66
- package/cli/commands/daemon.ts +44 -16
- package/cli/commands/doctor.ts +11 -12
- package/cli/commands/exec.ts +35 -73
- package/cli/commands/mcp.ts +25 -8
- package/cli/commands/memory.ts +16 -24
- package/cli/commands/openwork.ts +6 -2
- package/cli/commands/pricing.ts +14 -12
- package/cli/commands/providers.ts +36 -57
- package/cli/commands/sessions.ts +24 -18
- package/cli/commands/skills.ts +33 -18
- package/cli/commands/stats.ts +15 -30
- package/cli/commands.ts +96 -46
- package/cli/context-command-run.ts +171 -0
- package/cli/context-command.ts +87 -0
- package/cli/index.ts +96 -98
- package/cli/model-manager.ts +7 -2
- package/cli/provider-manager.ts +33 -18
- package/cli/router.ts +41 -12
- package/cli/setup.ts +246 -123
- package/cli/tui.ts +311 -109
- package/docs/TERMINAL_CONTRACT.md +254 -69
- package/docs/UI_RENDER_PIPELINE.md +9 -1
- package/docs/agents.md +2 -2
- package/docs/architecture.md +3 -3
- package/docs/choosing-mode.md +7 -9
- package/docs/cli.md +3 -5
- package/docs/config.md +16 -0
- package/docs/environment.md +3 -3
- package/docs/policy-sandbox.md +3 -3
- package/docs/repl.md +3 -2
- package/docs/tools.md +1 -1
- package/package.json +1 -1
- package/src/app/mentions.ts +60 -13
- package/src/app/rag-layer.ts +17 -20
- package/src/app/session.ts +119 -66
- package/src/app/tool-layer.ts +12 -17
- package/src/config.ts +64 -104
- package/src/constants.ts +23 -9
- package/src/daemon/capability.ts +8 -1
- package/src/daemon/control.ts +3 -2
- package/src/daemon/server.ts +57 -0
- package/src/hooks/run.ts +73 -41
- package/src/lib/db-path.ts +47 -0
- package/src/lib/process-tree.ts +62 -0
- package/src/lib/public-http.ts +88 -23
- package/src/lib/trusted-exec.ts +48 -1
- package/src/lsp/client.ts +62 -17
- package/src/mcp/client.ts +85 -38
- package/src/mcp/http-transport.ts +28 -16
- package/src/mcp/transport.ts +42 -6
- package/src/memory/files.ts +164 -134
- package/src/memory/vector.ts +371 -420
- package/src/policy/approval-binding.ts +122 -45
- package/src/policy/bash-guard.ts +18 -7
- package/src/policy/compaction.ts +51 -18
- package/src/policy/context-window.ts +109 -0
- package/src/policy/context.ts +78 -37
- package/src/policy/executor.ts +17 -7
- package/src/policy/microcompact.ts +4 -3
- package/src/policy/no-progress.ts +103 -22
- package/src/policy/permission.ts +36 -12
- package/src/policy/tool-contract.ts +74 -416
- package/src/policy/usage.ts +24 -2
- package/src/policy/verifier.ts +50 -2
- package/src/policy/work-mode.ts +28 -54
- package/src/presentation/adapter.ts +24 -16
- package/src/providers/guards.ts +41 -2
- package/src/providers/provision.ts +6 -60
- package/src/providers/responses.ts +1 -0
- package/src/repo/repomap.ts +180 -23
- package/src/runtime/execution-journal.ts +4 -29
- package/src/sandbox/docker.ts +58 -34
- package/src/sandbox/mask.ts +157 -0
- package/src/sandbox/os.ts +107 -73
- package/src/session/authority.ts +29 -10
- package/src/session/context-projection.ts +6 -5
- package/src/session/open-work.ts +26 -3
- package/src/session/persistence.ts +25 -58
- package/src/session/verification.ts +170 -20
- package/src/skills/loader.ts +31 -16
- package/src/task/production-scheduler.ts +13 -1
- package/src/task/store.ts +20 -37
- package/src/telemetry/trace.ts +27 -0
- package/src/tools/ask_user.ts +1 -13
- package/src/tools/bash.ts +27 -92
- package/src/tools/code_run.ts +1 -1
- package/src/tools/context.ts +133 -0
- package/src/tools/delete_file.ts +3 -2
- package/src/tools/edit.ts +37 -72
- package/src/tools/git.ts +86 -9
- package/src/tools/glob.ts +26 -51
- package/src/tools/grep.ts +67 -57
- package/src/tools/hashline.ts +4 -0
- package/src/tools/lsp.ts +11 -8
- package/src/tools/mcp_call.ts +9 -6
- package/src/tools/memory.ts +56 -33
- package/src/tools/move_file.ts +36 -10
- package/src/tools/patch.ts +13 -21
- package/src/tools/read_file.ts +18 -25
- package/src/tools/read_image.ts +35 -33
- package/src/tools/submit_result.ts +29 -8
- package/src/tools/task.ts +74 -17
- package/src/tools/todo.ts +181 -74
- package/src/tools/web_fetch.ts +42 -2
- package/src/tools/web_search.ts +47 -8
- package/src/ui/approval/prompt.ts +206 -47
- package/src/ui/assistant/turn-status.ts +14 -5
- package/src/ui/footer.ts +4 -4
- package/src/ui/i18n/en.ts +59 -23
- package/src/ui/i18n/id.ts +88 -51
- package/src/ui/input/input.ts +4 -3
- package/src/ui/input/prompt-engine.ts +35 -5
- package/src/ui/render/activity-panel.ts +4 -2
- package/src/ui/render/hint.ts +7 -4
- package/src/ui/render/list.ts +32 -0
- package/src/ui/render/markdown.ts +6 -3
- package/src/ui/render/notice.ts +19 -0
- package/src/ui/render/table-grid.ts +7 -8
- package/src/ui/render/theme.ts +113 -39
- package/src/ui/runtime/screen.ts +74 -10
- package/src/ui/runtime/spinner.ts +19 -6
- package/src/ui/screens/dialog.ts +19 -1
- package/src/ui/screens/form.ts +80 -35
- package/src/ui/screens/model-manager.ts +88 -62
- package/src/ui/screens/output-window.ts +263 -0
- package/src/ui/screens/picker.ts +94 -81
- package/src/ui/screens/provider-manager.ts +100 -69
- package/src/ui/screens/wizard.ts +117 -28
- package/src/ui/tui/app.ts +196 -33
- package/src/ui/tui/transcript.ts +154 -25
- package/vendor/minicore/src/core/executor.ts +2 -0
- package/vendor/minicore/src/core/loop.ts +17 -6
- package/vendor/minicore/src/core/session.ts +3 -0
- package/vendor/minicore/src/core/tool.ts +1 -0
- package/vendor/minicore/src/providers/openai-compat.ts +28 -19
package/src/ui/i18n/id.ts
CHANGED
|
@@ -3,19 +3,17 @@
|
|
|
3
3
|
import type { MsgKey } from "./locale.ts"
|
|
4
4
|
|
|
5
5
|
export const id: Record<MsgKey, string> = {
|
|
6
|
-
"app.placeholder": "tanya sesuatu, / untuk perintah… (Ctrl+D keluar)",
|
|
7
6
|
"app.newBelow": "↓ {n} baris baru di bawah · PgDn ke ekor",
|
|
8
7
|
"app.abortHint": "abort terkirim — tekan Esc sekali lagi untuk keluar",
|
|
9
|
-
"app.
|
|
10
|
-
"app.
|
|
11
|
-
"app.
|
|
12
|
-
"
|
|
13
|
-
"tui.
|
|
14
|
-
"tui.
|
|
15
|
-
"tui.selectionTooLarge": "selection terlalu besar untuk disalin",
|
|
8
|
+
"app.welcomeTitle": "minicode {dot} {model}",
|
|
9
|
+
"app.welcomeCwd": "{cwd}",
|
|
10
|
+
"app.welcomeHints": "Tab mode {dot} Shift+Tab izin {dot} / menu {dot} Ctrl+R riwayat",
|
|
11
|
+
"tui.selectionCopied": "seleksi disalin ke clipboard",
|
|
12
|
+
"tui.selectionCopyFailed": "seleksi tidak bisa disalin (OSC 52 tidak tersedia)",
|
|
13
|
+
"tui.selectionTooLarge": "seleksi terlalu besar untuk disalin",
|
|
16
14
|
"form.idleWarning": "diam — dibatalkan dalam {s} dtk (tekan sembarang tombol untuk lanjut)",
|
|
17
15
|
"appr.title": "Perlu persetujuan",
|
|
18
|
-
"appr.tool": "
|
|
16
|
+
"appr.tool": "Tool:",
|
|
19
17
|
"appr.cmdLabel": "Perintah:",
|
|
20
18
|
"appr.fileLabel": "Berkas:",
|
|
21
19
|
"appr.queryLabel": "Kueri:",
|
|
@@ -26,11 +24,10 @@ export const id: Record<MsgKey, string> = {
|
|
|
26
24
|
"appr.decAllow": "izinkan",
|
|
27
25
|
"appr.decAlways": "selalu",
|
|
28
26
|
"appr.decDeny": "tolak",
|
|
29
|
-
"appr.keyHint": "↑↓ pindah · Enter pilih · Esc batal",
|
|
30
27
|
"appr.askTitle": "Agen bertanya",
|
|
31
28
|
"appr.a11y": "[butuh persetujuan: {name}]",
|
|
32
29
|
"appr.answerPrompt": "Jawaban (kosong = batal): ",
|
|
33
|
-
"appr.risk": "
|
|
30
|
+
"appr.risk": "Efek:",
|
|
34
31
|
"appr.diff": "Perubahan:",
|
|
35
32
|
"appr.tier.pure": "hanya-baca",
|
|
36
33
|
"appr.tier.workspace": "ubah berkas workspace",
|
|
@@ -47,7 +44,7 @@ export const id: Record<MsgKey, string> = {
|
|
|
47
44
|
"… kompaksi mustahil: instruksi tetap + skema tool ({fixed}) sudah melebihi ambang {trigger}",
|
|
48
45
|
"ts.compactedLlmFailed": "… ringkasan LLM gagal ({reason}), memakai ringkasan mekanikal",
|
|
49
46
|
"ts.contextWindowSource": "konteks {tokens} token ({source})",
|
|
50
|
-
"ts.providerAttemptDiscarded": "percobaan
|
|
47
|
+
"ts.providerAttemptDiscarded": "percobaan penyedia {attempt} gagal; output parsial dibuang",
|
|
51
48
|
"ts.thinking": "… berpikir",
|
|
52
49
|
"ts.evictMarker": "… {n} baris awal di luar viewport",
|
|
53
50
|
"ts.statusRunning": "berjalan",
|
|
@@ -60,29 +57,23 @@ export const id: Record<MsgKey, string> = {
|
|
|
60
57
|
"ts.childGroup": "{n} tool anak",
|
|
61
58
|
"ts.turnSummary":
|
|
62
59
|
"turn {turn} · {ok} ok · {failed} gagal · {denied} ditolak · {cancelled} dibatalkan · {interrupted} terhenti · {files} berkas · ckpt {ckpt} · {secs}",
|
|
63
|
-
"form.footerDefault": "Tab:{move} · Enter:{save} · Esc:{cancel}",
|
|
64
60
|
"form.required": "wajib diisi",
|
|
65
61
|
"form.invalidUrl": "URL tidak valid",
|
|
66
62
|
"form.httpOnly": "harus http(s)",
|
|
67
63
|
"form.yes": "Ya",
|
|
68
64
|
"form.no": "Tidak",
|
|
69
|
-
"verb.select": "pilih",
|
|
70
|
-
"verb.add": "tambah",
|
|
71
|
-
"verb.delete": "hapus",
|
|
72
|
-
"verb.edit": "ubah",
|
|
73
|
-
"verb.close": "tutup",
|
|
74
65
|
"pick.noMatch": 'Tidak cocok untuk "{q}"',
|
|
75
66
|
"pick.fail": "picker gagal: {msg}",
|
|
76
67
|
"pick.failOpen": "picker gagal dibuka: {msg}",
|
|
77
68
|
"model.empty": "Belum ada model",
|
|
78
69
|
"model.noMatch": "Tidak ada model yang cocok",
|
|
79
70
|
"model.deleteTitle": "Hapus model",
|
|
80
|
-
"model.deleteFooter": "←/→/y/n pilih · Enter hapus · Esc batal",
|
|
81
71
|
"model.delActive": 'Hapus model AKTIF "{id}"?',
|
|
82
72
|
"model.del": 'Hapus model "{id}"?',
|
|
83
|
-
"model.failOpen": "model
|
|
73
|
+
"model.failOpen": "pengelola model gagal dibuka: {msg}",
|
|
84
74
|
"effort.title": "Upaya berpikir",
|
|
85
75
|
"effort.saved": "Upaya berpikir: {effort} (sesi berikut)",
|
|
76
|
+
"effort.noThinking": "model ini tidak punya upaya berpikir — tidak ada yang bisa diatur",
|
|
86
77
|
"prov.empty": "Belum ada penyedia",
|
|
87
78
|
"prov.addTitle": "Tambah penyedia",
|
|
88
79
|
"prov.customUrl": "URL kustom",
|
|
@@ -96,9 +87,8 @@ export const id: Record<MsgKey, string> = {
|
|
|
96
87
|
"prov.deleteLabel": '"{id}" ({n} model)',
|
|
97
88
|
"prov.deleteActive": " — aktif ({model})",
|
|
98
89
|
"prov.deleteAsk": " — hapus?",
|
|
99
|
-
"prov.
|
|
100
|
-
"prov.
|
|
101
|
-
"prov.reloadFail": "reload provider gagal — restart untuk menerapkan",
|
|
90
|
+
"prov.failOpen": "pengelola penyedia gagal dibuka: {msg}",
|
|
91
|
+
"prov.reloadFail": "muat ulang penyedia gagal — restart untuk menerapkan",
|
|
102
92
|
"prov.detectFail": "Deteksi model gagal: {msg}",
|
|
103
93
|
"prov.updateFail": "Pembaruan gagal: {msg}",
|
|
104
94
|
"prov.deleted": 'Penyedia "{id}" dihapus.',
|
|
@@ -125,18 +115,29 @@ export const id: Record<MsgKey, string> = {
|
|
|
125
115
|
"ntc.detecting": "Mendeteksi model…",
|
|
126
116
|
"ntc.timeout": "batas waktu — tak ada respons, UI pulih; ulangi atau Esc",
|
|
127
117
|
"gate.tuiPicker": '"{title}" butuh terminal interaktif — dibatalkan.',
|
|
128
|
-
"gate.tuiModel": "model
|
|
129
|
-
"gate.tuiProvider": "
|
|
118
|
+
"gate.tuiModel": "pengelola model butuh terminal interaktif — dibatalkan.",
|
|
119
|
+
"gate.tuiProvider": "pengelola penyedia butuh terminal interaktif — dibatalkan.",
|
|
130
120
|
"st.session": "Sesi {id}",
|
|
131
121
|
"st.model": " Model: {v}",
|
|
132
122
|
"st.provider": " Penyedia: {v}",
|
|
133
|
-
"st.tools": "
|
|
123
|
+
"st.tools": " Tool: {v}",
|
|
134
124
|
"st.workMode": " WorkMode: {v} (lapis intent)",
|
|
135
125
|
"st.permissionMode": " Izin: {v} (otoritas allow/deny)",
|
|
136
126
|
"st.context": " Konteks: ~{v} tok (estimasi jendela)",
|
|
127
|
+
"help.desc.context": "Lihat atau atur jendela konteks",
|
|
128
|
+
"ctx.title": "Jendela konteks",
|
|
129
|
+
"ctx.colModel": "Model",
|
|
130
|
+
"ctx.colWindow": "Jendela",
|
|
131
|
+
"ctx.colOrigin": "Asal",
|
|
132
|
+
"ctx.empty": "belum ada model — tambahkan penyedia dulu",
|
|
133
|
+
"ctx.pickTitle": "Jendela konteks — efektif {label} ({origin})",
|
|
134
|
+
"ctx.saved": "tersimpan: {label} ({tokens} token) untuk turn berikutnya",
|
|
135
|
+
"ctx.savedAuto": "kembali ke deteksi otomatis",
|
|
136
|
+
"ctx.saveFailed": "gagal menyimpan jendela: {msg}",
|
|
137
|
+
"ctx.usage": " /context <128k|1m|1024x1024|auto> -> setel untuk model aktif",
|
|
137
138
|
"st.turn": " Turn: {v} (turn terakhir saja)",
|
|
138
|
-
"st.input": " Masukan: {v} (pemakaian
|
|
139
|
-
"st.output": " Keluaran: {v} (pemakaian
|
|
139
|
+
"st.input": " Masukan: {v} (pemakaian penyedia)",
|
|
140
|
+
"st.output": " Keluaran: {v} (pemakaian penyedia)",
|
|
140
141
|
"st.total": " Total: {v} (kumulatif sesi)",
|
|
141
142
|
"st.cache": " Cache: {read} hit · {write} tulis (prompt cache)",
|
|
142
143
|
"st.cost": " Biaya: {v} (estimasi tabel harga)",
|
|
@@ -144,17 +145,27 @@ export const id: Record<MsgKey, string> = {
|
|
|
144
145
|
"st.costUnknown": " (biaya tak diketahui — model tanpa harga)",
|
|
145
146
|
"help.head": "Perintah:",
|
|
146
147
|
"help.keysLine": "Mouse wheel/PgUp/PgDn gulir (Shift = ½) · /help tombol = semua pintasan",
|
|
147
|
-
"hint.move": "
|
|
148
|
+
"hint.move": "pindah",
|
|
148
149
|
"hint.select": "pilih",
|
|
149
|
-
"hint.
|
|
150
|
-
"hint.
|
|
150
|
+
"hint.save": "simpan",
|
|
151
|
+
"hint.cancel": "batal",
|
|
152
|
+
"hint.submit": "kirim",
|
|
153
|
+
"hint.back": "kembali",
|
|
154
|
+
"hint.clear": "kosongkan",
|
|
155
|
+
"hint.scroll": "gulir",
|
|
151
156
|
"hint.delete": "hapus",
|
|
152
157
|
"hint.edit": "ubah",
|
|
153
158
|
"hint.add": "tambah",
|
|
154
159
|
"hint.effort": "upaya",
|
|
160
|
+
"hint.copy": "salin",
|
|
161
|
+
"hint.close": "tutup",
|
|
162
|
+
"state.compact": "ringkas",
|
|
163
|
+
"state.expanded": "dibuka",
|
|
164
|
+
"state.minimized": "diminimalkan",
|
|
165
|
+
"state.folded": "dilipat",
|
|
155
166
|
"help.cHead": "Perintah:",
|
|
156
167
|
"help.cKeys":
|
|
157
|
-
"Tombol: Tab
|
|
168
|
+
"Tombol: Tab WorkMode · Shift+Tab izin · ↑↓ riwayat · Mouse wheel/PgUp/PgDn gulir · Ctrl+R cari · Ctrl+D keluar",
|
|
158
169
|
"help.cMore": " /help tombol = semua pintasan",
|
|
159
170
|
"help.gGeneral": "Umum",
|
|
160
171
|
"help.gSession": "Sesi",
|
|
@@ -164,8 +175,7 @@ export const id: Record<MsgKey, string> = {
|
|
|
164
175
|
"help.gTask": "Tugas",
|
|
165
176
|
"help.kHead": "Papan tombol:",
|
|
166
177
|
"help.k.submit": "kirim",
|
|
167
|
-
"help.k.
|
|
168
|
-
"help.k.workMode": "putar work mode (Build/Plan/Discuss)",
|
|
178
|
+
"help.k.workMode": "putar WorkMode (Build/Discuss)",
|
|
169
179
|
"help.k.permission": "putar mode izin (Auto/Ask)",
|
|
170
180
|
"help.k.history": "riwayat prompt (di picker: navigasi)",
|
|
171
181
|
"help.k.mouse": "gulir transkrip dengan mouse wheel",
|
|
@@ -193,7 +203,7 @@ export const id: Record<MsgKey, string> = {
|
|
|
193
203
|
"help.desc.init": "Buat AGENTS.md",
|
|
194
204
|
"help.desc.exit": "Keluar",
|
|
195
205
|
"help.desc.mode": "Tampilkan atau set mode izin",
|
|
196
|
-
"help.desc.work-mode": "Tampilkan atau set
|
|
206
|
+
"help.desc.work-mode": "Tampilkan atau set WorkMode (lapis intent)",
|
|
197
207
|
"help.desc.lang": "Tampilkan atau set bahasa UI",
|
|
198
208
|
"help.desc.undo": "Urungkan perubahan berkas dari turn terakhir",
|
|
199
209
|
"help.desc.redo": "Terapkan ulang yang diurungkan",
|
|
@@ -201,6 +211,20 @@ export const id: Record<MsgKey, string> = {
|
|
|
201
211
|
"help.desc.copy": "Salin 1–10 turn terakhir ke clipboard (OSC 52)",
|
|
202
212
|
"help.desc.history": "Tampilkan riwayat prompt",
|
|
203
213
|
"help.desc.scheduler": "Picu / periksa / hentikan scheduler",
|
|
214
|
+
"help.desc.compact": "Alihkan output tool ringkas",
|
|
215
|
+
"help.desc.thinking": "Alihkan tampilan thinking",
|
|
216
|
+
"help.desc.expand": "Buka konten yang dilipat",
|
|
217
|
+
"help.desc.minimize": "Minimalkan output tool & jawaban",
|
|
218
|
+
"help.desc.fold": "Alihkan panel aktivitas",
|
|
219
|
+
"out.titleHelp": "Bantuan",
|
|
220
|
+
"out.titleStatus": "Status sesi",
|
|
221
|
+
"out.titleHistory": "Riwayat",
|
|
222
|
+
"out.titleSync": "Sinkronisasi",
|
|
223
|
+
"out.titleInit": "Inisialisasi",
|
|
224
|
+
"out.titleExpand": "Buka konten",
|
|
225
|
+
"out.titleModels": "Model",
|
|
226
|
+
"out.titleProviders": "Penyedia",
|
|
227
|
+
"out.titleCommand": "Perintah",
|
|
204
228
|
|
|
205
229
|
// [PHASE 6AB] Operator strings for `/scheduler`.
|
|
206
230
|
"sched.usage": "pakai: /scheduler [status|run|stop]",
|
|
@@ -246,35 +270,40 @@ export const id: Record<MsgKey, string> = {
|
|
|
246
270
|
"tui.stopped": "(dihentikan)",
|
|
247
271
|
"tui.budget80": "[budget] {spent} / {budget} (80% terpakai)",
|
|
248
272
|
"tui.copyNone": "(belum ada yang disalin — jalankan prompt dulu)",
|
|
249
|
-
"tui.copyOk": "tersalin {n}
|
|
273
|
+
"tui.copyOk": "tersalin {n} karakter (OSC 52 — izinkan akses clipboard di terminal bila kosong)",
|
|
250
274
|
"tui.copyOkMany":
|
|
251
|
-
"tersalin {turns} turn ({n}
|
|
275
|
+
"tersalin {turns} turn ({n} karakter · OSC 52 — izinkan akses clipboard di terminal bila kosong)",
|
|
252
276
|
"tui.copyInvalid": "jumlah turn tidak valid: {n} (gunakan 1–{max})",
|
|
253
277
|
"tui.copyNeedTty": "(clipboard butuh terminal TTY)",
|
|
254
278
|
"tui.copyTooLarge": "payload salin terlalu besar ({n} byte, maks {max})",
|
|
255
279
|
"tui.unknownMode": "mode tidak dikenal: {a} — pilihan: {modes}",
|
|
256
280
|
"tui.modeLine": "mode: {m}",
|
|
257
|
-
"tui.workModeUnknown": "
|
|
258
|
-
"tui.workModeLine": "
|
|
259
|
-
"tui.workModeUsage": "pemakaian: /work-mode <DISCUSS|
|
|
260
|
-
"tui.workModeUnavailable": "
|
|
281
|
+
"tui.workModeUnknown": "WorkMode tidak dikenal: {a} — pilihan: {modes}",
|
|
282
|
+
"tui.workModeLine": "WorkMode: {m}",
|
|
283
|
+
"tui.workModeUsage": "pemakaian: /work-mode <DISCUSS|BUILD> — aktif: {m}",
|
|
284
|
+
"tui.workModeUnavailable": "WorkMode tidak tersedia di sesi ini",
|
|
285
|
+
"tui.undoInDiscuss":
|
|
286
|
+
"undo/redo tidak tersedia di mode DISCUSS — beralih ke BUILD (/work-mode BUILD) terlebih dahulu",
|
|
287
|
+
"tui.unrestrictedUsage": "pemakaian: /unrestrict [on|off]",
|
|
261
288
|
"tui.unrestrictedOn": "mode unrestricted aktif - akses penuh",
|
|
262
289
|
"tui.unrestrictedOff": "unrestricted nonaktif — mode izin kembali ke {m}",
|
|
263
290
|
"tui.bgFinished": "job background {id} selesai (exit {code})",
|
|
264
291
|
"tui.bgFinishedAuto":
|
|
265
292
|
"job background {id} selesai dengan exit code {code}. Lanjutkan pekerjaan yang tadi tanpa menunggu saya: ambil output job lewat bash_output bila relevan, verifikasi hasilnya, lalu selesaikan tugas yang tersisa.",
|
|
266
293
|
"tui.langLine": "lang: {v}",
|
|
267
|
-
"tui.
|
|
294
|
+
"tui.compactLine": "output tool: {v}",
|
|
268
295
|
"tui.modelSet": "model: {v}",
|
|
269
296
|
"tui.thinkingSet": "thinking: {v}",
|
|
270
297
|
"tui.activityFold": "aktivitas: {v}",
|
|
271
298
|
"tui.sectionsMin": "bagian: diminimalkan",
|
|
272
299
|
"tui.sectionsExp": "bagian: dibuka",
|
|
273
300
|
"tui.minUse": "pakai: /minimize [on|off]",
|
|
301
|
+
"tui.toggleUse": "pakai: /{cmd} [on|off]",
|
|
274
302
|
"tui.unknownCmd": "Perintah tak dikenal: /{name}.{tail}",
|
|
275
303
|
"tui.didYou": " Maksudmu /{hint}?",
|
|
276
304
|
"tui.tryHelp": " Coba /help.",
|
|
277
305
|
"tui.expandEmpty": "(tidak ada yang dibuka — semua sudah terlihat)",
|
|
306
|
+
"tui.expandNotFound": "(tidak ada konten terpotong untuk id: {id})",
|
|
278
307
|
"tui.expandContent": "konten",
|
|
279
308
|
"tui.expandRetention":
|
|
280
309
|
"(konten di luar retensi — lihat .minicode/step-traces.jsonl / sesi sqlite)",
|
|
@@ -293,17 +322,24 @@ export const id: Record<MsgKey, string> = {
|
|
|
293
322
|
" Tidak ada yang diperbarui — periksa API key dan jaringan di atas, lalu coba /sync.",
|
|
294
323
|
"cmd.initExists": "AGENTS.md sudah ada - tidak ditimpa.",
|
|
295
324
|
"cmd.initCreated": "AGENTS.md dibuat: {t}",
|
|
325
|
+
"cmd.initInDiscuss":
|
|
326
|
+
"init tidak tersedia di mode DISCUSS — beralih ke BUILD (/work-mode BUILD) terlebih dahulu",
|
|
327
|
+
"cmd.initBodyDesc": "Petunjuk untuk agent yang bekerja di repo ini.",
|
|
328
|
+
"cmd.initBodyMap": "## Struktur (repo-map)",
|
|
329
|
+
"cmd.initBodyEmpty": "(repo-map kosong)",
|
|
330
|
+
"cmd.initBodyConv":
|
|
331
|
+
"## Konvensi\n- Ikuti gaya kode existing.\n- Jalankan typecheck/test sebelum selesai.",
|
|
296
332
|
"cmd.noSessions": "Tidak ada sesi.",
|
|
297
333
|
"ask.search": "(cari-balik)`{q}': ",
|
|
298
334
|
"ask.searchFail": "(gagal cari-balik)`{q}': ",
|
|
299
335
|
"ask.more": "… {n} lagi",
|
|
300
|
-
"one.turnHead": "\n──
|
|
336
|
+
"one.turnHead": "\n── Turn {n} ──\n",
|
|
301
337
|
"one.done": "\n selesai\n",
|
|
302
338
|
"one.answerOpen": " − jawaban\n",
|
|
303
339
|
"one.answerMin": " + jawaban ({n} karakter{cap}) — /expand untuk baca\n",
|
|
304
340
|
"one.answerCap": ", dibatasi 1MB",
|
|
305
341
|
"one.providerAttemptDiscarded":
|
|
306
|
-
"\n[percobaan
|
|
342
|
+
"\n[percobaan penyedia {attempt} gagal; output parsial di atas tidak termasuk jawaban akhir]\n",
|
|
307
343
|
"one.thinkOpen": " − berpikir\n",
|
|
308
344
|
"one.thinkMin": " + berpikir\n",
|
|
309
345
|
"one.more3": "\n ... ({n} lagi)",
|
|
@@ -316,7 +352,8 @@ export const id: Record<MsgKey, string> = {
|
|
|
316
352
|
"hl.moreLines": " ... ({n} baris lagi)",
|
|
317
353
|
"common.canceled": "Dibatalkan",
|
|
318
354
|
"err.rateLimit": "Penyedia membatasi laju permintaan",
|
|
319
|
-
"err.rateLimitFix":
|
|
355
|
+
"err.rateLimitFix":
|
|
356
|
+
"Tunggu sebentar dan coba lagi, ganti penyedia via /model, atau pakai --ratelimit untuk menahan laju.",
|
|
320
357
|
"err.balance": "Saldo atau kuota API key habis",
|
|
321
358
|
"err.balanceFix": "Ganti penyedia via /model, atau isi ulang kredit.",
|
|
322
359
|
"err.auth": "Penyedia menolak autentikasi",
|
|
@@ -332,15 +369,15 @@ export const id: Record<MsgKey, string> = {
|
|
|
332
369
|
"Mulai sesi baru (/exit lalu minicode), atau pakai model berjendela konteks lebih besar.",
|
|
333
370
|
"err.filter": "Permintaan diblokir filter konten penyedia",
|
|
334
371
|
"err.filterFix": "Tulis ulang prompt, atau ganti penyedia via /model.",
|
|
335
|
-
"err.timeout": "
|
|
372
|
+
"err.timeout": "Proses melewati batas waktu",
|
|
336
373
|
"err.timeoutFix": "Naikkan --timeout atau pakai model lebih cepat.",
|
|
337
374
|
"err.steps": "Batas langkah tool tercapai",
|
|
338
375
|
"err.stepsFix": "Progres sudah tersimpan — lanjutkan via /resume, atau naikkan --max-steps.",
|
|
339
376
|
"err.budget": "Budget sesi terlampaui",
|
|
340
377
|
"err.budgetFix": "Mulai sesi baru atau naikkan --budget.",
|
|
341
|
-
"err.busy": "
|
|
342
|
-
"err.busyFix": "Tunggu
|
|
343
|
-
"err.aborted": "
|
|
378
|
+
"err.busy": "Proses masih berjalan",
|
|
379
|
+
"err.busyFix": "Tunggu proses berjalan selesai.",
|
|
380
|
+
"err.aborted": "Proses dibatalkan",
|
|
344
381
|
"common.active": "aktif",
|
|
345
382
|
"panel.group.explore": "jelajah",
|
|
346
383
|
"panel.group.edit": "ubah",
|
|
@@ -348,7 +385,7 @@ export const id: Record<MsgKey, string> = {
|
|
|
348
385
|
"panel.group.feed": "sumber",
|
|
349
386
|
"panel.group.other": "lainnya",
|
|
350
387
|
"panel.tools": "{n} tool",
|
|
351
|
-
"panel.ok": "{n}
|
|
388
|
+
"panel.ok": "{n} selesai",
|
|
352
389
|
"panel.failed": "{n} gagal",
|
|
353
390
|
"panel.denied": "{n} ditolak",
|
|
354
391
|
"panel.cancelled": "{n} dibatalkan",
|
|
@@ -361,7 +398,7 @@ export const id: Record<MsgKey, string> = {
|
|
|
361
398
|
"loading.checking": "memeriksa pembaruan",
|
|
362
399
|
"loading.installing": "memasang pembaruan",
|
|
363
400
|
"loading.restarting": "memulai ulang",
|
|
364
|
-
"loading.provider": "menyiapkan
|
|
401
|
+
"loading.provider": "menyiapkan penyedia",
|
|
365
402
|
"loading.rag": "memuat konteks",
|
|
366
403
|
"loading.session": "menyiapkan sesi",
|
|
367
404
|
"loading.finalize": "menyelesaikan",
|
package/src/ui/input/input.ts
CHANGED
|
@@ -247,6 +247,7 @@ export async function askLine(opts: AskLineOptions = {}): Promise<string | null>
|
|
|
247
247
|
process.stdin.setRawMode(true)
|
|
248
248
|
process.stdin.resume()
|
|
249
249
|
} catch (e) {
|
|
250
|
+
endScreen()
|
|
250
251
|
reject(e)
|
|
251
252
|
return
|
|
252
253
|
}
|
|
@@ -869,12 +870,12 @@ export async function askSecret(
|
|
|
869
870
|
process.stdout.write(`${"\b \b".repeat(removed)}`)
|
|
870
871
|
}
|
|
871
872
|
} else if (k.type === "char") {
|
|
872
|
-
// Sekuens kontrol dari paste dibuang — secret tidak boleh
|
|
873
|
-
// mengandung newline/C0 (Enter adalah satu-satunya terminasi).
|
|
873
|
+
// Sekuens kontrol dari paste dibuang (C0 + C1) — secret tidak boleh
|
|
874
|
+
// mengandung newline/C0/C1 (Enter adalah satu-satunya terminasi).
|
|
874
875
|
const clean = k.ch
|
|
875
876
|
.replace(/\r\n|\r|\n|\t/g, "")
|
|
876
877
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: membuang kontrol dari paste
|
|
877
|
-
.replace(/[\u0000-\u0008\u000b-\u001f\u007f]/g, "")
|
|
878
|
+
.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g, "")
|
|
878
879
|
if (clean) {
|
|
879
880
|
secret += clean
|
|
880
881
|
process.stdout.write(glyphs.mask.repeat(toGraphemes(clean).length))
|
|
@@ -293,9 +293,12 @@ export function applyKey(
|
|
|
293
293
|
return { state: { ...state, sel: (state.sel + 1) % n }, action: "render" }
|
|
294
294
|
}
|
|
295
295
|
case "tab": {
|
|
296
|
-
|
|
297
|
-
//
|
|
298
|
-
|
|
296
|
+
if (!state.menuOpen) return { state, action: "none" }
|
|
297
|
+
// Lengkapi item terpilih (atau saran teratas jika sel=-1) tanpa langsung
|
|
298
|
+
// mengeksekusi agar operator masih bisa menambah argumen atau Enter.
|
|
299
|
+
const pick = pickSelected(state.line) ?? hints(state.line)[0]
|
|
300
|
+
if (!pick) return { state, action: "none" }
|
|
301
|
+
return { state: completeTo(pick), action: "render" }
|
|
299
302
|
}
|
|
300
303
|
case "enter": {
|
|
301
304
|
const pick = pickSelected(state.line)
|
|
@@ -413,6 +416,8 @@ export function createDecoderState(): DecoderState {
|
|
|
413
416
|
|
|
414
417
|
// Bound incomplete control sequences independently of bracketed paste payloads.
|
|
415
418
|
const MAX_CONTROL_SEQUENCE_BYTES = 64
|
|
419
|
+
/** Batas aman payload bracketed paste bila terminator ESC[201~ tidak kunjung tiba. */
|
|
420
|
+
const MAX_PASTE_BYTES = 512 * 1024
|
|
416
421
|
|
|
417
422
|
function isCsiParam(b: number): boolean {
|
|
418
423
|
return b >= 0x30 && b <= 0x3f
|
|
@@ -480,6 +485,7 @@ function asciiKey(b: number): DecodedKey | null {
|
|
|
480
485
|
* di `state.pending` untuk chunk berikutnya. Key dikembalikan berurutan.
|
|
481
486
|
*/
|
|
482
487
|
export function decodeKeysStream(chunk: Uint8Array, state: DecoderState): DecodedKey[] {
|
|
488
|
+
const pendingCount = state.pending.length
|
|
483
489
|
const buf = state.pending.concat([...chunk])
|
|
484
490
|
const out: DecodedKey[] = []
|
|
485
491
|
let i = 0
|
|
@@ -527,7 +533,16 @@ export function decodeKeysStream(chunk: Uint8Array, state: DecoderState): Decode
|
|
|
527
533
|
break
|
|
528
534
|
}
|
|
529
535
|
}
|
|
530
|
-
if (term === -1)
|
|
536
|
+
if (term === -1) {
|
|
537
|
+
// Batas defensif bila terminal crash sebelum mengirim penutup ESC[201~:
|
|
538
|
+
// jangan tahan buffer tanpa batas sampai membekukan seluruh input.
|
|
539
|
+
if (buf.length - (i + 6) > MAX_PASTE_BYTES) {
|
|
540
|
+
out.push({ key: { type: "char", ch: decodeUtf8(buf.slice(i + 6)) }, width: 0 })
|
|
541
|
+
i = buf.length
|
|
542
|
+
continue
|
|
543
|
+
}
|
|
544
|
+
break // penutup belum tiba — tahan
|
|
545
|
+
}
|
|
531
546
|
out.push({ key: { type: "char", ch: decodeUtf8(buf.slice(i + 6, term)) }, width: 0 })
|
|
532
547
|
i = term + 6
|
|
533
548
|
continue
|
|
@@ -616,6 +631,14 @@ export function decodeKeysStream(chunk: Uint8Array, state: DecoderState): Decode
|
|
|
616
631
|
i = j
|
|
617
632
|
continue
|
|
618
633
|
}
|
|
634
|
+
// Alt+Enter: ESC + CR (`\x1b\r`) → sisip newline, bukan batal/Esc.
|
|
635
|
+
// Hanya cocokkan bila tiba dalam chunk yang SAMA (`i >= pendingCount`),
|
|
636
|
+
// bukan `Esc` yang masih menunggu timer 50ms lalu diikuti `Enter` cepat.
|
|
637
|
+
if (n1 === 0x0d && i >= pendingCount) {
|
|
638
|
+
out.push({ key: { type: "ctrl-j" }, width: 2 })
|
|
639
|
+
i += 2
|
|
640
|
+
continue
|
|
641
|
+
}
|
|
619
642
|
// ESC + byte lain: ESC tunggal (lengkap, tidak menunggu apa pun).
|
|
620
643
|
out.push({ key: { type: "esc" }, width: 0 })
|
|
621
644
|
i += 1
|
|
@@ -854,9 +877,16 @@ export function decodeKey(s: string, i: number): DecodedKey | null {
|
|
|
854
877
|
// Tanpa cabang eksplisit ini ia jatuh ke catch-all "esc" di bawah,
|
|
855
878
|
// sehingga tipe "shift-tab" tidak pernah dihasilkan decodeKeys.
|
|
856
879
|
if (kind === "Z") return { key: { type: "shift-tab" }, width: 3 }
|
|
880
|
+
// Shift+Enter / Alt+Enter modern: CSI-u (`\x1b[13;2u` / `\x1b[13;3u`) atau
|
|
881
|
+
// modifyOtherKeys (`\x1b[27;2;13~` / `\x1b[27;3;13~`) → sisip newline.
|
|
882
|
+
const csiWidth = scanCsi(s, i)
|
|
883
|
+
if (/^(?:13;[23]u|27;[23];13~)$/.test(s.slice(i + 2, i + csiWidth))) {
|
|
884
|
+
return { key: { type: "ctrl-j" }, width: csiWidth }
|
|
885
|
+
}
|
|
857
886
|
// ESC [ … lainnya -> konsumsi saja
|
|
858
|
-
return { key: { type: "ignore" }, width:
|
|
887
|
+
return { key: { type: "ignore" }, width: csiWidth }
|
|
859
888
|
}
|
|
889
|
+
if (s[i + 1] === "\r") return { key: { type: "ctrl-j" }, width: 2 }
|
|
860
890
|
return { key: { type: "esc" }, width: 1 }
|
|
861
891
|
}
|
|
862
892
|
if (code === 0x01) return { key: { type: "home" }, width: 1 } // Ctrl+A
|
|
@@ -10,7 +10,7 @@ import type { UiPresentationActivity } from "../contract.ts"
|
|
|
10
10
|
import { t } from "../i18n/locale.ts"
|
|
11
11
|
import { activityGroup } from "./activity-group.ts"
|
|
12
12
|
import { sanitizeAnsiLine, stripSgr } from "./sanitize.ts"
|
|
13
|
-
import { c } from "./theme.ts"
|
|
13
|
+
import { c, glyphs } from "./theme.ts"
|
|
14
14
|
import { truncateToWidth } from "./width.ts"
|
|
15
15
|
/** Satu grup teragregasi (dipakai renderer + /expand buffer). */
|
|
16
16
|
export interface ActivityGroupView {
|
|
@@ -105,7 +105,9 @@ export function groupLine(g: ActivityGroupView): string {
|
|
|
105
105
|
const names = g.names.map((n) => sanitizeAnsiLine(n)).join(", ")
|
|
106
106
|
const more = Math.max(0, g.nameTotal - g.names.length)
|
|
107
107
|
if (names)
|
|
108
|
-
parts.push(
|
|
108
|
+
parts.push(
|
|
109
|
+
`${glyphs.dot} ${truncateToWidth(names, MAX_PANEL_LABEL, glyphs.ellipsis)}${more > 0 ? ` +${more}` : ""}`,
|
|
110
|
+
)
|
|
109
111
|
return groupPaint(g)(parts.join(" "))
|
|
110
112
|
}
|
|
111
113
|
|
package/src/ui/render/hint.ts
CHANGED
|
@@ -20,9 +20,12 @@ export function paintHint(item: HintItem): string {
|
|
|
20
20
|
return `${c.accent(item.key)} ${c.dim(item.label)}`
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
/** Satu baris hint: `a
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
/** Satu baris hint: `a tambah d hapus Esc batal` — pemisah HANYA spasi.
|
|
24
|
+
*
|
|
25
|
+
* Keputusan produk: grammar minimalis tanpa `·`, titik dua, atau label tambahan.
|
|
26
|
+
* Kunci berwarna accent (lebih terang), label dim; tanpa pembungkus faint di
|
|
27
|
+
* seluruh baris karena SGR 2 akan meredupkan kunci juga. ASCII fallback tetap
|
|
28
|
+
* ditanggung pemanggil lewat `glyphs` (mis. `glyphs.upDown`). */
|
|
26
29
|
export function hintLine(items: readonly HintItem[]): string {
|
|
27
|
-
return items.map(paintHint).join(
|
|
30
|
+
return items.map(paintHint).join(" ")
|
|
28
31
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Baris daftar pilihan: kolom marker SELALU dicadangkan agar label tidak
|
|
2
|
+
// bergeser satu kolom saat seleksi berpindah. Satu sumber untuk picker,
|
|
3
|
+
// manager model/provider, dan modal approval — sebelumnya prefix selected
|
|
4
|
+
// 4 kolom vs unselected 3 kolom (jitter) dan approval tanpa marker `›`.
|
|
5
|
+
import { sanitizeAnsiLine } from "./sanitize.ts"
|
|
6
|
+
import { c, glyphs } from "./theme.ts"
|
|
7
|
+
import { displayWidth, segmentGraphemes } from "./width.ts"
|
|
8
|
+
|
|
9
|
+
export function listRow(label: string, selected: boolean): string {
|
|
10
|
+
return selected ? ` ${c.accent(glyphs.arrow)} ${c.accent(c.bold(label))}` : ` ${c.dim(label)}`
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Ambil akhiran query agar muat dalam `maxCols` saat diketik panjang di kotak
|
|
15
|
+
* filter (picker & model-manager), sehingga kursor tetap berada di dalam kotak.
|
|
16
|
+
*/
|
|
17
|
+
export function tailFilterWindow(text: string, maxCols: number): string {
|
|
18
|
+
const clean = sanitizeAnsiLine(text)
|
|
19
|
+
if (displayWidth(clean) <= maxCols) return clean
|
|
20
|
+
const ell = glyphs.ellipsis
|
|
21
|
+
const budget = Math.max(1, maxCols - displayWidth(ell))
|
|
22
|
+
const pts = segmentGraphemes(clean)
|
|
23
|
+
const kept: string[] = []
|
|
24
|
+
let w = 0
|
|
25
|
+
for (let i = pts.length - 1; i >= 0; i--) {
|
|
26
|
+
const gw = displayWidth(pts[i] ?? "")
|
|
27
|
+
if (w + gw > budget) break
|
|
28
|
+
kept.unshift(pts[i]!)
|
|
29
|
+
w += gw
|
|
30
|
+
}
|
|
31
|
+
return `${ell}${kept.join("")}`
|
|
32
|
+
}
|
|
@@ -6,7 +6,7 @@ import { highlightCode } from "./highlight.ts"
|
|
|
6
6
|
import { type MarkdownTable, parseMarkdownBlocks } from "./markdown-table.ts"
|
|
7
7
|
import { sanitizeAnsi } from "./sanitize.ts"
|
|
8
8
|
import { renderMarkdownTable } from "./table-grid.ts"
|
|
9
|
-
import { c } from "./theme.ts"
|
|
9
|
+
import { c, glyphs } from "./theme.ts"
|
|
10
10
|
|
|
11
11
|
export { renderMarkdownTable, renderMarkdownTableLines } from "./table-grid.ts"
|
|
12
12
|
|
|
@@ -105,6 +105,7 @@ export function decorateMarkdown(text: string): string {
|
|
|
105
105
|
fenceChar = fence.char
|
|
106
106
|
fenceLen = fence.len
|
|
107
107
|
fenceLang = fence.lang
|
|
108
|
+
if (fenceLang) out.push(c.dim(` ${glyphs.dot} ${fenceLang}`))
|
|
108
109
|
} else {
|
|
109
110
|
if (fence.char === fenceChar && fence.len >= fenceLen) {
|
|
110
111
|
inFence = false
|
|
@@ -113,7 +114,8 @@ export function decorateMarkdown(text: string): string {
|
|
|
113
114
|
fenceLang = ""
|
|
114
115
|
} else {
|
|
115
116
|
// fence di dalam fence dengan char/len berbeda → anggap konten
|
|
116
|
-
|
|
117
|
+
const bar = fenceLang ? c.dim(glyphs.vLine) : glyphs.vLine
|
|
118
|
+
out.push(` ${bar} ${fenceLang ? highlightCode(line, fenceLang) : line}`)
|
|
117
119
|
continue
|
|
118
120
|
}
|
|
119
121
|
}
|
|
@@ -127,7 +129,8 @@ export function decorateMarkdown(text: string): string {
|
|
|
127
129
|
// `npm run build -- --flag=*value*` kehilangan bintangnya karena dianggap
|
|
128
130
|
// italic. Fence tanpa bahasa justru bentuk paling umum untuk perintah shell.
|
|
129
131
|
if (inFence) {
|
|
130
|
-
|
|
132
|
+
const bar = fenceLang ? c.dim(glyphs.vLine) : glyphs.vLine
|
|
133
|
+
out.push(` ${bar} ${fenceLang ? highlightCode(line, fenceLang) : line}`)
|
|
131
134
|
continue
|
|
132
135
|
}
|
|
133
136
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Struk aksi pendek di dalam popup (sukses/gagal/info). Satu sumber agar
|
|
2
|
+
// manager model & penyedia tidak lagi merender error sebagai teks redup tanpa
|
|
3
|
+
// kata status: error = merah + pesan kanonik, sukses = hijau, info = redup.
|
|
4
|
+
import { sanitizeAnsiLine } from "./sanitize.ts"
|
|
5
|
+
import { c } from "./theme.ts"
|
|
6
|
+
|
|
7
|
+
export type NoticeKind = "success" | "error" | "info"
|
|
8
|
+
|
|
9
|
+
export function paintNotice(kind: NoticeKind, text: string): string {
|
|
10
|
+
const clean = sanitizeAnsiLine(text)
|
|
11
|
+
if (kind === "success") return c.success(clean)
|
|
12
|
+
if (kind === "error") return c.error(clean)
|
|
13
|
+
return c.dim(clean)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Notice multi-baris (formatError membawa baris `→ fix`). */
|
|
17
|
+
export function paintNoticeLines(kind: NoticeKind, text: string): string[] {
|
|
18
|
+
return text.split("\n").map((line) => paintNotice(kind, line))
|
|
19
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MarkdownTable, PipeTableAlignment } from "./markdown-table.ts"
|
|
2
2
|
import { cleanUntrusted, sanitizeAnsiLine, stripSgr } from "./sanitize.ts"
|
|
3
|
-
import { c, getTerminalWidth, supportsUtf8 } from "./theme.ts"
|
|
3
|
+
import { c, getTerminalWidth, glyphs, supportsUtf8 } from "./theme.ts"
|
|
4
4
|
import {
|
|
5
5
|
displayWidth,
|
|
6
6
|
graphemeWidth,
|
|
@@ -40,7 +40,6 @@ export interface GridRenderOptions {
|
|
|
40
40
|
fairMinimums?: boolean
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const DEFAULT_ELLIPSIS = "…"
|
|
44
43
|
const DEFAULT_MAX_CELL_WIDTH = 50
|
|
45
44
|
const MIN_CONTENT_WIDTH = 3
|
|
46
45
|
/** Margin kiri kotak tabel — biar tidak menempel ke tepi terminal. */
|
|
@@ -241,11 +240,11 @@ function renderBorderedGrid(
|
|
|
241
240
|
h: "-",
|
|
242
241
|
v: "|",
|
|
243
242
|
}
|
|
244
|
-
|
|
245
|
-
//
|
|
246
|
-
//
|
|
243
|
+
const cellEllipsis = options.ellipsis ?? glyphs.ellipsis
|
|
244
|
+
// Guard terakhir: baris sel TIDAK BOLEH lebih lebar dari kolomnya. Pakai
|
|
245
|
+
// ellipsis runtime (bukan kosong) supaya pemotongan token tetap terbaca.
|
|
247
246
|
const fitCellLine = (line: string, colWidth: number): string =>
|
|
248
|
-
displayWidth(line) > colWidth ? truncateToWidth(line, colWidth,
|
|
247
|
+
displayWidth(line) > colWidth ? truncateToWidth(line, colWidth, cellEllipsis) : line
|
|
249
248
|
// Sel yang seluruhnya satu token tanpa spasi (identifier, path, hash, URL
|
|
250
249
|
// pendek) tidak punya titik patah yang wajar untuk dibaca user.
|
|
251
250
|
const hasNoBreakOpportunity = (plain: string): boolean => !/[\s\-_/.]/.test(plain.trim())
|
|
@@ -301,7 +300,7 @@ export function renderGridTable(table: GridTable, options: GridRenderOptions = {
|
|
|
301
300
|
const width = Number.isFinite(requestedTotalWidth)
|
|
302
301
|
? Math.max(1, Math.trunc(requestedTotalWidth))
|
|
303
302
|
: getTerminalWidth()
|
|
304
|
-
const ellipsis = options.ellipsis ??
|
|
303
|
+
const ellipsis = options.ellipsis ?? glyphs.ellipsis
|
|
305
304
|
const requestedMaxCellWidth = options.maxCellWidth ?? DEFAULT_MAX_CELL_WIDTH
|
|
306
305
|
const maxCellWidth = Number.isFinite(requestedMaxCellWidth)
|
|
307
306
|
? Math.max(1, Math.trunc(requestedMaxCellWidth))
|
|
@@ -338,7 +337,7 @@ export function renderGridTable(table: GridTable, options: GridRenderOptions = {
|
|
|
338
337
|
|
|
339
338
|
if (options.box) return renderBorderedGrid(table, widths, aligns, styleHeader, options)
|
|
340
339
|
|
|
341
|
-
const separator = c.dim(widths.map((value) =>
|
|
340
|
+
const separator = c.dim(widths.map((value) => glyphs.hLine.repeat(value + 2)).join(" "))
|
|
342
341
|
|
|
343
342
|
if (options.wrap) {
|
|
344
343
|
// Wrap isi sel di batas kolom (BUKAN truncate) agar info panjang tidak hilang
|