opencode-acp 1.18.2-pr.443.190 → 1.18.2-pr.448.192

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
@@ -10031,14 +10031,31 @@ function buildSchema2() {
10031
10031
  };
10032
10032
  }
10033
10033
  function extractMessageId(m) {
10034
- return m.id ?? m.messageId ?? "";
10034
+ return m?.info?.id ?? "";
10035
+ }
10036
+ function serializeMessagePart(part) {
10037
+ if (!part || typeof part !== "object") return null;
10038
+ if (part.type === "text") {
10039
+ return typeof part.text === "string" && part.text.length > 0 ? part.text : null;
10040
+ }
10041
+ if (part.type === "tool") {
10042
+ const contents = extractToolContent(part);
10043
+ if (contents.length === 0) return null;
10044
+ const toolName = "tool" in part && typeof part.tool === "string" && part.tool.length > 0 ? part.tool : "tool";
10045
+ return `[${toolName}] ${contents.join("\n")}`;
10046
+ }
10047
+ return null;
10035
10048
  }
10036
10049
  function extractMessageText2(m) {
10037
- const msg = m;
10038
- const role = msg.role || msg.type || "unknown";
10039
- const content = typeof msg.content === "string" ? msg.content : typeof msg.text === "string" ? msg.text : JSON.stringify(msg.content || msg.text || "");
10050
+ const role = m?.info?.role ?? "unknown";
10051
+ const parts = Array.isArray(m.parts) ? m.parts : [];
10052
+ const segments = [];
10053
+ for (const part of parts) {
10054
+ const serialized = serializeMessagePart(part);
10055
+ if (serialized !== null) segments.push(serialized);
10056
+ }
10040
10057
  return `[${role}]
10041
- ${content}`;
10058
+ ${segments.join("\n\n")}`;
10042
10059
  }
10043
10060
  function createDecompressTool(factoryCtx) {
10044
10061
  return tool3({
@@ -10090,10 +10107,18 @@ function createDecompressTool(factoryCtx) {
10090
10107
  const blockMessages = rawMessages.filter((m) => msgIdSet.has(extractMessageId(m)));
10091
10108
  const lines2 = blockMessages.map(extractMessageText2);
10092
10109
  const { writeFile: writeFile4 } = await import("fs/promises");
10093
- const fileContent = lines2.length > 0 ? lines2.join("\n\n---\n\n") : targets[0]?.blocks[0]?.summary ?? "(no content available)";
10110
+ let fileContent;
10111
+ let sourceNote;
10112
+ if (lines2.length > 0) {
10113
+ fileContent = lines2.join("\n\n---\n\n");
10114
+ sourceNote = `${blockMessages.length} original message${blockMessages.length === 1 ? "" : "s"}`;
10115
+ } else {
10116
+ fileContent = targets[0]?.blocks[0]?.summary ?? "(no content available)";
10117
+ sourceNote = `no original messages found; wrote block summary (${targets.length} block${targets.length === 1 ? "" : "s"})`;
10118
+ }
10094
10119
  await writeFile4(targetPath, fileContent, "utf-8");
10095
10120
  const displayIds2 = targets.map((t) => `b${t.displayId}`).join(", ");
10096
- return `Block(s) ${displayIds2} content (${blockMessages.length} messages, ${fileContent.length} chars) written to ${targetPath}. Block(s) stay compressed \u2014 context unchanged. Use read tool to access specific parts.`;
10121
+ return `Block(s) ${displayIds2} content (${sourceNote}, ${fileContent.length} chars) written to ${targetPath}. Block(s) stay compressed \u2014 context unchanged. Use read tool to access specific parts.`;
10097
10122
  }
10098
10123
  const activeMessagesBefore = snapshotActiveMessages(messagesState);
10099
10124
  const activeBlockIdsBefore = new Set(messagesState.activeBlockIds);
@@ -10906,7 +10931,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
10906
10931
  import { join as join4 } from "path";
10907
10932
  import { existsSync as existsSync4 } from "fs";
10908
10933
  import { homedir as homedir3 } from "os";
10909
- var LOG_VERSION = true ? "1.18.2-pr.443.190" : "dev";
10934
+ var LOG_VERSION = true ? "1.18.2-pr.448.192" : "dev";
10910
10935
  var LEVEL_RANK = {
10911
10936
  debug: 10,
10912
10937
  info: 20,
@@ -13624,7 +13649,7 @@ var server = (async (ctx) => {
13624
13649
  }
13625
13650
  const logger = new Logger(config.debug, config.debug ? "debug" : config.logLevel);
13626
13651
  logger.info("ACP plugin initialized", {
13627
- version: true ? "1.18.2-pr.443.190" : "dev",
13652
+ version: true ? "1.18.2-pr.448.192" : "dev",
13628
13653
  workspace: ctx.directory,
13629
13654
  logLevel: logger.level,
13630
13655
  debug: config.debug,