@opticell/workflow-companion 1.6.1 → 1.6.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.
Files changed (2) hide show
  1. package/index.js +27 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -27,7 +27,7 @@ const path = require("path");
27
27
  const os = require("os");
28
28
 
29
29
  const PROTOCOL_VERSION = "2024-11-05";
30
- const SERVER_INFO = { name: "workflow", version: "1.6.1" };
30
+ const SERVER_INFO = { name: "workflow", version: "1.6.2" };
31
31
  // Who the agent is in WorkFlow: the assignee its queue follows, the @name
32
32
  // that calls it, the signature on what it writes. On the Mac it's Claude.
33
33
  // A companion goes by the name chosen at setup (default "Companion"), so a
@@ -675,6 +675,25 @@ function addressingComment(t) {
675
675
  return comments.slice(-3).reverse().find(c => !isAgentID(c.authorID) && mentionsMe(c.text)) || null;
676
676
  }
677
677
 
678
+ // On a task assigned to this agent: the newest comment from another
679
+ // assistant that @mentions it, since the last person wrote, within the hop
680
+ // limit. Unlike addressingComment it needn't be the very last comment, so an
681
+ // assistant's follow-up without a mention doesn't change the wake signature.
682
+ function assignedHandoff(t) {
683
+ const comments = t.comments || [];
684
+ for (let i = comments.length - 1; i >= 0; i--) {
685
+ const c = comments[i];
686
+ if (!isAgentID(c.authorID)) return null;
687
+ if (c.authorID === AGENT.authorID || !mentionsMe(c.text)) continue;
688
+ let hops = 0;
689
+ for (let j = i; j >= 0 && isAgentID(comments[j].authorID); j--) {
690
+ if (/(^|[^A-Za-z0-9_])@[A-Za-z]/.test(comments[j].text || "")) hops++;
691
+ }
692
+ return hops <= MAX_AGENT_HOPS ? c : null;
693
+ }
694
+ return null;
695
+ }
696
+
678
697
  function showNote(n) {
679
698
  const lines = [n.title || "(untitled)", `id ${n.id}`];
680
699
  if (n.isPinned) lines.push("pinned");
@@ -1308,7 +1327,13 @@ function wakeItems(snap) {
1308
1327
  const personal = c => !String(c.authorID || "").startsWith("agent.");
1309
1328
  const items = rows.map(t => {
1310
1329
  const byPeople = (t.comments || []).filter(personal);
1311
- const trigger = mine(t) ? byPeople.slice(-1)[0] : addressingComment(t);
1330
+ // On an assigned task, another assistant's @mention counts too (1.6.2):
1331
+ // only a person's comment did before, so opticell → Jarvis hand-offs on
1332
+ // tasks assigned to Jarvis woke nothing. The newer of the two wins.
1333
+ const trigger = mine(t)
1334
+ ? [byPeople.slice(-1)[0], assignedHandoff(t)].filter(Boolean)
1335
+ .sort((x, y) => String(y.timestamp || "").localeCompare(String(x.timestamp || "")))[0]
1336
+ : addressingComment(t);
1312
1337
  const why = mine(t) ? `assigned to ${AGENT.name}` : `@${AGENT.name} in a comment`;
1313
1338
  return { key: `task:${t.id}`, sig: trigger ? `${trigger.id || ""}@${trigger.timestamp || ""}` : "assigned",
1314
1339
  kind: "task", id: t.id, title: t.title, project: t.project || "", why };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opticell/workflow-companion",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "mcpName": "io.github.TeamDzX/workflow-companion",
5
5
  "description": "Lets Claude on Windows or Linux work in your WorkFlow tasks, notes and projects, through WorkFlow for Mac and your own iCloud. An MCP server.",
6
6
  "keywords": [