openvisio-agent 0.6.1 → 0.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/package.json +1 -1
  2. package/src/watch.mjs +17 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openvisio-agent",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Connect your coding agent (Claude Code) to an OpenVisio team — MCP tools + optional autonomy — in one command. No shell scripts.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/watch.mjs CHANGED
@@ -40,7 +40,12 @@ const CHAT_CHARTER = [
40
40
  ].join('\n')
41
41
 
42
42
  const CYCLE = CHAT_CHARTER + '\n\nRun one OpenVisio autonomy cycle: call poll_inbox and handle mentions + follow-ups. Reply in 1-3 sentences, @mention people by their EXACT full name, at most one reply per channel. Then stop.'
43
- const CYCLE_FAST = CHAT_CHARTER + '\n\nNew chat activity. If a specific mention FOR YOU is given above, reply to it with mcp__openvisio-team__post_message (once). Then call poll_inbox and look at .followUps — but reply ONLY to the ones actually directed at YOU (a question to you, or a reply to your own message); SKIP thread chatter aimed at someone else or another agent. Ignore .tasks/.claimable. AT MOST ONE reply per channel; answer several nudges together in ONE post; never repeat a reply you already sent. If asked for work you have no tool for, say so plainly and offer to file a ticket. Never invent progress. Reply in 1-3 sentences, no summary. Then stop.'
43
+ const CYCLE_FAST = CHAT_CHARTER + '\n\n' + [
44
+ 'New chat activity. Do EXACTLY ONE of these:',
45
+ ' • IF a specific mention/message FOR YOU is given above: reply to THAT ONE message exactly once with mcp__openvisio-team__post_message, then STOP. Do NOT call poll_inbox and do NOT answer anything else this cycle — you already have the message; polling would make you re-answer it and double-post.',
46
+ ' • IF NO specific mention is given above: call poll_inbox and reply only to items truly directed at YOU (a question to you, or a reply to your own message) — SKIP chatter aimed at someone else / another agent, ignore .tasks/.claimable, at most one reply per channel.',
47
+ 'Post ONE message total for the thing you are answering — compose it fully, then send once. Never send a reply and then a "better" version; never repeat a reply you already sent. Be sure of your answer before sending. If asked for work you have no tool for, say so plainly and offer to file a ticket. 1-3 sentences, no summary. Then stop.',
48
+ ].join('\n')
44
49
 
45
50
  // ── CODE agents (--workdir given): full file + Bash + git/gh surface. ─────────
46
51
  // A stable "who you are / how you work" charter prepended to every code cycle.
@@ -75,10 +80,11 @@ const CODE_FULL = CODE_CHARTER + '\n\n' + [
75
80
  ].join('\n')
76
81
 
77
82
  const CODE_FAST = CODE_CHARTER + '\n\n' + [
78
- 'New chat activity. If a specific mention FOR YOU is given above, reply to it FIRST with mcp__openvisio-team__post_message (once) — before any Bash.',
79
- 'Then poll_inbox and handle .followUps ONLY when the reply is directed at YOU (asks you something, or responds to your own message) SKIP thread chatter aimed at someone else / another agent. At most one reply per channel, and never repeat a reply you already sent.',
80
- 'If a message asks YOU for real CODE work, do the WHOLE job now branch (checkout -B agent/<slug>), edit, run tests, commit, push your branch, open a PR (gh pr create), then reply with the PR link and @mention the requester by exact full name. Never push to main, never --force, never merge.',
81
- 'Do NOT promise and stopfinish and report in THIS cycle. Reply 1-3 sentences, no summary. Then stop.',
83
+ 'New chat activity. Do EXACTLY ONE of these:',
84
+ ' IF a specific mention/message FOR YOU is given above: reply to THAT ONE message exactly once with mcp__openvisio-team__post_message, then STOP. Do NOT call poll_inbox and do NOT answer anything else this cycle polling would re-surface the same message and make you double-post.',
85
+ ' IF NO specific mention is given above: call poll_inbox and reply only to items directed at YOU (asks you something, or responds to your own message) SKIP chatter aimed at someone else / another agent; at most one reply per channel.',
86
+ 'If the message asks YOU for real CODE work, do the WHOLE job now branch (checkout -B agent/<slug>), edit, run tests, commit, push your branch, open a PR (gh pr create), then reply once with the PR link and @mention the requester by exact full name. Never push to main, never --force, never merge.',
87
+ 'Post ONE message for the thing you are answering — send it once; never a reply then a "better" version; never repeat a reply you already sent; be sure before you send. Do NOT promise and stop — finish and report in THIS cycle. 1-3 sentences, no summary. Then stop.',
82
88
  ].join('\n')
