@clwnd/opencode 0.15.6 → 0.15.7

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 +18 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17,7 +17,8 @@ var DEFAULTS = {
17
17
  smallModel: "",
18
18
  permissionDusk: 6e4,
19
19
  droned: false,
20
- droneModel: { providerID: "opencode-clwnd", modelID: "claude-haiku-4-5" }
20
+ droneModel: { providerID: "opencode-clwnd", modelID: "claude-haiku-4-5" },
21
+ ocCompaction: false
21
22
  };
22
23
  var CONFIG_PATHS = [
23
24
  join(process.env.XDG_CONFIG_HOME ?? join(process.env.HOME ?? "/", ".config"), "clwnd", "clwnd.json")
@@ -34,7 +35,8 @@ function loadConfig() {
34
35
  smallModel: raw.smallModel ?? DEFAULTS.smallModel,
35
36
  permissionDusk: raw.permissionDusk ?? DEFAULTS.permissionDusk,
36
37
  droned: raw.droned ?? DEFAULTS.droned,
37
- droneModel: raw.droneModel ?? DEFAULTS.droneModel
38
+ droneModel: raw.droneModel ?? DEFAULTS.droneModel,
39
+ ocCompaction: raw.ocCompaction ?? DEFAULTS.ocCompaction
38
40
  };
39
41
  return cached;
40
42
  } catch {
@@ -474,7 +476,7 @@ function defaultSocketPath() {
474
476
  var HUM_PATH = (process.env.CLWND_SOCKET ?? defaultSocketPath()) + ".hum";
475
477
  var humSocket = null;
476
478
  var humEcho = "";
477
- var humHearer = null;
479
+ var humHearers = /* @__PURE__ */ new Map();
478
480
  var humAlive = false;
479
481
  var humReady = null;
480
482
  var humAwaken = awakenHum();
@@ -552,7 +554,11 @@ async function awakenHum() {
552
554
  trace("hum.pulse", { kind: msg.kind, sid: msg.sid });
553
555
  continue;
554
556
  }
555
- if (humHearer) humHearer(msg);
557
+ const msgSid = typeof msg.sid === "string" ? msg.sid : void 0;
558
+ if (msgSid) {
559
+ const h = humHearers.get(msgSid);
560
+ if (h) h(msg);
561
+ }
556
562
  } catch {
557
563
  }
558
564
  }
@@ -594,15 +600,15 @@ function hum(msg) {
594
600
  writeLog("trace", "hum.send.failed", { err: String(e) });
595
601
  }
596
602
  }
597
- function humHear(onMessage) {
603
+ function humHear(sid, onMessage) {
598
604
  return new Promise((resolve) => {
599
- humHearer = (incoming) => {
605
+ humHearers.set(sid, (incoming) => {
600
606
  onMessage(incoming);
601
607
  if (incoming.chi === "finish" || incoming.chi === "error") {
602
- humHearer = null;
608
+ humHearers.delete(sid);
603
609
  resolve();
604
610
  }
605
- };
611
+ });
606
612
  });
607
613
  }
608
614
  function extractContent(prompt, sessionId) {
@@ -996,7 +1002,8 @@ var ClwndModel = class {
996
1002
  if (!lt || !Array.isArray(lt.content)) return false;
997
1003
  for (const p of lt.content) {
998
1004
  if (p.type === "tool-result" && p.toolCallId?.startsWith("perm-")) {
999
- const rawOutput = p.output ?? p.result;
1005
+ const loose = p;
1006
+ const rawOutput = loose.output ?? loose.result;
1000
1007
  try {
1001
1008
  const outer = typeof rawOutput === "string" ? JSON.parse(rawOutput) : rawOutput;
1002
1009
  const inner = outer?.value ?? outer;
@@ -1125,6 +1132,7 @@ var ClwndModel = class {
1125
1132
  function wilt() {
1126
1133
  if (done) return;
1127
1134
  done = true;
1135
+ humHearers.delete(sid);
1128
1136
  try {
1129
1137
  controller.close();
1130
1138
  } catch {
@@ -1145,7 +1153,7 @@ var ClwndModel = class {
1145
1153
  return;
1146
1154
  }
1147
1155
  petal({ type: "stream-start", warnings: [] });
1148
- const humFade = humHear(onHummin);
1156
+ const humFade = humHear(sid, onHummin);
1149
1157
  if (!promptSent) {
1150
1158
  hum({
1151
1159
  chi: "prompt",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clwnd/opencode",
3
- "version": "0.15.6",
3
+ "version": "0.15.7",
4
4
  "description": "clwnd for opencode",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",