opencode-acp 1.14.17-pr.304.12 → 1.14.17-pr.304.13

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
@@ -2075,7 +2075,7 @@ THE FORMAT OF COMPRESS
2075
2075
  ]
2076
2076
  }
2077
2077
  \`\`\`
2078
- Each entry MAY have a topic. Missing topics fall back to the top-level topic, then to an automatic one derived from the summary.`;
2078
+ Each entry needs a topic \u2014 either its own or the top-level fallback.`;
2079
2079
 
2080
2080
  // lib/state/persistence.ts
2081
2081
  import * as fs from "fs/promises";
@@ -3756,11 +3756,8 @@ function filterProtectedRecentMessages(selection, searchContext, state, compress
3756
3756
 
3757
3757
  // lib/compress/range-utils.ts
3758
3758
  var BLOCK_PLACEHOLDER_REGEX = /\(b(\d+)\)|\{block_(\d+)\}/gi;
3759
- function deriveFallbackTopic(summary) {
3760
- const firstLine = summary.split("\n").map((line) => line.replace(/^#{1,6}\s*/, "").trim()).find((line) => line.length > 0) ?? "compressed range";
3761
- return firstLine.length > 80 ? `${firstLine.slice(0, 77)}...` : firstLine;
3762
- }
3763
3759
  function validateArgs(args) {
3760
+ const hasTopLevelTopic = typeof args.topic === "string" && args.topic.trim().length > 0;
3764
3761
  if (!Array.isArray(args.content) || args.content.length === 0) {
3765
3762
  throw new Error("content is required and must be a non-empty array");
3766
3763
  }
@@ -3776,12 +3773,18 @@ function validateArgs(args) {
3776
3773
  if (typeof entry?.summary !== "string" || entry.summary.trim().length === 0) {
3777
3774
  throw new Error(`${prefix}.summary is required and must be a non-empty string`);
3778
3775
  }
3776
+ const hasEntryTopic = typeof entry?.topic === "string" && entry.topic.trim().length > 0;
3777
+ if (!hasEntryTopic && !hasTopLevelTopic) {
3778
+ throw new Error(
3779
+ `${prefix} needs a topic \u2014 provide ${prefix}.topic or the top-level topic`
3780
+ );
3781
+ }
3779
3782
  }
3780
3783
  }
3781
3784
  function resolveRanges(args, searchContext, state, logger) {
3782
3785
  return args.content.map((entry, index) => {
3783
3786
  const normalizedEntry = {
3784
- topic: typeof entry.topic === "string" && entry.topic.trim().length > 0 ? entry.topic.trim() : typeof args.topic === "string" && args.topic.trim().length > 0 ? void 0 : deriveFallbackTopic(entry.summary),
3787
+ topic: typeof entry.topic === "string" && entry.topic.trim().length > 0 ? entry.topic.trim() : void 0,
3785
3788
  startId: entry.startId.trim(),
3786
3789
  endId: entry.endId.trim(),
3787
3790
  summary: entry.summary
@@ -5669,6 +5672,11 @@ exact values, errors). Then add "acknowledgeRisk": true to the compress tool cal
5669
5672
  Without acknowledgeRisk: true, the compression will be rejected again.`;
5670
5673
  return new Error(message);
5671
5674
  }
5675
+ function buildPreemptiveAcknowledgeError() {
5676
+ return new Error(
5677
+ 'Parameter "acknowledgeRisk": true was provided, but no quality gate rejection is pending. This parameter is only valid immediately after a compression was rejected by the quality gate. Remove it and try again.'
5678
+ );
5679
+ }
5672
5680
 
5673
5681
  // lib/compress/pipeline.ts
5674
5682
  function snapshotCompressionState(state) {
@@ -6142,13 +6150,13 @@ function createCompressRangeTool(factoryCtx) {
6142
6150
  }
6143
6151
  const acknowledgeRisk = args.acknowledgeRisk === true;
6144
6152
  const qualityGateRetryPendingBefore = ctx.state.qualityGateRetryPending;
6145
- const bypassQuality = acknowledgeRisk && ctx.state.qualityGateRetryPending;
6146
- const ignoredAcknowledgeRisk = acknowledgeRisk && !ctx.state.qualityGateRetryPending;
6147
- if (ignoredAcknowledgeRisk) {
6148
- ctx.logger.warn("compress: acknowledgeRisk ignored \u2014 no quality gate rejection pending");
6153
+ if (acknowledgeRisk && !ctx.state.qualityGateRetryPending) {
6154
+ throw buildPreemptiveAcknowledgeError();
6149
6155
  }
6150
- ctx.state.qualityGateRetryPending = false;
6151
- if (!bypassQuality) {
6156
+ if (acknowledgeRisk) {
6157
+ ctx.state.qualityGateRetryPending = false;
6158
+ } else {
6159
+ ctx.state.qualityGateRetryPending = false;
6152
6160
  for (const plan of preparedPlans) {
6153
6161
  const result = evaluatePreCommitQuality(
6154
6162
  rawMessages,
@@ -6224,10 +6232,7 @@ function createCompressRangeTool(factoryCtx) {
6224
6232
  const skippedNote = phantomSkipNotice !== null ? `
6225
6233
  \u26A0\uFE0F ${phantomSkipNotice}
6226
6234
  ` : "";
6227
- const ackNote = ignoredAcknowledgeRisk ? `
6228
- \u26A0\uFE0F acknowledgeRisk was ignored: no quality gate rejection was pending, so quality checks ran normally. Only pass it when retrying immediately after a quality gate rejection.
6229
- ` : "";
6230
- return `Compressed ${totalCompressedMessages} messages into ${COMPRESSED_BLOCK_HEADER}.${skippedNote}${ackNote}
6235
+ return `Compressed ${totalCompressedMessages} messages into ${COMPRESSED_BLOCK_HEADER}.${skippedNote}
6231
6236
  IMPORTANT: This was an automatic context compression. You MUST continue your previous task exactly where you left off. Do NOT ask the user what to do next.
6232
6237
  \u{1F4A1} Tip: Use search_context('keyword') to find compressed content when you need it later.`;
6233
6238
  }
@@ -8944,7 +8949,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
8944
8949
  import { join as join3 } from "path";
8945
8950
  import { existsSync as existsSync3 } from "fs";
8946
8951
  import { homedir as homedir3 } from "os";
8947
- var LOG_VERSION = true ? "1.14.17-pr.304.12" : "dev";
8952
+ var LOG_VERSION = true ? "1.14.17-pr.304.13" : "dev";
8948
8953
  var Logger = class {
8949
8954
  logDir;
8950
8955
  enabled;
@@ -9272,7 +9277,7 @@ Rules:
9272
9277
  BATCHING
9273
9278
  When multiple independent ranges are ready and their boundaries do not overlap, include all of them as separate entries in the \`content\` array of a single tool call. Each entry should have its own \`startId\`, \`endId\`, and \`summary\`.
9274
9279
 
9275
- When the ranges cover unrelated topics, give each entry its own \`topic\` for better summary quality \u2014 do not force unrelated content under a single shared topic. The top-level \`topic\` is an optional fallback; when no topic is provided at all, one is derived from the summary's first line automatically.
9280
+ When the ranges cover unrelated topics, give each entry its own \`topic\` for better summary quality \u2014 do not force unrelated content under a single shared topic. Omit the top-level \`topic\` when every entry has its own. Use the top-level \`topic\` only as a fallback when entries don't specify one.
9276
9281
 
9277
9282
  \`\`\`
9278
9283
  compress({ content: [