@cfio/cohort-sync 0.32.0 → 0.32.1

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
@@ -12279,18 +12279,19 @@ var ATMENTION_RESPONSE_PROMPT = `YOU WERE DIRECTLY @-MENTIONED. RESPOND.
12279
12279
  - Do not stop because Vercel CLI is not authenticated; Cohort deploys through GitHub Actions after merge.`;
12280
12280
  var ROOM_MESSAGE_RESPONSE_PROMPT = `YOU WERE DIRECTLY ASKED IN A COHORT ROOM. RESPOND.
12281
12281
 
12282
- - If you are the Room moderator and a human asks for a roundtable, standup, report-in, or panel response, FIRST use cohort_room_start_moderation_session(room_id, mode, objective, participant_names) to run it as a managed session, then drive it with cohort_room_advance_moderation_session; do not only name agents in prose.
12282
+ - If you are the Room moderator and a human asks for a question to be routed, FIRST use cohort_room_start_moderation_session with mode: "moderated_qna", one best participant, and question_text; use cohort_room_advance_moderation_session(action: "followup") for additional experts one at a time, then confirm with the asker before complete.
12283
+ - If you are the Room moderator and a human asks for a roundtable, standup, report-in, or panel response, FIRST use cohort_room_start_moderation_session with mode: "round_robin" to run it as a managed session, then drive it with cohort_room_advance_moderation_session; do not only name agents in prose.
12283
12284
  - Otherwise, use the cohort_room_message tool to post a reply in the Room. Do NOT just think silently and exit.
12284
12285
  - Reply in your own voice (see your persona in IDENTITY.md).
12285
- - If the human asks for a roundtable, standup, report-in, or panel response, contribute your own concise update.
12286
+ - If the human asks for an answer, answer it. If the human asks for a roundtable, standup, report-in, or panel response, contribute your own concise update.
12286
12287
  - If the moderator asks you to answer, answer. If another agent asks for your report, provide it. If your prompt includes a turn_id, echo it in cohort_room_message.
12287
12288
  - A brief, honest reply is better than no reply. If you genuinely have nothing to add, say so explicitly in the Room \u2014 don't go silent.`;
