minicode-ai 0.14.5 → 0.14.6

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/setup.ts CHANGED
@@ -1151,9 +1151,11 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
1151
1151
  }
1152
1152
 
1153
1153
  // [mode-architecture] `--plan` legacy bukan lagi permission mode — pemetaannya
1154
- // ke WorkMode PLAN terjadi di effectiveWorkMode (di atas). Sisa profil warisan
1155
- // (allow-all/allowlist) tetap tersedia sebagai tool-access profile.
1156
- const permissionMode = allowAll ? "allow-all" : ask ? "ask" : allowlist ? "allowlist" : "auto"
1154
+ // ke WorkMode PLAN terjadi di effectiveWorkMode (di atas). `--allow-all` tetap
1155
+ // profil privileged. `--allowlist`/fallback no-sandbox TIDAK lagi mengubah
1156
+ // PermissionMode: ia jadi `restrictBash` (lapis kapabilitas bash terpisah).
1157
+ const permissionMode = allowAll ? "allow-all" : ask ? "ask" : "auto"
1158
+ const restrictBash = allowlist
1157
1159
 
1158
1160
  // Home guard: sesi dibuka di home berisiko (glob rame, write berbahaya).
1159
1161
  // Standar industri: percaya-tapi-ingatkan, jangan tolak diam-diam maupun
@@ -1897,6 +1899,7 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
1897
1899
  tools: sessionTools,
1898
1900
  cwd,
1899
1901
  permissionMode,
1902
+ restrictBash,
1900
1903
  allowLocalConfig,
1901
1904
  // P12 S2.2 + P0.2 — WorkMode efektif sesi ini (termasuk pulihan resume).
1902
1905
  workMode: effectiveWorkMode,
@@ -1930,6 +1933,7 @@ export async function createCliSession(opts: CliSessionOptions): Promise<CliSess
1930
1933
  setToolPermissionMode?.(m)
1931
1934
  },
1932
1935
  getMode: () => ctl.getMode(),
1936
+ getRestrictBash: () => ctl.getRestrictBash?.() ?? false,
1933
1937
  }
1934
1938
  },
1935
1939
  // P12 S2.2 Slice 5 — handle kontrol WorkMode runtime. Setelah sesi
