minicode-ai 0.21.0 → 0.23.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 +1 -1
- package/cli/commands/exec.ts +44 -1
- package/cli/commands.ts +15 -2
- package/cli/index.ts +11 -0
- package/cli/setup.ts +88 -33
- package/cli/tui.ts +3 -3
- package/docs/TERMINAL_CONTRACT.md +69 -13
- package/docs/architecture.md +9 -5
- package/docs/concepts.md +1 -1
- package/docs/contributing.md +2 -1
- package/docs/environment.md +4 -0
- package/docs/policy-sandbox.md +6 -1
- package/docs/security.md +12 -4
- package/docs/skills.md +1 -1
- package/package.json +2 -2
- package/src/app/session.ts +129 -20
- package/src/config.ts +108 -8
- package/src/constants.ts +29 -4
- package/src/daemon/discovery.ts +24 -0
- package/src/policy/bash-guard.ts +170 -6
- package/src/policy/compaction.ts +61 -7
- package/src/policy/context-budget.ts +132 -0
- package/src/policy/context-escalation.ts +140 -0
- package/src/policy/context-window.ts +47 -9
- package/src/policy/context.ts +10 -1
- package/src/policy/jail.ts +10 -22
- package/src/policy/microcompact.ts +162 -0
- package/src/policy/permission.ts +9 -6
- package/src/presentation/projection.ts +1 -1
- package/src/providers/anthropic.ts +31 -7
- package/src/providers/detect.ts +128 -13
- package/src/providers/provision.ts +78 -1
- package/src/providers/responses.ts +14 -2
- package/src/providers/sse-bounds.ts +16 -2
- package/src/session/persistence.ts +56 -0
- package/src/ui/approval/prompt.ts +17 -6
- package/src/ui/assistant/simple.ts +1 -1
- package/src/ui/footer.ts +2 -2
- package/src/ui/i18n/en.ts +28 -5
- package/src/ui/i18n/id.ts +30 -5
- package/src/ui/input/input.ts +2 -2
- package/src/ui/input/prompt-engine.ts +6 -0
- package/src/ui/render/activity-panel.ts +21 -3
- package/src/ui/render/diff.ts +51 -2
- package/src/ui/render/highlight.ts +68 -37
- package/src/ui/render/hint.ts +28 -0
- package/src/ui/render/logo.ts +91 -0
- package/src/ui/render/sanitize.ts +5 -1
- package/src/ui/render/session-summary.ts +28 -5
- package/src/ui/render/table-grid.ts +123 -13
- package/src/ui/render/table.ts +4 -2
- package/src/ui/render/theme.ts +16 -3
- package/src/ui/render/width.ts +35 -6
- package/src/ui/render/wrap.ts +28 -6
- package/src/ui/runtime/loading-bar.ts +17 -5
- package/src/ui/runtime/screen.ts +4 -2
- package/src/ui/screens/dialog.ts +23 -2
- package/src/ui/screens/form.ts +71 -33
- package/src/ui/screens/lifecycle.ts +80 -0
- package/src/ui/screens/model-manager.ts +85 -83
- package/src/ui/screens/picker.ts +39 -25
- package/src/ui/screens/provider-manager.ts +58 -55
- package/src/ui/screens/watchdog.ts +27 -0
- package/src/ui/screens/wizard.ts +12 -1
- package/src/ui/tui/app.ts +62 -22
- package/src/ui/tui/transcript.ts +93 -23
- package/vendor/minicore/src/core/compact.ts +10 -0
- package/vendor/minicore/src/core/errors.ts +11 -1
- package/vendor/minicore/src/core/executor.ts +6 -1
- package/vendor/minicore/src/core/loop.ts +92 -2
- package/vendor/minicore/src/core/session.ts +8 -0
- package/vendor/minicore/src/providers/openai-compat.ts +45 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MiniCode
|
|
2
2
|
|
|
3
|
-
MiniCode is an open-source terminal coding agent built on the
|
|
3
|
+
MiniCode is an open-source terminal coding agent built on the vendored MiniCore kernel (host-editable since v0.16.0). It is zero-dependency (Bun is the only runtime). It inspects and edits a workspace, runs local tools, and connects to the AI providers and MCP/LSP servers you configure.
|
|
4
4
|
|
|
5
5
|
Interactive sessions run as a fullscreen TUI; one-shot and automation runs flow to the shell scrollback or a machine-readable JSONL stream. Every tool action is visible in the ledger, file changes are jailed to the workspace, and sensitive actions are gated behind your permission. Prompts and relevant workspace context are sent to the provider you configure; MCP and LSP servers may receive data or perform external effects. MiniCode itself sends no telemetry — traces are local-only (`MINICODE_TELEMETRY=0` to disable).
|
|
6
6
|
|
package/cli/commands/exec.ts
CHANGED
|
@@ -34,6 +34,14 @@ function writeMachineLine(line: string): void {
|
|
|
34
34
|
process.stdout.write(`${cleanUntrusted(scrubSecrets(line), false)}\n`)
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/** Prompt lanjutan (Phase D auto-continue): minta model menyelesaikan sisa
|
|
38
|
+
* pekerjaan dari titik berhenti, memanfaatkan progres parsial yang sudah
|
|
39
|
+
* durable (safeTurnBoundary + persist). */
|
|
40
|
+
const CONTINUE_PROMPT =
|
|
41
|
+
"Continue from where you left off: an earlier turn hit the tool-step limit " +
|
|
42
|
+
"but its completed steps are preserved. Finish the remaining work now " +
|
|
43
|
+
"(re-read state if needed) and do not start over from scratch."
|
|
44
|
+
|
|
37
45
|
function machineSummary(ok: boolean, fields: Record<string, unknown>): Record<string, unknown> {
|
|
38
46
|
return { schema: MACHINE_SCHEMA, type: "summary", ok, ...fields }
|
|
39
47
|
}
|
|
@@ -186,6 +194,18 @@ export async function handleExec(
|
|
|
186
194
|
)
|
|
187
195
|
timeoutMs = 900_000
|
|
188
196
|
}
|
|
197
|
+
// Phase D — auto-continue (opt-in): pecah tugas panjang menjadi beberapa turn
|
|
198
|
+
// bounded. Saat turn berakhir dengan max_steps_exceeded, kernel SUDAH
|
|
199
|
+
// meng-commit progres parsial (safeTurnBoundary); run lanjutan melanjutkan dari
|
|
200
|
+
// situ alih-alih mati fatal. `--max-turns` menetapkan jumlah turn lanjutan
|
|
201
|
+
// (default 3) — hard cap mencegah loop belanja; --budget tetap mengikat per turn.
|
|
202
|
+
const autoContinue =
|
|
203
|
+
hasFlag(subArgs, "--auto-continue") || process.env.MINICODE_AUTO_CONTINUE === "1"
|
|
204
|
+
const maxTurnsRaw = getArg("--max-turns")
|
|
205
|
+
const autoContinueBudget =
|
|
206
|
+
maxTurnsRaw && Number.isFinite(Number(maxTurnsRaw)) && Number(maxTurnsRaw) > 0
|
|
207
|
+
? Math.min(20, Math.floor(Number(maxTurnsRaw)))
|
|
208
|
+
: 3
|
|
189
209
|
|
|
190
210
|
const ignoredFlags = flagsAfterPromptBoundary(subArgs)
|
|
191
211
|
if (ignoredFlags.length > 0) {
|
|
@@ -296,7 +316,30 @@ export async function handleExec(
|
|
|
296
316
|
)
|
|
297
317
|
})
|
|
298
318
|
try {
|
|
299
|
-
|
|
319
|
+
if (autoContinue) {
|
|
320
|
+
// Lanjutkan sampai selesai / cap tercapai. `isStepLimit` memisahkan
|
|
321
|
+
// "habis langkah" (layak dilanjut) dari error lain (auth/network/dll yang
|
|
322
|
+
// wajib gagal keras). Tiap iterasi = satu turn utuh pada sesi sama; kernel
|
|
323
|
+
// sudah commit progres parsial turn yang gagal (safeTurnBoundary).
|
|
324
|
+
const isStepLimit = (e: unknown): boolean =>
|
|
325
|
+
(e as { kind?: string } | undefined)?.kind === "max_steps_exceeded" ||
|
|
326
|
+
/max.?steps/i.test(String((e as { message?: string } | undefined)?.message ?? ""))
|
|
327
|
+
for (let i = 0; i <= autoContinueBudget; i++) {
|
|
328
|
+
let err: unknown = null
|
|
329
|
+
try {
|
|
330
|
+
await ctx.runPromptWithVerify(i === 0 ? effectivePrompt : CONTINUE_PROMPT)
|
|
331
|
+
} catch (e) {
|
|
332
|
+
err = e
|
|
333
|
+
}
|
|
334
|
+
if (err === null) break
|
|
335
|
+
if (!isStepLimit(err) || i >= autoContinueBudget) throw err
|
|
336
|
+
process.stderr.write(
|
|
337
|
+
`[auto-continue] batas langkah tercapai — melanjutkan (turn lanjutan ${i + 1}/${autoContinueBudget})\n`,
|
|
338
|
+
)
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
await ctx.runPromptWithVerify(effectivePrompt)
|
|
342
|
+
}
|
|
300
343
|
// Harness-P1: exec sebelumnya mengabaikan --budget total (flag diteruskan
|
|
301
344
|
// tapi tak pernah diperiksa). Samakan dengan one-shot: over → exit 1.
|
|
302
345
|
const ue = ctx.usage.getSession(ctx.modelRef.current)
|
package/cli/commands.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "../src/task/scheduler-observability.ts"
|
|
13
13
|
import { type MsgKey, t } from "../src/ui/i18n/locale.ts"
|
|
14
14
|
import { formatUsd } from "../src/ui/render/money.ts"
|
|
15
|
+
import { sanitizeAnsiLine } from "../src/ui/render/sanitize.ts"
|
|
15
16
|
import { glyphs } from "../src/ui/render/theme.ts"
|
|
16
17
|
import { padToWidth } from "../src/ui/render/width.ts"
|
|
17
18
|
|
|
@@ -237,6 +238,16 @@ function statusLines(ctx: CommandContext): string[] {
|
|
|
237
238
|
t("st.output", { v: u.outputTokens.toLocaleString() }),
|
|
238
239
|
t("st.total", { v: u.totalTokens.toLocaleString() }),
|
|
239
240
|
t("st.cost", { v: u.cost != null ? formatUsd(u.cost) : "N/A" }),
|
|
241
|
+
// Fase 7 (pengukuran cache): tampilkan hit/read hanya bila ada aktivitas cache —
|
|
242
|
+
// baris nol-byte untuk sesi tanpa caching (clean & minimal).
|
|
243
|
+
...((u.cacheReadTokens ?? 0) > 0 || (u.cacheWriteTokens ?? 0) > 0
|
|
244
|
+
? [
|
|
245
|
+
t("st.cache", {
|
|
246
|
+
read: (u.cacheReadTokens ?? 0).toLocaleString(),
|
|
247
|
+
write: (u.cacheWriteTokens ?? 0).toLocaleString(),
|
|
248
|
+
}),
|
|
249
|
+
]
|
|
250
|
+
: []),
|
|
240
251
|
t("st.budget", {
|
|
241
252
|
v: ctx.budgetState(),
|
|
242
253
|
extra: u.cost == null ? t("st.costUnknown") : "",
|
|
@@ -594,11 +605,13 @@ export async function handleBuiltinCommand(
|
|
|
594
605
|
if (cfg.providers.length === 0) console.log(t("cmd.noProviders"))
|
|
595
606
|
else console.log(t("cmd.noChanges"))
|
|
596
607
|
} else {
|
|
608
|
+
// id provider datang dari probe jaringan (tak-terpercaya): paritas
|
|
609
|
+
// dengan `minicode providers sync` yang sudah menyaring ANSI.
|
|
597
610
|
for (const r of updated) {
|
|
598
|
-
console.log(` ${glyphs.check} ${r.id}: ${r.from} → ${r.to}`)
|
|
611
|
+
console.log(` ${glyphs.check} ${sanitizeAnsiLine(r.id)}: ${r.from} → ${r.to}`)
|
|
599
612
|
}
|
|
600
613
|
for (const f of failed) {
|
|
601
|
-
console.log(` ${glyphs.cross} ${f.id}: ${f.reason}`)
|
|
614
|
+
console.log(` ${glyphs.cross} ${sanitizeAnsiLine(f.id)}: ${sanitizeAnsiLine(f.reason)}`)
|
|
602
615
|
}
|
|
603
616
|
// "Restart" hanya jujur bila ADA model baru — tanpa updated, restart
|
|
604
617
|
// tak mengubah apa pun (sebelumnya selalu dicetak, menyesatkan saat
|
package/cli/index.ts
CHANGED
|
@@ -543,6 +543,15 @@ let setupBar: LoadingBar | null = null
|
|
|
543
543
|
const setupBarPhases: Record<string, { pct: number; label: MsgKey }> = {
|
|
544
544
|
"provider-layer": { pct: 55, label: "loading.provider" },
|
|
545
545
|
"rag-layer": { pct: 75, label: "loading.rag" },
|
|
546
|
+
// Load-histori resume (paling lambat saat repo berhistori banyak) — sekarang
|
|
547
|
+
// ter-instrumentasi via startupPhase di cli/setup.ts sehingga bar TIDAK mandeg
|
|
548
|
+
// diam di 75% selama loadSession/history/projection/select/workspace. Nilai pct
|
|
549
|
+
// hampiran berurutan; di-tune setelah MINICODE_DEBUG_STARTUP=1 diukur di repo besar.
|
|
550
|
+
"resume-session": { pct: 78, label: "loading.session" },
|
|
551
|
+
"resume-history": { pct: 82, label: "loading.session" },
|
|
552
|
+
"resume-projection": { pct: 84, label: "loading.session" },
|
|
553
|
+
"resume-select": { pct: 86, label: "loading.session" },
|
|
554
|
+
"resume-workspace": { pct: 88, label: "loading.session" },
|
|
546
555
|
"tool-layer": { pct: 90, label: "loading.session" },
|
|
547
556
|
"kernel-session": { pct: 98, label: "loading.session" },
|
|
548
557
|
}
|
|
@@ -653,6 +662,8 @@ if (enterRepl) {
|
|
|
653
662
|
sessionId: ctx.sessionId,
|
|
654
663
|
model: ctx.modelRef.current ?? "default",
|
|
655
664
|
totalTokens: u.totalTokens,
|
|
665
|
+
inputTokens: u.inputTokens,
|
|
666
|
+
cacheReadTokens: u.cacheReadTokens,
|
|
656
667
|
...(u.cost != null ? { cost: u.cost } : {}),
|
|
657
668
|
durationMs: Date.now() - replStart,
|
|
658
669
|
})
|
package/cli/setup.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "../src/app/session.ts"
|
|
14
14
|
import { setupToolLayer } from "../src/app/tool-layer.ts"
|
|
15
15
|
import type { MinicodeConfig } from "../src/config.ts"
|
|
16
|
-
import { loadLastModel, localConfigNotice } from "../src/config.ts"
|
|
16
|
+
import { loadLang, loadLastModel, localConfigNotice } from "../src/config.ts"
|
|
17
17
|
import { LIMITS } from "../src/constants.ts"
|
|
18
18
|
import { runRunHooks, shouldRunHooks } from "../src/hooks/run.ts"
|
|
19
19
|
import { homeDir } from "../src/lib/db-path.ts"
|
|
@@ -115,10 +115,7 @@ import {
|
|
|
115
115
|
runtimeMetadataFromSelection,
|
|
116
116
|
} from "../src/session/context-adapter.ts"
|
|
117
117
|
import { type ContextOnlyArtifact, stripContextOnly } from "../src/session/context-assembly.ts"
|
|
118
|
-
import {
|
|
119
|
-
countDurableCompactions,
|
|
120
|
-
deriveFrontierFromDurable,
|
|
121
|
-
} from "../src/session/context-identity.ts"
|
|
118
|
+
import { deriveFrontierFromDurable } from "../src/session/context-identity.ts"
|
|
122
119
|
import {
|
|
123
120
|
produceSummaryProjection,
|
|
124
121
|
readConsumableSummaryProjection,
|
|
@@ -148,6 +145,7 @@ import {
|
|
|
148
145
|
appendPresentationEvents,
|
|
149
146
|
backfillHistoryEventIds,
|
|
150
147
|
completeRun,
|
|
148
|
+
countDurableCompactionEvents,
|
|
151
149
|
createRun,
|
|
152
150
|
DEFAULT_THREAD_ID,
|
|
153
151
|
ensureDefaultThread,
|
|
@@ -156,6 +154,7 @@ import {
|
|
|
156
154
|
listPersistedTurns,
|
|
157
155
|
loadPresentationEvents,
|
|
158
156
|
loadSession,
|
|
157
|
+
loadSessionMeta,
|
|
159
158
|
loadSessionUsageSummary,
|
|
160
159
|
loadSessionWorkMode,
|
|
161
160
|
loadThreadHistoryWithSeq,
|
|
@@ -963,7 +962,8 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
963
962
|
})
|
|
964
963
|
const sessionId = identity.sid
|
|
965
964
|
const bootId = identity.bootId
|
|
966
|
-
|
|
965
|
+
// Identitas internal (sid/boot) — hanya --verbose; "resumed session …" sudah human-friendly.
|
|
966
|
+
if (verbose) startupWrite(`${c.dim(formatSessionIdentityLine(identity))}\n`)
|
|
967
967
|
|
|
968
968
|
// P2.2 — admission penulis tunggal. Lease = admission; pagar mutasi =
|
|
969
969
|
// writer_epoch (CAS di transaksi tulis). Komposisi ini MEMEGANG lease
|
|
@@ -985,9 +985,11 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
985
985
|
)
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
988
|
+
// Lease sukses = internal; hanya --verbose (STALE/lease-lost tetap tampil).
|
|
989
|
+
if (verbose)
|
|
990
|
+
startupWrite(
|
|
991
|
+
`${c.dim(`[writer] admitted sid=${sessionId} boot=${bootId} epoch=${expectedEpoch}${admission.admission.tookOver ? " (takeover)" : ""}${admission.admission.fresh ? " (fresh)" : ""}\n`)}`,
|
|
992
|
+
)
|
|
991
993
|
// [P14] Adopsi eksplisit berjalan SETELAH admission target (token target
|
|
992
994
|
// sudah sah) dan SEBELUM turn pertama. Gagal = lepas lease target lalu
|
|
993
995
|
// lempar error terklasifikasi; jangan pernah meninggalkan target terkunci
|
|
@@ -1360,11 +1362,17 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1360
1362
|
`${c.dim(`[thread sid=${sessionId} tid=${defaultThread.thread_id} head=${defaultThread.head_seq}${backfilled > 0 ? ` backfilled=${backfilled}` : ""}]\n`)}`,
|
|
1361
1363
|
)
|
|
1362
1364
|
try {
|
|
1363
|
-
const
|
|
1364
|
-
if (
|
|
1365
|
+
const meta = await startupPhase("resume-session", async () => loadSessionMeta(sessionId, cwd))
|
|
1366
|
+
if (meta) {
|
|
1365
1367
|
resumeUsageSnapshot = loadSessionUsageSummary(sessionId, cwd)
|
|
1366
1368
|
}
|
|
1367
|
-
|
|
1369
|
+
// BACA histori SEKALI (dengan seq). loadSessionMeta tidak decode messages,
|
|
1370
|
+
// jadi decode penuh tinggal SATU kali (dulu `loadSession` + `loadThreadHistoryWithSeq`
|
|
1371
|
+
// decode dua kali — akar lemot resume berhistori banyak, lihat audit perf).
|
|
1372
|
+
const rowsForSelector = await startupPhase("resume-history", async () =>
|
|
1373
|
+
loadThreadHistoryWithSeq(sessionId, defaultThread.thread_id, cwd),
|
|
1374
|
+
)
|
|
1375
|
+
if (meta && rowsForSelector.length) {
|
|
1368
1376
|
// [Fase 4 / LOOP-13, LOOP-INV-16] Kumpulkan snapshot state operasional
|
|
1369
1377
|
// deterministik dari sumber durable (TaskStore + usage historis) agar
|
|
1370
1378
|
// header [RUNTIME_STATE_HEADER] ikut ke konteks resume — tak hilang
|
|
@@ -1381,7 +1389,7 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1381
1389
|
totalTokens: resumeUsageSnapshot?.totalTokens ?? 0,
|
|
1382
1390
|
cost: resumeUsageSnapshot?.totalCostUsd,
|
|
1383
1391
|
}),
|
|
1384
|
-
getTurnCount: () =>
|
|
1392
|
+
getTurnCount: () => meta.turnCount ?? 0,
|
|
1385
1393
|
}
|
|
1386
1394
|
operationalState = collectOperationalState(
|
|
1387
1395
|
sessionId,
|
|
@@ -1400,16 +1408,15 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1400
1408
|
// Batasi histori resume ke batas model, tanpa mengarang overhead.
|
|
1401
1409
|
// Kernel menghitung system+tools aktual dan memadatkan sebelum request;
|
|
1402
1410
|
// selector hanya membuang ke budget-tail bila pesan sendiri tak muat.
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1411
|
+
// Hitung revisi kompaksi langsung dari kolom `type` — tanpa memuat +
|
|
1412
|
+
// decode seluruh presentation_events (dulu tarik ratusan ribu baris
|
|
1413
|
+
// hanya untuk menghitung revisi; kini COUNT(*) SQL, lihat audit perf).
|
|
1414
|
+
const revision = countDurableCompactionEvents(sessionId, cwd)
|
|
1406
1415
|
// P3.4: proyeksi kanonik durable adalah sumber UTAMA untuk selector
|
|
1407
1416
|
// (cakupan-valid: CURRENT atau STALE berjangkar utuh, P3.0 §8 D6),
|
|
1408
1417
|
// sehingga `summary-plus-tail` menjadi perilaku produksi nyata.
|
|
1409
|
-
const durableProjection =
|
|
1410
|
-
sessionId,
|
|
1411
|
-
cwd,
|
|
1412
|
-
defaultThread.thread_id,
|
|
1418
|
+
const durableProjection = await startupPhase("resume-projection", async () =>
|
|
1419
|
+
readConsumableSummaryProjection(sessionId, cwd, defaultThread.thread_id),
|
|
1413
1420
|
)
|
|
1414
1421
|
const projectionSummary = durableProjection
|
|
1415
1422
|
const selectedWindow = getContextWindowTokens()
|
|
@@ -1425,15 +1432,17 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1425
1432
|
rows: rowsToCanonicalRefs(selectorRows),
|
|
1426
1433
|
revision,
|
|
1427
1434
|
})
|
|
1428
|
-
const selection =
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1435
|
+
const selection = await startupPhase("resume-select", async () =>
|
|
1436
|
+
selectContext({
|
|
1437
|
+
sessionId,
|
|
1438
|
+
threadId: defaultThread.thread_id,
|
|
1439
|
+
rows: selectorRows,
|
|
1440
|
+
revision,
|
|
1441
|
+
...(projectionSummary ? { projection: projectionSummary } : {}),
|
|
1442
|
+
policy: { budgetTokens: messageBudget, estimator: minicodeEstimator },
|
|
1443
|
+
canonicalFrontier,
|
|
1444
|
+
}),
|
|
1445
|
+
)
|
|
1437
1446
|
initialMessages = selection.messages as readonly Message[]
|
|
1438
1447
|
// [Fase 4 / LOOP-13, LOOP-INV-16] Simpan snapshot state operasional
|
|
1439
1448
|
// deterministik untuk dijadikan header di SYSTEM prompt (buffer kedua):
|
|
@@ -1452,14 +1461,14 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1452
1461
|
runtimeContextMetadata = runtimeMetadataFromSelection(selection, revision)
|
|
1453
1462
|
if (selection.contextOnly) {
|
|
1454
1463
|
contextOnlyArtifact = selection.contextOnly
|
|
1455
|
-
contextCanonicalBaseline =
|
|
1464
|
+
contextCanonicalBaseline = rowsForSelector.map((r) => r.message)
|
|
1456
1465
|
}
|
|
1457
|
-
resumeTurnCount =
|
|
1466
|
+
resumeTurnCount = meta.turnCount
|
|
1458
1467
|
startupConsoleError(
|
|
1459
1468
|
c.dim(
|
|
1460
1469
|
// "(N messages)" dipertahankan VERBATIM (kontrak diagnostik yang
|
|
1461
1470
|
// sudah dipakai test/CLI).
|
|
1462
|
-
`[resumed session ${sessionId} (${
|
|
1471
|
+
`[resumed session ${sessionId} (${rowsForSelector.length} messages)]\n`,
|
|
1463
1472
|
),
|
|
1464
1473
|
)
|
|
1465
1474
|
// P3.3 — jejak provenance seleksi (baca-saja; tak mengubah perilaku).
|
|
@@ -1471,7 +1480,9 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1471
1480
|
// P3 — validasi resume: bukan replay buta. Bila workspace berubah
|
|
1472
1481
|
// sejak checkpoint terakhir (edit manual / run lain), beri tahu —
|
|
1473
1482
|
// /undo tersedia bila perlu kembali. Best-effort, tak menggagalkan resume.
|
|
1474
|
-
const div = await
|
|
1483
|
+
const div = await startupPhase("resume-workspace", async () =>
|
|
1484
|
+
validateResumeWorkspace(cwd ?? ".", sessionId).catch(() => null),
|
|
1485
|
+
)
|
|
1475
1486
|
if (div && div.diverged > 0) {
|
|
1476
1487
|
startupConsoleError(
|
|
1477
1488
|
c.yellow(
|
|
@@ -1941,6 +1952,9 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1941
1952
|
|
|
1942
1953
|
let permissions: PermissionControl | undefined
|
|
1943
1954
|
let noProgressDetector: NoProgressDetector | null = null
|
|
1955
|
+
// Jendela konteks hasil eskalasi adaptif (0 = belum ada). Dipakai /status
|
|
1956
|
+
// untuk menampilkan angka efektif, bukan tebakan awal.
|
|
1957
|
+
const escalatedWindowRef = { current: 0 }
|
|
1944
1958
|
const effectiveMaxTurns = (() => {
|
|
1945
1959
|
const raw = (opts as { maxTurns?: number }).maxTurns ?? Number(process.env.MINICODE_MAX_TURNS)
|
|
1946
1960
|
return typeof raw === "number" && Number.isFinite(raw) && raw >= 1 ? Math.floor(raw) : undefined
|
|
@@ -1954,11 +1968,17 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1954
1968
|
const v = opts.writeConcurrency
|
|
1955
1969
|
return typeof v === "number" && Number.isFinite(v) && v > 0 ? Math.floor(v) : undefined
|
|
1956
1970
|
})()
|
|
1971
|
+
// Muat state.json.lang LEBIH AWAL (tui.ts memuatnya setelah sesi terbangun) agar
|
|
1972
|
+
// direktif chat di system prompt ikut pilihan user; resolusi tetap currentLocale().
|
|
1973
|
+
const { currentLocale, setConfigLocale } = await import("../src/ui/i18n/locale.ts")
|
|
1974
|
+
setConfigLocale((await loadLang().catch(() => undefined)) ?? null)
|
|
1975
|
+
const sessionLang = currentLocale()
|
|
1957
1976
|
const session = await startupPhase("kernel-session", () =>
|
|
1958
1977
|
createMinicodeSession({
|
|
1959
1978
|
provider: router,
|
|
1960
1979
|
tools: sessionTools,
|
|
1961
1980
|
cwd,
|
|
1981
|
+
lang: sessionLang,
|
|
1962
1982
|
permissionMode,
|
|
1963
1983
|
restrictBash,
|
|
1964
1984
|
allowLocalConfig,
|
|
@@ -2020,6 +2040,17 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
2020
2040
|
onNoProgress: (detector) => {
|
|
2021
2041
|
noProgressDetector = detector
|
|
2022
2042
|
},
|
|
2043
|
+
// Eskalasi jendela konteks: beritahu user secara eksplisit. Tanpa ini,
|
|
2044
|
+
// jendela yang naik otomatis terasa seperti angka ajaib — user perlu tahu
|
|
2045
|
+
// bahwa ada BUKTI overflow dan berapa nilai barunya, agar bisa memutuskan
|
|
2046
|
+
// menyetel `contextWindows` permanen bila perlu.
|
|
2047
|
+
onContextWindowEscalated: (info) => {
|
|
2048
|
+
startupWrite(
|
|
2049
|
+
`${c.yellow(`[context] window raised ${info.fromTokens} → ${info.toTokens} tokens for ${sanitizeAnsi(info.model)} after a verified context overflow (observed ${info.observedTokens}). Set provider.contextWindows to make it permanent.
|
|
2050
|
+
`)}`,
|
|
2051
|
+
)
|
|
2052
|
+
escalatedWindowRef.current = info.toTokens
|
|
2053
|
+
},
|
|
2023
2054
|
...(maxSteps ? { maxSteps } : {}),
|
|
2024
2055
|
...(keepRecentTurns ? { keepRecentTurns } : {}),
|
|
2025
2056
|
...(safeConcurrency ? { concurrency: safeConcurrency } : {}),
|
|
@@ -2395,6 +2426,30 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
2395
2426
|
})
|
|
2396
2427
|
} catch {}
|
|
2397
2428
|
})
|
|
2429
|
+
// ── Phase C: soft-cap warning (host-side) ──
|
|
2430
|
+
// Peringatkan SEKALI per turn saat langkah mendekati cap (~85%) supaya operator
|
|
2431
|
+
// tahu batas akan tercapai dan bisa memecah/mendelegasikan sebelum tabrakan
|
|
2432
|
+
// keras di "Batas langkah tool tercapai". Operator-facing (stderr); menembus
|
|
2433
|
+
// ke MODEL butuh seam system-prompt terpisah (di luar scope fase ini).
|
|
2434
|
+
let softStepWarned = false
|
|
2435
|
+
session.events.on("turn:started", () => {
|
|
2436
|
+
softStepWarned = false
|
|
2437
|
+
})
|
|
2438
|
+
session.events.on("step:completed", (e) => {
|
|
2439
|
+
try {
|
|
2440
|
+
if (softStepWarned) return
|
|
2441
|
+
const cap = maxSteps ?? LIMITS.DEFAULT_MAX_STEPS
|
|
2442
|
+
const idx = (e.step as { index?: unknown })?.index
|
|
2443
|
+
if (typeof idx !== "number") return
|
|
2444
|
+
const threshold = Math.max(1, Math.floor(cap * 0.85))
|
|
2445
|
+
if (idx >= threshold && idx < cap) {
|
|
2446
|
+
softStepWarned = true
|
|
2447
|
+
warnLine(
|
|
2448
|
+
`mendekati batas langkah (step ${idx}/${cap}) — bungkus hasil, delegasikan, atau siapkan /resume`,
|
|
2449
|
+
)
|
|
2450
|
+
}
|
|
2451
|
+
} catch {}
|
|
2452
|
+
})
|
|
2398
2453
|
// ── P2.11 observasi verifikasi (observation-only) ──
|
|
2399
2454
|
// Bukti kanonik hidup di jurnal mutasi; presentasi hanya mengamatinya.
|
|
2400
2455
|
// Setiap tool selesai (dan setiap turn selesai untuk verifikasi susulan),
|
package/cli/tui.ts
CHANGED
|
@@ -36,7 +36,7 @@ import type { UiBus } from "../src/ui/contract.ts"
|
|
|
36
36
|
import { t } from "../src/ui/i18n/locale.ts"
|
|
37
37
|
import { loadHistory } from "../src/ui/input/input.ts"
|
|
38
38
|
import { formatUsd } from "../src/ui/render/money.ts"
|
|
39
|
-
import { c } from "../src/ui/render/theme.ts"
|
|
39
|
+
import { c, glyphs } from "../src/ui/render/theme.ts"
|
|
40
40
|
// [Area A · PROMPT 06] State UI milik SESI ini. TUI + printer linier sesi yang
|
|
41
41
|
// sama berbagi state (satu instance), sesi lain di proses yang sama tak
|
|
42
42
|
// tersentuh. Absen = instance default (fixture tes partial).
|
|
@@ -629,7 +629,7 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
629
629
|
// WorkMode EXECUTE (BUILD) agar ceiling DISCUSS/PLAN tak menahan tulis.
|
|
630
630
|
workModeControl?.setWorkMode("EXECUTE")
|
|
631
631
|
app.repaint()
|
|
632
|
-
transcript.pushInfo([c.warning(t("tui.unrestrictedOn"))])
|
|
632
|
+
transcript.pushInfo([c.warning(`${glyphs.unlock} ${t("tui.unrestrictedOn")}`)])
|
|
633
633
|
return
|
|
634
634
|
}
|
|
635
635
|
mode = modeBeforeUnrestricted ?? "auto"
|
|
@@ -643,7 +643,7 @@ export async function runTui(ctx: CliSession): Promise<void> {
|
|
|
643
643
|
modeBeforeUnrestricted = null
|
|
644
644
|
workModeBeforeUnrestricted = null
|
|
645
645
|
app.repaint()
|
|
646
|
-
transcript.pushInfo([c.muted(t("tui.unrestrictedOff", { m: mode }))])
|
|
646
|
+
transcript.pushInfo([c.muted(`${glyphs.unlock} ${t("tui.unrestrictedOff", { m: mode })}`)])
|
|
647
647
|
return
|
|
648
648
|
}
|
|
649
649
|
if (name === "lang") {
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
# Kontrak Terminal MiniCode (TUI fullscreen — v7.
|
|
1
|
+
# Kontrak Terminal MiniCode (TUI fullscreen — v7.13, 2026-11-13)
|
|
2
|
+
|
|
3
|
+
Perubahan v7.13: baris status kompaksi (`context:compacted`) kini **membedakan
|
|
4
|
+
hasil** alih-alih mencetak `reason` mentah. Sebelumnya sesi yang konteksnya TIDAK
|
|
5
|
+
menyusut tampil sebagai `… dipadatkan: pressure:critical:no-op` — terbaca seolah
|
|
6
|
+
berhasil, padahal turn berikutnya tetap kehabisan konteks. Empat kondisi sekarang
|
|
7
|
+
punya label berbeda karena tindak lanjut user berbeda: `… dipadatkan: tidak ada
|
|
8
|
+
yang bisa dibuang (<sebab>) — konteks tidak menyusut` (no-op), `… kompaksi
|
|
9
|
+
berhenti: target tak tercapai meski hanya N pesan tersisa` (fixpoint), `…
|
|
10
|
+
kompaksi mustahil: instruksi tetap + skema tool (N) sudah melebihi ambang M`
|
|
11
|
+
(biaya tetap), dan `… ringkasan LLM gagal (<sebab>), memakai ringkasan
|
|
12
|
+
mekanikal`. Label tetap satu baris redup (`c.muted`) dan tetap melewati
|
|
13
|
+
`sanitizeAnsiLine` sebelum tampil — teks sebab berasal dari error provider/model
|
|
14
|
+
(input tak terpercaya). Sumber: `src/ui/tui/transcript.ts` (`compactedLabel`),
|
|
15
|
+
kunci i18n `ts.compactedNoOp`/`ts.compactedFixpoint`/`ts.compactedImpossible`/
|
|
16
|
+
`ts.compactedLlmFailed`, dan emisi `reason` dari `vendor/minicore/src/core/
|
|
17
|
+
loop.ts`. Peta proteksi: `test/tui-classic.test.ts` (kontrak render transkrip)
|
|
18
|
+
+ `test/compaction-limits.test.ts` (alasan `impossible:`/`fixpoint` yang
|
|
19
|
+
mendarat di event) + `test/control-plane.test.ts` (`llm-failed:` dilaporkan).
|
|
20
|
+
Nol perubahan pada lebar/geometri: label hanya teks lebih panjang pada jalur
|
|
21
|
+
yang sama, tetap dipotong sesuai aturan baris status yang ada.
|
|
2
22
|
|
|
3
23
|
Perubahan v7.12: footer `context` & `metrics` (window %) kini **live per step**
|
|
4
24
|
selama turn berjalan — kernel meng-emit estimasi konteks turn-store via event
|
|
@@ -177,24 +197,35 @@ Non-TTY (pipe/redirect/CI/file): **0 cursor control, 0 alternate screen,
|
|
|
177
197
|
fail-closed di non-TTY/`TERM=dumb`. Siklus hidup region: render yang
|
|
178
198
|
menyusut/bergeser membersihkan union lama+baru (tanpa baris hantu); tutup
|
|
179
199
|
menghapus region sendiri sebelum pemilik repaint.
|
|
200
|
+
- `screen.ts` juga pemilik bentuk kursor: DECSCUSR `6 q` (bar tegak stabil)
|
|
201
|
+
dipancarkan saat caret ditampilkan (`paint`/`moveCursor`) — caret tak
|
|
202
|
+
menutupi karakter di bawahnya dan lebih tenang (clean & minimal). Tetap
|
|
203
|
+
TTY-only: non-TTY = 0 cursor control.
|
|
180
204
|
- Isi popup: kotak terpusat (`dialog.ts`: border, judul opsional dalam garis
|
|
181
205
|
atas, TANPA bayangan) di atas konten redup; `dialogBox` untuk komposit,
|
|
182
206
|
`dialogFrame` (backdrop `░` faint) hanya untuk layar yang memiliki buffer
|
|
183
207
|
sendiri.
|
|
184
|
-
- **Lebar kotak popup TETAP** per permukaan (model 64, picker 64, provider
|
|
208
|
+
- **Lebar kotak popup TETAP** per permukaan (model 64, picker 64, provider 64,
|
|
185
209
|
form 64 — min=max): geometri stabil, tak bernapas saat filter/error.
|
|
186
210
|
Nama/ID di DEPAN label (truncasi memakan ekor — tanggal/konteks boleh
|
|
187
211
|
hilang, id selamat).
|
|
188
212
|
- Form dalam popup (`form.ts`): field text/secret(mask `•`)/select/confirm,
|
|
189
213
|
Tab/↑↓ pindah, ←/→ pilih atau geser kursor, Enter validasi+submit, Esc
|
|
190
|
-
dua-tahap (tekan-1
|
|
191
|
-
hilang sekali tekan); error
|
|
192
|
-
diparkir di field aktif
|
|
193
|
-
|
|
214
|
+
dua-tahap (tekan-1 KEMBALIKAN nilai bawaan field aktif — text/secret/select/
|
|
215
|
+
confirm, tekan-2 batal — isi tidak pernah hilang sekali tekan); error
|
|
216
|
+
validasi merah dalam box; kursor terminal diparkir di field aktif dan field
|
|
217
|
+
aktif SELALU terlihat (jendela body digeser via `focusRow` bila kotak
|
|
218
|
+
terpotong). Add/edit provider, delete confirm, dan wizard input WAJIB lewat
|
|
219
|
+
ini (bukan askLine liar di luar kotak).
|
|
220
|
+
- Picker ber-filter: Esc-1 mengosongkan filter (= kembali ke nilai bawaan
|
|
221
|
+
pencarian, analogen revert-to-default I21), Esc-2 menutup. Ctrl+U juga
|
|
222
|
+
mengosongkan filter. Tidak ada draft yang hilang tanpa undo.
|
|
194
223
|
- Dropdown `/` tetap inline menempel prompt (harus mengikuti kursor ketik):
|
|
195
224
|
berbingkai, terhapus di SEMUA jalur keluar.
|
|
196
225
|
- **Kursor diparkir di SEMUA permukaan** (picker/manager/form/App): baris
|
|
197
|
-
item/field aktif — bukan ditinggal di posisi paint terakhir.
|
|
226
|
+
item/field aktif — bukan ditinggal di posisi paint terakhir. Kursor idle App
|
|
227
|
+
berada tepat setelah prompt `minicode ›` (prompt tidak lagi disembunyikan
|
|
228
|
+
setelah Esc/Enter kosong — I13).
|
|
198
229
|
- **i18n dwibahasa** (`src/ui/i18n/`): kamus statis `en.ts`/`id.ts` (id WAJIB
|
|
199
230
|
kunci = en — tsc mengawal), `t(key, params)` interpolasi `{nama}`, fallback
|
|
200
231
|
kunci hilang → en. Prioritas: `/lang` (sesi) > `MINICODE_LANG` >
|
|
@@ -206,6 +237,13 @@ Non-TTY (pipe/redirect/CI/file): **0 cursor control, 0 alternate screen,
|
|
|
206
237
|
`Del` + confirm dalam popup, tercatat); navigasi daftar = `↑↓` + `pgup/
|
|
207
238
|
pgdn` + `home/end` di semua popup ber-daftar; hint footer tiap permukaan
|
|
208
239
|
hanya tombol yang benar-benar berlaku di sana.
|
|
240
|
+
- **Hint aksi minimalis** (audit UI/UX 2026-11): satu baris di dasar body
|
|
241
|
+
picker/manager (`src/ui/render/hint.ts`, satu sumber), format `kunci label`
|
|
242
|
+
— kunci lebih terang, label redup, pemisah `·` — tanpa judul dan tanpa
|
|
243
|
+
footer dekoratif di dalam kotak. `/model`: **Enter = pilih model satu
|
|
244
|
+
langkah** (tanpa picker effort); **Tab = ubah thinking effort** terpisah
|
|
245
|
+
(Esc pada picker effort = batal effort, kembali ke daftar — manajer tak
|
|
246
|
+
pernah menutup diri di sana).
|
|
209
247
|
- Approval tool & ask_user: blok pertanyaan + keputusan DICATAT di transkrip
|
|
210
248
|
(jejak audit) dan layar di-repaint sebelum menjawab; input via askLine di
|
|
211
249
|
baris kursor (aman: input App beku saat busy; Esc/Ctrl+C = abort + deny).
|
|
@@ -252,7 +290,7 @@ Non-TTY (pipe/redirect/CI/file): **0 cursor control, 0 alternate screen,
|
|
|
252
290
|
geometri popup, dialog, dan viewport TUI.
|
|
253
291
|
12. Long session tetap readable (cap 5000 baris, tertua dibuang). Proyeksi
|
|
254
292
|
presentasi mempertahankan cap yang sama dan menambahkan satu marker
|
|
255
|
-
`… N baris awal di luar viewport
|
|
293
|
+
`… N baris awal di luar viewport` yang melacak
|
|
256
294
|
jumlah baris yang di-evict; `total()` tetap monotonik. Buffer jawaban
|
|
257
295
|
live dibatasi 1.000.000 karakter dan menampilkan marker truncasi; satu
|
|
258
296
|
layout paint tidak boleh memproyeksikan transcript dua kali.
|
|
@@ -330,7 +368,7 @@ Non-TTY (pipe/redirect/CI/file): **0 cursor control, 0 alternate screen,
|
|
|
330
368
|
berkas histori lama). `/copy [n]` menyalin 1–10 turn terakhir (default 1,
|
|
331
369
|
oldest-to-newest) melalui OSC 52.
|
|
332
370
|
19. Dropdown `/` inline berbingkai; Enter pada menu melengkapi + kirim.
|
|
333
|
-
20. Lebar kotak popup TETAP per permukaan (model 64, picker 64, provider
|
|
371
|
+
20. Lebar kotak popup TETAP per permukaan (model 64, picker 64, provider 64,
|
|
334
372
|
form 64 — min=max); nama/ID di depan label; seleksi murni warna; search
|
|
335
373
|
selalu tampil.
|
|
336
374
|
21. Form dalam popup: semua input teks/pilihan di dalam kotak (text/secret/
|
|
@@ -362,8 +400,10 @@ Non-TTY (pipe/redirect/CI/file): **0 cursor control, 0 alternate screen,
|
|
|
362
400
|
`/help full`, pintasan via `/help keys`).
|
|
363
401
|
25. Keybinding konsisten: Esc dua-tahap (isi tak hilang sekali tekan);
|
|
364
402
|
backspace/delete edit-teks (hapus-data = confirm); navigasi daftar
|
|
365
|
-
(`↑↓`, pgup/pgdn, home/end) di semua popup; hint
|
|
366
|
-
|
|
403
|
+
(`↑↓`, pgup/pgdn, home/end) di semua popup; hint aksi minimalis
|
|
404
|
+
(`kunci label`, kunci terang/label redup) akurat per permukaan;
|
|
405
|
+
kursor diparkir di semua permukaan; Enter `/model` = pilih satu
|
|
406
|
+
langkah, Tab = ubah effort.
|
|
367
407
|
26. i18n dwibahasa: semua string user-visible lewat `t()`; id kunci = en
|
|
368
408
|
(tsc mengawal); fallback kunci hilang → en; prioritas sesi > env >
|
|
369
409
|
state.json > locale OS > en (di OS: `LC_ALL` > `LANG`, string kosong
|
|
@@ -563,7 +603,9 @@ panjang).
|
|
|
563
603
|
> [Gap proteksi](#peta-proteksi-dan-gap-tersisa) di bawah — jangan
|
|
564
604
|
> dipoles dengan mengganti kata-kata.
|
|
565
605
|
|
|
566
|
-
- `test/tui-app.test.ts` — I1/I13/I14/I17-I20 (
|
|
606
|
+
- `test/tui-app.test.ts` — I1/I13/I14/I17-I20 (baris indikator dipotong ke
|
|
607
|
+
lebar frame walau locale id 51 kolom; prompt idle bertahan setelah Esc;
|
|
608
|
+
`repaint()` tak melukis saat suspended; boot/exit pairing, transcript
|
|
567
609
|
viewport, mouse-wheel/drag-selection/PgUp/PgDn scroll + indikator, prompt
|
|
568
610
|
editing, dots/timer, status bar, Esc-only abort, quit, suspend/resume,
|
|
569
611
|
busy-freeze, live repaint; I14: Home/End jump + Shift+PgUp/PgDn + hint abort
|
|
@@ -619,7 +661,21 @@ panjang).
|
|
|
619
661
|
- `test/tui-popup.test.ts` — I16 (komposit di atas transkrip, anti-bocor,
|
|
620
662
|
anti-hantu).
|
|
621
663
|
- `test/form.test.ts` — I21 (field, validasi, secret, select, confirm, batal;
|
|
622
|
-
Esc-1 kembalikan prefill
|
|
664
|
+
Esc-1 kembalikan prefill untuk text/secret DAN pilihan bawaan untuk
|
|
665
|
+
select/confirm, Esc-2 batal; Tab+teks dalam satu chunk tidak menulis ke field
|
|
666
|
+
lama; field aktif di luar tinggi kotak tetap terlihat).
|
|
667
|
+
- `test/render-audit-2026-11.test.ts` — audit renderer 2026-11-12 (proyeksi
|
|
668
|
+
pending dimemo per baris → tidak O(n²); SGR majemuk diproses berurutan di
|
|
669
|
+
`truncateToWidth`; indentasi `wordWrap`; SGR opak di highlight; cap input &
|
|
670
|
+
guard LCS diff; lebar tabel untuk grapheme 2 kolom; kop sesi lewat i18n;
|
|
671
|
+
`dialogBox` menggeser jendela ke `focusRow`) **plus penutupan kebocoran**:
|
|
672
|
+
`U+2028/U+2029` jadi spasi di jalur satu-baris, dan paste composer tidak
|
|
673
|
+
bisa menyelundupkan CSI C1 (`U+009B`) — buffer composer dilukis apa adanya,
|
|
674
|
+
jadi gate-nya ada di `prompt-engine` sebelum buffer terbentuk. Jalur pesan
|
|
675
|
+
error layar (`picker`, `model-manager`/`provider-manager` fail-open) dan
|
|
676
|
+
hasil probe jaringan `cli/commands.ts` (`/sync`) memakai `cleanUntrusted` /
|
|
677
|
+
`sanitizeAnsiLine`; hook `?25h` loading-bar didaftarkan lazy agar modul yang
|
|
678
|
+
sekadar di-import tidak menulis byte ke alt-screen.
|
|
623
679
|
- `test/approval-tui.test.ts` — I23 (blok + keputusan tercatat, deny;
|
|
624
680
|
stdout-pipe tanpa sink = deny).
|
|
625
681
|
- `test/footer-render.test.ts` — I13 (label title case, Work Mode kiri dan Permission Mode cyan rata kanan dekat konteks, posisi kolom stabil, fallback terminal sempit, ikon gembok 🔒 terang/redup).
|
package/docs/architecture.md
CHANGED
|
@@ -9,15 +9,19 @@ Roadmap fase pemilik tidak tersedia di checkout ini; jangan simpulkan status fas
|
|
|
9
9
|
```
|
|
10
10
|
L1 cli/ + src/ui/ → controller tipis + presentation mandiri
|
|
11
11
|
L2 src/ non-ui → agen: tools, agents, hooks, policy, providers, mcp, lsp, session, skills
|
|
12
|
-
L3 vendor/minicore → kernel STATE/MODEL/ACTION/LOOP (
|
|
12
|
+
L3 vendor/minicore → kernel STATE/MODEL/ACTION/LOOP (vendored, host-editable, zero-dep, via #minicore)
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
Kernel di-vendor dan **dapat diedit di host** sejak v0.16.0 (lihat
|
|
16
|
+
[catatan vendor MiniCore](https://github.com/minilabs-id/minicode/blob/main/vendor/minicore/VENDOR.md));
|
|
17
|
+
commit sumber `0d33571` hanya referensi historis provenance, bukan invarian
|
|
18
|
+
keras. Impor kernel aplikasi hanya melalui `#minicore`.
|
|
17
19
|
|
|
18
20
|
Patch host yang diperlukan runtime tersimpan di `scripts/vendor-overlays/` dan
|
|
19
|
-
diterapkan saat sinkronisasi vendor
|
|
20
|
-
|
|
21
|
+
diterapkan saat sinkronisasi vendor. `bun run vendor:check` masih bisa dipakai
|
|
22
|
+
sebagai alat diagnosa provenance, tetapi bukan gate: hash yang tercatat di
|
|
23
|
+
`VENDOR.md` adalah checkpoint historis dan tidak ikut berubah saat kernel
|
|
24
|
+
diedit di host.
|
|
21
25
|
|
|
22
26
|
- `cli/` boleh impor `src/ui/` + `src/`; `src/` non-ui dilarang impor `src/ui/`; `src/ui/` dilarang impor `cli/`, `src/` non-ui, `#minicore`. Dijaga `test/ui-boundary.test.ts`.
|
|
23
27
|
- Satu-satunya jendela UI↔luar: `src/ui/contract.ts` (`UiEvent/UiBus/UiStep/UiExecution`).
|
package/docs/concepts.md
CHANGED
|
@@ -6,7 +6,7 @@ Minicode itu apa, kenapa dibangun begitu, dan kenapa beberapa hal sengaja tidak
|
|
|
6
6
|
|
|
7
7
|
| Nama | Apa |
|
|
8
8
|
|---|---|
|
|
9
|
-
| **MiniCore** | Kernel runtime `STATE / MODEL / ACTION / LOOP`.
|
|
9
|
+
| **MiniCore** | Kernel runtime `STATE / MODEL / ACTION / LOOP`. Zero-dependency, di-vendor ke `vendor/minicore`; dapat diedit di host sejak v0.16.0 (angka provenance historis dicatat di `vendor/minicore/VENDOR.md`). Bukan dependency — di-resolve lewat subpath imports `#minicore` |
|
|
10
10
|
| **Minicode** | Layer agencode di atasnya: tools, sub-agents, skills, hooks, policy/sandbox, providers, MCP/LSP, memory, sessions, repo-map, verifier, dan CLI dengan TUI interaktif serta jalur non-interaktif shell-first |
|
|
11
11
|
|
|
12
12
|
|
package/docs/contributing.md
CHANGED
|
@@ -52,7 +52,8 @@ Batas 4.096 KiB disetujui pemilik pada 2026-11-11 untuk rilis v0.21.0. Jangan me
|
|
|
52
52
|
Gerbang lain:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
bun run gate:bash #
|
|
55
|
+
bun run gate:bash # korpus pola serangan + perintah sah (auto & allowlist) → 0 bypass / 0 over-block
|
|
56
|
+
# hitungan tercetak oleh probe itu sendiri; jangan disalin ke dokumen
|
|
56
57
|
bun run bench:smoke # fake, CI-safe
|
|
57
58
|
bun run vendor:check # provenance MiniCore (soft; vendor host-editable sejak v0.16.0)
|
|
58
59
|
```
|
package/docs/environment.md
CHANGED
|
@@ -57,6 +57,9 @@ Variabel yang paling menentukan perilaku (sisanya referensi di bawah):
|
|
|
57
57
|
| `MINICODE_PROVIDER_ORDER` | Urutkan provider agnostik tanpa edit config: `openai,anthropic,deepseek` |
|
|
58
58
|
| `MINICODE_EMBED_MODEL` | Model embedding untuk memory/vector (default `text-embedding-3-small`) |
|
|
59
59
|
| `MINICODE_COMPACT_KEEP_TURNS` | Override keepRecentTurns kompaksi (bilangan ≥1; invalid → default kernel + warn) |
|
|
60
|
+
| `MINICODE_MICROCOMPACT` | `0` → matikan pemangkasan isi hasil tool lama (lapisan termurah sebelum kompaksi penuh). Default aktif; matikan bila sesi butuh seluruh output tool verbatim |
|
|
61
|
+
| `MINICODE_PROMPT_CACHE` | `0` → matikan prompt caching (`cache_control: ephemeral` Anthropic). Default aktif; kill-switch runtime bila gateway menolak header cache atau untuk diagnostik hit-rate (berpasangan dengan metrik cache di ringkasan sesi/`/status`) |
|
|
62
|
+
| `MINICODE_CONTEXT_PROBE` | `0` → matikan eskalasi adaptif jendela konteks (probe reaktif setelah overflow terverifikasi). Default aktif; probe juga dibatasi anggaran per-model/per-proses terlepas dari nilai ini |
|
|
60
63
|
| `MINICODE_MEMORY_SCOPE` | Scope baca memory: `cwd` (default) \| `global` \| `all` (gabung, tanpa silent shadowing) |
|
|
61
64
|
| `MINICODE_AUTO_MEMORY` | `0` → matikan auto-simpan summary/snippet ke memory (opt-out) |
|
|
62
65
|
| `MINICODE_READ_VOLUME_GUARD` | `1` → aktifkan peringatan sekali per turn saat volume baca (char hasil tool) melewati ambang — penanda "banyak dibaca tanpa kompaksi" (risiko degradasi working-memory, bukan jendela token); default nonaktif |
|
|
@@ -69,6 +72,7 @@ Variabel yang paling menentukan perilaku (sisanya referensi di bawah):
|
|
|
69
72
|
|---|---|
|
|
70
73
|
| `MINICODE_BUDGET_STRICT` | `1` → penegasan eksplisit fail-closed (cost tak dikenal + pemakaian = over; kini juga default `--budget`) |
|
|
71
74
|
| `MINICODE_MAX_TURNS` | Batas keras maksimum jumlah turn per sesi (termasuk carry-forward lintas `--resume`; bilangan ≥1) |
|
|
75
|
+
| `MINICODE_AUTO_CONTINUE` | `1` → pada `exec`, saat turn berakhir `max_steps_exceeded`, lanjutkan turn pada sesi yang sama (progres parsial sudah durable) alih-alih gagal; dibatasi `--max-turns` (default 3) |
|
|
72
76
|
| `MINICODE_ALLOW_LOCAL_CONFIG` | `1` → percayai config lokal workspace (default: diabaikan) |
|
|
73
77
|
|
|
74
78
|
## Terminal & aksesibilitas
|