12288
12289
  var TOOLS_REFERENCE = `
12289
12290
  TOOLS: Use these \u2014 do NOT call the REST API directly.
12290
12291
  - cohort_comment(task_number, comment) \u2014 post a comment
12291
12292
  - cohort_room_message(room_id, message, turn_id?) \u2014 post a message in a Cohort Room; pass turn_id when your prompt included one so the reply is attributed to that moderation turn
12292
- - cohort_room_start_moderation_session(room_id, mode, objective, participant_names) \u2014 moderator only: start a managed round robin or Q&A session
12293
- - cohort_room_advance_moderation_session(session_id, action, ...) \u2014 moderator only: advance, retry, skip, accept, followup, or complete the session
12293
+ - cohort_room_start_moderation_session(room_id, mode, objective, participant_names) \u2014 moderator only: start a managed session; round_robin = ask every participant to report in, moderated_qna = route a question to one selected agent
12294
+ - cohort_room_advance_moderation_session(session_id, action, ...) \u2014 moderator only: advance, retry, skip, accept, followup, or complete the session; followup asks one additional Q&A expert after the first answer
12294
12295
  - cohort_room_cancel_moderation_session(session_id, reason?) \u2014 moderator only: cancel an in-flight session
12295
12296
  - cohort_room_prompt_agent(roomId, agentName, prompt) \u2014 moderator only, low-level: ask one Room agent to respond (prefer moderation sessions for multi-step workflows)
12296
12297
  - cohort_room_prompt_agents(roomId, agentNames, prompt) \u2014 moderator only, low-level: ask multiple Room agents to respond (prefer moderation sessions for multi-step workflows)
@@ -12322,6 +12323,16 @@ var HANDOFF_ACTION_TERMS = [
12322
12323
  "gather",
12323
12324
  "ask"
12324
12325
  ];
12326
+ var QUESTION_ROUTING_TERMS = [
12327
+ "question for the team",
12328
+ "route it",
12329
+ "route this",
12330
+ "ask whoever",
12331
+ "whoever's best suited",
12332
+ "whoever is best suited",
12333
+ "who's best suited",
12334
+ "who is best suited"
12335
+ ];
12325
12336
  function sanitizePreview(raw) {
12326
12337
  return raw.replace(/<\/?user_comment>/gi, "");
12327
12338
  }
@@ -12337,11 +12348,21 @@ function isHumanHandoffRequest(n) {
12337
12348
  const hasAction = HANDOFF_ACTION_TERMS.some((term) => preview.includes(term));
12338
12349
  return hasTopic && hasAction;
12339
12350
  }
12351
+ function isHumanQuestionRoutingRequest(n) {
12352
+ if (n.actorType !== "human") {
12353
+ return false;
12354
+ }
12355
+ const preview = (n.preview ?? "").toLowerCase();
12356
+ return QUESTION_ROUTING_TERMS.some((term) => preview.includes(term)) || /\bhave\s+[a-z][a-z0-9_-]*\s+answer\b/.test(preview);
12357
+ }
12340
12358
  function roomMessageCta(n) {
12341
12359
  const roomId = n.roomId ?? "unknown";
12342
12360
  if (n.moderationContext != null && renderModerationContext(n.moderationContext) !== "") {
12343
12361
  return "Follow the MODERATION SESSION block in this message \u2014 it is authoritative.";
12344
12362
  }
12363
+ if (isHumanQuestionRoutingRequest(n)) {
12364
+ return `You are moderating a Room Q&A. FIRST use cohort_room_start_moderation_session(room_id: ${roomId}, mode: "moderated_qna", objective: <one-line objective>, participant_names: [<single best agent>], question_text: <the question>) to route the question to one selected expert. If more expertise is needed after the answer, use cohort_room_advance_moderation_session(action: "followup", target_agent_name: <next expert>, prompt: <follow-up question>) for one additional expert at a time (advance(action: "followup")). Then ask the asker whether the answer resolves the question before complete.`;
12365
+ }
12345
12366
  if (isHumanHandoffRequest(n)) {
12346
12367
  return `You are moderating a Room round robin. FIRST use cohort_room_start_moderation_session(room_id: ${roomId}, mode: "round_robin", objective: <one-line objective>, participant_names: [<agents>]) to run it as a managed moderation session. Do NOT only post @agent prose and do NOT hand-roll turn-taking with cohort_room_prompt_agent. The session prompts each participant for you and tells you when to advance; finish with cohort_room_advance_moderation_session(action: "complete") to record the outcomes.`;
12347
12368
  }
@@ -13990,7 +14011,7 @@ function dumpEvent(event) {
13990
14011
  function positiveNumber(value) {
13991
14012
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
13992
14013
  }
13993
- var PLUGIN_VERSION = true ? "0.32.0" : "unknown";
14014
+ var PLUGIN_VERSION = true ? "0.32.1" : "unknown";
13994
14015
  function resolveGatewayToken(api) {
13995
14016
  const token2 = api.config?.gateway?.auth?.token;
13996
14017
  return typeof token2 === "string" ? token2 : null;
@@ -15208,16 +15229,16 @@ Do not attempt more comments until tomorrow.`);
15208
15229
  return {
15209
15230
  name: "cohort_room_start_moderation_session",
15210
15231
  label: "cohort_room_start_moderation_session",
15211
- description: "Start a managed moderation session in a Cohort Room. This is THE way to run round robins and moderated Q&A as the Room moderator: the backend prompts each participant in turn, tracks who responded, and tells you when to advance. Returns the session state block. The returned block includes the session_id \u2014 pass it to cohort_room_advance_moderation_session for every subsequent action.",
15232
+ description: 'Start a managed moderation session in a Cohort Room. Use round_robin = ask every participant to report in; use moderated_qna = route a question to one selected agent, wait for the answer, ask the asker whether it resolves the question, then complete. For multiple experts in Q&A, start with one best agent and use action: "followup" for additional experts one at a time. Returns the session state block. The returned block includes the session_id \u2014 pass it to cohort_room_advance_moderation_session for every subsequent action.',
15212
15233
  parameters: Type.Object({
15213
15234
  room_id: Type.String({ description: "Room ID supplied by Cohort, e.g. rooms:abc123" }),
15214
15235
  mode: Type.Union([
15215
15236
  Type.Literal("round_robin"),
15216
15237
  Type.Literal("moderated_qna")
15217
- ], { description: 'Session mode: "round_robin" (each participant responds in turn) or "moderated_qna" (one participant answers a question)' }),
15238
+ ], { description: 'Session mode: "round_robin" means every participant reports in; "moderated_qna" means one selected participant answers a question, with serial followups for more experts.' }),
15218
15239
  objective: Type.String({ description: "One-line objective for the session, e.g. 'Daily standup: blockers and progress'" }),
15219
- participant_names: Type.Array(Type.String(), { description: "Cohort agent names to include, in speaking order" }),
15220
- question_text: Type.Optional(Type.String({ description: "moderated_qna only: the question to ask the participant" })),
15240
+ participant_names: Type.Array(Type.String(), { description: "Cohort agent names to include, in speaking order; moderated_qna should include exactly one best agent" }),
15241
+ question_text: Type.Optional(Type.String({ description: "moderated_qna only: the question to ask the selected participant" })),
15221
15242
  auto_advance: Type.Optional(Type.Boolean({ description: "round_robin only: automatically prompt the next participant after each matched response" }))
15222
15243
  }),
