minicode-ai 0.14.2 → 0.14.4

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 (76) hide show
  1. package/README.md +34 -178
  2. package/cli/args.ts +10 -18
  3. package/cli/commands/acp.ts +20 -27
  4. package/cli/commands/daemon.ts +6 -7
  5. package/cli/commands/exec.ts +12 -10
  6. package/cli/commands.ts +6 -9
  7. package/cli/index.ts +30 -15
  8. package/cli/provider-manager.ts +1 -3
  9. package/cli/setup.ts +167 -143
  10. package/cli/tui.ts +15 -23
  11. package/docs/CONTROL-PLANE-MAP.md +145 -0
  12. package/docs/OUTPUT_EVENT_MODEL.md +1 -1
  13. package/docs/OUTPUT_PROTOCOL_SPEC.md +2 -2
  14. package/docs/OUTPUT_RENDERING_SPEC.md +7 -2
  15. package/docs/OUTPUT_UX_RULES.md +1 -1
  16. package/docs/README.md +14 -102
  17. package/docs/SUMMARY.md +53 -0
  18. package/docs/TERMINAL_CONTRACT.md +84 -51
  19. package/docs/UI_RENDER_PIPELINE.md +204 -0
  20. package/docs/agents.md +5 -5
  21. package/docs/architecture.md +23 -12
  22. package/docs/choosing-mode.md +7 -7
  23. package/docs/cli.md +22 -29
  24. package/docs/concepts.md +1 -1
  25. package/docs/config.md +10 -5
  26. package/docs/contributing.md +6 -6
  27. package/docs/environment.md +3 -1
  28. package/docs/exec.md +5 -5
  29. package/docs/glossary.md +8 -6
  30. package/docs/memory-sessions.md +7 -5
  31. package/docs/policy-sandbox.md +16 -14
  32. package/docs/quickstart.md +2 -2
  33. package/docs/repl.md +4 -3
  34. package/docs/security-model.md +14 -15
  35. package/docs/security.md +8 -29
  36. package/docs/skills.md +1 -1
  37. package/docs/tools.md +2 -2
  38. package/package.json +5 -3
  39. package/scripts/vendor-overlays/minicode-context.patch +109 -0
  40. package/src/app/provider-layer.ts +13 -1
  41. package/src/app/session.ts +216 -13
  42. package/src/config.ts +30 -3
  43. package/src/constants.ts +2 -0
  44. package/src/daemon/control.ts +1 -1
  45. package/src/mcp/server.ts +2 -3
  46. package/src/policy/compaction.ts +272 -16
  47. package/src/policy/context-window.ts +73 -0
  48. package/src/policy/context.ts +55 -3
  49. package/src/policy/ratelimit.ts +47 -18
  50. package/src/policy/usage.ts +15 -8
  51. package/src/policy/work-mode.ts +1 -1
  52. package/src/providers/guards.ts +61 -4
  53. package/src/providers/provision.ts +12 -3
  54. package/src/providers/router.ts +56 -23
  55. package/src/session/context-projection.ts +14 -0
  56. package/src/session/context-selector.ts +58 -20
  57. package/src/session/persistence.ts +1 -1
  58. package/src/task/model.ts +21 -70
  59. package/src/tools/task.ts +7 -0
  60. package/src/ui/footer.ts +131 -66
  61. package/src/ui/i18n/en.ts +0 -11
  62. package/src/ui/i18n/id.ts +0 -11
  63. package/src/ui/input/input.ts +2 -3
  64. package/src/ui/input/prompt-engine.ts +2 -5
  65. package/src/ui/screens/model-manager.ts +3 -10
  66. package/src/ui/screens/picker.ts +23 -40
  67. package/src/ui/screens/provider-manager.ts +12 -33
  68. package/src/ui/screens/wizard.ts +0 -1
  69. package/src/ui/tui/app.ts +10 -6
  70. package/src/ui/tui/transcript.ts +48 -8
  71. package/vendor/minicore/VENDOR.md +9 -5
  72. package/vendor/minicore/src/core/loop.ts +47 -12
  73. package/vendor/minicore/src/core/provider.ts +4 -0
  74. package/vendor/minicore/src/core/session.ts +14 -1
  75. package/docs/OUTPUT_ARCHITECTURE_AUDIT.md +0 -489
  76. package/docs/OUTPUT_IMPLEMENTATION_PLAN.md +0 -391
