@cfio/cohort-sync 0.31.1 → 0.31.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 CHANGED
@@ -11923,6 +11923,34 @@ function isUnauthorizedError(err) {
11923
11923
  if (!data || typeof data !== "object") return false;
11924
11924
  return data.code === "UNAUTHORIZED";
11925
11925
  }
11926
+ function isRecord(value) {
11927
+ return typeof value === "object" && value !== null;
11928
+ }
11929
+ function appErrorMessageFromData(data) {
11930
+ if (!isRecord(data)) return null;
11931
+ return typeof data.message === "string" ? data.message : null;
11932
+ }
11933
+ function getConvexAppErrorMessage(err) {
11934
+ if (err instanceof ConvexError) {
11935
+ const message = appErrorMessageFromData(err.data);
11936
+ if (message) return message;
11937
+ }
11938
+ if (isRecord(err)) {
11939
+ const message = appErrorMessageFromData(err.data);
11940
+ if (message) return message;
11941
+ }
11942
+ if (err instanceof Error) {
11943
+ const prefix = "Uncaught ConvexError: ";
11944
+ if (err.message.startsWith(prefix)) {
11945
+ try {
11946
+ return appErrorMessageFromData(JSON.parse(err.message.slice(prefix.length)));
11947
+ } catch {
11948
+ return null;
11949
+ }
11950
+ }
11951
+ }
11952
+ return null;
11953
+ }
11926
11954
  function tripAuthCircuit() {
11927
11955
  if (authCircuitOpen) return;
11928
11956
  authCircuitOpen = true;
@@ -13561,7 +13589,7 @@ function dumpCtx(ctx) {
13561
13589
  function dumpEvent(event) {
13562
13590
  return dumpCtx(event);
13563
13591
  }
13564
- var PLUGIN_VERSION = true ? "0.31.1" : "unknown";
13592
+ var PLUGIN_VERSION = true ? "0.31.2" : "unknown";
13565
13593
  function resolveGatewayToken(api) {
13566
13594
  const token = api.config?.gateway?.auth?.token;
13567
13595
  return typeof token === "string" ? token : null;
@@ -13983,8 +14011,7 @@ function registerHookHandlers(api, logger, getState) {
13983
14011
  failureKind: event.failureKind
13984
14012
  });
13985
14013
  try {
13986
- const agentId = ctx.agentId ?? "main";
13987
- const agentName = state.resolveAgentName(agentId);
14014
+ const agentName = resolveAgentFromContext(state, ctx);
13988
14015
  const entry = buildActivityEntry(agentName, "model_call_ended", {
13989
14016
  outcome: event.outcome,
13990
14017
  errorCategory: event.errorCategory,
@@ -14631,7 +14658,10 @@ var plugin = definePluginEntry({
14631
14658
  }
14632
14659
  return textResult(lines.join("\n"), result);
14633
14660
  } catch (err) {
14634
- const msg = err instanceof Error ? err.message : String(err);
14661
+ const msg = [
14662
+ getConvexAppErrorMessage(err),
14663
+ err instanceof Error ? err.message : String(err)
14664
+ ].filter(Boolean).join("\n");
14635
14665
  if (msg.includes("AGENT_COMMENTS_LOCKED")) {
14636
14666
  return textResult(`Cannot comment on task #${params.task_number}.
14637
14667
  Reason: Agent comments are locked on this task.
@@ -72,5 +72,5 @@
72
72
  }
73
73
  }
74
74
  },
75
- "version": "0.31.1"
75
+ "version": "0.31.2"
76
76
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.31.1",
3
+ "version": "0.31.2",
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.1",
3
+ "version": "0.31.2",
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",