minicode-ai 0.28.0 → 0.30.1

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 (41) hide show
  1. package/README.md +1 -1
  2. package/cli/args.ts +93 -70
  3. package/cli/bootstrap/presentation-bridge.ts +383 -0
  4. package/cli/commands/acp.ts +7 -1
  5. package/cli/commands/doctor.ts +7 -3
  6. package/cli/commands/exec.ts +6 -16
  7. package/cli/index.ts +3 -2
  8. package/cli/setup.ts +13 -380
  9. package/cli/tui.ts +3 -4
  10. package/docs/TERMINAL_CONTRACT.md +28 -21
  11. package/docs/UI_RENDER_PIPELINE.md +3 -3
  12. package/docs/architecture.md +14 -29
  13. package/docs/environment.md +1 -1
  14. package/package.json +1 -1
  15. package/src/app/session.ts +201 -53
  16. package/src/app/tool-layer.ts +27 -0
  17. package/src/lib/atomic-write.ts +31 -59
  18. package/src/policy/jail.ts +6 -8
  19. package/src/providers/anthropic.ts +16 -5
  20. package/src/providers/responses.ts +37 -7
  21. package/src/providers/sse-bounds.ts +6 -4
  22. package/src/session/db/runs.ts +397 -0
  23. package/src/session/db/schema.ts +358 -0
  24. package/src/session/persistence.ts +64 -955
  25. package/src/task/db/schema.ts +325 -0
  26. package/src/task/db/types.ts +269 -0
  27. package/src/task/store.ts +74 -986
  28. package/src/ui/assistant/simple.ts +25 -19
  29. package/src/ui/i18n/en.ts +0 -3
  30. package/src/ui/i18n/id.ts +0 -3
  31. package/src/ui/render/logo.ts +15 -18
  32. package/src/ui/render/markdown-layout.ts +293 -0
  33. package/src/ui/render/markdown.ts +36 -44
  34. package/src/ui/render/session-summary.ts +1 -1
  35. package/src/ui/render/table-grid.ts +16 -7
  36. package/src/ui/render/width.ts +71 -18
  37. package/src/ui/render/wrap.ts +39 -22
  38. package/src/ui/session-state.ts +4 -4
  39. package/src/ui/tui/app.ts +15 -36
  40. package/src/ui/tui/transcript.ts +111 -50
  41. package/vendor/minicore/src/providers/openai-compat.ts +7 -0
@@ -1,3 +1,4 @@
1
+ import { effectiveAssistantMargin } from "./markdown-layout.ts"
1
2
  import type { MarkdownTable, PipeTableAlignment } from "./markdown-table.ts"
2
3
  import { cleanUntrusted, sanitizeAnsiLine, stripSgr } from "./sanitize.ts"
3
4
  import { c, getTerminalWidth, glyphs, supportsUtf8 } from "./theme.ts"
