minicode-ai 0.25.0 → 0.26.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 +3 -1
- package/cli/commands/config.ts +123 -0
- package/cli/setup.ts +107 -8
- package/docs/TERMINAL_CONTRACT.md +32 -1
- package/docs/config.md +13 -1
- package/docs/environment.md +1 -0
- package/docs/getting-started.md +11 -3
- package/package.json +1 -1
- package/src/app/session.ts +187 -17
- package/src/config.ts +19 -8
- package/src/constants.ts +14 -1
- package/src/lib/net.ts +6 -15
- package/src/lib/public-http.ts +128 -0
- package/src/policy/auto-resume.ts +63 -0
- package/src/policy/compaction.ts +354 -70
- package/src/policy/context-budget.ts +4 -6
- package/src/policy/context-window-assign.ts +114 -0
- package/src/policy/context-window-catalog.ts +4 -1
- package/src/policy/context-window-presets.ts +165 -0
- package/src/policy/context-window.ts +19 -4
- package/src/policy/context.ts +11 -9
- package/src/policy/executor.ts +69 -27
- package/src/policy/microcompact.ts +76 -15
- package/src/policy/recovery-budget.ts +281 -0
- package/src/policy/step-escalation.ts +82 -0
- package/src/policy/tokenizer-registry.ts +1 -0
- package/src/providers/detect.ts +13 -7
- package/src/providers/provision.ts +8 -0
- package/src/runtime/child-execution.ts +4 -2
- package/src/runtime/execution-backend.ts +3 -0
- package/src/sandbox/os.ts +53 -9
- package/src/session/context-assembly.ts +11 -7
- package/src/session/persistence.ts +19 -3
- package/src/tools/bash.ts +12 -9
- package/src/tools/code_run.ts +19 -20
- package/src/tools/task.ts +4 -1
- package/src/tools/web_fetch.ts +13 -19
- package/src/ui/assistant/simple.ts +61 -10
- package/src/ui/i18n/en.ts +3 -0
- package/src/ui/i18n/id.ts +3 -0
- package/src/ui/input/prompt-engine.ts +53 -21
- package/src/ui/render/activity-group.ts +8 -0
- package/src/ui/render/activity-panel.ts +20 -2
- package/src/ui/tui/app.ts +26 -11
- package/src/ui/tui/transcript.ts +175 -29
- package/vendor/minicore/src/core/loop.ts +20 -1
- package/vendor/minicore/src/core/session.ts +6 -0
package/README.md
CHANGED
|
@@ -9,10 +9,12 @@ Interactive sessions run as a fullscreen TUI; one-shot and automation runs flow
|
|
|
9
9
|
Requires Bun >=1.1.13 for development, local execution, and the published CLI:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
|
|
12
|
+
bun add -g minicode-ai
|
|
13
13
|
minicode
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
`npm install -g minicode-ai` installs the same binary if you prefer npm.
|
|
17
|
+
|
|
16
18
|
To run from a clone:
|
|
17
19
|
|
|
18
20
|
```bash
|
package/cli/commands/config.ts
CHANGED
|
@@ -10,6 +10,10 @@ import { sanitizeAnsiLine } from "../../src/ui/render/sanitize.ts"
|
|
|
10
10
|
import { renderTable } from "../../src/ui/render/table.ts"
|
|
11
11
|
import { c, glyphs } from "../../src/ui/render/theme.ts"
|
|
12
12
|
|
|
13
|
+
// Akhiran baris untuk tabel yang dicetak bersama judul. Konstanta bernama
|
|
14
|
+
// (bukan `"\n"` lepas) supaya tidak tertukar dengan escape di template literal.
|
|
15
|
+
const NEWLINE = "\n"
|
|
16
|
+
|
|
13
17
|
// Help kontekstual per subcommand. Sebelumnya ketiga cabang ini mencetak HELP
|
|
14
18
|
// global 45 baris dan exit 0 — user tidak tahu apa yang salah dan skrip tidak
|
|
15
19
|
// bisa mendeteksi kegagalan.
|
|
@@ -19,6 +23,10 @@ const CONFIG_HELP = `minicode config — provider, MCP, and LSP
|
|
|
19
23
|
minicode config list
|
|
20
24
|
minicode config remove <id> [--global|--local]
|
|
21
25
|
minicode config detect --baseUrl <url> --apiKey <key>
|
|
26
|
+
minicode config context-window list all explicit windows
|
|
27
|
+
minicode config context-window <provider> windows of one provider
|
|
28
|
+
minicode config context-window <provider> <model> <v> set (128k, 200k, 1m, 1024x1024)
|
|
29
|
+
minicode config context-window <provider> <model> auto back to auto-detection
|
|
22
30
|
minicode config set-key <id> [--global|--local] move API key to OS store (DPAPI on Windows)
|
|
23
31
|
minicode config delete-key <id> forget stored key (provider stays disabled)
|
|
24
32
|
|
|
@@ -151,6 +159,121 @@ export async function handleConfig(
|
|
|
151
159
|
`${c.green(glyphs.check)} Removed provider ${sanitizeAnsiLine(id)} (${!args.includes("--local") ? "global" : "local"})`,
|
|
152
160
|
)
|
|
153
161
|
process.exit(0)
|
|
162
|
+
} else if (sub === "context-window") {
|
|
163
|
+
// Jendela konteks MANUAL untuk model yang providernya tidak melaporkan
|
|
164
|
+
// kapasitas. Tanpa ini satu-satunya jalan adalah mengedit JSON dan menebak
|
|
165
|
+
// angka; salah tebak ke atas = request ditolak 400 di tengah turn, ke bawah
|
|
166
|
+
// = kompaksi prematur.
|
|
167
|
+
//
|
|
168
|
+
// Bentuk:
|
|
169
|
+
// minicode config context-window → daftar semua nilai
|
|
170
|
+
// minicode config context-window <provider> → nilai provider itu
|
|
171
|
+
// minicode config context-window <provider> <model> <nilai>
|
|
172
|
+
// minicode config context-window <provider> <model> auto → kembali deteksi
|
|
173
|
+
const pid = positionalArg(args, 2)
|
|
174
|
+
const model = positionalArg(args, 3)
|
|
175
|
+
const value = positionalArg(args, 4)
|
|
176
|
+
const { assignContextWindow, summarizeContextWindows } = await import(
|
|
177
|
+
"../../src/policy/context-window-assign.ts"
|
|
178
|
+
)
|
|
179
|
+
const { describeContextWindow } = await import("../../src/policy/context-window-presets.ts")
|
|
180
|
+
const global = !args.includes("--local")
|
|
181
|
+
const cwdArg = getArg("--cwd")
|
|
182
|
+
// Config dimuat lokal untuk cabang ini: daftar/nilai harus mencerminkan
|
|
183
|
+
// berkas yang benar-benar akan ditulis (global vs lokal), sama seperti
|
|
184
|
+
// cabang `add`/`remove`.
|
|
185
|
+
const cfg = await loadConfig(cwdArg, { allowLocal: allowLocalHere(args) })
|
|
186
|
+
|
|
187
|
+
if (!pid) {
|
|
188
|
+
// Daftar ringkas seluruh provider: model mana yang punya nilai eksplisit.
|
|
189
|
+
const rows = cfg.providers.flatMap((p) =>
|
|
190
|
+
summarizeContextWindows(p).map((w) => ({
|
|
191
|
+
provider: p.id,
|
|
192
|
+
model: w.model === "*" ? c.dim("* (default)") : w.model,
|
|
193
|
+
window: describeContextWindow(w.tokens),
|
|
194
|
+
source: w.source === "user" ? c.cyan("manual") : c.dim(w.source),
|
|
195
|
+
})),
|
|
196
|
+
)
|
|
197
|
+
if (rows.length === 0) {
|
|
198
|
+
console.log(
|
|
199
|
+
`${c.dim("no explicit context windows — all models use automatic detection")}\n` +
|
|
200
|
+
` ${c.dim("set one: minicode config context-window <provider> <model> 128k")}`,
|
|
201
|
+
)
|
|
202
|
+
process.exit(0)
|
|
203
|
+
}
|
|
204
|
+
console.log(
|
|
205
|
+
`
|
|
206
|
+
${c.bold("Context windows")}
|
|
207
|
+
` +
|
|
208
|
+
renderTable(
|
|
209
|
+
[
|
|
210
|
+
{ header: "Provider", key: "provider", width: 18 },
|
|
211
|
+
{ header: "Model", key: "model", width: 30 },
|
|
212
|
+
{ header: "Window", key: "window", width: 10, align: "right" },
|
|
213
|
+
{ header: "Origin", key: "source", width: 10 },
|
|
214
|
+
],
|
|
215
|
+
rows,
|
|
216
|
+
) +
|
|
217
|
+
NEWLINE,
|
|
218
|
+
)
|
|
219
|
+
process.exit(0)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const provider = cfg.providers.find((p) => p.id === pid)
|
|
223
|
+
if (!provider) {
|
|
224
|
+
console.error(`provider ${c.bold(sanitizeAnsiLine(pid))} not found — see: minicode providers`)
|
|
225
|
+
process.exit(1)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (!model || !value) {
|
|
229
|
+
const rows = summarizeContextWindows(provider).map((w) => ({
|
|
230
|
+
model: w.model === "*" ? c.dim("* (default)") : sanitizeAnsiLine(w.model),
|
|
231
|
+
window: describeContextWindow(w.tokens),
|
|
232
|
+
source: w.source === "user" ? c.cyan("manual") : c.dim(w.source),
|
|
233
|
+
}))
|
|
234
|
+
if (rows.length === 0)
|
|
235
|
+
console.log(`${c.dim(`${provider.id}: no explicit windows (automatic detection)`)}`)
|
|
236
|
+
else
|
|
237
|
+
console.log(
|
|
238
|
+
`
|
|
239
|
+
${c.bold(`Context windows — ${sanitizeAnsiLine(provider.id)}`)}
|
|
240
|
+
` +
|
|
241
|
+
renderTable(
|
|
242
|
+
[
|
|
243
|
+
{ header: "Model", key: "model", width: 34 },
|
|
244
|
+
{ header: "Window", key: "window", width: 10, align: "right" },
|
|
245
|
+
{ header: "Origin", key: "source", width: 10 },
|
|
246
|
+
],
|
|
247
|
+
rows,
|
|
248
|
+
) +
|
|
249
|
+
NEWLINE,
|
|
250
|
+
)
|
|
251
|
+
console.log(
|
|
252
|
+
` ${c.dim(
|
|
253
|
+
`set: minicode config context-window ${sanitizeAnsiLine(provider.id)} <model> <128k|1m|1024x1024|auto>`,
|
|
254
|
+
)}`,
|
|
255
|
+
)
|
|
256
|
+
process.exit(0)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const outcome = assignContextWindow(provider, model, value)
|
|
260
|
+
if (!outcome.ok) {
|
|
261
|
+
console.error(`${c.red(glyphs.cross ?? "x")} ${outcome.error}`)
|
|
262
|
+
process.exit(1)
|
|
263
|
+
}
|
|
264
|
+
const { saveProvider } = await import("../../src/providers/provision.ts")
|
|
265
|
+
await saveProvider(outcome.provider, { global, ...(cwdArg ? { cwd: cwdArg } : {}) })
|
|
266
|
+
const shown = sanitizeAnsiLine(model)
|
|
267
|
+
const where = global ? "global" : "local"
|
|
268
|
+
if (outcome.tokens === null) {
|
|
269
|
+
console.log(`${c.green(glyphs.check)} ${shown}: back to automatic detection (${where})`)
|
|
270
|
+
} else {
|
|
271
|
+
console.log(
|
|
272
|
+
`${c.green(glyphs.check)} ${shown}: ${describeContextWindow(outcome.tokens)} ` +
|
|
273
|
+
`(${outcome.tokens.toLocaleString("en-US")} tokens) — ${where}`,
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
process.exit(0)
|
|
154
277
|
} else if (sub === "set-key" || sub === "delete-key") {
|
|
155
278
|
// Pindahkan API key provider dari config plaintext ke penyimpanan OS
|
|
156
279
|
// (Windows: DPAPI user-scope; selain itu: berkas chmod 600 + peringatan
|
package/cli/setup.ts
CHANGED
|
@@ -8,7 +8,9 @@ import { createProviderLayer } from "../src/app/provider-layer.ts"
|
|
|
8
8
|
import { createRagLayer } from "../src/app/rag-layer.ts"
|
|
9
9
|
import {
|
|
10
10
|
createMinicodeSession,
|
|
11
|
+
createRecoveryLedger,
|
|
11
12
|
type PermissionControl,
|
|
13
|
+
type RecoveryLedger,
|
|
12
14
|
type WorkModeControl,
|
|
13
15
|
} from "../src/app/session.ts"
|
|
14
16
|
import { setupToolLayer } from "../src/app/tool-layer.ts"
|
|
@@ -32,6 +34,11 @@ import { loadContextWindowOverlay, resolveContextWindow } from "../src/policy/co
|
|
|
32
34
|
import type { NoProgressDetector } from "../src/policy/no-progress.ts"
|
|
33
35
|
import type { PermissionAsk } from "../src/policy/permission.ts"
|
|
34
36
|
import type { RateLimiter } from "../src/policy/ratelimit.ts"
|
|
37
|
+
import {
|
|
38
|
+
type FailureSignal,
|
|
39
|
+
planRecovery,
|
|
40
|
+
type RecoveryDecision,
|
|
41
|
+
} from "../src/policy/recovery-budget.ts"
|
|
35
42
|
import {
|
|
36
43
|
budgetExceededError,
|
|
37
44
|
createUsageCollector,
|
|
@@ -1261,7 +1268,7 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1261
1268
|
if (!warnedContextModels.has(key)) {
|
|
1262
1269
|
warnedContextModels.add(key)
|
|
1263
1270
|
startupWrite(
|
|
1264
|
-
`${c.yellow(`[context] no configured window for ${sanitizeAnsi(key)}; using fallback ${resolved.tokens} tokens. Set
|
|
1271
|
+
`${c.yellow(`[context] no configured window for ${sanitizeAnsi(key)}; using fallback ${resolved.tokens} tokens. Set it with: minicode config context-window ${resolved.providerId ?? "<provider>"} ${resolved.model ?? "<model>"} 128k\n`)}`,
|
|
1265
1272
|
)
|
|
1266
1273
|
}
|
|
1267
1274
|
}
|
|
@@ -1274,7 +1281,7 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1274
1281
|
if (!warnedCatalogDrift.has(key)) {
|
|
1275
1282
|
warnedCatalogDrift.add(key)
|
|
1276
1283
|
startupWrite(
|
|
1277
|
-
`${c.yellow(`[context] catalog window ${resolved.drift.catalogTokens} for ${sanitizeAnsi(key)} differs >2x from models.dev (${resolved.drift.overlayTokens});
|
|
1284
|
+
`${c.yellow(`[context] catalog window ${resolved.drift.catalogTokens} for ${sanitizeAnsi(key)} differs >2x from models.dev (${resolved.drift.overlayTokens}); using ${resolved.tokens} tokens (${resolved.source}). Set provider.contextWindows for an endpoint-specific limit.\n`)}`,
|
|
1278
1285
|
)
|
|
1279
1286
|
}
|
|
1280
1287
|
}
|
|
@@ -1968,17 +1975,14 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
1968
1975
|
const v = opts.writeConcurrency
|
|
1969
1976
|
return typeof v === "number" && Number.isFinite(v) && v > 0 ? Math.floor(v) : undefined
|
|
1970
1977
|
})()
|
|
1971
|
-
// Muat
|
|
1972
|
-
|
|
1973
|
-
const { currentLocale, setConfigLocale } = await import("../src/ui/i18n/locale.ts")
|
|
1978
|
+
// Muat bahasa label UI lebih awal; bahasa balasan mengikuti percakapan pengguna.
|
|
1979
|
+
const { setConfigLocale } = await import("../src/ui/i18n/locale.ts")
|
|
1974
1980
|
setConfigLocale((await loadLang().catch(() => undefined)) ?? null)
|
|
1975
|
-
const sessionLang = currentLocale()
|
|
1976
1981
|
const session = await startupPhase("kernel-session", () =>
|
|
1977
1982
|
createMinicodeSession({
|
|
1978
1983
|
provider: router,
|
|
1979
1984
|
tools: sessionTools,
|
|
1980
1985
|
cwd,
|
|
1981
|
-
lang: sessionLang,
|
|
1982
1986
|
permissionMode,
|
|
1983
1987
|
restrictBash,
|
|
1984
1988
|
allowLocalConfig,
|
|
@@ -2768,13 +2772,108 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
|
|
|
2768
2772
|
: deadline.signal
|
|
2769
2773
|
: signal
|
|
2770
2774
|
try {
|
|
2771
|
-
|
|
2775
|
+
// [T-009 OBSERVATION.md] Resume otomatis untuk kegagalan TRANSIEN.
|
|
2776
|
+
//
|
|
2777
|
+
// KENAPA memakai LEDGER BERSAMA: retry provider (lapisan recovery) dan
|
|
2778
|
+
// resume turn (di sini) adalah dua lapisan. Memberi masing-masing anggaran
|
|
2779
|
+
// sendiri membuat biayanya BERKALI — pola *retry amplification* yang
|
|
2780
|
+
// menahan user ~82 dtk untuk provider yang mati. Satu ledger per prompt
|
|
2781
|
+
// berarti satu anggaran waktu dan satu kuota percobaan dipakai bersama,
|
|
2782
|
+
// sehingga biaya total konstan berapa pun lapisannya.
|
|
2783
|
+
const ledger = createRecoveryLedger()
|
|
2784
|
+
for (;;) {
|
|
2785
|
+
try {
|
|
2786
|
+
return await runPromptWithVerifyImpl(p, runSignal)
|
|
2787
|
+
} catch (error) {
|
|
2788
|
+
const failure = classifyFailure(error, {
|
|
2789
|
+
userAborted: signal?.aborted === true && deadline.signal?.aborted !== true,
|
|
2790
|
+
})
|
|
2791
|
+
const decision = decideTurnResume(failure, ledger, p.trim().length > 0)
|
|
2792
|
+
if (decision.action !== "retry") throw error
|
|
2793
|
+
const secs = (decision.delayMs / 1000).toFixed(1)
|
|
2794
|
+
const left = Math.max(0, Math.round(decision.remainingMs / 1000))
|
|
2795
|
+
process.stderr.write(
|
|
2796
|
+
`[recovery] gangguan penyedia — melanjutkan turn otomatis ` +
|
|
2797
|
+
`(percobaan ${decision.attempt}, jeda ${secs} dtk, sisa anggaran ${left} dtk)
|
|
2798
|
+
`,
|
|
2799
|
+
)
|
|
2800
|
+
await Bun.sleep(decision.delayMs)
|
|
2801
|
+
// Pengguna menekan Ctrl+C saat menunggu: berhenti, jangan lanjut.
|
|
2802
|
+
if (runSignal?.aborted) throw error
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2772
2805
|
} finally {
|
|
2773
2806
|
deadline.cancel()
|
|
2774
2807
|
if (activeAgentSessionId === sessionId) activeAgentSessionId = previous ?? null
|
|
2775
2808
|
}
|
|
2776
2809
|
}
|
|
2777
2810
|
|
|
2811
|
+
/**
|
|
2812
|
+
* Terjemahkan error nyata menjadi `FailureSignal` murni untuk kebijakan.
|
|
2813
|
+
* Kategori provider bisa berada di `cause` (adapter membungkusnya), jadi
|
|
2814
|
+
* rantai cause ditelusuri berbatas — bukan while(true) pada objek asing.
|
|
2815
|
+
*/
|
|
2816
|
+
function classifyFailure(error: unknown, opts: { userAborted: boolean }): FailureSignal {
|
|
2817
|
+
let category: string | undefined
|
|
2818
|
+
let kind: string | undefined
|
|
2819
|
+
let retryAfterMs: number | undefined
|
|
2820
|
+
let node: unknown = error
|
|
2821
|
+
for (let depth = 0; depth < 5 && node !== null && node !== undefined; depth++) {
|
|
2822
|
+
if (typeof node !== "object") break
|
|
2823
|
+
const rec = node as {
|
|
2824
|
+
category?: unknown
|
|
2825
|
+
kind?: unknown
|
|
2826
|
+
retryAfterMs?: unknown
|
|
2827
|
+
cause?: unknown
|
|
2828
|
+
}
|
|
2829
|
+
if (typeof rec.category === "string" && category === undefined) category = rec.category
|
|
2830
|
+
if (typeof rec.kind === "string" && kind === undefined) kind = rec.kind
|
|
2831
|
+
if (typeof rec.retryAfterMs === "number" && retryAfterMs === undefined)
|
|
2832
|
+
retryAfterMs = rec.retryAfterMs
|
|
2833
|
+
node = rec.cause
|
|
2834
|
+
}
|
|
2835
|
+
return {
|
|
2836
|
+
...(category !== undefined ? { category } : {}),
|
|
2837
|
+
...(kind !== undefined ? { kind } : {}),
|
|
2838
|
+
...(retryAfterMs !== undefined ? { retryAfterMs } : {}),
|
|
2839
|
+
abortedByUser: opts.userAborted,
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
/**
|
|
2844
|
+
* Keputusan resume turn, memakai anggaran bersama.
|
|
2845
|
+
*
|
|
2846
|
+
* Saklar `MINICODE_TURN_AUTO_RESUME=0` dipakai tes yang memang menguji jalur
|
|
2847
|
+
* gagal cepat (provider lokal tak terjangkau) dan operator yang ingin
|
|
2848
|
+
* kegagalan provider langsung terlihat tanpa jeda. Default tetap menyala.
|
|
2849
|
+
*/
|
|
2850
|
+
function decideTurnResume(
|
|
2851
|
+
failure: FailureSignal,
|
|
2852
|
+
ledger: RecoveryLedger,
|
|
2853
|
+
hasPrompt: boolean,
|
|
2854
|
+
): RecoveryDecision {
|
|
2855
|
+
if (process.env.MINICODE_TURN_AUTO_RESUME === "0")
|
|
2856
|
+
return { action: "stop", reason: "not-transient" }
|
|
2857
|
+
const next = ledger.nextDelay(failure)
|
|
2858
|
+
if (next !== null)
|
|
2859
|
+
return {
|
|
2860
|
+
action: "retry",
|
|
2861
|
+
attempt: next.attempt,
|
|
2862
|
+
delayMs: next.delayMs,
|
|
2863
|
+
remainingMs: ledger.remainingMs(),
|
|
2864
|
+
}
|
|
2865
|
+
// Kuota/anggaran yang menahan: laporkan alasannya, bukan "not-transient".
|
|
2866
|
+
return planRecovery(
|
|
2867
|
+
failure,
|
|
2868
|
+
{
|
|
2869
|
+
startedAtMs: ledger.startedAtMs,
|
|
2870
|
+
nowMs: Date.now(),
|
|
2871
|
+
attemptsUsed: ledger.attemptsUsed(),
|
|
2872
|
+
},
|
|
2873
|
+
{ hasPrompt },
|
|
2874
|
+
)
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2778
2877
|
async function runPromptWithVerifyImpl(p: string, signal?: AbortSignal): Promise<void> {
|
|
2779
2878
|
if (signal?.aborted) {
|
|
2780
2879
|
const reason = signal.reason
|
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
# Kontrak Terminal MiniCode (TUI fullscreen — v7.
|
|
1
|
+
# Kontrak Terminal MiniCode (TUI fullscreen — v7.15, unreleased)
|
|
2
|
+
|
|
3
|
+
Perubahan v7.15 (remediasi audit): CSI/SS3 malformed dibuang sampai byte
|
|
4
|
+
independen berikutnya; Ctrl+C/Ctrl+D tetap dapat didekode. Prefix kontrol
|
|
5
|
+
tertahan dibatasi 64 byte. Sequence lengkap yang tidak didukung (termasuk
|
|
6
|
+
Ctrl+panah) menghasilkan `ignore`, bukan Escape; Escape tunggal tetap memakai
|
|
7
|
+
flush timer yang ada. Peta proteksi: `test/input-recovery.test.ts` dan
|
|
8
|
+
`test/prompt-engine.test.ts`. Cache proyeksi transkrip memakai ID baris stabil;
|
|
9
|
+
eviction hanya menghapus cache ID yang hilang, dengan geometri/output tetap.
|
|
10
|
+
Peta proteksi: `test/transcript-retention-cache.test.ts`.
|
|
11
|
+
Panel aktivitas tetap menghitung semua tool, tetapi error/deny/cancel/interrupted
|
|
12
|
+
juga tampil langsung sebagai ledger dengan nama tool dan alasan yang tersedia.
|
|
13
|
+
Hitungan denied/cancelled/interrupted dipisahkan dari failed dan tidak disembunyikan.
|
|
14
|
+
Peta proteksi: `test/activity-panel.test.ts`, `test/activity-fold.test.ts`.
|
|
15
|
+
Warning perbedaan kapasitas katalog/metadata menyatakan angka dan sumber yang dipakai;
|
|
16
|
+
metadata model eksak mengalahkan tebakan keluarga katalog, setelah override endpoint/operator.
|
|
17
|
+
Prinsip **satu baris per kejadian** (v7.15): satu turn menghasilkan satu baris
|
|
18
|
+
ringkasan thinking (angka baris diakumulasi lintas segmen, diperbarui di tempat —
|
|
19
|
+
bukan satu baris per segmen reasoning) dan satu baris ringkasan aktivitas tool;
|
|
20
|
+
panel aktivitas hidup tidak boleh meninggalkan salinan permanen 10 baris di
|
|
21
|
+
belakang setiap turn. Tinggi tata letak TUI tidak bergantung pada status
|
|
22
|
+
(indicators mengalah ke baris footer), sehingga transkrip tidak bergeser saat
|
|
23
|
+
thinking/tool berjalan. Alasan kegagalan ringkasan kompaksi dipendekkan ke
|
|
24
|
+
sebabnya (status + kode + pesan) tanpa payload JSON gateway.
|
|
25
|
+
Peta proteksi: `test/tui-render-regressions.test.ts`.
|
|
26
|
+
|
|
2
27
|
|
|
3
28
|
Perubahan v7.14: **geometri & dekorasi popup diseragamkan** (audit Surface
|
|
4
29
|
Popup, `AUD-001..AUD-011`). Empat perubahan tampak-pengguna:
|
|
@@ -267,6 +292,12 @@ Non-TTY (pipe/redirect/CI/file): **0 cursor control, 0 alternate screen,
|
|
|
267
292
|
state.json `lang` > locale OS (`LANG`/`LC_ALL` awalan `id`) > en. Semua
|
|
268
293
|
string user-visible TUI lewat `t()` — literal Indonesia hardcode di luar
|
|
269
294
|
dict dilarang (test anti-regresi). Getter runtime, bukan const beku.
|
|
295
|
+
Bahasa balasan model (progres, pertanyaan, jawaban akhir) mengikuti bahasa
|
|
296
|
+
pesan pengguna atau permintaan bahasa eksplisit, termasuk saat berganti bahasa;
|
|
297
|
+
pesan pendek mengikuti bahasa percakapan yang sudah terbentuk. Locale UI/OS
|
|
298
|
+
dan `/lang` hanya mengatur label UI, bukan bahasa balasan. Kutipan, kode, log,
|
|
299
|
+
serta hasil tool bukan penentu bahasa pengguna. Peta proteksi prompt:
|
|
300
|
+
`test/context-audit.test.ts`; kepatuhan model perlu diuji dengan provider nyata.
|
|
270
301
|
- **Keybinding konsisten** (kontrak I25): `Esc` dua-tahap di semua input
|
|
271
302
|
teks; `backspace`/`delete` selalu edit teks (aksi hapus-data via `d`/
|
|
272
303
|
`Del` + confirm dalam popup, tercatat); navigasi daftar = `↑↓` + `pgup/
|
package/docs/config.md
CHANGED
|
@@ -21,7 +21,19 @@ Di mana pengaturan dan data Minicode tinggal, bagaimana file lokal yang tak tepe
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
- `providers` — bisa juga diisi lewat wizard/`minicode config add`/`/provider`; lihat daftar preset di bawah.
|
|
24
|
-
- `providers[].contextWindows` — batas konteks dalam token per model; exact model ID menang, lalu key `"*"` menjadi fallback provider. Nilai
|
|
24
|
+
- `providers[].contextWindows` — batas konteks dalam token per model; exact model ID menang, lalu key `"*"` menjadi fallback provider. Nilai boleh **angka** (`128000`) atau **string preset** (`"128k"`, `"1m"`, `"1024x1024"`, `"auto"`); `"auto"` berarti hapus nilai dan kembali ke deteksi otomatis. Karena gateway memakai alias model, MiniCode memakai **default konservatif 128K** untuk alias generik (`auto`/`best`/...) dan **32K** untuk model tak dikenal lainnya; jendela eksak tersedia lewat katalog built-in (keluarga umum), overlay `minicode pricing sync` (models.dev), dan **tokenizer presisi on-demand** dari HuggingFace untuk model open. `--context-window` mengalahkan nilai config selama sesi itu.
|
|
25
|
+
|
|
26
|
+
**Provider yang tidak melaporkan kapasitas** (gateway lokal, endpoint kompatibel, alias): setel manual — nilai tersimpan berlabel `user` sehingga `minicode sync` **tidak** menimpanya:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
minicode config context-window # daftar semua nilai eksplisit
|
|
30
|
+
minicode config context-window <provider> # nilai satu provider
|
|
31
|
+
minicode config context-window <provider> <model> 128k
|
|
32
|
+
minicode config context-window <provider> <model> 1024x1024
|
|
33
|
+
minicode config context-window <provider> <model> auto # kembali deteksi otomatis
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Pilihan yang diterima mengikuti ukuran yang benar-benar dipakai model produksi: `16K`, `32K`, `64K`, `128K`, `200K`, `256K`, `400K`, `500K`, `1M`, `1M (1024²)`, `1.05M`, `2M`, `4M`, `10M`, ditambah angka eksak. **Tiga varian 1M** disengaja karena memang berbeda: `1000000` (Anthropic/DeepSeek/Qwen), `1048576` (Google/Gemini, Kimi, GLM), `1050000` (OpenAI) — selisihnya sampai ~50K token.
|
|
25
37
|
- `mcpServers` — dua bentuk: stdio (`command`+`args`) dan HTTP (`url`+opsional `headers`). Detail transport di [MCP & LSP](mcp-lsp.md).
|
|
26
38
|
- `verifyCommand` — dipakai `--verify` bila auto-detect tidak menemukan (urutan deteksi: `typecheck` → `test` → `tsconfig`).
|
|
27
39
|
- `bashAllowlist` — pola koma/pola glob perintah bash yang dianggap aman (mode `allowlist`).
|
package/docs/environment.md
CHANGED
|
@@ -94,6 +94,7 @@ Variabel yang paling menentukan perilaku (sisanya referensi di bawah):
|
|
|
94
94
|
| `MINICODE_MINIMIZE_ACTIVITY` | ON secara default di TUI; `0` → transparan (baris per-tool). Lipat aktivitas tool per turn jadi satu ringkasan (detail via `/expand`) |
|
|
95
95
|
| `MINICODE_ACTIVITY_PANEL` | `0` → matikan panel aktivitas (default AKTIF di TUI; `/fold` toggle); `1` → paksa aktif juga di jalur linear/one-shot |
|
|
96
96
|
| `MINICODE_AUTORESUME_BG` | `0` → nonaktifkan auto-resume turn TUI saat job background selesai (default aktif; sekali per job, hanya bila tidak ada turn berjalan) |
|
|
97
|
+
| `MINICODE_TURN_AUTO_RESUME` | `0` → nonaktifkan resume otomatis turn setelah kegagalan provider **transien** (`server`/`network`; default aktif). Retry provider dan resume turn berbagi **satu anggaran pemulihan** (`src/policy/recovery-budget.ts`): total 45 dtk dan kuota 6 percobaan untuk satu panggilan logis, dengan full jitter dan `Retry-After` sebagai floor. Berbagi satu anggaran mencegah *retry amplification* (angka terpisah per lapisan membuat biaya berkali: ≈82 dtk untuk provider mati). Kegagalan terminal tidak dipulihkan: `rate_limit` (429 permanen/spend-cap tidak pulih), `auth`, `invalid_request`, `context_length_exceeded`, `budget_exceeded`, `max_steps_exceeded`, dan abort user |
|
|
97
98
|
| `MINICORE_THINKING` | `off` → kirim `enable_thinking:false` ke OpenAI-compat (DeepSeek). Alias lama `MINICODE_THINKING` masih dihormati |
|
|
98
99
|
| `NO_COLOR` | Set apa pun selain `0` → matikan seluruh warna |
|
|
99
100
|
|
package/docs/getting-started.md
CHANGED
|
@@ -27,12 +27,20 @@ Cek: `bun --version` harus keluar versi ≥ `1.1.13` (contoh `1.4.x`). Kalau mas
|
|
|
27
27
|
**Langkah 2 — Pasang Minicode:**
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
|
|
30
|
+
bun add -g minicode-ai
|
|
31
31
|
# bin: minicode
|
|
32
32
|
minicode --version # pastikan versi terbaru terpasang
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Minicode adalah paket Bun — memasangnya dengan `bun add -g` memakai runtime yang
|
|
36
|
+
sama dengan yang menjalankannya, tanpa perantara Node. Tanpa Bun di PATH,
|
|
37
|
+
`minicode` gagal dengan `'bun' is not recognized`.
|
|
38
|
+
|
|
39
|
+
Masih memakai npm? Itu tetap didukung dan menghasilkan bin yang sama:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g minicode-ai
|
|
43
|
+
```
|
|
36
44
|
|
|
37
45
|
Untuk kontributor (kerja dari source):
|
|
38
46
|
|
|
@@ -137,7 +145,7 @@ One-shot, `exec`, pipe, dan CI hanya menampilkan notifikasi (tanpa install).
|
|
|
137
145
|
> manual sesuai kebijakan organisasinya.
|
|
138
146
|
|
|
139
147
|
```bash
|
|
140
|
-
|
|
148
|
+
bun add -g minicode-ai@<versi> # manual, gunakan versi yang sudah ditinjau
|
|
141
149
|
minicode sync # refresh model baru dari semua provider
|
|
142
150
|
minicode pricing sync # refresh cache harga dari models.dev
|
|
143
151
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minicode-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "Open-source terminal coding agent on a vendored zero-dependency MiniCore kernel — layered permissions, path jail, sandboxing, MCP/LSP, and durable shadow-git checkpoints",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|