@openviking/opencode-plugin 2026.10.13-2 → 2026.10.14

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.
@@ -17,6 +17,8 @@
17
17
  // that asks for less than a second gets a second.
18
18
  const MIN_TIMEOUT_MS = 1000;
19
19
 
20
+ import { parseExtraHeaders } from "./mcp-proxy-config.mjs";
21
+
20
22
  /**
21
23
  * The headers every harness puts on every OpenViking request.
22
24
  *
@@ -59,6 +61,12 @@ export function createOvHttp(cfg = {}, {
59
61
  } = {}) {
60
62
  // dsh and pi name this field `endpoint`; every other harness names it `baseUrl`.
61
63
  const baseUrl = cfg.baseUrl || cfg.endpoint || "";
64
+ // A caller that owns its header map passes it in; every other harness gets the
65
+ // operator's escape hatch from the environment. A deployment behind an
66
+ // authenticating gateway (Cloudflare Access, oauth2-proxy, mTLS-terminating proxy)
67
+ // needs the same headers on the turn hooks as on the MCP path, and wiring each
68
+ // harness by hand is how the header blocks drifted in the first place.
69
+ const resolvedExtraHeaders = extraHeaders ?? parseExtraHeaders(process.env.OPENVIKING_EXTRA_HEADERS);
62
70
  return async function fetchJSON(path, init = {}, options = {}) {
63
71
  const timeoutMs = Math.max(MIN_TIMEOUT_MS, Number(options.timeoutMs) || Number(defaultTimeoutMs) || 0);
64
72
  const controller = new AbortController();
@@ -72,7 +80,7 @@ export function createOvHttp(cfg = {}, {
72
80
  ...buildOvHeaders(cfg, {
73
81
  actorPeerId: options.actorPeerId ?? resolveActorPeerId(),
74
82
  identityHeaders,
75
- extraHeaders,
83
+ extraHeaders: resolvedExtraHeaders,
76
84
  }),
77
85
  ...(init.headers || {}),
78
86
  };
@@ -81,6 +89,19 @@ export function createOvHttp(cfg = {}, {
81
89
  if (!(error instanceof SyntaxError)) throw error;
82
90
  return null;
83
91
  });
92
+ const contentType = response.headers.get("content-type") || "";
93
+ if (body === null && response.ok && contentType && !/json/i.test(contentType)) {
94
+ // A 2xx that is not JSON is not OpenViking. An authenticating gateway's login
95
+ // page, a captive portal or a WAF page answers with 200 and HTML; calling that a
96
+ // success makes a harness believe it is connected while every capture and recall
97
+ // is quietly dropped.
98
+ return {
99
+ ok: false,
100
+ status: response.status,
101
+ result: null,
102
+ error: { message: `non-JSON response (${contentType})` },
103
+ };
104
+ }
84
105
  if (requireJsonBody && !body) {
85
106
  return {
86
107
  ok: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openviking/opencode-plugin",
3
- "version": "2026.10.13-2",
3
+ "version": "2026.10.14",
4
4
  "author": "@openviking",
5
5
  "description": "Unified OpenCode plugin for OpenViking repository retrieval and long-term memory",
6
6
  "type": "module",
@@ -46,5 +46,5 @@
46
46
  "code-search"
47
47
  ],
48
48
  "license": "Apache-2.0",
49
- "openvikingSourceCommit": "676c4038d95be79b91a22782c1ad1b8359a0a4e1"
49
+ "openvikingSourceCommit": "e05460914532ba0a61d7bf859fc16b95e88d2194"
50
50
  }