opencode-acp 1.18.5-pr.408.227 → 1.18.5-pr.413.228

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
@@ -6621,7 +6621,7 @@ function restoreCompressionState(state, snapshot) {
6621
6621
  state.prune.messages = structuredClone(snapshot.messages);
6622
6622
  state.stats = { ...snapshot.stats };
6623
6623
  }
6624
- async function prepareSession(ctx, toolCtx, title) {
6624
+ async function requestCompressPermission(toolCtx, title) {
6625
6625
  await toolCtx.ask({
6626
6626
  permission: "compress",
6627
6627
  patterns: ["*"],
@@ -6629,6 +6629,11 @@ async function prepareSession(ctx, toolCtx, title) {
6629
6629
  metadata: {}
6630
6630
  });
6631
6631
  toolCtx.metadata({ title });
6632
+ }
6633
+ async function prepareSession(ctx, toolCtx, title, opts) {
6634
+ if (!opts?.preApproved) {
6635
+ await requestCompressPermission(toolCtx, title);
6636
+ }
6632
6637
  const rawMessages = await fetchSessionMessages(ctx.client, toolCtx.sessionID);
6633
6638
  await ensureSessionInitialized(
6634
6639
  ctx.client,
@@ -8254,11 +8259,13 @@ function createCompressRangeTool(factoryCtx) {
8254
8259
  }
8255
8260
  }
8256
8261
  const callId = typeof toolCtx.callID === "string" ? toolCtx.callID : void 0;
8262
+ const title = `Compress Range: ${input.topic ?? "(batch)"}`;
8257
8263
  const run = async () => {
8258
8264
  const { rawMessages, searchContext } = await prepareSession(
8259
8265
  ctx0,
8260
8266
  toolCtx,
8261
- `Compress Range: ${input.topic ?? "(batch)"}`
8267
+ title,
8268
+ { preApproved: true }
8262
8269
  );
8263
8270
  const { providerId, modelId } = getModelInfo(rawMessages);
8264
8271
  const ctx = {
@@ -8490,6 +8497,7 @@ function createCompressRangeTool(factoryCtx) {
8490
8497
  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.
8491
8498
  \u{1F4A1} Tip: Use search_context('keyword') to find compressed content when you need it later.`;
8492
8499
  };
8500
+ await requestCompressPermission(toolCtx, title);
8493
8501
  return factoryCtx.registry.withSessionGuard(toolCtx.sessionID, () => run());
8494
8502
  }
8495
8503
  });
@@ -10342,14 +10350,10 @@ function extractTextContent(msg) {
10342
10350
  }
10343
10351
 
10344
10352
  // lib/compress/decompress.ts
10345
- async function prepareDecompressSession(ctx, toolCtx) {
10346
- await toolCtx.ask({
10347
- permission: "compress",
10348
- patterns: ["*"],
10349
- always: ["*"],
10350
- metadata: {}
10351
- });
10352
- toolCtx.metadata({ title: "Decompress" });
10353
+ async function prepareDecompressSession(ctx, toolCtx, opts) {
10354
+ if (!opts?.preApproved) {
10355
+ await requestCompressPermission(toolCtx, "Decompress");
10356
+ }
10353
10357
  const rawMessages = await fetchSessionMessages(ctx.client, toolCtx.sessionID);
10354
10358
  await ensureSessionInitialized(
10355
10359
  ctx.client,
@@ -10527,7 +10531,7 @@ function createDecompressTool(factoryCtx) {
10527
10531
  async execute(args, toolCtx) {
10528
10532
  const ctx = resolveToolContext(factoryCtx, toolCtx.sessionID);
10529
10533
  const run = async () => {
10530
- const { rawMessages } = await prepareDecompressSession(ctx, toolCtx);
10534
+ const { rawMessages } = await prepareDecompressSession(ctx, toolCtx, { preApproved: true });
10531
10535
  const effectiveLimitBefore = resolveEffectiveContextLimit(ctx.state, ctx.config);
10532
10536
  const contextUsageBefore = effectiveLimitBefore ? Math.round(
10533
10537
  getCurrentTokenUsage(ctx.state, rawMessages) / effectiveLimitBefore.limit * 100
@@ -10661,6 +10665,7 @@ function createDecompressTool(factoryCtx) {
10661
10665
  });
10662
10666
  return lines.join("\n");
10663
10667
  };
10668
+ await requestCompressPermission(toolCtx, "Decompress");
10664
10669
  return factoryCtx.registry.withSessionGuard(toolCtx.sessionID, () => run());
10665
10670
  }
10666
10671
  });
@@ -11419,7 +11424,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
11419
11424
  import { join as join5 } from "path";
11420
11425
  import { existsSync as existsSync5 } from "fs";
11421
11426
  import { homedir as homedir3 } from "os";
11422
- var LOG_VERSION = true ? "1.18.5-pr.408.227" : "dev";
11427
+ var LOG_VERSION = true ? "1.18.5-pr.413.228" : "dev";
11423
11428
  var LEVEL_RANK = {
11424
11429
  debug: 10,
11425
11430
  info: 20,
@@ -14235,7 +14240,7 @@ var server = (async (ctx) => {
14235
14240
  }
14236
14241
  const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
14237
14242
  logger.info("ACP plugin initialized", {
14238
- version: true ? "1.18.5-pr.408.227" : "dev",
14243
+ version: true ? "1.18.5-pr.413.228" : "dev",
14239
14244
  workspace: ctx.directory,
14240
14245
  logLevel: logger.level,
14241
14246
  debug: config.debug,