opencode-acp 1.14.25-pr.349.71 → 1.14.25-pr.349.75

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
@@ -4243,16 +4243,16 @@ var SessionStateRegistry = class {
4243
4243
  // the process's lifetime. During a request the server is guaranteed up
4244
4244
  // (we are inside its pipeline), so on a catalog miss we retry hydration
4245
4245
  // once per process before giving up (the fallback limit then applies).
4246
- lazyHydrated = false;
4246
+ // The in-flight promise (not a boolean) lets concurrent callers await the
4247
+ // same hydration instead of skipping it.
4248
+ lazyHydration;
4247
4249
  async hydrateAndResolve(client, providerId, modelId) {
4248
4250
  const existing = this.catalog.resolve(providerId, modelId);
4249
4251
  if (existing !== void 0) {
4250
4252
  return existing;
4251
4253
  }
4252
- if (!this.lazyHydrated) {
4253
- this.lazyHydrated = true;
4254
- await this.catalog.hydrateFromClient(client);
4255
- }
4254
+ this.lazyHydration ??= this.catalog.hydrateFromClient(client);
4255
+ await this.lazyHydration;
4256
4256
  return this.catalog.resolve(providerId, modelId);
4257
4257
  }
4258
4258
  get(sessionId) {
@@ -9159,7 +9159,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
9159
9159
  import { join as join3 } from "path";
9160
9160
  import { existsSync as existsSync3 } from "fs";
9161
9161
  import { homedir as homedir3 } from "os";
9162
- var LOG_VERSION = true ? "1.14.25-pr.349.71" : "dev";
9162
+ var LOG_VERSION = true ? "1.14.25-pr.349.75" : "dev";
9163
9163
  var LEVEL_RANK = {
9164
9164
  debug: 10,
9165
9165
  info: 20,
@@ -9984,6 +9984,7 @@ var KEEP_PREFIX_CHARS = 2e3;
9984
9984
  var KEEP_SUFFIX_CHARS = 2e3;
9985
9985
  var PROTECT_RECENT_MESSAGES = 3;
9986
9986
  var OUTPUT_RESERVE_TOKENS = 16384;
9987
+ var overheadErrorLogged = /* @__PURE__ */ new Set();
9987
9988
  function parseGcThreshold(threshold, modelContextLimit) {
9988
9989
  if (typeof threshold === "number") return threshold;
9989
9990
  const str = threshold ?? "100%";
@@ -10000,12 +10001,16 @@ function truncateLargeToolOutputs(state, config, logger, messages) {
10000
10001
  const overhead = (state.systemPromptTokens ?? 0) + OUTPUT_RESERVE_TOKENS;
10001
10002
  const threshold = Math.min(configuredThreshold, effective.limit - overhead);
10002
10003
  if (threshold <= 0) {
10003
- logger.error("ACP: model context window too small to fit overhead", {
10004
- session: state.sessionId,
10005
- limit: effective.limit,
10006
- contextLimitSource: effective.source,
10007
- overhead
10008
- });
10004
+ const sessionKey = state.sessionId ?? "unknown";
10005
+ if (!overheadErrorLogged.has(sessionKey)) {
10006
+ overheadErrorLogged.add(sessionKey);
10007
+ logger.error("ACP: model context window too small to fit overhead", {
10008
+ session: state.sessionId,
10009
+ limit: effective.limit,
10010
+ contextLimitSource: effective.source,
10011
+ overhead
10012
+ });
10013
+ }
10009
10014
  return;
10010
10015
  }
10011
10016
  if (currentTokens < threshold) return;
@@ -11084,10 +11089,14 @@ function createSystemPromptHandler(registry4, logger, config, prompts) {
11084
11089
  const limit = input.model.limit.context;
11085
11090
  const providerID = input.model?.providerID;
11086
11091
  const modelID = input.model?.id;
11087
- const changed = state.modelContextLimit !== limit || state.modelProviderID !== providerID || state.modelID !== modelID;
11092
+ const changed = state.modelContextLimit !== limit || providerID !== void 0 && state.modelProviderID !== providerID || modelID !== void 0 && state.modelID !== modelID;
11088
11093
  state.modelContextLimit = limit;
11089
- state.modelProviderID = providerID;
11090
- state.modelID = modelID;
11094
+ if (providerID !== void 0) {
11095
+ state.modelProviderID = providerID;
11096
+ }
11097
+ if (modelID !== void 0) {
11098
+ state.modelID = modelID;
11099
+ }
11091
11100
  if (changed) {
11092
11101
  saveSessionState(state, logger).catch(() => {
11093
11102
  });
@@ -11650,7 +11659,7 @@ var server = (async (ctx) => {
11650
11659
  }
11651
11660
  const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
11652
11661
  logger.info("ACP plugin initialized", {
11653
- version: true ? "1.14.25-pr.349.71" : "dev",
11662
+ version: true ? "1.14.25-pr.349.75" : "dev",
11654
11663
  workspace: ctx.directory,
11655
11664
  logLevel: logger.level,
11656
11665
  debug: config.debug,