@clwnd/opencode 0.19.3 → 0.19.4
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 +21 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -873,6 +873,19 @@ function cheapHash(s) {
|
|
|
873
873
|
for (let i = 0; i < s.length; i++) h = (h << 5) + h + s.charCodeAt(i) | 0;
|
|
874
874
|
return h.toString(36) + ":" + s.length;
|
|
875
875
|
}
|
|
876
|
+
function clearSessionHashes(sid) {
|
|
877
|
+
lastSystemPromptHash.delete(sid);
|
|
878
|
+
lastPermissionsHash.delete(sid);
|
|
879
|
+
lastAllowedToolsHash.delete(sid);
|
|
880
|
+
lastAllowedTools.delete(sid);
|
|
881
|
+
}
|
|
882
|
+
function clearSessionState(sid) {
|
|
883
|
+
clearSessionHashes(sid);
|
|
884
|
+
sessionLastAgent.delete(sid);
|
|
885
|
+
sessionPetalCounts.delete(sid);
|
|
886
|
+
sessionJustCompacted.delete(sid);
|
|
887
|
+
lastReminder.delete(sid);
|
|
888
|
+
}
|
|
876
889
|
var AGENT_DENY = {
|
|
877
890
|
plan: /* @__PURE__ */ new Set(["do_code", "do_noncode"])
|
|
878
891
|
};
|
|
@@ -1453,6 +1466,14 @@ var clwndPlugin = async (input) => {
|
|
|
1453
1466
|
hum({ chi: "petal-cell", sid, event: etype, role, model, provider: provider2, messageId, parentId, completed });
|
|
1454
1467
|
}
|
|
1455
1468
|
}
|
|
1469
|
+
if (etype === "session.deleted") {
|
|
1470
|
+
const sid = props.sessionID ?? props.id;
|
|
1471
|
+
if (sid) {
|
|
1472
|
+
trace("session.deleted", { sid });
|
|
1473
|
+
clearSessionState(sid);
|
|
1474
|
+
hum({ chi: "cleanup", sid });
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1456
1477
|
if (loadConfig().ocCompaction && etype === "session.compacted") {
|
|
1457
1478
|
const sid = props.sessionID;
|
|
1458
1479
|
if (sid) {
|