@lexwdex-org/opencode-dcp 3.3.3 → 3.3.4

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
@@ -2002,16 +2002,28 @@ function resolveBoundaryIds(context, state, startId, endId) {
2002
2002
  const startReference = lookup.get(parsedStartId.ref);
2003
2003
  const endReference = lookup.get(parsedEndId.ref);
2004
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.";
2005
+ const allKeys = Array.from(lookup.keys());
2006
+ const availableBlockRefs = allKeys.filter((key) => key.startsWith("b")).sort(
2007
+ (a, b) => Number.parseInt(a.slice(1), 10) - Number.parseInt(b.slice(1), 10)
2008
+ );
2009
+ const availableMsgRefs = allKeys.filter((key) => key.startsWith("m")).sort(
2010
+ (a, b) => Number.parseInt(a.slice(1), 10) - Number.parseInt(b.slice(1), 10)
2011
+ );
2012
+ const blockHint = availableBlockRefs.length ? ` Available block IDs: ${availableBlockRefs.join(", ")}.` : " No block IDs available.";
2013
+ const msgHint = availableMsgRefs.length === 0 ? " No message IDs available." : availableMsgRefs.length <= 10 ? ` Available message IDs: ${availableMsgRefs.join(", ")}.` : ` Available message IDs: ${availableMsgRefs[0]} to ${availableMsgRefs[availableMsgRefs.length - 1]} (${availableMsgRefs.length} total).`;
2014
+ const hint = `${msgHint}${blockHint}`;
2007
2015
  if (!startReference) {
2016
+ const wasKnown = state.messageIds.byRef.has(parsedStartId.ref);
2017
+ const reason = wasKnown ? " (message was likely compacted out of the conversation)" : " (invalid ID)";
2008
2018
  issues.push(
2009
- `startId ${parsedStartId.ref} is not available in the current conversation context. Choose an injected ID visible in context.${blockHint}`
2019
+ `startId ${parsedStartId.ref} is not available${reason}. Choose an injected ID visible in context.${hint}`
2010
2020
  );
2011
2021
  }
2012
2022
  if (!endReference) {
2023
+ const wasKnown = state.messageIds.byRef.has(parsedEndId.ref);
2024
+ const reason = wasKnown ? " (message was likely compacted out of the conversation)" : " (invalid ID)";
2013
2025
  issues.push(
2014
- `endId ${parsedEndId.ref} is not available in the current conversation context. Choose an injected ID visible in context.${blockHint}`
2026
+ `endId ${parsedEndId.ref} is not available${reason}. Choose an injected ID visible in context.${hint}`
2015
2027
  );
2016
2028
  }
2017
2029
  }