@clwnd/opencode 0.12.0 → 0.12.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.
Files changed (2) hide show
  1. package/dist/index.js +9 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -676,6 +676,7 @@ function isBrokeredToolReturn(prompt) {
676
676
  return false;
677
677
  }
678
678
  var sessionLastAgent = /* @__PURE__ */ new Map();
679
+ var sessionPetalCounts = /* @__PURE__ */ new Map();
679
680
  function detectAgent(sid, headers) {
680
681
  const raw = headers?.["x-clwnd-agent"] ?? null;
681
682
  if (!raw) return null;
@@ -860,6 +861,14 @@ var ClwndModel = class {
860
861
  const listenOnly = !!isPermReturn;
861
862
  const priorPetals = opts.prompt.filter((m) => m.role === "user" || m.role === "assistant" || m.role === "tool");
862
863
  trace("priorPetals", { sid, count: priorPetals.length, roles: priorPetals.map((m) => m.role).join(",") });
864
+ if (!isAux) {
865
+ const prev = sessionPetalCounts.get(sid) ?? 0;
866
+ sessionPetalCounts.set(sid, priorPetals.length);
867
+ if (prev > 0 && priorPetals.length < prev * 0.5) {
868
+ trace("compaction.detected", { sid, prev, now: priorPetals.length });
869
+ hum({ chi: "cancel", sid, reason: "compaction" });
870
+ }
871
+ }
863
872
  const externalTools = [];
864
873
  const externalToolNames = /* @__PURE__ */ new Set();
865
874
  if (opts.tools) {
@@ -1278,10 +1287,6 @@ var clwndPlugin = async (input) => {
1278
1287
  return JSON.stringify({ granted: true, tool: args.tool, askId });
1279
1288
  }
1280
1289
  })
1281
- },
1282
- "experimental.session.compacting": async (input2, _output) => {
1283
- trace("compaction.started", { sessionId: input2.sessionID });
1284
- hum({ chi: "cancel", sid: input2.sessionID, reason: "compaction" });
1285
1290
  }
1286
1291
  };
1287
1292
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clwnd/opencode",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "clwnd for opencode",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",