@cfio/cohort-sync 0.31.6 → 0.31.7

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
@@ -11971,6 +11971,7 @@ var acknowledgeCommandRef = makeFunctionReference("gatewayCommands:acknowledgeCo
11971
11971
  var failCommandRef = makeFunctionReference("gatewayCommands:failCommand");
11972
11972
  var getChannelsForPlugin = makeFunctionReference("cloudGatewayChannels:listForPlugin");
11973
11973
  var addCommentFromPluginRef = makeFunctionReference("comments:addCommentFromPlugin");
11974
+ var transitionFromPluginRef = makeFunctionReference("tasks:transitionFromPlugin");
11974
11975
  async function pushTelemetry(apiKey2, data) {
11975
11976
  if (authCircuitOpen) return;
11976
11977
  const c = getClient();
@@ -12073,6 +12074,30 @@ async function callAddCommentFromPlugin(apiKey2, args) {
12073
12074
  throw err;
12074
12075
  }
12075
12076
  }
12077
+ async function callTransitionFromPlugin(apiKey2, args) {
12078
+ if (authCircuitOpen) {
12079
+ throw new Error(
12080
+ 'cohort-sync: API key rejected \u2014 all outbound mutations disabled until gateway restart.\n 1. Create a new key at https://my.cohort.bot/settings/api-keys\n 2. Run: openclaw config set plugins.entries.cohort-sync.config.apiKey "ch_live_..."'
12081
+ );
12082
+ }
12083
+ const c = getClient();
12084
+ if (!c) {
12085
+ throw new Error("Convex client not initialized \u2014 subscription may not be active");
12086
+ }
12087
+ try {
12088
+ return await c.mutation(transitionFromPluginRef, {
12089
+ apiKeyHash: hashApiKey(apiKey2),
12090
+ taskNumber: args.taskNumber,
12091
+ agentName: args.agentName,
12092
+ targetStatus: args.targetStatus
12093
+ });
12094
+ } catch (err) {
12095
+ if (isUnauthorizedError(err)) {
12096
+ tripAuthCircuit();
12097
+ }
12098
+ throw err;
12099
+ }
12100
+ }
12076
12101
  var DEFAULT_BEHAVIORAL_PROMPT = `BEFORE RESPONDING:
12077
12102
  - Does your planned response address the task's stated scope? If not, do not comment.
12078
12103
  - Do not post acknowledgment-only responses ("got it", "sounds good", "confirmed"). If you have no new information to add, do not comment.
@@ -13640,7 +13665,7 @@ function dumpEvent(event) {
13640
13665
  function positiveNumber(value) {
13641
13666
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
13642
13667
  }
13643
- var PLUGIN_VERSION = true ? "0.31.6" : "unknown";
13668
+ var PLUGIN_VERSION = true ? "0.31.7" : "unknown";
13644
13669
  function resolveGatewayToken(api) {
13645
13670
  const token2 = api.config?.gateway?.auth?.token;
13646
13671
  return typeof token2 === "string" ? token2 : null;
@@ -14832,7 +14857,8 @@ Do not attempt more comments until tomorrow.`);
14832
14857
  }
14833
14858
  };
14834
14859
  });
14835
- api.registerTool(() => {
14860
+ api.registerTool((toolCtx) => {
14861
+ const agentId = toolCtx.agentId ?? "main";
14836
14862
  return {
14837
14863
  name: "cohort_transition",
14838
14864
  label: "cohort_transition",
@@ -14850,21 +14876,13 @@ Do not attempt more comments until tomorrow.`);
14850
14876
  if (!validStatuses.includes(params.status)) {
14851
14877
  return textResult(`Invalid status "${params.status}". Valid statuses: ${validStatuses.join(", ")}`);
14852
14878
  }
14879
+ const agentName = rt.resolveAgentName(agentId);
14853
14880
  try {
14854
- const res = await fetch(`${rt.apiUrl}/api/v1/tasks/${params.task_number}/transition`, {
14855
- method: "POST",
14856
- headers: {
14857
- "Authorization": `Bearer ${rt.apiKey}`,
14858
- "Content-Type": "application/json"
14859
- },
14860
- body: JSON.stringify({ to: params.status }),
14861
- signal: AbortSignal.timeout(1e4)
14881
+ await callTransitionFromPlugin(rt.apiKey, {
14882
+ taskNumber: params.task_number,
14883
+ agentName,
14884
+ targetStatus: params.status
14862
14885
  });
14863
- if (!res.ok) {
14864
- const body = await res.text();
14865
- return textResult(`Failed to transition task #${params.task_number} to "${params.status}": ${res.status} ${body.slice(0, 200)}`);
14866
- }
14867
- const task = await res.json();
14868
14886
  return textResult(`Task #${params.task_number} transitioned to "${params.status}".`);
14869
14887
  } catch (err) {
14870
14888
  return textResult(`Failed to transition task #${params.task_number}: ${err instanceof Error ? err.message : String(err)}`);
@@ -14872,8 +14890,7 @@ Do not attempt more comments until tomorrow.`);
14872
14890
  }
14873
14891
  };
14874
14892
  });
14875
- api.registerTool((toolCtx) => {
14876
- const agentId = toolCtx.agentId ?? "main";
14893
+ api.registerTool(() => {
14877
14894
  return {
14878
14895
  name: "cohort_assign",
14879
14896
  label: "cohort_assign",
@@ -14905,7 +14922,7 @@ Do not attempt more comments until tomorrow.`);
14905
14922
  const body = await res.text();
14906
14923
  return textResult(`Failed to assign task #${params.task_number}: ${res.status} ${body.slice(0, 200)}`);
14907
14924
  }
14908
- const task = await res.json();
14925
+ await res.json();
14909
14926
  const msg = assignee ? `Task #${params.task_number} assigned to ${assignee}.` : `Task #${params.task_number} unassigned.`;
14910
14927
  return textResult(msg);
14911
14928
  } catch (err) {
@@ -72,5 +72,5 @@
72
72
  }
73
73
  }
74
74
  },
75
- "version": "0.31.6"
75
+ "version": "0.31.7"
76
76
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.31.6",
3
+ "version": "0.31.7",
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.6",
3
+ "version": "0.31.7",
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",