opencode-raven 2.3.3 → 2.3.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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/raven-core.ts +25 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.3.4
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Raven Search and MCP follow-ups now validate against the calling session's project instead of the plugin's loading project, avoiding incorrect ownership rejections in OpenCode 2 while preserving parent-session and agent checks.
|
|
7
|
+
|
|
3
8
|
## 2.3.3
|
|
4
9
|
|
|
5
10
|
### Fixed
|
package/package.json
CHANGED
package/raven-core.ts
CHANGED
|
@@ -1756,17 +1756,20 @@ Then restart opencode for the model change to take effect. If the task can be co
|
|
|
1756
1756
|
return kind === "mcp" ? "Raven MCP" : "Raven Seek"
|
|
1757
1757
|
}
|
|
1758
1758
|
|
|
1759
|
-
async function
|
|
1760
|
-
let current = sessionId
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1759
|
+
async function rootSessionScope(sessionId: string, signal?: AbortSignal): Promise<{ rootId: string; projectID: string }> {
|
|
1760
|
+
let current = sessionId
|
|
1761
|
+
let projectID = input.project.id
|
|
1762
|
+
const seen = new Set<string>()
|
|
1763
|
+
while (!seen.has(current)) {
|
|
1764
|
+
seen.add(current)
|
|
1765
|
+
const response = await client.session.get({ path: { id: current }, signal })
|
|
1766
|
+
const session = (response as any)?.data ?? response
|
|
1767
|
+
// V2's plugin loading project can differ from the calling session's project.
|
|
1768
|
+
if (current === sessionId) projectID = session?.projectID ?? projectID
|
|
1769
|
+
if (!session?.parentID) return { rootId: current, projectID }
|
|
1770
|
+
current = session.parentID
|
|
1771
|
+
}
|
|
1772
|
+
return { rootId: sessionId, projectID }
|
|
1770
1773
|
}
|
|
1771
1774
|
|
|
1772
1775
|
async function syncCreatedSession(sessionId: string, title: string, signal?: AbortSignal) {
|
|
@@ -1803,9 +1806,9 @@ Then restart opencode for the model change to take effect. If the task can be co
|
|
|
1803
1806
|
return { title, output: "Cannot resume Raven: sessionId must not be empty." }
|
|
1804
1807
|
}
|
|
1805
1808
|
|
|
1806
|
-
let
|
|
1807
|
-
try {
|
|
1808
|
-
|
|
1809
|
+
let scope = { rootId: context.sessionID, projectID: input.project.id }
|
|
1810
|
+
try {
|
|
1811
|
+
scope = await rootSessionScope(context.sessionID, context.abort)
|
|
1809
1812
|
} catch (error) {
|
|
1810
1813
|
if (context.abort.aborted) throw error
|
|
1811
1814
|
// Falling back preserves delegation if an older OpenCode build cannot read the caller session.
|
|
@@ -1826,8 +1829,8 @@ Then restart opencode for the model change to take effect. If the task can be co
|
|
|
1826
1829
|
if (!existingSession?.id || existingSession.id !== requestedSessionId) {
|
|
1827
1830
|
return { title, output: `Cannot resume Raven session ${requestedSessionId}: the session was not found or could not be read.` }
|
|
1828
1831
|
}
|
|
1829
|
-
const validParent = existingSession.parentID === rootId || existingSession.parentID === context.sessionID
|
|
1830
|
-
if (!validParent || existingSession.projectID !==
|
|
1832
|
+
const validParent = existingSession.parentID === scope.rootId || existingSession.parentID === context.sessionID
|
|
1833
|
+
if (!validParent || existingSession.projectID !== scope.projectID) {
|
|
1831
1834
|
return { title, output: "Cannot resume Raven: sessionId is not part of this main session's Raven tree." }
|
|
1832
1835
|
}
|
|
1833
1836
|
|
|
@@ -1859,7 +1862,7 @@ Then restart opencode for the model change to take effect. If the task can be co
|
|
|
1859
1862
|
const sessionTitle = `${toolName}: ${args.query.slice(0, 80)}`
|
|
1860
1863
|
const session = await client.session.create({
|
|
1861
1864
|
body: {
|
|
1862
|
-
parentID: rootId,
|
|
1865
|
+
parentID: scope.rootId,
|
|
1863
1866
|
title: sessionTitle,
|
|
1864
1867
|
...(host === "v2" ? { agent } : {}),
|
|
1865
1868
|
},
|
|
@@ -2124,9 +2127,9 @@ Then restart opencode for the model change to take effect. If the task can be co
|
|
|
2124
2127
|
return { title: "Raven Seek", output: "Cannot resume Raven: sessionId must not be empty." }
|
|
2125
2128
|
}
|
|
2126
2129
|
|
|
2127
|
-
let
|
|
2128
|
-
try {
|
|
2129
|
-
|
|
2130
|
+
let scope = { rootId: context.sessionID, projectID: input.project.id }
|
|
2131
|
+
try {
|
|
2132
|
+
scope = await rootSessionScope(context.sessionID, context.abort)
|
|
2130
2133
|
} catch (error) {
|
|
2131
2134
|
if (context.abort.aborted) throw error
|
|
2132
2135
|
}
|
|
@@ -2145,7 +2148,7 @@ Then restart opencode for the model change to take effect. If the task can be co
|
|
|
2145
2148
|
if (!existingSession?.id || existingSession.id !== requestedSessionId) {
|
|
2146
2149
|
return { title: "Raven Seek", output: `Cannot resume Raven session ${requestedSessionId}: the session was not found or could not be read.` }
|
|
2147
2150
|
}
|
|
2148
|
-
if ((existingSession.parentID !== rootId && existingSession.parentID !== context.sessionID) || existingSession.projectID !==
|
|
2151
|
+
if ((existingSession.parentID !== scope.rootId && existingSession.parentID !== context.sessionID) || existingSession.projectID !== scope.projectID) {
|
|
2149
2152
|
return { title: "Raven Seek", output: "Cannot resume Raven: sessionId is not a Raven child of this main session." }
|
|
2150
2153
|
}
|
|
2151
2154
|
|
|
@@ -2177,7 +2180,7 @@ Then restart opencode for the model change to take effect. If the task can be co
|
|
|
2177
2180
|
const sessionTitle = `raven_seek: ${args.query.slice(0, 80)}`
|
|
2178
2181
|
const session = await client.session.create({
|
|
2179
2182
|
body: {
|
|
2180
|
-
parentID: rootId,
|
|
2183
|
+
parentID: scope.rootId,
|
|
2181
2184
|
title: sessionTitle,
|
|
2182
2185
|
...(host === "v2" ? { agent: "raven" } : {}),
|
|
2183
2186
|
},
|