@cfio/cohort-sync 0.31.4 → 0.31.6

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
@@ -12083,7 +12083,9 @@ var ATMENTION_RESPONSE_PROMPT = `YOU WERE DIRECTLY @-MENTIONED. RESPOND.
12083
12083
  - Reply in your own voice (see your persona in IDENTITY.md).
12084
12084
  - If you need more context, fetch it via cohort_task before replying \u2014 then reply with what you found and your next step.
12085
12085
  - A brief, honest reply is better than no reply. If you genuinely have nothing to add, say so explicitly in a comment \u2014 don't go silent.
12086
- - If the mention is a question, answer it. If it's a request, acknowledge what you'll do (and then do it).`;
12086
+ - If the mention is a question, answer it. If it's a request, acknowledge what you'll do (and then do it).
12087
+ - For coding requests, do not stop at local implementation; source scripts/agent-dev-env.sh, push your branch, open a PR, enable auto-merge, watch CI until green or red, confirm the PR merged, verify the production deploy with gh run watch, and then comment with the PR link plus verification evidence.
12088
+ - Do not stop because Vercel CLI is not authenticated; Cohort deploys through GitHub Actions after merge.`;
12087
12089
  var TOOLS_REFERENCE = `
12088
12090
  TOOLS: Use these \u2014 do NOT call the REST API directly.
12089
12091
  - cohort_comment(task_number, comment) \u2014 post a comment
@@ -13635,7 +13637,10 @@ function dumpCtx(ctx) {
13635
13637
  function dumpEvent(event) {
13636
13638
  return dumpCtx(event);
13637
13639
  }
13638
- var PLUGIN_VERSION = true ? "0.31.4" : "unknown";
13640
+ function positiveNumber(value) {
13641
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
13642
+ }
13643
+ var PLUGIN_VERSION = true ? "0.31.6" : "unknown";
13639
13644
  function resolveGatewayToken(api) {
13640
13645
  const token2 = api.config?.gateway?.auth?.token;
13641
13646
  return typeof token2 === "string" ? token2 : null;
@@ -13979,10 +13984,6 @@ function registerHookHandlers(api, logger, getState) {
13979
13984
  state.logger.debug("cohort-sync: resolve agent: result", { method: "fallback_main", resolved });
13980
13985
  return resolved;
13981
13986
  }
13982
- function isHeartbeatCronSession(ctx) {
13983
- const sessionKey = ctx.sessionKey ?? ctx.sessionId;
13984
- return typeof sessionKey === "string" && sessionKey.includes(":cron:heartbeat");
13985
- }
13986
13987
  api.on("agent_end", async (event, ctx) => {
13987
13988
  const state = getState();
13988
13989
  if (!state) return;
@@ -14055,15 +14056,6 @@ function registerHookHandlers(api, logger, getState) {
14055
14056
  if (!state) return;
14056
14057
  if (event?.outcome !== "error") return;
14057
14058
  const { logger: log } = state;
14058
- if (isHeartbeatCronSession(ctx)) {
14059
- log.debug("cohort-sync: suppressing heartbeat model error activity", {
14060
- provider: event.provider,
14061
- errorCategory: event.errorCategory,
14062
- failureKind: event.failureKind,
14063
- sessionKey: ctx.sessionKey
14064
- });
14065
- return;
14066
- }
14067
14059
  log.debug("cohort-sync: hook: model_call_ended (error)", {
14068
14060
  provider: event.provider,
14069
14061
  errorCategory: event.errorCategory,
@@ -14091,7 +14083,8 @@ function registerHookHandlers(api, logger, getState) {
14091
14083
  const { cfg, tracker, logger: log } = state;
14092
14084
  const usage = normalizeLlmUsage(event.usage);
14093
14085
  const model = event.model ?? state.resolveModel(ctx.agentId ?? "main");
14094
- const contextLimit = state.getModelContextLimit(model);
14086
+ const contextLimit = positiveNumber(event.contextTokenBudget) ?? state.getModelContextLimit(model);
14087
+ const contextTokens = usage.contextTokens || positiveNumber(event.contextWindowReferenceTokens) || 0;
14095
14088
  const agentId = ctx.agentId ?? "main";
14096
14089
  const agentName = state.resolveAgentName(agentId);
14097
14090
  try {
@@ -14106,7 +14099,7 @@ function registerHookHandlers(api, logger, getState) {
14106
14099
  tokensOut: usage.outputTokens,
14107
14100
  cacheReadTokens: usage.cachedInputTokens,
14108
14101
  cacheWriteTokens: usage.cacheWriteTokens,
14109
- contextTokens: usage.contextTokens,
14102
+ contextTokens,
14110
14103
  contextLimit
14111
14104
  });
14112
14105
  tracker.updateSessionKey(agentName, sessionKey);
@@ -14602,7 +14595,8 @@ var POCKET_GUIDE = `# Cohort Agent Guide (Pocket Version)
14602
14595
  - You cannot transition tasks to "done" unless your workspace admin has enabled it. Only humans close tasks by default.
14603
14596
  - When moving to "in_progress", you are claiming ownership \u2014 only claim tasks you can actively work on.
14604
14597
  - When moving to "waiting", comment what you are blocked on and who/what can unblock you.
14605
- - When work is complete, comment with evidence: PR link, test output, or summary of changes.
14598
+ - For code changes, work is not complete when it is implemented locally; push your branch, open a PR, enable auto-merge, watch CI until green or red, confirm the PR merged, verify the production deploy, then comment with the PR link, deploy result, and verification evidence.
14599
+ - Use GitHub for deployment: after opening the PR, run gh pr merge --auto --rebase --delete-branch, gh pr checks <PR> --watch, confirm the merge, then run gh run watch <deploy-run-id> for the Deploy Production workflow. Do not stop because Vercel CLI is not authenticated; Cohort deploys through GitHub Actions after merge.
14606
14600
 
14607
14601
  ## Comments
14608
14602
  - Comment before every status transition explaining what happened.
@@ -14621,6 +14615,9 @@ var POCKET_GUIDE = `# Cohort Agent Guide (Pocket Version)
14621
14615
  - If rate limited (429), wait per Retry-After header.
14622
14616
  - If 404, verify you are using the correct task number or ID (both accepted).
14623
14617
  - If 500, retry once after a brief pause. If it fails again, stop and report.
14618
+ - At the start of repository work, run source scripts/agent-dev-env.sh from the repo root so nvm, pnpm, gh, and Homebrew tools are on PATH.
14619
+ - A dirty checkout, missing node_modules, missing local test dependencies, or unrelated local type errors are environment snags, not a reason to stop; fix the local environment when practical, otherwise push the branch and use CI to get a clean signal.
14620
+ - Do not stop at implemented locally. Keep going until the code is reviewed by CI, merged, deployed, and verified, or until you have a concrete external blocker you cannot resolve.
14624
14621
 
14625
14622
  ## What Not To Do
14626
14623
  - Don't poll /tasks in a loop \u2014 check assignments, then do your work.
@@ -72,5 +72,5 @@
72
72
  }
73
73
  }
74
74
  },
75
- "version": "0.31.4"
75
+ "version": "0.31.6"
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.6",
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.6",
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",