@lexwdex-org/opencode-dcp 3.3.1 → 3.3.3
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/dist/index.js
CHANGED
|
@@ -2001,15 +2001,19 @@ function resolveBoundaryIds(context, state, startId, endId) {
|
|
|
2001
2001
|
}
|
|
2002
2002
|
const startReference = lookup.get(parsedStartId.ref);
|
|
2003
2003
|
const endReference = lookup.get(parsedEndId.ref);
|
|
2004
|
-
if (!startReference) {
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
)
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
)
|
|
2004
|
+
if (!startReference || !endReference) {
|
|
2005
|
+
const availableBlockRefs = Array.from(lookup.keys()).filter((key) => key.startsWith("b")).sort((a, b) => Number.parseInt(a.slice(1), 10) - Number.parseInt(b.slice(1), 10)).join(", ");
|
|
2006
|
+
const blockHint = availableBlockRefs ? ` Available block IDs: ${availableBlockRefs}.` : " No block IDs available.";
|
|
2007
|
+
if (!startReference) {
|
|
2008
|
+
issues.push(
|
|
2009
|
+
`startId ${parsedStartId.ref} is not available in the current conversation context. Choose an injected ID visible in context.${blockHint}`
|
|
2010
|
+
);
|
|
2011
|
+
}
|
|
2012
|
+
if (!endReference) {
|
|
2013
|
+
issues.push(
|
|
2014
|
+
`endId ${parsedEndId.ref} is not available in the current conversation context. Choose an injected ID visible in context.${blockHint}`
|
|
2015
|
+
);
|
|
2016
|
+
}
|
|
2013
2017
|
}
|
|
2014
2018
|
if (issues.length > 0) {
|
|
2015
2019
|
throw new Error(
|
|
@@ -2158,6 +2162,32 @@ function buildBoundaryLookup(context, state) {
|
|
|
2158
2162
|
});
|
|
2159
2163
|
}
|
|
2160
2164
|
}
|
|
2165
|
+
for (const [blockId, block] of state.prune.messages.blocksById) {
|
|
2166
|
+
if (block.active) {
|
|
2167
|
+
continue;
|
|
2168
|
+
}
|
|
2169
|
+
const blockRef = formatBlockRef(blockId);
|
|
2170
|
+
if (lookup.has(blockRef)) {
|
|
2171
|
+
continue;
|
|
2172
|
+
}
|
|
2173
|
+
const anchorMessage = context.rawMessagesById.get(block.anchorMessageId);
|
|
2174
|
+
if (!anchorMessage) {
|
|
2175
|
+
continue;
|
|
2176
|
+
}
|
|
2177
|
+
if (isIgnoredUserMessage(anchorMessage)) {
|
|
2178
|
+
continue;
|
|
2179
|
+
}
|
|
2180
|
+
const rawIndex = context.rawIndexById.get(block.anchorMessageId);
|
|
2181
|
+
if (rawIndex === void 0) {
|
|
2182
|
+
continue;
|
|
2183
|
+
}
|
|
2184
|
+
lookup.set(blockRef, {
|
|
2185
|
+
kind: "compressed-block",
|
|
2186
|
+
rawIndex,
|
|
2187
|
+
blockId: block.blockId,
|
|
2188
|
+
anchorMessageId: block.anchorMessageId
|
|
2189
|
+
});
|
|
2190
|
+
}
|
|
2161
2191
|
return lookup;
|
|
2162
2192
|
}
|
|
2163
2193
|
|
|
@@ -5693,15 +5723,15 @@ var syncCompressionBlocks = (state, logger, messages) => {
|
|
|
5693
5723
|
messagesState.activeBlockIds.clear();
|
|
5694
5724
|
messagesState.activeByAnchorMessageId.clear();
|
|
5695
5725
|
const now = Date.now();
|
|
5696
|
-
const
|
|
5726
|
+
const missingAnchorBlockIds = [];
|
|
5697
5727
|
const orderedBlocks = Array.from(messagesState.blocksById.values()).sort(sortBlocksByCreation);
|
|
5698
5728
|
for (const block of orderedBlocks) {
|
|
5699
|
-
const
|
|
5700
|
-
if (!
|
|
5729
|
+
const hasAnchorMessage = typeof block.anchorMessageId === "string" && block.anchorMessageId.length > 0 && messageIds.has(block.anchorMessageId);
|
|
5730
|
+
if (!hasAnchorMessage) {
|
|
5701
5731
|
block.active = false;
|
|
5702
5732
|
block.deactivatedAt = now;
|
|
5703
5733
|
block.deactivatedByBlockId = void 0;
|
|
5704
|
-
|
|
5734
|
+
missingAnchorBlockIds.push(block.blockId);
|
|
5705
5735
|
continue;
|
|
5706
5736
|
}
|
|
5707
5737
|
if (block.deactivatedByUser) {
|
|
@@ -5756,9 +5786,9 @@ var syncCompressionBlocks = (state, logger, messages) => {
|
|
|
5756
5786
|
reactivatedCount++;
|
|
5757
5787
|
}
|
|
5758
5788
|
}
|
|
5759
|
-
if (
|
|
5789
|
+
if (missingAnchorBlockIds.length > 0 || deactivatedCount > 0 || reactivatedCount > 0) {
|
|
5760
5790
|
logger.info("Synced compress block state", {
|
|
5761
|
-
|
|
5791
|
+
missingAnchorCount: missingAnchorBlockIds.length,
|
|
5762
5792
|
deactivatedCount,
|
|
5763
5793
|
reactivatedCount
|
|
5764
5794
|
});
|
|
@@ -5881,11 +5911,11 @@ function listPriorityRefsBeforeIndex(messages, priorities, anchorIndex, priority
|
|
|
5881
5911
|
|
|
5882
5912
|
// lib/messages/inject/utils.ts
|
|
5883
5913
|
var MESSAGE_MODE_NUDGE_PRIORITY = "high";
|
|
5884
|
-
function getNudgeFrequency(
|
|
5885
|
-
return
|
|
5914
|
+
function getNudgeFrequency(_config) {
|
|
5915
|
+
return 1;
|
|
5886
5916
|
}
|
|
5887
|
-
function getIterationNudgeThreshold(
|
|
5888
|
-
return
|
|
5917
|
+
function getIterationNudgeThreshold(_config) {
|
|
5918
|
+
return 1;
|
|
5889
5919
|
}
|
|
5890
5920
|
function findLastNonIgnoredMessage(messages) {
|
|
5891
5921
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
@@ -6621,7 +6651,7 @@ function getActiveCompressionTargets(messagesState) {
|
|
|
6621
6651
|
}
|
|
6622
6652
|
function getRecompressibleCompressionTargets(messagesState, availableMessageIds) {
|
|
6623
6653
|
const allBlocks = Array.from(messagesState.blocksById.values()).filter((block) => {
|
|
6624
|
-
return availableMessageIds.has(block.
|
|
6654
|
+
return availableMessageIds.has(block.anchorMessageId);
|
|
6625
6655
|
});
|
|
6626
6656
|
const messageGroups = /* @__PURE__ */ new Map();
|
|
6627
6657
|
const singleTargets = [];
|
|
@@ -7088,7 +7118,7 @@ async function handleRecompressCommand(ctx) {
|
|
|
7088
7118
|
);
|
|
7089
7119
|
return;
|
|
7090
7120
|
}
|
|
7091
|
-
if (target.blocks.some((block) => !availableMessageIds.has(block.
|
|
7121
|
+
if (target.blocks.some((block) => !availableMessageIds.has(block.anchorMessageId))) {
|
|
7092
7122
|
await sendIgnoredMessage(
|
|
7093
7123
|
client,
|
|
7094
7124
|
sessionId,
|