@@ -42,8 +43,6 @@ export interface GridRenderOptions {
42
43
 
43
44
  const DEFAULT_MAX_CELL_WIDTH = 50
44
45
  const MIN_CONTENT_WIDTH = 3
45
- /** Margin kiri kotak tabel — biar tidak menempel ke tepi terminal. */
46
- const BOX_MARGIN = 1
47
46
 
48
47
  function cleanCell(value: unknown): string {
49
48
  return cleanUntrusted(
@@ -212,6 +211,7 @@ function renderBorderedGrid(
212
211
  aligns: readonly PipeTableAlignment[],
213
212
  styleHeader: boolean,
214
213
  options: GridRenderOptions,
214
+ margin: number,
215
215
  ): string {
216
216
  const g = supportsUtf8()
217
217
  ? {
@@ -290,7 +290,8 @@ function renderBorderedGrid(
290
290
  for (let li = 0; li < height; li++) out.push(rowLine(cols, li))
291
291
  }
292
292
  out.push(horiz(g.bl, g.bm, g.br))
293
- return out.map((line) => " ".repeat(BOX_MARGIN) + line).join("\n")
293
+ const pad = margin > 0 ? " ".repeat(margin) : ""
294
+ return pad ? out.map((line) => pad + line).join("\n") : out.join("\n")
294
295
  }
295
296
 
296
297
  export function renderGridTable(table: GridTable, options: GridRenderOptions = {}): string {
@@ -311,9 +312,10 @@ export function renderGridTable(table: GridTable, options: GridRenderOptions = {
311
312
  : MIN_CONTENT_WIDTH
312
313
  // Overhead batas: format kotak `│ c │` memakan 2 kolom lebih banyak per baris
313
314
  // (baris batas `│` + padding) daripada format separator lama ` c ` + spasi.
314
- // `BOX_MARGIN` = margin kiri agar kotak tidak nempel ke tepi terminal.
315
+ // Margin kiri kotak tabel diselaraskan dengan margin area teks asisten.
316
+ const boxMargin = options.box ? effectiveAssistantMargin(width) : 0
315
317
  const overhead = options.box
316
- ? table.headers.length * 3 + 1 + BOX_MARGIN
318
+ ? table.headers.length * 3 + 1 + boxMargin
317
319
  : table.headers.length * 3 - 1
318
320
  const budget = width - overhead
319
321
  const natural = naturalWidths(table, maxCellWidth)
@@ -330,12 +332,19 @@ export function renderGridTable(table: GridTable, options: GridRenderOptions = {
330
332
  budget < minimums.reduce((sum, value) => sum + value, 0)
331
333
  ? null
332
334
  : fitWidths(natural, budget, minimums)
333
- if (!widths) return renderVertical(table, width, ellipsis).join("\n")
335
+ if (!widths) {
336
+ const vMargin = options.box ? effectiveAssistantMargin(width) : 0
337
+ const lines = renderVertical(table, Math.max(1, width - vMargin), ellipsis)
338
+ .join("\n")
339
+ .split("\n")
340
+ const pad = vMargin > 0 ? " ".repeat(vMargin) : ""
341
+ return (pad ? lines.map((l) => (l ? pad + l : l)) : lines).join("\n")
342
+ }
334
343
 
335
344
  const aligns = table.aligns ?? table.headers.map(() => "left" as const)
336
345
  const styleHeader = options.styleHeader !== false
337
346
 
338
- if (options.box) return renderBorderedGrid(table, widths, aligns, styleHeader, options)
347
+ if (options.box) return renderBorderedGrid(table, widths, aligns, styleHeader, options, boxMargin)
339
348
 
340
349
  const separator = c.dim(widths.map((value) => glyphs.hLine.repeat(value + 2)).join(" "))
341
350
 
@@ -349,13 +349,8 @@ export function padToWidth(s: string, width: number, align: "left" | "right" = "
349
349
  return align === "right" ? pad + s : s + pad
350
350
  }
351
351
 
352
- /**
353
- * Pecah string menjadi potongan yang masing-masing <= `width` kolom.
354
- * Dipakai untuk teks tanpa spasi (CJK, URL panjang, hash) yang tidak bisa
355
- * dipecah di batas kata.
356
- */
357
- export function chunkByWidth(s: string, width: number): string[] {
358
- if (width <= 0) return [""]
352
+ function chunkByWidthCore(s: string, firstWidth: number, contWidth: number): string[] {
353
+ if (firstWidth <= 0 || contWidth <= 0) return [""]
359
354
  const out: string[] = []
360
355
  let cur = ""
361
356
  let w = 0
@@ -389,7 +384,8 @@ export function chunkByWidth(s: string, width: number): string[] {
389
384
  cur += seq
390
385
  continue
391
386
  }
392
- if (w + token.width > width && cur !== "") {
387
+ const limit = out.length === 0 ? firstWidth : contWidth
388
+ if (w + token.width > limit && cur !== "") {
393
389
  pushChunk()
394
390
  }
395
391
  cur += token.text
@@ -399,6 +395,28 @@ export function chunkByWidth(s: string, width: number): string[] {
399
395
  return out.length ? out : [""]
400
396
  }
401
397
 
398
+ /**
399
+ * Pecah string menjadi potongan per-kolom, dengan anggaran baris pertama dan
400
+ * baris lanjutan terpisah (dipakai word-wrap ber-indentasi gantung).
401
+ */
402
+ export function chunkByWidthSplit(s: string, firstWidth: number, contWidth: number): string[] {
403
+ return chunkByWidthCore(s, firstWidth, contWidth)
404
+ }
405
+
406
+ /**
407
+ * Pecah string menjadi potongan yang masing-masing <= `width` kolom.
408
+ * Dipakai untuk teks tanpa spasi (CJK, URL panjang, hash) yang tidak bisa
409
+ * dipecah di batas kata.
410
+ */
411
+ export function chunkByWidth(s: string, width: number): string[] {
412
+ return chunkByWidthCore(s, width, width)
413
+ }
414
+
415
+ export interface WrapByWidthOptions {
416
+ /** Indentasi gantung (kolom spasi) yang disisipkan di awal setiap baris lanjutan. */
417
+ hangingIndent?: string
418
+ }
419
+
402
420
  /**
403
421
  * Pecah string ke potongan <= `width` kolom, TAPI word-aware: lebih suka
404
422
  * memutus di batas kata (spasi) daripada membelah kata di tengah. Token tanpa
@@ -409,12 +427,22 @@ export function chunkByWidth(s: string, width: number): string[] {
409
427
  * Spasi yang tepat TIDAK muat menjadi titik putus; spasi itu (dan spasi-trailing
410
428
  * yang tak terlihat) dibuang, bukan dipindah ke baris berikutnya.
411
429
  */
412
- export function wrapByWidth(s: string, width: number): string[] {
430
+ export function wrapByWidth(s: string, width: number, options?: WrapByWidthOptions): string[] {
413
431
  if (width <= 0) return [""]
432
+ const rawHang = options?.hangingIndent ?? ""
433
+ const rawHangWidth = rawHang ? displayWidth(rawHang) : 0
434
+ // Jangan biarkan indentasi gantung menutup seluruh lebar baris — minimal 1 kolom isi.
435
+ const effectiveHang = rawHangWidth > 0 && rawHangWidth < width ? rawHang : ""
436
+ const effectiveHangWidth = effectiveHang ? rawHangWidth : 0
437
+ const contBudget = Math.max(1, width - effectiveHangWidth)
438
+
414
439
  const out: string[] = []
415
440
  let line = ""
416
441
  let lineWidth = 0
442
+ let plainIndent = ""
443
+ let lineHasWord = false
417
444
  let openSgr: string[] = []
445
+ let openSgrBeforeWord: string[] = []
418
446
  let word = ""
419
447
  let wordWidth = 0
420
448
 
@@ -430,36 +458,56 @@ export function wrapByWidth(s: string, width: number): string[] {
430
458
 
431
459
  const flush = (): void => {
432
460
  if (line !== "") out.push(openSgr.length > 0 ? `${line}\x1b[0m` : line)
433
- line = openSgr.join("")
434
- lineWidth = 0
461
+ // Indentasi gantung diletakkan SEBELUM SGR terbuka agar spasi margin/indentasi
462
+ // tidak ikut mendapat gaya warna/latar teks di baris lanjutan.
463
+ line = effectiveHang + openSgr.join("")
464
+ lineWidth = effectiveHangWidth
465
+ plainIndent = effectiveHang
466
+ lineHasWord = false
435
467
  }
436
468
 
437
469
  const placeWord = (): void => {
438
470
  if (wordWidth === 0) {
471
+ if (word) line += word
439
472
  word = ""
473
+ openSgrBeforeWord = [...openSgr]
440
474
  return
441
475
  }
442
476
  if (lineWidth + wordWidth <= width) {
443
477
  line += word
444
478
  lineWidth += wordWidth
445
- } else if (wordWidth <= width) {
479
+ lineHasWord = true
480
+ } else if (wordWidth <= contBudget) {
446
481
  // Kata utuh pindah ke baris berikutnya (bukan dibelah di tengah).
447
482
  flush()
448
483
  line += word
449
484
  lineWidth += wordWidth
485
+ lineHasWord = true
450
486
  } else {
451
- // Token tanpa spasi > width: potong per kolom (chunkByWidth, sgr-safe).
452
- if (lineWidth > 0) flush()
453
- const pieces = chunkByWidth(word, width)
487
+ // Token tanpa spasi > sisa anggaran: potong per kolom (chunkByWidthCore, sgr-safe).
488
+ if (lineHasWord) flush()
489
+ const firstBudget = Math.max(1, width - lineWidth)
490
+ const pieces = chunkByWidthCore(openSgrBeforeWord.join("") + word, firstBudget, contBudget)
454
491
  for (let i = 0; i < pieces.length - 1; i++) {
492
+ const prefix = i === 0 ? plainIndent : effectiveHang
455
493
  const piece = pieces[i]!
456
- out.push(openSgr.length > 0 && !piece.endsWith("\x1b[0m") ? `${piece}\x1b[0m` : piece)
494
+ out.push(prefix + piece)
457
495
  }
458
- line = pieces[pieces.length - 1] ?? ""
496
+ let lastPiece = pieces[pieces.length - 1] ?? ""
497
+ // Jika masih ada SGR terbuka setelah kata ini, lepas `\x1b[0m` penutup
498
+ // sementara dari chunkByWidthCore agar kata berikutnya di baris yang sama
499
+ // tetap mewarisi gaya aslinya.
500
+ if (openSgr.length > 0 && lastPiece.endsWith("\x1b[0m")) {
501
+ lastPiece = lastPiece.slice(0, -4)
502
+ }
503
+ const lastPrefix = pieces.length === 1 ? plainIndent : effectiveHang
504
+ line = lastPrefix + lastPiece
459
505
  lineWidth = displayWidth(line)
506
+ lineHasWord = true
460
507
  }
461
508
  word = ""
462
509
  wordWidth = 0
510
+ openSgrBeforeWord = [...openSgr]
463
511
  }
464
512
 
465
513
  for (const token of displayTokens(s)) {
@@ -475,6 +523,7 @@ export function wrapByWidth(s: string, width: number): string[] {
475
523
  if (lineWidth + 1 <= width) {
476
524
  line += " "
477
525
  lineWidth += 1
526
+ if (!lineHasWord) plainIndent += " "
478
527
  }
479
528
  continue
480
529
  }
@@ -482,6 +531,10 @@ export function wrapByWidth(s: string, width: number): string[] {
482
531
  wordWidth += token.width
483
532
  }
484
533
  placeWord()
485
- if (line !== "" || out.length === 0) flush()
534
+ if (out.length === 0 || lineHasWord || lineWidth > effectiveHangWidth) {
535
+ if (line !== "" || out.length === 0) {
536
+ out.push(openSgr.length > 0 ? `${line}\x1b[0m` : line)
537
+ }
538
+ }
486
539
  return out.length ? out : [""]
487
540
  }
@@ -8,8 +8,9 @@
8
8
  // yang di sini tidak ikut diperbaiki saat pola ANSI diperluas untuk sekuens
9
9
  // private-mode (ESC[?25l dsb.).
10
10
 
11
+ import { computeHangingIndent } from "./markdown-layout.ts"
11
12
  import { stripAnsi } from "./theme.ts"
12
- import { chunkByWidth, displayWidth } from "./width.ts"
13
+ import { chunkByWidthSplit, displayWidth } from "./width.ts"
13
14
 
14
15
  export { stripAnsi }
15
16
 
@@ -34,13 +35,20 @@ export function wordWrap(text: string, width: number): string {
34
35
  out.push(line)
35
36
  continue
36
37
  }
38
+ const hang = computeHangingIndent(line, width)
39
+ const hangWidth = hang ? displayWidth(hang) : 0
37
40
  let current = ""
41
+ let lineIndex = 0
42
+ const emitLine = (textOut: string) => {
43
+ out.push(textOut)
44
+ lineIndex++
45
+ }
38
46
  const flush = () => {
39
- if (current !== "") {
47
+ if (current !== "" && (lineIndex === 0 || current.trim() !== "")) {
40
48
  // Spasi pemisah di ujung tidak ikut tampil.
41
- out.push(current.trimEnd())
42
- current = ""
49
+ emitLine(current.trimEnd())
43
50
  }
51
+ current = ""
44
52
  }
45
53
  // Pisah dengan pemisah tertangkap agar spasi ganda (ASCII art/tabel)
46
54
  // tetap utuh — run whitespace menempel ke kata berikut, wrap hanya putus
@@ -56,25 +64,35 @@ export function wordWrap(text: string, width: number): string {
56
64
  continue
57
65
  }
58
66
  const word = tok
59
- // Kata tunggal lebih lebar dari baris: pecah paksa per kolom.
60
- if (displayWidth(word) > width) {
67
+ const contBudget = Math.max(1, width - hangWidth)
68
+ // Kata tunggal lebih lebar dari sisa lebar baris lanjutan: pecah paksa per kolom.
69
+ if (
70
+ displayWidth(word) > contBudget &&
71
+ (displayWidth(word) > width || current.trim() !== "")
72
+ ) {
61
73
  // Indentasi (bila ada) menempel ke potongan PERTAMA dan menyusutkan
62
74
  // lebar potongan itu — tanpa ini indentasi hilang atau baris meluap.
63
75
  const lead = current.trim() === "" ? current : ""
64
76
  // Teks yang sudah terkumpul (bila ada) ditutup dulu; hanya indentasi
65
77
  // murni yang ikut menempel ke potongan pertama.
66
- if (current.trim() !== "") out.push(current.trimEnd())
78
+ if (current.trim() !== "") emitLine(current.trimEnd())
67
79
  current = ""
68
- const avail = Math.max(1, width - displayWidth(lead))
69
- const pieces = chunkByWidth(word, avail)
70
- if (lead && pieces.length > 0) {
71
- out.push(lead + (pieces[0] ?? ""))
72
- for (let i = 1; i < pieces.length - 1; i++) out.push(pieces[i]!)
73
- current = pieces[pieces.length - 1] ?? ""
74
- if (pieces.length === 1) current = ""
75
- } else {
76
- for (let i = 0; i < pieces.length - 1; i++) out.push(pieces[i]!)
77
- current = pieces[pieces.length - 1] ?? ""
80
+ const firstPrefix = lineIndex === 0 ? lead : hang
81
+ const firstPrefixWidth = displayWidth(firstPrefix)
82
+ const availFirst = Math.max(1, width - firstPrefixWidth)
83
+ if (displayWidth(word) <= availFirst) {
84
+ current = firstPrefix + word
85
+ continue
86
+ }
87
+ // Potong bagian pertama sepas `availFirst`, sisanya mengikuti `contBudget`
88
+ // (SGR-safe via chunkByWidthSplit agar warna tetap terbawa utuh).
89
+ const pieces = chunkByWidthSplit(word, availFirst, contBudget)
90
+ if (pieces.length > 0) {
91
+ emitLine(firstPrefix + (pieces[0] ?? ""))
92
+ for (let i = 1; i < pieces.length - 1; i++) {
93
+ emitLine(hang + pieces[i]!)
94
+ }
95
+ current = pieces.length > 1 ? hang + (pieces[pieces.length - 1] ?? "") : ""
78
96
  }
79
97
  continue
80
98
  }
@@ -82,12 +100,11 @@ export function wordWrap(text: string, width: number): string {
82
100
  // hanya bila tidak ada pemisah di antara dua kata.
83
101
  const glued = !current || /\s$/.test(current) ? `${current}${word}` : `${current} ${word}`
84
102
  if (displayWidth(glued) > width && current.trim() !== "") {
85
- out.push(current.trimEnd())
86
- current = word
103
+ emitLine(current.trimEnd())
104
+ current = hang && displayWidth(hang) + displayWidth(word) <= width ? hang + word : word
87
105
  } else if (displayWidth(glued) > width) {
88
- // Indentasi + kata tak muat bersama: indentasi dilepas untuk baris ini
89
- // (baris tetap <= width; lebih baik daripada meluap/memecah kata).
90
- current = word
106
+ // Indentasi + kata tak muat bersama: lepas indentasi berlebih atau pakai hang.
107
+ current = hang && displayWidth(hang) + displayWidth(word) <= width ? hang + word : word
91
108
  } else {
92
109
  current = glued
93
110
  }
@@ -72,10 +72,10 @@ export class UiSessionState {
72
72
  this.#minimizeAnswer = opts.minimizeAnswer ?? process.env.MINICODE_MINIMIZE_ANSWER === "1"
73
73
  this.#minimizeTool = opts.minimizeTool ?? process.env.MINICODE_MINIMIZE_TOOL === "1"
74
74
  this.#compact = opts.compact ?? process.env.MINICODE_COMPACT === "1"
75
- // Thinking/teks berpikir TERLIHAT secara default (expanded) — alasannya user
76
- // ingin membaca proses berpikir model tanpa flag. `MINICODE_SHOW_THINKING=0`
77
- // eksplisit mematikan (minimized); `=1` eksplisit menghidupkan.
78
- this.#reasoningVisible = opts.reasoningVisible ?? process.env.MINICODE_SHOW_THINKING !== "0"
75
+ // Thinking/teks berpikir TERSEMBUNYI secara default agar transkrip bersih;
76
+ // user tetap bisa membukanya lewat `/thinking`, `Ctrl+T`, `--verbose`, atau
77
+ // `MINICODE_SHOW_THINKING=1` (indikator dots di composer tetap hidup).
78
+ this.#reasoningVisible = opts.reasoningVisible ?? process.env.MINICODE_SHOW_THINKING === "1"
79
79
  // Lipat aktivitas tool per turn (opencode-like): baris ledger per-tool
80
80
  // ditahan, diganti satu ringkasan turn. Opt-in (`MINICODE_MINIMIZE_ACTIVITY=1`),
81
81
  // default transparan sesuai filosofi "agentic Unix shell".
package/src/ui/tui/app.ts CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  import { appendWrapped, shaveWrapped } from "../render/composer-wrap.ts"
27
27
  import { formatError } from "../render/errors.ts"
28
28
  import { listRow } from "../render/list.ts"
29
+ import { LOGO_WIDTH, renderLogoRows } from "../render/logo.ts"
29
30
  import { sanitizeAnsi, sanitizeAnsiLine, stripSgr } from "../render/sanitize.ts"
30
31
  import { c, glyphs, scrimMode, scrimSgr } from "../render/theme.ts"
31
32
  import { chunkByWidth, displayWidth, escapeLength, truncateToWidth } from "../render/width.ts"
@@ -257,7 +258,7 @@ export class TuiApp {
257
258
  private lastAbortAt = 0
258
259
  /** Hint "tekan lagi untuk keluar" tampil sekali setelah abort pertama. */
259
260
  private abortHintOn = false
260
- /** Micro-toast 2 detik di slot footer saat mengganti mode/bahasa/salin. */
261
+ /** Micro-toast 2 detik di slot footer saat mengganti bahasa/salin. */
261
262
  private statusToast = ""
262
263
  private toastTimer: ReturnType<typeof setTimeout> | undefined
263
264
  private frames = 0
@@ -784,21 +785,15 @@ export class TuiApp {
784
785
  return
785
786
  }
786
787
  this.host.cycleWorkMode(1)
787
- const wm = this.host.getStatus().footer.workMode
788
- if (wm) {
789
- const label = wm === "EXECUTE" ? "Build" : "Discuss"
790
- this.showToast(t("tui.workModeLine", { m: label }))
791
- } else {
792
- this.paintCurrent()
793
- }
788
+ // Pembaruan WorkMode langsung mengubah label di bar footer tanpa
789
+ // menutup footer dengan toast sementara.
790
+ this.paintCurrent()
794
791
  return
795
792
  }
796
793
  if (key.type === "shift-tab") {
797
794
  this.host.togglePermissionMode()
798
- const pm = this.host.getStatus().footer.mode
799
- const label = pm ? `${pm[0]!.toUpperCase()}${pm.slice(1)}` : ""
800
- if (label) this.showToast(t("tui.modeLine", { m: label }))
801
- else this.paintCurrent()
795
+ // Pembaruan PermissionMode langsung mengubah label di bar footer.
796
+ this.paintCurrent()
802
797
  return
803
798
  }
804
799
  if (key.type === "ctrl-o") {
@@ -1919,30 +1914,14 @@ export class TuiApp {
1919
1914
  const selected = this.selectedRange(row)
1920
1915
  return selected ? highlightColumns(row.text, selected.start, selected.end) : row.text
1921
1916
  })
1922
- // Zero-state welcome ringkas saat sesi masih kosong & idle: langsung memberi
1923
- // orientasi model/workspace/pintasan tanpa menyisipkan riwayat scrollback.
1924
- if (
1925
- this.transcript.total() === 0 &&
1926
- !busy &&
1927
- menu.length === 0 &&
1928
- !this.state.line &&
1929
- viewH >= 5 &&
1930
- width >= 24
1931
- ) {
1932
- const dot = glyphs.dot
1933
- const innerMax = Math.max(8, width - 4)
1934
- const model = sanitizeAnsiLine(snap.footer.model || t("tui.noModel"))
1935
- const cwdText = sanitizeAnsiLine(snap.footer.cwd || "")
1936
- const welcome = [
1937
- c.bold(c.accent(truncateToWidth(t("app.welcomeTitle", { dot, model }), innerMax))),
1938
- ...(cwdText
1939
- ? [c.dim(truncateToWidth(t("app.welcomeCwd", { cwd: cwdText }), innerMax))]
1940
- : []),
1941
- c.muted(truncateToWidth(t("app.welcomeHints", { dot }), innerMax)),
1942
- ]
1943
- const startRow = Math.max(0, Math.floor((body.length - welcome.length) / 2))
1944
- for (let wi = 0; wi < welcome.length && startRow + wi < body.length; wi++) {
1945
- body[startRow + wi] = ` ${welcome[wi]!}`
1917
+ // Zero-state boot: tampilkan hanya logo kecil minicode di pojok kiri atas
1918
+ // tanpa blok identitas/hint di atas prompt & footer agar tampilan awal clean.
1919
+ if (this.transcript.total() === 0 && !busy && menu.length === 0 && !this.state.line) {
1920
+ const logoRows = renderLogoRows()
1921
+ if (viewH >= logoRows.length && width >= LOGO_WIDTH + 2) {
1922
+ for (let wi = 0; wi < logoRows.length; wi++) {
1923
+ body[wi] = ` ${c.accent(logoRows[wi]!)}`
1924
+ }
1946
1925
  }
1947
1926
  }
1948
1927