83
89
 
84
90
  // ── Workspace-ethics cycles (both chat-only + code agents) ───────────────────
@@ -396,11 +402,11 @@ function loopBackendWs({ wsUrl, apiKey, identifier, slug, claude, mcpConfig, wor
396
402
  const parent = msg.parent_id != null ? msg.parent_id : (msg.parentId != null ? msg.parentId : null)
397
403
  const threadRoot = parent != null ? parent : mid
398
404
  // De-dupe: the same mention re-delivered (reconnect replay / dup fan-out) must
399
- // NOT trigger a second reply to the same message.
400
- if (mid != null) {
401
- if (seenMentions.has(mid)) { log('agent:mention (dup ' + mid + ') skipped'); return }
402
- seenMentions.add(mid); if (seenMentions.size > 500) seenMentions.clear()
403
- }
405
+ // NOT trigger a second reply. Key by message id, or a channel+text signature
406
+ // when the payload carries no id.
407
+ const dedupeKey = mid != null ? 'id:' + mid : 'sig:' + (cid != null ? cid : '?') + '|' + text.slice(0, 100)
408
+ if (seenMentions.has(dedupeKey)) { log('agent:mention (dup) — skipped'); return }
409
+ seenMentions.add(dedupeKey); if (seenMentions.size > 500) seenMentions.clear()
404
410
  // Under-the-hood model control from chat (view / switch the model the agent runs).
405
411
  const mcmd = cid != null ? parseModelCmd(text) : null
406
412
  if (mcmd) {
@@ -425,7 +431,7 @@ function loopBackendWs({ wsUrl, apiKey, identifier, slug, claude, mcpConfig, wor
425
431
  }
426
432
  log('agent:mention in channel ' + (cid != null ? cid : '?') + (threadRoot != null ? ' (thread ' + threadRoot + ')' : ''))
427
433
  const ctx = cid != null
428
- ? `You were @mentioned in OpenVisio channel ${cid}${who ? ` by "${who}"` : ''}: "${text}". This mention is FOR YOU reply once with mcp__openvisio-team__post_message as your FIRST action — arguments: channel_id ${cid}${threadRoot != null ? `, parent_id ${threadRoot} (reply IN THAT THREAD, do not start a new top-level message)` : ''}, plus agent_identifier + agent_api_key from the AUTH line above, and a 1-3 sentence reply. FIRST read the recent messages in this thread: if you already answered this, or it turns out another agent was the one addressed, do NOT post. Be sure of your answer before sending — do not reply then correct yourself.${who ? ` To @mention them back, write their EXACT full name "@${who}" (a mention only links when the name matches exactly — "@${who.split(' ')[0]}" alone will NOT).` : ''} You already have the message here — do NOT poll_inbox to find it.`
434
+ ? `You were @mentioned in OpenVisio channel ${cid}${who ? ` by "${who}"` : ''}: "${text}". This mention is FOR YOU. Send EXACTLY ONE reply with mcp__openvisio-team__post_message — arguments: channel_id ${cid}${threadRoot != null ? `, parent_id ${threadRoot} (reply IN THAT THREAD, do not start a new top-level message)` : ''}, plus agent_identifier + agent_api_key from the AUTH line above, and a 1-3 sentence reply. Compose the whole answer, then post it ONCE — do NOT post a first reply and then a revised/"better" one. FIRST read the recent messages in this thread: if you already answered this, or another agent was the one addressed, do NOT post at all. Be sure of your answer before sending.${who ? ` To @mention them back, write their EXACT full name "@${who}" (a mention only links when the name matches exactly — "@${who.split(' ')[0]}" alone will NOT).` : ''} You ALREADY have the message here — do NOT poll_inbox, and after your single reply, STOP.`
429
435
  : undefined
430
436
  void drain('fast', ctx)
431
437
  } else if (k === 'error') {