minicode-ai 0.14.0 → 0.14.2
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/args.ts +16 -3
- package/cli/auto-update.ts +32 -2
- package/cli/commands/exec.ts +9 -0
- package/cli/index.ts +31 -13
- package/cli/setup.ts +31 -19
- package/cli/tui.ts +63 -40
- package/docs/OUTPUT_PROTOCOL_SPEC.md +6 -0
- package/docs/OUTPUT_RENDERING_SPEC.md +28 -4
- package/docs/README.md +2 -2
- package/docs/TERMINAL_CONTRACT.md +52 -26
- package/docs/agents.md +2 -2
- package/docs/choosing-mode.md +20 -13
- package/docs/cli.md +11 -11
- package/docs/environment.md +3 -3
- package/docs/getting-started.md +14 -12
- package/docs/glossary.md +1 -1
- package/docs/mcp-lsp.md +1 -1
- package/docs/policy-sandbox.md +7 -1
- package/docs/security-model.md +2 -2
- package/docs/security.md +7 -1
- package/docs/tools.md +4 -4
- package/docs/verify-benchmark.md +16 -0
- package/package.json +1 -3
- package/src/app/mentions.ts +4 -3
- package/src/app/session.ts +19 -9
- package/src/app/tool-layer.ts +10 -3
- package/src/constants.ts +17 -0
- package/src/lib/git-hardening.ts +27 -22
- package/src/lib/safe-open.ts +73 -19
- package/src/lib/trusted-exec.ts +7 -4
- package/src/mcp/client.ts +34 -9
- package/src/mcp/transport.ts +96 -42
- package/src/memory/files.ts +15 -4
- package/src/memory/vector.ts +5 -1
- package/src/policy/context.ts +21 -13
- package/src/policy/permission.ts +75 -16
- package/src/policy/tool-contract.ts +21 -10
- package/src/policy/update-check.ts +83 -6
- package/src/policy/usage.ts +17 -7
- package/src/policy/work-mode.ts +51 -17
- package/src/presentation/adapter.ts +64 -2
- package/src/presentation/events.ts +6 -0
- package/src/presentation/model.ts +1 -0
- package/src/presentation/projection.ts +2 -0
- package/src/presentation/reducer.ts +1 -0
- package/src/providers/anthropic.ts +52 -19
- package/src/providers/guards.ts +98 -13
- package/src/providers/responses.ts +61 -23
- package/src/providers/sse-bounds.ts +170 -0
- package/src/repo/repomap.ts +10 -11
- package/src/runtime/execution-backend.ts +7 -8
- package/src/sandbox/docker.ts +113 -9
- package/src/session/checkpoint.ts +9 -2
- package/src/session/persistence.ts +5 -2
- package/src/session/verification.ts +55 -16
- package/src/skills/loader.ts +16 -3
- package/src/tools/bash.ts +6 -3
- package/src/tools/code_run.ts +6 -5
- package/src/tools/context.ts +8 -0
- package/src/tools/delete_file.ts +2 -1
- package/src/tools/edit.ts +2 -1
- package/src/tools/git.ts +128 -54
- package/src/tools/glob.ts +2 -1
- package/src/tools/grep.ts +31 -6
- package/src/tools/lsp.ts +5 -4
- package/src/tools/mcp_call.ts +3 -1
- package/src/tools/memory.ts +175 -180
- package/src/tools/move_file.ts +2 -1
- package/src/tools/patch.ts +2 -1
- package/src/tools/read_file.ts +94 -1
- package/src/tools/read_image.ts +2 -1
- package/src/tools/task.ts +2 -1
- package/src/tools/todo.ts +4 -5
- package/src/tools/web_fetch.ts +28 -12
- package/src/tools/web_search.ts +28 -9
- package/src/tools/write_file.ts +2 -1
- package/src/ui/assistant/simple.ts +72 -3
- package/src/ui/footer.ts +17 -12
- package/src/ui/i18n/en.ts +6 -3
- package/src/ui/i18n/id.ts +6 -3
- package/src/ui/render/width.ts +107 -79
- package/src/ui/runtime/screen.ts +49 -37
- package/src/ui/tui/app.ts +261 -209
- package/src/ui/tui/transcript.ts +39 -0
- package/CHANGELOG.md +0 -1167
- package/docs/PLAN_UIUX_V6.md +0 -209
- package/docs/changelog.md +0 -3
package/src/tools/web_fetch.ts
CHANGED
|
@@ -5,28 +5,41 @@ import { fenceUntrustedToolOutput, isAlreadyFenced, scrubSecrets } from "../poli
|
|
|
5
5
|
|
|
6
6
|
const MAX_REDIRECTS = LIMITS.WEB_FETCH_MAX_REDIRECTS
|
|
7
7
|
// Hard-cap pembacaan body SEBELUM slicing — cegah OOM dari response raksasa.
|
|
8
|
-
const
|
|
8
|
+
const BODY_HARD_CAP_BYTES = LIMITS.WEB_RESPONSE_BODY_HARD_CAP_BYTES
|
|
9
9
|
|
|
10
10
|
// Diekspor untuk web_search (jalur DDG): satu kebijakan cap untuk semua fetch.
|
|
11
|
-
export async function readBodyCapped(
|
|
12
|
-
|
|
11
|
+
export async function readBodyCapped(
|
|
12
|
+
res: Response,
|
|
13
|
+
controller: AbortController,
|
|
14
|
+
): Promise<{ text: string; truncated: boolean }> {
|
|
15
|
+
if (!res.body) return { text: "", truncated: false }
|
|
13
16
|
const reader = res.body.getReader()
|
|
14
17
|
const decoder = new TextDecoder()
|
|
15
18
|
let out = ""
|
|
19
|
+
let bytesRead = 0
|
|
20
|
+
let truncated = false
|
|
16
21
|
try {
|
|
17
22
|
while (true) {
|
|
18
23
|
const { done, value } = await reader.read()
|
|
19
|
-
if (done)
|
|
20
|
-
|
|
21
|
-
if (out.length > BODY_HARD_CAP_CHARS) {
|
|
22
|
-
controller.abort(new Error("response exceeds body hard cap"))
|
|
24
|
+
if (done) {
|
|
25
|
+
out += decoder.decode()
|
|
23
26
|
break
|
|
24
27
|
}
|
|
28
|
+
const remaining = BODY_HARD_CAP_BYTES - bytesRead
|
|
29
|
+
if (value.byteLength > remaining) {
|
|
30
|
+
if (remaining > 0) out += decoder.decode(value.subarray(0, remaining), { stream: true })
|
|
31
|
+
truncated = true
|
|
32
|
+
controller.abort(new Error("response exceeds body byte cap"))
|
|
33
|
+
await reader.cancel().catch(() => {})
|
|
34
|
+
break
|
|
35
|
+
}
|
|
36
|
+
bytesRead += value.byteLength
|
|
37
|
+
out += decoder.decode(value, { stream: true })
|
|
25
38
|
}
|
|
26
39
|
} finally {
|
|
27
40
|
reader.releaseLock()
|
|
28
41
|
}
|
|
29
|
-
return out
|
|
42
|
+
return { text: out, truncated }
|
|
30
43
|
}
|
|
31
44
|
|
|
32
45
|
// Snippet body error dengan cap streaming (F-15): cukup untuk diagnosis,
|
|
@@ -147,11 +160,14 @@ export const webFetchTool: Tool = {
|
|
|
147
160
|
}
|
|
148
161
|
|
|
149
162
|
const contentType = res.headers.get("content-type") ?? ""
|
|
150
|
-
const
|
|
151
|
-
const scrubbed = scrubSecrets(
|
|
163
|
+
const body = await readBodyCapped(res, controller)
|
|
164
|
+
const scrubbed = scrubSecrets(body.text)
|
|
152
165
|
const sliced = scrubbed.slice(0, limit)
|
|
153
|
-
const
|
|
166
|
+
const outputTruncation =
|
|
154
167
|
scrubbed.length > limit ? `\n\n… truncated ${scrubbed.length - limit} chars` : ""
|
|
168
|
+
const byteTruncation = body.truncated
|
|
169
|
+
? `\n\n… response truncated at ${BODY_HARD_CAP_BYTES} bytes`
|
|
170
|
+
: ""
|
|
155
171
|
// Header tak boleh menggema kredensial: userinfo dihapus STRUKTURAL
|
|
156
172
|
// (scrub pola tak kenal `user:pass@`), query disamarkan via scrubSecrets
|
|
157
173
|
// (pola sama seperti body). Divalidasi e2e bug-hunt 2026-09-19 F4:
|
|
@@ -161,7 +177,7 @@ export const webFetchTool: Tool = {
|
|
|
161
177
|
shown.username = ""
|
|
162
178
|
shown.password = ""
|
|
163
179
|
const header = `[${scrubSecrets(shown.toString())} ${res.status} ${contentType}]\n`
|
|
164
|
-
const content = (header + sliced +
|
|
180
|
+
const content = (header + sliced + outputTruncation + byteTruncation).slice(0, limit + 500)
|
|
165
181
|
// [Fase 4 / TOOL-05] Pagar data tak-terpercaya pada output web_fetch
|
|
166
182
|
return isAlreadyFenced(content) ? content : fenceUntrustedToolOutput("web_fetch", content)
|
|
167
183
|
} finally {
|
package/src/tools/web_search.ts
CHANGED
|
@@ -54,15 +54,21 @@ export const webSearchTool: Tool = {
|
|
|
54
54
|
signal: controller.signal,
|
|
55
55
|
})
|
|
56
56
|
if (res.ok) {
|
|
57
|
-
const
|
|
57
|
+
const body = await readBodyCapped(res, controller)
|
|
58
|
+
if (body.truncated) throw new Error("Tavily response exceeds body byte cap")
|
|
59
|
+
const data = JSON.parse(body.text) as {
|
|
58
60
|
results?: { title: string; url: string; content: string }[]
|
|
59
61
|
}
|
|
60
62
|
const results = (data.results ?? []).slice(0, n)
|
|
61
63
|
const out = results
|
|
62
64
|
.map((r, i) => `${i + 1}. ${r.title}\n ${r.url}\n ${cutSnippet(r.content)}`)
|
|
63
65
|
.join("\n\n")
|
|
64
|
-
|
|
66
|
+
const content = capTotal(`[tavily ${results.length} results for "${q}"]\n${out}`, 20000)
|
|
67
|
+
return isAlreadyFenced(content)
|
|
68
|
+
? content
|
|
69
|
+
: fenceUntrustedToolOutput("web_search", content)
|
|
65
70
|
}
|
|
71
|
+
await res.body?.cancel().catch(() => {})
|
|
66
72
|
} finally {
|
|
67
73
|
clearTimeout(t)
|
|
68
74
|
ctx.signal.removeEventListener("abort", onAbort)
|
|
@@ -88,7 +94,9 @@ export const webSearchTool: Tool = {
|
|
|
88
94
|
},
|
|
89
95
|
)
|
|
90
96
|
if (res.ok) {
|
|
91
|
-
const
|
|
97
|
+
const body = await readBodyCapped(res, controller)
|
|
98
|
+
if (body.truncated) throw new Error("Brave response exceeds body byte cap")
|
|
99
|
+
const data = JSON.parse(body.text) as {
|
|
92
100
|
web?: { results?: { title: string; url: string; description: string }[] }
|
|
93
101
|
}
|
|
94
102
|
const results = (data.web?.results ?? []).slice(0, n)
|
|
@@ -99,9 +107,16 @@ export const webSearchTool: Tool = {
|
|
|
99
107
|
`${i + 1}. ${r.title}\n ${r.url}\n ${cutSnippet(r.description ?? "")}`,
|
|
100
108
|
)
|
|
101
109
|
.join("\n\n")
|
|
102
|
-
|
|
110
|
+
const content = capTotal(
|
|
111
|
+
`[brave ${results.length} results for "${q}"]\n${out}`,
|
|
112
|
+
20000,
|
|
113
|
+
)
|
|
114
|
+
return isAlreadyFenced(content)
|
|
115
|
+
? content
|
|
116
|
+
: fenceUntrustedToolOutput("web_search", content)
|
|
103
117
|
}
|
|
104
118
|
}
|
|
119
|
+
await res.body?.cancel().catch(() => {})
|
|
105
120
|
} finally {
|
|
106
121
|
clearTimeout(t)
|
|
107
122
|
ctx.signal.removeEventListener("abort", onAbort)
|
|
@@ -125,7 +140,8 @@ export const webSearchTool: Tool = {
|
|
|
125
140
|
})
|
|
126
141
|
// Cap streaming seperti web_fetch (bug-hunt 2026-09-19: res.text()
|
|
127
142
|
// tanpa batas = transient ~2x body di heap untuk halaman raksasa).
|
|
128
|
-
const
|
|
143
|
+
const body = await readBodyCapped(res, controller)
|
|
144
|
+
const html = body.text
|
|
129
145
|
const scrubbed = scrubSecrets(html)
|
|
130
146
|
// DDG markup berubah-ubah; coba dua pola kelas umum.
|
|
131
147
|
const resRe = /<a[^>]+class="result__url"[^>]*href="([^"]+)"[^>]*>([^<]+)<\/a>/g
|
|
@@ -142,18 +158,21 @@ export const webSearchTool: Tool = {
|
|
|
142
158
|
}
|
|
143
159
|
}
|
|
144
160
|
if (results.length) {
|
|
161
|
+
const truncation = body.truncated ? " · response truncated at byte cap" : ""
|
|
145
162
|
const content = capTotal(
|
|
146
|
-
`[duckduckgo ${results.length} results for "${q}"]\n${results.map((r, i) => `${i + 1}. ${r.title}\n ${r.url}`).join("\n")}`,
|
|
163
|
+
`[duckduckgo ${results.length} results for "${q}"${truncation}]\n${results.map((r, i) => `${i + 1}. ${r.title}\n ${r.url}`).join("\n")}`,
|
|
147
164
|
8000,
|
|
148
165
|
)
|
|
149
166
|
return isAlreadyFenced(content)
|
|
150
167
|
? content
|
|
151
|
-
: fenceUntrustedToolOutput("web_search", content
|
|
168
|
+
: fenceUntrustedToolOutput("web_search", content)
|
|
152
169
|
}
|
|
153
|
-
const fallback =
|
|
170
|
+
const fallback = body.truncated
|
|
171
|
+
? `[web_search] DuckDuckGo response exceeded the byte cap before structured results could be parsed for "${q}" — coba set TAVILY_API_KEY atau BRAVE_API_KEY.`
|
|
172
|
+
: `[web_search] no structured results for "${q}" — coba set TAVILY_API_KEY atau BRAVE_API_KEY untuk hasil lebih baik.`
|
|
154
173
|
return isAlreadyFenced(fallback)
|
|
155
174
|
? fallback
|
|
156
|
-
: fenceUntrustedToolOutput("web_search", fallback
|
|
175
|
+
: fenceUntrustedToolOutput("web_search", fallback)
|
|
157
176
|
} finally {
|
|
158
177
|
clearTimeout(t)
|
|
159
178
|
ctx.signal.removeEventListener("abort", onAbort)
|
package/src/tools/write_file.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { LIMITS } from "../constants.ts"
|
|
|
5
5
|
import { atomicWriteText } from "../lib/atomic-write.ts"
|
|
6
6
|
import { assertSafeWriteTarget, resolveSafePath } from "../lib/safe-open.ts"
|
|
7
7
|
import { appendLspDiagnostics } from "../policy/verifier.ts"
|
|
8
|
+
import { requireToolCwd } from "./context.ts"
|
|
8
9
|
|
|
9
10
|
export const writeFileTool: Tool = {
|
|
10
11
|
name: "write_file",
|
|
@@ -22,7 +23,7 @@ export const writeFileTool: Tool = {
|
|
|
22
23
|
async execute({ path, content }, ctx) {
|
|
23
24
|
ctx.signal.throwIfAborted()
|
|
24
25
|
const p = path as string
|
|
25
|
-
const root = ctx
|
|
26
|
+
const root = requireToolCwd(ctx)
|
|
26
27
|
// Verifikasi path terpusat (logis + target nyata) — detail di safe-open.ts.
|
|
27
28
|
const { real: realAbs } = await resolveSafePath(p, root)
|
|
28
29
|
// Tolak menimpa symlink final (swap antara cek dan tulis gagal tutup).
|
|
@@ -176,8 +176,8 @@ export function attachSimpleLogger(bus: UiBus, opts: SimpleOptions = {}): () =>
|
|
|
176
176
|
// aliran (model/reasoning/bash) agar state ekor tak tercampur. Ekor yang
|
|
177
177
|
// tersisa saat turn selesai/detach DIBUANG (flush di bawah): escape tanpa
|
|
178
178
|
// teks lanjutan tak punya efek tampak kecuali mutasi state terminal.
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
let textSan = createStreamSanitizer()
|
|
180
|
+
let reasoningSan = createStreamSanitizer()
|
|
181
181
|
const bashSan = createStreamSanitizer()
|
|
182
182
|
// State fence dipegang DI SINI, bukan di decorateMarkdown: baris datang per
|
|
183
183
|
// event streaming, sedangkan decorateMarkdown memproses satu teks utuh.
|
|
@@ -206,6 +206,14 @@ export function attachSimpleLogger(bus: UiBus, opts: SimpleOptions = {}): () =>
|
|
|
206
206
|
// /copy tak tersentuh (rememberTurn selalu jalan sebelum sink).
|
|
207
207
|
let answerBuf = ""
|
|
208
208
|
let answerTruncated = false
|
|
209
|
+
let activeProviderAttempt: number | null = null
|
|
210
|
+
let attemptCopyText = ""
|
|
211
|
+
let attemptAnswerBuf = ""
|
|
212
|
+
let attemptAnswerTruncated = false
|
|
213
|
+
let attemptThinkingBuf = ""
|
|
214
|
+
let attemptReasoningLine = ""
|
|
215
|
+
let attemptThinkState: "off" | "min" | "exp" = "off"
|
|
216
|
+
let attemptFence: FenceMatch | null = null
|
|
209
217
|
const ANSWER_BUF_MAX = 1_000_000
|
|
210
218
|
// Jawaban tak pernah disembunyikan di pipa/CI (output mesin harus utuh)
|
|
211
219
|
// dan --verbose selalu menampilkan semua.
|
|
@@ -565,6 +573,8 @@ export function attachSimpleLogger(bus: UiBus, opts: SimpleOptions = {}): () =>
|
|
|
565
573
|
reasoningLine = ""
|
|
566
574
|
answerBuf = ""
|
|
567
575
|
answerTruncated = false
|
|
576
|
+
activeProviderAttempt = null
|
|
577
|
+
attemptCopyText = ""
|
|
568
578
|
ui.clearCollapsedSections()
|
|
569
579
|
ui.setActiveSection(null)
|
|
570
580
|
archiveTurn(ui)
|
|
@@ -605,12 +615,71 @@ export function attachSimpleLogger(bus: UiBus, opts: SimpleOptions = {}): () =>
|
|
|
605
615
|
answerTruncated = false
|
|
606
616
|
}
|
|
607
617
|
const clean = cleanUntrusted(textSan.push(e.text), !!process.stdout.isTTY)
|
|
608
|
-
|
|
618
|
+
if (activeProviderAttempt === null) {
|
|
619
|
+
// Kompatibilitas untuk bus provider legacy yang tidak melewati guard.
|
|
620
|
+
rememberTurn(ui, clean)
|
|
621
|
+
} else if (attemptCopyText.length < ANSWER_BUF_MAX) {
|
|
622
|
+
attemptCopyText += clean.slice(0, ANSWER_BUF_MAX - attemptCopyText.length)
|
|
623
|
+
}
|
|
609
624
|
consumeTableEvents(tableStream.push(clean))
|
|
610
625
|
}),
|
|
611
626
|
)
|
|
612
627
|
offs.push(
|
|
613
628
|
bus.on("provider:extension", (e) => {
|
|
629
|
+
if (e.kind === "minicode:attempt") {
|
|
630
|
+
const data = e.data as {
|
|
631
|
+
phase?: unknown
|
|
632
|
+
attemptId?: unknown
|
|
633
|
+
hadVisibleOutput?: unknown
|
|
634
|
+
} | null
|
|
635
|
+
const id = data?.attemptId
|
|
636
|
+
if (typeof id !== "number" || !Number.isSafeInteger(id) || id < 1) return
|
|
637
|
+
if (data?.phase === "started") {
|
|
638
|
+
// Batas attempt juga menjadi batas stream markdown dan ANSI. Teks
|
|
639
|
+
// attempt sebelumnya yang sudah diterima dipertahankan; state parsial
|
|
640
|
+
// yang belum dirender diselesaikan sebelum attempt baru dimulai.
|
|
641
|
+
flushTableStream()
|
|
642
|
+
tableStream.reset()
|
|
643
|
+
activeProviderAttempt = id
|
|
644
|
+
attemptCopyText = ""
|
|
645
|
+
attemptAnswerBuf = answerBuf
|
|
646
|
+
attemptAnswerTruncated = answerTruncated
|
|
647
|
+
attemptThinkingBuf = thinkingBuf
|
|
648
|
+
attemptReasoningLine = reasoningLine
|
|
649
|
+
attemptThinkState = thinkState
|
|
650
|
+
attemptFence = fence ? { ...fence } : null
|
|
651
|
+
textSan = createStreamSanitizer()
|
|
652
|
+
reasoningSan = createStreamSanitizer()
|
|
653
|
+
} else if (id === activeProviderAttempt && data?.phase === "completed") {
|
|
654
|
+
rememberTurn(ui, attemptCopyText)
|
|
655
|
+
activeProviderAttempt = null
|
|
656
|
+
attemptCopyText = ""
|
|
657
|
+
textSan.flush()
|
|
658
|
+
reasoningSan.flush()
|
|
659
|
+
textSan = createStreamSanitizer()
|
|
660
|
+
reasoningSan = createStreamSanitizer()
|
|
661
|
+
} else if (id === activeProviderAttempt && data?.phase === "invalidated") {
|
|
662
|
+
answerBuf = attemptAnswerBuf
|
|
663
|
+
answerTruncated = attemptAnswerTruncated
|
|
664
|
+
thinkingBuf = attemptThinkingBuf
|
|
665
|
+
reasoningLine = attemptReasoningLine
|
|
666
|
+
thinkState = attemptThinkState
|
|
667
|
+
fence = attemptFence ? { ...attemptFence } : null
|
|
668
|
+
plainLineBuffer = ""
|
|
669
|
+
tableStream.reset()
|
|
670
|
+
textSan.flush()
|
|
671
|
+
reasoningSan.flush()
|
|
672
|
+
textSan = createStreamSanitizer()
|
|
673
|
+
reasoningSan = createStreamSanitizer()
|
|
674
|
+
ui.setActiveSection(thinkState === "off" ? null : "thinking")
|
|
675
|
+
activeProviderAttempt = null
|
|
676
|
+
attemptCopyText = ""
|
|
677
|
+
if (data.hadVisibleOutput === true) {
|
|
678
|
+
wErr(c.warning(t("one.providerAttemptDiscarded", { attempt: id })))
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return
|
|
682
|
+
}
|
|
614
683
|
if (e.kind === "reasoning") {
|
|
615
684
|
// Section thinking: reasoning.visible = expanded (stream), else
|
|
616
685
|
// minimized (satu baris ` + thinking`, isi di-buffer untuk /expand).
|
package/src/ui/footer.ts
CHANGED
|
@@ -48,8 +48,8 @@ export interface FooterStatus {
|
|
|
48
48
|
timerHighlight?: TimerHighlight
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
/** Lebar tetap kolom mode —
|
|
52
|
-
const MODE_WIDTH =
|
|
51
|
+
/** Lebar tetap kolom mode — muat label terpanjang "DISCUSS · AUTO". */
|
|
52
|
+
const MODE_WIDTH = 14
|
|
53
53
|
|
|
54
54
|
/** Buang prefix provider (`acme::deepseek-v4` → `deepseek-v4`). */
|
|
55
55
|
export function shortModel(id: string): string {
|
|
@@ -57,25 +57,30 @@ export function shortModel(id: string): string {
|
|
|
57
57
|
return i >= 0 ? id.slice(i + 2) : id
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/** Label permission (AUTO/ASK) — legacy profile warisan di-uppercase saja. */
|
|
61
|
+
function permissionLabel(mode: string): string {
|
|
62
|
+
return (mode || "").toUpperCase()
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
/**
|
|
61
66
|
* Warna + PAD token mode. Padding dilakukan sebelum pewarnaan supaya lebar
|
|
62
67
|
* kolom mode tetap sama untuk semua mode (anti-geser), sementara warna tetap
|
|
63
68
|
* dipilih dari nama mode asli.
|
|
64
69
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
70
|
+
* [mode-architecture] Selalu tampilkan KEDUA lapis sebagai `<WorkMode> ·
|
|
71
|
+
* <PermissionMode>` (mis. `BUILD · AUTO`, `PLAN · ASK`). Identitas internal
|
|
72
|
+
* `EXECUTE` ditampilkan sebagai produk `BUILD`. EXECUTE/default tak lagi
|
|
73
|
+
* disembunyikan. Warna mengikuti lapis yang lebih ketat: DISCUSS/PLAN warning,
|
|
74
|
+
* ASK info, AUTO success.
|
|
68
75
|
*/
|
|
69
76
|
export function paintFooterMode(mode: string, workMode?: string): string {
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// Mode satu-baris: newline dari input tak terpercaya wajib dibuang agar tak
|
|
75
|
-
// memecah frame lengket 2-baris chrome.ts.
|
|
77
|
+
const wm = !workMode || workMode === "EXECUTE" ? "BUILD" : workMode.toUpperCase()
|
|
78
|
+
const pm = permissionLabel(mode)
|
|
79
|
+
const restrictive = wm === "DISCUSS" || wm === "PLAN"
|
|
80
|
+
const label = `${wm} · ${pm}`
|
|
76
81
|
const padded = padToWidth(sanitizeAnsiLine(label), MODE_WIDTH)
|
|
77
82
|
if (restrictive) return c.warning(padded)
|
|
78
|
-
return
|
|
83
|
+
return pm === "ASK" ? c.info(padded) : c.success(padded)
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
/** Spark glyph: redup saat idle, pulse putih↔abu saat busy (frame genap/ganjil). */
|
package/src/ui/i18n/en.ts
CHANGED
|
@@ -39,6 +39,7 @@ export const en = {
|
|
|
39
39
|
"appr.tier.unknown": "unknown effect",
|
|
40
40
|
"dlg.more": "… {n} more",
|
|
41
41
|
"ts.compacted": "… compacted: {reason}",
|
|
42
|
+
"ts.providerAttemptDiscarded": "provider attempt {attempt} failed; partial output was discarded",
|
|
42
43
|
"ts.thinking": "… thinking",
|
|
43
44
|
"ts.evictMarker": "… {n} early lines outside viewport — full history in model",
|
|
44
45
|
"ts.statusRunning": "running",
|
|
@@ -145,11 +146,11 @@ export const en = {
|
|
|
145
146
|
"help.keysLine": "Mouse wheel/PgUp/PgDn scroll (Shift = half) · /help keys = all shortcuts",
|
|
146
147
|
"help.cHead": "Commands:",
|
|
147
148
|
"help.cKeys":
|
|
148
|
-
"Keys: Tab mode · ↑↓ history · Mouse wheel/PgUp/PgDn scroll · Ctrl+R search · Ctrl+D exit",
|
|
149
|
+
"Keys: Tab work-mode · Shift+Tab permission · ↑↓ history · Mouse wheel/PgUp/PgDn scroll · Ctrl+R search · Ctrl+D exit",
|
|
149
150
|
"help.cMore": " /help keys = all shortcuts",
|
|
150
151
|
"help.kHead": "Keyboard:",
|
|
151
152
|
"help.k.submit": "submit",
|
|
152
|
-
"help.k.cycleMode": "cycle
|
|
153
|
+
"help.k.cycleMode": "cycle work mode",
|
|
153
154
|
"help.k.history": "prompt history (in picker: navigate)",
|
|
154
155
|
"help.k.mouse": "scroll transcript with mouse wheel",
|
|
155
156
|
"help.k.scroll": "scroll transcript with PgUp/PgDn (Shift+ = half page)",
|
|
@@ -238,7 +239,7 @@ export const en = {
|
|
|
238
239
|
"tui.modeLine": "mode: {m}",
|
|
239
240
|
"tui.workModeUnknown": "unknown work mode: {a} — choices: {modes}",
|
|
240
241
|
"tui.workModeLine": "work mode: {m}",
|
|
241
|
-
"tui.workModeUsage": "usage: /work-mode <DISCUSS|PLAN|
|
|
242
|
+
"tui.workModeUsage": "usage: /work-mode <DISCUSS|PLAN|BUILD> — current: {m}",
|
|
242
243
|
"tui.workModeUnavailable": "work mode is not available in this session",
|
|
243
244
|
"tui.langLine": "lang: {v}",
|
|
244
245
|
"tui.toolCall": "tool call: {v}",
|
|
@@ -277,6 +278,8 @@ export const en = {
|
|
|
277
278
|
"one.answerOpen": " − answer\n",
|
|
278
279
|
"one.answerMin": " + answer ({n} chars{cap}) — /expand to read\n",
|
|
279
280
|
"one.answerCap": ", capped 1MB",
|
|
281
|
+
"one.providerAttemptDiscarded":
|
|
282
|
+
"\n[provider attempt {attempt} failed; partial output above is excluded from the final response]\n",
|
|
280
283
|
"one.thinkOpen": " − thinking\n",
|
|
281
284
|
"one.thinkMin": " + thinking\n",
|
|
282
285
|
"one.more3": "\n ... ({n} more)",
|
package/src/ui/i18n/id.ts
CHANGED
|
@@ -40,6 +40,7 @@ export const id: Record<MsgKey, string> = {
|
|
|
40
40
|
"appr.tier.unknown": "efek tidak diketahui",
|
|
41
41
|
"dlg.more": "… {n} lagi",
|
|
42
42
|
"ts.compacted": "… dipadatkan: {reason}",
|
|
43
|
+
"ts.providerAttemptDiscarded": "percobaan provider {attempt} gagal; output parsial dibuang",
|
|
43
44
|
"ts.thinking": "… berpikir",
|
|
44
45
|
"ts.evictMarker": "… {n} baris awal di luar viewport — riwayat penuh di model",
|
|
45
46
|
"ts.statusRunning": "berjalan",
|
|
@@ -146,11 +147,11 @@ export const id: Record<MsgKey, string> = {
|
|
|
146
147
|
"help.keysLine": "Mouse wheel/PgUp/PgDn gulir (Shift = ½) · /help tombol = semua pintasan",
|
|
147
148
|
"help.cHead": "Perintah:",
|
|
148
149
|
"help.cKeys":
|
|
149
|
-
"Tombol: Tab mode · ↑↓ riwayat · Mouse wheel/PgUp/PgDn gulir · Ctrl+R cari · Ctrl+D keluar",
|
|
150
|
+
"Tombol: Tab work-mode · Shift+Tab izin · ↑↓ riwayat · Mouse wheel/PgUp/PgDn gulir · Ctrl+R cari · Ctrl+D keluar",
|
|
150
151
|
"help.cMore": " /help tombol = semua pintasan",
|
|
151
152
|
"help.kHead": "Papan tombol:",
|
|
152
153
|
"help.k.submit": "kirim",
|
|
153
|
-
"help.k.cycleMode": "putar mode
|
|
154
|
+
"help.k.cycleMode": "putar work mode",
|
|
154
155
|
"help.k.history": "riwayat prompt (di picker: navigasi)",
|
|
155
156
|
"help.k.mouse": "gulir transkrip dengan mouse wheel",
|
|
156
157
|
"help.k.scroll": "gulir transkrip dengan PgUp/PgDn (Shift+ = setengah halaman)",
|
|
@@ -239,7 +240,7 @@ export const id: Record<MsgKey, string> = {
|
|
|
239
240
|
"tui.modeLine": "mode: {m}",
|
|
240
241
|
"tui.workModeUnknown": "work mode tidak dikenal: {a} — pilihan: {modes}",
|
|
241
242
|
"tui.workModeLine": "mode kerja: {m}",
|
|
242
|
-
"tui.workModeUsage": "pemakaian: /work-mode <DISCUSS|PLAN|
|
|
243
|
+
"tui.workModeUsage": "pemakaian: /work-mode <DISCUSS|PLAN|BUILD> — aktif: {m}",
|
|
243
244
|
"tui.workModeUnavailable": "work mode tidak tersedia di sesi ini",
|
|
244
245
|
"tui.langLine": "lang: {v}",
|
|
245
246
|
"tui.toolCall": "pemanggilan tool: {v}",
|
|
@@ -279,6 +280,8 @@ export const id: Record<MsgKey, string> = {
|
|
|
279
280
|
"one.answerOpen": " − jawaban\n",
|
|
280
281
|
"one.answerMin": " + jawaban ({n} karakter{cap}) — /expand untuk baca\n",
|
|
281
282
|
"one.answerCap": ", dibatasi 1MB",
|
|
283
|
+
"one.providerAttemptDiscarded":
|
|
284
|
+
"\n[percobaan provider {attempt} gagal; output parsial di atas tidak termasuk jawaban akhir]\n",
|
|
282
285
|
"one.thinkOpen": " − berpikir\n",
|
|
283
286
|
"one.thinkMin": " + berpikir\n",
|
|
284
287
|
"one.more3": "\n ... ({n} lagi)",
|