15223
15244
  async execute(_toolCallId, params) {
@@ -15249,7 +15270,7 @@ Do not attempt more comments until tomorrow.`);
15249
15270
  return {
15250
15271
  name: "cohort_room_advance_moderation_session",
15251
15272
  label: "cohort_room_advance_moderation_session",
15252
- description: 'Advance a moderation session you are running: "next" prompts the next participant, "retry"/"skip"/"accept" resolve a mismatched turn, "followup" asks a target a follow-up question, and "complete" ends the session. Outcomes passed with action "complete" (summary, decisions, proposed_tasks, follow_ups) become the session recap; proposed_tasks surface for human approval. Returns the updated session state block.',
15273
+ description: 'Advance a moderation session you are running: "next" prompts the next round-robin participant, "retry"/"skip"/"accept" resolve a mismatched turn, followup asks one additional Q&A expert after the first answer, and "complete" ends the session. For moderated_qna, confirm with the asker before complete. Outcomes passed with action "complete" (summary, decisions, proposed_tasks, follow_ups) become the session recap; proposed_tasks surface for human approval. Returns the updated session state block.',
15253
15274
  parameters: Type.Object({
15254
15275
  session_id: Type.String({ description: "Moderation session ID returned by cohort_room_start_moderation_session" }),
15255
15276
  action: Type.Union([
@@ -15259,7 +15280,7 @@ Do not attempt more comments until tomorrow.`);
15259
15280
  Type.Literal("accept"),
15260
15281
  Type.Literal("followup"),
15261
15282
  Type.Literal("complete")
15262
- ], { description: "next = prompt the next participant (from waiting); retry = re-prompt the same agent; skip = skip the expected agent and move on; accept = accept an out-of-order reply as the response; followup = route a follow-up question (Q&A only); complete = finish the session (pass summary/decisions/proposed_tasks to create the recap)." }),
15283
+ ], { description: "next = prompt the next round-robin participant (from waiting); retry = re-prompt the same agent; skip = skip the expected agent and move on; accept = accept an out-of-order reply as the response; followup = route one additional Q&A question to one target agent; complete = finish after asker confirmation when in Q&A (pass summary/decisions/proposed_tasks to create the recap)." }),
15263
15284
  prompt: Type.Optional(Type.String({ description: "Custom prompt for the turn (next/retry/followup)" })),
15264
15285
  target_agent_name: Type.Optional(Type.String({ description: "followup only: the agent to ask" })),
15265
15286
  summary: Type.Optional(Type.String({ description: "complete only: session recap summary" })),
@@ -80,5 +80,5 @@
80
80
  }
81
81
  }
82
82
  },
83
- "version": "0.32.0"
83
+ "version": "0.32.1"
84
84
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
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.32.0",
3
+ "version": "0.32.1",
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",