@clwnd/opencode 0.15.0 → 0.15.2
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 +28 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -645,6 +645,7 @@ function extractContent(prompt, sessionId) {
|
|
|
645
645
|
} else {
|
|
646
646
|
parts.splice(j, 1);
|
|
647
647
|
}
|
|
648
|
+
pendingPenny.reminderStripped++;
|
|
648
649
|
trace("reminder.stripped", { sid: sessionId });
|
|
649
650
|
} else {
|
|
650
651
|
lastReminder.set(sessionId, key);
|
|
@@ -827,6 +828,23 @@ var lastAllowedTools = /* @__PURE__ */ new Map();
|
|
|
827
828
|
var lastSystemPromptHash = /* @__PURE__ */ new Map();
|
|
828
829
|
var lastPermissionsHash = /* @__PURE__ */ new Map();
|
|
829
830
|
var lastAllowedToolsHash = /* @__PURE__ */ new Map();
|
|
831
|
+
var pendingPenny = {
|
|
832
|
+
humDedup: 0,
|
|
833
|
+
reminderStripped: 0,
|
|
834
|
+
priorPetalsElided: 0,
|
|
835
|
+
auxModelRouted: 0
|
|
836
|
+
};
|
|
837
|
+
function flushPenny() {
|
|
838
|
+
if (pendingPenny.humDedup === 0 && pendingPenny.reminderStripped === 0 && pendingPenny.priorPetalsElided === 0 && pendingPenny.auxModelRouted === 0) {
|
|
839
|
+
return void 0;
|
|
840
|
+
}
|
|
841
|
+
const snap = { ...pendingPenny };
|
|
842
|
+
pendingPenny.humDedup = 0;
|
|
843
|
+
pendingPenny.reminderStripped = 0;
|
|
844
|
+
pendingPenny.priorPetalsElided = 0;
|
|
845
|
+
pendingPenny.auxModelRouted = 0;
|
|
846
|
+
return snap;
|
|
847
|
+
}
|
|
830
848
|
function cheapHash(s) {
|
|
831
849
|
let h = 5381;
|
|
832
850
|
for (let i = 0; i < s.length; i++) h = (h << 5) + h + s.charCodeAt(i) | 0;
|
|
@@ -955,7 +973,10 @@ var ClwndModel = class {
|
|
|
955
973
|
const skipGraft = isEmptyTools;
|
|
956
974
|
if (skipGraft) trace("graft.skip", { method: "doStream", sid, reason: "emptyTools", toolsLen: opts.tools?.length ?? "undefined" });
|
|
957
975
|
const effectiveModel = isEmptyTools ? pickAuxModel(self.modelId) : self.modelId;
|
|
958
|
-
if (effectiveModel !== self.modelId)
|
|
976
|
+
if (effectiveModel !== self.modelId) {
|
|
977
|
+
pendingPenny.auxModelRouted++;
|
|
978
|
+
trace("aux.model.routed", { sid, primary: self.modelId, aux: effectiveModel });
|
|
979
|
+
}
|
|
959
980
|
const systemPromptHash = cheapHash(systemPrompt);
|
|
960
981
|
const permissionsHash = cheapHash(JSON.stringify(permissions));
|
|
961
982
|
const allowedToolsHash = cheapHash(allowedTools.join(","));
|
|
@@ -965,6 +986,7 @@ var ClwndModel = class {
|
|
|
965
986
|
if (sendSystemPrompt) lastSystemPromptHash.set(sid, systemPromptHash);
|
|
966
987
|
if (sendPermissions) lastPermissionsHash.set(sid, permissionsHash);
|
|
967
988
|
if (sendAllowedTools) lastAllowedToolsHash.set(sid, allowedToolsHash);
|
|
989
|
+
if (!sendSystemPrompt || !sendPermissions || !sendAllowedTools) pendingPenny.humDedup++;
|
|
968
990
|
trace("hum.dedup", { sid, sp: sendSystemPrompt, perm: sendPermissions, tools: sendAllowedTools });
|
|
969
991
|
let permAskId = null;
|
|
970
992
|
const isPermReturn = isBrokeredToolReturn(opts.prompt) && (() => {
|
|
@@ -1020,6 +1042,7 @@ var ClwndModel = class {
|
|
|
1020
1042
|
hum({ chi: "cancel", sid, reason: "compaction" });
|
|
1021
1043
|
} else if (prevPetalCount === priorPetals.length && prevPetalCount > 0) {
|
|
1022
1044
|
elidePriorPetals = true;
|
|
1045
|
+
pendingPenny.priorPetalsElided++;
|
|
1023
1046
|
trace("priorPetals.elided", { sid, count: priorPetals.length });
|
|
1024
1047
|
}
|
|
1025
1048
|
}
|
|
@@ -1039,12 +1062,14 @@ var ClwndModel = class {
|
|
|
1039
1062
|
if (externalTools.length > 0) trace("external.tools.detected", { sid, names: [...externalToolNames].join(",") });
|
|
1040
1063
|
let promptSent = false;
|
|
1041
1064
|
if (listenOnly && humAlive) {
|
|
1065
|
+
const pd = flushPenny();
|
|
1042
1066
|
hum({
|
|
1043
1067
|
chi: "prompt",
|
|
1044
1068
|
sid,
|
|
1045
1069
|
cwd,
|
|
1046
1070
|
modelId: effectiveModel,
|
|
1047
1071
|
listenOnly: true,
|
|
1072
|
+
...pd ? { pennyDelta: pd } : {},
|
|
1048
1073
|
dusk: duskIn(3e4)
|
|
1049
1074
|
});
|
|
1050
1075
|
promptSent = true;
|
|
@@ -1053,6 +1078,7 @@ var ClwndModel = class {
|
|
|
1053
1078
|
hum({ chi: "release-permit", askId: permAskId, decision: "allow" });
|
|
1054
1079
|
}
|
|
1055
1080
|
} else if (!listenOnly && humAlive) {
|
|
1081
|
+
const pd = flushPenny();
|
|
1056
1082
|
hum({
|
|
1057
1083
|
chi: "prompt",
|
|
1058
1084
|
sid,
|
|
@@ -1070,6 +1096,7 @@ var ClwndModel = class {
|
|
|
1070
1096
|
externalTools: externalTools.length > 0 ? externalTools : void 0,
|
|
1071
1097
|
mcpServerConfigs: await getMcpServerConfigs(this.config.client),
|
|
1072
1098
|
visibleTools: allToolNames,
|
|
1099
|
+
...pd ? { pennyDelta: pd } : {},
|
|
1073
1100
|
dusk: duskIn(3e4)
|
|
1074
1101
|
});
|
|
1075
1102
|
promptSent = true;
|