package/cli/tui.ts CHANGED
@@ -638,7 +638,10 @@ export async function runTui(ctx: CliSession): Promise<void> {
638
638
  getStatus: () => {
639
639
  const status = {
640
640
  footer: {
641
- mode,
641
+ // Normalisasi: sumbu persetujuan hanya AUTO/ASK. Profil warisan
642
+ // (allow-all/allowlist) tak lagi bocor sebagai label mode.
643
+ mode: mode === "ask" ? "ask" : "auto",
644
+ strictBash: permissions?.getRestrictBash?.() ?? false,
642
645
  // P12 S2.2 Slice 5 - WorkMode LIVE (bukan snapshot boot): footer
643
646
  // mencerminkan mode aktif saat frame digambar.
644
647
  workMode: workModeControl?.getWorkMode() ?? "DISCUSS",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minicode-ai",
3
- "version": "0.14.5",
3
+ "version": "0.14.6",
4
4
  "description": "Coding agent CLI built on the frozen MiniCore runtime — tools, MCP, LSP, sandbox, shadow-git checkpoints",
5
5
  "type": "module",
6
6
  "private": false,
@@ -74,6 +74,8 @@ export const cappedRecovery = {
74
74
  export type PermissionControl = {
75
75
  setMode(m: "auto" | "readonly" | "plan" | "allow-all" | "ask" | "allowlist"): void
76
76
  getMode(): "auto" | "readonly" | "plan" | "allow-all" | "ask" | "allowlist"
77
+ /** Bila true, bash dibatasi ke allow-list (lapis kapabilitas, terpisah mode). */
78
+ getRestrictBash?(): boolean
77
79
  }
78
80
 
79
81
  /**
@@ -129,6 +131,11 @@ export async function createMinicodeSession(
129
131
  /** Live model identity used for per-model token calibration. */
130
132
  getContextModel?: () => string | undefined
131
133
  permissionMode?: "auto" | "readonly" | "plan" | "allow-all" | "ask" | "allowlist"
134
+ /**
135
+ * [mode-architecture] Lapis kapabilitas bash TERPISAH dari permission mode.
136
+ * Bila true, `auto` membatasi bash ke allow-list (fallback "no-sandbox").
137
+ */
138
+ restrictBash?: boolean
132
139
  /** S2.1: WorkMode adalah lapis intent TERPISAH dari PermissionMode.
133
140
  * Default EXECUTE = perilaku lama (base handler apa adanya). Nilai selain
134
141
  * EXECUTE memasang ceiling tipis di atas handler PM (lihat work-mode.ts);
@@ -237,6 +244,7 @@ export async function createMinicodeSession(
237
244
  concurrency,
238
245
  writeConcurrency,
239
246
  permissionMode,
247
+ restrictBash,
240
248
  workMode: _workMode,
241
249
  allowLocalConfig,
242
250
  systemExtra: _extra,
@@ -313,6 +321,7 @@ export async function createMinicodeSession(
313
321
  root: defaultCwd,
314
322
  ask,
315
323
  allowLocalConfig,
324
+ restrictBash,
316
325
  onApprovalEvent,
317
326
  authorizedTools,
318
327
  // [Area B · PROMPT 06] Store per-sesi: persetujuan dari sesi A tak
@@ -433,6 +442,9 @@ export async function createMinicodeSession(
433
442
  onPermissions({
434
443
  setMode: (m) => withMode.__setMode(m),
435
444
  getMode: () => withMode.__getMode(),
445
+ // restrictBash adalah opsi tetap (bukan state handler) — dibaca langsung
446
+ // dari closure, bukan lewat wrapper WorkMode yang tak meneruskannya.
447
+ getRestrictBash: () => restrictBash === true,
436
448
  })
437
449
  }
438
450
  // P12 S2.2 Slice 5 — handle kontrol WorkMode runtime. Hanya di-wire bila
@@ -342,9 +342,18 @@ export function createPermissionHandler(
342
342
  * ini yang boleh auto-allow. Absen = fail-closed (semua MCP bertitik deny).
343
343
  */
344
344
  authorizedTools?: ReadonlySet<string> | null
345
+ /**
346
+ * [mode-architecture] Pembatas bash TERPISAH dari sumbu persetujuan.
347
+ * Bila true, mode `auto` juga membatasi `bash` ke allow-list
348
+ * (DEFAULT_BASH_ALLOWLIST / MINICODE_BASH_ALLOWLIST) — pola "no-sandbox"
349
+ * (Windows) yang dulu diselipkan sebagai `mode: "allowlist"`. Mode
350
+ * permission tetap `auto`/`ask`; ini hanya lapis kapabilitas bash.
351
+ */
352
+ restrictBash?: boolean
345
353
  } = {},
346
354
  ): PermissionHandler {
347
355
  const state = { mode: (opts.mode ?? "auto") as PermissionMode }
356
+ const restrictBash = opts.restrictBash === true
348
357
  const root = resolve(opts.root ?? cwd())
349
358
  const approvalBindings = opts.approvalBindings
350
359
  const askUser = opts.ask
@@ -555,6 +564,17 @@ export function createPermissionHandler(
555
564
  const cmd = (args?.cmd as string) ?? ""
556
565
  const br = bashDenyReason(cmd)
557
566
  if (br) return deny(call, `bash-guard: ${br}`)
567
+ // restrictBash: bash hanya boleh pola allow-list (fallback no-sandbox).
568
+ if (restrictBash) {
569
+ const matched = bashAllowlist.filter((pat) => matchBashAllowlist(cmd, pat))
570
+ if (matched.length === 0)
571
+ return deny(
572
+ call,
573
+ `allowlist: no matching pattern for "${cmd.slice(0, 80)}" — file work: use read_file/write_file/edit; full shell: rerun with --allow-all / --sandbox docker / MINICODE_BASH_ALLOWLIST`,
574
+ )
575
+ if (matched.some((p) => /^(npx|npm exec|bun x|bun run)\b/i.test(p)) && !npmNpxSafe(cmd))
576
+ return deny(call, "allowlist: npm/npx unsafe")
577
+ }
558
578
  return "allow"
559
579
  }
560
580
  return deny(call, "not authorized in AUTO mode")
@@ -701,6 +721,9 @@ export function createPermissionHandler(
701
721
  __getMode(): PermissionMode {
702
722
  return state.mode
703
723
  },
724
+ __getRestrictBash(): boolean {
725
+ return restrictBash
726
+ },
704
727
  // Seam kernel describeDenial: alasan deny terakhir call ini (dicatat
705
728
  // check() via deny()). Hapus-saat-baca; tak ada catatan = undefined =
706
729
  // pesan deny polos seperti dulu.
@@ -720,6 +743,7 @@ export function createPermissionHandler(
720
743
  return returned as unknown as PermissionHandler & {
721
744
  __setMode(m: PermissionMode): void
722
745
  __getMode(): PermissionMode
746
+ __getRestrictBash(): boolean
723
747
  describeDenial(call: ToolCall): string | undefined
724
748
  __promptGated(call: ToolCall, deps?: unknown): Promise<"allow" | "deny">
725
749
  }
package/src/ui/footer.ts CHANGED
@@ -16,6 +16,8 @@ export type TimerHighlight = "seconds" | "minutes" | "hours"
16
16
  export interface FooterStatus {
17
17
  /** Permission mode efektif sesi ini (umumnya AUTO atau ASK). */
18
18
  mode: string
19
+ /** Bila true, bash dibatasi ke allow-list (lapis kapabilitas, bukan mode). */
20
+ strictBash?: boolean
19
21
  /** WorkMode aktif sesi; identitas internal EXECUTE ditampilkan sebagai Build. */
20
22
  workMode?: string
21
23
  model: string
@@ -97,6 +99,11 @@ export function paintPermissionMode(mode: string, style: ModeLabelStyle = "full"
97
99
  return `${c.gray(prefix)}${c.info(value)}`
98
100
  }
99
101
 
102
+ /** Badge kecil pembatas bash allow-list (lapis kapabilitas, terpisah mode). */
103
+ export function paintBashStrict(strictBash?: boolean): string {
104
+ return strictBash ? c.yellow("bash:strict") : ""
105
+ }
106
+
100
107
  /** Spark glyph: redup saat idle, pulse putih↔abu saat busy (frame genap/ganjil). */
101
108
  function sparkGlyph(frame: number): string {
102
109
  const g = glyphs.thinkingIcon
@@ -173,7 +180,9 @@ export function renderFooter(s: FooterStatus, columns: number): string[] {
173
180
  return `${lead}${paintWorkMode(s.workMode, style)}`
174
181
  }
175
182
  const rightFor = (style: ModeLabelStyle): string =>
176
- [...contextParts, paintPermissionMode(s.mode, style)].join(fieldGap)
183
+ [...contextParts, paintPermissionMode(s.mode, style), paintBashStrict(s.strictBash)]
184
+ .filter(Boolean)
185
+ .join(fieldGap)
177
186
  const align = (left: string, right: string): string | undefined => {
178
187
  const leftWidth = displayWidth(left)
179
188
  const rightWidth = displayWidth(right)
@@ -224,15 +233,16 @@ export function renderFooter(s: FooterStatus, columns: number): string[] {
224
233
  // timer/model/CWD/label sebelum konteks; potong konteks lebih dahulu.
225
234
  const workValue = paintWorkMode(s.workMode, "value")
226
235
  const permissionValue = paintPermissionMode(s.mode, "value")
236
+ const strictValue = paintBashStrict(s.strictBash)
227
237
  const shortWorkValue = workValue.trimEnd()
228
- const modeOnly = `${spark} ${shortWorkValue} ${permissionValue}`
238
+ const modeOnly = `${spark} ${shortWorkValue} ${[permissionValue, strictValue].filter(Boolean).join(" ")}`
229
239
  if (ctx || metrics) {
230
240
  const context = [ctx, metrics].filter(Boolean).join(" ")
231
241
  const baseWidth = displayWidth(modeOnly)
232
242
  const contextBudget = target - baseWidth - 2
233
243
  if (contextBudget > 0) {
234
244
  const shortenedContext = truncateToWidth(context, contextBudget, "…")
235
- const withContext = `${spark} ${shortWorkValue} ${c.gray(shortenedContext)} ${permissionValue}`
245
+ const withContext = `${spark} ${shortWorkValue} ${c.gray(shortenedContext)} ${[permissionValue, strictValue].filter(Boolean).join(" ")}`
236
246
  if (displayWidth(withContext) <= target) return [withContext]
237
247
  }
238
248
  }