@ngockhoale/ukit 3.4.63 → 3.4.64
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to UKit are documented here.
|
|
4
4
|
|
|
5
|
+
## 3.4.64 - 2026-10-22
|
|
6
|
+
|
|
7
|
+
**Completion Gate: defect-contingent repair/release is not an unconditional publish order.**
|
|
8
|
+
- Exact approved pilot prompt reproduced false `release-publication`: line/comma splitting detached `release npm` from the preceding wrapped “Nếu gặp bug UKit…” condition. Standing policy/carryover is not needed to reproduce it.
|
|
9
|
+
- Preserve defect-repair sentence scope across line wraps; activate its release branch only after owned runtime writes. Direct publish commands still require registry verification, and foreign-task proofs remain rejected.
|
|
10
|
+
- Do not interpret hashed write-bank keys as paths; bank the runtime-write classification separately across same-task rekeys. Docs/test-only direct writes do not activate repair publication. Legacy pathless Bash deltas remain conservative (may demand release); no new path-attribution architecture added.
|
|
11
|
+
- Pilot preflight narrowed to existing host interfaces and exact condition-change options; no paid arms, no relaxed limits adopted, no BAGuide/default changes.
|
|
12
|
+
|
|
5
13
|
## 3.4.63 - 2026-10-22
|
|
6
14
|
|
|
7
15
|
**Completion recovery: background pending is not a pipeline.**
|
package/package.json
CHANGED
|
@@ -1513,6 +1513,7 @@ function carriedEvidenceLedger(fresh, current) {
|
|
|
1513
1513
|
writeAttempted: fresh.writeAttempted || current.writeAttempted === true,
|
|
1514
1514
|
writeSucceeded: fresh.writeSucceeded || current.writeSucceeded === true,
|
|
1515
1515
|
// undefined (a ledger written before this field existed) keeps the legacy any-write behavior.
|
|
1516
|
+
conditionalRuntimeWrite: fresh.conditionalRuntimeWrite === true || current.conditionalRuntimeWrite === true,
|
|
1516
1517
|
substantiveWrite: fresh.substantiveWrite === true || current.substantiveWrite === true
|
|
1517
1518
|
? true
|
|
1518
1519
|
: (current.substantiveWrite === undefined && current.writeSucceeded === true ? undefined : false),
|
|
@@ -1982,13 +1983,13 @@ async function quarantineJournalLines(target, lines) {
|
|
|
1982
1983
|
|
|
1983
1984
|
// Uniform applier: returns { ledger, value } or null when the record is unappliable
|
|
1984
1985
|
// (the caller quarantines it instead of applying it).
|
|
1985
|
-
function applyJournalRecord(ledger, record) {
|
|
1986
|
+
function applyJournalRecord(ledger, record, projectRoot) {
|
|
1986
1987
|
const sameTask = ledger.taskInstanceId || record.taskInstanceId
|
|
1987
1988
|
? Boolean(ledger.taskInstanceId && ledger.taskInstanceId === record.taskInstanceId)
|
|
1988
1989
|
: Boolean(ledger.requestKey && ledger.requestKey === record.requestKey && (ledger.promptKey || null) === (record.promptKey || null));
|
|
1989
1990
|
if (!sameTask) return null;
|
|
1990
1991
|
if (record.type === 'receipt') {
|
|
1991
|
-
return applyReceiptToLedger(ledger, record.event?.receipt, { vibecode: record.event?.vibecode === true });
|
|
1992
|
+
return applyReceiptToLedger(ledger, record.event?.receipt, { vibecode: record.event?.vibecode === true, projectRoot });
|
|
1992
1993
|
}
|
|
1993
1994
|
if (record.type === 'continuation') {
|
|
1994
1995
|
return { ledger: applyContinuationToLedger(ledger, record.event), value: null };
|
|
@@ -2008,7 +2009,7 @@ function applyJournalRecord(ledger, record) {
|
|
|
2008
2009
|
// Read the journal and apply every unseen record onto `ledger` IN MEMORY. The journal is
|
|
2009
2010
|
// consumed only after the caller's ledger write lands (commit()), so a crash anywhere
|
|
2010
2011
|
// before that leaves the journal intact and the records re-apply idempotently by eventId.
|
|
2011
|
-
async function drainJournal(target, { ledger, payload, signal, deadlineMs }) {
|
|
2012
|
+
async function drainJournal(target, { ledger, payload, signal, deadlineMs, projectRoot }) {
|
|
2012
2013
|
const journalPath = journalPathFor(target);
|
|
2013
2014
|
let text = null;
|
|
2014
2015
|
try {
|
|
@@ -2031,7 +2032,7 @@ async function drainJournal(target, { ledger, payload, signal, deadlineMs }) {
|
|
|
2031
2032
|
continue;
|
|
2032
2033
|
}
|
|
2033
2034
|
if (seen.has(record.eventId)) continue; // idempotent replay
|
|
2034
|
-
const result = applyJournalRecord(next, record);
|
|
2035
|
+
const result = applyJournalRecord(next, record, projectRoot);
|
|
2035
2036
|
if (!result) {
|
|
2036
2037
|
malformed.push(line);
|
|
2037
2038
|
continue;
|
|
@@ -2529,7 +2530,7 @@ function applyReceiptToLedger(ledger, receipt, options = {}) {
|
|
|
2529
2530
|
return applyReceiptCore(base, receipt, options);
|
|
2530
2531
|
}
|
|
2531
2532
|
|
|
2532
|
-
function applyReceiptCore(ledger, receipt, { vibecode = false } = {}) {
|
|
2533
|
+
function applyReceiptCore(ledger, receipt, { vibecode = false, projectRoot } = {}) {
|
|
2533
2534
|
if (!receipt || typeof receipt !== 'object' || !RECEIPT_KINDS.has(receipt.kind)) return null;
|
|
2534
2535
|
const next = { ...ledger, receiptSequence: Number(ledger.receiptSequence || 0) + 1 };
|
|
2535
2536
|
if (receipt.kind === 'delegation-violation') {
|
|
@@ -2565,6 +2566,7 @@ function applyReceiptCore(ledger, receipt, { vibecode = false } = {}) {
|
|
|
2565
2566
|
} else if (receipt.kind === 'write') {
|
|
2566
2567
|
next.writeAttempted = true;
|
|
2567
2568
|
next.writeSucceeded = next.writeSucceeded || receipt.success;
|
|
2569
|
+
if (receipt.success && isConditionalRuntimeWrite(receipt, receipt.workspaceRoot || projectRoot)) next.conditionalRuntimeWrite = true;
|
|
2568
2570
|
if (receipt.success && receipt.file && !isBookkeepingWrite(receipt.file)) next.substantiveWrite = true;
|
|
2569
2571
|
else if (next.substantiveWrite === undefined) next.substantiveWrite = false;
|
|
2570
2572
|
// Evidence tier: a fingerprint-derived Bash delta is inferred (supporting) evidence; only a
|
|
@@ -2946,7 +2948,7 @@ export async function recordLedgerEvent(event, {
|
|
|
2946
2948
|
let ledger = liveBaseLedger(event, current, payload, state, harness, fallbackLedger);
|
|
2947
2949
|
// Reconcile pending journaled events first — inside this caller's acquired lock and
|
|
2948
2950
|
// before its own evidence, so a timed-out writer's receipt is never stranded.
|
|
2949
|
-
const drained = await drainJournal(target, { ledger, payload, signal, deadlineMs });
|
|
2951
|
+
const drained = await drainJournal(target, { ledger, payload, signal, deadlineMs, projectRoot });
|
|
2950
2952
|
ledger = drained.ledger;
|
|
2951
2953
|
let value;
|
|
2952
2954
|
if (event.type === 'receipt') {
|
|
@@ -2975,7 +2977,7 @@ export async function recordLedgerEvent(event, {
|
|
|
2975
2977
|
const stampedReceipt = TASK_OWNED_RECEIPT_KINDS.has(event.receipt.kind)
|
|
2976
2978
|
? { ...event.receipt, taskInstanceId: state?.taskInstanceId || null, sessionKey: sessionIdentity(payload) }
|
|
2977
2979
|
: event.receipt;
|
|
2978
|
-
const applied = applyReceiptToLedger(ledger, stampedReceipt, { vibecode: event.vibecode === true });
|
|
2980
|
+
const applied = applyReceiptToLedger(ledger, stampedReceipt, { vibecode: event.vibecode === true, projectRoot });
|
|
2979
2981
|
if (!applied) return { committed: false, eventId, reason: 'invalid-receipt' };
|
|
2980
2982
|
ledger = applied.ledger;
|
|
2981
2983
|
// TASK-005 (FR-005): completion receipts (write/verification terminal
|
|
@@ -3781,12 +3783,23 @@ const PUBLISH_ORDER_HEADER = /prohibit|forbidden|out of scope|non-goal|scope con
|
|
|
3781
3783
|
// "Do not: ... npm publish") keeps its negation across comma/and/or list items and under a prohibition header; only a
|
|
3782
3784
|
// explicit command can end a negated non-release clause, but bare list verbs cannot. Explicit publication
|
|
3783
3785
|
// prohibitions win over positive references elsewhere. Only the task's authoritative prompt is consulted.
|
|
3786
|
+
// Keep a defect-contingent repair sentence together across soft line wraps. Its
|
|
3787
|
+
// publication instruction becomes active only after an owned runtime write.
|
|
3788
|
+
function defectRepairBranches(text) {
|
|
3789
|
+
return [...text.matchAll(/(?:^|\n|\.\s+)[ \t]*(?:[-*]|\d+[.)])?\s*((?:neu\s+(?:gap|phat hien|tim thay|co)|if\b)[^.!?]*(?:\.(?!\w)|$))/g)]
|
|
3790
|
+
.map((match) => match[1])
|
|
3791
|
+
.filter((branch) => !/\n\s*\n/.test(branch)
|
|
3792
|
+
&& /^(?:neu\s+(?:gap|phat hien|tim thay|co)\s+(?:bug|loi)|if\s+[^,\n]*(?:bug|defect|error)\b)/.test(branch)
|
|
3793
|
+
&& /\b(?:sua|fix|repair)\b/.test(branch));
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3784
3796
|
export function promptOrdersNpmPublish(state = {}) {
|
|
3785
3797
|
const text = String(state?.routingContext?.lastExplicitUserPromptText || '')
|
|
3786
3798
|
.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[đĐ]/g, 'd').toLowerCase();
|
|
3787
3799
|
// Quoted commands and historical/example blocks describe orders; they do not issue them.
|
|
3788
|
-
|
|
3800
|
+
let active = text.replace(/```[^]*?```|~~~[^]*?~~~/g, '')
|
|
3789
3801
|
.replace(/^[ \t]*>.*$/gm, '').replace(/[“"][^”"\n]*[”"]|‘[^’\n]*’/g, '');
|
|
3802
|
+
for (const branch of defectRepairBranches(active)) active = active.replace(branch, '');
|
|
3790
3803
|
let prohibited = false;
|
|
3791
3804
|
let ordered = false;
|
|
3792
3805
|
let blockNegated = false;
|
|
@@ -3821,6 +3834,16 @@ export function promptOrdersNpmPublish(state = {}) {
|
|
|
3821
3834
|
return ordered && !prohibited;
|
|
3822
3835
|
}
|
|
3823
3836
|
|
|
3837
|
+
function isConditionalRuntimeWrite(receipt, cwd) {
|
|
3838
|
+
if (receipt.kind !== 'write' || receipt.success !== true || !receipt.file || isBookkeepingWrite(receipt.file)) return false;
|
|
3839
|
+
// Older inferred Bash deltas have no paths: keep their conservative release demand.
|
|
3840
|
+
if (receipt.detail === 'bash-workspace-delta' && /^bash-workspace:/.test(receipt.file)) return true;
|
|
3841
|
+
const relative = cwd ? path.relative(path.resolve(cwd), path.resolve(cwd, receipt.file)) : String(receipt.file);
|
|
3842
|
+
if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`)) return false;
|
|
3843
|
+
return !/^(?:\.ukit|\.cache|node_modules|docs|tests?|fixtures?)(?:[\\/]|$)/.test(relative)
|
|
3844
|
+
&& !/^tmp(?:[\\/]|$)/.test(relative);
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3824
3847
|
// Conditional repair is not a publication order until owned project source actually changes.
|
|
3825
3848
|
// Reuse the affirmative publication parser on the taken branch, including its negation rules.
|
|
3826
3849
|
function conditionalRepairOrdersPublish(state, ledger, cwd) {
|
|
@@ -3828,21 +3851,22 @@ function conditionalRepairOrdersPublish(state, ledger, cwd) {
|
|
|
3828
3851
|
const text = String(state?.routingContext?.lastExplicitUserPromptText || '')
|
|
3829
3852
|
.normalize('NFD').replace(/[̀-ͯ]/g, '').replace(/[đĐ]/g, 'd').toLowerCase()
|
|
3830
3853
|
.replace(/```[^]*?```|~~~[^]*?~~~/g, '').replace(/^[ \t]*>.*$/gm, '');
|
|
3831
|
-
|
|
3832
|
-
const
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
return relative && !relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative)
|
|
3840
|
-
&& !/^(?:\.ukit|\.cache|node_modules|tests?|fixtures?|tmp)(?:[\\/]|$)/.test(relative);
|
|
3841
|
-
});
|
|
3854
|
+
const defectBranches = defectRepairBranches(text);
|
|
3855
|
+
const verificationPurpose = /(?:^|\n)[ \t*#_-]*(?:muc tieu|goal|purpose|objective)\s*:[^\n]*\b(?:xac nhan|verify|confirm|validate)\b/.test(text);
|
|
3856
|
+
const legacyBranch = verificationPurpose ? text.match(/(?:^|\n|\.\s+)[ \t]*(?:\d+[.)]\s*)?(?:neu\s+co\s+source fix|if\s+(?:there is a\s+)?source fix)\s*:[^\n]*/)?.[0] : null;
|
|
3857
|
+
if (!defectBranches.length && !legacyBranch) return false;
|
|
3858
|
+
// bankedWrites keys are hashes, never filenames. Keep the runtime-write bit
|
|
3859
|
+
// separately so receipt-window eviction cannot activate a report-only branch.
|
|
3860
|
+
const projectWrite = ledger.conditionalRuntimeWrite === true
|
|
3861
|
+
|| (ledger.receipts || []).some((receipt) => isConditionalRuntimeWrite(receipt, cwd));
|
|
3842
3862
|
if (!projectWrite) return false;
|
|
3843
3863
|
// Explicit task-wide publication prohibitions still dominate the conditional branch.
|
|
3844
3864
|
if (/(?:do not|never|khong|chua)\s+(?:npm\s+)?publish\b|\bno\s+(?:release|publication)\b/.test(text)) return false;
|
|
3845
|
-
return promptOrdersNpmPublish({ routingContext: {
|
|
3865
|
+
return defectBranches.some((branch) => promptOrdersNpmPublish({ routingContext: {
|
|
3866
|
+
lastExplicitUserPromptText: branch.replace(/^[^,\n]*[,\n]\s*/, '').replace(/\s*\n\s*/g, ' '),
|
|
3867
|
+
} })) || Boolean(legacyBranch && promptOrdersNpmPublish({ routingContext: {
|
|
3868
|
+
lastExplicitUserPromptText: legacyBranch.replace(/^.*?:/, 'Run '),
|
|
3869
|
+
} }));
|
|
3846
3870
|
}
|
|
3847
3871
|
|
|
3848
3872
|
function releasePublicationMissing(state, ledger, cwd) {
|