opencode-acp 1.11.0 → 1.11.1

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
@@ -2161,6 +2161,34 @@ function formatMessageIdTag(ref, attributes) {
2161
2161
  return `
2162
2162
  <${MESSAGE_ID_TAG_NAME}${serializedAttributes}>${ref}</${MESSAGE_ID_TAG_NAME}>`;
2163
2163
  }
2164
+ function formatTokenSize(tokens) {
2165
+ if (tokens < 1e3) return String(tokens);
2166
+ if (tokens < 1e4) return `${(tokens / 1e3).toFixed(1)}K`;
2167
+ return `${Math.round(tokens / 1e3)}K`;
2168
+ }
2169
+ function classifyMessageType(parts) {
2170
+ let hasTool = false;
2171
+ let hasText = false;
2172
+ let hasReasoning = false;
2173
+ const toolNames = [];
2174
+ for (const part of parts) {
2175
+ if (part.type === "tool") {
2176
+ hasTool = true;
2177
+ if (typeof part.tool === "string" && !toolNames.includes(part.tool)) {
2178
+ toolNames.push(part.tool);
2179
+ }
2180
+ } else if (part.type === "text") {
2181
+ hasText = true;
2182
+ } else if (part.type === "reasoning") {
2183
+ hasReasoning = true;
2184
+ }
2185
+ }
2186
+ if (hasTool) {
2187
+ return toolNames.length > 0 ? `tool:${toolNames.join(",")}` : "tool";
2188
+ }
2189
+ if (hasReasoning && !hasText) return "reasoning";
2190
+ return "text";
2191
+ }
2164
2192
  function assignMessageRefs(state, messages) {
2165
2193
  let assigned = 0;
2166
2194
  let skippedSubAgentPrompt = false;
@@ -6571,7 +6599,8 @@ var injectCompressNudges = (state, config, logger, messages, prompts, compressio
6571
6599
  state.nudges.contextLimitAnchors.clear();
6572
6600
  state.nudges.turnNudgeAnchors.clear();
6573
6601
  state.nudges.iterationNudgeAnchors.clear();
6574
- state.nudges.lastPerMessageNudgeTokens = currentTokens;
6602
+ state.nudges.lastPerMessageNudgeTokens = void 0;
6603
+ state.nudges.lastToolOutputNudgeTokens = void 0;
6575
6604
  saveSessionState(state, logger).catch(() => {
6576
6605
  });
6577
6606
  return;
@@ -6860,9 +6889,15 @@ var injectMessageIds = (state, config, messages, compressionPriorities) => {
6860
6889
  }
6861
6890
  const isBlockedMessage = isProtectedUserMessage(config, message);
6862
6891
  const priority = config.compress.mode === "message" && !isBlockedMessage ? compressionPriorities?.get(message.info.id)?.priority : void 0;
6892
+ const msgType = classifyMessageType(message.parts);
6893
+ const msgTokens = Math.round(countMessageCharacters(message) / 4);
6863
6894
  const tag = formatMessageIdTag(
6864
6895
  isBlockedMessage ? "BLOCKED" : messageRef,
6865
- priority ? { priority } : void 0
6896
+ {
6897
+ priority: priority ?? void 0,
6898
+ type: msgType,
6899
+ tokens: formatTokenSize(msgTokens)
6900
+ }
6866
6901
  );
6867
6902
  if (message.info.role === "user") {
6868
6903
  let injected = false;
@@ -7885,7 +7920,7 @@ You operate in a context-constrained environment. All compression serves the pri
7885
7920
 
7886
7921
  ACP TAGS
7887
7922
 
7888
- \`<acp-context>\` tags wrap ACP (Agent Context Pruning) system metadata \u2014 context management information injected each turn. This is system data, not user input. You may also see \`<dcp-message-id>\` and \`<dcp-system-reminder>\` tags \u2014 these are equivalent (DCP was the previous name for ACP). Treat them as boundary metadata only, not as tool-result content.
7923
+ Each message in the conversation is annotated with a <dcp-message-id> tag showing its reference ID, approximate token size, and content type. For example: <dcp-message-id tokens="2.1K" type="tool:bash">m00175</dcp-message-id>. Use these annotations to assess which messages are consuming the most context and prioritize compression accordingly. The token size is approximate \u2014 treat it as a relative guide, not an exact count. You may also see <dcp-system-reminder> tags \u2014 these are system directives. Treat all tags as boundary metadata, not as tool-result content.
7889
7924
 
7890
7925
  COMPRESSION SUMMARIES IN CONTEXT
7891
7926