minicode-ai 0.26.0 → 0.28.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 +120 -16
- package/cli/commands/acp.ts +38 -28
- package/cli/commands/auth.ts +17 -17
- package/cli/commands/config.ts +65 -66
- package/cli/commands/daemon.ts +44 -16
- package/cli/commands/doctor.ts +11 -12
- package/cli/commands/exec.ts +35 -73
- package/cli/commands/mcp.ts +25 -8
- package/cli/commands/memory.ts +16 -24
- package/cli/commands/openwork.ts +6 -2
- package/cli/commands/pricing.ts +14 -12
- package/cli/commands/providers.ts +36 -57
- package/cli/commands/sessions.ts +24 -18
- package/cli/commands/skills.ts +33 -18
- package/cli/commands/stats.ts +15 -30
- package/cli/commands.ts +96 -46
- package/cli/context-command-run.ts +171 -0
- package/cli/context-command.ts +87 -0
- package/cli/index.ts +96 -98
- package/cli/model-manager.ts +7 -2
- package/cli/provider-manager.ts +33 -18
- package/cli/router.ts +41 -12
- package/cli/setup.ts +246 -123
- package/cli/tui.ts +311 -109
- package/docs/TERMINAL_CONTRACT.md +254 -69
- package/docs/UI_RENDER_PIPELINE.md +9 -1
- package/docs/agents.md +2 -2
- package/docs/architecture.md +3 -3
- package/docs/choosing-mode.md +7 -9
- package/docs/cli.md +3 -5
- package/docs/config.md +16 -0
- package/docs/environment.md +3 -3
- package/docs/policy-sandbox.md +3 -3
- package/docs/repl.md +3 -2
- package/docs/tools.md +1 -1
- package/package.json +1 -1
- package/src/app/mentions.ts +60 -13
- package/src/app/rag-layer.ts +17 -20
- package/src/app/session.ts +119 -66
- package/src/app/tool-layer.ts +12 -17
- package/src/config.ts +64 -104
- package/src/constants.ts +23 -9
- package/src/daemon/capability.ts +8 -1
- package/src/daemon/control.ts +3 -2
- package/src/daemon/server.ts +57 -0
- package/src/hooks/run.ts +73 -41
- package/src/lib/db-path.ts +47 -0
- package/src/lib/process-tree.ts +62 -0
- package/src/lib/public-http.ts +88 -23
- package/src/lib/trusted-exec.ts +48 -1
- package/src/lsp/client.ts +62 -17
- package/src/mcp/client.ts +85 -38
- package/src/mcp/http-transport.ts +28 -16
- package/src/mcp/transport.ts +42 -6
- package/src/memory/files.ts +164 -134
- package/src/memory/vector.ts +371 -420
- package/src/policy/approval-binding.ts +122 -45
- package/src/policy/bash-guard.ts +18 -7
- package/src/policy/compaction.ts +51 -18
- package/src/policy/context-window.ts +109 -0
- package/src/policy/context.ts +78 -37
- package/src/policy/executor.ts +17 -7
- package/src/policy/microcompact.ts +4 -3
- package/src/policy/no-progress.ts +103 -22
- package/src/policy/permission.ts +36 -12
- package/src/policy/tool-contract.ts +74 -416
- package/src/policy/usage.ts +24 -2
- package/src/policy/verifier.ts +50 -2
- package/src/policy/work-mode.ts +28 -54
- package/src/presentation/adapter.ts +24 -16
- package/src/providers/guards.ts +41 -2
- package/src/providers/provision.ts +6 -60
- package/src/providers/responses.ts +1 -0
- package/src/repo/repomap.ts +180 -23
- package/src/runtime/execution-journal.ts +4 -29
- package/src/sandbox/docker.ts +58 -34
- package/src/sandbox/mask.ts +157 -0
- package/src/sandbox/os.ts +107 -73
- package/src/session/authority.ts +29 -10
- package/src/session/context-projection.ts +6 -5
- package/src/session/open-work.ts +26 -3
- package/src/session/persistence.ts +25 -58
- package/src/session/verification.ts +170 -20
- package/src/skills/loader.ts +31 -16
- package/src/task/production-scheduler.ts +13 -1
- package/src/task/store.ts +20 -37
- package/src/telemetry/trace.ts +27 -0
- package/src/tools/ask_user.ts +1 -13
- package/src/tools/bash.ts +27 -92
- package/src/tools/code_run.ts +1 -1
- package/src/tools/context.ts +133 -0
- package/src/tools/delete_file.ts +3 -2
- package/src/tools/edit.ts +37 -72
- package/src/tools/git.ts +86 -9
- package/src/tools/glob.ts +26 -51
- package/src/tools/grep.ts +67 -57
- package/src/tools/hashline.ts +4 -0
- package/src/tools/lsp.ts +11 -8
- package/src/tools/mcp_call.ts +9 -6
- package/src/tools/memory.ts +56 -33
- package/src/tools/move_file.ts +36 -10
- package/src/tools/patch.ts +13 -21
- package/src/tools/read_file.ts +18 -25
- package/src/tools/read_image.ts +35 -33
- package/src/tools/submit_result.ts +29 -8
- package/src/tools/task.ts +74 -17
- package/src/tools/todo.ts +181 -74
- package/src/tools/web_fetch.ts +42 -2
- package/src/tools/web_search.ts +47 -8
- package/src/ui/approval/prompt.ts +206 -47
- package/src/ui/assistant/turn-status.ts +14 -5
- package/src/ui/footer.ts +4 -4
- package/src/ui/i18n/en.ts +59 -23
- package/src/ui/i18n/id.ts +88 -51
- package/src/ui/input/input.ts +4 -3
- package/src/ui/input/prompt-engine.ts +35 -5
- package/src/ui/render/activity-panel.ts +4 -2
- package/src/ui/render/hint.ts +7 -4
- package/src/ui/render/list.ts +32 -0
- package/src/ui/render/markdown.ts +6 -3
- package/src/ui/render/notice.ts +19 -0
- package/src/ui/render/table-grid.ts +7 -8
- package/src/ui/render/theme.ts +113 -39
- package/src/ui/runtime/screen.ts +74 -10
- package/src/ui/runtime/spinner.ts +19 -6
- package/src/ui/screens/dialog.ts +19 -1
- package/src/ui/screens/form.ts +80 -35
- package/src/ui/screens/model-manager.ts +88 -62
- package/src/ui/screens/output-window.ts +263 -0
- package/src/ui/screens/picker.ts +94 -81
- package/src/ui/screens/provider-manager.ts +100 -69
- package/src/ui/screens/wizard.ts +117 -28
- package/src/ui/tui/app.ts +196 -33
- package/src/ui/tui/transcript.ts +154 -25
- package/vendor/minicore/src/core/executor.ts +2 -0
- package/vendor/minicore/src/core/loop.ts +17 -6
- package/vendor/minicore/src/core/session.ts +3 -0
- package/vendor/minicore/src/core/tool.ts +1 -0
- package/vendor/minicore/src/providers/openai-compat.ts +28 -19
package/cli/provider-manager.ts
CHANGED
|
@@ -6,6 +6,8 @@ import { loadConfig, type MinicodeConfig } from "../src/config.ts"
|
|
|
6
6
|
import { GATEWAY_PRESETS } from "../src/providers/presets.ts"
|
|
7
7
|
import { detectAndSave, removeProvider } from "../src/providers/provision.ts"
|
|
8
8
|
import { t } from "../src/ui/i18n/locale.ts"
|
|
9
|
+
import { formatError } from "../src/ui/render/errors.ts"
|
|
10
|
+
import { sanitizeAnsiLine } from "../src/ui/render/sanitize.ts"
|
|
9
11
|
import {
|
|
10
12
|
type ProviderActionResult,
|
|
11
13
|
type ProviderRow,
|
|
@@ -30,13 +32,20 @@ export async function runProviderManager(opts: {
|
|
|
30
32
|
}): Promise<void> {
|
|
31
33
|
if (!process.stdin.isTTY) {
|
|
32
34
|
const cfg = await loadConfig(opts.cwd, { allowLocal: opts.allowLocalConfig })
|
|
33
|
-
for (const p of cfg.providers) console.log(p.id)
|
|
35
|
+
for (const p of cfg.providers) console.log(sanitizeAnsiLine(p.id))
|
|
34
36
|
return
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
const
|
|
39
|
+
// Simpan kegagalan muat-ulang agar ditampilkan sebagai notice di dalam kotak
|
|
40
|
+
// Layer 2 (bukan menulis mentah ke stderr saat popup masih terbuka).
|
|
41
|
+
const reloadSuffix = async (): Promise<string> => {
|
|
42
|
+
try {
|
|
43
|
+
await reloadProviders(opts.cwd, { allowLocal: opts.allowLocalConfig })
|
|
44
|
+
return ""
|
|
45
|
+
} catch {
|
|
46
|
+
return ` (${t("prov.reloadFail")})`
|
|
47
|
+
}
|
|
48
|
+
}
|
|
40
49
|
|
|
41
50
|
await runProviderManagerView({
|
|
42
51
|
initialRows: rowsFrom(await loadConfig(opts.cwd, { allowLocal: opts.allowLocalConfig })),
|
|
@@ -60,19 +69,20 @@ export async function runProviderManager(opts: {
|
|
|
60
69
|
fallbackModels,
|
|
61
70
|
allowLocal: opts.allowLocalConfig,
|
|
62
71
|
})
|
|
63
|
-
|
|
72
|
+
const warn = await reloadSuffix()
|
|
64
73
|
return {
|
|
65
|
-
ok: t("ntc.saved", { id: entry.id, n: entry.models.length, scope })
|
|
74
|
+
ok: `${t("ntc.saved", { id: entry.id, n: entry.models.length, scope })}${warn}`,
|
|
66
75
|
}
|
|
67
76
|
} catch (e) {
|
|
68
|
-
return { err: t("prov.detectFail", { msg: (e
|
|
77
|
+
return { err: t("prov.detectFail", { msg: formatError(e) }) }
|
|
69
78
|
}
|
|
70
79
|
},
|
|
71
80
|
onDelete: async (row): Promise<ProviderActionResult> => {
|
|
72
81
|
await removeProvider(row.id, { global: true })
|
|
73
|
-
if (opts.cwd
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
if (opts.cwd && opts.allowLocalConfig)
|
|
83
|
+
await removeProvider(row.id, { global: false, cwd: opts.cwd })
|
|
84
|
+
const warn = await reloadSuffix()
|
|
85
|
+
return { ok: `${t("prov.deleted", { id: row.id })}${warn}` }
|
|
76
86
|
},
|
|
77
87
|
onEditDefaults: async (row) => {
|
|
78
88
|
const cfg = await loadConfig(opts.cwd, { allowLocal: opts.allowLocalConfig })
|
|
@@ -84,25 +94,30 @@ export async function runProviderManager(opts: {
|
|
|
84
94
|
const cfg = await loadConfig(opts.cwd, { allowLocal: opts.allowLocalConfig })
|
|
85
95
|
const cur = cfg.providers.find((p) => p.id === row.id)
|
|
86
96
|
if (!cur) return { err: t("ntc.notFound") }
|
|
97
|
+
const inGlobal = (await loadConfig(undefined, { allowLocal: false })).providers.some(
|
|
98
|
+
(p) => p.id === row.id,
|
|
99
|
+
)
|
|
100
|
+
const saveGlobal = inGlobal || !opts.allowLocalConfig || !opts.cwd
|
|
87
101
|
try {
|
|
88
|
-
await removeProvider(row.id, { global: true })
|
|
89
|
-
if (opts.cwd
|
|
102
|
+
if (inGlobal) await removeProvider(row.id, { global: true })
|
|
103
|
+
if (opts.cwd && opts.allowLocalConfig)
|
|
104
|
+
await removeProvider(row.id, { global: false, cwd: opts.cwd })
|
|
90
105
|
const entry = await detectAndSave(baseUrl, apiKey, row.id, {
|
|
91
|
-
global:
|
|
106
|
+
global: saveGlobal,
|
|
92
107
|
cwd: opts.cwd,
|
|
93
108
|
fallbackModels: cur.models,
|
|
94
109
|
allowLocal: opts.allowLocalConfig,
|
|
95
110
|
})
|
|
96
|
-
|
|
97
|
-
return { ok: t("ntc.updated", { id: entry.id, n: entry.models.length }) }
|
|
111
|
+
const warn = await reloadSuffix()
|
|
112
|
+
return { ok: `${t("ntc.updated", { id: entry.id, n: entry.models.length })}${warn}` }
|
|
98
113
|
} catch (e) {
|
|
99
114
|
await detectAndSave(cur.baseUrl, cur.apiKey, cur.id, {
|
|
100
|
-
global:
|
|
115
|
+
global: saveGlobal,
|
|
101
116
|
cwd: opts.cwd,
|
|
102
117
|
fallbackModels: cur.models,
|
|
103
118
|
}).catch(() => {})
|
|
104
|
-
|
|
105
|
-
return { err: t("prov.updateFail", { msg: (e
|
|
119
|
+
const warn = await reloadSuffix()
|
|
120
|
+
return { err: `${t("prov.updateFail", { msg: formatError(e) })}${warn}` }
|
|
106
121
|
}
|
|
107
122
|
},
|
|
108
123
|
})
|
package/cli/router.ts
CHANGED
|
@@ -60,6 +60,10 @@ export async function dispatch(
|
|
|
60
60
|
if (a === undefined) continue
|
|
61
61
|
if (a === "--") break
|
|
62
62
|
if (a === name) {
|
|
63
|
+
if (!valueFlags.has(name)) {
|
|
64
|
+
found = "1"
|
|
65
|
+
continue
|
|
66
|
+
}
|
|
63
67
|
const v = subArgv[i + 1]
|
|
64
68
|
if (v !== undefined && (v === "-" || !v.startsWith("-") || /^-?\d+(\.\d+)?$/.test(v)))
|
|
65
69
|
found = v
|
|
@@ -71,19 +75,44 @@ export async function dispatch(
|
|
|
71
75
|
return found
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
// P11.x
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
// P11.x + CMD-03: pisahkan positional pasca-subcommand ke indeks 1..N sebelum
|
|
79
|
+
// flag global & pasca-subcommand agar flag mendahului subcommand tetap terbaca.
|
|
80
|
+
const postPositionals: string[] = []
|
|
81
|
+
const postFlags: string[] = []
|
|
82
|
+
for (let i = cmdIndex + 1; i < args.length; i++) {
|
|
83
|
+
const t = args[i]
|
|
84
|
+
if (t === undefined) continue
|
|
85
|
+
if (t === "--") {
|
|
86
|
+
postPositionals.push(...args.slice(i + 1))
|
|
87
|
+
break
|
|
88
|
+
}
|
|
89
|
+
const flag = flagNameOf(t)
|
|
90
|
+
if (flag) {
|
|
91
|
+
postFlags.push(t)
|
|
92
|
+
if (valueFlags.has(flag) && !t.includes("=") && i + 1 < args.length) {
|
|
93
|
+
const v = args[i + 1]
|
|
94
|
+
if (v !== undefined) {
|
|
95
|
+
postFlags.push(v)
|
|
96
|
+
i++
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
continue
|
|
100
|
+
}
|
|
101
|
+
if (t.startsWith("-")) {
|
|
102
|
+
postFlags.push(t)
|
|
103
|
+
continue
|
|
104
|
+
}
|
|
105
|
+
postPositionals.push(t)
|
|
106
|
+
}
|
|
107
|
+
const scoped = [
|
|
108
|
+
args[cmdIndex]!,
|
|
109
|
+
...postPositionals,
|
|
110
|
+
...subArgv.slice(0, cmdTokenPos),
|
|
111
|
+
...postFlags,
|
|
112
|
+
]
|
|
84
113
|
if (cmd === "stats") {
|
|
85
114
|
const { handleStats } = await import("./commands/stats.ts")
|
|
86
|
-
await handleStats(subGetArg)
|
|
115
|
+
await handleStats(subGetArg, scoped)
|
|
87
116
|
return true
|
|
88
117
|
}
|
|
89
118
|
if (cmd === "sessions") {
|
|
@@ -145,7 +174,7 @@ export async function dispatch(
|
|
|
145
174
|
// Fase 5: server JSON-RPC stdio minimal untuk IDE (subset, bukan ACP penuh).
|
|
146
175
|
// Handler memblokir sampai stdin EOF/shutdown; tak ada sesi CLI yang dibuat.
|
|
147
176
|
const { handleAcp } = await import("./commands/acp.ts")
|
|
148
|
-
await handleAcp()
|
|
177
|
+
await handleAcp(scoped)
|
|
149
178
|
return true
|
|
150
179
|
}
|
|
151
180
|
if (cmd === "daemon") {
|