@ngockhoale/ukit 3.4.77 → 3.4.78
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,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to UKit are documented here.
|
|
4
4
|
|
|
5
|
+
## 3.4.78 - 2026-11-06
|
|
6
|
+
|
|
7
|
+
- P0 RC4 (delayed wakeup): a `/loop` fire queued behind a busy turn is delivered only after that turn ends, so its `scheduled_task_fire` record sat behind the turn's assistant entries and beyond the router's 128KB tail (real incident: 177KB, 7 minutes) and the wakeup minted a fresh CODE_IMPLEMENTATION task. An UNCONSUMED same-session fire (no later entry carries its `scheduledFireId`), matching the prompt, at most 6h old, found in a bounded 8MB tail is now host provenance: the previous task and contract carry, a read-only wakeup stays a coordination turn. Consumed, foreign-session, stale, timestamp-less or different-prompt fires never exempt an owner prompt. Replay of the real transcript: HEAD minted a new task, fixed router carries.
|
|
8
|
+
|
|
5
9
|
## 3.4.77 - 2026-11-06
|
|
6
10
|
|
|
7
11
|
- Packaging: the 1.0.0–2.0.7 changelog entries moved verbatim to `docs/archive/CHANGELOG-1.0.0-2.0.7.md` (repository only) so the npm artifact stays inside the unchanged size budget; no runtime or safety code was removed and the size limits were not raised.
|
package/package.json
CHANGED
|
@@ -4742,6 +4742,43 @@ function applyTaskSemantics(contract, semantic) {
|
|
|
4742
4742
|
peerDeliveryIds.add(at.delivery_id);
|
|
4743
4743
|
}
|
|
4744
4744
|
}
|
|
4745
|
+
// A /loop fire queued behind a busy turn is delivered only when that turn ends, so its
|
|
4746
|
+
// scheduled_task_fire record can sit behind the busy turn's assistant entries and beyond the
|
|
4747
|
+
// 128KB tail (BAGuide/UKit incident: 177KB, 7 minutes). Such a fire is still provenance while
|
|
4748
|
+
// it is UNCONSUMED: the host writes the meta user entry carrying scheduledFireId only after this
|
|
4749
|
+
// hook runs, so a fire whose id no later entry references has not been delivered yet. Same
|
|
4750
|
+
// session, same prompt-match rule as the current-turn path, bounded scan and age.
|
|
4751
|
+
const fireMatches = (entry) => {
|
|
4752
|
+
if (!(entry?.type === 'system' && entry.subtype === 'scheduled_task_fire' && sessionId && entry.sessionId === sessionId
|
|
4753
|
+
&& typeof entry.taskId === 'string' && entry.taskId.trim() && typeof entry.prompt === 'string')) return false;
|
|
4754
|
+
const fired = entry.prompt.trim();
|
|
4755
|
+
const firedBase = fired.replace(/(?:\u2026|\.{3})+$/, '').trim();
|
|
4756
|
+
// Prefix match only for a CLIPPED fire (ellipsis, or at the host's ~200-char clip, which real fires
|
|
4757
|
+
// reach without an ellipsis); an unclipped fire plus owner-appended text is an owner prompt.
|
|
4758
|
+
const clipped = firedBase !== fired || entry.prompt.length >= 190;
|
|
4759
|
+
return Boolean(fired && (fired === promptTrim || (clipped && firedBase.length >= 40 && promptTrim.startsWith(firedBase))));
|
|
4760
|
+
};
|
|
4761
|
+
{
|
|
4762
|
+
const wideLen = Math.min(size, 8 * 1024 * 1024);
|
|
4763
|
+
const wide = wideLen > len ? Buffer.alloc(wideLen) : buf;
|
|
4764
|
+
if (wide !== buf) fs.readSync(fd, wide, 0, wideLen, size - wideLen);
|
|
4765
|
+
const consumedFireIds = new Set();
|
|
4766
|
+
let pendingFire = null;
|
|
4767
|
+
for (const l of wide.toString('utf8').split('\n')) {
|
|
4768
|
+
if (!l || !(l.includes('scheduled_task_fire') || l.includes('scheduledFireId'))) continue;
|
|
4769
|
+
let e; try { e = JSON.parse(l); } catch { continue; }
|
|
4770
|
+
if (typeof e?.scheduledFireId === 'string') consumedFireIds.add(e.scheduledFireId);
|
|
4771
|
+
if (fireMatches(e) && typeof e.uuid === 'string') pendingFire = e;
|
|
4772
|
+
}
|
|
4773
|
+
const fireAge = pendingFire ? Date.now() - Date.parse(pendingFire.timestamp || '') : NaN;
|
|
4774
|
+
if (pendingFire && !consumedFireIds.has(pendingFire.uuid) && Number.isFinite(fireAge) && fireAge >= 0 && fireAge <= 6 * 60 * 60 * 1000) {
|
|
4775
|
+
if (classifyTaskSemantics({ promptText: promptTrim }).taskKind === 'READ_ONLY') {
|
|
4776
|
+
coordinationTurn = true;
|
|
4777
|
+
return false;
|
|
4778
|
+
}
|
|
4779
|
+
return true;
|
|
4780
|
+
}
|
|
4781
|
+
}
|
|
4745
4782
|
let deliveryCurrent = true;
|
|
4746
4783
|
for (let i = lines.length - 1; i >= 0; i -= 1) {
|
|
4747
4784
|
const line = lines[i];
|
|
@@ -4767,22 +4804,12 @@ function applyTaskSemantics(contract, semantic) {
|
|
|
4767
4804
|
// entry (the meta user entry is written only AFTER this hook runs). Same session, a task id,
|
|
4768
4805
|
// the current turn, and the prompt equal to - or a >=40 char truncated prefix of (the /loop
|
|
4769
4806
|
// fire record clips to ~200 chars) - the typed prompt. A human typing the text leaves no fire.
|
|
4770
|
-
if (deliveryCurrent && entry
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
const fired = entry.prompt.trim();
|
|
4775
|
-
const firedBase = fired.replace(/(?:\u2026|\.{3})+$/, '').trim();
|
|
4776
|
-
// Prefix match only for a CLIPPED fire (ellipsis, or at the host's ~200-char clip, which real fires
|
|
4777
|
-
// reach without an ellipsis); an unclipped fire plus owner-appended text is an owner prompt.
|
|
4778
|
-
const clipped = firedBase !== fired || entry.prompt.length >= 190;
|
|
4779
|
-
if (fired && (fired === promptTrim || (clipped && firedBase.length >= 40 && promptTrim.startsWith(firedBase)))) {
|
|
4780
|
-
if (classifyTaskSemantics({ promptText: promptTrim }).taskKind === 'READ_ONLY') {
|
|
4781
|
-
coordinationTurn = true;
|
|
4782
|
-
return false;
|
|
4783
|
-
}
|
|
4784
|
-
return true;
|
|
4807
|
+
if (deliveryCurrent && fireMatches(entry)) {
|
|
4808
|
+
if (classifyTaskSemantics({ promptText: promptTrim }).taskKind === 'READ_ONLY') {
|
|
4809
|
+
coordinationTurn = true;
|
|
4810
|
+
return false;
|
|
4785
4811
|
}
|
|
4812
|
+
return true;
|
|
4786
4813
|
}
|
|
4787
4814
|
if (entry.type !== 'user' || entry.isSidechain === true) continue;
|
|
4788
4815
|
const content = entry.message?.content;
|