minicode-ai 0.15.0 → 0.21.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 +6 -4
- package/cli/auto-update.ts +24 -15
- package/cli/commands/exec.ts +3 -2
- package/cli/commands/openwork.ts +1 -1
- package/cli/commands.ts +6 -6
- package/cli/index.ts +61 -22
- package/cli/model-manager.ts +1 -1
- package/cli/setup.ts +119 -62
- package/cli/tui.ts +128 -13
- package/docs/CONTROL-PLANE-MAP.md +6 -4
- package/docs/OUTPUT_EVENT_MODEL.md +4 -3
- package/docs/OUTPUT_PROTOCOL_SPEC.md +1 -1
- package/docs/OUTPUT_RENDERING_SPEC.md +16 -4
- package/docs/OUTPUT_UX_RULES.md +38 -32
- package/docs/P14_OPEN_WORK.md +290 -0
- package/docs/README.md +1 -1
- package/docs/SUMMARY.md +36 -22
- package/docs/TERMINAL_CONTRACT.md +74 -11
- package/docs/UI_RENDER_PIPELINE.md +53 -11
- package/docs/agents.md +1 -1
- package/docs/architecture.md +9 -8
- package/docs/autonomous-scheduler.md +142 -0
- package/docs/choosing-mode.md +2 -2
- package/docs/cli.md +4 -4
- package/docs/concepts.md +5 -5
- package/docs/config-providers.md +3 -3
- package/docs/contributing.md +7 -9
- package/docs/environment.md +6 -4
- package/docs/getting-started.md +4 -4
- package/docs/mcp-lsp.md +2 -2
- package/docs/memory-sessions.md +1 -1
- package/docs/policy-sandbox.md +7 -4
- package/docs/pricing-budget.md +3 -3
- package/docs/quickstart.md +1 -1
- package/docs/repl.md +5 -5
- package/docs/security-model.md +1 -1
- package/docs/security.md +9 -8
- package/docs/skills.md +2 -2
- package/docs/terminal.md +10 -2
- package/docs/tools.md +4 -4
- package/docs/troubleshooting.md +3 -3
- package/docs/verify-benchmark.md +0 -3
- package/package.json +9 -18
- package/src/app/session.ts +40 -7
- package/src/constants.ts +31 -0
- package/src/hooks/run.ts +5 -6
- package/src/mcp/http-transport.ts +1 -1
- package/src/policy/bash-guard.ts +26 -6
- package/src/policy/compaction.ts +107 -17
- package/src/policy/consequence-engine.ts +3 -3
- package/src/policy/context-window.ts +24 -1
- package/src/policy/context.ts +16 -4
- package/src/policy/permission.ts +219 -4
- package/src/policy/update-check.ts +6 -4
- package/src/presentation/adapter.ts +1 -1
- package/src/presentation/events.ts +2 -2
- package/src/presentation/label.ts +3 -3
- package/src/presentation/model.ts +4 -0
- package/src/presentation/store.ts +2 -2
- package/src/runtime/child-execution.ts +1 -1
- package/src/runtime/composition.ts +5 -5
- package/src/runtime/execution-registry.ts +1 -1
- package/src/runtime/production-execution.ts +3 -3
- package/src/runtime/production-runtime.ts +2 -2
- package/src/runtime/runtime-capabilities.ts +1 -1
- package/src/runtime/runtime-status-facts.ts +1 -1
- package/src/runtime/runtime-task-admission.ts +2 -2
- package/src/session/context-assembly.ts +8 -1
- package/src/session/context-identity.ts +2 -2
- package/src/session/context-projection.ts +36 -11
- package/src/session/persistence.ts +1 -1
- package/src/task/autonomous-context.ts +2 -2
- package/src/task/autonomous-policy.ts +3 -3
- package/src/task/model.ts +2 -2
- package/src/task/production-scheduler.ts +2 -2
- package/src/task/scheduler.ts +3 -2
- package/src/task/scheduling-policy.ts +2 -1
- package/src/task/trigger.ts +5 -5
- package/src/tools/read_image.ts +2 -1
- package/src/tools/task.ts +1 -1
- package/src/ui/assistant/simple.ts +47 -30
- package/src/ui/footer.ts +48 -9
- package/src/ui/i18n/en.ts +21 -0
- package/src/ui/i18n/id.ts +21 -0
- package/src/ui/input/prompt-engine.ts +36 -10
- package/src/ui/render/activity-group.ts +53 -0
- package/src/ui/render/activity-panel.ts +91 -0
- package/src/ui/render/cells.ts +347 -0
- package/src/ui/render/composer-wrap.ts +73 -0
- package/src/ui/render/detail.ts +2 -2
- package/src/ui/render/diff.ts +7 -0
- package/src/ui/render/ledger.ts +47 -0
- package/src/ui/render/markdown.ts +6 -1
- package/src/ui/render/session-summary.ts +7 -2
- package/src/ui/render/theme.ts +40 -4
- package/src/ui/render/width.ts +2 -2
- package/src/ui/render/wrap.ts +5 -3
- package/src/ui/runtime/loading-bar.ts +125 -0
- package/src/ui/runtime/screen.ts +84 -7
- package/src/ui/runtime/statusline.ts +26 -0
- package/src/ui/screens/model-manager.ts +1 -1
- package/src/ui/session-state.ts +22 -0
- package/src/ui/tui/app.ts +336 -65
- package/src/ui/tui/transcript.ts +407 -106
- package/vendor/minicore/VENDOR.md +15 -11
- package/vendor/minicore/src/core/events.ts +1 -0
- package/vendor/minicore/src/core/loop.ts +10 -0
- package/vendor/minicore/src/core/session.ts +39 -0
package/src/policy/compaction.ts
CHANGED
|
@@ -18,6 +18,30 @@ export function parseCompactKeepTurns(raw: string | undefined): number | undefin
|
|
|
18
18
|
return Number.isInteger(n) && n >= 1 ? n : undefined
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
// R9/T5 — tool "pembawa fakta": hasilnya (isi file, match grep, output
|
|
22
|
+
// bash/test, hasil fetch/web) adalah FAKTA yang harus dipertahankan sebaik
|
|
23
|
+
// mungkin saat kompaksi. Prosa dan tool lain tetap dipangkas pendek untuk
|
|
24
|
+
// hemat token. Head fakta jauh lebih panjang (800 char) daripada prosa
|
|
25
|
+
// (~250 char) karena kehilangan satu baris match grep / satu baris output test
|
|
26
|
+
// saja dapat merusak kesimpulan audit model setelah ringkasan dipakai lagi.
|
|
27
|
+
const FACT_TOOLS = new Set([
|
|
28
|
+
"read_file",
|
|
29
|
+
"grep",
|
|
30
|
+
"glob",
|
|
31
|
+
"bash",
|
|
32
|
+
"bash_output",
|
|
33
|
+
"code_run",
|
|
34
|
+
"web_fetch",
|
|
35
|
+
"web_search",
|
|
36
|
+
])
|
|
37
|
+
const FACT_HEAD_CHARS = 800
|
|
38
|
+
|
|
39
|
+
/** Panjang head saat memangkas baris kompaksi per-peran: hasil tool pembawa
|
|
40
|
+
* fakta dapat head panjang; selain itu pakai `fallback` (prosa pendek). */
|
|
41
|
+
function toolHeadLen(name: string | null | undefined, fallback: number): number {
|
|
42
|
+
return name != null && FACT_TOOLS.has(name) ? FACT_HEAD_CHARS : fallback
|
|
43
|
+
}
|
|
44
|
+
|
|
21
45
|
export interface LlmCompactionOptions {
|
|
22
46
|
provider?: ModelProvider
|
|
23
47
|
model?: string // deepseek v4 flash
|
|
@@ -90,8 +114,12 @@ function boundedMechanical(
|
|
|
90
114
|
* omitted>`), memakai `getKeptCount` + `mechanicalLine` yang sama — supaya
|
|
91
115
|
* fallback (saat LLM tak tersedia/thrash) tidak menghapus fakta yang justru
|
|
92
116
|
* dibutuhkan untuk audit. Tetap dibatasi `boundSummary`/`fitSummaryToTokenBudget`.
|
|
117
|
+
*
|
|
118
|
+
* Diekspor (R10/A) supaya produsen proyeksi durable (`context-projection.ts`)
|
|
119
|
+
* memakai folder yang MEMPERTAHANKAN hasil tool — bukan folder kernel
|
|
120
|
+
* `mechanicalCompaction` yang menulis `<result omitted>` dan membuang fakta.
|
|
93
121
|
*/
|
|
94
|
-
function mechanicalKeepResults(
|
|
122
|
+
export function mechanicalKeepResults(
|
|
95
123
|
store: ContextStore,
|
|
96
124
|
keepRecentTurns: number,
|
|
97
125
|
): readonly import("#minicore/core/types.ts").Message[] {
|
|
@@ -156,7 +184,7 @@ function mechanicalLine(message: import("#minicore/core/types.ts").Message): str
|
|
|
156
184
|
}
|
|
157
185
|
if (message.role === "tool") {
|
|
158
186
|
const result = toolContentText(message.content)
|
|
159
|
-
return `- tool(${message.name})${message.isError ? " ERROR" : ""}: ${headText(result, 260)}`
|
|
187
|
+
return `- tool(${message.name})${message.isError ? " ERROR" : ""}: ${headText(result, toolHeadLen(message.name, 260))}`
|
|
160
188
|
}
|
|
161
189
|
return `- ${message.role}: ${headText(contentToText(message.content), 180)}`
|
|
162
190
|
}
|
|
@@ -268,7 +296,7 @@ export function createLlmCompaction(opts: LlmCompactionOptions = {}): Compaction
|
|
|
268
296
|
const limit = opts.getContextWindowTokens?.()
|
|
269
297
|
const target =
|
|
270
298
|
Number.isSafeInteger(limit) && (limit as number) > 0
|
|
271
|
-
? Math.floor((limit as number) *
|
|
299
|
+
? Math.floor((limit as number) * LIMITS.COMPACTION_SUMMARY_TARGET_RATIO)
|
|
272
300
|
: undefined
|
|
273
301
|
return boundedMechanical(store, cOpts.keepRecentTurns, target)
|
|
274
302
|
},
|
|
@@ -276,7 +304,7 @@ export function createLlmCompaction(opts: LlmCompactionOptions = {}): Compaction
|
|
|
276
304
|
const targetTokens = () => {
|
|
277
305
|
const limit = opts.getContextWindowTokens?.()
|
|
278
306
|
return Number.isSafeInteger(limit) && (limit as number) > 0
|
|
279
|
-
? Math.floor((limit as number) *
|
|
307
|
+
? Math.floor((limit as number) * LIMITS.COMPACTION_SUMMARY_TARGET_RATIO)
|
|
280
308
|
: undefined
|
|
281
309
|
}
|
|
282
310
|
// F3.1 anti-thrash (state per strategi = per sesi, karena strategy dibuat
|
|
@@ -306,7 +334,7 @@ export function createLlmCompaction(opts: LlmCompactionOptions = {}): Compaction
|
|
|
306
334
|
// Jalur LLM sudah dinyatakan thrash sesi-ini: lempar agar loop memakai
|
|
307
335
|
// mekanikal sinkron (bukan diam, bukan retry LLM).
|
|
308
336
|
if (llmDisabled) throw new Error("llm compaction disabled after thrash")
|
|
309
|
-
// cap
|
|
337
|
+
// cap 10s — jangan biarkan LLM summary memblokir loop terlalu lama;
|
|
310
338
|
// kalau gagal/timeout, loop otomatis fallback ke compact() sinkron.
|
|
311
339
|
const ac = new AbortController()
|
|
312
340
|
const timer = setTimeout(
|
|
@@ -338,6 +366,8 @@ export function createLlmCompaction(opts: LlmCompactionOptions = {}): Compaction
|
|
|
338
366
|
? Math.min(configured!, target)
|
|
339
367
|
: target
|
|
340
368
|
})(),
|
|
369
|
+
maxSummaryChars: summaryCharBudgetForWindow(opts.getContextWindowTokens?.()),
|
|
370
|
+
maxInputChars: summaryInputCharBudget(opts.getContextWindowTokens?.()),
|
|
341
371
|
...(opts.onUsage ? { onUsage: opts.onUsage } : {}),
|
|
342
372
|
},
|
|
343
373
|
ac.signal,
|
|
@@ -411,6 +441,41 @@ const SUMMARY_HEADER =
|
|
|
411
441
|
const SUMMARY_ELISION =
|
|
412
442
|
"[older context omitted from the active prompt; ask again for details that are missing]\n"
|
|
413
443
|
|
|
444
|
+
/**
|
|
445
|
+
* R9 — pagu ringkasan kompaksi LLM mengikuti ukuran jendela, bukan 4k char
|
|
446
|
+
* konstan. Model berjendela raksasa (1M token) diberi ruang ringkasan lebih
|
|
447
|
+
* kaya (hingga `COMPACTION_SUMMARY_SCALED_MAX_CHARS`) supaya fakta lama tak
|
|
448
|
+
* over-discard; model kecil tetap hemat di lantai `COMPACTION_SUMMARY_MAX_CHARS`.
|
|
449
|
+
* Formula kasar: ~1 char per 25 token jendela, diklem [min, max]. Nilai non-
|
|
450
|
+
* positif/tak-terdefinisi → lantai (perilaku lama persis).
|
|
451
|
+
*/
|
|
452
|
+
export function summaryCharBudgetForWindow(windowTokens: number | undefined): number {
|
|
453
|
+
const min = LIMITS.COMPACTION_SUMMARY_MAX_CHARS
|
|
454
|
+
const max = LIMITS.COMPACTION_SUMMARY_SCALED_MAX_CHARS
|
|
455
|
+
if (windowTokens === undefined || !Number.isSafeInteger(windowTokens) || windowTokens <= 0) {
|
|
456
|
+
return min
|
|
457
|
+
}
|
|
458
|
+
const scaled = Math.floor(windowTokens / 25)
|
|
459
|
+
return Math.min(max, Math.max(min, scaled))
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* R10/B — pagu INPUT summarizer kompaksi LLM (`scrubbedPrefix`), mengikuti
|
|
464
|
+
* jendela. Input harus SELALU ≥ output (`summaryCharBudgetForWindow`) agar
|
|
465
|
+
* summarizer membaca lebih banyak daripada yang diminta dihasilkan. Formula
|
|
466
|
+
* kasar: ~1 char per 8 token jendela, diklem [6k, 48k]. Nilai non-positif/
|
|
467
|
+
* tak-terdefinisi → lantai (perilaku lama 6k char persis).
|
|
468
|
+
*/
|
|
469
|
+
export function summaryInputCharBudget(windowTokens: number | undefined): number {
|
|
470
|
+
const min = LIMITS.COMPACTION_LLM_INPUT_MIN_CHARS
|
|
471
|
+
const max = LIMITS.COMPACTION_LLM_INPUT_SCALED_MAX_CHARS
|
|
472
|
+
if (windowTokens === undefined || !Number.isSafeInteger(windowTokens) || windowTokens <= 0) {
|
|
473
|
+
return min
|
|
474
|
+
}
|
|
475
|
+
const scaled = Math.floor(windowTokens / 8)
|
|
476
|
+
return Math.min(max, Math.max(min, scaled))
|
|
477
|
+
}
|
|
478
|
+
|
|
414
479
|
/**
|
|
415
480
|
* Pagu keras untuk pesan ringkasan gabungan (P0 long-horizon).
|
|
416
481
|
*
|
|
@@ -439,8 +504,12 @@ const SUMMARY_ELISION =
|
|
|
439
504
|
* melalui `compactWithLlm` (tiap panggilan melakukan dynamic import sehingga
|
|
440
505
|
* menembus batas 5 dtk per test).
|
|
441
506
|
*/
|
|
442
|
-
export function composeBoundedSummary(
|
|
443
|
-
|
|
507
|
+
export function composeBoundedSummary(
|
|
508
|
+
priorText: string,
|
|
509
|
+
fresh: string,
|
|
510
|
+
maxChars: number = LIMITS.COMPACTION_SUMMARY_MAX_CHARS,
|
|
511
|
+
): string {
|
|
512
|
+
const cap = maxChars > 0 ? Math.floor(maxChars) : LIMITS.COMPACTION_SUMMARY_MAX_CHARS
|
|
444
513
|
// `String.slice` memotong per code unit UTF-16, jadi bisa memelah surrogate
|
|
445
514
|
// pair dan menyisakan surrogate TUNGGAL. Itu bukan sekadar kosmetik: teks
|
|
446
515
|
// summary dikirim ke provider sebagai JSON, dan lone surrogate bisa
|
|
@@ -481,6 +550,13 @@ export async function compactWithLlm(
|
|
|
481
550
|
opts: {
|
|
482
551
|
keepRecentTurns: number
|
|
483
552
|
maxSummaryTokens?: number
|
|
553
|
+
/** R9 — pagu karakter ringkasan LLM (hasil `summaryCharBudgetForWindow`).
|
|
554
|
+
* Bila absen, pakai `COMPACTION_SUMMARY_MAX_CHARS` (perilaku lama). */
|
|
555
|
+
maxSummaryChars?: number
|
|
556
|
+
/** R10/B — pagu karakter INPUT prefix summarizer (hasil
|
|
557
|
+
* `summaryInputCharBudget`). Bila absen, pakai lantai 6k char (perilaku
|
|
558
|
+
* lama). */
|
|
559
|
+
maxInputChars?: number
|
|
484
560
|
provider?: ModelProvider
|
|
485
561
|
model?: string
|
|
486
562
|
baseUrl?: string
|
|
@@ -546,9 +622,12 @@ export async function compactWithLlm(
|
|
|
546
622
|
|
|
547
623
|
// use safe head like mechanical: content truncated, tool results included
|
|
548
624
|
// seperlunya — hasil tool SUKSES adalah sumber fakta (isi file, output
|
|
549
|
-
// grep/bash, verifikasi). Do not buang: head
|
|
625
|
+
// grep/bash, verifikasi). Do not buang: head 800 chars untuk tool pembawa
|
|
626
|
+
// fakta, 250 untuk sisanya (lihat FACT_HEAD_CHARS/toolHeadLen).
|
|
550
627
|
const head = (s: string, n: number) => (s.length <= n ? s : `${s.slice(0, n)}…`)
|
|
551
|
-
// Tuned 250/
|
|
628
|
+
// Tuned 250 (prosa/sisanya) / 800 (tool pembawa fakta) vs 400 — still factual. Hasil tool
|
|
629
|
+
// pembawa fakta (grep/bash/read/test/…) memakai head panjang (toolHeadLen)
|
|
630
|
+
// agar match/output penting tak terbuang saat ringkasan LLM dibentuk.
|
|
552
631
|
const lineFor = (m: import("#minicore/core/types.ts").Message): string => {
|
|
553
632
|
if (m.role === "user") return `- user: ${head(contentToText(m.content), 250)}`
|
|
554
633
|
if (m.role === "assistant") {
|
|
@@ -557,16 +636,22 @@ export async function compactWithLlm(
|
|
|
557
636
|
.join(", ")
|
|
558
637
|
return `- assistant${calls ? ` [${calls}]` : ""}: ${head(contentToText(m.content), 250)}`
|
|
559
638
|
}
|
|
560
|
-
if (m.isError)
|
|
639
|
+
if (m.isError)
|
|
640
|
+
return `- tool(${m.name}) ERROR: ${head(String(m.content), toolHeadLen(m.name, 250))}`
|
|
561
641
|
const raw =
|
|
562
642
|
typeof m.content === "string"
|
|
563
643
|
? m.content
|
|
564
644
|
: Array.isArray(m.content)
|
|
565
645
|
? contentToText(m.content)
|
|
566
646
|
: ""
|
|
567
|
-
return `- tool(${m.name}): ${head(raw, 250)}`
|
|
647
|
+
return `- tool(${m.name}): ${head(raw, toolHeadLen(m.name, 250))}`
|
|
568
648
|
}
|
|
569
|
-
const scrubbedPrefix = scrubSecrets(
|
|
649
|
+
const scrubbedPrefix = scrubSecrets(
|
|
650
|
+
prefix
|
|
651
|
+
.map(lineFor)
|
|
652
|
+
.join("\n")
|
|
653
|
+
.slice(0, opts.maxInputChars ?? LIMITS.COMPACTION_LLM_INPUT_MIN_CHARS),
|
|
654
|
+
)
|
|
570
655
|
// Guard anti-injeksi (temuan audit #02): prefix berisi output tool/web/repo
|
|
571
656
|
// tak-terpercaya yang bisa memuat "abaikan instruksi". Tanpa pagar, payload
|
|
572
657
|
// itu masuk ringkasan lalu bertahan melewati compaction (prompt injection
|
|
@@ -577,7 +662,7 @@ export async function compactWithLlm(
|
|
|
577
662
|
// token terbuang tanpa manfaat. Estimasi kasar 4 char/token (konservatif).
|
|
578
663
|
const summaryBudgetChars = Math.max(
|
|
579
664
|
200,
|
|
580
|
-
LIMITS.COMPACTION_SUMMARY_MAX_CHARS - SUMMARY_HEADER.length,
|
|
665
|
+
(opts.maxSummaryChars ?? LIMITS.COMPACTION_SUMMARY_MAX_CHARS) - SUMMARY_HEADER.length,
|
|
581
666
|
)
|
|
582
667
|
const summaryBudgetTokens = Math.min(
|
|
583
668
|
Math.floor(summaryBudgetChars / 4),
|
|
@@ -657,7 +742,7 @@ export async function compactWithLlm(
|
|
|
657
742
|
}
|
|
658
743
|
const lruSummary = {
|
|
659
744
|
role: "user" as const,
|
|
660
|
-
content: composeBoundedSummary("", summary),
|
|
745
|
+
content: composeBoundedSummary("", summary, opts.maxSummaryChars),
|
|
661
746
|
}
|
|
662
747
|
// P13 S1 — persist summary ke vector (opt-out via MINICODE_AUTO_MEMORY=0).
|
|
663
748
|
// cwd diteruskan eksplisit: tanpa ini summary mendarat di DB global/sembarang
|
|
@@ -665,8 +750,13 @@ export async function compactWithLlm(
|
|
|
665
750
|
if (process.env.MINICODE_AUTO_MEMORY !== "0") {
|
|
666
751
|
try {
|
|
667
752
|
const { addMemory } = await import("../memory/vector.ts")
|
|
668
|
-
// fire-and-forget, jangan gagalkan compaction bila embedding gagal
|
|
669
|
-
|
|
753
|
+
// fire-and-forget, jangan gagalkan compaction bila embedding gagal.
|
|
754
|
+
// safeHead (bukan slice) supaya potongan tak meninggalkan lone high
|
|
755
|
+
// surrogate di ekornya (kalau titik batas memecah pasangan surrogate,
|
|
756
|
+
// string bisa gagal serialisasi/gagal embedding).
|
|
757
|
+
void addMemory(safeHead(summary, 1200), { category: "summary", cwd: opts.cwd }).catch(
|
|
758
|
+
() => {},
|
|
759
|
+
)
|
|
670
760
|
} catch {}
|
|
671
761
|
}
|
|
672
762
|
// Bila ada prior (summary dari kompaksi sebelumnya), gabungkan isi prior dan
|
|
@@ -677,7 +767,7 @@ export async function compactWithLlm(
|
|
|
677
767
|
const priorText = typeof prior[0]!.content === "string" ? prior[0]!.content : ""
|
|
678
768
|
const combined = {
|
|
679
769
|
role: "user" as const,
|
|
680
|
-
content: composeBoundedSummary(priorText, summary),
|
|
770
|
+
content: composeBoundedSummary(priorText, summary, opts.maxSummaryChars),
|
|
681
771
|
}
|
|
682
772
|
return [combined, ...keptTail]
|
|
683
773
|
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
// berikutnya. Modul ini PURE dan deterministik: tanpa I/O, tanpa clock, tanpa
|
|
6
6
|
// jaringan — masukan yang sama selalu menghasilkan keputusan yang sama.
|
|
7
7
|
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
8
|
+
// Modul ini PURE (tanpa IO/clock/network) dan hanya impor tipe Node +
|
|
9
|
+
// `./tool-contract.ts`. Karena itu tipe ACE diimpor oleh session/runtime-header.ts
|
|
10
|
+
// dan composition root, bukan sebaliknya.
|
|
11
11
|
//
|
|
12
12
|
// [ACE-INV-01] HARD CONSTRAINT: percobaan manipulasi evaluator SELALU
|
|
13
13
|
// mengalahkan metrik lain. Tidak ada kombinasi input yang boleh mengubah
|
|
@@ -5,7 +5,15 @@ import { contextWindowsCachePath } from "./pricing.ts"
|
|
|
5
5
|
|
|
6
6
|
/** App fallback for providers that do not publish model metadata.
|
|
7
7
|
* Operators can set an exact `ProviderEntry.contextWindows` value or use the
|
|
8
|
-
* explicit `--context-window` override when a gateway exposes aliases.
|
|
8
|
+
* explicit `--context-window` override when a gateway exposes aliases.
|
|
9
|
+
*
|
|
10
|
+
* SENGAJA beda dari `DEFAULT_ALIAS_CONTEXT_WINDOW_TOKENS` (128K): ini adalah
|
|
11
|
+
* batas-bawah aman untuk model yang BENAR-BENAR tak dikenal (nilai minimal yang
|
|
12
|
+
* didukung hampir semua model), sedangkan default alias router memilih 128K
|
|
13
|
+
* karena model aslinya pasti model besar — hanya identitasnya yang disembunyikan
|
|
14
|
+
* oleh alias `auto`/`best`. Menyatukan keduanya ke satu nilai akan membuat
|
|
15
|
+
* salah satu sisi salah arah: 32K → alias dikompaksi prematur; 128K → model
|
|
16
|
+
* belum-tentu-mendukung melampaui jendela. */
|
|
9
17
|
export const DEFAULT_FALLBACK_CONTEXT_WINDOW_TOKENS = 32_000
|
|
10
18
|
|
|
11
19
|
// Alias router (`auto`/`best`/...) model aslinya tak diketahui dari config.
|
|
@@ -26,6 +34,11 @@ export interface ContextWindowResolution {
|
|
|
26
34
|
| "safe-default"
|
|
27
35
|
readonly model?: string
|
|
28
36
|
readonly providerId?: string
|
|
37
|
+
/** R9/T8 — hadir bila katalog built-in dan overlay models.dev saling beda
|
|
38
|
+
* >2× (katalog mungkin ketinggalan zaman). Murni diagnostik: pemanggil boleh
|
|
39
|
+
* memperingatkan user; resolusi TETAP pakai katalog (over-estimate ditoleransi
|
|
40
|
+
* lewat jalur recovery). */
|
|
41
|
+
readonly drift?: { catalogTokens: number; overlayTokens: number }
|
|
29
42
|
}
|
|
30
43
|
|
|
31
44
|
function validWindow(value: unknown): value is number {
|
|
@@ -149,11 +162,21 @@ export function resolveContextWindow(
|
|
|
149
162
|
if (modelId) {
|
|
150
163
|
const catalogTokens = findContextWindowFromCatalog(modelId)
|
|
151
164
|
if (validWindow(catalogTokens)) {
|
|
165
|
+
// R9/T8 — katalog diutamakan (kurasi manual) tapi bisa basi. Bila overlay
|
|
166
|
+
// models.dev (cache dari `pricing sync`) punya nilai > 2× beda, tandai
|
|
167
|
+
// drift supaya setup memperingatkan user — resolusi tetap katalog (aman:
|
|
168
|
+
// over-estimate turun anggun via compact-and-retry).
|
|
169
|
+
const overlayTokens = findContextWindowFromOverlay(modelId)
|
|
170
|
+
const drift =
|
|
171
|
+
validWindow(overlayTokens) && catalogTokens > 0
|
|
172
|
+
? Math.max(overlayTokens / catalogTokens, catalogTokens / overlayTokens)
|
|
173
|
+
: 0
|
|
152
174
|
return {
|
|
153
175
|
tokens: catalogTokens,
|
|
154
176
|
source: "catalog",
|
|
155
177
|
...(modelId ? { model: modelId } : {}),
|
|
156
178
|
...(providerId ? { providerId } : {}),
|
|
179
|
+
...(drift > 2 ? { drift: { catalogTokens, overlayTokens: overlayTokens as number } } : {}),
|
|
157
180
|
}
|
|
158
181
|
}
|
|
159
182
|
}
|
package/src/policy/context.ts
CHANGED
|
@@ -95,7 +95,11 @@ export const minicodeEstimator: TokenEstimator = (text: string) => {
|
|
|
95
95
|
return Math.ceil(len / cpt + dense * 0.75)
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
// helper for image content: base64 overhead 4/3 — use when estimating tool image results
|
|
98
|
+
// helper for image content: base64 overhead 4/3 — use when estimating tool image results.
|
|
99
|
+
// CATATAN (R9/T10): ini BATAS BAWAH. Model vision asli menghitung token per-tile
|
|
100
|
+
// (patch), bukan chars/4 atas base64 — akurasi penuh butuh tokenizer gambar
|
|
101
|
+
// per-model. Cukup untuk admission kasus gambar langka; jangan dipakai sebagai
|
|
102
|
+
// angka presisi biaya/kompaksi gambar.
|
|
99
103
|
export function estimateImageTokens(bytes: number): number {
|
|
100
104
|
const b64 = Math.ceil((bytes * 4) / 3)
|
|
101
105
|
return Math.ceil(b64 / DEFAULT_CHARS_PER_TOKEN)
|
|
@@ -159,8 +163,12 @@ export function createCalibratedEstimator(opts: { maxFactor?: number } = {}): Ca
|
|
|
159
163
|
|
|
160
164
|
// Satu-satunya titik yang menyesuaikan `factor` dari sampel
|
|
161
165
|
// (estimer vs provider aktual). Idempoten dan konservatif: factor tidak
|
|
162
|
-
// pernah < 1, sehingga estimasi lokal tidak pernah dilemahkan
|
|
163
|
-
//
|
|
166
|
+
// pernah < 1, sehingga estimasi lokal tidak pernah dilemahkan. Factor
|
|
167
|
+
// mengikuti ratio observasi TERBARU (reassign, bukan akumulasi max) — jadi
|
|
168
|
+
// ia BISA turun bila drift mereda (mis. 2.0 → 1.2), sambil tetap di-clamp
|
|
169
|
+
// ke [1, maxFactor]. Ini sengaja: revisi ke bawah menurunkan inflasi
|
|
170
|
+
// kompaksi-palsu, sedangkan revisi ke atas mencegah under-budget (mekanisme
|
|
171
|
+
// yang sama, arah aman masing-masing).
|
|
164
172
|
//
|
|
165
173
|
// [Live Hardening 0.13.x] Gerbang anti-sampel in-flight: selama turn berjalan
|
|
166
174
|
// host-visible `state.history` SENGAJA basi (kernel menulis ke turnStore
|
|
@@ -291,12 +299,16 @@ export async function buildSystemPrompt(
|
|
|
291
299
|
"- Read first, then act: inspect the file before editing it; locate symbols with glob/grep.",
|
|
292
300
|
"- Prefer the dedicated tools (read_file, edit, apply_patch, git_*) over bash for file and repo access.",
|
|
293
301
|
"- For tasks with 3+ steps, maintain the todo list; keep exactly one item in_progress.",
|
|
294
|
-
"- Ask the user only when truly blocked on a decision; delegate large independent research to a sub-agent.",
|
|
302
|
+
"- Ask the user only when truly blocked on a decision; delegate large independent research to a sub-agent (for auditing a large repo/document, fan out one `explore` sub-agent per area and synthesize their findings).",
|
|
295
303
|
"- On a tool error or permission denial, read the message and change approach — do not repeat the same call.",
|
|
296
304
|
// F3.3 kontrak selesai: klaim "done" tanpa bukti adalah pola gagal
|
|
297
305
|
// VERIFY_FAIL di bench (berhenti sendiri tapi verify gagal). Murah:
|
|
298
306
|
// satu baris instruksi + diukur, bukan gate kode yang rapuh.
|
|
299
307
|
"- Verify before claiming done: reproduce or check the result (run the relevant test/command, re-read the edited file) before reporting success. If verification fails, keep working — never declare victory on an unchecked change.",
|
|
308
|
+
// B1: anti-amnesia — hasil turn dibuang bila timeout/abort (turn transaksional),
|
|
309
|
+
// jadi untuk task panjang/model berjendela besar, model WAJIB menulis temuan
|
|
310
|
+
// ke state durable sedini mungkin (bukan merangkum di akhir turn).
|
|
311
|
+
"- For long or multi-step tasks, persist findings/progress as you go (write to a file or write_memory) so partial work survives a timeout or interruption — don't wait until the very end to summarize.",
|
|
300
312
|
"- Work only inside the workspace. Do not attempt to read or write files outside it, in secret paths, or in .minicode/.",
|
|
301
313
|
].join("\n"),
|
|
302
314
|
)
|
package/src/policy/permission.ts
CHANGED
|
@@ -156,6 +156,15 @@ const NO_PROMPT_TOOLS = new Set(["todo_write", "submit_result", "bash_output", "
|
|
|
156
156
|
// ini memang menahan efek samping. Agent yang butuh menulis file punya
|
|
157
157
|
// `write_file`/`edit` yang ter-jail, bukan shell.
|
|
158
158
|
//
|
|
159
|
+
// Area node/npm (di bawah) merupakan perluasan SADAR demi menjalankan project
|
|
160
|
+
// web npm (keluhan: agent menolak "tidak bisa akses & menjalankan nodejs"):
|
|
161
|
+
// `node *` = menjalankan berkas skrip (REPL `node` polos tak cocok, pola butuh
|
|
162
|
+
// argumen); bentuk eval inline (`-e`/`--eval`/`--require`/`-r`/`--loader`) tetap
|
|
163
|
+
// diblokir bash-guard dulu. `npm install`/`ci` JUGA menjalankan lifecycle
|
|
164
|
+
// script (postinstall = kode arbitrer dari registry) — oleh sebab itu kategori
|
|
165
|
+
// ini tidak lagi murni read-only, melainkan "trusted project". Chain (`;|&`),
|
|
166
|
+
// ekspansi `$()`-backtick, dan redirection tetap ditahan lapisan di bawah.
|
|
167
|
+
//
|
|
159
168
|
// Perhatikan: allowlist diperiksa SETELAH bash-guard, jadi `cat *` di sini
|
|
160
169
|
// tidak berarti `cat .env` lolos — guard menolaknya lebih dulu. Pola di sini
|
|
161
170
|
// soal "bentuk perintah apa yang boleh", bukan "target apa yang boleh".
|
|
@@ -171,6 +180,24 @@ const DEFAULT_BASH_ALLOWLIST = [
|
|
|
171
180
|
"npm run *",
|
|
172
181
|
"npm exec *",
|
|
173
182
|
"npx *",
|
|
183
|
+
// Project web npm: install dependensi + jalankan script bare (npm test/start
|
|
184
|
+
// adalah bentuk pendek `npm run test/start` yang TIDAK cocok pola `npm run *`).
|
|
185
|
+
// Package manager JS lain ikut (bun/pnpm/yarn) supaya proyek yang memilih PM
|
|
186
|
+
// selain npm tetap bisa install/run di mode ini — konsisten dengan `npm *`.
|
|
187
|
+
"npm install*",
|
|
188
|
+
"npm ci*",
|
|
189
|
+
"npm test*",
|
|
190
|
+
"npm start*",
|
|
191
|
+
"bun install*",
|
|
192
|
+
"bun add*",
|
|
193
|
+
"bun remove*",
|
|
194
|
+
"pnpm install*",
|
|
195
|
+
"pnpm add*",
|
|
196
|
+
"pnpm i *",
|
|
197
|
+
"pnpm remove*",
|
|
198
|
+
"yarn install*",
|
|
199
|
+
"yarn add*",
|
|
200
|
+
"yarn remove*",
|
|
174
201
|
"echo *",
|
|
175
202
|
"ls*",
|
|
176
203
|
"dir*",
|
|
@@ -187,10 +214,191 @@ const DEFAULT_BASH_ALLOWLIST = [
|
|
|
187
214
|
"rg *",
|
|
188
215
|
"find *",
|
|
189
216
|
"which *",
|
|
190
|
-
|
|
217
|
+
// Menjalankan berkas skrip Node (mis. `node server.js`) — bukan REPL polos
|
|
218
|
+
// (pola `*` butuh argumen) dan bukan eval inline (diblokir bash-guard).
|
|
219
|
+
// Subsumes `node --version` (versi lama) sehingga entri itu tak lagi khusus.
|
|
220
|
+
"node *",
|
|
191
221
|
"bun --version",
|
|
192
222
|
]
|
|
193
223
|
|
|
224
|
+
// [0.16.x] Allowlist "developer" untuk fallback no-sandbox (restrictBash) —
|
|
225
|
+
// sesi TRUSTED pengembang di mesin tanpa isolasi OS (Windows default, atau
|
|
226
|
+
// Linux/mac tanpa bwrap/seatbelt + tanpa `--sandbox docker`). DI SINI user
|
|
227
|
+
// menjalankan KODE SENDIRI, jadi run/test/build/install ekosistem umum boleh.
|
|
228
|
+
// Ini BUKAN pengganti isolasi: untuk repo tak-terpercaya tetap pakai
|
|
229
|
+
// `--sandbox docker` / `--allowlist` (daftar narrow di atas) — daftar ini
|
|
230
|
+
// hanya menghapus gesekan "kenapa node/pip gak bisa jalan" di mesin sendiri.
|
|
231
|
+
//
|
|
232
|
+
// Deny-list bash-guard TETAP zirah di semua mode (berjalan SEBELUM allowlist
|
|
233
|
+
// apa pun): eksekusi kode inline `-e`/`-c` (`python -c`, `node -e`), baca kredensial, exfiltrasi,
|
|
234
|
+
// perintah destruktif, dan tulis di luar workspace tetap ditolak. Verba
|
|
235
|
+
// berbahaya (`* publish`, `* login`) sengaja TIDAK dicantumkan.
|
|
236
|
+
const DEFAULT_DEV_BASH_ALLOWLIST = [
|
|
237
|
+
...DEFAULT_BASH_ALLOWLIST, // dasar read + git + node/npm/bun/pnpm/yarn + readers
|
|
238
|
+
// ── Runtime/interpreter (menjalankan berkas skrip; eval inline `-e`/`-c`
|
|
239
|
+
// tetap ditolak bash-guard). `node *` sudah ada di daftar narrow. ──
|
|
240
|
+
"python *",
|
|
241
|
+
"python3 *",
|
|
242
|
+
"deno run*",
|
|
243
|
+
"deno test*",
|
|
244
|
+
"deno task*",
|
|
245
|
+
"deno lint*",
|
|
246
|
+
"deno fmt*",
|
|
247
|
+
"ruby *",
|
|
248
|
+
"php *",
|
|
249
|
+
"perl *",
|
|
250
|
+
"lua*",
|
|
251
|
+
"luajit*",
|
|
252
|
+
"julia*",
|
|
253
|
+
"Rscript *",
|
|
254
|
+
"elixir*",
|
|
255
|
+
"escript*",
|
|
256
|
+
"erl*",
|
|
257
|
+
"groovy*",
|
|
258
|
+
"scala*",
|
|
259
|
+
"tclsh*",
|
|
260
|
+
"dart*",
|
|
261
|
+
"swift*",
|
|
262
|
+
"dotnet*",
|
|
263
|
+
"java*",
|
|
264
|
+
// ── JS/TS: package manager + framework/bundler + test/lint ──
|
|
265
|
+
"pnpm run *",
|
|
266
|
+
"pnpm test*",
|
|
267
|
+
"pnpm dlx *",
|
|
268
|
+
"pnpm exec *",
|
|
269
|
+
"yarn run *",
|
|
270
|
+
"yarn test*",
|
|
271
|
+
"yarn dlx *",
|
|
272
|
+
"yarn exec *",
|
|
273
|
+
"vite*",
|
|
274
|
+
"vitest*",
|
|
275
|
+
"next*",
|
|
276
|
+
"nuxt*",
|
|
277
|
+
"remix*",
|
|
278
|
+
"astro*",
|
|
279
|
+
"svelte-kit*",
|
|
280
|
+
"webpack*",
|
|
281
|
+
"esbuild*",
|
|
282
|
+
"rollup*",
|
|
283
|
+
"parcel*",
|
|
284
|
+
"swc*",
|
|
285
|
+
"babel*",
|
|
286
|
+
"turbo*",
|
|
287
|
+
"nx *",
|
|
288
|
+
"tsx*",
|
|
289
|
+
"ts-node*",
|
|
290
|
+
"jest*",
|
|
291
|
+
"mocha*",
|
|
292
|
+
"ava*",
|
|
293
|
+
"playwright*",
|
|
294
|
+
"cypress*",
|
|
295
|
+
"eslint*",
|
|
296
|
+
"prettier*",
|
|
297
|
+
"biome*",
|
|
298
|
+
"stylelint*",
|
|
299
|
+
"tsc*",
|
|
300
|
+
// ── Python: package/test/lint ──
|
|
301
|
+
"pip *",
|
|
302
|
+
"pip3 *",
|
|
303
|
+
"uv *",
|
|
304
|
+
"pipx *",
|
|
305
|
+
"poetry*",
|
|
306
|
+
"pipenv*",
|
|
307
|
+
"conda*",
|
|
308
|
+
"mypy*",
|
|
309
|
+
"pytest*",
|
|
310
|
+
"ruff*",
|
|
311
|
+
"black*",
|
|
312
|
+
"flake8*",
|
|
313
|
+
"isort*",
|
|
314
|
+
"pylint*",
|
|
315
|
+
"tox*",
|
|
316
|
+
"nox*",
|
|
317
|
+
"django-admin*",
|
|
318
|
+
// ── Ruby (tanpa `gem push`) ──
|
|
319
|
+
"gem install*",
|
|
320
|
+
"gem list*",
|
|
321
|
+
"gem update*",
|
|
322
|
+
"gem build*",
|
|
323
|
+
"gem outdated*",
|
|
324
|
+
"bundle*",
|
|
325
|
+
"bundler*",
|
|
326
|
+
"rake*",
|
|
327
|
+
"rails*",
|
|
328
|
+
"rspec*",
|
|
329
|
+
"rubocop*",
|
|
330
|
+
// ── PHP ──
|
|
331
|
+
"composer*",
|
|
332
|
+
"phpunit*",
|
|
333
|
+
"artisan*",
|
|
334
|
+
"phpcs*",
|
|
335
|
+
"phpstan*",
|
|
336
|
+
"psalm*",
|
|
337
|
+
// ── Rust (tanpa `cargo publish`/`login`) ──
|
|
338
|
+
"cargo build*",
|
|
339
|
+
"cargo run*",
|
|
340
|
+
"cargo test*",
|
|
341
|
+
"cargo check*",
|
|
342
|
+
"cargo add*",
|
|
343
|
+
"cargo remove*",
|
|
344
|
+
"cargo fmt*",
|
|
345
|
+
"cargo clippy*",
|
|
346
|
+
"cargo bench*",
|
|
347
|
+
"cargo doc*",
|
|
348
|
+
"cargo update*",
|
|
349
|
+
"cargo clean*",
|
|
350
|
+
"cargo install*",
|
|
351
|
+
"cargo fix*",
|
|
352
|
+
"rustc*",
|
|
353
|
+
"rustup*",
|
|
354
|
+
// ── Go ──
|
|
355
|
+
"go *",
|
|
356
|
+
// ── Java/Kotlin/JVM ──
|
|
357
|
+
"javac*",
|
|
358
|
+
"jar*",
|
|
359
|
+
"gradle*",
|
|
360
|
+
"gradlew*",
|
|
361
|
+
"./gradlew*",
|
|
362
|
+
"mvn*",
|
|
363
|
+
"./mvnw*",
|
|
364
|
+
"kotlin*",
|
|
365
|
+
"kotlinc*",
|
|
366
|
+
"sbt*",
|
|
367
|
+
// ── .NET ──
|
|
368
|
+
"msbuild*",
|
|
369
|
+
"nuget restore*",
|
|
370
|
+
// ── C/C++/build ──
|
|
371
|
+
"make*",
|
|
372
|
+
"cmake*",
|
|
373
|
+
"ninja*",
|
|
374
|
+
"meson*",
|
|
375
|
+
"bazel*",
|
|
376
|
+
"gcc*",
|
|
377
|
+
"g++*",
|
|
378
|
+
"clang*",
|
|
379
|
+
"clang++*",
|
|
380
|
+
"cc*",
|
|
381
|
+
"pkg-config*",
|
|
382
|
+
// ── Swift/Dart/Flutter ──
|
|
383
|
+
"xcodebuild*",
|
|
384
|
+
"flutter*",
|
|
385
|
+
"pub*",
|
|
386
|
+
// ── DB / ORM CLI ──
|
|
387
|
+
"psql*",
|
|
388
|
+
"mysql*",
|
|
389
|
+
"sqlite3*",
|
|
390
|
+
"redis-cli*",
|
|
391
|
+
"mongosh*",
|
|
392
|
+
"prisma*",
|
|
393
|
+
"drizzle-kit*",
|
|
394
|
+
"knex*",
|
|
395
|
+
// ── Container (dev lokal; escape di-guard CONTAINER_ESCAPE) ──
|
|
396
|
+
"docker*",
|
|
397
|
+
"docker-compose*",
|
|
398
|
+
"podman*",
|
|
399
|
+
"compose*",
|
|
400
|
+
]
|
|
401
|
+
|
|
194
402
|
// 6.4 — npm exec / npx hanya di-allow bila arg "known-good": tak ada
|
|
195
403
|
// ekspansi shell ($/backtick) atau redirection (< >). Chaining ;|& sudah
|
|
196
404
|
// diblokir oleh matchBashAllowlist (pattern tak mengandungnya).
|
|
@@ -376,12 +584,17 @@ export function createPermissionHandler(
|
|
|
376
584
|
const sessionGrants: string[] = []
|
|
377
585
|
// bash allowlist di-cache sekali (bukan baca env tiap panggilan)
|
|
378
586
|
const envRaw = process.env.MINICODE_BASH_ALLOWLIST
|
|
379
|
-
const
|
|
587
|
+
const envList = envRaw
|
|
380
588
|
? envRaw
|
|
381
589
|
.split(",")
|
|
382
590
|
.map((s) => s.trim())
|
|
383
591
|
.filter(Boolean)
|
|
384
|
-
:
|
|
592
|
+
: undefined
|
|
593
|
+
// Dua daftar: narrow (--allowlist = task tak-terpercaya) vs developer
|
|
594
|
+
// (restrictBash = fallback no-sandbox pada sesi TRUSTED). Env override
|
|
595
|
+
// MINICODE_BASH_ALLOWLIST (keputusan operator) menimpa KEDUANYA.
|
|
596
|
+
const bashAllowlist = envList ?? DEFAULT_BASH_ALLOWLIST
|
|
597
|
+
const devBashAllowlist = envList ?? DEFAULT_DEV_BASH_ALLOWLIST
|
|
385
598
|
|
|
386
599
|
async function getAllowlist(): Promise<string[]> {
|
|
387
600
|
if (allowlistCache) return allowlistCache
|
|
@@ -581,8 +794,10 @@ export function createPermissionHandler(
|
|
|
581
794
|
const br = bashDenyReason(cmd)
|
|
582
795
|
if (br) return deny(call, `bash-guard: ${br}`)
|
|
583
796
|
// restrictBash: bash hanya boleh pola allow-list (fallback no-sandbox).
|
|
797
|
+
// Pakai daftar DEVELOPER (lebih luas) — sesi trusted di mesin sendiri,
|
|
798
|
+
// bukan task tak-terpercaya (yang memakai daftar narrow via --allowlist).
|
|
584
799
|
if (restrictBash) {
|
|
585
|
-
const matched =
|
|
800
|
+
const matched = devBashAllowlist.filter((pat) => matchBashAllowlist(cmd, pat))
|
|
586
801
|
if (matched.length === 0)
|
|
587
802
|
return deny(
|
|
588
803
|
call,
|
|
@@ -208,14 +208,16 @@ export function installUpdate(version: string, runner?: InstallRunner): boolean
|
|
|
208
208
|
const run: InstallRunner =
|
|
209
209
|
runner ??
|
|
210
210
|
((cmd, args, opts) => {
|
|
211
|
-
// Windows: npm adalah .cmd → butuh shell
|
|
212
|
-
//
|
|
211
|
+
// Windows: npm adalah .cmd → butuh shell. Output npm dipipe dan
|
|
212
|
+
// dibuang — auto-update kini berjalan di belakang bar loading, jadi
|
|
213
|
+
// progres raw npm malah mengotori baris bar (sebelumnya stdio
|
|
214
|
+
// inherit menimpa spinner).
|
|
213
215
|
// Timeout 120 dtk: tanpa ini spawnSync memblokir event-loop selamanya
|
|
214
216
|
// saat npm lambat (AV/UAC di Windows 15–60 dtk) — timer abort 1.8 dtk
|
|
215
|
-
// dan
|
|
217
|
+
// dan bar ikut beku sehingga terlihat hang. Timeout = gagal jujur
|
|
216
218
|
// lalu lanjut versi lama, bukan gantung.
|
|
217
219
|
const r = spawnSync(cmd, args, {
|
|
218
|
-
stdio: "
|
|
220
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
219
221
|
shell: process.platform === "win32",
|
|
220
222
|
...(opts?.cwd ? { cwd: opts.cwd } : {}),
|
|
221
223
|
timeout: 120_000,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Adaptor semantik lama → DomainEvent V2.1 (Fase 1).
|
|
2
2
|
//
|
|
3
3
|
// Kenapa berkas ini ada: kernel meng-emit event miskin (deny/unknown/validate
|
|
4
|
-
// tanpa event — executor.ts:44-73; abort/timeout
|
|
4
|
+
// tanpa event — executor.ts:44-73; abort/timeout kini `turn:interrupted` — session.ts);
|
|
5
5
|
// finalText dibuang UI; approval hanya callback). Berkas ini merekonstruksi
|
|
6
6
|
// lifecycle yang hilang TANPA mengubah kernel: deny dari step.results,
|
|
7
7
|
// turn-settle dari driver (noteRunSettled), approval dari hook permission.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Kenapa berkas ini ada: runtime (MiniCore) meng-emit 9 event miskin tanpa
|
|
4
4
|
// lifecycle gagal/batal/deny dan tanpa identitas yang selamat sampai UI
|
|
5
5
|
// (vendor/minicore/src/core/events.ts, executor.ts:44-73 return tanpa emit,
|
|
6
|
-
// session.ts:
|
|
6
|
+
// session.ts:261 jalur sukses; `turn:interrupted` pada abort/timeout). Dua sink UI menafsir event mentah
|
|
7
7
|
// sendiri-sendiri dan divergen. Berkas ini mendefinisikan SATU bahasa yang
|
|
8
8
|
// dipakai adaptor → reducer → proyeksi, sehingga TUI/linear/ACP kelak berbagi
|
|
9
9
|
// makna yang sama tanpa masing-masing merekonstruksi semantik runtime.
|
|
@@ -614,7 +614,7 @@ export const DURABILITY: Record<DomainEventType, { durable: boolean; replayable:
|
|
|
614
614
|
|
|
615
615
|
/**
|
|
616
616
|
* Bus sumber yang dibaca adaptor — struktural seperti UiBus (handler `any`
|
|
617
|
-
* disengaja karena `on` kernel generik-kondisional; lihat contract.ts:
|
|
617
|
+
* disengaja karena `on` kernel generik-kondisional; lihat contract.ts:62-71).
|
|
618
618
|
*/
|
|
619
619
|
export interface EventBusLike {
|
|
620
620
|
on(type: string, handler: (event: any) => void): () => void
|