@cfio/cohort-sync 0.31.12 → 0.31.13

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
@@ -12000,6 +12000,7 @@ var failCommandRef = makeFunctionReference("gatewayCommands:failCommand");
12000
12000
  var getChannelsForPlugin = makeFunctionReference("cloudGatewayChannels:listForPlugin");
12001
12001
  var addCommentFromPluginRef = makeFunctionReference("comments:addCommentFromPlugin");
12002
12002
  var addRoomMessageFromPluginRef = makeFunctionReference("rooms:addMessageFromPlugin");
12003
+ var promptAgentsFromPluginRef = makeFunctionReference("rooms:promptAgentsFromPlugin");
12003
12004
  var transitionFromPluginRef = makeFunctionReference("tasks:transitionFromPlugin");
12004
12005
  async function pushTelemetry(apiKey2, data) {
12005
12006
  if (authCircuitOpen) return;
@@ -12127,6 +12128,31 @@ async function callAddRoomMessageFromPlugin(apiKey2, args) {
12127
12128
  throw err;
12128
12129
  }
12129
12130
  }
12131
+ async function callPromptRoomAgentsFromPlugin(apiKey2, args) {
12132
+ if (authCircuitOpen) {
12133
+ throw new Error(
12134
+ '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_..."'
12135
+ );
12136
+ }
12137
+ const c = getClient();
12138
+ if (!c) {
12139
+ throw new Error("Convex client not initialized \u2014 subscription may not be active");
12140
+ }
12141
+ try {
12142
+ return await c.mutation(promptAgentsFromPluginRef, {
12143
+ apiKeyHash: hashApiKey(apiKey2),
12144
+ roomId: args.roomId,
12145
+ moderatorAgentName: args.moderatorAgentName,
12146
+ targetAgentNames: args.targetAgentNames,
12147
+ prompt: args.prompt
12148
+ });
12149
+ } catch (err) {
12150
+ if (isUnauthorizedError(err)) {
12151
+ tripAuthCircuit();
12152
+ }
12153
+ throw err;
12154
+ }
12155
+ }
12130
12156
  async function callTransitionFromPlugin(apiKey2, args) {
12131
12157
  if (authCircuitOpen) {
12132
12158
  throw new Error(
@@ -13775,7 +13801,7 @@ function dumpEvent(event) {
13775
13801
  function positiveNumber(value) {
13776
13802
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
13777
13803
  }
13778
- var PLUGIN_VERSION = true ? "0.31.12" : "unknown";
13804
+ var PLUGIN_VERSION = true ? "0.31.13" : "unknown";
13779
13805
  function resolveGatewayToken(api) {
13780
13806
  const token2 = api.config?.gateway?.auth?.token;
13781
13807
  return typeof token2 === "string" ? token2 : null;
@@ -14930,6 +14956,62 @@ Do not attempt more comments until tomorrow.`);
14930
14956
  }
14931
14957
  };
14932
14958
  });
14959
+ api.registerTool((toolCtx) => {
14960
+ const agentId = toolCtx.agentId ?? "main";
14961
+ return {
14962
+ name: "cohort_room_prompt_agent",
14963
+ label: "cohort_room_prompt_agent",
14964
+ description: "Ask one agent in a Cohort Room to respond. Use this when you are the Room moderator and need controlled turn-taking.",
14965
+ parameters: Type.Object({
14966
+ room_id: Type.String({ description: "Room ID supplied by Cohort, e.g. rooms:abc123" }),
14967
+ agent_name: Type.String({ description: "Cohort agent name to prompt, e.g. iris" }),
14968
+ prompt: Type.String({ description: "Prompt to send to the target agent" })
14969
+ }),
14970
+ async execute(_toolCallId, params) {
14971
+ const rt = getToolRuntime();
14972
+ if (!rt.isReady) {
14973
+ return textResult("cohort_room_prompt_agent is not ready yet \u2014 the plugin is still starting up. Try again in a few seconds.");
14974
+ }
14975
+ const moderatorAgentName = rt.resolveAgentName(agentId);
14976
+ const result = await callPromptRoomAgentsFromPlugin(rt.apiKey, {
14977
+ roomId: params.room_id,
14978
+ moderatorAgentName,
14979
+ targetAgentNames: [params.agent_name],
14980
+ prompt: params.prompt
14981
+ });
14982
+ const noun = result.notificationCount === 1 ? "agent" : "agents";
14983
+ return textResult(`Prompt sent to ${result.notificationCount} Room ${noun}.`, result);
14984
+ }
14985
+ };
14986
+ });
14987
+ api.registerTool((toolCtx) => {
14988
+ const agentId = toolCtx.agentId ?? "main";
14989
+ return {
14990
+ name: "cohort_room_prompt_agents",
14991
+ label: "cohort_room_prompt_agents",
14992
+ description: "Ask multiple agents in a Cohort Room to respond in one controlled moderator action.",
14993
+ parameters: Type.Object({
14994
+ room_id: Type.String({ description: "Room ID supplied by Cohort, e.g. rooms:abc123" }),
14995
+ agent_names: Type.Array(Type.String({ description: "Cohort agent name to prompt" })),
14996
+ prompt: Type.String({ description: "Prompt to send to the target agents" })
14997
+ }),
14998
+ async execute(_toolCallId, params) {
14999
+ const rt = getToolRuntime();
15000
+ if (!rt.isReady) {
15001
+ return textResult("cohort_room_prompt_agents is not ready yet \u2014 the plugin is still starting up. Try again in a few seconds.");
15002
+ }
15003
+ const moderatorAgentName = rt.resolveAgentName(agentId);
15004
+ const result = await callPromptRoomAgentsFromPlugin(rt.apiKey, {
15005
+ roomId: params.room_id,
15006
+ moderatorAgentName,
15007
+ targetAgentNames: params.agent_names,
15008
+ prompt: params.prompt
15009
+ });
15010
+ const noun = result.notificationCount === 1 ? "agent" : "agents";
15011
+ return textResult(`Prompt sent to ${result.notificationCount} Room ${noun}.`, result);
15012
+ }
15013
+ };
15014
+ });
14933
15015
  api.registerTool(() => {
14934
15016
  return {
14935
15017
  name: "cohort_context",
@@ -12,6 +12,8 @@
12
12
  "tools": [
13
13
  "cohort_comment",
14
14
  "cohort_room_message",
15
+ "cohort_room_prompt_agent",
16
+ "cohort_room_prompt_agents",
15
17
  "cohort_context",
16
18
  "cohort_briefing_context",
17
19
  "cohort_briefing",
@@ -75,5 +77,5 @@
75
77
  }
76
78
  }
77
79
  },
78
- "version": "0.31.12"
80
+ "version": "0.31.13"
79
81
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.31.12",
3
+ "version": "0.31.13",
4
4
  "description": "OpenClaw plugin — syncs agent telemetry, sessions, and activity to the Cohort dashboard",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -10,6 +10,8 @@
10
10
  "tools": [
11
11
  "cohort_comment",
12
12
  "cohort_room_message",
13
+ "cohort_room_prompt_agent",
14
+ "cohort_room_prompt_agents",
13
15
  "cohort_context",
14
16
  "cohort_briefing_context",
15
17
  "cohort_briefing",
@@ -73,5 +75,5 @@
73
75
  }
74
76
  }
75
77
  },
76
- "version": "0.9.2"
78
+ "version": "0.9.3"
77
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.31.12",
3
+ "version": "0.31.13",
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",