opencode-raven 2.1.0 → 2.1.1

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.ts +9 -5
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -591,8 +591,9 @@ export default ((input: PluginInput) => {
591
591
 
592
592
  function onDemandMcpGuidance(target: "delegate" | "raven" = "delegate"): string {
593
593
  const servers = config.onDemandMcpServers ?? {}
594
- const entries = Object.entries(servers)
595
- if (!entries.length) return "No on-demand MCPs are configured."
594
+ const entries = Object.entries(servers).filter(([name]) => onDemandMcpRuntimeStatus(name) === "ready")
595
+ if (!Object.keys(servers).length) return "No on-demand MCPs are configured."
596
+ if (!entries.length) return "No loaded on-demand MCPs are available."
596
597
 
597
598
  const detail = config.onDemandMcpDescriptionDetail ?? "full"
598
599
  const lines = entries.map(([name, server]) => {
@@ -897,6 +898,7 @@ export default ((input: PluginInput) => {
897
898
  else delete next.lastError
898
899
  mcpMetadata[name] = next
899
900
  saveMcpMetadata(mcpMetadata)
901
+ saveDynamicGuidance()
900
902
  return name
901
903
  }
902
904
 
@@ -994,7 +996,9 @@ export default ((input: PluginInput) => {
994
996
 
995
997
  function formatTokens(bytes: number): string {
996
998
  const tokens = Math.round(bytes / 4)
997
- return tokens >= 1000 ? `${(tokens / 1000).toFixed(1)}K` : `${tokens}`
999
+ return tokens >= 1_000_000 ? `${(tokens / 1_000_000).toFixed(1)}M`
1000
+ : tokens >= 1000 ? `${(tokens / 1000).toFixed(1)}K`
1001
+ : `${tokens}`
998
1002
  }
999
1003
 
1000
1004
  function compareVersions(a: string, b: string): number {
@@ -1156,8 +1160,8 @@ export default ((input: PluginInput) => {
1156
1160
  const onDemandNames = new Set(Object.keys(config.onDemandMcpServers ?? {}).map((name) => name.toLowerCase()))
1157
1161
  duplicateMcpServers = globalMcpServers.filter((name) => onDemandNames.has(name.toLowerCase()))
1158
1162
 
1159
- // Inject MCP guidance as a startup instruction file (absolute path for npm compat)
1160
- saveDynamicGuidance()
1163
+ // Inject MCP guidance as a startup instruction file (absolute path for npm compat).
1164
+ // The file is regenerated after MCP health checks, not during the startup pending reset.
1161
1165
  cleanupOldRootFiles()
1162
1166
  configInput.instructions = configInput.instructions || []
1163
1167
  if (!configInput.instructions.includes(MCP_GUIDANCE_MD)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-raven",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Raven is a context firewall for OpenCode. It routes noisy search, docs, web, GitHub, and MCP calls through a free focused agent before they hit your main model, saving cost and context!",
5
5
  "main": "./index.ts",
6
6
  "exports": {