minicode-ai 0.15.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/cli/auto-update.ts +24 -15
- package/cli/commands/exec.ts +3 -2
- package/cli/commands/openwork.ts +1 -1
- package/cli/commands.ts +6 -6
- package/cli/index.ts +61 -22
- package/cli/model-manager.ts +1 -1
- package/cli/setup.ts +119 -62
- package/cli/tui.ts +128 -13
- package/docs/CONTROL-PLANE-MAP.md +6 -4
- package/docs/OUTPUT_EVENT_MODEL.md +4 -3
- package/docs/OUTPUT_PROTOCOL_SPEC.md +1 -1
- package/docs/OUTPUT_RENDERING_SPEC.md +16 -4
- package/docs/OUTPUT_UX_RULES.md +38 -32
- package/docs/P14_OPEN_WORK.md +290 -0
- package/docs/README.md +1 -1
- package/docs/SUMMARY.md +36 -22
- package/docs/TERMINAL_CONTRACT.md +74 -11
- package/docs/UI_RENDER_PIPELINE.md +53 -11
- package/docs/agents.md +1 -1
- package/docs/architecture.md +9 -8
- package/docs/autonomous-scheduler.md +142 -0
- package/docs/choosing-mode.md +2 -2
- package/docs/cli.md +4 -4
- package/docs/concepts.md +5 -5
- package/docs/config-providers.md +3 -3
- package/docs/contributing.md +7 -9
- package/docs/environment.md +6 -4
- package/docs/getting-started.md +4 -4
- package/docs/mcp-lsp.md +2 -2
- package/docs/memory-sessions.md +1 -1
- package/docs/policy-sandbox.md +7 -4
- package/docs/pricing-budget.md +3 -3
- package/docs/quickstart.md +1 -1
- package/docs/repl.md +5 -5
- package/docs/security-model.md +1 -1
- package/docs/security.md +9 -8
- package/docs/skills.md +2 -2
- package/docs/terminal.md +10 -2
- package/docs/tools.md +4 -4
- package/docs/troubleshooting.md +3 -3
- package/docs/verify-benchmark.md +0 -3
- package/package.json +9 -18
- package/src/app/session.ts +40 -7
- package/src/constants.ts +31 -0
- package/src/hooks/run.ts +5 -6
- package/src/mcp/http-transport.ts +1 -1
- package/src/policy/bash-guard.ts +26 -6
- package/src/policy/compaction.ts +107 -17
- package/src/policy/consequence-engine.ts +3 -3
- package/src/policy/context-window.ts +24 -1
- package/src/policy/context.ts +16 -4
- package/src/policy/permission.ts +219 -4
- package/src/policy/update-check.ts +6 -4
- package/src/presentation/adapter.ts +1 -1
- package/src/presentation/events.ts +2 -2
- package/src/presentation/label.ts +3 -3
- package/src/presentation/model.ts +4 -0
- package/src/presentation/store.ts +2 -2
- package/src/runtime/child-execution.ts +1 -1
- package/src/runtime/composition.ts +5 -5
- package/src/runtime/execution-registry.ts +1 -1
- package/src/runtime/production-execution.ts +3 -3
- package/src/runtime/production-runtime.ts +2 -2
- package/src/runtime/runtime-capabilities.ts +1 -1
- package/src/runtime/runtime-status-facts.ts +1 -1
- package/src/runtime/runtime-task-admission.ts +2 -2
- package/src/session/context-assembly.ts +8 -1
- package/src/session/context-identity.ts +2 -2
- package/src/session/context-projection.ts +36 -11
- package/src/session/persistence.ts +1 -1
- package/src/task/autonomous-context.ts +2 -2
- package/src/task/autonomous-policy.ts +3 -3
- package/src/task/model.ts +2 -2
- package/src/task/production-scheduler.ts +2 -2
- package/src/task/scheduler.ts +3 -2
- package/src/task/scheduling-policy.ts +2 -1
- package/src/task/trigger.ts +5 -5
- package/src/tools/read_image.ts +2 -1
- package/src/tools/task.ts +1 -1
- package/src/ui/assistant/simple.ts +47 -30
- package/src/ui/footer.ts +48 -9
- package/src/ui/i18n/en.ts +21 -0
- package/src/ui/i18n/id.ts +21 -0
- package/src/ui/input/prompt-engine.ts +36 -10
- package/src/ui/render/activity-group.ts +53 -0
- package/src/ui/render/activity-panel.ts +91 -0
- package/src/ui/render/cells.ts +347 -0
- package/src/ui/render/composer-wrap.ts +73 -0
- package/src/ui/render/detail.ts +2 -2
- package/src/ui/render/diff.ts +7 -0
- package/src/ui/render/ledger.ts +47 -0
- package/src/ui/render/markdown.ts +6 -1
- package/src/ui/render/session-summary.ts +7 -2
- package/src/ui/render/theme.ts +40 -4
- package/src/ui/render/width.ts +2 -2
- package/src/ui/render/wrap.ts +5 -3
- package/src/ui/runtime/loading-bar.ts +125 -0
- package/src/ui/runtime/screen.ts +84 -7
- package/src/ui/runtime/statusline.ts +26 -0
- package/src/ui/screens/model-manager.ts +1 -1
- package/src/ui/session-state.ts +22 -0
- package/src/ui/tui/app.ts +336 -65
- package/src/ui/tui/transcript.ts +407 -106
- package/vendor/minicore/VENDOR.md +15 -11
- package/vendor/minicore/src/core/events.ts +1 -0
- package/vendor/minicore/src/core/loop.ts +10 -0
- package/vendor/minicore/src/core/session.ts +39 -0
package/cli/tui.ts
CHANGED
|
@@ -26,7 +26,12 @@ import {
|
|
|
26
26
|
} from "../src/presentation/projection.ts"
|
|
27
27
|
import { redoLastCheckpoint, undoLastCheckpoint } from "../src/session/checkpoint.ts"
|
|
28
28
|
import { renderSkill } from "../src/skills/loader.ts"
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
clipboardByteLength,
|
|
31
|
+
MAX_CLIPBOARD_BYTES,
|
|
32
|
+
MAX_COPY_TURNS,
|
|
33
|
+
writeClipboardOsc52,
|
|
34
|
+
} from "../src/ui/assistant/simple.ts"
|
|
30
35
|
import type { UiBus } from "../src/ui/contract.ts"
|
|
31
36
|
import { t } from "../src/ui/i18n/locale.ts"
|
|
32
37
|
import { loadHistory } from "../src/ui/input/input.ts"
|
|
@@ -77,14 +82,16 @@ function fmtCtx(n: number): string | undefined {
|
|
|
77
82
|
* F-CTX-1: metrik usage footer (biaya + window %) dari angka NYATA, tanpa
|
|
78
83
|
* perkiraan. Kosong = tak ada data relevan (belum belanja / flag window tak
|
|
79
84
|
* disetel) — footer tak pernah menampilkan persentase/biaya palsu.
|
|
85
|
+
*
|
|
86
|
+
* P1.4: persentase footer = OCCUPANCY konteks saat ini (param `used`), bukan
|
|
87
|
+
* total token yang sudah dibelanjakan sepanjang sesi. Memakai spend membuat
|
|
88
|
+
* footer mentok 100% setelah beberapa step meski konteks masih jauh di bawah
|
|
89
|
+
* window. `used` di-inject oleh pemanggil (cache per turn) agar angka
|
|
90
|
+
* O(history) `session.contextTokens` tak dihitung ulang tiap paint.
|
|
80
91
|
*/
|
|
81
|
-
function fmtUsageMetrics(ctx: CliSession): string | undefined {
|
|
92
|
+
function fmtUsageMetrics(ctx: CliSession, used: number): string | undefined {
|
|
82
93
|
const cost: number | undefined = ctx.usage.getSession().cost
|
|
83
94
|
const windowTokens: number | undefined = ctx.getContextWindowTokens?.() ?? ctx.contextWindowTokens
|
|
84
|
-
// P1.4: persentase footer = OCCUPANCY konteks saat ini, bukan total token
|
|
85
|
-
// yang sudah dibelanjakan sepanjang sesi. Memakai spend membuat footer
|
|
86
|
-
// mentok 100% setelah beberapa step meski konteks masih jauh di bawah window.
|
|
87
|
-
const used: number = ctx.session.contextTokens
|
|
88
95
|
const parts: string[] = []
|
|
89
96
|
if (cost !== undefined && Number.isFinite(cost) && cost > 0) parts.push(formatUsd(cost))
|
|
90
97
|
if (
|
|
@@ -102,7 +109,7 @@ function fmtUsageMetrics(ctx: CliSession): string | undefined {
|
|
|
102
109
|
/**
|
|
103
110
|
* Tangkap console.log/error selama `fn` → baris teks (tanpa warna liar:
|
|
104
111
|
* caller yang mewarnai). Dipakai membungkus handleBuiltinCommand supaya
|
|
105
|
-
* readout warisan (/help,
|
|
112
|
+
* readout warisan (/help, pesan status/undo) mendarat di transkrip,
|
|
106
113
|
* bukan menimpa frame alt-screen. View modal menulis via stdout.write
|
|
107
114
|
* langsung (bukan console) sehingga tak ikut tertangkap — layarnya tetap
|
|
108
115
|
* tampil normal (nested refcount screen.ts). Baris yang sudah tercetak
|
|
@@ -164,6 +171,13 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
164
171
|
? ctx.getPresentationSnapshot()
|
|
165
172
|
: { activities: [], turns: [] }
|
|
166
173
|
|
|
174
|
+
// [Fase 2] Panel aktivitas default ON di TUI (thinking + grup tool).
|
|
175
|
+
// Env MINICODE_ACTIVITY_PANEL=0 (opt-out eksplisit) / /fold mematikannya.
|
|
176
|
+
// Guard `ctx.uiState`: produksi SELALU mengoper state sesi (cli/setup.ts);
|
|
177
|
+
// fixture tes tanpa uiState memakai singleton `defaultUiState` — jangan
|
|
178
|
+
// dimutasi dari sini (bocor antar berkas tes).
|
|
179
|
+
if (ctx.uiState && process.env.MINICODE_ACTIVITY_PANEL !== "0") ui.setActivityPanel(true)
|
|
180
|
+
|
|
167
181
|
let mode: string = permissions?.getMode() ?? permissionMode ?? "auto"
|
|
168
182
|
// Mode permission sebelum /unrestric diaktifkan — dipakai untuk memulihkan
|
|
169
183
|
// saat operator menonaktifkannya kembali (toggle, per-sesi).
|
|
@@ -180,6 +194,55 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
180
194
|
let warned80 = false
|
|
181
195
|
let abort: AbortController | null = null
|
|
182
196
|
|
|
197
|
+
// Fase 1 perf (butir 2b): `session.contextTokens` adalah getter O(history)
|
|
198
|
+
// (estimateMessages mengiterasi SELURUH store + estimator per pesan). Footer
|
|
199
|
+
// membacanya tiap paint/ketikan — untuk chat panjang ini pengulangan token
|
|
200
|
+
// estimation penuh per ketikan. Committed store hanya berubah saat turn
|
|
201
|
+
// selesai (turnCount naik), jadi cache keyed turnCount aman + output-identik.
|
|
202
|
+
let cachedContext: { turn: number; tokens: number } | null = null
|
|
203
|
+
// Item 16 (live context): nilai per-step yang di-emit kernel (loop.ts, event
|
|
204
|
+
// `provider:extension` kind `context-window`). Saat turn berjalan nilainya
|
|
205
|
+
// O(1) dan terus diperbarui tiap step; direset di batas turn agar idle
|
|
206
|
+
// kembali ke nilai committed.
|
|
207
|
+
let liveContextTokens: number | undefined
|
|
208
|
+
const liveContextUnsubs: (() => void)[] = []
|
|
209
|
+
const uiBus = session.events as unknown as UiBus
|
|
210
|
+
try {
|
|
211
|
+
liveContextUnsubs.push(
|
|
212
|
+
uiBus.on("provider:extension", (e: { kind?: unknown; data?: unknown }) => {
|
|
213
|
+
if (e?.kind !== "context-window") return
|
|
214
|
+
const d = e.data as { usedTokens?: unknown } | undefined
|
|
215
|
+
if (typeof d?.usedTokens === "number") liveContextTokens = d.usedTokens
|
|
216
|
+
}),
|
|
217
|
+
)
|
|
218
|
+
} catch {}
|
|
219
|
+
try {
|
|
220
|
+
liveContextUnsubs.push(
|
|
221
|
+
uiBus.on("turn:started", () => {
|
|
222
|
+
liveContextTokens = undefined
|
|
223
|
+
}),
|
|
224
|
+
)
|
|
225
|
+
} catch {}
|
|
226
|
+
try {
|
|
227
|
+
liveContextUnsubs.push(
|
|
228
|
+
uiBus.on("turn:completed", () => {
|
|
229
|
+
liveContextTokens = undefined
|
|
230
|
+
}),
|
|
231
|
+
)
|
|
232
|
+
} catch {}
|
|
233
|
+
const getContextTokens = (): number => {
|
|
234
|
+
// Live (per-step) menang saat turn berjalan; idle → committed (cache).
|
|
235
|
+
if (liveContextTokens !== undefined) return liveContextTokens
|
|
236
|
+
// Beberapa fixture test menyediakan `session` parsial (tanpa `state`): tanpa
|
|
237
|
+
// sinyal turn yang andal, baca langsung seperti perilaku lama.
|
|
238
|
+
const turn = (session.state as { turnCount?: number } | undefined)?.turnCount
|
|
239
|
+
if (turn === undefined) return session.contextTokens
|
|
240
|
+
if (!cachedContext || cachedContext.turn !== turn) {
|
|
241
|
+
cachedContext = { turn, tokens: session.contextTokens }
|
|
242
|
+
}
|
|
243
|
+
return cachedContext.tokens
|
|
244
|
+
}
|
|
245
|
+
|
|
183
246
|
// Bahasa UI: state.json (sesi bisa menimpa via /lang). Gagal baca = default.
|
|
184
247
|
const { setConfigLocale } = await import("../src/ui/i18n/locale.ts")
|
|
185
248
|
try {
|
|
@@ -203,6 +266,34 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
203
266
|
},
|
|
204
267
|
})
|
|
205
268
|
|
|
269
|
+
// [resume] Rebuild riwayat transkrip dari event presentasi durable. Hanya sesi
|
|
270
|
+
// yang BENAR-BENAR di-resume (turnCount > 0) yang punya histori — `--session
|
|
271
|
+
// <id>` reuse tanpa `--resume` tak boleh menampilkan riwayat lama. Sesi baru
|
|
272
|
+
// (tanpa event) = no-op. Tak double-render: replay memproses event LAMA,
|
|
273
|
+
// turn live baru menyusul dengan event baru.
|
|
274
|
+
// Baris diagnostik startup yang didefer (resume/recovery/context/dll)
|
|
275
|
+
// di-flush ke transcript SEBELUM replay agar urutan kronologisnya benar
|
|
276
|
+
// (diagnostik dulu, lalu riwayat sesi).
|
|
277
|
+
if (ctx.startupNotices?.length) {
|
|
278
|
+
transcript.pushInfo(ctx.startupNotices)
|
|
279
|
+
}
|
|
280
|
+
try {
|
|
281
|
+
const turnCount = (session.state as { turnCount?: number } | undefined)?.turnCount ?? 0
|
|
282
|
+
if (turnCount > 0) {
|
|
283
|
+
const { loadPresentationEvents } = await import("../src/session/persistence.ts")
|
|
284
|
+
const { toPresentationEvent } = await import("./setup.ts")
|
|
285
|
+
const durable = await loadPresentationEvents(sessionId, cwd)
|
|
286
|
+
if (durable.length > 0) {
|
|
287
|
+
const events = durable
|
|
288
|
+
.map((e) => toPresentationEvent(e))
|
|
289
|
+
.filter((e): e is import("../src/ui/contract.ts").UiPresentationEvent => e !== null)
|
|
290
|
+
transcript.replayHistory(events)
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
} catch {
|
|
294
|
+
// Replay best-effort: gagal membaca histori bukan alasan membatalkan TUI.
|
|
295
|
+
}
|
|
296
|
+
|
|
206
297
|
const commandCtx: CommandContext = {
|
|
207
298
|
cwd,
|
|
208
299
|
sessionId,
|
|
@@ -443,6 +534,15 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
443
534
|
transcript.pushInfo([c.muted(t("tui.copyNone"))])
|
|
444
535
|
return
|
|
445
536
|
}
|
|
537
|
+
// Guard byte SEBELUM base64: 10 turn panjang bisa melewati batas OSC 52;
|
|
538
|
+
// memberi pesan spesifik lebih baik daripada gagal "butuh TTY" yang keliru.
|
|
539
|
+
const bytes = clipboardByteLength(txt)
|
|
540
|
+
if (bytes > MAX_CLIPBOARD_BYTES) {
|
|
541
|
+
transcript.pushInfo([
|
|
542
|
+
c.warning(t("tui.copyTooLarge", { n: bytes, max: MAX_CLIPBOARD_BYTES })),
|
|
543
|
+
])
|
|
544
|
+
return
|
|
545
|
+
}
|
|
446
546
|
if (writeClipboardOsc52(txt)) {
|
|
447
547
|
const key = turns.length > 1 ? "tui.copyOkMany" : "tui.copyOk"
|
|
448
548
|
transcript.pushInfo([c.muted(t(key, { n: txt.length, turns: turns.length }))])
|
|
@@ -576,8 +676,11 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
576
676
|
return
|
|
577
677
|
}
|
|
578
678
|
if (name === "fold") {
|
|
679
|
+
// [Fase 2] /fold = toggle PANEL AKTIVITAS (thinking + grup tool).
|
|
680
|
+
// Perilaku lama (minimizeActivity) tetap hidup saat panel off; `/fold`
|
|
681
|
+
// sekarang mengontrol panel. i18n key sama (folded/expanded).
|
|
579
682
|
const next = args === "" ? undefined : args === "on" || args === "1"
|
|
580
|
-
const on = ui.
|
|
683
|
+
const on = ui.setActivityPanel(next)
|
|
581
684
|
transcript.pushInfo([c.muted(t("tui.activityFold", { v: on ? "folded" : "expanded" }))])
|
|
582
685
|
return
|
|
583
686
|
}
|
|
@@ -691,6 +794,7 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
691
794
|
const host: TuiHost = {
|
|
692
795
|
bus: session.events as unknown as TuiHost["bus"],
|
|
693
796
|
getStatus: () => {
|
|
797
|
+
const busy = abort != null
|
|
694
798
|
const status = {
|
|
695
799
|
footer: {
|
|
696
800
|
// Normalisasi: sumbu persetujuan hanya AUTO/ASK. Profil warisan
|
|
@@ -706,13 +810,15 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
706
810
|
workMode: workModeControl?.getWorkMode() ?? "DISCUSS",
|
|
707
811
|
model: modelRef.current ?? cfg.providers[0]?.models[0] ?? t("tui.noModel"),
|
|
708
812
|
cwd: cwd ?? process.cwd(),
|
|
709
|
-
context: fmtCtx(
|
|
710
|
-
metrics: fmtUsageMetrics(ctx),
|
|
813
|
+
context: fmtCtx(getContextTokens()),
|
|
814
|
+
metrics: fmtUsageMetrics(ctx, getContextTokens()),
|
|
711
815
|
},
|
|
712
|
-
busy
|
|
816
|
+
busy,
|
|
713
817
|
}
|
|
818
|
+
// Fase 1 perf (butir 2): pinnedActivity hanya ditampilkan saat busy —
|
|
819
|
+
// jangan memindai seluruh activities pada tiap ketikan idle.
|
|
820
|
+
if (!busy) return { ...status, pinnedActivity: undefined }
|
|
714
821
|
const activities = getPresentationSnapshot().activities
|
|
715
|
-
|
|
716
822
|
return {
|
|
717
823
|
...status,
|
|
718
824
|
pinnedActivity:
|
|
@@ -758,12 +864,21 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
758
864
|
if (!res.started) {
|
|
759
865
|
// Kegagalan startup adalah diagnostik, bukan keluaran program. App
|
|
760
866
|
// sudah menolak membuka layar dan tidak ada fallback linear yang sah.
|
|
761
|
-
|
|
867
|
+
// Notices startup yang sempat didefer WAJIB tetap terlihat di jalur
|
|
868
|
+
// gagal ini (transcript tak pernah hidup) — digabung ke SATU write
|
|
869
|
+
// dengan pesan noTty agar inventaris writer tidak bertambah.
|
|
870
|
+
const deferred = ctx.startupNotices?.length ? ctx.startupNotices.join("") : ""
|
|
871
|
+
process.stderr.write(`${deferred}${t("tui.noTty")}\n`)
|
|
762
872
|
process.exitCode = 1
|
|
763
873
|
return
|
|
764
874
|
}
|
|
765
875
|
} finally {
|
|
766
876
|
setApprovalSink(null)
|
|
877
|
+
for (const unsub of liveContextUnsubs.splice(0)) {
|
|
878
|
+
try {
|
|
879
|
+
unsub()
|
|
880
|
+
} catch {}
|
|
881
|
+
}
|
|
767
882
|
transcript.dispose()
|
|
768
883
|
await close()
|
|
769
884
|
}
|
|
@@ -59,9 +59,12 @@ diselaraskan 0.9.27 saat seam dihilirkan; sebelumnya `budget:<…>`):
|
|
|
59
59
|
- *What is eligible?* — hanya messages; system prompt di-cap di hulu
|
|
60
60
|
(`SYSTEM_PROMPT_MAX_CHARS` 8000), tool schema TIDAK pernah terkompaksi.
|
|
61
61
|
- *What must be preserved?* — pasangan assistant(toolCalls)→tool results tidak
|
|
62
|
-
pernah dipecah (`compact.ts`);
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
pernah dipecah (folder mekanis kernel `vendor/minicore/src/core/compact.ts`);
|
|
63
|
+
summary LLM terpin verbatim (anti-drift).
|
|
64
|
+
- *What may be removed?* — teks di luar head per peran: jalur host
|
|
65
|
+
(`src/policy/compaction.ts`) mempertahankan hasil tool pembawa fakta ~800 char
|
|
66
|
+
dan prosa ~250/180 char (TIDAK lagi `<result omitted>` seperti folder mekanis
|
|
67
|
+
kernel), plus reasoning dan tail lama.
|
|
65
68
|
- *What if compaction fails?* — LLM gagal/timeout (10s) → fallback sync
|
|
66
69
|
mekanis; async compactor tak pernah bisa crash loop.
|
|
67
70
|
- *Can it retry?* — budget: tidak (flag); recovery: sekali per turn (flag).
|
|
@@ -140,6 +143,5 @@ Operator harus bisa membedakan (tanpa ambigu):
|
|
|
140
143
|
- `test/control-plane.test.ts` — compaction budget≠recovery (F-10), anti-loop,
|
|
141
144
|
contextTokens getter + konsistensi estimator, termination reason.
|
|
142
145
|
- `test/cli-help-language.test.ts` — /status membedakan Context/Usage/Budget.
|
|
143
|
-
- `test/repl-linear.test.ts` — footer membaca kernel contextTokens.
|
|
144
146
|
- `test/usage-session.test.ts` / `budget-unknown.test.ts` — budget contract.
|
|
145
147
|
- `test/pack-integrity.test.ts` — vendor hash + VENDOR.md sinkron.
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
**Status:** Phase 2 core state/replay contract landed; renderer/wire protocol masih target
|
|
4
4
|
**Tanggal:** 2026-09-25
|
|
5
|
-
**Kontrak aktif:**
|
|
5
|
+
**Kontrak aktif:** definisi tipe + registry durability di `src/presentation/events.ts`;
|
|
6
|
+
producer event di `src/presentation/adapter.ts` (events.ts tidak mem-`publish`).
|
|
6
7
|
|
|
7
8
|
## Status implementasi
|
|
8
9
|
|
|
@@ -133,8 +134,8 @@ mengarang final message.
|
|
|
133
134
|
| `diagnostic.raised` | adapter/policy | diagnostic actionable | ya |
|
|
134
135
|
|
|
135
136
|
Tool `completed` harus membawa `summary`, `durationMs`, `expandRef`, dan bila ada
|
|
136
|
-
`receipt`. Tool `failed` harus membawa `cause
|
|
137
|
-
Tool `denied` harus membawa `reason`; `denied` tidak boleh berubah menjadi generic
|
|
137
|
+
`receipt`. Tool `failed` harus membawa `cause` dan `message` (`hint` dan `expandRef`
|
|
138
|
+
opsional). Tool `denied` harus membawa `reason`; `denied` tidak boleh berubah menjadi generic
|
|
138
139
|
`failed` hanya karena satu renderer tidak tahu policy.
|
|
139
140
|
|
|
140
141
|
### Error, recovery, dan lifecycle
|
|
@@ -59,6 +59,14 @@ interface RendererInput {
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
> **Catatan sinkronisasi:** blok tipe di atas adalah **sketsa target**. Implementasi
|
|
63
|
+
> aktif memakai `UiPresentationSnapshot`/`PresentationPolicy` (`src/ui/contract.ts`)
|
|
64
|
+
> dan `ProjectionNode` berbentuk `{ kind, id, seq, data }` dengan kind
|
|
65
|
+
> `message|turn|tool|approval|reasoning|system|plan|finding|result|diagnostic`
|
|
66
|
+
> (`src/presentation/projection.ts`). Tipe `PresentationSnapshot`, `ContentResolver`,
|
|
67
|
+
> `RendererClock`, `SourceRef`, `EvidenceRef`, dan `SemanticError` belum ada sebagai
|
|
68
|
+
> tipe runtime.
|
|
69
|
+
|
|
62
70
|
`PresentationSnapshot` harus read-only. `ContentResolver` mengembalikan `ContentEntry`
|
|
63
71
|
dengan marker retention; tidak mengembalikan seluruh raw database tanpa batas.
|
|
64
72
|
`RendererClock` adalah satu-satunya sumber waktu visual; `Date.now()` tidak boleh
|
|
@@ -132,7 +140,8 @@ popup tidak boleh membuat listener stdin kedua.
|
|
|
132
140
|
- Assistant stream: live buffer yang di-cap; final node dipisah dari stream.
|
|
133
141
|
- Whitespace jawaban dirapikan hanya pada layer tampilan: baris kosong tepi dibuang,
|
|
134
142
|
jeda berulang di luar code fence dirapatkan, isi fenced code tetap literal.
|
|
135
|
-
- Activity: started → running → terminal, dengan glyph
|
|
143
|
+
- Activity: started → running → terminal, dengan status word (glyph status dihapus;
|
|
144
|
+
bukan lagi penanda `✓`/`✗` — lihat `OUTPUT_UX_RULES.md` §3).
|
|
136
145
|
- Tool child: default dikelompokkan ke parent `delegate_task`; child detail tersedia
|
|
137
146
|
pada verbose/debug.
|
|
138
147
|
- Context compaction: system entry, tidak menghapus history.
|
|
@@ -263,9 +272,12 @@ untuk regressions visual dan protocol.
|
|
|
263
272
|
3. TUI/linear dapat membandingkan canonical projection dengan legacy output pada test.
|
|
264
273
|
4. Exec/ACP memakai canonical projection lebih dulu karena machine parity paling mudah
|
|
265
274
|
diukur.
|
|
266
|
-
5.
|
|
267
|
-
|
|
268
|
-
|
|
275
|
+
5. Raw EventBus tetap dipakai untuk streaming content, trace, dan sebagian
|
|
276
|
+
lifecycle turn/execution yang dibaca TUI (`src/ui/tui/transcript.ts`,
|
|
277
|
+
`src/ui/tui/app.ts`); keputusan user-facing tetap lewat semantic
|
|
278
|
+
projection/policy. Klaim lama "raw semantic subscriptions dihapus dari TUI"
|
|
279
|
+
tidak akurat: TUI masih melanggan `turn:*`/`execution:*`/`provider:extension`
|
|
280
|
+
untuk transcript dan status.
|
|
269
281
|
|
|
270
282
|
## 13. Definition of done renderer
|
|
271
283
|
|
package/docs/OUTPUT_UX_RULES.md
CHANGED
|
@@ -38,8 +38,8 @@ RESULT
|
|
|
38
38
|
Tidak semua task membutuhkan semua section. Short task boleh:
|
|
39
39
|
|
|
40
40
|
```text
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
Updated src/router.ts
|
|
42
|
+
Tests passed
|
|
43
43
|
|
|
44
44
|
Done.
|
|
45
45
|
```
|
|
@@ -66,13 +66,13 @@ AUDIT
|
|
|
66
66
|
### Activity
|
|
67
67
|
|
|
68
68
|
```text
|
|
69
|
-
|
|
69
|
+
Analyzed 18 files
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
### Active operation
|
|
73
73
|
|
|
74
74
|
```text
|
|
75
|
-
|
|
75
|
+
› Analyzing source files…
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
### Warning
|
|
@@ -85,7 +85,7 @@ AUDIT
|
|
|
85
85
|
### Error
|
|
86
86
|
|
|
87
87
|
```text
|
|
88
|
-
|
|
88
|
+
Build failed
|
|
89
89
|
TypeScript compilation failed in src/app.ts.
|
|
90
90
|
→ Fix the reported errors and retry.
|
|
91
91
|
```
|
|
@@ -113,20 +113,26 @@ Plan hanya future work. “Read file”, “run grep”, dan “think” adalah
|
|
|
113
113
|
### Completion
|
|
114
114
|
|
|
115
115
|
```text
|
|
116
|
-
|
|
116
|
+
Audit complete · 18 files · 42s
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
## 3. Status vocabulary
|
|
120
120
|
|
|
121
|
+
Sejak v0.17.0 ikon status (`✓`/`✗`/`⊘`/`◌`) DIHAPUS — `glyphs.check/cross/denied/circle`
|
|
122
|
+
mengembalikan `""` (`src/ui/render/theme.ts`) karena bising dan tak konsisten antar
|
|
123
|
+
terminal. Status kini disampaikan lewat WARNA + kata; operasi aktif memakai chevron
|
|
124
|
+
`›` (lihat `TERMINAL_CONTRACT.md` invariant #1). Contoh di dokumen ini sudah mengikuti
|
|
125
|
+
format tanpa ikon status.
|
|
126
|
+
|
|
121
127
|
| Status | Glyph | Teks default | Arti |
|
|
122
128
|
|---|---|---|---|
|
|
123
|
-
| active |
|
|
124
|
-
| completed |
|
|
129
|
+
| active | `›` | `running` atau `active` | operasi masih berjalan |
|
|
130
|
+
| completed | — | `completed` | sukses terminal |
|
|
125
131
|
| warning | `⚠` | `warning` | perlu perhatian, belum terminal failure |
|
|
126
|
-
| failed |
|
|
127
|
-
| denied |
|
|
128
|
-
| cancelled |
|
|
129
|
-
| interrupted |
|
|
132
|
+
| failed | — | `failed` | operasi/turn gagal |
|
|
133
|
+
| denied | — | `denied` | policy/permission menolak |
|
|
134
|
+
| cancelled | — | `cancelled` | dibatalkan user/system |
|
|
135
|
+
| interrupted | — | `interrupted` | proses berhenti sebelum terminal |
|
|
130
136
|
| retrying | `↻` | `retrying` | recovery sedang berjalan |
|
|
131
137
|
| transition | `→` | `next` | tindakan berikutnya |
|
|
132
138
|
| info | `ℹ` | `info` | informasi non-actionable |
|
|
@@ -196,27 +202,27 @@ Satu baris ledger default:
|
|
|
196
202
|
Completion:
|
|
197
203
|
|
|
198
204
|
```text
|
|
199
|
-
|
|
205
|
+
read_file src/config.ts · completed
|
|
200
206
|
```
|
|
201
207
|
|
|
202
208
|
Failure:
|
|
203
209
|
|
|
204
210
|
```text
|
|
205
|
-
|
|
211
|
+
read_file src/config.ts · failed
|
|
206
212
|
File does not exist.
|
|
207
213
|
```
|
|
208
214
|
|
|
209
215
|
Denial:
|
|
210
216
|
|
|
211
217
|
```text
|
|
212
|
-
|
|
218
|
+
bash · denied
|
|
213
219
|
Permission denied by mode=plan.
|
|
214
220
|
```
|
|
215
221
|
|
|
216
222
|
Receipt:
|
|
217
223
|
|
|
218
224
|
```text
|
|
219
|
-
|
|
225
|
+
write_file src/router.ts · 1 file · 34ms
|
|
220
226
|
```
|
|
221
227
|
|
|
222
228
|
### Parallel
|
|
@@ -224,20 +230,20 @@ Receipt:
|
|
|
224
230
|
Jangan interleave raw output. Kelompokkan:
|
|
225
231
|
|
|
226
232
|
```text
|
|
227
|
-
|
|
233
|
+
› Analyzing 11 source files…
|
|
228
234
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
app.ts
|
|
236
|
+
config.ts
|
|
237
|
+
index.ts
|
|
238
|
+
router.ts
|
|
233
239
|
…
|
|
234
|
-
|
|
240
|
+
Source analysis complete · 11 files
|
|
235
241
|
```
|
|
236
242
|
|
|
237
243
|
Untuk batch besar:
|
|
238
244
|
|
|
239
245
|
```text
|
|
240
|
-
|
|
246
|
+
Analyzed 11 files
|
|
241
247
|
```
|
|
242
248
|
|
|
243
249
|
### Retry
|
|
@@ -264,15 +270,15 @@ Processing…
|
|
|
264
270
|
Dihindari. Gunakan:
|
|
265
271
|
|
|
266
272
|
```text
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
273
|
+
› Reading 18 files…
|
|
274
|
+
› Running tests…
|
|
275
|
+
› Applying migration…
|
|
270
276
|
```
|
|
271
277
|
|
|
272
278
|
Untuk long-running tool:
|
|
273
279
|
|
|
274
280
|
```text
|
|
275
|
-
|
|
281
|
+
› Running integration tests… (2m 14s)
|
|
276
282
|
```
|
|
277
283
|
|
|
278
284
|
Progress yang tidak berubah setelah stall dapat menjadi warning/timeout sesuai policy;
|
|
@@ -284,7 +290,7 @@ linear memakai transient heartbeat, dan machine memakai duration/status field.
|
|
|
284
290
|
Activity:
|
|
285
291
|
|
|
286
292
|
```text
|
|
287
|
-
|
|
293
|
+
Read src/app.ts · completed
|
|
288
294
|
```
|
|
289
295
|
|
|
290
296
|
Finding:
|
|
@@ -332,7 +338,7 @@ Kategori minimum:
|
|
|
332
338
|
Error example:
|
|
333
339
|
|
|
334
340
|
```text
|
|
335
|
-
|
|
341
|
+
Provider request failed
|
|
336
342
|
Rate limit reached while running the model.
|
|
337
343
|
→ Retry after the provider cooldown, or choose another provider.
|
|
338
344
|
```
|
|
@@ -347,13 +353,13 @@ Cancellation harus punya state, bukan hanya hilang:
|
|
|
347
353
|
```text
|
|
348
354
|
↻ Cancelling…
|
|
349
355
|
|
|
350
|
-
|
|
356
|
+
Task cancelled
|
|
351
357
|
```
|
|
352
358
|
|
|
353
359
|
Timeout:
|
|
354
360
|
|
|
355
361
|
```text
|
|
356
|
-
|
|
362
|
+
Operation timed out after 15m
|
|
357
363
|
→ Retry with a smaller scope or increase the timeout.
|
|
358
364
|
```
|
|
359
365
|
|
|
@@ -368,7 +374,7 @@ Recovery:
|
|
|
368
374
|
|
|
369
375
|
```text
|
|
370
376
|
↻ Provider unavailable; retrying with fallback…
|
|
371
|
-
|
|
377
|
+
Recovered using fallback provider.
|
|
372
378
|
```
|
|
373
379
|
|
|
374
380
|
TUI harus mencegah live stream/foreign painter menimpa state terminal. Linear harus
|