package/cli/tui.ts CHANGED
@@ -77,7 +77,7 @@ function fmtCtx(n: number): string | undefined {
77
77
  */
78
78
  function fmtUsageMetrics(ctx: CliSession): string | undefined {
79
79
  const cost: number | undefined = ctx.usage.getSession().cost
80
- const windowTokens: number | undefined = ctx.contextWindowTokens
80
+ const windowTokens: number | undefined = ctx.getContextWindowTokens?.() ?? ctx.contextWindowTokens
81
81
  // P1.4: persentase footer = OCCUPANCY konteks saat ini, bukan total token
82
82
  // yang sudah dibelanjakan sepanjang sesi. Memakai spend membuat footer
83
83
  // mentok 100% setelah beberapa step meski konteks masih jauh di bawah window.
@@ -221,7 +221,7 @@ export async function runTui(ctx: CliSession): Promise<void> {
221
221
  // P1.2: dua dimensi selalu terbaca live di /status — bukan snapshot boot.
222
222
  // [mode-architecture] /status memakai nilai PRODUK (BUILD/AUTO/ASK).
223
223
  get workMode() {
224
- return displayWorkMode(workModeControl?.getWorkMode() ?? "EXECUTE")
224
+ return displayWorkMode(workModeControl?.getWorkMode() ?? "DISCUSS")
225
225
  },
226
226
  get permissionMode() {
227
227
  return (permissions?.getMode() ?? mode).toUpperCase()
@@ -272,7 +272,7 @@ export async function runTui(ctx: CliSession): Promise<void> {
272
272
  // (beserta /work-mode) yang menggeser operating mode — TIDAK permission mode.
273
273
  const cycleWorkMode = (dir: 1 | -1): void => {
274
274
  if (!workModeControl) return // policy terinjeksi = tanpa kontrol (fail-closed)
275
- const current = workModeControl.getWorkMode() ?? "EXECUTE"
275
+ const current = workModeControl.getWorkMode() ?? "DISCUSS"
276
276
  const idx = (WORK_MODE_CYCLE as readonly string[]).indexOf(current)
277
277
  if (idx === -1) return
278
278
  const next = WORK_MODE_CYCLE[(idx + dir + WORK_MODE_CYCLE.length) % WORK_MODE_CYCLE.length]!
@@ -290,6 +290,7 @@ export async function runTui(ctx: CliSession): Promise<void> {
290
290
 
291
291
  async function runBuiltin(
292
292
  q: string,
293
+ recordOutput = true,
293
294
  ): Promise<{ lines: string[]; shouldExit: boolean; handled: boolean }> {
294
295
  let shouldExit = false
295
296
  let handled = false
@@ -304,15 +305,15 @@ export async function runTui(ctx: CliSession): Promise<void> {
304
305
  // Baris parsial yang sempat tercetak sebelum throw tetap tampil —
305
306
  // tanpa ini hanya pesan error generik yang keluar (data-loss diam).
306
307
  lines = (e as { capturedLines?: string[] }).capturedLines ?? []
307
- if (lines.length) transcript.pushInfo(lines)
308
+ if (recordOutput && lines.length) transcript.pushInfo(lines)
308
309
  throw e
309
310
  }
310
311
  return { lines, shouldExit, handled }
311
312
  }
312
313
 
313
- async function delegateBuiltin(q: string): Promise<{ quit?: boolean }> {
314
- const { lines, shouldExit } = await runBuiltin(q)
315
- if (lines.length) transcript.pushInfo(lines)
314
+ async function delegateBuiltin(q: string, recordOutput = true): Promise<{ quit?: boolean }> {
315
+ const { lines, shouldExit } = await runBuiltin(q, recordOutput)
316
+ if (recordOutput && lines.length) transcript.pushInfo(lines)
316
317
  return shouldExit ? { quit: true } : {}
317
318
  }
318
319
 
@@ -320,14 +321,13 @@ export async function runTui(ctx: CliSession): Promise<void> {
320
321
  * Builtin yang membuka popup: bekukan App (input dilepas + layar redup),
321
322
  * view melukis regionnya sendiri, App repaint saat kembali. Tanpa ini
322
323
  * byte masuk ke dua tempat (App + popup) dan frame App menimpa popup.
323
- * Struk mutasi: model/provider yang berubah saat popup terbuka dicatat
324
- * ke transkrip (jejak audit — scroll ke atas selalu menunjukkan ganti).
324
+ * Hasil pemilihan provider/model terlihat di footer dan daftar saat dibuka
325
+ * kembali; transkrip tidak mengarsipkan pilihan UI yang sudah selesai.
325
326
  */
326
327
  async function popupBuiltin(q: string): Promise<{ quit?: boolean }> {
327
- const before = commandCtx.currentModel
328
328
  app.suspend()
329
329
  try {
330
- return await delegateBuiltin(q)
330
+ return await delegateBuiltin(q, false)
331
331
  } catch (e) {
332
332
  // Spawn anak gagal (terminal sudah dilepas onBeforeSpawn): hidupkan
333
333
  // kembali atau keluar bersih — jangan biarkan TUI mati tanpa layar.
@@ -335,8 +335,6 @@ export async function runTui(ctx: CliSession): Promise<void> {
335
335
  throw e
336
336
  } finally {
337
337
  app.resume()
338
- const after = commandCtx.currentModel
339
- if (after && after !== before) transcript.pushInfo([c.muted(t("tui.modelSet", { v: after }))])
340
338
  }
341
339
  }
342
340
 
@@ -472,13 +470,12 @@ export async function runTui(ctx: CliSession): Promise<void> {
472
470
  } else {
473
471
  togglePermissionMode()
474
472
  }
475
- transcript.pushInfo([c.muted(t("tui.modeLine", { m: mode.toUpperCase() }))])
476
473
  return
477
474
  }
478
475
  // [mode-architecture] /work-mode = WorkMode (operating mode) SAJA.
479
476
  // Aksi operator EKSPLISIT untuk operating mode; Tab/Shift+Tab = pintasan.
480
477
  if (name === "work-mode") {
481
- const current = workModeControl?.getWorkMode() ?? "EXECUTE"
478
+ const current = workModeControl?.getWorkMode() ?? "DISCUSS"
482
479
  const currentDisplay = displayWorkMode(current)
483
480
  if (!args) {
484
481
  transcript.pushInfo([c.muted(t("tui.workModeUsage", { m: currentDisplay }))])
@@ -498,7 +495,6 @@ export async function runTui(ctx: CliSession): Promise<void> {
498
495
  return
499
496
  }
500
497
  workModeControl.setWorkMode(next)
501
- transcript.pushInfo([c.muted(t("tui.workModeLine", { m: displayWorkMode(next) }))])
502
498
  return
503
499
  }
504
500
  if (name === "lang") {
@@ -518,19 +514,16 @@ export async function runTui(ctx: CliSession): Promise<void> {
518
514
  const { saveLang } = await import("../src/config.ts")
519
515
  await saveLang(next)
520
516
  } catch {}
521
- transcript.pushInfo([c.muted(t("tui.langLine", { v: next }))])
522
517
  return
523
518
  }
524
519
  if (name === "compact") {
525
520
  const next = args === "" ? undefined : args === "on" || args === "1"
526
- const compact = ui.setCompactMode(next)
527
- transcript.pushInfo([c.muted(t("tui.toolCall", { v: compact ? "compact" : "expanded" }))])
521
+ ui.setCompactMode(next)
528
522
  return
529
523
  }
530
524
  if (name === "thinking") {
531
525
  const next = args === "" ? undefined : args === "on" || args === "1"
532
- const vis = ui.setReasoningVisible(next)
533
- transcript.pushInfo([c.muted(t("tui.thinkingSet", { v: vis ? "expanded" : "minimized" }))])
526
+ ui.setReasoningVisible(next)
534
527
  return
535
528
  }
536
529
  if (name === "expand") {
@@ -571,7 +564,6 @@ export async function runTui(ctx: CliSession): Promise<void> {
571
564
  }
572
565
  ui.setSectionMinimized("tool", next)
573
566
  ui.setSectionMinimized("answer", next)
574
- transcript.pushInfo([c.muted(t(next ? "tui.sectionsMin" : "tui.sectionsExp"))])
575
567
  return
576
568
  }
577
569
  if (name === "undo") {
@@ -649,7 +641,7 @@ export async function runTui(ctx: CliSession): Promise<void> {
649
641
  mode,
650
642
  // P12 S2.2 Slice 5 - WorkMode LIVE (bukan snapshot boot): footer
651
643
  // mencerminkan mode aktif saat frame digambar.
652
- workMode: workModeControl?.getWorkMode() ?? "EXECUTE",
644
+ workMode: workModeControl?.getWorkMode() ?? "DISCUSS",
653
645
  model: modelRef.current ?? cfg.providers[0]?.models[0] ?? t("tui.noModel"),
654
646
  cwd: cwd ?? process.cwd(),
655
647
  context: fmtCtx(session.contextTokens),
@@ -0,0 +1,145 @@
1
+ # Control Plane Map — kontrak context/usage/cost/budget/compaction/termination
2
+
3
+ Dokumen ini membekukan kontrak control-plane MiniCode (Phase 6, 2026-09-17).
4
+ Tujuannya: satu sumber kebenaran per konsep, hubungan antar-konsep eksplisit,
5
+ dan setiap keputusan (kompaksi, abort, termination) dapat dijelaskan.
6
+
7
+ Prinsip: **Context ≠ Cost. Cost ≠ Usage. Usage ≠ Budget. Budget ≠ Termination.
8
+ Compaction ≠ Retry. Tool cap ≠ Context cap.** — semua konsep berbeda dan
9
+ punya owner sendiri; yang disatukan di sini hanya *hubungannya*.
10
+
11
+ ## 1. Empat angka konteks (dua konsep, dua ukuran)
12
+
13
+ | Konsep | Ukuran | Owner | Sumber kebenaran | Dipakai |
14
+ |---|---|---|---|---|
15
+ | Logical context | token ESTIMASI (chars/4, sadar-gambar) | Kernel loop + `Session.contextTokens` | `estimateSessionContext` (`vendor tokens.ts`) — messages+system+tools | pressure evaluation, footer, `/status` |
16
+ | Serialized context | chars wire (JSON/base64 +overhead) | Adapter provider | `buildRequest` per adapter | dikirim, tidak diukur tersendiri |
17
+ | Provider usage | token yang dilaporkan provider | `createUsageCollector` | event `provider:extension{kind:"usage"}` — **boleh hilang** | akumulasi turn/session, cost |
18
+ | Economic usage | USD estimated dari harga tabel | `costFor`/`findPrice` | harga × usage; `undefined` = unknown | `--budget`, `/status` |
19
+
20
+ Relationship eksplisit:
21
+ - `logical` ≠ `serialized` (JSON overhead, base64 +33% — konsisten undercount).
22
+ - `provider usage` boleh tak ada → **unknown tetap unknown, bukan zero**
23
+ (collector tidak pernah memalsukan angka).
24
+ - `economic` selalu estimasi (tabel harga basi/stale) — bukan tagihan riil.
25
+
26
+ ## 2. Owner map (siapa tahu / siapa memutuskan)
27
+
28
+ | Konsep | TAHU | MEMUTUSKAN |
29
+ |---|---|---|
30
+ | Context size | Kernel loop (`contextTokens`) + `Session.contextTokens` getter (ekspos ke driver/UI) | Kernel: kompaksi + gagal-bila-critical |
31
+ | Compaction | Kernel (pressure + flag) | Kernel: KAPAN + fallback; LLM: ISI ringkasan |
32
+ | Termination | maxSteps + turn timeout (kernel), per-prompt deadline (CLI), budget (driver), abort (user) | Kernel: maxSteps/turn timeout/post-kompaksi critical; CLI: fresh wall-clock deadline per prompt including retry/verify; Driver: budget abort; User: Esc (TUI), Ctrl+C/Esc (raw prompt) |
33
+ | Budget | Collector (usage live) + `budgetStatus` | `budgetStatus` (terpusat, seragam TUI/one-shot/exec) + watcher abort |
34
+ | Backpressure | Producer caps + kernel truncate | Cap di producer (sudah benar); kernel truncate terakhir |
35
+
36
+ ## 3. Compaction Contract (Phase 6 — seam kernel)
37
+
38
+ **Dua semantics terpisah, tidak lagi satu flag:**
39
+
40
+ - `compactedForBudget` — kompaksi budget-pressure (`shouldCompact(pressure)`).
41
+ Set saat dicoba (anti berulang tiap step O(n)). Kritis setelahnya →
42
+ `AgentError("budget_exceeded")` (bukan retry provider sia-sia).
43
+ - `compactedForRecovery` — kompaksi recovery (`force_compact_and_retry` /
44
+ `onLength`). Set SETELAH compact (anti loop abadi: jalur ini tidak dihitung
45
+ `maxProviderRetries`). Kedua kalinya → `budget_exceeded`.
46
+
47
+ **Reason event** (`context:compacted`, `reason` — nama generik kernel,
48
+ diselaraskan 0.9.27 saat seam dihilirkan; sebelumnya `budget:<…>`):
49
+ - `pressure:<pressure>` — kompaksi policy-path yang benar-benar mengurangi messages.
50
+ - `pressure:<pressure>:no-op` — kompaksi policy-path yang TIDAK mengurangi (tidak ada
51
+ yang bisa dibuang dari messages — operator harus tahu bedanya dari fixed
52
+ overhead: system+tool schema, yang tidak pernah terkompaksi).
53
+ - `recovery` — kompaksi dari recovery (`context_length_exceeded` / `length`).
54
+
55
+ **Contract wajib menjawab:**
56
+ - *Who requested?* — budget path (kernel, pressure ≥ 75%) atau recovery path
57
+ (kernel, error konteks). Manual `/compact` tak menyentuh kernel (view saja).
58
+ - *Why?* — reason event di atas.
59
+ - *What is eligible?* — hanya messages; system prompt di-cap di hulu
60
+ (`SYSTEM_PROMPT_MAX_CHARS` 8000), tool schema TIDAK pernah terkompaksi.
61
+ - *What must be preserved?* — pasangan assistant(toolCalls)→tool results tidak
62
+ pernah dipecah (`compact.ts`); summary LLM terpin verbatim (anti-drift).
63
+ - *What may be removed?* — hasil tool sukses (ditinggal `<result omitted>` di
64
+ mechanical; LLM menulis ringkasan fakta), reasoning, tail lama.
65
+ - *What if compaction fails?* — LLM gagal/timeout (10s) → fallback sync
66
+ mekanis; async compactor tak pernah bisa crash loop.
67
+ - *Can it retry?* — budget: tidak (flag); recovery: sekali per turn (flag).
68
+ - *Can another occur in the same turn?* — budget + recovery boleh co-exist
69
+ (flag terpisah); sesama kind tidak.
70
+ - *What does compaction itself consume?* — LLM kompaksi berbiaya; usage-nya
71
+ ditangkap `compactWithLlm` → callback `onUsage` → bus sesi (event usage
72
+ standar) — **bukan blind spot lagi** (Phase 6, E5).
73
+
74
+ ## 4. Budget Contract
75
+
76
+ Status (`budgetStatus`, terpusat): `ok | over | unknown-strict`.
77
+
78
+ | Fase | Semantics |
79
+ |---|---|
80
+ | Preflight (prompt baru) | `tokens == 0` (belum ada pemakaian tercatat) → **start selalu boleh** (lockout strict tidak diminta — Phase 5 E-3c); `tokens > 0` + cost unknown → ditolak (fail-closed, F-06); cost known + over → ditolak |
81
+ | In-flight | `watchBudgetLimit` membaca biaya LIVE per usage event; fire-once → `ctl.abort(budgetExceededError())` — kind `budget_exceeded` dipertahankan (terbedakan dari abort user) |
82
+ | Post-usage | cost = estimated dari harga tabel (bukan tagihan riil); cost unknown → status `unknown-strict`, angka palsu tidak dibuat |
83
+
84
+ **Context vs budget adalah dua dimensi independen**: pressure HIGH + cost LOW
85
+ valid (tool result raksasa, model gratis); pressure LOW + cost HIGH valid
86
+ (konteks kecil, model mahal). Tidak ada asumsi `high context = high cost`.
87
+
88
+ ## 5. Termination Contract
89
+
90
+ | Reason | Owner | Mekanisme |
91
+ |---|---|---|
92
+ | `completed` | kernel loop | tidak ada tool call → `finalText` |
93
+ | `max_steps_exceeded` | kernel loop | `stepIndex >= maxSteps` |
94
+ | `timeout` | CLI per-prompt deadline + kernel `createTimeout` | Keduanya membawa `AgentError("timeout")`; retry wait dan provider stream menerima sinyal yang sama |
95
+ | `budget_exceeded` | kernel (post-kompaksi) / driver (watcher abort) | `AgentError("budget_exceeded")` — dipertahankan |
96
+ | `aborted` | user (Esc pada TUI; Ctrl+C/Esc pada prompt non-TUI) / `session.abort()` | sinyal tanpa kind AgentError |
97
+ | `provider` | kernel loop | provider error setelah retry habis |
98
+ | busy | kernel | `run()` saat `running` |
99
+
100
+ Deadline provider per request default 300 detik. Kegagalan provider yang dapat
101
+ dicoba ulang memakai paling banyak tiga retry setelah percobaan awal; backoff
102
+ tanpa `Retry-After` adalah 1, 2, lalu 4 detik. `Retry-After` dibatasi 30 detik.
103
+ Router dapat mencoba provider alternatif sebelum menunggu, kecuali model di-pin.
104
+ Semua penantian retry dan rate-limit dibatalkan oleh timeout/abort pemanggilan.
105
+
106
+ Satu terminal reason per sinyal (`abortError` mempertahankan kind
107
+ `AgentError`); pemutus lain dapat REQUEST, tidak ada competing owners —
108
+ `joinSignals` + `withAbort` = satu titik settle.
109
+
110
+ ## 6. Producer/Backpressure hierarchy
111
+
112
+ ```
113
+ producer-side cap (bash 20k, git 500k, mcp 100k, read_file paging, ...)
114
+ ↓
115
+ kernel truncate (toolResultMaxTokens 4096 tok = 16.384 chars, head 70%+tail 30%)
116
+ ↓
117
+ context insertion (store append — cap by truncation di atas)
118
+ ↓
119
+ compaction (messages; system/schema = fixed overhead, tidak pernah terkompaksi)
120
+ ↓
121
+ termination (budget_exceeded bila critical setelah kompaksi)
122
+ ```
123
+
124
+ Aturan: **jangan double-truncate tanpa semantics** — raw output cap ≠ context
125
+ insertion cap ≠ stored result cap ≠ display cap. Keempatnya boleh berbeda,
126
+ tetapi setiap lapisan harus tahu apa yang hilang di situ (marker truncation
127
+ wajib). Guard `read_image` memakai angka kernel (16.184 chars) — bukan angka
128
+ sendiri (bug E-1 sudah ditutup).
129
+
130
+ ## 7. Observability contract
131
+
132
+ Operator harus bisa membedakan (tanpa ambigu):
133
+ - `/status`: `Context` (window estimate, kernel) vs `Input/Output/Total`
134
+ (provider usage) vs `Cost` (estimated) vs `Budget` (status keputusan).
135
+ - Footer: angka = ukuran jendela saat ini (kernel) — bukan spend kumulatif.
136
+ - `context:compacted` event: reason membedakan policy-pressure/recovery/no-op.
137
+
138
+ ## Proteksi (test → kontrak)
139
+
140
+ - `test/control-plane.test.ts` — compaction budget≠recovery (F-10), anti-loop,
141
+ contextTokens getter + konsistensi estimator, termination reason.
142
+ - `test/cli-help-language.test.ts` — /status membedakan Context/Usage/Budget.
143
+ - `test/repl-linear.test.ts` — footer membaca kernel contextTokens.
144
+ - `test/usage-session.test.ts` / `budget-unknown.test.ts` — budget contract.
145
+ - `test/pack-integrity.test.ts` — vendor hash + VENDOR.md sinkron.
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Status:** Phase 2 core state/replay contract landed; renderer/wire protocol masih target
4
4
  **Tanggal:** 2026-09-25
5
- **Audit sumber:** `docs/OUTPUT_ARCHITECTURE_AUDIT.md`
5
+ **Kontrak aktif:** implementasi dan producer event di `src/presentation/events.ts`.
6
6
 
7
7
  ## Status implementasi
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Status:** landed — `exec --json` memakai envelope `minicode.output.v1`, ACP memakai framing JSON-RPC + mapping semantik yang sama; legacy `type:"tool"` hanya bila lifecycle absen
4
4
  **Tanggal:** 2026-09-25
5
- **Audit sumber:** `docs/OUTPUT_ARCHITECTURE_AUDIT.md`
5
+ **Kontrak aktif:** envelope machine di `src/presentation/projection.ts` dan consumer di `cli/commands/exec.ts` serta `cli/commands/acp.ts`.
6
6
 
7
7
  ## 1. Prinsip
8
8
 
@@ -136,7 +136,7 @@ Semua event machine SHOULD menggunakan bentuk:
136
136
  "sessionId": "s1",
137
137
  "turnId": 1,
138
138
  "correlationId": "call-1",
139
- "source": "runtime",
139
+ "source": "derived",
140
140
  "severity": "info",
141
141
  "status": "completed",
142
142
  "visibility": ["machine"],
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Status:** implemented renderer boundary; canonical policy active, with streaming content transport and one ACP compatibility window.
4
4
  **Tanggal:** 2026-09-25
5
- **Audit sumber:** `docs/OUTPUT_ARCHITECTURE_AUDIT.md`
5
+ **Kontrak aktif:** renderer TUI/linear di `src/presentation/` dan `src/ui/`.
6
6
 
7
7
  ## 1. Prinsip boundary
8
8
 
@@ -127,14 +127,19 @@ popup tidak boleh membuat listener stdin kedua.
127
127
 
128
128
  ### TUI semantic projection
129
129
 
130
- - User message: satu entry user dengan source range.
130
+ - Prompt percakapan: satu entry user dengan source range. Input command slash tetap
131
+ tersedia di composer history, tetapi tidak ditambahkan sebagai pesan transkrip.
131
132
  - Assistant stream: live buffer yang di-cap; final node dipisah dari stream.
133
+ - Whitespace jawaban dirapikan hanya pada layer tampilan: baris kosong tepi dibuang,
134
+ jeda berulang di luar code fence dirapatkan, isi fenced code tetap literal.
132
135
  - Activity: started → running → terminal, dengan glyph + status word.
133
136
  - Tool child: default dikelompokkan ke parent `delegate_task`; child detail tersedia
134
137
  pada verbose/debug.
135
138
  - Context compaction: system entry, tidak menghapus history.
136
139
  - Summary: system node dari canonical turn summary, bukan hasil hitung ulang widget.
137
140
  - Error: node dengan category/cause/hint; tidak hanya string merah.
141
+ - Pilihan provider/model dan status selesai dari popup pengelolaan tidak diarsipkan
142
+ ke transkrip; state aktif dibaca dari footer/manager saat ini. Error tetap terlihat.
138
143
 
139
144
  ### Selection dan clipboard
140
145
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Status:** contract grammar untuk normal/verbose/debug/machine output
4
4
  **Tanggal:** 2026-09-25
5
- **Audit sumber:** `docs/OUTPUT_ARCHITECTURE_AUDIT.md`
5
+ **Kontrak aktif:** proyeksi output di `src/presentation/projection.ts` dan formatter di `src/ui/render/`.
6
6
 
7
7
  ## 1. North star
8
8
 
package/docs/README.md CHANGED
@@ -1,111 +1,23 @@
1
- # Minicode — Dokumentasi
1
+ # Dokumentasi MiniCode
2
2
 
3
- Minicode adalah coding agent CLI berbahasa Indonesia. Ia membantu Anda bekerja dengan kode — membaca, menulis, mencari, dan menjalankan perintah — dengan menerima perintah dalam bahasa Indonesia atau Inggris.
3
+ MiniCode adalah coding agent terminal yang dibangun di atas kernel MiniCore. Jalur interaktif memakai TUI fullscreen; jalur one-shot dan otomatis menulis ke scrollback atau stream mesin sesuai kontraknya.
4
4
 
5
- Minicode dibangun di atas kernel kecil bernama MiniCore. Kernel inilah yang mengurus pekerjaan inti: menerima permintaan, memilih langkah, menjalankan alat, dan melaporkan hasilnya.
5
+ ## Mulai
6
6
 
7
- ## Apa itu Minicode?
7
+ 1. Ikuti [instalasi](getting-started.md). Metadata paket dan batas runtime Bun tersedia di `package.json` pada root repository.
8
+ 2. Gunakan [quickstart](quickstart.md) untuk menyiapkan provider dan menjalankan prompt pertama.
9
+ 3. Baca [memilih mode](choosing-mode.md) sebelum memberi agent akses tulis atau eksekusi.
8
10
 
9
- Singkatnya: Minicode adalah asisten yang bekerja di terminal. Anda memberinya tugas dalam bahasa Indonesia atau Inggris, dan ia melakukan pekerjaan tersebut langkah demi langkah, sambil menunjukkan apa yang sedang dilakukan.
11
+ ## Batas yang perlu diketahui
10
12
 
11
- Di balik layar, ada dua bagian utama:
13
+ - Prompt dan konteks dikirim ke provider yang Anda pilih. Server MCP dan LSP yang dikonfigurasi juga dapat menerima data atau melakukan efek eksternal.
14
+ - Path jail, bash guard, WorkMode, PermissionMode, dan tool access policy membatasi eksekusi; tidak menjamin bahwa keluaran model benar.
15
+ - Batasan dan kontrak operasional dijelaskan dalam panduan aktif di direktori ini. Laporan audit bertanggal telah dipangkas dari baseline dokumentasi.
12
16
 
13
- - **MiniCore** — bagian inti yang dibekukan. Ia mengurus alur kerja dasar: menerima permintaan, memilih tindakan, menjalankan alat, dan melaporkan hasil. Bagian ini sengaja dibuat kecil dan stabil. Versi Minicode berikutnya tidak akan mengubah inti ini, kecuali untuk tambahan kecil yang tidak mengganggu fungsi aslinya.
17
+ ## Peta dokumentasi
14
18
 
15
- - **Minicode** — bagian yang Anda gunakan. Ia bekerja di terminal, menerima perintah dalam bahasa Indonesia atau Inggris, dan menggunakan berbagai alat untuk menyelesaikan tugas Anda. Alat-alat yang tersedia antara lain: membaca dan menulis file, menjalankan perintah, mencari di kode, terhubung ke penyedia Kecerdasan Buatan (AI), serta beberapa alat bantu lain.
19
+ `SUMMARY.md` adalah daftar navigasi yang dibaca generator situs. Untuk referensi terbit, buka [Dokumentasi](/docs/). [Arsitektur](architecture.md) memuat peta struktur dan alur runtime.
16
20
 
17
- ## Struktur singkat
21
+ ## Pengembangan
18
22
 
19
- Berikut adalah gambaran singkat tentang apa yang ada di dalam Minicode. Ini bukan informasi wajib untuk penggunaan umum, tetapi bisa membantu Anda memahami biaya dan cara kerjanya.
20
-
21
- - **Komponen inti** (`vendor/minicore`) — kernel yang dibekukan, tidak bergantung pada paket lain.
22
- - **Alat-alat** — untuk membaca dan menulis file, menjalankan perintah, dan bekerja dengan kode.
23
- - **Penanganan tugas** — dapat membagi pekerjaan ke agen lain yang bekerja secara terpisah.
24
- - **Kebijakan keamanan** — membatasi apa yang boleh dijalankan, sehingga pekerjaan tetap terkendali.
25
- - **Penyedia Kecerdasan Buatan** — terhubung ke layanan AI yang Anda pilih.
26
- - **Alat bantu eksternal** — bisa terhubung ke layanan MCP dan LSP untuk fungsi tambahan.
27
- - **Memori & sesi** — mencatat riwayat pekerjaan dan menyimpan ringkasan yang relevan.
28
- - **Kemampuan khusus** — seperti membaca struktur kode, menyimpan dan melanjutkan sesi, serta pemeriksaan otomatis.
29
-
30
- ## Privasi & kejujuran
31
-
32
- Beberapa hal penting yang perlu Anda tahu:
33
-
34
- - **Tidak ada data yang dikirim tanpa sepengetahuan Anda.** Konfigurasi Anda tersimpan di komputer Anda sendiri. Token akses disimpan dengan aman dan tidak disebarkan.
35
- - **Kegagalan dilaporkan apa adanya.** Jika ada masalah, Minicode akan memberitahu secara langsung, tanpa disamarkan.
36
- - **Informasi kuantitatif tidak ditulis secara permanen di sini.** Jika Anda ingin tahu jumlah test, cakupan, atau jumlah alat yang tersedia, jalankan perintah `bun test`, `bun run gate:coverage`, atau lihat hasil di layanan continuous integration (CI). Informasi seperti ini bisa berubah sewaktu-waktu.
37
- - **Riwayat perubahan** tercatat di [GitHub Releases](https://github.com/startupmini/minicode/releases); changelog lengkap tersedia pada repository.
38
-
39
- ## Mulai dalam 5 menit
40
-
41
- Yang Anda butuhkan: Bun versi 1.0 ke atas. Tidak perlu instalasi lain.
42
-
43
- ```bash
44
- # Salin repo ke komputer Anda
45
- git clone https://github.com/startupmini/minicode && cd minicode
46
-
47
- # Pasang ketergantungan
48
- bun install && bun link
49
- ```
50
-
51
- Selanjutnya, coba perintah-perintah ini untuk melihat bagaimana Minicode bekerja:
52
-
53
- ```bash
54
- minicode # Mulai Minicode — akan muncul panduan jika ini pertama kalinya
55
- minicode "buat http server" --verbose
56
- minicode auth login # OAuth device-code bila provider mendukung; lainnya via API key
57
- minicode providers # Lihat daftar penyedia yang tersedia
58
- minicode doctor # Cek kondisi jika ada yang tidak beres
59
- ```
60
-
61
- Untuk langkah selanjutnya — mulai dari awal sampai membuat prompt pertama yang terverifikasi — baca [Quickstart](quickstart.md). Jika Anda ingin tahu tentang instalasi di sistem operasi berbeda, atau cara memperbarui dan menghapus Minicode, baca [Instalasi](getting-started.md).
62
-
63
- ## Mulai di sini
64
-
65
- Anda baru dan tak mau menebak urutan baca? Ikuti jalur ini (total ±15 menit):
66
-
67
- 0. **Apa Minicode?** — [Konsep & Desain](concepts.md) (3 menit): apa, kenapa, dan apa yang sengaja tidak ada.
68
- 1. **Install** — [Instalasi](getting-started.md) (5 menit): Bun, clone, `doctor`.
69
- 2. **Prompt pertama** — [Quickstart](quickstart.md) (5 menit): wizard/API key atau OAuth, prompt ter-verify pertama.
70
- 3. **Pilih mode** — [Memilih Mode](choosing-mode.md) (2 menit): baca, ubah, approve, atau plan.
71
- 4. **Workflow pertama** — [CLI](cli.md) + [TUI](repl.md): flag harian dan slash command sesuai kebutuhan.
72
-
73
- Habis itu, baca sesuai kebutuhan lewat tabel Navigasi di bawah — tak perlu berurutan.
74
-
75
- ## Navigasi
76
-
77
- | Anda ingin... | Baca... |
78
- |---|---|
79
- | Mengerti apa itu Minicode dan alasan dibaliknya | [Konsep & Desain](concepts.md) |
80
- | Cara menginstall, memperbarui, atau menghapusnya | [Instalasi](getting-started.md) |
81
- | Mulai dari nol sampai membuat prompt pertama yang terverifikasi | [Quickstart](quickstart.md) |
82
- | Arti istilah-istilah yang dipakai di sini | [Glosarium](glossary.md) |
83
- | Semua perintah CLI dan flag yang tersedia | [CLI](cli.md) |
84
- | Perintah khusus di dalam Minicode dan tombol pintas | [TUI](repl.md) |
85
- | Cara menjalankan Minicode tanpa interaksi (otomatis / di CI) | [Otomasi & CI](exec.md) |
86
- | Cara menyimpan pengaturan dan di mana data tersimpan | [Config](config.md) |
87
- | Cara menambah penyedia AI dan mengelola akses | [Config & Provider](config-providers.md) |
88
- | Cara memperkirakan biaya dan membatasi pengeluaran | [Pricing & Budget](pricing-budget.md) |
89
- | Semua variabel lingkungan yang tersedia | [Environment Variables](environment.md) |
90
- | Cara membuat perintah khusus (skill) dan skrip terbatas | [Skills & Hooks](skills.md) |
91
- | Sub-agent `delegate_task`, mode explore/plan, recovery | [Sub-Agents & Tasks](agents.md) |
92
- | MCP stdio/HTTP, LSP, `mcp serve` | [MCP & LSP](mcp-lsp.md) |
93
- | Memory RAG, sessions, undo/redo, recovery journal | [Memory & Sessions](memory-sessions.md) |
94
- | Auto-verify, benchmark, SWE-bench Lite, harness audit | [Verify & Benchmark](verify-benchmark.md) |
95
- | Permission mode, bash-guard, jail, sandbox | [Policy & Sandbox](policy-sandbox.md) |
96
- | Threat model, prompt injection, supply chain | [Keamanan](security.md) |
97
- | Error umum + `doctor` | [Troubleshooting](troubleshooting.md) |
98
- | Peta lapisan, alur satu prompt | [Arsitektur](architecture.md) |
99
- | Kontrak stdout/stderr FROZEN, invariant I1–I35 | [Kontrak Terminal](terminal.md) |
100
- | Kontrak internal kontributor: terminal FROZEN, control-plane, pipeline render | [Internal & Arsitektur](TERMINAL_CONTRACT.md) (grup di sidebar) |
101
- | Audit dan target arsitektur output/presentation | [Output Architecture Audit](OUTPUT_ARCHITECTURE_AUDIT.md) |
102
- | Ikut kontribusi, gate, batas lapisan | [Contributing](contributing.md) |
103
- | Perubahan per versi | [Changelog](https://github.com/startupmini/minicode/releases) |
104
- | Arsip panduan monolit lama (baca hanya bila perlu) | `USAGE.md` (file pendamping, status legacy) |
105
-
106
- ## Konvensi dokumen ini
107
-
108
- - Bahasa: **Indonesia**, istilah teknis tetap English (`provider`, `checkpoint`, `sandbox`).
109
- - Komentar kode di repo juga Indonesia (menjelaskan *mengapa*, bukan *apa*).
110
- - Setiap klaim perilaku merujuk ke `file:line` agar bisa diverifikasi dengan `read_file` + `offset`/`limit`.
111
- - Encoding UTF-8 tanpa BOM. Jangan commit rahasia (API key, token OAuth).
23
+ Panduan contributor, gate, dan batas lapisan: [contributing.md](contributing.md). Aturan agent ada di `AGENTS.md` pada root repository. Master roadmap tetap milik pemilik repo dan tidak tersedia di checkout ini.
@@ -0,0 +1,53 @@
1
+ # Summary
2
+
3
+ * [Minicode — Dokumentasi](README.md)
4
+
5
+ ## Memulai
6
+
7
+ * [Konsep & Desain](concepts.md)
8
+ * [Instalasi](getting-started.md)
9
+ * [Quickstart 5 menit](quickstart.md)
10
+ * [Glosarium](glossary.md)
11
+
12
+ ## Menggunakan
13
+
14
+ * [CLI — Mode & Flags](cli.md)
15
+ * [Memilih Mode](choosing-mode.md)
16
+ * [TUI — Slash & Keyboard](repl.md)
17
+ * [Otomasi & CI](exec.md)
18
+ * [Config — File & Lokasi Data](config.md)
19
+ * [Config & Provider](config-providers.md)
20
+ * [Pricing & Budget](pricing-budget.md)
21
+ * [Environment Variables](environment.md)
22
+ * [Skills & Hooks](skills.md)
23
+
24
+ ## Referensi
25
+
26
+ * [Tools](tools.md)
27
+ * [Sub-Agents & Tasks](agents.md)
28
+ * [MCP & LSP](mcp-lsp.md)
29
+ * [Memory & Sessions](memory-sessions.md)
30
+ * [Verify & Benchmark](verify-benchmark.md)
31
+
32
+ ## Keamanan
33
+
34
+ * [Security Model](security-model.md)
35
+ * [Policy & Sandbox](policy-sandbox.md)
36
+ * [Keamanan](security.md)
37
+ * [Troubleshooting](troubleshooting.md)
38
+
39
+ ## Kontribusi & Arsitektur
40
+
41
+ * [Arsitektur](architecture.md)
42
+ * [Kontrak Terminal](terminal.md)
43
+ * [Contributing](contributing.md)
44
+
45
+ ## Internal & Arsitektur (untuk kontributor)
46
+
47
+ * [Terminal Contract (FROZEN) — 35 invariant, v7.7](TERMINAL_CONTRACT.md)
48
+ * [Output Event Model — taksonomi dan lifecycle](OUTPUT_EVENT_MODEL.md)
49
+ * [Output Protocol Spec — stream dan machine contract](OUTPUT_PROTOCOL_SPEC.md)
50
+ * [Output Rendering Spec — boundary renderer](OUTPUT_RENDERING_SPEC.md)
51
+ * [Output UX Rules — grammar human-facing](OUTPUT_UX_RULES.md)
52
+ * [Control Plane — kontrak context/budget/compaction](CONTROL-PLANE-MAP.md)
53
+ * [UI Render Pipeline — jalur stream ke terminal](UI_RENDER_PIPELINE.md)