minicode-ai 0.14.6 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/args.ts +20 -8
- package/cli/commands/exec.ts +14 -12
- package/cli/commands.ts +33 -17
- package/cli/index.ts +25 -3
- package/cli/router.ts +22 -9
- package/cli/setup.ts +20 -5
- package/cli/tui.ts +73 -14
- package/docs/CONTROL-PLANE-MAP.md +1 -1
- package/docs/SUMMARY.md +1 -1
- package/docs/TERMINAL_CONTRACT.md +37 -12
- package/docs/architecture.md +1 -0
- package/docs/choosing-mode.md +3 -1
- package/docs/cli.md +7 -5
- package/docs/config.md +1 -1
- package/docs/environment.md +3 -1
- package/docs/getting-started.md +1 -1
- package/docs/memory-sessions.md +2 -2
- package/docs/repl.md +6 -3
- package/docs/security-model.md +3 -1
- package/package.json +1 -1
- package/scripts/vendor-overlays/minicode-context.patch +1 -1
- package/src/app/mentions.ts +1 -1
- package/src/app/rag-layer.ts +11 -2
- package/src/app/session.ts +92 -7
- package/src/constants.ts +1 -1
- package/src/daemon/client.ts +11 -6
- package/src/daemon/control.ts +2 -9
- package/src/daemon/resource.ts +5 -4
- package/src/lib/keystore.ts +11 -9
- package/src/lib/net.ts +8 -3
- package/src/lib/safe-open.ts +29 -5
- package/src/lib/trusted-exec.ts +4 -1
- package/src/lsp/client.ts +9 -10
- package/src/mcp/server.ts +17 -7
- package/src/memory/files.ts +2 -1
- package/src/memory/vector.ts +25 -16
- package/src/policy/bash-guard.ts +33 -11
- package/src/policy/bpe.ts +110 -0
- package/src/policy/compaction.ts +33 -6
- package/src/policy/context-window.ts +19 -0
- package/src/policy/context.ts +34 -8
- package/src/policy/jail.ts +48 -3
- package/src/policy/no-progress.ts +15 -8
- package/src/policy/permission.ts +24 -1
- package/src/policy/tokenizer-registry.ts +104 -0
- package/src/policy/usage.ts +20 -13
- package/src/policy/verifier.ts +7 -4
- package/src/policy/work-mode.ts +9 -5
- package/src/presentation/adapter.ts +7 -3
- package/src/presentation/projection.ts +10 -2
- package/src/providers/anthropic.ts +13 -3
- package/src/providers/responses.ts +16 -6
- package/src/runtime/capability.ts +22 -4
- package/src/runtime/execution-journal.ts +13 -7
- package/src/runtime/production-execution.ts +4 -3
- package/src/sandbox/os.ts +4 -3
- package/src/session/checkpoint.ts +29 -4
- package/src/session/persistence.ts +21 -10
- package/src/task/autonomous-context.ts +0 -1
- package/src/task/scheduler-observability.ts +1 -0
- package/src/tools/git.ts +22 -4
- package/src/tools/lsp.ts +10 -8
- package/src/tools/web_fetch.ts +6 -2
- package/src/tools/web_search.ts +2 -1
- package/src/ui/assistant/simple.ts +9 -3
- package/src/ui/contract.ts +4 -0
- package/src/ui/footer.ts +18 -6
- package/src/ui/i18n/en.ts +13 -2
- package/src/ui/i18n/id.ts +13 -2
- package/src/ui/render/diff.ts +14 -5
- package/src/ui/render/highlight.ts +4 -4
- package/src/ui/render/markdown.ts +12 -5
- package/src/ui/render/session-summary.ts +50 -0
- package/src/ui/render/table-grid.ts +134 -6
- package/src/ui/render/theme.ts +17 -0
- package/src/ui/render/width.ts +89 -2
- package/src/ui/runtime/screen.ts +16 -15
- package/src/ui/session-state.ts +27 -1
- package/src/ui/tui/transcript.ts +90 -18
- package/vendor/minicore/VENDOR.md +3 -3
- package/vendor/minicore/src/core/loop.ts +1 -1
package/src/ui/tui/transcript.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { type MarkdownTable, parseMarkdownBlocks } from "../render/markdown-tabl
|
|
|
21
21
|
import { sanitizeAnsi, sanitizeAnsiLine, stripSgr } from "../render/sanitize.ts"
|
|
22
22
|
import { renderMarkdownTable } from "../render/table-grid.ts"
|
|
23
23
|
import { c, glyphs } from "../render/theme.ts"
|
|
24
|
-
import {
|
|
24
|
+
import { displayWidth, truncateToWidth, wrapByWidth } from "../render/width.ts"
|
|
25
25
|
import { defaultUiState, type UiSessionState } from "../session-state.ts"
|
|
26
26
|
|
|
27
27
|
/** Cap memori: baris logis tertua dibuang diam-diam (kontrak I12). */
|
|
@@ -234,6 +234,10 @@ export class Transcript {
|
|
|
234
234
|
private presentedTerminals = new Set<string>()
|
|
235
235
|
private presentedVerifications = new Set<string>()
|
|
236
236
|
private summarizedTurns = new Set<number>()
|
|
237
|
+
/** Lipat aktivitas (minimizeActivity): baris ledger per-tool ditahan dulu,
|
|
238
|
+
* lalu saat turn selesai dirangkum jadi SATU baris (opencode-like) + detail
|
|
239
|
+
* di-buffer untuk /expand. */
|
|
240
|
+
private activityFold: { name: string; status: string; line: string }[] = []
|
|
237
241
|
private unsubs: (() => void)[] = []
|
|
238
242
|
|
|
239
243
|
constructor(bus: UiBus, opts: TranscriptOptions = {}) {
|
|
@@ -247,6 +251,7 @@ export class Transcript {
|
|
|
247
251
|
bus.on("turn:started", () => {
|
|
248
252
|
this.commit()
|
|
249
253
|
this.commitThinking()
|
|
254
|
+
this.activityFold = []
|
|
250
255
|
}),
|
|
251
256
|
bus.on("turn:completed", () => {
|
|
252
257
|
this.commit()
|
|
@@ -326,11 +331,12 @@ export class Transcript {
|
|
|
326
331
|
if (!text) return
|
|
327
332
|
const clean = sanitizeAnsi(text)
|
|
328
333
|
if (this.uiState.reasoningVisible) {
|
|
329
|
-
// Expanded: alir
|
|
334
|
+
// Expanded: alir per baris dengan indentasi 2 kolom (line-buffered, ekor
|
|
335
|
+
// hidup) — membedakan thinking dari jawaban model yang mulai di kolom 0.
|
|
330
336
|
this.thinkingTail += clean
|
|
331
337
|
const parts = this.thinkingTail.split("\n")
|
|
332
338
|
for (let i = 0; i < parts.length - 1; i++)
|
|
333
|
-
this.append(c.
|
|
339
|
+
this.append(c.thinking(` ${parts[i] ?? ""}`), { kind: "diagnostic" })
|
|
334
340
|
|
|
335
341
|
this.thinkingTail = parts[parts.length - 1] ?? ""
|
|
336
342
|
} else {
|
|
@@ -340,10 +346,10 @@ export class Transcript {
|
|
|
340
346
|
}
|
|
341
347
|
|
|
342
348
|
/** Selesaikan fase thinking: minimized → penanda hilang; expanded → flush
|
|
343
|
-
* ekor
|
|
349
|
+
* ekor (berindentasi sama dengan baris thinking). */
|
|
344
350
|
private commitThinking(): void {
|
|
345
351
|
if (this.thinkingTail) {
|
|
346
|
-
this.append(c.
|
|
352
|
+
this.append(c.thinking(` ${this.thinkingTail}`), { kind: "diagnostic" })
|
|
347
353
|
this.thinkingTail = ""
|
|
348
354
|
}
|
|
349
355
|
this.thinkingBuf = ""
|
|
@@ -412,6 +418,7 @@ export class Transcript {
|
|
|
412
418
|
this.presentedTerminals.clear()
|
|
413
419
|
this.presentedVerifications.clear()
|
|
414
420
|
this.summarizedTurns.clear()
|
|
421
|
+
this.activityFold = []
|
|
415
422
|
}
|
|
416
423
|
|
|
417
424
|
/** Jumlah baris logis (untuk test; bukan API paint). */
|
|
@@ -454,8 +461,8 @@ export class Transcript {
|
|
|
454
461
|
sourceBase += source.length + 1
|
|
455
462
|
continue
|
|
456
463
|
}
|
|
457
|
-
const renderedRows = rendered === "" ? [""] :
|
|
458
|
-
const sourceRows = sourcePrefix || source ?
|
|
464
|
+
const renderedRows = rendered === "" ? [""] : wrapByWidth(rendered, w)
|
|
465
|
+
const sourceRows = sourcePrefix || source ? wrapByWidth(`${sourcePrefix}${source}`, w) : [""]
|
|
459
466
|
let offset = sourceBase
|
|
460
467
|
const count = Math.max(renderedRows.length, sourceRows.length)
|
|
461
468
|
for (let rowIndex = 0; rowIndex < count; rowIndex++) {
|
|
@@ -616,10 +623,10 @@ export class Transcript {
|
|
|
616
623
|
}
|
|
617
624
|
if (this.thinkingTail) {
|
|
618
625
|
for (const chunk of this.thinkingTail.split("\n")) {
|
|
619
|
-
const chunkRows = chunk === "" ? [""] :
|
|
626
|
+
const chunkRows = chunk === "" ? [""] : wrapByWidth(chunk, w)
|
|
620
627
|
for (const row of chunkRows) {
|
|
621
628
|
rows.push({
|
|
622
|
-
text: c.
|
|
629
|
+
text: c.thinking(row),
|
|
623
630
|
sourceId: -1,
|
|
624
631
|
sourceStart: 0,
|
|
625
632
|
sourceEnd: 0,
|
|
@@ -752,6 +759,9 @@ export class Transcript {
|
|
|
752
759
|
this.pendingTruncated = false
|
|
753
760
|
const text = normalizeAssistantOutput(rawText)
|
|
754
761
|
if (!text) return
|
|
762
|
+
// Pisahkan jawaban dari thinking/diagnostik tepat di atasnya dengan satu
|
|
763
|
+
// baris kosong — supaya "berpikir" tidak nempel ke jawaban.
|
|
764
|
+
if (this.lastKind() === "diagnostic") this.append("", { kind: "assistant" })
|
|
755
765
|
for (const block of parseMarkdownBlocks(sanitizeAnsi(text))) {
|
|
756
766
|
if (block.type === "table") this.appendTable(block.table, { kind: "assistant" })
|
|
757
767
|
else {
|
|
@@ -760,6 +770,10 @@ export class Transcript {
|
|
|
760
770
|
}
|
|
761
771
|
}
|
|
762
772
|
|
|
773
|
+
private lastKind(): TranscriptMeta["kind"] | undefined {
|
|
774
|
+
return this.meta[this.meta.length - 1]?.kind
|
|
775
|
+
}
|
|
776
|
+
|
|
763
777
|
private presentationSnapshot(): UiPresentationSnapshot | null {
|
|
764
778
|
if (!this.getSnapshot) return null
|
|
765
779
|
try {
|
|
@@ -770,10 +784,25 @@ export class Transcript {
|
|
|
770
784
|
}
|
|
771
785
|
|
|
772
786
|
private presentationEvent(event: UiPresentationEvent): void {
|
|
787
|
+
if (event.type === "turn.started") {
|
|
788
|
+
this.commit()
|
|
789
|
+
this.commitThinking()
|
|
790
|
+
this.activityFold = []
|
|
791
|
+
return
|
|
792
|
+
}
|
|
773
793
|
if (event.type === "turn.completed") {
|
|
774
794
|
this.commit()
|
|
775
795
|
this.commitThinking()
|
|
776
|
-
|
|
796
|
+
// minimizeActivity ON → fold meringkas sendiri (nama tool + ok/gagal);
|
|
797
|
+
// turnSummary (turn · files · durasi) dilewati agar tidak ada dua ringkasan.
|
|
798
|
+
if (!this.uiState.minimizeActivity) this.turnSummary(event.summary, event)
|
|
799
|
+
this.flushActivityFold()
|
|
800
|
+
return
|
|
801
|
+
}
|
|
802
|
+
if (event.type === "turn.failed" || event.type === "turn.cancelled") {
|
|
803
|
+
this.commit()
|
|
804
|
+
this.commitThinking()
|
|
805
|
+
this.flushActivityFold()
|
|
777
806
|
return
|
|
778
807
|
}
|
|
779
808
|
// F-TASK-1: status task kanonik (t<n>) + DAG dirender sebagai baris ledger,
|
|
@@ -880,14 +909,20 @@ export class Transcript {
|
|
|
880
909
|
// P2.11: penanda verifikasi/provenans dari deskripsi policy (ASCII aman).
|
|
881
910
|
// Absen = unknown/live — tidak dirender sebagai keberhasilan.
|
|
882
911
|
const verification = desc?.verification ?? activity?.verification
|
|
883
|
-
const verificationMark = !verification
|
|
884
|
-
? ""
|
|
885
|
-
: verification.verdict === "present"
|
|
886
|
-
? " [verified]"
|
|
887
|
-
: ` [unverified:${verification.verdict}]`
|
|
888
912
|
const provenance = desc?.provenance ?? activity?.provenance
|
|
889
|
-
|
|
890
|
-
|
|
913
|
+
// Keputusan marker lewat policy kanonik bila di-inject; fallback inline
|
|
914
|
+
// legacy (tanpa policy) dijaga test display agar tak divergen dari
|
|
915
|
+
// projection.ts (`verificationMark`/`provenanceMark`).
|
|
916
|
+
const verificationMark = this.policy
|
|
917
|
+
? this.policy.verificationMark(verification)
|
|
918
|
+
: !verification
|
|
919
|
+
? ""
|
|
920
|
+
: verification.verdict === "present"
|
|
921
|
+
? " [verified]"
|
|
922
|
+
: ` [unverified:${verification.verdict}]`
|
|
923
|
+
const provenanceMark = this.policy
|
|
924
|
+
? this.policy.provenanceMark(provenance)
|
|
925
|
+
: provenance === "reconstructed"
|
|
891
926
|
? " [reconstructed]"
|
|
892
927
|
: provenance === "replay"
|
|
893
928
|
? " [replay]"
|
|
@@ -904,6 +939,13 @@ export class Transcript {
|
|
|
904
939
|
? `: ${truncateToWidth(sanitizeAnsi(denyReason), 200, "…").split("\n")[0] ?? ""}`
|
|
905
940
|
: ""
|
|
906
941
|
const line = ` ${this.statusGlyph(status)} ${name}${targetText} ${this.statusWord(status)}${retry}${child}${verificationMark}${provenanceMark}${message}`
|
|
942
|
+
// Lipat aktivitas (opencode-like): saat minimizeActivity aktif, baris ledger
|
|
943
|
+
// per-tool TIDAK boleh menghilang diam-diam — ditahan lalu dirangkum jadi
|
|
944
|
+
// SATU baris saat turn selesai (detail via /expand).
|
|
945
|
+
if (this.uiState.minimizeActivity) {
|
|
946
|
+
this.activityFold.push({ name, status, line })
|
|
947
|
+
return
|
|
948
|
+
}
|
|
907
949
|
this.append(this.statusPaint(status, line), {
|
|
908
950
|
kind: "activity",
|
|
909
951
|
...(event.seq !== undefined ? { seq: event.seq } : {}),
|
|
@@ -1097,7 +1139,8 @@ export class Transcript {
|
|
|
1097
1139
|
)
|
|
1098
1140
|
}))
|
|
1099
1141
|
: undefined
|
|
1100
|
-
const turnId =
|
|
1142
|
+
const turnId =
|
|
1143
|
+
event.turnId ?? turn?.turnId ?? snapshot?.turns[snapshot.turns.length - 1]?.turnId ?? 0
|
|
1101
1144
|
if (event.turnId !== undefined) {
|
|
1102
1145
|
if (this.summarizedTurns.has(event.turnId)) return
|
|
1103
1146
|
this.summarizedTurns.add(event.turnId)
|
|
@@ -1120,6 +1163,35 @@ export class Transcript {
|
|
|
1120
1163
|
})
|
|
1121
1164
|
}
|
|
1122
1165
|
|
|
1166
|
+
/** Flush lipatan aktivitas (minimizeActivity) menjadi SATU baris ringkas
|
|
1167
|
+
* (opencode-like) + buffer detail untuk /expand. Tidak menghilangkan isi
|
|
1168
|
+
* diam-diam: nama tool + hitung ok/gagal tetap terlihat. */
|
|
1169
|
+
private flushActivityFold(): void {
|
|
1170
|
+
const fold = this.activityFold
|
|
1171
|
+
this.activityFold = []
|
|
1172
|
+
if (fold.length === 0) return
|
|
1173
|
+
const count = (status: string) => fold.reduce((n, e) => n + (e.status === status ? 1 : 0), 0)
|
|
1174
|
+
const ok = count("completed")
|
|
1175
|
+
const failed = count("failed")
|
|
1176
|
+
const denied = count("denied")
|
|
1177
|
+
const names = [...new Set(fold.map((e) => e.name))]
|
|
1178
|
+
const shown = names.slice(0, 3).join(", ")
|
|
1179
|
+
const more = names.length - 3
|
|
1180
|
+
const namePart = shown ? ` · ${shown}${more > 0 ? ` +${more}` : ""}` : ""
|
|
1181
|
+
const stats = [
|
|
1182
|
+
ok ? `${ok} ok` : "",
|
|
1183
|
+
failed ? `${failed} ${t("ts.statusFailed")}` : "",
|
|
1184
|
+
denied ? `${denied} ${t("ts.statusDenied")}` : "",
|
|
1185
|
+
]
|
|
1186
|
+
.filter(Boolean)
|
|
1187
|
+
.join(", ")
|
|
1188
|
+
const statPart = stats ? ` · ${stats}` : ""
|
|
1189
|
+
const line = ` ${glyphs.check} ${fold.length} tool${fold.length > 1 ? "s" : ""}${namePart}${statPart}`
|
|
1190
|
+
// Detail tetap tersedia via /expand (tidak dibuang).
|
|
1191
|
+
this.uiState.rememberCollapsedSection("activity", fold.map((e) => e.line).join("\n"))
|
|
1192
|
+
this.append(line, { kind: "activity" })
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1123
1195
|
private runningRows(): string[] {
|
|
1124
1196
|
const snapshot = this.presentationSnapshot()
|
|
1125
1197
|
if (!snapshot) return []
|
|
@@ -7,10 +7,10 @@ simpan seam ini saat menyinkronkan source upstream.
|
|
|
7
7
|
|
|
8
8
|
- source commit: `0d33571047c0ed3778986108fd42e4bde6828bb0`
|
|
9
9
|
- source hash: `c8d214bb8d5eea86`
|
|
10
|
-
- overlay sha256: `
|
|
10
|
+
- overlay sha256: `fa3e3a789982523c3de99c2d31c173789a7fee2bf0f8087267c222ce9b4eebcf`
|
|
11
11
|
- files: 20
|
|
12
|
-
- hash: `
|
|
13
|
-
- shipped hash: `
|
|
12
|
+
- hash: `4cee16b60d65d18f`
|
|
13
|
+
- shipped hash: `b714c2adc59ea720` (18 file) — fingerprint file vendor yang ikut paket npm
|
|
14
14
|
(hash di atas mencakup test/fakes.ts yang sengaja tidak ikut paket;
|
|
15
15
|
verifikasi dari paket terbit: hitung hash vendor/minicore di dalam tarball)
|
|
16
16
|
|
|
@@ -50,7 +50,7 @@ export async function executeTurn(
|
|
|
50
50
|
// Permit one follow-up policy compaction after tool results grow the current
|
|
51
51
|
// turn. The hard cap prevents a no-progress compactor from looping forever.
|
|
52
52
|
let budgetCompactions = 0;
|
|
53
|
-
const maxBudgetCompactions =
|
|
53
|
+
const maxBudgetCompactions = 3;
|
|
54
54
|
let compactedForRecovery = false;
|
|
55
55
|
|
|
56
56
|
// Resolve once for the turn: model switching is a between-turn operation,
|