openvisio-agent 0.25.7 → 0.25.8
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/CHANGELOG.md +7 -0
- package/README.md +2 -2
- package/USER_GUIDE.md +1 -1
- package/package.json +1 -1
- package/scenarios/workspace.scenarios.mjs +3 -2
- package/scripts/certify.mjs +3 -1
- package/src/events.mjs +13 -0
- package/src/watch.mjs +32 -18
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## [0.25.8] — 2026-09-21
|
|
6
|
+
|
|
7
|
+
- Hydrate compact `list_agents` identities through `get_agent` so watchers subscribe to their verified organization and receive mentions from every accessible channel.
|
|
8
|
+
- Route organization `task:created` and `task:updated` events through the same authoritative assignment verification used by targeted assignment events.
|
|
9
|
+
- Allow explicit requests to publish in another named channel while retaining guarded, single-delivery replies in the source thread and dedicated-channel defaults for unsolicited results.
|
|
10
|
+
- Start organization discovery immediately after each WebSocket connection and retain event-driven idle behavior.
|
|
11
|
+
|
|
5
12
|
## [0.25.7] — 2026-09-21
|
|
6
13
|
|
|
7
14
|
- Restore recovery for addressed messages that the backend omits from the watcher WebSocket stream.
|
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ The backend MCP may be stateful or stateless. A successful initialize response w
|
|
|
87
87
|
|
|
88
88
|
Codex BYO agents follow the repository's normative runtime specification in `docs/CODEX_BYO_AGENT_SPEC.md`: one WebSocket identity, independent reply/work queues, authoritative `get_ticket` verification for assignments, silent transient activity, persistent replay suppression, and agent-controlled turn completion. Maintainers must run `npm run certify` before publishing.
|
|
89
89
|
|
|
90
|
-
Both `agent:mention` and organization `channel:message` events pass through the same source-recipient, ownership, and deduplication checks before any model starts. The watcher subscribes only to the organization verified from
|
|
90
|
+
Both `agent:mention` and organization `channel:message` events pass through the same source-recipient, ownership, and deduplication checks before any model starts. The watcher hydrates compact roster entries through `get_agent`, subscribes only to the organization verified from that authenticated profile, and restores the subscription after reconnect. Organization `task:created` and `task:updated` events enter the same authoritative assignment verifier as targeted `task:assigned` events, so a task starts only after `get_ticket` confirms it is open and owned by this agent. Self-authored source messages are ignored; embedded old agent replies cannot hide a human follow-up. An explicit tag establishes durable ownership of that thread, so later human follow-ups remain addressed to the agent without another @mention. Messages redirected to another agent and unaddressed agent chatter stay silent, while a direct stand-down cancels queued/running work and releases ownership for that thread. Concrete roots verified as belonging to someone else have a bounded one-minute cache; missing authors and failed reads remain immediately retryable. The watcher publishes working, thinking, and typing presence from actual runtime activity using the authenticated REST endpoint. It stops refreshing when work finishes or is cancelled; the app clears the indicator through its expiry timer. Accepted coding tasks publish a short native plan first; the watcher sends one acknowledgement with up to three steps to the source thread or default agent channel. Every runtime returns a distinct final answer for guarded watcher delivery. Plans and reconnects cannot duplicate or suppress that final answer.
|
|
91
91
|
|
|
92
92
|
Ticket references follow the board UI: BYO agents use the project-scoped slug, such as `OVS-57`, in messages, comments, PR descriptions, blockers, and results. Numeric `project_id` and `ticket_id` values remain internal MCP arguments and are never used as human-facing ticket names. If an older backend omits the slug, the agent uses the ticket title rather than inventing one.
|
|
93
93
|
|
|
@@ -112,7 +112,7 @@ The helper `openvisio-agent push-pr-branch` accepts no arguments. It pushes only
|
|
|
112
112
|
|
|
113
113
|
Authorization recovery checks paused repositories locally every two seconds and clears both policy and failed-revision state before live ticket verification. It does not need a new watcher or a new chat message. Updating the package still requires the running service to load the new version once.
|
|
114
114
|
|
|
115
|
-
Fresh top-level
|
|
115
|
+
Responses to existing requests stay in their source thread. Fresh top-level results use the agent’s dedicated channel by default; when a teammate explicitly requests a message in another named channel, the agent resolves that destination from live `list_channels` and posts there. The watcher resolves a unique exact identity/name match (including `agent-alex` and `alex-agent`) and never silently falls back to general. Use `connect ... --channel <id>` for a differently named dedicated channel. If a requested or default channel is missing or ambiguous, the agent reports that condition instead of inventing a channel or id.
|
|
116
116
|
|
|
117
117
|
Codex, OpenCode, Gemini CLI, and Qwen Code use Mastra ACP directly. OpenCode starts only for an accepted cycle and exits as soon as that cycle releases it, so the idle watcher does not retain an OpenCode child process. Other runtimes retain work sessions per ticket in a six-entry pool and reply sessions in an eight-entry pool; their idle sessions expire after five minutes, and active sessions cannot be evicted. Git snapshots are asynchronous, lightweight commands lazily load the watcher, and logs separate queue wait, preflight, first-event, and total runtime time. Studio reads watcher liveness from the local PID lock instead of requiring journal heartbeats, and model changes arrive through filesystem notifications. Projects reconcile with concurrency three and enqueue tickets before reading optional activity history; later idle recovery reads activity only. Coordination sessions can update the board without gaining repository access.
|
|
118
118
|
|
package/USER_GUIDE.md
CHANGED
|
@@ -74,7 +74,7 @@ Stopping a watcher interrupts its active work. When you are ready to resume, run
|
|
|
74
74
|
- **Assign repository work:** assign an actionable ticket to the agent in a project with a linked codebase. Include the problem, expected behavior, and how the result should be checked.
|
|
75
75
|
- **Continue a conversation:** reply in the same thread. Keep follow-up instructions concrete, such as “The new test fails on an empty email address; please fix that case.”
|
|
76
76
|
|
|
77
|
-
Replies stay in their source thread. New completion messages use the agent’s dedicated channel. Check the ticket and any linked pull request for delivered results. A progress message describes ongoing work; wait for the final result or blocker.
|
|
77
|
+
Replies stay in their source thread. New completion messages use the agent’s dedicated channel by default. You can explicitly ask the agent to send or announce something in another named channel; it resolves that destination from the live channel list and confirms the action in the source thread. Check the ticket and any linked pull request for delivered results. A progress message describes ongoing work; wait for the final result or blocker.
|
|
78
78
|
|
|
79
79
|
For accepted coding tasks, the agent starts by publishing a short plan. You receive one acknowledgement with up to three steps, followed later by its result. The agent can delegate independent pieces to native sub-agents and remains responsible for checking their work. Thinking, working, and typing indicators follow runtime activity; they expire after work stops. A reconnect does not repeat the plan or cancel healthy work.
|
|
80
80
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openvisio-agent",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.8",
|
|
4
4
|
"description": "Connect Claude Code, Codex, OpenCode, Gemini CLI, or Qwen Code to an OpenVisio team \u2014 MCP tools + optional autonomy \u2014 in one command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,18 +16,19 @@ async function eventually(predicate, description) {
|
|
|
16
16
|
assert.fail(`Watcher did not reach: ${description}`)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function fixture({ agent = 'codex', name, task = true, run, threadError = false, commentTools = [], onComment, selfProfile = self, listAgents, getTicket, listChannels, listActivity, transportRecoveryDelays, activityReporter } = {}) {
|
|
19
|
+
export function fixture({ agent = 'codex', name, task = true, run, threadError = false, commentTools = [], onComment, selfProfile = self, listAgents, getAgent, getTicket, listChannels, listActivity, transportRecoveryDelays, activityReporter } = {}) {
|
|
20
20
|
const dir = mkdtempSync(join(tmpdir(), 'byo-workspace-'))
|
|
21
21
|
const posts = [], runs = [], calls = [], logs = [], messages = [], subscriptions = []
|
|
22
22
|
const ticket = { id: 77, project_id: 1, slug: 'OPEN-77', title: 'Repair the component', agent_id: 7, status: 'In Progress', type_id: 1, updated_at: 'revision-1' }
|
|
23
23
|
let watcher, connection, messageId = 100, closed = 0
|
|
24
24
|
const memory = createByoMemoryGraph({ path: join(dir, 'ledger.json') })
|
|
25
25
|
const mcp = {
|
|
26
|
-
listTools: async () => ['list_agents', 'list_projects', 'list_boards', 'list_tasks', 'get_ticket', 'update_ticket', 'post_message', 'list_message_thread', 'list_channels', 'list_task_types', 'list_activity', ...commentTools].map((name) => ({ name, ...(name === 'list_task_types' ? { inputSchema: { required: ['project_id', 'board_id'], properties: { project_id: {}, board_id: {} } } } : {}) })),
|
|
26
|
+
listTools: async () => ['list_agents', 'get_agent', 'list_projects', 'list_boards', 'list_tasks', 'get_ticket', 'update_ticket', 'post_message', 'list_message_thread', 'list_channels', 'list_task_types', 'list_activity', ...commentTools].map((name) => ({ name, ...(name === 'list_task_types' ? { inputSchema: { required: ['project_id', 'board_id'], properties: { project_id: {}, board_id: {} } } } : {}) })),
|
|
27
27
|
callTool: async (name, args = {}) => {
|
|
28
28
|
calls.push({ name, args })
|
|
29
29
|
if (commentTools.includes(name)) return onComment ? await onComment(name, args) : { id: 500 }
|
|
30
30
|
if (name === 'list_agents') return listAgents ? await listAgents() : { agents: [selfProfile] }
|
|
31
|
+
if (name === 'get_agent') { assert.equal(args.agent_id, Number(selfProfile.id)); return { agent: getAgent ? await getAgent(args.agent_id) : selfProfile } }
|
|
31
32
|
if (name === 'list_projects') return { projects: [{ id: 1, name: 'Workspace' }] }
|
|
32
33
|
if (name === 'list_tasks') return { tasks: task ? [{ ...ticket }] : [] }
|
|
33
34
|
if (name === 'list_boards') return { boards: [{ id: 4 }] }
|
package/scripts/certify.mjs
CHANGED
|
@@ -56,6 +56,8 @@ const assertions = [
|
|
|
56
56
|
['idle watchers use event notifications without journal or settings polling', watcher.includes('watchFs(stateDir') && !watcher.includes('modelSettingsTimer') && !journal.includes("emit('runtime.heartbeat'")],
|
|
57
57
|
['ticket pickup precedes optional activity reads', watcher.indexOf("await handleTaskSignal('task:assigned'", watcher.indexOf('const reconcileBacklog')) < watcher.indexOf('await replayRecentActivity(projects)', watcher.indexOf('const reconcileBacklog'))],
|
|
58
58
|
['task:assigned is handled', watcher.includes("k === 'task:assigned'")],
|
|
59
|
+
['task creation and update fanout use the assignment verifier', watcher.includes("k === 'task:created'") && watcher.includes("k === 'task:updated'") && watcher.includes('return handleTaskSignal(k, raw)')],
|
|
60
|
+
['compact agent records are hydrated before organization subscription', watcher.includes("callMcpTool('get_agent', { agent_id: selfAgentId })") && watcher.includes('selfAgentId != null && selfOrganizationId == null')],
|
|
59
61
|
['task signals are verified with get_ticket', watcher.includes("callMcpTool('get_ticket'")],
|
|
60
62
|
['review and testing handoffs do not restart work', watcher.includes('taskIsAwaitingReview(task, reviewIds)') && watcher.includes('taskIsAwaitingReview(ticket, typeSets.review)')],
|
|
61
63
|
['review handoff releases the task key for future rework', watcher.includes('seenTasks.delete(taskKey)') && watcher.includes('seenTasks.delete(key)')],
|
|
@@ -79,7 +81,7 @@ const assertions = [
|
|
|
79
81
|
['generic coding pickup messages are absent', !watcher.includes("I've picked this up and will return here with the verified result")],
|
|
80
82
|
['human-facing ticket references require slugs, never database ids', watcher.includes('TICKET SLUGS, NEVER DATABASE IDS') && watcher.includes('ticketDisplaySlug(task)') && events.includes('export function ticketDisplaySlug') && !events.includes('I finished ticket #${task.id}')],
|
|
81
83
|
['rendered backend replies are checked before every guarded thread post', watcher.includes("callMcpTool('list_message_thread'") && watcher.includes('renderedAgentMessages(live') && watcher.includes('same-content-rendered')],
|
|
82
|
-
['
|
|
84
|
+
['guarded replies cannot race the watcher while explicit channel delivery remains available', watcher.includes("delivery?.watcherOwned && !delivery?.allowChannelMessaging") && watcher.includes('conversationRequestsChannelMessage(text)') && codexConfig.includes('disabled_tools = [')],
|
|
83
85
|
['ACP sessions receive the authenticated OpenVisio proxy', mastraHarness.includes("name: 'openvisio-team-watcher'") && mastraHarness.includes('OPENVISIO_CODEX_MCP_URL')],
|
|
84
86
|
['Codex discovers deferred OpenVisio actions before claiming they are missing', watcher.includes('Codex may defer MCP actions') && watcher.includes('use tool_search to find that exact action') && watcher.includes('initial-list miss is NOT evidence that the server is disconnected')],
|
|
85
87
|
['Codex authentication is injected outside the model', codexConfig.includes('OPENVISIO_CODEX_API_KEY') && codexProxy.includes('toolWithoutCredentialInputs') && codexProxy.includes('client.callTool') && watcher.includes('local OpenVisio MCP bridge injects authentication outside the model')],
|
package/src/events.mjs
CHANGED
|
@@ -565,6 +565,19 @@ export function conversationAsksPendingTickets(value) {
|
|
|
565
565
|
return pending && question
|
|
566
566
|
}
|
|
567
567
|
|
|
568
|
+
// A guarded reply normally has post_message removed so the runtime cannot race
|
|
569
|
+
// the watcher's single source-thread delivery. Keep that guard unless the human
|
|
570
|
+
// explicitly asks the agent to publish into a named channel. The destination is
|
|
571
|
+
// still resolved from live list_channels by the runtime; this only identifies
|
|
572
|
+
// the narrow class of requests that needs the posting tool.
|
|
573
|
+
export function conversationRequestsChannelMessage(value) {
|
|
574
|
+
const text = String(value || '')
|
|
575
|
+
const action = /\b(?:send|post|message|announce|notify|share|write)\b/i.test(text)
|
|
576
|
+
const channel = /#[a-z0-9][a-z0-9_-]*\b/i.test(text) || /\b(?:in|into|on|to)\s+(?:the\s+)?(?:channel\s+)?[a-z0-9][a-z0-9 _-]{0,80}\s+channel\b/i.test(text) || /\bchannel\s+(?:named\s+|called\s+)?["'`#]?[a-z0-9][a-z0-9 _-]*/i.test(text)
|
|
577
|
+
const negated = /\b(?:do\s+not|don't|dont|never)\s+(?:send|post|message|announce|notify|share|write)\b/i.test(text)
|
|
578
|
+
return action && channel && !negated
|
|
579
|
+
}
|
|
580
|
+
|
|
568
581
|
// Filing a ticket is a team mutation, even when its description asks for code.
|
|
569
582
|
// Questions about a previous creation and negated requests stay read-only.
|
|
570
583
|
export function conversationCreatesTicket(value) {
|
package/src/watch.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { fileURLToPath } from 'node:url'
|
|
|
10
10
|
import { join, dirname } from 'node:path'
|
|
11
11
|
import { OV_DIR, DEFAULT_WORKSPACE, readConfig, writeJson, configPath, onPath, fail, ok, info, slugify, stripSlash, chmodSafe } from './lib.mjs'
|
|
12
12
|
import { connectAgentWs, assertWebSocket } from './ws.mjs'
|
|
13
|
-
import { buildTaskCompletionReport, claudeEventEvidence, classifyConversationTarget, conversationAsksPendingTickets, conversationCreatesTicket, conversationNeedsCode, failedTaskRevisionIsCurrent, mentionDedupeKeys, messageParentId, messageSenderIsSelf, normalizeRenderedMessageText, renderedAgentMessages, taskAgentId, taskAgentIdentifier, taskBelongsToAgent, taskFromEvent, taskIsAwaitingReview, taskIsCompleted, taskIsCoordinationOnly, taskRevision, ticketDisplaySlug } from './events.mjs'
|
|
13
|
+
import { buildTaskCompletionReport, claudeEventEvidence, classifyConversationTarget, conversationAsksPendingTickets, conversationCreatesTicket, conversationNeedsCode, conversationRequestsChannelMessage, failedTaskRevisionIsCurrent, mentionDedupeKeys, messageParentId, messageSenderIsSelf, normalizeRenderedMessageText, renderedAgentMessages, taskAgentId, taskAgentIdentifier, taskBelongsToAgent, taskFromEvent, taskIsAwaitingReview, taskIsCompleted, taskIsCoordinationOnly, taskRevision, ticketDisplaySlug } from './events.mjs'
|
|
14
14
|
import { WORK_SESSION_TOOL, workSessionRequest, agentProfileContext } from './runtime-control.mjs'
|
|
15
15
|
import { createMastraMemory } from './memory.mjs'
|
|
16
16
|
import { createContextService } from './context-service.mjs'
|
|
@@ -87,7 +87,7 @@ const REPLY_DISCIPLINE = [
|
|
|
87
87
|
' • LOOK UP ASSIGNED WORK. If someone says they assigned you a task, asks which task is yours, or asks for its status, check the live board yourself with list_projects + list_tasks and then get_ticket as needed. Use list_agents only if assignment data requires a numeric identity lookup. Match assignments to your authenticated agent identity. Do not ask the teammate for a project slug, ticket slug, or numeric id before trying those MCP tools; ask only if the live lookup fails or returns genuinely ambiguous matches.',
|
|
88
88
|
' • TICKET SLUGS, NEVER DATABASE IDS. In every human-facing channel message, ticket comment, PR description, summary, blocker, and result, reference a ticket by the exact project-scoped slug returned by get_ticket/list_tasks (for example, `OVS-57`). Numeric project_id and ticket_id values are internal MCP arguments only: never write `#57`, `ticket 57`, or expose a database id to teammates. If the backend omits the slug, use the ticket title or say “the ticket”; do not invent a slug.',
|
|
89
89
|
' • CLOSE CONCERNS. Never leave a concern, direct question, correction, or blocker addressed to you without a clear response. Acknowledge the concern, act if you can, then report the verified result. If blocked, name the blocker and the exact next action or owner in one message.',
|
|
90
|
-
' •
|
|
90
|
+
' • HONOR CHANNEL DESTINATIONS. Reply to an existing request in its original thread. When a teammate explicitly asks you to send, post, announce, or share something in another channel, resolve that exact destination from live list_channels and post there. Use your dedicated agent channel for fresh top-level results, blockers, and introductions only when no other destination was requested. Never invent a channel id or silently substitute a different channel.',
|
|
91
91
|
' • WRITE PLAINLY. Prefer short sentences, commas, periods, and colons. Avoid em dashes except when reproducing quoted text.',
|
|
92
92
|
].join('\n')
|
|
93
93
|
|
|
@@ -944,15 +944,27 @@ export function createBackendWatcher({ backend, wsUrl, apiKey, identifier, slug,
|
|
|
944
944
|
let selfRead = null
|
|
945
945
|
let selfReadAfter = 0
|
|
946
946
|
const ensureSelfAgent = async () => {
|
|
947
|
-
if (selfAgentId != null) return
|
|
947
|
+
if (selfAgentId != null && selfOrganizationId != null) return
|
|
948
948
|
if (!selfRead && Date.now() < selfReadAfter) return
|
|
949
|
-
if (!selfRead) selfRead =
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
949
|
+
if (!selfRead) selfRead = (async () => {
|
|
950
|
+
if (selfAgentId == null) {
|
|
951
|
+
const data = toolData(await callMcpTool('list_agents'), 'list_agents')
|
|
952
|
+
const agents = Array.isArray(data.agents) ? data.agents : []
|
|
953
|
+
const identified = agents.find((row) => String(row?.identifier || row?.slug || '') === identifier)
|
|
954
|
+
const named = agents.filter((row) => !row?.identifier && !row?.slug && String(row?.name || '').trim().toLowerCase() === String(name || '').trim().toLowerCase())
|
|
955
|
+
rememberSelfAgent(identified || (named.length === 1 ? named[0] : null))
|
|
956
|
+
}
|
|
957
|
+
// Compact list_agents responses can contain only id + name. Hydrate that
|
|
958
|
+
// authenticated match so organization fanout can be subscribed without
|
|
959
|
+
// trusting organization data from an incoming event.
|
|
960
|
+
if (selfAgentId != null && selfOrganizationId == null) {
|
|
961
|
+
const names = await discoverMcpTools()
|
|
962
|
+
if (names.has('get_agent')) {
|
|
963
|
+
const detail = toolData(await callMcpTool('get_agent', { agent_id: selfAgentId }), 'get_agent')
|
|
964
|
+
rememberSelfAgent(detail.agent ?? detail.data?.agent ?? detail)
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
})().catch((error) => {
|
|
956
968
|
log('Agent profile unavailable; continuing with task ownership and configured aliases: ' + (error?.message || error))
|
|
957
969
|
}).finally(() => { selfRead = null; selfReadAfter = Date.now() + 60_000 })
|
|
958
970
|
await selfRead
|
|
@@ -1132,7 +1144,7 @@ export function createBackendWatcher({ backend, wsUrl, apiKey, identifier, slug,
|
|
|
1132
1144
|
const postMessageOnce = async ({ key, channelId, parentId, projectId, content, skipIfAnyAgentReply = false, sourceKey = '', sourceMessageId, allowCancelled = false, isCancelled = () => false }) => {
|
|
1133
1145
|
if (stopping) throw new Error('Watcher is stopping')
|
|
1134
1146
|
const deliveryKey = String(key || '')
|
|
1135
|
-
if (parentId == null) {
|
|
1147
|
+
if (parentId == null && !validBackendId(channelId)) {
|
|
1136
1148
|
channelId = await projectStatusChannel(projectId)
|
|
1137
1149
|
if (channelId == null) throw new Error('No dedicated agent channel available for a new thread')
|
|
1138
1150
|
projectId = undefined // dedicated channels may be organization-scoped
|
|
@@ -1660,7 +1672,7 @@ export function createBackendWatcher({ backend, wsUrl, apiKey, identifier, slug,
|
|
|
1660
1672
|
const ticketWorktree = preparedWorkdir || (kind === 'full' && activeTaskRef ? findTicketWorktree(workdir, activeTaskRef.ticketId) : '')
|
|
1661
1673
|
const runnerOptions = {
|
|
1662
1674
|
cycleId: cycleControl.cycleId, attempt: cycleControl.attempt || 1,
|
|
1663
|
-
...(delivery?.watcherOwned ? { disabledMcpTools: ['post_message'] } : {}),
|
|
1675
|
+
...(delivery?.watcherOwned && !delivery?.allowChannelMessaging ? { disabledMcpTools: ['post_message'] } : {}),
|
|
1664
1676
|
...(ticketWorktree ? { workdir: ticketWorktree } : {}),
|
|
1665
1677
|
}
|
|
1666
1678
|
const targets = [...new Set(targetChannels.filter((id) => id != null && Number.isFinite(Number(id))).map(Number))]
|
|
@@ -2002,7 +2014,7 @@ export function createBackendWatcher({ backend, wsUrl, apiKey, identifier, slug,
|
|
|
2002
2014
|
|
|
2003
2015
|
function routeEvent(k, d) {
|
|
2004
2016
|
const raw = d && typeof d === 'object' ? d : {}
|
|
2005
|
-
if (k === 'task:assigned' || k === 'task:updated') {
|
|
2017
|
+
if (k === 'task:created' || k === 'task:assigned' || k === 'task:updated') {
|
|
2006
2018
|
return handleTaskSignal(k, raw)
|
|
2007
2019
|
} else if (k === 'agent:mention') {
|
|
2008
2020
|
const cid = raw.channel_id != null ? raw.channel_id : (raw.channelId != null ? raw.channelId : null)
|
|
@@ -2055,8 +2067,8 @@ export function createBackendWatcher({ backend, wsUrl, apiKey, identifier, slug,
|
|
|
2055
2067
|
// Every runtime carries the source thread through the queue so a later
|
|
2056
2068
|
// redirect can cancel its process. The watcher delivers the final answer
|
|
2057
2069
|
// for every runtime after an authoritative last-moment thread check.
|
|
2058
|
-
const conversationDelivery = (stage = 'reply', skipIfAnyAgentReply = stage !== 'result') => cid != null
|
|
2059
|
-
? { key: `reply:${sourceKey}:${stage}`, channelId: Number(cid), parentId: threadRoot, skipIfAnyAgentReply, sourceKey, sourceMessageId: mid, watcherOwned: true }
|
|
2070
|
+
const conversationDelivery = (stage = 'reply', skipIfAnyAgentReply = stage !== 'result', allowChannelMessaging = false) => cid != null
|
|
2071
|
+
? { key: `reply:${sourceKey}:${stage}`, channelId: Number(cid), parentId: threadRoot, skipIfAnyAgentReply, sourceKey, sourceMessageId: mid, watcherOwned: true, allowChannelMessaging }
|
|
2060
2072
|
: null
|
|
2061
2073
|
// Under-the-hood model control from chat (view / switch the model the agent runs).
|
|
2062
2074
|
const mcmd = cid != null ? parseModelCmd(text) : null
|
|
@@ -2086,6 +2098,7 @@ export function createBackendWatcher({ backend, wsUrl, apiKey, identifier, slug,
|
|
|
2086
2098
|
return
|
|
2087
2099
|
}
|
|
2088
2100
|
const creatingTicket = conversationCreatesTicket(text)
|
|
2101
|
+
const channelMessaging = !creatingTicket && conversationRequestsChannelMessage(text)
|
|
2089
2102
|
const assignmentKey = controlKey ? `assignment-routing:${controlKey}` : ''
|
|
2090
2103
|
const priorAssignment = assignmentKey ? memory.get(assignmentKey) : null
|
|
2091
2104
|
const retryAssignment = priorAssignment?.state === 'failed' && /^\s*(?:please\s+)?(?:try\s+again|retry)(?:\s+please)?[.!?]*\s*$/i.test(text)
|
|
@@ -2121,10 +2134,10 @@ export function createBackendWatcher({ backend, wsUrl, apiKey, identifier, slug,
|
|
|
2121
2134
|
// subsequent working/typing heartbeat for its lane.
|
|
2122
2135
|
if (cid != null) sendStatus(cid, 'thinking')
|
|
2123
2136
|
const codingMention = !creatingTicket && canCode && conversationNeedsCode(text, { rootContent: raw._threadRootContent })
|
|
2124
|
-
const replyDelivery = conversationDelivery(codingMention ? 'result' : 'reply', !codingMention)
|
|
2137
|
+
const replyDelivery = conversationDelivery(codingMention ? 'result' : 'reply', !codingMention, channelMessaging)
|
|
2125
2138
|
let ctx = cid != null
|
|
2126
2139
|
? replyDelivery?.watcherOwned
|
|
2127
|
-
? `The watcher verified this source message is addressed to you in OpenVisio channel ${cid}${who ? ` by "${who}"` : ''}: "${text}". ${codingMention ? 'Complete the concrete repository work and verification first.' : 'Answer the request directly.'} Do NOT call post_message; it is intentionally unavailable. Return only the final reply as your final answer. The watcher will re-check the live thread and render it at most once.${who ? ` To mention the requester, use their exact full name "@${who}".` : ''} Use additional discovery, resources, and history when they help answer this request.`
|
|
2140
|
+
? `The watcher verified this source message is addressed to you in OpenVisio channel ${cid}${who ? ` by "${who}"` : ''}: "${text}". ${codingMention ? 'Complete the concrete repository work and verification first.' : 'Answer the request directly.'} ${channelMessaging ? 'The teammate explicitly requested a message in another channel. Use list_channels to resolve the named destination, then call post_message once with that exact channel_id. Do not substitute your dedicated or source channel for the requested destination. Return a short confirmation for the watcher to deliver in this source thread.' : 'Do NOT call post_message; it is intentionally unavailable. Return only the final reply as your final answer.'} The watcher will re-check the live thread and render it at most once.${who ? ` To mention the requester, use their exact full name "@${who}".` : ''} Use additional discovery, resources, and history when they help answer this request.`
|
|
2128
2141
|
: `The watcher verified this source message is addressed to you in OpenVisio channel ${cid}${who ? ` by "${who}"` : ''}: "${text}". ${codingMention ? `This is concrete repository work. Start the coding flow now. You may send at most one concrete progress update after work begins, but do not stop there: continue the work and then send one distinct final result with evidence or a real blocker. Use post_message for the final result even if you already sent a progress message` : 'Send EXACTLY ONE reply with post_message'}: arguments: channel_id ${cid}${threadRoot != null ? `, parent_id ${threadRoot} (reply IN THAT THREAD, do not start a new top-level message)` : ''}, using the authenticated session bridge. Never repeat the same message.${who ? ` To @mention them back, write their EXACT full name "@${who}". A mention only links when the name matches exactly.` : ''} Use additional discovery, resources, and history when they help answer this request.${codingMention ? ' Stop only after the work and final result/blocker.' : ' After your single reply, STOP.'}`
|
|
2129
2142
|
: undefined
|
|
2130
2143
|
if (ctx && creatingTicket) ctx += ' This is a ticket-creation request, not repository implementation. Discover create_ticket on the authenticated watcher server, resolve the project, board, and valid type using list_projects, list_boards, and list_task_types, then create the requested ticket once. Follow its actual schema. If a required detail is ambiguous, ask for that detail rather than inventing it. Report the returned ticket reference. Never replay a creation after a timeout or uncertain response.'
|
|
@@ -2134,7 +2147,7 @@ export function createBackendWatcher({ backend, wsUrl, apiKey, identifier, slug,
|
|
|
2134
2147
|
// pickup message; the first channel message is the verified result or a
|
|
2135
2148
|
// concrete blocker from the work lane.
|
|
2136
2149
|
void drain('full', ctx, cid == null ? [] : [cid], null, replyDelivery)
|
|
2137
|
-
} else void drain(creatingTicket ? 'coord' : 'fast', ctx, cid == null ? [] : [cid], null, replyDelivery)
|
|
2150
|
+
} else void drain(creatingTicket || channelMessaging ? 'coord' : 'fast', ctx, cid == null ? [] : [cid], null, replyDelivery)
|
|
2138
2151
|
} else if (k === 'error') {
|
|
2139
2152
|
const detail = raw && (raw.message || raw.error || raw.reason || raw.code || raw.d?.message || raw.d?.error)
|
|
2140
2153
|
log('error event: ' + (detail ? String(detail) : JSON.stringify(raw)).slice(0, 220))
|
|
@@ -2159,6 +2172,7 @@ export function createBackendWatcher({ backend, wsUrl, apiKey, identifier, slug,
|
|
|
2159
2172
|
activity.pulse()
|
|
2160
2173
|
emit('connection.connected', { status: 'connected' })
|
|
2161
2174
|
for (const wake of [...recoveryWaiters]) wake()
|
|
2175
|
+
queueMicrotask(() => { if (!stopping) void ensureSelfAgent() })
|
|
2162
2176
|
if (autoStart) setTimeout(() => { if (!stopping) void reconcileBacklog() }, 250)
|
|
2163
2177
|
}, log })
|
|
2164
2178
|
|