opencode-raven 1.2.3 → 1.2.4
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/README.md +2 -1
- package/index.ts +17 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,10 +131,11 @@ To disable an MCP entirely:
|
|
|
131
131
|
| Hook | What it does |
|
|
132
132
|
|------|--------------|
|
|
133
133
|
| `config` | Registers Raven agent, adds Context7/Exa/Grep.app MCPs, loads MCP guidance |
|
|
134
|
-
| `tool` | Registers `raven_seek` — creates Raven sessions with timeout, error recovery, and
|
|
134
|
+
| `tool` | Registers `raven_seek` — creates Raven sessions with timeout, error recovery, timing, and session tree visibility. Tracks context processed for stats (both `raven_seek` and direct `@Raven`). |
|
|
135
135
|
| `chat.message` | Tracks agent ↔ session mapping for allowlist and Raven exclusion |
|
|
136
136
|
| `command.execute.before` | Handles `/raven on\|off\|model\|effort\|timeout\|stats\|status` |
|
|
137
137
|
| `tool.execute.before` | Blocks search tools for non-Raven, non-excluded agents (respects `excludeTools`). Injects `<raven_guidance>` into subagent prompts. |
|
|
138
|
+
| `tool.execute.after` | Counts output bytes from direct `@Raven` calls for accurate stats. |
|
|
138
139
|
|
|
139
140
|
### Blocked tools (redirected except for Raven and any agents in `excludeAgents`)
|
|
140
141
|
|
package/index.ts
CHANGED
|
@@ -200,6 +200,7 @@ export default ((input: PluginInput) => {
|
|
|
200
200
|
|
|
201
201
|
let config = loadConfig()
|
|
202
202
|
const ravenSessions = new Set<string>()
|
|
203
|
+
const ravenTaskCalls = new Set<string>()
|
|
203
204
|
const sessionAgents = new Map<string, string>()
|
|
204
205
|
|
|
205
206
|
// ── Check if an agent is excluded from Raven enforcement (case-insensitive) ──
|
|
@@ -291,7 +292,10 @@ export default ((input: PluginInput) => {
|
|
|
291
292
|
try {
|
|
292
293
|
// Create a Raven session
|
|
293
294
|
const session = await client.session.create({
|
|
294
|
-
body: {
|
|
295
|
+
body: {
|
|
296
|
+
parentID: context.sessionID,
|
|
297
|
+
title: `raven_seek: ${args.query.slice(0, 80)}`,
|
|
298
|
+
},
|
|
295
299
|
})
|
|
296
300
|
|
|
297
301
|
const sessionId = (session as any)?.data?.id ?? (session as any)?.id
|
|
@@ -299,6 +303,9 @@ export default ((input: PluginInput) => {
|
|
|
299
303
|
return { title: "Raven Seek", output: "Failed to create Raven session." }
|
|
300
304
|
}
|
|
301
305
|
|
|
306
|
+
// Emit sessionId so the TUI renders a clickable delegation box
|
|
307
|
+
context.metadata({ metadata: { sessionId } })
|
|
308
|
+
|
|
302
309
|
// Log session for debugging
|
|
303
310
|
try {
|
|
304
311
|
const logFile = join(tmpdir(), "raven-sessions.log")
|
|
@@ -333,7 +340,7 @@ export default ((input: PluginInput) => {
|
|
|
333
340
|
// Track context saved
|
|
334
341
|
addBytes(output.length)
|
|
335
342
|
|
|
336
|
-
return { title: "Raven Seek", output: `${output}\n\n*Raven searched for ${elapsed}s — ${formatBytes(output.length)}, ~${formatTokens(output.length)} tokens*` }
|
|
343
|
+
return { title: "Raven Seek", metadata: { sessionId }, output: `${output}\n\n*Raven searched for ${elapsed}s — ${formatBytes(output.length)}, ~${formatTokens(output.length)} tokens*` }
|
|
337
344
|
} catch (err: any) {
|
|
338
345
|
const elapsed = ((Date.now() - started) / 1000).toFixed(1)
|
|
339
346
|
const msg = String(err?.message ?? err ?? "").toLowerCase()
|
|
@@ -422,6 +429,9 @@ export default ((input: PluginInput) => {
|
|
|
422
429
|
// ── Subagent prompt injection: inject Raven guidance into every subagent ──
|
|
423
430
|
if ((input.tool === "task" || input.tool === "subtask") && output.args) {
|
|
424
431
|
const subagentType = input.tool === "task" ? (output.args.subagent_type ?? "") : ""
|
|
432
|
+
if (subagentType === "raven") {
|
|
433
|
+
ravenTaskCalls.add(input.callID)
|
|
434
|
+
}
|
|
425
435
|
if (subagentType !== "raven" && !isExcluded(subagentType)) {
|
|
426
436
|
const field = ["prompt", "description", "request", "objective", "query"].find(
|
|
427
437
|
(f) => f in output.args
|
|
@@ -440,7 +450,11 @@ export default ((input: PluginInput) => {
|
|
|
440
450
|
},
|
|
441
451
|
|
|
442
452
|
"tool.execute.after"(input: any, output: any) {
|
|
443
|
-
|
|
453
|
+
if (ravenTaskCalls.has(input.callID)) {
|
|
454
|
+
ravenTaskCalls.delete(input.callID)
|
|
455
|
+
const outputLen = String(output.output ?? "").length
|
|
456
|
+
if (outputLen > 0) addBytes(outputLen)
|
|
457
|
+
}
|
|
444
458
|
},
|
|
445
459
|
}
|
|
446
460
|
}) satisfies Plugin
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-raven",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Search-first subagent for opencode — intercepts search tools and routes them through a hidden Raven agent with Context7, Exa AI, and Grep.app MCPs",
|
|
5
5
|
"main": "./index.ts",
|
|
6
6
|
"exports": {
|