@cfio/cohort-sync 0.31.0 → 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
@@ -11811,7 +11811,9 @@ async function executeCommand(cmd, gwClient, cfg, resolveAgentName, logger, cron
11811
11811
  const patch = {};
11812
11812
  if (cmd.payload?.name) patch.name = cmd.payload.name;
11813
11813
  if (cmd.payload?.schedule) patch.schedule = cmd.payload.schedule;
11814
- if (cmd.payload?.message) patch.payload = { kind: "agentTurn", message: cmd.payload.message };
11814
+ if (cmd.payload?.message !== void 0) {
11815
+ patch.payload = { kind: "agentTurn", message: cmd.payload.message };
11816
+ }
11815
11817
  if (cmd.payload?.agentId) patch.agentId = reverseResolveAgentName(cmd.payload.agentId, nameMap);
11816
11818
  await gwClient.request("cron.update", {
11817
11819
  jobId: cmd.payload?.jobId,
@@ -11921,6 +11923,34 @@ function isUnauthorizedError(err) {
11921
11923
  if (!data || typeof data !== "object") return false;
11922
11924
  return data.code === "UNAUTHORIZED";
11923
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
+ }
11924
11954
  function tripAuthCircuit() {
11925
11955
  if (authCircuitOpen) return;
11926
11956
  authCircuitOpen = true;
@@ -13559,7 +13589,7 @@ function dumpCtx(ctx) {
13559
13589
  function dumpEvent(event) {
13560
13590
  return dumpCtx(event);
13561
13591
  }
13562
- var PLUGIN_VERSION = true ? "0.31.0" : "unknown";
13592
+ var PLUGIN_VERSION = true ? "0.31.2" : "unknown";
13563
13593
  function resolveGatewayToken(api) {
13564
13594
  const token = api.config?.gateway?.auth?.token;
13565
13595
  return typeof token === "string" ? token : null;
@@ -13981,8 +14011,7 @@ function registerHookHandlers(api, logger, getState) {
13981
14011
  failureKind: event.failureKind
13982
14012
  });
13983
14013
  try {
13984
- const agentId = ctx.agentId ?? "main";
13985
- const agentName = state.resolveAgentName(agentId);
14014
+ const agentName = resolveAgentFromContext(state, ctx);
13986
14015
  const entry = buildActivityEntry(agentName, "model_call_ended", {
13987
14016
  outcome: event.outcome,
13988
14017
  errorCategory: event.errorCategory,
@@ -14629,7 +14658,10 @@ var plugin = definePluginEntry({
14629
14658
  }
14630
14659
  return textResult(lines.join("\n"), result);
14631
14660
  } catch (err) {
14632
- 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");
14633
14665
  if (msg.includes("AGENT_COMMENTS_LOCKED")) {
14634
14666
  return textResult(`Cannot comment on task #${params.task_number}.
14635
14667
  Reason: Agent comments are locked on this task.
@@ -72,5 +72,5 @@
72
72
  }
73
73
  }
74
74
  },
75
- "version": "0.31.0"
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.0",
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.0",
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",