@cfio/cohort-sync 0.31.4 → 0.31.5

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
@@ -13635,7 +13635,10 @@ function dumpCtx(ctx) {
13635
13635
  function dumpEvent(event) {
13636
13636
  return dumpCtx(event);
13637
13637
  }
13638
- var PLUGIN_VERSION = true ? "0.31.4" : "unknown";
13638
+ function positiveNumber(value) {
13639
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
13640
+ }
13641
+ var PLUGIN_VERSION = true ? "0.31.5" : "unknown";
13639
13642
  function resolveGatewayToken(api) {
13640
13643
  const token2 = api.config?.gateway?.auth?.token;
13641
13644
  return typeof token2 === "string" ? token2 : null;
@@ -14091,7 +14094,8 @@ function registerHookHandlers(api, logger, getState) {
14091
14094
  const { cfg, tracker, logger: log } = state;
14092
14095
  const usage = normalizeLlmUsage(event.usage);
14093
14096
  const model = event.model ?? state.resolveModel(ctx.agentId ?? "main");
14094
- const contextLimit = state.getModelContextLimit(model);
14097
+ const contextLimit = positiveNumber(event.contextTokenBudget) ?? state.getModelContextLimit(model);
14098
+ const contextTokens = usage.contextTokens || positiveNumber(event.contextWindowReferenceTokens) || 0;
14095
14099
  const agentId = ctx.agentId ?? "main";
14096
14100
  const agentName = state.resolveAgentName(agentId);
14097
14101
  try {
@@ -14106,7 +14110,7 @@ function registerHookHandlers(api, logger, getState) {
14106
14110
  tokensOut: usage.outputTokens,
14107
14111
  cacheReadTokens: usage.cachedInputTokens,
14108
14112
  cacheWriteTokens: usage.cacheWriteTokens,
14109
- contextTokens: usage.contextTokens,
14113
+ contextTokens,
14110
14114
  contextLimit
14111
14115
  });
14112
14116
  tracker.updateSessionKey(agentName, sessionKey);
@@ -72,5 +72,5 @@
72
72
  }
73
73
  }
74
74
  },
75
- "version": "0.31.4"
75
+ "version": "0.31.5"
76
76
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.31.4",
3
+ "version": "0.31.5",
4
4
  "description": "OpenClaw plugin — syncs agent telemetry, sessions, and activity to the Cohort dashboard",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.31.4",
3
+ "version": "0.31.5",
4
4
  "description": "OpenClaw plugin — syncs agent telemetry, sessions, and activity to the Cohort dashboard",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.cohort.bot/gateway",